HowTo BootRootFSFromMMC

  1. Alternative 1 - developer rootfs and flasher
  2. Alternative 2 - initfs with onscreen menu and cloning your existing IT2006 environment
    1. Flashing modified initfs
    2. Cloning existing rootfs
    3. Valid names are 'flash', 'mmc' and 'usb' by default. Modified initfs adds 'mmc2' (second partition on mmc) and 'ask' (to show menu everytimes). For details and additional options check README inside initfs flasher archive.

There's an updated and simplified version of this page at howto easily boot from mmc card

Alternative 1 - developer rootfs and flasher

Copied from forum post by "dashiad" on internettablettalk.com forums: http://www.internettablettalk.com/forums/showthread.php?t=1709

How to boot the Maemo reference root filesystem from the MMC

What you need:

1 ) The maemo Dev Platform rootfs:

(Warning: This fs is for developing..All user utilities are stripped out..The "normal" image is here, but i've not tested with this..

2 )The flasher tool

How to do it: The first steps are just like the ones shown in the Maemo wiki:

sudo modprobe mtdblock
$ sudo modprobe mtdram total_size=65536 erase_size=256
$ sudo modprobe jffs2
$ sudo modprobe loop
$ sudo losetup /dev/loop0 /pathtoimage/rootfs.jffs2
$ sudo dd if=/pathtoimage/rootfs.jffs2 of=/dev/mtdblock0
$ mkdir /mnt/jffs2
$ sudo mount -t jffs2 /dev/mtdblock0 /mnt/jffs2

Note : rootfs.jffs2 must be the name of the file you downloaded in step 1

$ cd /mnt/jffs2
$ sudo tar cvzf /my_path/myRootImage.tar.gz .
$ cd
$ umount /mnt/jffs2

Next step is to format the mmc (i'm supposing here your mmc is detected as /dev/sda1...this may vary..)

$ mkfs.ext3 /dev/sda1
$ mkdir /mnt/mymmc
$ mount -t ext3 /dev/sda1 /mnt/mymmc
$ cd /mnt/mymmc
$ tar xvzf /my_path/myRootImage

All this has just been convert and uncompress the root filesystem onto your mmc.

Telling the nokia to boot from the MMC: Use the flasher tool.Shut down the 770, unplug the battery if plugged in, and connect it to the computer with the USB cable. Exec this (supposing flasher is in the same directory where your shell is)

$./flasher <del>set-root-device mmc </del>reboot

Turn on the device.After flasher does its job, you should boot from the MMC.

You can always reset the root partition with:

$./flasher <del>set-root-device flash </del>reboot

There's also the option to boot from USB, which i can find useful to attach an external USB disk to have all the tools you may need for developing/testing.(Great USB fix by ThoughtFix (m8, works like a charm!) and enabling usb host mode needed)

Booting from the MMC is great to test things like new kernels or apps you just downloaded.

Once you've formatted your MMC as ext3, the system in the flash will not auto-recognize the mmc (or the partition you used to put the new fs in). By gaining root (see maemo website), and with a xterm (see maemo website), you can mount it by hand. If then, you cd to it, and chroot in it...you'll be able to launch apps both in the "flash root", and the "mmc root".

TODO: The file /mnt/initfs/linuxrc has a "boot menu" that should appear if rd-mode is enabled (i think..not looking at it right now).Is it possible to enable that menu at boot time , so root (and other options) can be set without the flasher?

Alternative 2 - initfs with onscreen menu and cloning your existing IT2006 environment

Developer rootfs is not very useful if you want to use device also as a normal user. Many things are missing in this rootfs. Solution is to clone your existing IT2006 system to mmc card and upgrade it with developer packages (and/or Sardine). As there is no easy way to select which system should boot on device and as original system can boot only from 1st partition on MMC card, you need to install modified initfs image available here http://fanoush.wz.cz/maemo/#initfs. This initfs provides onscreen boot menu and can also boot from partition 2 on MMC card so you can keep part of your card as FAT for maximum compatibility with other sytems and also with IT2006 features (swap, usb storage).

Flashing modified initfs

You need ssh on PC and N770 or osso-xterm on N770.

Get the n770_initfs_flasher.tgz from http://fanoush.wz.cz/maemo/#initfs, extract it on N770 device, execute initfs_flash script and follow instructions. You can still skip the final (a bit dangerous) flashing part and backup created initfs images to PC (via scp or MMC card) and flash from your PC via official flasher, if you'd prefer.

Cloning existing rootfs

First you need to backup your FAT partition on MMC card and repartition it to have at least two partitions. First partition as FAT, second one as ext2. You can use fdisk on linux PC and USB card reader to do this (is there fdisk compiled for N770?). As the jffs2 flash filesystem uses compression you need bigger partition on MMC to hold same data. 128MB is too small, at least 256MB is recommended to have similar space as with original flash rootfs.

If you have second partition on MMC card prepared, you can clone you existing IT2006 installation with rsync.

1 . Format and mount partition on n770:

You need e2fsprogs (available in maemo2.0 repository)

Nokia770-26:~# apt-get install e2fsprogs
Nokia770-26:~# mkfs.ext2 /dev/mmcblk0p2
Nokia770-26:~# insmod /mnt/initfs/lib/modules/current/ext2.ko
Nokia770-26:~# mount /dev/mmcblk0p2 /opt/

n800 requires loading mbcache.ko before ext2.ko. Modules may be in some other folder than "current" ex "2.6.18-omap1" or similar.

2 . Remount flash rootfs to different directory to reveal hidden /dev/ entries:

Nokia770-26:~# mount -t jffs2 /dev/mtdblock4 /floppy

3 . Make sure both mount commands succeeded and you really have /opt and /floppy mounted to correct places ('Filesystem' and 'Mounted on' columns below).

Nokia770-26:~# df
Filesystem           1k-blocks      Used Available Use% Mounted on
....
....
/dev/mtdblock4           .......                        /floppy
/dev/mmcblk0p2           .......                        /opt

4 . Clone it to card by rsync or tar. Do not swap /floppy and /opt by mistake.

Nokia770-26:~# rsync -avH --delete /floppy/ /opt/

There is some issue with opera fonts caused by such copy made by rsync - details here or here. If you want to make extra sure your copy on mmc card does not have this issue, use GNU tar (not the busybox one) not rsync. Get the binary either from scratchbox arm target (/bin/tar) or by apt-get on the device in download only mode (apt-get -d install tar) After ignoring warnings tar deb should be in /var/cache/apt/archives and you can extract it by dpkg -x. Then you can make the clone by

/path/to/gnu/tar cf - -C /floppy . | /path/to/gnu/tar xvf - -C /opt

5 . Cleanup

Nokia770-26:~# umount /opt
Nokia770-26:~# umount /floppy

Now you have exact clone of your IT2006 system ready for booting from the menu.

6 . Setting default root device

If you are tired of using the menu everytime to boot from mmc, you can set default device to boot via flasher or cal-tool on the device.

Nokia770-26:~# chroot /mnt/initfs cal-tool --set-root-device mmc2

Or if you prefer to see menu on each boot (with automatic timeout).

Nokia770-26:~# chroot /mnt/initfs cal-tool --set-root-device ask:mmc2

Some boot menu settings can be customized by editing the '/mnt/initfs/bootmenu.sh' file (cumbersome and not recommended) or by creating your own bootmenu.conf with your customizations (before flashing via initfs_flash or later directly in /mnt/initfs/). Do this to boot different partitions, change filesystem to ext3 or anything else.

Valid names are 'flash', 'mmc' and 'usb' by default. Modified initfs adds 'mmc2' (second partition on mmc) and 'ask' (to show menu everytimes). For details and additional options check README inside initfs flasher archive.

CategoryHowTo