Installing Ubuntu (Natty) on the BeagleBoard with RootStock

There are prebuilt Ubuntu images suitable for the BeagleBoard, however if you want more control over what’s included in your filesystem, and your kernel, RootStock is a good option. RootStock will assemble a complete Ubuntu file system, a kernel image and initial ramdisk based on the set of packages you provide on the command line.

Running Rootstock

There seems to be a bug in rootstock under Ubuntu 11 in that if you install it using the usual ‘apt-get install rootstock’, rootstock fails later on with a lot of:

...
bin/chown: changing ownership of `/proc/923/task/965': Operation not permitted
...

However if you just install the source code it seems to run correctly:

apt-get source rootstock
apt-get install qemu-kvm-extras
apt-get install debootstrap
cd rootstock*

Before running rootstock you need to choose which kernel version you want to run. A helpful guy over at http://rcn-ee.net has precompiled a lot of different kernel versions with the appropriate config and patches for the BeagleBoard. I’ve been using the 3.1.0 kernel. If you want to build your own kernel there are instructions at the end of this article.

Once you’ve chosen a kernel, find the URL of the corresponding image under http://rcn-ee.net/deb/natty/. Run rootstock, customizing the seed packages and kernel image URL arguments as necessary:

./rootstock --fqdn beagle --login someusername --password somepassword \
--imagesize 4G \
--seed linux-firmware,build-essential,apt,usbutils,wireless-tools,i2c-tools,wpasupplicant \
--dist natty \
--serial ttyO2 \
--kernel-image http://rcn-ee.net/deb/natty/v3.1.0-x1/linux-image-3.1.0-x1_1.0natty_armel.deb

This will (eventually) generate a couple of files: armel-rootfs-<date>.tgz which contains the root file system, and vmlinuz-<date> which is the compressed kernel.

Preparing the SD Card

Before we can boot the beagle from this we need to generate the uImage and uInitrd files for the boot partition:

sudo apt-get install u-boot-tools
mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n "Linux" -d ./vmlinuz* ./uImage
mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d ./initrd.img-* ./uInitrd

Copy MLO, and the generated uImage and uInitrd files to the boot partition of your SD card. If you haven’t partitioned your SD card yet, you can find instructions here. Once this is done, delete everything in the main partition, and extract the tarball produced by rootstock into it:

tar xfp armel-rootfs-*.tgz -C /media/main

Booting the BeagleBoard

Insert the SD card into your beagle and turn it on. If you’re lucky this may boot straight away. If not, you may need to change the config in U-Boot. I use the following bootcmd and bootargs (make sure you grab a copy of your settings with ‘printenv’ before running these below, as they will override your settings):

setenv bootcmd 'mmc rescan;fatload mmc 0 0x80000000 uImage;fatload mmc 0 0x81600000 uInitrd;bootm 0x80000000 0x81600000'
setenv bootargs 'console=ttyO2,115200n8 root=/dev/mmcblk0p2 rootwait ro vram=${vram} omapfb.mode=dvi:${dvimode} fixrtc buddy=${buddy} mpurate=${mpurate}'
boot

I’m using U-Boot 2011.06, so you may need a slightly different syntax if you have a different version.

Compiling your own Kernel

If you want to build your own kernel (eg to lower the I2C bus frequency), you can make the job a bit easier with a set of scripts made by the same guy who provided the precompiled kernel images earlier:

git clone git://github.com/RobertCNelson/stable-kernel.git

Edit the file system.sh.sample. If you’re going to cross-compile the kernel (recommended – compiling the kernel on the BeagleBoard will take an awfully long time), uncomment the following lines and save the file as system.sh:

...
#sudo apt-get install gcc-arm-linux-gnueabi
...
#CC=arm-linux-gnueabi-
...
#ZRELADDR=0x80008000
...

When you’re done, run:

./build_deb.sh

This will take a while, and when done will produce a file called deploy/linux-image-<version>cross_armel.deb. Put this up on a web server and you can reference it in the –kernel-image argument to rootstock above.

Advertisements
This entry was posted in BeagleBoard, Linux and tagged , , . Bookmark the permalink.

8 Responses to Installing Ubuntu (Natty) on the BeagleBoard with RootStock

  1. Pingback: Changing the BeagleBoard I2C Bus Frequency | Yet Another Hacker's Blog

  2. Jan Lernout says:

    Zal dit zeker uitproberen!

  3. Ajay Bhargav says:

    Hi, Thank you for informative article… I am trying to create minimal ubunut fs for my beagleboard revC3. I am stuck at one point and I have no idea where to go from there… even you’ve mentioned those steps so I wanted to ask you this question..
    my fs is ready.. but I donno how to create uInitrd. as per your command

    mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d ./initrd.img-* ./uInitrd
    

    now question is where to get ./initrd.img-* from.. :/ I am using my own build kernel I have the uImage but i donno where to get this initrd from.. Please reply me.. thanks..

    • bengalvin says:

      Are you using rootstock? If so, it should generate the initrd.img-* for you. If you’re not using rootstock, you may be able to use update-initramfs (the usual method for generating the file), however I don’t know how to get this to work in a cross-compiler situation. Good luck!

      • Ajay Bhargav says:

        yes I am using rootstock.. this is what i used as command…

        sudo rootstock --fqdn ubuntu --login rickey --password rickey --imagesize 3G --seed ubuntu-minimal --serial ttyO2

        after this a tarball is created but there is no initrd…

        I also download prebuilt images from ubuntu website for omap3. but after I install it on mmc it does not boot with boot.scr inside… board hangs after “uncompressing kernel…booting kernel” something..

        I found that board does not boot if I do bootm but if i boot with bootm board boots but nothing comes on screen.. I do not even see beagle board logo on display. I have no idea what is wrong with my board :/ I updated both u-boot and xloader to latest on mainline branch. can that be a problem?

      • bengalvin says:

        I had a look through the rootstock script and it looks like it only generates the initrd if you’ve supplied a –kernel-image argument (the KERNEL_IMAGE_CREATE_INITRAMFS variable in http://bazaar.launchpad.net/~matteo-mattei/project-rootstock/main/view/head:/rootstock is set in the setup_kernel_image() function which is only called if you provide a –kernel-image argument). You could probably hack the rootstock script to make it generate the file for you if you really want to use the original kernel, or otherwise use a custom kernel (I use –kernel-image http://rcn-ee.net/deb/natty/v3.1.0-x1/linux-image-3.1.0-x1_1.0natty_armel.deb)

  4. Luc says:

    Hello,
    Try to build an ubuntu image with Rootstock for my Android GT-N7000
    I am fighting with the “bug in rootstock under Ubuntu 11”
    Uninstalled the package and Installed the source code as you suggest…. But seems not installing …. thus do not recognize rootstock command.
    Can you hel me?
    Best regards

    • bengalvin says:

      Hi Luc. The ‘apt-get source rootstock’ command won’t actually install rootstock – it will create a subdirectory under your current directory, and install the scripts in there. You’ll need to change to the newly created directory and run the script from in there.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s