Friday, January 15, 2010

Making flashable rootfs's for the N900

For the N8x0 the way to create flashable rootfs's - that is, rootfs's usable in flasher-3.5 -r rootfs.jffs2 -f -R was through these two steps:

mkfs.jffs2 -d $ROOTFS_DIRECTORY -l -n -e 128KiB
-o rootfs.jffs2.raw
sumtool -l -n -e 128KiB -o rootfs.jffs2 -i rootfs.jffs2.raw

Now that the N900 uses ubifs for rootfs instead, how do you do create a flashable rootfs?

You need to make a file, ubinize.cfg:

[ubifs]
mode="ubi"
image="/full/path/to/base.ubi.img"
vol_id="0"
vol_size="200MiB"
vol_type="dynamic"
vol_name="rootfs"
vol_alignment="1"
vol_flags="autoresize"

Then, you run these two commands - you have to grab mtd-utils - Ubuntu Karmic has mtd-utils with ubifs support.

mkfs.ubifs -m 2048 -e 129024 -c 2047 -R 4MiB -r $ROOTFS_DIRECTORY -v /full/path/to/base.ubi.img
ubinize -o /full/path/to/ubi.img ubinize.cfg -m 2048 -p 128KiB -s 512

You can now run flasher-3.5 -r ubi.img -f -R.

What can this information be used for?

* Generate a full snapshot of your NAND rootfs and restore it with flasher after trying out something stupid that failed.

* Flash alternative OS'es onto your N900 NAND.

* Possibilities in rescue menu as in my previous post about bootmenu.sh hook - dump my rootfs to SD and I'll fix it on my PC and reflash it back to my N900.

3 comments:

  1. This rocks! Thanks for this keepsie!

    ReplyDelete
  2. How does one take the full snapshot of the NAND in the first place?

    ReplyDelete
  3. I just rsync -aHx / myself personally. And a copy of /dev.

    ReplyDelete