Angstrom on Touchpad

From WebOS Internals
Revision as of 11:57, 4 September 2011 by XP1 (talk | contribs)
Jump to navigation Jump to search

Booting Angstrom on the TouchPad is actually fairly easy. Here are the steps to get it going.

What to boot

For this, we will have a beagleboard of Angstrom located in an LVM on the touchpad named ext2fs. This is un-tested with an ext3 filesystem, but it will likely work. The Angstrom rootfs needs to be right in the base of the LVM, not in a sub-folder.

We are going to be creating a multi-file uImage. It will be one file with both a uImage kernel as well as an initrd.

Gather required bits

First novaterm into the TouchPad and run the following commands

cd /var/home/root
tar czvf boot.tgz -C /boot/ .

Then exit out of novaterm and back on your PC run the following

mkdir -p uImage/initrd
cd uImage
novacom get file:///var/home/root/boot.tgz > boot.tgz

This will have everything you need to create the multi-file uImage using whatever kernel is currently installed on your TouchPad. I would recommend using either UberKernel or F15, something that gives console output on bootup.

initrd

Build the initrd

First we need to make an empty file that will be used for our initrd. We will be starting off with an 8 MiB initrd.

dd if=/dev/zero of=ramdisk bs=1M count=8
mke2fs -Fvm0 ramdisk
mount -o loop ramdisk initrd

Now, we have an empty initrd ramdisk file and it is mounted as a loopback so that we can put things into it.

Fill the initrd

This one is pretty simple. We are going to fill the initrd with the contents of the boot.tgz EXCEPT for the kernel.

mkdir boottemp
tar xzvf boot.tgz -C boottemp
rm boottemp/uImage
mv boottemp/uImage-2.6.35-palm-tenderloin 
mv boottemp/* initrd

Change the pivot_root

You need to edit the file /sbin/init within the initrd to alter what rootfs is loaded at bootup.

vi initrd/sbin/init

Find these lines:

lvm.static lvchange -ay --ignorelockingfailure /dev/mapper/store-root

# May need to say "don't update mtab" option below
mount -o ro /dev/mapper/store-root /realroot

... and change them to:

lvm.static lvchange -ay --ignorelockingfailure /dev/mapper/store-ext2fs

# May need to say "don't update mtab" option below
mount -o ro /dev/mapper/store-ext2fs /realroot

Now, you are done with creating the initrd. You can umount initrd now if you like, or leave it mounted if you are going to be making changes and testing them.

Build the multi-file uImage

You will need the package uboot-mkimage (at least on Ubuntu) installed to do this.

Cheater script

I have worked up a script that runs the needed commands for you.

#!/bin/bash
rm uMulti uRamdisk
mkimage -A arm -O linux -T ramdisk -C none -d ramdisk uRamdisk
mkimage -a 0 -e 0 -A arm -O linux -T multi -C none -d uImage-2.6.35-palm-tenderloin:uRamdisk uMulti

Just name the file something like spin-kernel.sh and give it execute permission. It should be inside of the uImage folder we made earlier, then give it a run.

Update Angstrom

You will need to chroot into the angstrom rootfs on the TouchPad over a novaterm session and install lvm with the command:

opkg install lvm2

Also, one thing that I have found is that the checkroot script was not running early enough so it was halting the boot due to the rootfs still being read-only. To fix this go to /etc/rcS.d within your angstrom rootfs. Find the symlink that points to ../init.d/checkroot and rename it to S01checkroot.

Boot Angstrom

To do this, just put the TouchPad into recovery mode and memboot the multi-file uImage we made earlier. Because we are membooting it, if something goes wrong and if the TouchPad doesn't boot properly, you can force a reboot by holding Home+Power for 10 seconds, and it will safely reboot into webOS.