Differences between revisions 12 and 13
Revision 12 as of 2013-05-17 22:41:26
Size: 7114
Editor: ?NeilStockbridge
Revision 13 as of 2013-05-17 22:42:24
Size: 7164
Editor: ?NeilStockbridge
Deletions are marked like this. Additions are marked like this.
Line 30: Line 30:
# The rest can now be over SSH with copy & paste

This is an account of getting Debian Squeeze dual-booting with Maemo 5 on a Nokia N900 so that I could play with native Debian on my phone without destroying Maemo.

Please edit this page if you try this and discover that some steps are missing.

  • First, the phone was flashed with Maemo PR-3 (20.2010.36-2). No CSSU was used

  • A µSD card ( minimum 2GB recommended) was partitioned on a workstation. The scheme might be:

    • Device




      32 MB



      1057 MB



      768 MB


    • Swap was placed on the µSD to avoid wearing the ( irreplacable) eMMC

    • A separate ( vfat) boot is handy if the rootfs is unsupported by the boot loader although Pail's u-boot supports ext2, 3 and 4 as well as FAT
    • rootfs is ext2 here because the 2.6.28-omap1-fb kernel I used does not support ext4

On a workstation ( that need not be armel):

sudo mkfs -t ext2 -L 2GB-uSD-card /dev/mmcblk0p1
sudo mount /dev/mmcblk0p1 /mnt/
sudo debootstrap --arch=armel --variant=minbase --include=$PACKAGES --foreign \
  squeeze  /mnt/  http://ftp.debian.org/debian  # Replace "ftp.debian.org" with the URL of you local mirror if you have one

Then in Maemo:

alias install="apt-get install --no-install-recommends"
install  openssh-server  # provides access as root, so no need for rootsh
# The rest can now be over SSH with copy & paste
mount -t ext2 -o errors=remount-ro,noatime /dev/mmcblk1p1 /media/mmc1
chroot /media/mmc1/ /bin/bash -l  # ..thus leaving Maemo

In Debian, set up the root file system:

debootstrap/debootstrap --second-stage
cat <<. > /etc/apt/sources.list

deb http://ftp.debian.org/debian  squeeze          main
deb http://security.debian.org    squeeze/updates  main
deb http://ftp.debian.org/debian  squeeze-updates  main

# ..or substitute your local mirror in the lines above
apt-get update
apt-get upgrade
EDITOR=vim # ..or your favourite
apt-get install --no-install-recommends  less  locales  whiptail  $EDITOR \
  man-db  ifupdown  openssh-server  udev  procps  netbase  module-init-tools \
  openssh-client  alsa-base  apt-utils  initramfs-tools
apt-get clean
cat <<. > /etc/fstab
# /etc/fstab: static file system information.
# pass: 0: do not check, 1: before mounting root, 2: after mounting root
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#                                                               pass,
# ,file system    ,mount point  ,type  ,options               dump, |
# |               |             |      |                          | |
  /dev/mmcblk1p1  /             ext2   errors=remount-ro,noatime  0 0
  proc            /proc         proc   nodev,noexec,nosuid        0 0
  none            /tmp          tmpfs  defaults                   0 0

passwd  # Choose a password that can be input even if the keyboard setup is wonky
$EDITOR /etc/watchdog.conf  # and ensure that it includes:
#watchdog-device = /dev/twl4030_wdt
#interval = 10
#realtime = yes
#priority = 1
$EDITOR /etc/default/rcS  # and ensure that it says:
echo N900 > /etc/hostname
# Get a kernel with fbcon support built-in so you can see if something goes wrong
cd /tmp/
wget http://atrey.karlin.mff.cuni.cz/~pali/u-boot/u-boot-images_2012.04-1.tar.gz
cd /
tar xf /tmp/u-boot-images_2012.04-1.tar.gz  boot/zImage-2.6.28-omap1-fb

In Maemo, prepare u-boot and the kernel:

cat <<'.' >> /etc/apt/sources.list
deb http://repository.maemo.org/extras-testing  fremantle  free
deb http://repository.maemo.org/extras-devel    fremantle  free non-free
install  u-boot-flasher  u-boot-tools  # u-boot-flasher postinst flashes mtd3 ( kernel) with a u-boot that includes the stock kernel as a payload ( the "attached" kernel) but it can also load kernels from eMMC or uSD
install  kernel-modules
cp -a /lib/modules/2.6.28-omap1/ /media/mmc1/lib/modules/2.6.28-omap1
cp -a /lib/firmware/ /media/mmc1/lib/
# Convert the zImage to u-boot format
mkimage -A arm -O linux -T kernel -C none -a 80008000 -e 80008000 -n 2.6.28-omap1-fb -d /media/mmc1/boot/zImage-2.6.28-omap1-fb /media/mmc1/boot/uImage
chroot /media/mmc1/ /bin/bash -l

In Debian, build an initrd:

$EDITOR /etc/initramfs-tools/modules  # and add:
depmod -a
update-initramfs -c -k 2.6.28-omap1

To check that the modules are there ( from your workstation):

scp root@Nokia-N900:/media/mmc1/boot/initrd.img-2.6.28-omap1 /tmp/
zcat /tmp/initrd.img-2.6.28-omap1 | cpio --list | grep ko

Back in Maemo, convert the initrd to u-boot form and set up u-boot:

mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d /media/mmc1/boot/initrd.img-2.6.28-omap1 /media/mmc1/boot/uInitrd
cat <<. > /etc/bootmenu.d/60-Debian-6-armel-uSD.item
ITEM_NAME="Debian 6 armel on uSD"
ITEM_CMDLINE="vram=12M console=tty0 root=/dev/mmcblk0p1 rootwait ro"

Don't be tempted to edit /home/user/MyDocs/bootmenu.scr. Even changing a single character with vi will lose the whole boot menu.


install console-setup
less /usr/share/X11/xkb/symbols/nokia_vndr/rx-51
$EDITOR /etc/default/keyboard

..and make it look like:



  • The system clock shows 1st Jan 1970 and the date and time must be reset once booting back to Maemo. The system clock was not being by hwclockfirst.sh for some reason so I h4x0r3d it like this until I can find out why:

--- /etc/init.d/hwclockfirst.sh 2010-12-25 10:56:37.000000000 +1300
+++ /tmp/hwclockfirst.sh        2013-01-08 19:55:40.082454923 +1300
@@ -68,6 +68,9 @@
     case "$1" in
+           # Copied from below because something was preventing it from happening
+           /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --hctosys $GMT $HWCLOCKPARS $BADYEAR $NOADJ
            if [ -d /dev/.udev ]; then
                return 0
  • The alternate functions on the keyboard aren't working yet in the console
  • udev in wheezy requires kernel >= 2.6.32 so it doesn't start, which prevents the wireless firmware from being loaded