[U-Boot] ext2fs.c/ext2fs_mount() fails when inode_size = 256

Our SBC have been happily booting uClinux from ext3 partitioned SD cards prepared on a Fedora Linux-2.6.15 PC.
But, when we prepared our 2GB SD cards on a brand new Ubuntu Linux-2.6.27 PC, out SBCs were no longer able to find /boot/linux.bin.
Linux/dumpe2fs showed that the bootable [Fedora] 2GB SD cards had inode_size = 128, whereas the delinquent [Ubuntu] SD cards had inode_size = 256. Adding a "-I 128" switch to mkfs.ext3 in the script that prepares an loads the SD cards solved the problem. That is, our SBCs can now boot from Ubuntu prepared SD cards. However, this brings up the point that, somewhere along the line, the default inode_size for SD cards is no longer 128 bytes. It could be double, quadruple or more.
There is some suspicious code in ext2fs.c/ext2fs_mount():
inodes_per_block = EXT2_BLOCK_SIZE (data) / 128;
However, when this was replaced by
inodes_per_block = EXT2_BLOCK_SIZE (data) / INODE_SIZE(data);
..the 2GB/128 byte inode SD cards booted and the 2GB/256 byte inode SD cards didn't.
When reading a 2GB/256 byte inode card, ext2fs_mount()/ext2fs_read_inode(data, 2, data->inode) returns data->inode filled with zeros. Either there is a flaw in data or data is not being interpreted correctly. Regrettably, the root problem eludes me.
Any thoughts or comments would be appreciated.
Bob Furber

Dear Bob Furber,
In message 4A82EB38.6060802@steroidmicros.com you wrote:
Our SBC have been happily booting uClinux from ext3 partitioned SD cards prepared on a Fedora Linux-2.6.15 PC.
...
Any thoughts or comments would be appreciated.
You failed to mention some really important fects, like for example which version of U-Boot you are using.
Me deems that it must be an old one.
This commit most probably fixes your issue:
commit 56fdaadc124a8ef9ec0fd8ff578233ec3b1137be Author: Weirich, Bernhard Bernhard.Weirich@riedel.net Date: Wed Jun 10 14:00:37 2009 +0200
ext2: fix inode size and calculations
Signed-off-by: unsik Kim donari75@gmail.com Signed-off-by: Bernhard Weirich bernhard.weirich@riedel.net Signed-off-by: Wolfgang Denk wd@denx.de Tested-by: Wolfgang Denk wd@denx.de
I recommend you update your code, and try again.
Best regards,
Wolfgang Denk
participants (2)
-
Bob Furber
-
Wolfgang Denk