Booting from a flash card

Line 5: Line 5:
*ExtendedRootFilesystem  
*ExtendedRootFilesystem  
*ModifyingRootImage  
*ModifyingRootImage  
-
*HowTo_GetStartedWithSardine
+
*[[How To Get Started with Sardine]]
=Why would we want to boot from MMC?=
=Why would we want to boot from MMC?=

Revision as of 15:52, 24 May 2008

Here are the links to older pages on which this one is based:

Contents

Why would we want to boot from MMC?

  • Because we'll have enough space to INSTALL as MANY applications as may fit in our (GB-size) MMC card.
  • Because we'll have an INTACT COPY of the original system. So that if something goes wrong, we'll be able to BACKUP the system without reflashing the device.
  • Because we'll still be able to mount our MMC on a Windows-based PC via USB.
  • Because the whole system won't be based on a compressed and journalized filesystem (jffs2) so the result may be faster due to lower CPU usage (no (de)compression with each read/write operation) and faster SD/MMC speed (depends on card and may require custom kernel - 770, N800)

Known working devices

This procedure has been tested on the following configurations:

Hardware Software
Nokia N770 ITOS 2006 3.2006.49-2
Nokia N800 ITOS 2007 2.2006.51-6 1
Nokia N800 ITOS 2007 4.2007.26-8

1 The first time I tried this on my N800 it led to continuous reboots 30-90 seconds after booting. Trying it a second time on a clean install (directly after flashing and erasing everything already on the device) worked fine.

This procedure should work with any device listed at http://fanoush.wz.cz/maemo/#initfs

It is supposed that without any previous knowledge you should be able to accomplish the whole procedure. Ask for help in case something goes wrong. I'll be happy to help you at the following e-mail address: sebastian.maemo{AT}gmail.com

First of all: you need to become root

First of all you need to be able to get ROOT access from an Xterm on your Tablet. If you don't know how to do it, please follow this link, and come back when ready: http://maemo.org/community/wiki/HowTo_EASILY_BecomeRoot/

Second: you need to partition your MMC!

Follow this link to find the instructions to partition the MMC card: http://maemo.org/community/wiki/HowTo_EASILY_Partition_your_MMC_card/

Once you've partitioned your MMC, come back to this page and go on with the process...

How to install a dual boot menu?

Connect your device via the AC/DC power adaptor to the main power supply, or verify the battery is fully charged. It's important not to run out of battery in the middle of this operation.

From your own Tablet use the browser to download this file from Fanoush's webpage: http://fanoush.wz.cz/maemo/initfs_flasher.tgz

Supposing it's been downloaded to the fold named Documents, open an Xterm and type AS ROOT:

# cd /home/user/MyDocs/.documents/
# tar zxvf initfs_flasher.tgz
# cd initfs_flasher/
# ./initfs_flash

Just follow instructions.

Now it's time to clone the whole original system !
Connnect to Internet for apt-get to work below.

If you are working on an N770, SKIP THIS STEP. If you are working on an N800 running OS2007, you'll have to type as ROOT:

# insmod /mnt/initfs/lib/modules/2.6.18-omap1/mbcache.ko
# insmod /mnt/initfs/lib/modules/2.6.18-omap1/ext2.ko

For Nokia 770 with IT2006 or hacker edition type this instead:

# insmod /mnt/initfs/lib/modules/current/ext2.ko

NOW FOR ALL DEVICES, continue by typing as ROOT:

# mkdir /opt/
# mount /dev/mmcblk0p2 /opt
# mkdir /floppy/
# mount -t jffs2 -o ro /dev/mtdblock4 /floppy

The following command will generate dire warnings and prompts, requiring you to type YES. However, -d tells apt-get to only download the package and not install it, so it's safe to ignore those warnings and type YES... You need to be connected to internet for apt-get to work.

# apt-get -d install tar
# cd /var/cache/apt/archives/
# mkdir /tar-temp/
# dpkg -x tar*.deb /tar-temp/

Before continuing it is better to close internet connection...

# cd /tar-temp/bin/
# cp tar targnu
# ./targnu cf - -C /floppy . | ./targnu xvf - -C /opt

I have repeated this process many times in my little Nokia 770 without experiencing any problem... Nevertheless, here follow some warnings from other users: For Nokia 770 make sure you have installed bugfix for memory corruption bug, details also here. Also in newer ITOS releases, apt-get will simply say "selecting busybox instead of tar" and refuse to do anything. The tar program in the bora SDK is actually an x86 binary, so it will not work. You will have to download the tar package directly from http://repository.maemo.org/pool/maemo3.2/free/binary/tar_1.14-2.1osso_armel.deb, after which you can basically follow the instructions above, replacing /var/cache/apt/archives with wherever you put the .deb file.

It will take a while to finish last command, but do not worry about it. In the end you may see tar warning about implausible time stamp which is OK. Then you will be ready to go on with the procedure:

# umount /opt
# umount /floppy
# chroot /mnt/initfs cal-tool --set-root-device ask:mmc2
# shutdown -r now

And the process is complete. After rebooting the Tablet, you should be able to boot from the MMC card. You'll then be able to install as many applications as fit into the card. And if there's any problem in the future, you can always boot from the flash and recover the original system and start again ;)

Removing the menu

If you decide you do not wish to see the menu on each boot or you do not wish to boot from mmc anymore and go back to using internal flash only, type this (as root):

# chroot /mnt/initfs cal-tool --set-root-device flash

To remove the (harmless) 'Press menu key ..." message early on boot you need to restore your initfs backup (if you decided to create one)

# cd /home/user/MyDocs/.documents/initfs_flasher/
# ./initfs_flash initfs.orig.jffs2

or you can reflash whole firmware (Windows) or restore just initfs part (Linux). Both initfs restoration steps are a bit risky and can cause data loss if something goes wrong so it may be good idea to simply live with the message until you decide to upgrade to next firmware or want to reflash whole device anyway. It does not slow down device booting or do any other harm.