Running latest U-Boot, Linux and BusyBox on PandaBoard

In this document I will show how to create and boot a minimal filesystem (about 5 MB) on a Pandaboard using the latest versions of U-Boot, Linux kernel and Busybox.

I'll try to keep this document updated when new version of each software are released.

The only thing needed for booting the board is a generic SD card (FAT32 formatted).

I strongly recommend that all steps are done as normal user (not root!). For this purpose we will first create a develop folder in the home directory:

$ cd ~
$ mkdir develop

This directory will contain everything we'll need for creating the system.

Install toolchain

We are going to use Linaro ARM toolchain:

$ cd ~/develop
$ wget
$ tar xJf gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux.tar.xz

Add these lines at the end of /home/user/.bashrc:

export ARCH=arm
export CROSS_COMPILE=/home/user/develop/gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux/bin/arm-linux-gnueabihf-
export PATH=/home/user/develop/gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux/bin:$PATH

Build MLO and U-Boot

First we need to clone the official U-Boot git repository:

$ cd ~/develop
$ git clone git:// u-boot

find the latest stable version (the last one without -rc* suffix, in this case v2014.07):

$ cd u-boot
$ git tag -l | sort -V

check it out:

$ git checkout -b panda v2014.07

configure for Panda:

$ make omap4_panda_config

and then build MLO and u-boot.img:

$ make

If everything went well, you should now have two files, MLO and u-boot.img, which are respectively SPL and the real U-Boot.

You can now copy these files to the SD.

NOTE: my Pandaboard seems to have some problems reading from SD cards. I think it has a broken connection on one of the data bits.
The error message (when SPL boots) is something like this:

U-Boot SPL 2014.07
OMAP4430 ES2.0
SPL: Please implement spl_start_uboot() for your board
SPL: Direct Linux boot not active!
** Partition 1 not valid on device 0 **
spl_register_fat_device: fat register err - -1
### ERROR ### Please RESET the board ###

I solved the problem forcing "1-bit" mode instead of "4-bit". It works slowly but al least it works.
Should you have the same issue you can apply this patch to u-boot.

Build Linux Kernel

Clone the official Linux git repository:

$ cd ~/develop
$ git clone git:// linux-2.6
$ cd linux-2.6

Add linux-stable remote branch:

$ git remote add linux-stable git://
$ git remote update linux-stable
$ git fetch --tags linux-stable

find the latest stable kernel by looking for the largest vX.Y.Z values (without -rc*):

$ git tag -l | sort -V
$ git checkout -b panda v3.16.2

we can now configure the kernel for Pandaboard:

$ make mrproper
$ make omap2plus_defconfig
$ make menuconfig

Here enable the following:

enable preemption:

Kernel Features
	Preemption Model
		Preemptible Kernel (Low-Latency Desktop)

enable USB support:

Device Drivers
	[*] USB support
		<*> EHCI HCD (USB 2.0) support
                <*> EHCI support for OMAP3 and later chips
                <*> OHCI HCD (USB 1.1) support
                <*> OHCI support for OMAP3 and later chips

kernel configuration for RAM disk (16 MB):

General setup
	[*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
        [*] Support initial ramdisks compressed using gzip
Device Drivers
	[*] Block devices
		[*] RAM block device support
                (16384) Default RAM disk size (kbytes)

build zImage:

$ make zImage -j2

build the device tree blob:

$ make dtbs

At this point, you should have two files:

Copy these files on the SD (along with MLO and u-boot.img).

Build BusyBox

$ cd ~/develop
$ wget
$ tar xjf busybox-1.22.1.tar.bz2 
$ cd busybox-1.22.1

Configure for Panda

$ make defconfig
$ make menuconfig

Set the following options:

Busybox settings
	Build Options
		[*] Build BusyBox as a static binary (no shared libs)
		Cross Compiler prefix: /home/user/develop/gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux/bin/arm-linux-gnueabihf-
		Additional CFLAGS: -march=armv7-a -mthumb

NOTE: should you get compilation errors regarding RPC, disable the following option:

Networking Utilities
	[ ] Support RPC services

You can now build BusyBox:

$ make -j2

Create a develop folder where you are going to install busybox:

$ mkdir ~/develop/rd_develop
$ make install CONFIG_PREFIX=/home/user/develop/rd_develop

Create a minimal file-system

To complete the filesystem we need to add some directories and files.

Go to the file system directory:

$ cd ~/develop/rd_develop

and add these directories/nodes:

$ mkdir proc
$ mkdir sys
$ mkdir dev
$ mkdir lib
$ mkdir lib/modules
$ mkdir mnt
$ mkdir tmp
$ mkdir etc
$ mkdir etc/init.d
$ sudo mknod dev/tty2 c 4 2
$ sudo mknod dev/tty3 c 4 3
$ sudo mknod dev/tty4 c 4 4

create start-up script:

$ vi etc/init.d/rcS

add these lines:

mount -t proc none /proc
mount -t sysfs none /sys
/sbin/mdev -s

make it executable:

$ chmod +x etc/init.d/rcS

create users and groups:

$ vi etc/group
$ vi etc/passwd

create minimal hosts file:

$ vi etc/hosts       localhost

Create RAM disk

Now we need to create the RAM disk, which is a 16 MB gzip'ed ext2 file:

$ cd ~/develop
$ dd if=/dev/zero of=rd.ext2 bs=1k count=16384
$ mkfs.ext2 rd.ext2
$ mkdir rd_mnt
$ sudo mount -t ext2 -o loop rd.ext2 rd_mnt
$ sudo cp -a rd_develop/* rd_mnt
$ sudo chown -R root.root rd_mnt
$ sudo umount rd_mnt
$ gzip rd.ext2

As a final step copy the file rd.ext2.gz to the SD card.

Boot the Pandaboard

At this point you should have an SD containing the following five files:

  1. put the SD card into the SD slot
  2. connect a serial cable from Pandaboard DB9 to your PC
  3. launch a terminal application (i.e. minicom) set to 115200,8N1
  4. power on the the device
  5. at the U-Boot prompt issue the following commands (you can put them in the environment or in CONFIG_BOOTCOMMAND to save typing):
    U-Boot# load mmc 0:1 0x82000000 zImage
    U-Boot# load mmc 0:1 0x83000000 rd.ext2.gz
    U-Boot# load mmc 0:1 0x84000000 omap4-panda.dtb
    U-Boot# setenv bootargs console=ttyO2,115200n8 vram=16M root=/dev/ram0 rw ramdisk_size=16384 initrd=0x83000000,16M rootfstype=ext2
    U-Boot# bootz 0x82000000 - 0x84000000
  6. you should now see the kernel boot log scrolling through the screen and finally the shell prompt (after pressing Enter)
  7. enjoy!