Commit Graph

4 Commits

Author SHA1 Message Date
Simon Glass
78059b2649 linux: Update jbd2.h includes
Add includes for the new header files (blk_types.h, jiffies.h,
percpu_counter.h, spinlock.h) to jbd2.h so it can be included
standalone.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-22 05:07:01 -07:00
Simon Glass
e3f8042575 ext4l: Add inode.c to build
Add inode.c to the Makefile with minimal changes:
- Replace Linux kernel includes with ext4_uboot.h
- Add cast in ext4_inode_peek_iversion() to fix const qualifier warning
- Add __maybe_unused to variables in ext4_print_free_blocks()

Update ext4_uboot.h with additional stubs needed by inode.c:
- address_space_operations: add migrate_folio, swap_activate members,
  fix write_begin/write_end/writepages signatures
- Add buffer_migrate_folio, buffer_migrate_folio_norefs, noop_dirty_folio

Add stub functions in stub.c for inode.c dependencies:
- Inline data: ext4_try_to_write_inline_data, ext4_generic_write_inline_data,
  ext4_write_inline_data_end
- xattr: ext4_xattr_delete_inode, ext4_xattr_inode_array_free
- JBD2: jbd2_inode_cache, jbd2_journal_try_to_free_buffers,
  jbd2_journal_init_jbd_inode

Also add required stub headers:
- linux/mpage.h - multi-page I/O stub
- linux/rmap.h - reverse mapping stub
- linux/atomic.h - atomic operations stub

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-20 14:09:14 -07:00
Simon Glass
166dcda718 linux: Add compatibility headers for ext4l
Add stub headers to support ext4l filesystem compilation:

New headers:
- bit_spinlock.h: bit-based spinlock stubs
- blkdev.h: block device structures and operations
- buffer_head.h: buffer head management with state functions
- crc32c.h: CRC32C checksum stub
- fs.h: filesystem structures (super_block, inode operations)
- journal-head.h: journal buffer head structure
- mutex.h: mutex stubs

Updates to existing headers:
- compat.h: add rcu_head callback structure
- jbd2.h: add wait.h and init.h includes for types
- sched.h: add current task stub
- workqueue.h: fix flush_work macro warning

These provide the minimal Linux kernel interfaces needed for
ext4 code to compile in U-Boot's single-threaded environment.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-18 12:34:17 -07:00
Simon Glass
2442c24399 ext4l: bring in jbd2 header file
Copy include/linux/jbd2.h from Linux v6.18. This header defines the
JBD2 journaling layer interface used by ext4.

Series-to: concept
Cover-letter:
ext4l: Begin an implementation of ext4 based on Linux
U-Boot has long had a solid implementation of ext4. Support for writing
and basic journaling was added as well.

However, there are some missing features. For example, some distros
enable metadata checksums which are not supported. There also also other
features such as fast commit and special feature for small files which
are not currently available.

Linux has the canonical implementation of ext4, so one approach would be
to plumb that code into U-Boot. It is not a small undertaking, since the
existing linux/compat.h has only a small fraction of the required
features.

As a start towards this effort, bring in the entire Linux code,
unmodified.

Note: There are 1000s of checkpatch checks and warnings, plus over 100
errors. These have been left along to reduce the source delta.
END

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-16 13:19:59 +00:00