changing mtd partitioning
werner at openmoko.org
Fri Apr 11 01:31:09 CEST 2008
Sean McNeil wrote:
> I'd like to change the mtd partitioning, but I'm a little confused. It
> would appear that the partition info is stored in the bad block table,
There's truth in advertisement - the bad block table indeed only contains
the bad blocks :-) The partition "table" is stored in the environment, in
the variable mtdparts. (Yeah, ugly as it gets ...)
> It would also appear there is no way to map this out yourself
> save, perhaps, building a new uboot.
You can actually do it by changing mtdparts. E.g., this would add a
128kB partition called "other" after the rootfs on my GTA02v5 (*):
setenv mtdparts mtdparts=physmap-flash:2m(nor)\;neo1973-nand:256k(u-boot),256k(u-boot_env),8m(kernel),640k(splash),256k(factory),16896k(rootfs),128k(other)
Note the backslash before the semicolon !
(*) Your will have a different bad blocks, so the partition sizes,
which include bad blocks, will probably be different.
However, there are a few problems with this approach:
- you have to do all the calculations yourself. In particular, if you
care about making room for bad blocks (as opposed to just sizing your
partitions with enough slack to accommodate whatever evilness may
exist in your NAND), you have to include them in your calculations.
- DFU won't see the extra partitions unless you change u-boot
- the u-boot in NOR won't know anything about this (but that's not so
bad - you only really need it to recover u-boot and the u-boot
environment, then you can go back to NAND for the rest)
- if you ever need to restore your environment from scratch, you have
to do all this again
A more robust approach would be to change the u-boot source to
permanently include your partitions. Personally, I'd try to avoid
having a non-standard partition layout. It's just too much of an
uphill battle ...
> So far, so good. I can't use the regular bootm line as it does a
> dynpart; saveenv. So I tried without those. Was a no-go. Now, I've ended
> up doing a defaultenv; dynpart; saveenv and messed up my boot menu plus
> no serial out.
Aiii, defaultenv does that, yes. You should still be able to go in with
DFU, grab the environment (dfu-util -U), edit it on the PC with
editenv.pl (svn.openmoko.org/trunk/src/host/devirginator/), then put
it back (dfu-util -D).
If you have a properly set up NOR, you can use the u-boot there to
play as well. Just press and hold AUX before pressing POWER, then
hold both until the menu comes up after a few seconds.
Note however that the u-boot from NOR comes with its own environment.
If you want to edit the one in NAND, you have to get it first with
Hope this helps.
More information about the openmoko-kernel