Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 1 | U-Boot supports access of both ext2 and ext4 filesystems, either in read-only |
| 2 | mode or in read-write mode. |
Uma Shankar | ed34f34 | 2012-05-25 21:22:49 +0530 | [diff] [blame] | 3 | |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 4 | First, to enable support for both ext4 (and, automatically, ext2 as well), |
Tuomas Tynkkynen | 3d22bae | 2018-01-05 02:45:17 +0200 | [diff] [blame] | 5 | but without selecting the corresponding commands, enable one of the following: |
Stephen Warren | 03e2ecf | 2012-10-22 06:43:50 +0000 | [diff] [blame] | 6 | |
Tuomas Tynkkynen | 3d22bae | 2018-01-05 02:45:17 +0200 | [diff] [blame] | 7 | CONFIG_FS_EXT4 (for read-only) |
| 8 | CONFIG_EXT4_WRITE (for read-write) |
Stephen Warren | 03e2ecf | 2012-10-22 06:43:50 +0000 | [diff] [blame] | 9 | |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 10 | Next, to select the ext2-related commands: |
Uma Shankar | ed34f34 | 2012-05-25 21:22:49 +0530 | [diff] [blame] | 11 | |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 12 | * ext2ls |
| 13 | * ext2load |
Uma Shankar | ed34f34 | 2012-05-25 21:22:49 +0530 | [diff] [blame] | 14 | |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 15 | or ext4-related commands: |
Stephen Warren | 03e2ecf | 2012-10-22 06:43:50 +0000 | [diff] [blame] | 16 | |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 17 | * ext4size |
| 18 | * ext4ls |
| 19 | * ext4load |
Uma Shankar | ed34f34 | 2012-05-25 21:22:49 +0530 | [diff] [blame] | 20 | |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 21 | use one or both of: |
Uma Shankar | ed34f34 | 2012-05-25 21:22:49 +0530 | [diff] [blame] | 22 | |
Tuomas Tynkkynen | 3d22bae | 2018-01-05 02:45:17 +0200 | [diff] [blame] | 23 | CONFIG_CMD_EXT2 |
| 24 | CONFIG_CMD_EXT4 |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 25 | |
Tuomas Tynkkynen | 3d22bae | 2018-01-05 02:45:17 +0200 | [diff] [blame] | 26 | Selecting either of the above automatically selects CONFIG_FS_EXT4 if it |
| 27 | wasn't enabled already. |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 28 | |
Tuomas Tynkkynen | 3d22bae | 2018-01-05 02:45:17 +0200 | [diff] [blame] | 29 | In addition, to get the write access command "ext4write", enable: |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 30 | |
Tuomas Tynkkynen | 3d22bae | 2018-01-05 02:45:17 +0200 | [diff] [blame] | 31 | CONFIG_CMD_EXT4_WRITE |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 32 | |
Tuomas Tynkkynen | 3d22bae | 2018-01-05 02:45:17 +0200 | [diff] [blame] | 33 | which automatically selects CONFIG_EXT4_WRITE if it wasn't defined |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 34 | already. |
| 35 | |
| 36 | Also relevant are the generic filesystem commands, selected by: |
| 37 | |
Tuomas Tynkkynen | 3d22bae | 2018-01-05 02:45:17 +0200 | [diff] [blame] | 38 | CONFIG_CMD_FS_GENERIC |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 39 | |
| 40 | This does not automatically enable EXT4 support for you, you still need |
| 41 | to do that yourself. |
| 42 | |
| 43 | Some sample commands to test ext4 support: |
| 44 | |
| 45 | 1. Check that the commands can be seen in the output of U-Boot help: |
| 46 | |
Wolfgang Denk | 93e1459 | 2013-10-04 17:43:24 +0200 | [diff] [blame] | 47 | UBOOT #help |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 48 | ... |
Wolfgang Denk | 93e1459 | 2013-10-04 17:43:24 +0200 | [diff] [blame] | 49 | ext4load- load binary file from a Ext4 file system |
| 50 | ext4ls - list files in a directory (default /) |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 51 | ext4size - determine a file's size |
Wolfgang Denk | 93e1459 | 2013-10-04 17:43:24 +0200 | [diff] [blame] | 52 | ext4write- create a file in ext4 formatted partition |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 53 | ... |
Uma Shankar | ed34f34 | 2012-05-25 21:22:49 +0530 | [diff] [blame] | 54 | |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 55 | 2. To list the files in an ext4-formatted partition, run: |
| 56 | |
Wolfgang Denk | 93e1459 | 2013-10-04 17:43:24 +0200 | [diff] [blame] | 57 | ext4ls <interface> <dev[:part]> [directory] |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 58 | |
Wolfgang Denk | 93e1459 | 2013-10-04 17:43:24 +0200 | [diff] [blame] | 59 | For example: |
| 60 | UBOOT #ext4ls mmc 0:5 /usr/lib |
Uma Shankar | ed34f34 | 2012-05-25 21:22:49 +0530 | [diff] [blame] | 61 | |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 62 | 3. To read and load a file from an ext4-formatted partition to RAM, run: |
| 63 | |
Wolfgang Denk | 93e1459 | 2013-10-04 17:43:24 +0200 | [diff] [blame] | 64 | ext4load <interface> <dev[:part]> [addr] [filename] [bytes] |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 65 | |
Wolfgang Denk | 93e1459 | 2013-10-04 17:43:24 +0200 | [diff] [blame] | 66 | For example: |
| 67 | UBOOT #ext4load mmc 2:2 0x30007fc0 uImage |
Uma Shankar | ed34f34 | 2012-05-25 21:22:49 +0530 | [diff] [blame] | 68 | |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 69 | 4. To write a file to an ext4-formatted partition. |
| 70 | |
Wolfgang Denk | 93e1459 | 2013-10-04 17:43:24 +0200 | [diff] [blame] | 71 | a) First load a file to RAM at a particular address for example 0x30007fc0. |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 72 | Now execute ext4write command: |
Wolfgang Denk | 93e1459 | 2013-10-04 17:43:24 +0200 | [diff] [blame] | 73 | ext4write <interface> <dev[:part]> [filename] [Address] [sizebytes] |
Robert P. J. Day | 28983f4 | 2016-04-13 18:30:16 -0400 | [diff] [blame] | 74 | |
Wolfgang Denk | 93e1459 | 2013-10-04 17:43:24 +0200 | [diff] [blame] | 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 |
Uma Shankar | ed34f34 | 2012-05-25 21:22:49 +0530 | [diff] [blame] | 79 | |
| 80 | References : |
| 81 | -- ext4 implementation in Linux Kernel |
| 82 | -- Uboot existing ext2 load and ls implementation |
| 83 | -- Journaling block device JBD2 implementation in linux Kernel |