2012-01-14

Arch Linux on the BeagleBone

The BeagleBone is a low-cost (only $89!) ARM development board equipped with a Sitara AM3358 Cortex-A8 from Texas Instruments. It has on-board ethernet, a mircoSD-card slot, USB (both host and serial/JTAG), as well as expansion headers with lots of I/Os to play around with. I got mine a couple of weeks ago, but haven’t had the time to do anything really interesting with it yet. I did however install Arch Linux just for fun, and while the process was fairly straight-forward I have documented it here in case anyone wants to try it out.

Preparation

To build the bootloader and kernel, you’ll need a cross-compilation toolchain like cross-arm-none-eabi-gcc as well as uboot-mkimage which is used to create images in the format used by u-boot. I used the SD-card that came with the BeagleBone, and just reformatted the two partitions

 $ sudo mkfs.vfat -F 32 -n "boot" /dev/sdb1
 $ sudo mke2fs -j -L "rootfs" /dev/sdb2

(Note that mkfs.vfat requires the dosfstools package). In the commands below, the boot and rootfs partitions are assumed to be mounted on /media/boot and /media/rootfs respectively.

Root file system

The Arch Linux ARM project has pre-built root file systems for several different ARMv5, ARMv6 and ARMv7 platforms. The OMAP3/4 ARMv7 root file system is the closest match for the BeagleBone (since the OMAP 3 and 4 are also ARMv7 SoCs designed by Texas Instruments):

 $ wget http://archlinuxarm.org/os/ArchLinuxARM-omap-smp-latest.tar.gz

and extract it (as root)

 $ sudo tar xvzf ArchLinuxARM-omap-smp-latest.tar.gz -C /media/rootfs

Boot loader

The Texas Instruments Arago Project hosts staging repositories for board support until it can be merged upstream. Download and build the bootloader:

 $ git clone git://arago-project.org/git/projects/u-boot-am33x.git
 $ cd u-boot-am33x
 $ make ARCH=arm CROSS_COMPILE=arm-none-eabi- am335x_evm_config
 $ make ARCH=arm CROSS_COMPILE=arm-none-eabi-
 $ sudo cp MLO /media/boot/
 $ sudo cp u-boot.img /media/boot/

Kernel

Download, configure and build the kernel:

 $ git clone git://arago-project.org/git/projects/linux-am33x.git
 $ cd linux-am33x
 $ make ARCH=arm CROSS_COMPILE=arm-none-eabi- am335x_evm_defconfig
 $ make ARCH=arm CROSS_COMPILE=arm-none-eabi- menuconfig
 $ make ARCH=arm CROSS_COMPILE=arm-none-eabi- uImage
 $ sudo cp arch/arm/boot/uImage /media/boot/

Build and install kernel modules if needed:

 $ make ARCH=arm CROSS_COMPILE=arm-none-eabi- modules
 $ sudo make ARCH=arm CROSS_COMPILE=arm-none-eabi-
     INSTALL_MOD_PATH=/media/rootfs/ modules_install

Almost done…

Finally, edit /etc/inittab in the rootfs to use the correct serial port for the console.

 --- inittab.original 2012-01-14 22:21:27.000000000 +0100
 +++ inittab.beaglebone 2012-01-14 22:21:40.000000000 +0100
 @@ -24,7 +24,7 @@
 su:S:wait:/sbin/sulogin -p
 # -8 options fixes umlauts problem on login
 -s0:12345:respawn:/sbin/agetty -8 -s 115200 ttyO2 linux
 +s0:12345:respawn:/sbin/agetty -8 -s 115200 ttyO0 linux
 c1:2345:respawn:/sbin/agetty -8 -s 38400 tty1 linux
 c2:2345:respawn:/sbin/agetty -8 -s 38400 tty2 linux
 c3:2345:respawn:/sbin/agetty -8 -s 38400 tty3 linux

The SD-card should now be ready to boot Arch Linux on the BeagleBone.