RootfsOnSDForBabbage

Differences between revisions 3 and 5 (spanning 2 versions)
Revision 3 as of 2009-06-20 02:07:40
Size: 4608
Editor: pool-71-254-56-47
Comment:
Revision 5 as of 2009-06-20 12:46:01
Size: 4736
Editor: pool-71-254-56-47
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
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 [[http://wiki.ubuntu.com/ARM/RootfsFromScratch|Rootfs From Scratch]] work. 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 on the iMX51 Babbage board. Much of this is based on the existing [[http://wiki.ubuntu.com/ARM/RootfsFromScratch|Rootfs From Scratch]] work.
Line 5: Line 5:
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. 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.
Line 13: Line 13:
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. 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 (iMX51) has only 256 megs or ram, you may wish to have an external swap.
Line 49: Line 49:

  
Plug the SD into your Babbage. Your new root image should now boot and run directly off your SD.

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 on the iMX51 Babbage board. 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 (iMX51) 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>"'

Just make sure you keep the same r, s, and console values as returned from reading the config string.

Plug the SD into your Babbage. Your new root image should now boot and run directly off your SD.

ARM/RootfsOnSDForBabbage (last edited 2009-07-20 15:34:54 by pool-72-75-143-152)