Skip to contentSkip to conversation

Add ext4 filesystem support in uboot

U-Boot New uma.shankar at samsung.com 5 participants 12 messages Dec 15, 2011 – May 25, 2012

lore
Share & tools
lore
#1 lore raw

cover *** Add ext4 filesystem support in uboot ***

From: Uma Shankar <[email protected]>

***
This patch series adds support for ext4 ls,load and write features in uboot Journaling is supported for write feature.

To Enable EXT4 commands, modify the board specific config file with #define CONFIG_CMD_EXT2 1
#define CONFIG_CMD_EXT4 1
Steps to test:

1. After applying the patch, ext4 specific commands can be seen in the boot loader prompt using
UBOOT #help

ext4load- load binary file from a Ext4 file system ext4ls - list files in a directory (default /) ext4write- create a file in ext4 formatted partition

2. To list the files in ext4 formatted partition, execute ext4ls <interface> <dev[:part]> [directory] For example:
UBOOT #ext4ls mmc 0:5 /usr/lib

3. To read and load a file from an ext4 formatted partition to RAM, execute

	ext4load <interface> <dev[:part]> [addr] [filename] [bytes]
	For example:
	UBOOT #ext4load mmc 2:2 0x30007fc0 uImage

4. To write a file to a ext4 formatted partition.
a) First load a file to RAM at a particular address for example 0x30007fc0. Now execute ext4write command
ext4write <interface> <dev[:part]> [filename] [Address] [sizebytes] For example:
UBOOT #ext4write mmc 2:2 /boot/uImage 0x30007fc0 6183120
(here 6183120 is the size of the file to be written)
Note: Absolute path is required for the file to be written

***

Uma Shankar (2):
ext4fs ls load support
ext4fs write support

 Makefile               |    2 +-
 common/Makefile        |    1 +
 common/cmd_ext2.c      |    1 +
 common/cmd_ext4.c      |  388 ++++++++++
 fs/Makefile            |    1 +
 fs/ext2/dev.c          |    1 +
 fs/ext2/ext2fs.c       |  340 +--------
 fs/ext4/Makefile       |   51 ++
 fs/ext4/crc16.c        |   62 ++
 fs/ext4/crc16.h        |   16 +
 fs/ext4/ext4_common.c  | 1955 ++++++++++++++++++++++++++++++++++++++++++++++++
 fs/ext4/ext4_common.h  |   61 ++
 fs/ext4/ext4_journal.c |  650 ++++++++++++++++
 fs/ext4/ext4_journal.h |  147 ++++
 fs/ext4/ext4fs.c       | 1251 +++++++++++++++++++++++++++++++
 include/ext2fs.h       |   16 +-
 include/ext4fs.h       |  124 +++
 include/ext_common.h   |  199 +++++
 18 files changed, 4942 insertions(+), 324 deletions(-)
 create mode 100644 common/cmd_ext4.c
 create mode 100644 fs/ext4/Makefile
 create mode 100644 fs/ext4/crc16.c
 create mode 100644 fs/ext4/crc16.h
 create mode 100644 fs/ext4/ext4_common.c
 create mode 100644 fs/ext4/ext4_common.h
 create mode 100644 fs/ext4/ext4_journal.c
 create mode 100644 fs/ext4/ext4_journal.h
 create mode 100644 fs/ext4/ext4fs.c
 create mode 100644 include/ext4fs.h
 create mode 100644 include/ext_common.h
#2 lore raw

cover *** Add ext4 filesystem support in uboot ***

Dear uma.shankar at samsung.com,

Quoted 9 lines · In message <[email protected]> you…

From: Uma Shankar <[email protected]>

***
This patch series adds support for ext4 ls,load and write features in uboot Journaling is supported for write feature.

To Enable EXT4 commands, modify the board specific config file with #define CONFIG_CMD_EXT2 1
#define CONFIG_CMD_EXT4 1

No. This selects a feature only, so a plain #define without any value should be used.

Quoted 9 lines

Steps to test:

1. After applying the patch, ext4 specific commands can be seen in the boot loader prompt using
UBOOT #help

ext4load- load binary file from a Ext4 file system ext4ls - list files in a directory (default /) ext4write- create a file in ext4 formatted partition

Could you please add these explanations as doc/README.ext4 so they don't get lost?

Thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
No one may kill a man.  Not for any purpose.  It cannot be condoned.
	-- Kirk, "Spock's Brain", stardate 5431.6
#3 lore raw

[U-Boot] Add ext4 write support

In reply to uma.shankar at samsung.com

We are still keeping crc16.c file in fs/ext4 because the lib/crc16.c file ( Poly - x^16 + x^12 + x^5 + 1) is not compatible with Linux kernel crc implementation (Poly - x^16 + x^15 + x^2 + 1). Also, fs/ubifs/crc16.c is also giving some errors. Kernel does not mount the partition if we use this particular crc file. Hence, we are keeping the existing crc16.c.

We have also added a README file in fs/ext4/ folder with steps to test the uboot ext4 feature.

Thanks to Wolfgang Denk, Kim Phillips, Graeme Russ and Mike Frysinger for your valuable suggestions and review comments.

Thanks & Regards,
Uma Shankar
Manjunatha C Achar

#4 lore raw

v3 cover *** Add ext4 filesystem support in uboot ***

From: Uma Shankar <[email protected]>

***
This patch series adds support for ext4 ls,load and write features in uboot Journaling is supported for write feature.

To Enable ext4 ls and load commands, modify the board specific config file with #define CONFIG_CMD_EXT2
#define CONFIG_CMD_EXT4

To enable ext4 write command, modify the board specific config file with #define CONFIG_CMD_EXT2
#define CONFIG_CMD_EXT4
#define CONFIG_CMD_EXT4_WRITE
Steps to test:

1. After applying the patch, ext4 specific commands can be seen in the boot loader prompt using
UBOOT #help

ext4load- load binary file from a Ext4 file system ext4ls - list files in a directory (default /) ext4write- create a file in ext4 formatted partition

2. To list the files in ext4 formatted partition, execute ext4ls <interface> <dev[:part]> [directory] For example:
UBOOT #ext4ls mmc 0:5 /usr/lib

3. To read and load a file from an ext4 formatted partition to RAM, execute ext4load <interface> <dev[:part]> [addr] [filename] [bytes] For example:
UBOOT #ext4load mmc 2:2 0x30007fc0 uImage

4. To write a file to a ext4 formatted partition.
a) First load a file to RAM at a particular address for example 0x30007fc0. Now execute ext4write command
ext4write <interface> <dev[:part]> [filename] [Address] [sizebytes] For example:
UBOOT #ext4write mmc 2:2 /boot/uImage 0x30007fc0 6183120
(here 6183120 is the size of the file to be written)
Note: Absolute path is required for the file to be written

***

Uma Shankar (2):
ext4fs ls load support
ext4fs write support

Changes for v2:
- Code cleanup, changed comment style
- camel case removed, resolved code alignment issues
- memory allocation logic changed, removed busybox logic
- Modified ext4 load to remove grub dependency (GPLv3)
- Introduced new Config for ext4 write

Changes for v1:
- Removed checkpatch warnings and errors
- Moved common API's of ext2 and ext4 to one generic header file

 Makefile               |    2 +-
 common/Makefile        |    1 +
 common/cmd_ext2.c      |    1 +
 common/cmd_ext4.c      |  390 ++++++++++
 fs/Makefile            |    1 +
 fs/ext2/dev.c          |    1 +
 fs/ext2/ext2fs.c       |  340 +--------
 fs/ext4/Makefile       |   52 ++
 fs/ext4/README         |   46 ++
 fs/ext4/crc16.c        |   62 ++
 fs/ext4/crc16.h        |   16 +
 fs/ext4/ext4_common.c  | 1945 ++++++++++++++++++++++++++++++++++++++++++++++++
 fs/ext4/ext4_common.h  |   68 ++
 fs/ext4/ext4_journal.c |  662 ++++++++++++++++
 fs/ext4/ext4_journal.h |  147 ++++
 fs/ext4/ext4fs.c       | 1191 +++++++++++++++++++++++++++++
 include/ext2fs.h       |   16 +-
 include/ext4fs.h       |  145 ++++
 include/ext_common.h   |  198 +++++
 19 files changed, 4960 insertions(+), 324 deletions(-)
 create mode 100644 common/cmd_ext4.c
 create mode 100644 fs/ext4/Makefile
 create mode 100644 fs/ext4/README
 create mode 100644 fs/ext4/crc16.c
 create mode 100644 fs/ext4/crc16.h
 create mode 100644 fs/ext4/ext4_common.c
 create mode 100644 fs/ext4/ext4_common.h
 create mode 100644 fs/ext4/ext4_journal.c
 create mode 100644 fs/ext4/ext4_journal.h
 create mode 100644 fs/ext4/ext4fs.c
 create mode 100644 include/ext4fs.h
 create mode 100644 include/ext_common.h
#5 lore raw

[U-Boot] Add ext4 write support

In reply to uma.shankar at samsung.com

Hi All,
We have resolved the coding style issues and updated the copyrights correctly in the respective header files. Ext4fs code has been made independant of ext2 code. A separate config CONFIG_CMD_EXT4 is provided for ext4ls and load, also CONFIG_CMD_EXT4_WRITE for ext4 write feature.

We are still keeping crc16.c file in fs/ext4 because the lib/crc16.c file ( Poly - x^16 + x^12 + x^5 + 1) is not compatible with Linux kernel crc implementation (Poly - x^16 + x^15 + x^2 + 1). Also, fs/ubifs/crc16.c is also giving some errors. Kernel does not mount the partition if we use this particular crc file. Hence, we are keeping the existing crc16.c file.

We have also added a README.ext4 file in doc/ folder with steps to test the uboot ext4 feature.

Thanks to Wolfgang Denk, Kim Phillips, Graeme Russ and Mike Frysinger for your valuable suggestions and review comments.

Thanks & Regards,
Uma Shankar
Manjunatha C Achar

#6 lore raw

v4 cover *** Add ext4 filesystem support in uboot ***

From: uma.shankar <[email protected]>

***
This patch series adds support for ext4 ls,load and write features in uboot Journaling is supported for write feature.

To Enable ext4 ls and load commands, modify the board specific config file with #define CONFIG_CMD_EXT4

To enable ext4 write command, modify the board specific config file with #define CONFIG_CMD_EXT4_WRITE

Steps to test:

1. After applying the patch, ext4 specific commands can be seen in the boot loader prompt using
UBOOT #help

ext4load- load binary file from a Ext4 file system ext4ls - list files in a directory (default /) ext4write- create a file in ext4 formatted partition

2. To list the files in ext4 formatted partition, execute ext4ls <interface> <dev[:part]> [directory] For example:
UBOOT #ext4ls mmc 0:5 /usr/lib

3. To read and load a file from an ext4 formatted partition to RAM, execute ext4load <interface> <dev[:part]> [addr] [filename] [bytes] For example:
UBOOT #ext4load mmc 2:2 0x30007fc0 uImage

4. To write a file to a ext4 formatted partition.
a) First load a file to RAM at a particular address for example 0x30007fc0. Now execute ext4write command
ext4write <interface> <dev[:part]> [filename] [Address] [sizebytes] For example:
UBOOT #ext4write mmc 2:2 /boot/uImage 0x30007fc0 6183120
(here 6183120 is the size of the file to be written)
Note: Absolute path is required for the file to be written

***

uma.shankar (2):
ext4fs ls load support
ext4fs write support

Changes for v3:
- Copyright has been updated in respective files
- ext4fs has been made independant of ext2fs.c
- Fixed API namespace
- Removed endianness conversion API, used uboot defined API for the same
- Fixed coding style issues
- Moved README.ext4 file into doc folder

Changes for v2:
- Code cleanup, changed comment style
- camel case removed, resolved code alignment issues
- memory allocation logic changed, removed busybox logic
- Modified ext4 load to remove grub dependency (GPLv3)
- Introduced new Config for ext4 write

Changes for v1:
- Removed checkpatch warnings and errors
- Moved common API's of ext2 and ext4 to one generic header file

 Makefile               |    2 +-
 common/Makefile        |    4 +
 common/cmd_ext4.c      |  407 +++++++++
 doc/README.ext4        |   43 +
 fs/Makefile            |    1 +
 fs/ext2/dev.c          |    1 +
 fs/ext2/ext2fs.c       |  181 +----
 fs/ext4/Makefile       |   55 ++
 fs/ext4/crc16.c        |   62 ++
 fs/ext4/crc16.h        |   16 +
 fs/ext4/dev.c          |  145 ++++
 fs/ext4/ext4_common.c  | 2221 ++++++++++++++++++++++++++++++++++++++++++++++++
 fs/ext4/ext4_common.h  |   88 ++
 fs/ext4/ext4_journal.c |  666 +++++++++++++++
 fs/ext4/ext4_journal.h |  141 +++
 fs/ext4/ext4fs.c       | 1188 ++++++++++++++++++++++++++
 include/ext4fs.h       |  144 ++++
 include/ext_common.h   |  188 ++++
 18 files changed, 5396 insertions(+), 157 deletions(-)
 create mode 100644 common/cmd_ext4.c
 create mode 100644 doc/README.ext4
 create mode 100644 fs/ext4/Makefile
 create mode 100644 fs/ext4/crc16.c
 create mode 100644 fs/ext4/crc16.h
 create mode 100644 fs/ext4/dev.c
 create mode 100644 fs/ext4/ext4_common.c
 create mode 100644 fs/ext4/ext4_common.h
 create mode 100644 fs/ext4/ext4_journal.c
 create mode 100644 fs/ext4/ext4_journal.h
 create mode 100644 fs/ext4/ext4fs.c
 create mode 100644 include/ext4fs.h
 create mode 100644 include/ext_common.h
#7 lore raw

[U-Boot] Add ext4 write support

In reply to uma.shankar at samsung.com
Quoted 2 lines · On Mon, 9 Jan 2012 23:21:40 +0530 <[email protected]> wrote:

We are still keeping crc16.c file in fs/ext4 because the lib/crc16.c file ( Poly - x^16 + x^12 + x^5 + 1) is not compatible with Linux kernel crc implementation (Poly - x^16 + x^15 + x^2 + 1).

I see that now - lib/crc16.c implements the CCITT version, whereas it appears filesystems use the IBM/ANSI polynomials.

Quoted 2 lines

Also, fs/ubifs/crc16.c
is also giving some errors.

strange - ubifs uses the same polynomial. I diffed fs/ubifs/crc16.c and linux' lib/crc16.c, and found no difference in the table. Is there a possibility of an endianness problem, or that the test was based on data a prior CCITT test wrote?

Quoted 2 lines

Kernel does not mount the partition if we use this particular crc file. Hence, we are keeping the existing crc16.c file.

setting the standard for new filesystem implementations to do the same?

The implementations should be cleaned up before too many duplications occur - linux calls the IBM/ANSI version plain 'crc16', and the CCITT version crc-ccitt (linux/lib/crc-ccitt.c). Is it possible instead to move u-boot's ubifs implementation into lib/crc16.c, and the current u-boot lib/crc16.c be renamed lib/crc-ccitt.c?

Thanks,

Kim

[1] http://en.wikipedia.org/wiki/Crc16

#8 lore raw

[U-Boot] Add ext4 write support

Quoted 7 lines · On Monday 09 January 2012 21:30:41 Kim Phillips wrote:
Quoted 2 lines · On Mon, 9 Jan 2012 23:21:40 +0530 uma shankar wrote:

Kernel does not mount the partition if we use this particular crc file. Hence, we are keeping the existing crc16.c file.

setting the standard for new filesystem implementations to do the same?

Quoted 6 lines

The implementations should be cleaned up before too many duplications occur - linux calls the IBM/ANSI version plain 'crc16', and the CCITT version crc-ccitt (linux/lib/crc-ccitt.c). Is it possible instead to move u-boot's ubifs implementation into lib/crc16.c, and the current u-boot lib/crc16.c be renamed lib/crc-ccitt.c?

this sounds good to me
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120115/dfc0e5fc/attachment.pgp>

#9 lore raw

[U-Boot] Add ext4 write support

In reply to uma.shankar at samsung.com

Hi All,
We have resolved the review comments received for uboot ext4 feature.
Ext4 code is based on existing ext2 implementation in uboot, and is capable to ls, load ext2 partitions as well. Hence we have removed the ext2 folder from fs folder and will maintain one ext4 directory. Since ext4 is based on ext2, all ext2 developers name has been added to the respective file headers

To make the command line interface clean, we are maintaining cmd_ext2.c and cmd_ext4.c files. They will act as a wrapper and a new file cmd_ext_common.c is introduced which will act as an interface file with ext4 directory.

Hence, it will avoid lot of code duplicacy and also will maintain a cleaner command interface.
Also, the current ext4 ls and load is optimized and around 10 times faster than the existing ext2 ls and load in uboot.

Thanks to Wolfgang Denk, Kim Phillips, Graeme Russ, Rob and Mike Frysinger for your valuable suggestions and review comments.

Thanks & Regards,
Uma Shankar
Manjunatha C Achar

#10 lore raw

v5 cover *** Add ext4 filesystem support in uboot ***

In reply to uma.shankar at samsung.com

***
This patch series adds support for ext4 ls,load and write features in uboot Journaling is supported for write feature.

To Enable ext2 ls and load commands, modify the board specific config file with #define CONFIG_CMD_EXT2

To Enable ext4 ls and load commands, modify the board specific config file with #define CONFIG_CMD_EXT4

To enable ext4 write command, modify the board specific config file with #define CONFIG_CMD_EXT4
#define CONFIG_CMD_EXT4_WRITE

Steps to test:

1. After applying the patch, ext4 specific commands can be seen in the boot loader prompt using
UBOOT #help

ext4load- load binary file from a Ext4 file system ext4ls - list files in a directory (default /) ext4write- create a file in ext4 formatted partition

2. To list the files in ext4 formatted partition, execute ext4ls <interface> <dev[:part]> [directory] For example:
UBOOT #ext4ls mmc 0:5 /usr/lib

3. To read and load a file from an ext4 formatted partition to RAM, execute ext4load <interface> <dev[:part]> [addr] [filename] [bytes] For example:
UBOOT #ext4load mmc 2:2 0x30007fc0 uImage

4. To write a file to a ext4 formatted partition.
a) First load a file to RAM at a particular address for example 0x30007fc0. Now execute ext4write command
ext4write <interface> <dev[:part]> [filename] [Address] [sizebytes] For example:
UBOOT #ext4write mmc 2:2 /boot/uImage 0x30007fc0 6183120
(here 6183120 is the size of the file to be written)
Note: Absolute path is required for the file to be written

***

Uma Shankar (2):
ext4fs ls load support
ext4fs write support

Changes for v4:
- Redesigned ext2, ext4 command interface
- Removed ext2 folder from fs/
- Memory Leak issue handled

Changes for v3:
- Copyright has been updated in respective files
- ext4fs has been made independant of ext2fs.c
- Fixed API namespace
- Removed endianness conversion API, used uboot defined API for the same
- Fixed coding style issues
- Moved README.ext4 file into doc folder

Changes for v2:
- Code cleanup, changed comment style
- camel case removed, resolved code alignment issues
- memory allocation logic changed, removed busybox logic
- Modified ext4 load to remove grub dependency (GPLv3)
- Introduced new Config for ext4 write

Changes for v1:
- Removed checkpatch warnings and errors
- Moved common API's of ext2 and ext4 to one generic header file

 Makefile                   |    2 +-
 common/Makefile            |    6 +
 common/cmd_ext2.c          |  219 +----
 common/cmd_ext4.c          |  237 +++++
 common/cmd_ext_common.c    |  259 +++++
 doc/README.ext4            |   46 +
 fs/Makefile                |    5 +-
 fs/ext2/dev.c              |  131 ---
 fs/ext2/ext2fs.c           |  897 ------------------
 fs/{ext2 => ext4}/Makefile |    9 +-
 fs/ext4/crc16.c            |   62 ++
 fs/ext4/crc16.h            |   16 +
 fs/ext4/dev.c              |  145 +++
 fs/ext4/ext4_common.c      | 2228 ++++++++++++++++++++++++++++++++++++++++++++
 fs/ext4/ext4_common.h      |   88 ++
 fs/ext4/ext4_journal.c     |  667 +++++++++++++
 fs/ext4/ext4_journal.h     |  141 +++
 fs/ext4/ext4fs.c           | 1189 +++++++++++++++++++++++
 include/ext2fs.h           |   81 --
 include/ext4fs.h           |  144 +++
 include/ext_common.h       |  199 ++++
 21 files changed, 5455 insertions(+), 1316 deletions(-)
 create mode 100644 common/cmd_ext4.c
 create mode 100644 common/cmd_ext_common.c
 create mode 100644 doc/README.ext4
 delete mode 100644 fs/ext2/dev.c
 delete mode 100644 fs/ext2/ext2fs.c
 rename fs/{ext2 => ext4}/Makefile (86%)
 create mode 100644 fs/ext4/crc16.c
 create mode 100644 fs/ext4/crc16.h
 create mode 100644 fs/ext4/dev.c
 create mode 100644 fs/ext4/ext4_common.c
 create mode 100644 fs/ext4/ext4_common.h
 create mode 100644 fs/ext4/ext4_journal.c
 create mode 100644 fs/ext4/ext4_journal.h
 create mode 100644 fs/ext4/ext4fs.c
 delete mode 100644 include/ext2fs.h
 create mode 100644 include/ext4fs.h
 create mode 100644 include/ext_common.h
#11 lore raw

v5 cover *** Add ext4 filesystem support in uboot ***

Quoted 43 lines · Uma Shankar

***
This patch series adds support for ext4 ls,load and write features in uboot Journaling is supported for write feature.

To Enable ext2 ls and load commands, modify the board specific config file with #define CONFIG_CMD_EXT2

To Enable ext4 ls and load commands, modify the board specific config file with #define CONFIG_CMD_EXT4

To enable ext4 write command, modify the board specific config file with #define CONFIG_CMD_EXT4
#define CONFIG_CMD_EXT4_WRITE

Steps to test:

1. After applying the patch, ext4 specific commands can be seen in the boot loader prompt using
UBOOT #help

ext4load- load binary file from a Ext4 file system ext4ls - list files in a directory (default /) ext4write- create a file in ext4 formatted partition

2. To list the files in ext4 formatted partition, execute ext4ls <interface> <dev[:part]> [directory] For example:
UBOOT #ext4ls mmc 0:5 /usr/lib

3. To read and load a file from an ext4 formatted partition to RAM, execute ext4load <interface> <dev[:part]> [addr] [filename] [bytes] For example:
UBOOT #ext4load mmc 2:2 0x30007fc0 uImage

4. To write a file to a ext4 formatted partition.
a) First load a file to RAM at a particular address for example 0x30007fc0. Now execute ext4write command
ext4write <interface> <dev[:part]> [filename] [Address] [sizebytes] For example:
UBOOT #ext4write mmc 2:2 /boot/uImage 0x30007fc0 6183120
(here 6183120 is the size of the file to be written)
Note: Absolute path is required for the file to be written

Quoted 1 line

***

FYI, in the prior version, I'm seeing some issues with reading sub-directories on ext4 filesystem. When doing an ls some directories are present, but have a size of 0 and can't be listed. In Linux, they are fine.

Rob