BabbageImageFromScratch

To use a proper ubuntu setup with a babbage board in a way that kernel upgrades and initramfs changes work out of the box, a special partitioning format is needed on the SD card, the following outlines how to achieve a setup in which kernel and initramfs work properly for a ubuntu setup on babbage based hardware.

Preparation

Create a temporary workdir and get the creator script

mkdir ~/build
cd ~/build
wget http://people.canonical.com/~ogra/arm/babbage/redboot-install
chmod +x redboot-install
  • Warning /!\ from karmic on redboot-install is included in the redboot-tools package, you dont need to download it

Install redboot-tools on your host

sudo apt-get install redboot-tools

Get redboot and fconfig binaries for armel from http://ports.ubuntu.com/pool/main/r/redboot-imx/ and extract them on your host.

For example

wget http://ports.ubuntu.com/pool/main/r/redboot-imx/redboot-imx51-babbage_200918-0ubuntu2_armel.deb
sudo dpkg -x redboot-imx51-babbage_200918-0ubuntu2_armel.deb /
  • Warning /!\ if you have to use a different redboot.bin, copy it over /usr/lib/redboot/imx51-babbage-TO2_redboot.bin (note it needs to be an unpadded binary)

Get a kernel (if you dont have one) and extract it in the workdir

wget http://ports.ubuntu.com/pool/main/l/linux/linux-image-2.6.28-14-imx51_2.6.28-14.46_armel.deb
dpkg -x linux-image-2.6.28-14-imx51_2.6.28-14.46_armel.deb .

Grab an initial initramfs from:

wget http://people.canonical.com/~ogra/arm/babbage/initrd.img-2.6.28-14-imx51

Run the creator script

  • Warning /!\ Note, the actual initramfs for your kernel has to be created inside the running system after first boot

sudo ./redboot-install -k ./boot/vmlinuz-2.6.28-14-imx51 -c "root=/dev/mmcblk0p2" -i ./initrd.img-2.6.28-14-imx51 -d /dev/mmcblk0

Partitioning

Create a partiton with cfdisk on the card, mount it and extract an armel rootfs to it

  • Warning /!\ Make sure redboot-tools and flash-kernel are installed in your rootfs

Configuration

Create /etc/flash-kernel.conf in the rootfs

fis_dev=/dev/mmcblk0
fis_offset_hex=0x40000
fis_size_hex="0x1F000"

Create /etc/kernel-img.conf in the rootfs (only needed if you want to use ubuntu kernel packages)

do_symlinks = yes
relative_links = yes
do_bootloader = no
do_bootfloppy = no
do_initrd = yes
link_in_boot = no
postinst_hook = flash-kernel
postrm_hook   = flash-kernel

Copy your kernel to /boot/vmlinuz-$(uname -r)-imx51 in the rootfs

  • Warning /!\ Note the -imx51 suffix is important here

Create a module dir for your kernel version, else update-initramfs will complain

mkdir -p /lib/modules/$(uname -r)

Finalization

After first boot run

update-initramfs -c -k $(uname -r)
  • Warning /!\ You need to add the -imx51 suffix to the initrd.img filename in /boot if this is not contained in your uname versioning

Create links for /vmlinuz and /initrd.img to the actual files in /boot

Then run flash-kernel and reboot the board

Config changes

If you want to change any configuration i.e. add a proper UUID to the kernel commandline after install, use the fconfig tool that was installed with the redboot-tools package, so you dont need to use a serial console.

To list all redboot variables of the current setup

sudo fconfig -s -l -d /dev/mmcblk0 -o 0x5F000

To specifically only list the bootscript (containing the kernel commandline)

sudo fconfig -s -r -d /dev/mmcblk0 -o 0x5F000 -n boot_script_data

To actually change the kernel commandline

sudo fconfig -s -w -d /dev/mmcblk0 -o 0x5F000 -n boot_script_data -x 'fis load initrd\fis load kernel\exec -r 16777216 -s 9699328 -c "console=ttymxc0,115200 console=tty0 root=UUID=aa3265c3-691a-40ca-b18b-bba6cacfcac9"\'
  • Warning /!\ Note that 'fis load initrd\fis load kernel\exec -r 16777216 -s 9699328 -c' are mandatory, you may render your system unbootable if you dont use the above syntax

ARM/BabbageImageFromScratch (last edited 2009-09-30 09:45:27 by 5ac8846c)