blob: 2b0eab5ddec3170800cf0e34f3b34f568a3d6df3 [file] [log] [blame]
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -04001U-Boot supports access of both ext2 and ext4 filesystems, either in read-only
2mode or in read-write mode.
Uma Shankara74a99a2012-05-25 21:22:49 +05303
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -04004First, to enable support for both ext4 (and, automatically, ext2 as well),
5but without selecting the corresponding commands, use one of:
Stephen Warren4f8662d2012-10-22 06:43:50 +00006
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -04007 #define CONFIG_FS_EXT4 (for read-only)
8 #define CONFIG_EXT4_WRITE (for read-write)
Stephen Warren4f8662d2012-10-22 06:43:50 +00009
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -040010Next, to select the ext2-related commands:
Uma Shankara74a99a2012-05-25 21:22:49 +053011
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -040012 * ext2ls
13 * ext2load
Uma Shankara74a99a2012-05-25 21:22:49 +053014
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -040015or ext4-related commands:
Stephen Warren4f8662d2012-10-22 06:43:50 +000016
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -040017 * ext4size
18 * ext4ls
19 * ext4load
Uma Shankara74a99a2012-05-25 21:22:49 +053020
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -040021use one or both of:
Uma Shankara74a99a2012-05-25 21:22:49 +053022
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -040023 #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.
Uma Shankara74a99a2012-05-25 21:22:49 +053035
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -040036Also 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 ...
Wolfgang Denkec7fbf52013-10-04 17:43:24 +020049 ext4load- load binary file from a Ext4 file system
50 ext4ls - list files in a directory (default /)
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -040051 ext4size - determine a file's size
Wolfgang Denkec7fbf52013-10-04 17:43:24 +020052 ext4write- create a file in ext4 formatted partition
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -040053 ...
Uma Shankara74a99a2012-05-25 21:22:49 +053054
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -0400552. To list the files in an ext4-formatted partition, run:
56
Wolfgang Denkec7fbf52013-10-04 17:43:24 +020057 ext4ls <interface> <dev[:part]> [directory]
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -040058
Wolfgang Denkec7fbf52013-10-04 17:43:24 +020059 For example:
60 UBOOT #ext4ls mmc 0:5 /usr/lib
Uma Shankara74a99a2012-05-25 21:22:49 +053061
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -0400623. To read and load a file from an ext4-formatted partition to RAM, run:
63
Wolfgang Denkec7fbf52013-10-04 17:43:24 +020064 ext4load <interface> <dev[:part]> [addr] [filename] [bytes]
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -040065
Wolfgang Denkec7fbf52013-10-04 17:43:24 +020066 For example:
67 UBOOT #ext4load mmc 2:2 0x30007fc0 uImage
Uma Shankara74a99a2012-05-25 21:22:49 +053068
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -0400694. To write a file to an ext4-formatted partition.
70
Wolfgang Denkec7fbf52013-10-04 17:43:24 +020071 a) First load a file to RAM at a particular address for example 0x30007fc0.
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -040072 Now execute ext4write command:
Wolfgang Denkec7fbf52013-10-04 17:43:24 +020073 ext4write <interface> <dev[:part]> [filename] [Address] [sizebytes]
Robert P. J. Dayc1c22ce2016-04-13 18:30:16 -040074
Wolfgang Denkec7fbf52013-10-04 17:43:24 +020075 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
Uma Shankara74a99a2012-05-25 21:22:49 +053079
80References :
81 -- ext4 implementation in Linux Kernel
82 -- Uboot existing ext2 load and ls implementation
83 -- Journaling block device JBD2 implementation in linux Kernel