Dualboot Guide

Introduction

This document has been reviewed for maemo 3.x.

Please note, that the dualboot is not officially supported in the Nokia N800 product but following these instructions you should be able to get it working for your development or testing purposes.

This document explains how to make dualboot work in the Nokia N800 device. In Internet Tablet product the dualboot is a method how you can boot your device with an alternative root filesystem. Only the rootfs - not the initfs - can be alternatively booted during the bootup sequence.

Dualboot makes developers life a bit easier because reflashing the device with different root filesystems is not needed anymore. You simply install the wanted root filesystems into MMC card(s) and simply reboot.

Requirements

You need the following:

  • 256 Mb MMC card (minimum)
  • the Developer RootFS as a tar.gz file (provided with maemo 3.1 sdk)
  • Your Internet Tablet Device
  • MMC card reader. For convenience an additional MMC card reader is recommended. However, it is possible to operate and prepare the MMC card using the device itself but in this example we use a separate MMC card reader. The instructions given are basically the same even if you would prepare the MMC card in the actual device.

Preparing the MMC card

Usually MMC cards have a FAT filesystem in them. However, during the bootup sequence the device requires that the MMC holds an ext2 or ext3 filesystem and if it is found it tries to mount it during the bootup.

For this purpose you need to create an ext2 or ext3 filesystem in the MMC card. You can do this with utilities like FDISK or GPARTED. In this example we use the FDISK tool in the Linux PC side for partition creation.

In case if your MMC card has FAT filesystem already it is enough to just change the filesystem type to ext2. You can use the fdisk tool to do this. The command to change the type is t (=type). See the fdisk examples below in this document.

Note: If you don't have a separate MMC card reader you can simply place the MMC card in the device, then login into the actual device and create the partition with the fdisk. For this purpose you need to use fdisk program (or similar) that works in the Internet Tablet.

Whatever method you choose to prepare the MMC card the process itself is similar in both cases.

Follow these steps:

  • Insert the MMC card to your card reader
  • Figure out what is the /dev/ file for the card. In this example we use /dev/sdb device for the card
  • If your computer mounted the MMC card then first unmount it
  • Then start the fdisk tool with the correct /dev/ device file (yours may be different than sdb):
    
    root@linux-pc:~# fdisk /dev/sdb
          
    
  • Now fdisk is running. give the p (=print) command to see what it tells to you about the /dev/sdb device.
    Command (m for help): p
    
    Disk /dev/sdb: 256 MB, 256901120 bytes
    8 heads, 62 sectors/track, 1011 cylinders
    Units = cylinders of 496 * 512 = 253952 bytes
    
       Device Boot      Start         End      Blocks   Id  System
    
  • Then give the n (=new) command following with p (=primary partition) command as below:
    
    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    
  • Give the partition number as below.
    Partition number (1-4): 1
    First cylinder (1-1011, default 1): 
    Using default value 1
    Last cylinder or +size or +sizeM or +sizeK (1-1011, default 1011): 
    Using default value 1011
    
  • Then you need to set the type for the partition. The hexadecimal code for ext2 and ext3 types is hex 83:
    Command (m for help): t
    Selected partition 1
    Hex code (type L to list codes): 83
    
  • Next you need to write the changes back to MMC card. Use the w command for this. After w the fdisk quits.
    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    Syncing disks.
    
  • Now create a filesystem inside the newly created partition with the mkfs.ext2 command:
    root@linux-pc:~# mkfs.ext2 /dev/sdb1 
    mke2fs 1.40-WIP (14-Nov-2006)
    Filesystem label=
    OS type: Linux
    Block size=1024 (log=0)
    Fragment size=1024 (log=0)
    62744 inodes, 250696 blocks
    12534 blocks (5.00%) reserved for the super user
    First data block=1
    Maximum filesystem blocks=67371008
    31 block groups
    8192 blocks per group, 8192 fragments per group
    2024 inodes per group
    Superblock backups stored on blocks: 
            8193, 24577, 40961, 57345, 73729, 204801, 221185
    
    Writing inode tables: done                            
    Writing superblocks and filesystem accounting information: done
    
    This filesystem will be automatically checked every 36 mounts or
    180 days, whichever comes first.  Use tune2fs -c or -i to override.
    root@linux-pc:~#
          
    

Now you should have a MMC card with newly created ext2 filesystem.

Install the developer RootFS into the MMC card

Now that we have the MMC card ready we need to populate it with real files. In this example we will install the maemo Developer RootFS (armel ofcourse) content into the MMC card.

Follow the following steps.

First, download the developer rootfs from maemo.org site. In this example we use maemo-sdk-rootfs_armel.tgz as a name for this file. This name may differ between different maemo releases so check the correct name.

Here we assume that you have downloaded the maemo-sdk-rootfs_armel.tgz and copied it into the /tmp directory.

Mount the MMC card to /mnt/mmc directory and extract the content of the tar archive to the MMC card. Use the right partition in the MMC disk, in this example it is sdb1 but it may be different in your environment.

root@linux-pc:~/tmp# mount /dev/sdb1 /mnt/mmc
root@linux-pc:~/tmp# cd /mnt/mmc
root@linux-pc:~/tmp# tar zxf /tmp/maemo-sdk-rootfs_armel.tgz

Check that no errors were reported and you have now files under the /mnt/mmc directory by running the ls command:

root@linux-pc:/mnt/mmc# ls
bin   etc     lib     mnt   root  sys  var
boot  home    opt     sbin  tmp
dev   initrd  media   proc  srv   usr

If you have files like above then just move away from the mmc directory and unmount the MMC card.

root@linux-pc:/mnt/mmc# cd ..  ; umount /mnt/mmc

Now you have populated the MMC cards ext2 filesystem with the developer rootfs content.

Change the booting rootfs using Flasher tool

Next, take the flasher tool and connect the Internet Tablet with the provided USB cable to your Linux Pc. Run the flasher tool with the following command:

$ flasher --set-root-device mmc

Important: This will tell the device that the root filesystem is in the MMC card and in the next reboot it will use the rootfs from the MMC card.

Reboot from the MMC card

Now you should have both your MMC card and your device properly prepared for dual-boot.

Now reboot the device normally.

If everything is OK the device should boot to the developer rootfs in the MMC card. If this is the case there should be big SDK letters in the device screen during bootup sequence.

The original sales image rootfs is still in the devices flash memory, intact.

When you want to boot back to the normal Sales Image rootfs just remove the MMC card from the device and reboot.

Booting from Flash-memory

If you later want to make the device to always boot from the built-in flash memory run the following command from your Linux PC:

$ flasher --set-root-device flash

After this your device will always boot from the internal flash memory where the Sales Image is located (assuming -ofcourse- that you have not reflashed your device).

How to copy existing RootFS to the MMC card

There is a wikipage in maemo.org that explains how to copy devices rootfs to MMC card.

The link to the document is: http://maemo.org/maemowiki/HowTo_GetStartedWithSardine

FDISK command

For your convenience the FDISK tool commands are listed here.

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)



Improve this page