gumstix/meta-gumstix — pull request #11 by pabigot (2013-09-07 16:32:28+00:00)
Title: For dylan/mtdpart

I recommend this alternative solution, for a couple reasons.

First, since CONFIG_CMD_MTDPARTS was enabled the JFFS partition size defines are never referenced: the entire chunk of cmd_jffs2.c where they would apply is excluded in favor of the version from cmd_mtdparts.c.

Second, the whole point of enabling mtdparts was to support arbitrary MTD partitioning: the original with 4 MB Linux partition, the new default with 8 MB Linux partition, and in the future perhaps adding a new partition for SPL export supporting Falcon Mode booting. Hard-coding offsets and sizes is fragile.

With mtdparts support in u-boot the correct way to locate the MTD partition holding the linux kernel is to use the partition name, which is linux. It is necessary to ensure that the mtdparts description is correct for the particular board being booted, which is done by setting the corresponding environment variable. For example, a board with a pre-dylan installation in NAND that has a 4MB Linux partition can be supported by doing:

setenv mtdparts "mtdparts=omap2-nand.0:512k(xloader),1792k(u-boot),256k(environ),4m(linux),-(rootfs)"

For jffs2, the fsinfo/fsload commands apply to the current MTD partition, which can be specified through the partition environment variable:

setenv partition rootfs

Using partition names instead of absolute offsets and sizes makes the system more robust. (I've verified that fsinfo does read the correct partition in this case, but since I have no Overo COMs with a JFFS2 partition in NAND I was unable to fully verify the solution.)

Wherever this stuff gets documented should include a warning that anybody who ever executed "saveenv" will not see the new boot settings, e.g. the corrected value of nandboot. In that situation the boot will fail.

(I re-ordered your two commits so with this change the u-boot PR serendipitously matches the number of patches. These commits are also in my u-boot repository on github in branch gumstix/v2013.07 if you want to pull them.)