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