Advanced booting

m (script now works, added comment. Overall still fails.)
(Slight mods from Frantisek that appear to have fixed it - THANKS :))
Line 2: Line 2:
== Multi-boot ==
== Multi-boot ==
-
 
-
Sorry - '''currently doesn't work''' - hangs 90% way through a boot of Chinook or Diablo and does a reset. Using
 
-
flasher-3.0 --set-rd-flags=no-lifeguard-reset
 
-
doesn't help (it just hangs until power cycled). Please let me [[User:lbt]] know if you can get any further...
 
-
 
-
----
 
The process for setting up a multi-boot is very similar to [[Booting from a flash card]].
The process for setting up a multi-boot is very similar to [[Booting from a flash card]].
Line 40: Line 34:
mkdir -p $IMAGE_DIR
mkdir -p $IMAGE_DIR
-
cd $IMAGE_DIR
 
# unpack fiasco
# unpack fiasco
-
$FLASHER3 -F $F_IMAGE -u
+
(cd $IMAGE_DIR; $FLASHER3 -F $F_IMAGE -u)
# https://wiki.maemo.org/Modifying_the_root_image
# https://wiki.maemo.org/Modifying_the_root_image
mknod /tmp/mtdblock0 b 31 0
mknod /tmp/mtdblock0 b 31 0
modprobe loop
modprobe loop
-
losetup /dev/loop0 rootfs.jffs2  
+
losetup /dev/loop0 $IMAGE_DIR/rootfs.jffs2  
modprobe block2mtd
modprobe block2mtd
modprobe mtdblock
modprobe mtdblock
Line 55: Line 48:
modprobe jffs2
modprobe jffs2
mkdir /tmp/jffs2
mkdir /tmp/jffs2
-
mount -t jffs2 /tmp/mtdblock0 /tmp/jffs2
+
# mount the rootfs ro
 +
mount -t jffs2 -o ro /tmp/mtdblock0 /tmp/jffs2
# copy files
# copy files
-
ssh root@nut insmod /mnt/initfs/lib/modules/2.6.21-omap1/ext2.ko \; mkdir /tst \; mount $PART /tst
+
ssh root@nut insmod /mnt/initfs/lib/modules/2.6.21-omap1/ext2.ko \; mkdir /tst \; mount $PART -o noatime /tst
-
rsync -av /tmp/jffs2/ root@nut:/tst/
+
(cd /tmp/jffs2;tar cf - . | ssh root@nut cd /tst\;tar xf -)
 +
# rsync may not work
 +
# rsync -av /tmp/jffs2/ root@nut:/tst/
ssh root@nut umount /tst \; rmdir /tst
ssh root@nut umount /tst \; rmdir /tst
Line 70: Line 66:
rm -f /tmp/mtdblock0
rm -f /tmp/mtdblock0
rmdir /tmp/jffs2
rmdir /tmp/jffs2
 +
rm -rf $IMAGE_DIR
</pre>
</pre>

Revision as of 15:51, 11 August 2008

This article covers advanced booting procedures and configuration options.

Multi-boot

The process for setting up a multi-boot is very similar to Booting from a flash card. It's a good idea to makes sure the first partition is a fat/data partition - this keeps things simple.

A sample partition layout on an 8Gb card may be:

  • 2GB primary vfat data
  • 2GB primary everyday
  • 2GB primary debian
  • 512MB logical test1 (diablo)
  • 512MB logical test2 (chinook)
  • 512MB logical test3 (diablo)

Be aware that the kernel/initfs only supports a limited number of partitions; this can easily be extended to 6 but no further. This requires editing /home/user/local/bin/initfs_flasher/initfs.bootmenu.jffs2 to add the dev nodes using mknod (eg: mknod -m600 initfs/dev/mmcblk0p5 b 254 5)

When cloning, you may edit nupgrade.sh to remove the TARGET= line and then run it as follows:

TARGET=/dev/mmcblk0p5 ./nupgrade.sh 1

To create pristine images of Diablo/Chinook, follow the instructions for Modifying the root image, but once you have the rootfs.jffs2 image extracted, you can follow the mount instructions and rsync the rootfs to the tablet.

I used this script (which now works fine)

#!/bin/bash

# This script connects to the tablet and sends the selected rootfs to the selected partition

FLASHER3=/everything/Downloads/Hardware/nokia_n800/flasher-3.0 
F_IMAGE=/everything/Downloads/Hardware/nokia_n800/RX-34_2008SE_2.2007.51-3_PR_COMBINED_MR0_ARM.bin
IMAGE_DIR=chinook_fiasco
PART=/dev/mmcblk0p6

mkdir -p $IMAGE_DIR

# unpack fiasco
(cd $IMAGE_DIR; $FLASHER3 -F $F_IMAGE -u)

# https://wiki.maemo.org/Modifying_the_root_image
mknod /tmp/mtdblock0 b 31 0
modprobe loop
losetup /dev/loop0 $IMAGE_DIR/rootfs.jffs2 
modprobe block2mtd
modprobe mtdblock
# Note that on a host running 2.6.27-rc2 (and probably *much* earlier), the ,128KiB sets the erase size.
echo "/dev/loop0,128KiB" > /sys/module/block2mtd/parameters/block2mtd
modprobe jffs2
mkdir /tmp/jffs2
# mount the rootfs ro
mount -t jffs2 -o ro /tmp/mtdblock0 /tmp/jffs2

# copy files
ssh root@nut insmod /mnt/initfs/lib/modules/2.6.21-omap1/ext2.ko \; mkdir /tst \; mount $PART -o noatime /tst
(cd /tmp/jffs2;tar cf - . | ssh root@nut cd /tst\;tar xf -)
# rsync may not work
# rsync -av /tmp/jffs2/ root@nut:/tst/
ssh root@nut umount /tst \; rmdir /tst

#clean up
umount /tmp/jffs2
rmmod jffs2
rmmod mtdblock
rmmod block2mtd
losetup -d /dev/loop0
rm -f /tmp/mtdblock0
rmdir /tmp/jffs2
rm -rf $IMAGE_DIR

Boot messages

So if you want to see the kernel boot log or dmesg type output when you boot here's how (thanks to qwerty12 for the pointers)

Check you have an up-to-date initfs - does this file exist:

/mnt/initfs/usr/bin/fb_update_mode

If not then install fanoush's bootmenu/initfs.

Log into the tablet and remount initfs so you can edit it directly. (If this doesn't make you nervous then you should stop now!)

 mount -o remount,rw /mnt/initfs

Now grab some kernel modules from here:

 http://fanoush.wz.cz/maemo/modules-2.2007.50-2-custom.tar.gz

and copy the 4 modules you find in

  ./drivers/video/console/

to

 /mnt/initfs/lib/modules/`uname -r`/

I extracted them on my host and did:

 scp drivers/video/console/* root@nut:/mnt/initfs/lib/modules/2.6.21-omap1/

Now, for each bootmenu where you want a bootlog, edit /mnt/initfs/bootmenu.conf and add

 softcursor bitblit font fbcon

to any MODULE_N_MODULES= lines Also add a line like this (where MENU_2 will differ for you):

 MENU_2_FBMODE="auto"

eg:

 MENU_4_NAME="Diablo Test"
 MENU_4_ID="mmc5"
 MENU_4_DEVICE="${INT_CARD}p5"
 MENU_4_MODULES="mbcache ext2 softcursor bitblit font fbcon"
 MENU_4_FSTYPE="ext2"
 MENU_4_FSOPTIONS="noatime"
 MENU_4_FBMODE="auto"
 [ -d "/sys/block/${INT_CARD}/${MENU_4_DEVICE}" ] || MENU_4_NAME="(${MENU_4_NAME}) N/A"

Finally, remount the initfs as ro and reboot.

 mount -oremount,ro /mnt/initfs/

Once your system starts, don't forget to run

 /mnt/initfs/usr/bin/fb_update_mode manual

or the display will run slowly.

Initfs hacking