Fun with N800: Booting N800 Internet Tablet from SD card

Average: 5 (3 votes) : Thanks for your votes!

So here you will find a summary of what i gather from the wiki and forums to achieve what i need.

Summary of steps:
1. gain root access
2. prepare the memory card
3. prepare the dual boot system
4. duplicate the root file system
5. fix a few things to perfect the system  

Gain Root Access - refer to Wiki
for n800 with latest firmware (dated 1st July, the 2007SE_4.2007.26-8). First add this in the application catalogue:

Web address: http://eko.one.pl/maemo/
Distribution: mistral
Components: user

then you can either  use the .install file http://stage.maemo.org/~ferenc/bora_sdk.install or add the following to the application catalogue:

 

Web address: http://repository.maemo.org/
Distribution: bora
Components: free non-free

now from the application catalogue, install the following software:
1. *becomeroot*
2. osso-xterm

now you should be able to use root mode. Click on programs > Extras > X Terminal. you should be welcomed with the familiar black window

Prepare the memory card - refer to Wiki
prepare here means  to repartition your memory. before you proceed, please make a backup of your card. Don't proceed then come back and realise your favourite songs or photos are gone :)

from the X terminal, do the following:

# apt-get install e2fsprogs
# umount /media/mmc1
# umount /media/mmc2 (for N800 only!)
# sfdisk /dev/mmcblk0
/dev/mmcblk0p1:1,15000,6
/dev/mmcblk0p2:15001,,
/dev/mmcblk0p3:
/dev/mmcblk0p4:

pay attention to the numbering. In the N800 the internal memory slot is mmc2, while the external slot (the one available when you open the stand) is mmc1. Don't mistake the sequence. A ls to see the content first will save you from destroy data accidentally.

the cryptic name mmcblk0p1 is the representation of your memory card. however the confusing part is how the /dev/mmcblk numbering is named. To remind myself, view it as such

mmcblkXpY -
X is the representation of card. 1 is for mmc1, which is external card. 0 is for mmc2, which is the internal card. don't mistaken it.
Y is the representation of the partition number. 1 means first partition, 2 means second and so on. 

so for my case, i have the Sandisk 2GB card in the external card slot. so i did:

# sfdisk /dev/mmcblk1
/dev/mmcblk1p1:1,30000,6
/dev/mmcblk1p2:30001,,
/dev/mmcblk1p3:
/dev/mmcblk1p4:

note that i have 30000 instead of 15000. The number means the number of cylinders. 30000 will give me about 1GB of space. the number 6 behinds it means VFAT file system. if nothing is put, such as the one for mmcblk1p2, Linux_83 file system will be applied.

when partitions are defined, do this: 

# mkdosfs /dev/mmcblk1p1
# shutdown -r now

this will format the first partition on your card with the FAT16 file system. next you will reboot the unit. i have no idea why a reboot is necessary, but i just followed. Next after the reboot, format the second partition with ext2. 

# mke2fs /dev/mmcblk1p2
# shutdown -r now

if you want to have ext3 instead of ext2, use a -j as parameter for mke2fs. I read it is possible, so you can try it.


Prepare the dual boot system

this part is direct. download the scripts from http://fanoush.wz.cz/maemo/initfs_flasher.tgz , and unpack it in your home directory. If you download it from the desktop and put it in your memory card, you should not extract it under /media/mmc1 or /media/mmc2 because you won't be able to execute it. once extracted, assuming it is on the external slot memory card, do the following:

# cd /home/user/
# tar zxvf /media/mmc1/initfs_flasher.tgz
# cd initfs_flasher/
# ./initfs_flash

say yes to all questions. i did :)



Duplicate the root system

now it is time to duplicate. I somehow cannot locate ext2.ko in /mnt/initfs/lib/modules/current/, so i use /mnt/initfs/lib/modules/2.6.18-omap1/ 

# insmod /mnt/initfs/lib/modules/2.6.18-omap1/mbcache.ko
# insmod /mnt/initfs/lib/modules/2.6.18-omap1/ext2.ko
# mkdir /opt/
# mount /dev/mmcblk0p2 /opt
# mkdir /floppy/
# mount -t jffs2 /dev/mtdblock4 /floppy 

now you need to get another version of tar, since the original tar from busybox has path limited to 100 chars so not everything is copied.

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

now this step will duplicate the system

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

this will take like almost 10 minutes. after this, do the following:

# umount /opt
# umount /floppy
# chroot /mnt/initfs cal-tool --set-root-device ask:mmc2
fix a few things to perfect the system
since i want to boot from external slot, i would need to edit /mnt/initfs/bootmenu.sh. look for the following:
MENU_3_NAME="MMC card, partition 2, ext2"
MENU_3_ID="mmc2"
MENU_3_DEVICE="mmcblk1p2" 
and change it to 
MENU_3_NAME="MMC card, partition 2, ext2"
MENU_3_ID="mmc2"
MENU_3_DEVICE="mmcblk0p2" 

you can of course change the mmc2 to mmc1, but i am lazy and i prefer to keep it like that :) if you change it, then you must also change the above command parameter ask:mmc2 to ask:mmc1 (not tested, but i assume so). When done this, reboot the system.

# shutdown -r now

now. be ready for your system to be booted from the memory card :)

one more thing you will realise is that you cannot access the VFAT partition once you boot from external memory card. It makes sense: how should the system umount its root to be accessible via USB? so you need the following changes on the umount script /usr/sbin/osso-mmc-umount.sh

        for mp in $MPS; do
umount $mp 2> /dev/null
RC=$?
if [ $RC != 0 ]; then
echo "$0: could not unmount $mp"
exit $RC
fi
done

and change it to

        for mp in $MPS; do
             if [ "$mp" != "/" ] ; then umount $mp 2> /dev/null ; fi
RC=$?
if [ $RC != 0 ]; then
echo "$0: could not unmount $mp"
exit $RC
fi
done

that should do the magic :)

have fun with your new system on memory card :) 

 

Links:
1. Maemo Wiki on HowTo Easily boot from MMC card
2. Hack to access FAT partition on the SD card even if the same card is used as root file system.
3. backup of the external card root system as tar archive.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Installing to External Card Slot...

Hi, I followed your instructions more or less to get the OS booting from the external card slot.

However, I think there is one line for when you duplicate the root file system that is wrong:

# mount /dev/mmcblk0p2 /opt
should be
# mount /dev/mmcblk1p2 /opt

Similarly, when editing the /mnt/initfs/bootmenu.sh, I had to change the line MENU_3_DEVICE="mmcblk0p2" TO MENU_3_DEVICE="mmcblk1p2", not the other way around.

But this may be because I ran chroot /mnt/initfs cal-tool --set-root-device ask:mmc1, whereas you ran "mmc2"

exactly

i think i did mentioned in the instruction the difference between the internal memory slot and external card slot. And the whole document is going to tell people how to install to internal card slot (except the part i mentioned about my own choice, which is external card slot). So perhaps there created the confusion...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.