Bringing up Debian on BeagleBone Black

| tagged with
  • bbb
  • debian

BeagleBoard.org has recently been gradually playing with the idea of replacing the long-used Angstrom distribution to Debian. Thanks in large part to the incredibly productive Robert C. Nelson the transition seems to be quite smooth. Below I document my attempt at bringing up a BeagleBone Black with one of Robert’s Debian images.

Initial setup

  1. Download image. I used a testing image from the elinux wiki.

  2. Write to SD card,

    $ dd if=BBB-eMMC-flasher-debian-7.6-console-armhf-2014-09-04-2gb.img.xz of=/dev/mmcblk0
  3. Boot BeagleBone from SD card; a great deal of flashing commences. When flashing stops unplug BBB, remove SD card.

Making things hospitable

The default Debian image is quite spartan. In fact, it doesn’t even include wpa_supplicant or the firmware for my Ralink RT5370 wifi adapter. To download these I used wired ethernet,

  1. Plug in Ethernet cable

  2. Apply power to BBB

  3. Monitor DHCP logs for BBB’s request

  4. SSH to BBB (the default username is debian, password is temppwd). Then,

    $ sudo adduser ben
    $ sudo adduser ben adm
    $ sudo adduser ben admin
    $ sudo passwd -d debian
    $ sudo apt-get update
    $ sudo apt-get install wpasupplicant firmware-ralink vim iw usbutils lsb-release
    $ sudo apt-get install tmux git bash-completion
  5. Unfortunately the rt2800usb drivers perform very poorly with power-saving enabled (the default). Thankfully Stack Overflow has the answer to this,

    $ echo 'ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*" RUN+="/usr/bin/iw dev %k set power_save off"' | sudo tee /etc/udev/rules.d/70-wifi-disable-powersave.rules
  6. Configure wlan0 in /etc/network/interfaces.

  7. Reboot and ensure that wlan0 comes up.

Upgrading the kernel

The image I downloaded included a rather ancient 3.8 kernel. Let’s try the 3.14 kernel currently under testing,

$ sudo apt-get install linux-image-3.14.17-ti-r19

Things appear to still work after reboot.

Modifying the Devicetree

Robert Nelson’s [dtb-rebuilder][] repository has sources for the upstream Devicetrees,

$ git clone https://github.com/RobertCNelson/dtb-rebuilder
$ cd dtb-rebuilder/src/arm
$ cp am335x-boneblack-audio.dts am335x-boneblack-mycape.dts
$ make -C../..

Next, copy am335x-boneblack-mycape.dtb to /boot/dtbs/$KERNEL_VERSION on the device. Finally, you need to configure u-boot to use your new Devicetree: in /boot/uEnv.txt set dtb to, e.g., am335x-boneblack-mycape.dtb. Reboot and hopefully things work.

Building a new kernel

The official BeagleBoard kernel tree is now hosted by the beagleboard organization on Github.

$ git clone git@github.com/beagleboard/linux
$ git checkout 3.14.17-ti-r17
$ make menuconfig ARCH=arm
$ KDEB_PKGVERSION=1wheezy KBUILD_DEBARCH=armhf make deb-pkg ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- LOCALVERSION=-mycape

Copy the resulting .debs in the parent directory to the device and install with dpkg -i.

Further resources

  • https://groups.google.com/d/topic/beagleboard/4eDQvQOkUkc/discussion