xref: /openbmc/u-boot/doc/README.ext4 (revision 413ab5b0)
1U-Boot supports access of both ext2 and ext4 filesystems, either in read-only
2mode or in read-write mode.
3
4First, to enable support for both ext4 (and, automatically, ext2 as well),
5but without selecting the corresponding commands, use one of:
6
7  #define CONFIG_FS_EXT4	(for read-only)
8  #define CONFIG_EXT4_WRITE	(for read-write)
9
10Next, to select the ext2-related commands:
11
12  * ext2ls
13  * ext2load
14
15or ext4-related commands:
16
17  * ext4size
18  * ext4ls
19  * ext4load
20
21use one or both of:
22
23  #define CONFIG_CMD_EXT2
24  #define CONFIG_CMD_EXT4
25
26Selecting either of the above automatically defines CONFIG_FS_EXT4 if it
27wasn't defined already.
28
29In addition, to get the write access command "ext4write", use:
30
31  #define CONFIG_CMD_EXT4_WRITE
32
33which automatically defines CONFIG_EXT4_WRITE if it wasn't defined
34already.
35
36Also relevant are the generic filesystem commands, selected by:
37
38  #define CONFIG_CMD_FS_GENERIC
39
40This does not automatically enable EXT4 support for you, you still need
41to do that yourself.
42
43Some sample commands to test ext4 support:
44
451. Check that the commands can be seen in the output of U-Boot help:
46
47	UBOOT #help
48	...
49	ext4load- load binary file from a Ext4 file system
50	ext4ls  - list files in a directory (default /)
51	ext4size - determine a file's size
52	ext4write- create a file in ext4 formatted partition
53	...
54
552. To list the files in an ext4-formatted partition, run:
56
57	ext4ls <interface> <dev[:part]> [directory]
58
59	For example:
60	UBOOT #ext4ls mmc 0:5 /usr/lib
61
623. To read and load a file from an ext4-formatted partition to RAM, run:
63
64	ext4load <interface> <dev[:part]> [addr] [filename] [bytes]
65
66	For example:
67	UBOOT #ext4load mmc 2:2 0x30007fc0 uImage
68
694. To write a file to an ext4-formatted partition.
70
71	a) First load a file to RAM at a particular address for example 0x30007fc0.
72	Now execute ext4write command:
73	ext4write <interface> <dev[:part]> [filename] [Address] [sizebytes]
74
75	For example:
76	UBOOT #ext4write mmc 2:2 /boot/uImage 0x30007fc0 6183120
77	(here 6183120 is the size of the file to be written)
78	Note: Absolute path is required for the file to be written
79
80References :
81	-- ext4 implementation in Linux Kernel
82	-- Uboot existing ext2 load and ls implementation
83	-- Journaling block device JBD2 implementation in linux Kernel
84