The BeagleBone is a low-power open source hardware single-board computer designed with open source software development in mind, and as a way of demonstrating the Texas Instrument’s OMAP3530 system-on-a-chip.
It comes with a 4GB SD card with a preinstalled Angström Linux. The simplest method to use the console is to connect the board to your PC with the supplied USB cable. It will bring up a serial interface (it should mount the SD card on the PC for the first time but this never worked for me – if it mounts the card for you, just unmount it). Use a terminal (like minicom, gtkterm or RealTerm in a Windows world) with the settings 115200 baud, 8 bits, 1 stop bit.
After bootup you can login with root without a password. The usb0 network interface should come up, if it doesn’t, issue the following commands on the Bone:
ifconfig usb0 192.168.7.2
route add default gw 192.168.7.1
echo “nameserver 126.96.36.199” > /etc/resolv.conf
The PC should have a new eth1 interface by now, set an address for it and enable NAT, so the Bone can reach the internet:
ifconfig eth1 192.168.7.1
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo "1" >/proc/sys/net/ipv4/ip_forward
Replace eth0 with the interface of your internet connection (if you’re using Wi-Fi, probably it’s wlan0).
The boot process
Here’s the BeagleBone boot sequence:
- On-chip bootloader starts
- Loads the MLO from the SD card
- The MLO loads U-Boot
- U-Boot loads the Linux kernel image
There should be 2 partitions on the SD card, a smaller FAT32 boot partition (bootfs) and a larger system partition (rootfs, with an ext3, ext4 or other filesystem). The boot partition has the MLO and u-boot.img files. Some U-Boot versions search for the kernel image in the boot partition, some just simply mount the system partition and search for the image in it’s /boot folder. Make sure there’s only one kernel image on the SD card, preferably in the /boot folder of the rootfs.
If you want to replace the boot loader, just simply overwrite these files. Be sure to make a full backup of the SD card before you proceed with replacing the factory Angström distrib with your custom one. Put the SD card into a card reader on your PC and issue the following command:
sudo dd if=/dev/sde bs=8M | bzip2 -c > beaglebone-default.img.bz2
Replace /dev/sde with the SD card device file.
There are some commands you can use in the U-Boot shell. The most important ones are:
- boot – boot default, i.e., run ‘bootcmd’
- set bootfile something.img – sets the filename to load to the given parameter
Building a custom Angström distribution
You’ll need bitbake (apt-get install bitbake).
git clone git://github.com/Angstrom-distribution/setup-scripts.git
MACHINE=beaglebone ./oebb.sh config beaglebone
MACHINE=beaglebone ./oebb.sh update
MACHINE=beaglebone ./oebb.sh bitbake virtual/kernel
MACHINE=beaglebone ./oebb.sh bitbake console-image
The latter command missed some packages for me, install those and proceed. After everything’s finished, you’ll have a rootfs and a bootfs in the build/tmp-angstrom_v2012_05-eglibc/deploy/images/beaglebone directory. Simply erase everything on the SD card and copy the contents of these two files to their partitions.
Building a custom kernel for the BeagleBone
You’ll need the TI Arago cross-compiler which is in the BeagleBone SDK. Download it from here (ti-sdk-am335x-evm-05.04.01.00-Linux-x86-Install). There are some useful development documentations here too.
After installing I had the SDK in my home in the ti-sdk-am335x-evm-05.04.01.00 directory. To have the cross-compiler in the path, I added this to the end of my ~/.bashrc:
I downloaded a fresh kernel source for the Bone:
git clone https://github.com/RobertCNelson/linux-dev.git
git checkout origin/am33x-v3.2 -b am33x-v3.2
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
cp system.sh.sample system.sh
Edit system.sh and change the LINUX_GIT and CC lines to these:
Run the ./build_kernel.sh script to start compiling. Next time you want to recompile just issue the following command in the KERNEL directory:
make ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- uImage
This way only the modified components get recompiled. You’ll have the uImage file in the arch/arm/boot/ directory. Here’s how to compile the modules to the ~/0modules/ directory:
make ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- modules
make ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- INSTALL_MOD_PATH=~/0modules/ modules_install
Copy the created uImage file to the SD card’s /boot directory (on the rootfs), and copy the modules to the rootfs’ /lib/modules directory.
SCP and Midnight Commander on the BeagleBone
Anström has dropbear by default. To get scp to work, I had to make a symlink:
ln -s /usr/sbin/dropbearmulti /usr/bin/scp
Click here for the Midnight Commander compiling howto.