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.

On a workstation ( that need not be armel):

sudo mkfs -t ext2 -L 2GB-uSD-card /dev/mmcblk0p1
sudo mount /dev/mmcblk0p1 /mnt/
PACKAGES="watchdog,wget"
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:
#RAMRUN=yes
#RAMLOCK=yes
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
logout

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:
#omaplfb
#sd_mod
#omap_hsmmc
#mmc_block
#omap_wdt
#twl4030_wdt
depmod -a
update-initramfs -c -k 2.6.28-omap1
logout

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_DEVICE="${EXT_CARD}p1"
ITEM_FSTYPE="ext2"
ITEM_KERNEL="/boot/uImage"
ITEM_INITRD="/boot/uInitrd"
ITEM_CMDLINE="vram=12M console=tty0 root=/dev/mmcblk0p1 rootwait ro"
.
u-boot-update-bootmenu

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

Keyboard

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

..and make it look like:

XKBMODEL="nokiarx51"
XKBLAYOUT="us"

Issues

--- /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
        start)
+           # 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
            fi

Thanks