Installing Pristine Debian On A BeagleBone

Introduction

BeagleBoard.org recommends their own Debian flavour images as the OS for the BeagleBone range of open hardware boards. Indeed, Beagle Debian images have the fullest hardware support and are easy to install to the internal eMMC. Hence they are the recommended OS for newbies and hardware hackers alike.

My only gripe with Beagle Debian is that it includes some proprietary blobs like TIDL, TI CGT and WiLink firmware. Never being a fan of black boxes I tried to install pristine Debian on my BBG board. It turned out to be non-trivial so here I am sharing my steps.

Overview

Debian installer supports BeagleBone and other embedded ARM boards via UART, so you don’t even need a monitor and keyboard to use it. Debian instructions are straightforward, as is the installer UI.

The only gotcha is that bootloader must be manually installed. Installer has not been taught yet how to provision bootloaders for the myriad of ARM boards. And without this manual step your successful Debian installation will simply not boot.

Instructions

Create SD Card With Debian Installer

Follow the Debian instructions:

$ wget https://get.debian.org/debian/dists/stable/main/installer-armhf/current/images/netboot/SD-card-images/partition.img.gz
$ wget https://get.debian.org/debian/dists/stable/main/installer-armhf/current/images/netboot/SD-card-images/firmware.BeagleBoneBlack.img.gz
$ zcat firmware.BeagleBoneBlack.img.gz partition.img.gz > complete_image.img

Then write the complete image to your micro SD card. Be careful which disk you write to!

$ sudo dd if=complete_image.img of=/dev/sdX

Build Mainline U-Boot

Instead of searching for binary releases it was far easier to simply build U-Boot myself.

I like “living on the edge” and used current top-of-tree. You may want to checkout a stable tag, though.

$ git clone git://git.denx.de/u-boot.git
$ cd u-boot
$ export CROSS_COMPILE=arm-none-eabi-
$ make am335x_evm_defconfig
$ make -j10

Mount the prepared SD Card on your host and copy the bootloader images there. They will be used during installation. You need MLO and u-boot.img.

$ cp MLO u-boot.img /media/dinux/CB3C-5B3C/

HW Prerequisites

Ethernet connection will be needed by installer to fetch packages. You will also need USB TTL Serial Cable to access the BeagleBone serial port. The FTDI cable matches exactly the pinout on BeagleBone serial console pin header. But you should also be able to hook any other 3V3 TTL UART.

Using The Installer

Now you can insert the Micro SD Card and power up your BeagleBone. After a few seconds you should be able to see the installer’s welcome screen:

Installer's Welcome Screen

UI is straightforward. Use arrow keys, TAB and ENTER for navigation. Ctrl+A followed by 1, 2, 3 or 4 will switch respectively between main UI, shell, shell and log. This key combination should be familiar to GNU Screen users.

Ctrl+L will refresh the screen. This may be useful if you connect the UART cable after board has booted.

Partitioning

You’ll have to partition your eMMC manually.

First create a small 8MB partition and mark it is “do not use this partition”. That’s where the bootloaders will go.

Second, create a new logical partition using the rest of the space and mark that we’ll use it for root filesystem / . Mark it as bootable just in case.

Here is how eMMC partitioning (mmcblk1) should look like: Partitioning

Installing Bootloaders

Please follow the steps until you reach the “Finish the installation” screen: Finish Screen

Stop and do not reboot!

When installer finishes but before rebooting the board you need to install u-boot. Unfortunately this step is manual and the installer will not do it for you.

Switch to shell using Ctrl+A followed by pressing 2.

Mount SD Card so that we can access the u-boot images prepared earlier:

~ # mkdir m
~ # mount /dev/mmcblk0p1 m

Write bootloaders:

~ # dd if=m/MLO of=/dev/mmcblk1 count=1 seek=1 conv=notrunc bs=128k
~ # dd if=m/u-boot.img of=/dev/mmcblk1 count=2 seek=1 conv=notrunc bs=384k
~ # umount m
~ # sync

For reference, here is a screenshot of the sequence: Installing Bootloaders

Finishing Installation

Now that installer has finished installing packages and you have provisioned the bootloaders, you may reboot. Remove the SD Card and enjoy your new Debian installation.