- The first thing is to setup a boot menu. One of the problems I had here was that the initfs was seeing the internal card as mmcblk1 whilst the OS once booted sees it as mmcblk0. Well, actually once booted the kernel still sees the internal as mmcblk1:
~ $ cat /proc/partitions
But udev seems to swap them when creating the entries in /dev:
major minor #blocks name
254 0 7977472 mmcblk0
254 1 7973376 mmcblk0p1
254 8 1966080 mmcblk1
254 9 1441791 mmcblk1p1
254 10 524288 mmcblk1p2~ $ ls -l /dev/mmcblk*
It's very likely a kernel bug and seems to occur only on N810. When trying to boot from MMC, this causes two problems:
brw-rw---- 1 root floppy 254, 8 Jan 26 14:44 /dev/mmcblk0
brw-rw---- 1 root floppy 254, 9 Jan 26 14:55 /dev/mmcblk0p1
brw-rw---- 1 root floppy 254, 10 Jan 1 1970 /dev/mmcblk0p2
brw-rw---- 1 root floppy 254, 0 Jan 26 14:44 /dev/mmcblk1
brw-rw---- 1 root floppy 254, 1 Jan 26 14:56 /dev/mmcblk1p1- With no external SD card plugged in, the boot menu sees the internal one as mmcblk0, which is fine. But as soon as there's an external card plugged in, the internal one becomes mmcblk1. The obvious problem here is that the boot menu won't behave in a consistent manner depending on the card configuration.
- Once booted, and with an external card plugged in, the root of the file system will be mounted on mmcblk1p2, which doesn't exist.
Graham Cobb came up with a very elegant way to make the boot menu always boot from the internal card, regardless of the presence of an external one. - With no external SD card plugged in, the boot menu sees the internal one as mmcblk0, which is fine. But as soon as there's an external card plugged in, the internal one becomes mmcblk1. The obvious problem here is that the boot menu won't behave in a consistent manner depending on the card configuration.
- Now that the boot menu is patched, let's move on to partitioning and copying the root file system. And reboot from MMC!
- Now we need to fix USB mounting. It'll break at some point because the system tries to unmount every mmcblk*p*, including the root filesystem (mounted on /dev/mmcblk1p2....) and bails out as soon as there's an error. The fix is to edit /usr/sbin/osso-mmc-umount.sh so that it doesn't try to unmount "/". Changing
if [ $? = 0 ]
toif [ $? = 0 -a "$MP" != "/" ]
should to the trick. - Alright, got the USB working but a Linux host will mount the root partition as well! This time the problem is that the whole disk is shared over USB. i.e. it shares mmcblk0 and mmcblk1, not individual partitions. This time the fix is to edit /usr/sbin/osso-usb-mass-storage-enable.sh so that it shares only the first partition of a device instead of the whole device. Basically, add something like
DEVICE=${1}p1
near the beginning of the file and replace all instances of$1
with$DEVICE
.
References:
[1] http://fanoush.wz.cz/maemo/#initfs
[2] http://maemo.org/community/wiki/howto_easily_boot_from_mmc_card/
[3] http://www.internettablettalk.com/forums/showthread.php?t=11703
[4] http://www.internettablettalk.com/forums/showpost.php?p=124657&postcount=73