RootfsOnSDForBabbage

Differences between revisions 1 and 2
Revision 1 as of 2009-06-20 01:50:16
Size: 2938
Editor: dyfet
Comment:
Revision 2 as of 2009-06-20 02:03:57
Size: 4478
Editor: dyfet
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= ARM Rootfs ON SD For Babbage =
Line 8: Line 6:

Another way to do this is to follow the instructions on [[http://wiki.ubuntu.com/ARM/BuildingBabbageRedBoot|Building Babbage RedBoot]], which allows you to build an entirely custom redboot from scratch, and ultimately add your own kernel. However, the process is more complex.
Line 31: Line 31:
== Making your partition bootable ==

Now you will need some redboot magic. apt-get install redboot-tools. If your SD appears as /dev/sde, then you can use something like ''sudo fconfig -r -d /dev/sde -o 0x5F000 -n boot_script_data''. If you used the original live install image for Babbage from ports.cdimage.com, then you should see something like:

fis load initrd
fis load kernel
exec -r 16777216 -s 9699328 -c "console=ttymxc0,115200 console=tty0 file=/cdrom/preseed/ubuntu.seed boot=casper --"

All you need to do is tell the kernel to use your root partition rather than boot casper by changing the boot_script_data string and the kernel options it passes. First, you need to know the uuid of your new root partition. You can find this out using sudo blkid /dev/sde2. This will give you something like:

/dev/sde2: UUID="55eece57-8736-45ec-b5da-29b0df3be823" TYPE="ext2"

Now, you will reset the boot_script_data using fconfig. You will need to do sudo bash or be root, or deal with shell expansion issues. But essentially, as root, you would enter:

fconfig /dev/sde -w -d /dev/sde -o 0x5F000 -n boot_script_data -x 'fis load initramfs\fis load kernel\exec -r 16777216 -s 9699328 -c "console=ttymxc0,115200 console=tty0 root=UUID=<the uuid from blkid>"'


 
Line 36: Line 54:

This page describes the process for building a root filesystem on the SD boot device without having to go through an install media. This allows one to boot a Jaunty Ubuntu armel release directly on SD. Much of this is based on the existing Rootfs From Scratch work.

Creating a bootable SD

The cheapest and easiest way to do so is probably to use usb creator to write the existing alternate install image to a SD device. This will then create two partitions. The first partition will be a redboot partition with the kernel and initrd image based on 2.6.28 that will boot on the babbage, and the second partition is a live install. You may also simply dd the first 16 megs of an existing babbage SD to get the redboot and kernel setup, since we need nothing else.

Another way to do this is to follow the instructions on Building Babbage RedBoot, which allows you to build an entirely custom redboot from scratch, and ultimately add your own kernel. However, the process is more complex.

Partitioning

Now we can partition the device in a more useful way. To do this, I suggest fdisk, which will detect the geometry and let you manipulate the SD easily. If you have an existing alternate or desktop live install, simply delete the second partition. Leave the first partition, type df, alone, as this is the redboot & kernel.

Now, you can create a new primary partition on the SD for "swap" if you want. Alternately, you can depend on the comps swap support in the kernel to use compressed swap pages in ram. Since the Babbage has only 256 megs or ram, you may wish to have an external swap.

Next, with the remaining space on the SD, create a standard ext2 Linux filesystem partition. This will be your new "root" filesystem.

Create a root tarball

The ARM/RootfsFromScratch page can be consulted for this. Basically, you will need to get Oliver's build-arm-rootfs script. A simple rootfs can be created for the LXDE desktop, which runs well on the Babbage, with something like:

sudo ./build-arm-rootfs --fqdn ubuntu --login ubuntu --password ubuntu --seed kxde,gdm

Other ideas can be found on the ARM/RootfsFromScratch page. Or you can build a custom root seeded with any base set of packages you may wish. This script, when if finishes, will produce a "armel-....-.tgz" file that is your new "root".

Put tarball on your SD root

First, you will need to create the ext2 filesystem. If your SD appears as something like /dev/sde, then you will use mke2fs /dev/sde2 or mke2fs /dev/sde3 (if you have a swap) to create the initial ext2 filesystem on the device.

Now you should be able to mount your SD root filesystem somewhere. Perhaps /tmp/sd, as in mount /dev/sde2 /tmp/sd. Now you can unpackage the root tarball created by the build-arm-rootfs script. You can use sudo tar -C /tmp/sd -xvzf armel-...-.tgz. You must do so as root because the rootfs needs device nodes and other things created under root or other user permissions.

Making your partition bootable

Now you will need some redboot magic. apt-get install redboot-tools. If your SD appears as /dev/sde, then you can use something like sudo fconfig -r -d /dev/sde -o 0x5F000 -n boot_script_data. If you used the original live install image for Babbage from ports.cdimage.com, then you should see something like:

fis load initrd fis load kernel exec -r 16777216 -s 9699328 -c "console=ttymxc0,115200 console=tty0 file=/cdrom/preseed/ubuntu.seed boot=casper --"

All you need to do is tell the kernel to use your root partition rather than boot casper by changing the boot_script_data string and the kernel options it passes. First, you need to know the uuid of your new root partition. You can find this out using sudo blkid /dev/sde2. This will give you something like:

/dev/sde2: UUID="55eece57-8736-45ec-b5da-29b0df3be823" TYPE="ext2"

Now, you will reset the boot_script_data using fconfig. You will need to do sudo bash or be root, or deal with shell expansion issues. But essentially, as root, you would enter:

fconfig /dev/sde -w -d /dev/sde -o 0x5F000 -n boot_script_data -x 'fis load initramfs\fis load kernel\exec -r 16777216 -s 9699328 -c "console=ttymxc0,115200 console=tty0 root=UUID=<the uuid from blkid>"'

ARM/RootfsOnSDForBabbage (last edited 2009-07-20 15:34:54 by dyfet)