Skip to content

Instantly share code, notes, and snippets.

@tcr
Last active February 16, 2016 10:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tcr/7f753f93b671733c9e72 to your computer and use it in GitHub Desktop.
Save tcr/7f753f93b671733c9e72 to your computer and use it in GitHub Desktop.
Creating a reusable Beaglebone Debian Image

BeagleBone Debian Image

Quick reference:

screen /dev/tty.usbmodem1d113 115200 (tty)
ssh debian@beaglebone.local (ethernet)
ssh debian@192.168.7.2 (usb0)

SSH takes about 30s to boot up after plugging in, tty is much sooner.

Building a new SD Card

Download from http://beagleboard.org/latest-images. Last known good image: 2014-05-14 (MD5 35877ce21e8ed0eb1bdc6819ad71c317)

Extract using unxz, then use this to create an SD card using dd. For example, on OS X:

brew install axel unxz
axel -a http://debian.beagleboard.org/images/bone-debian-7.5-2014-05-14-2gb.img.xz
unxz bone-debian-7.5-2014-05-14-2gb.img.xz
sudo dd if=bone-debian-7.5-2014-05-14-2gb.img of=/dev/rdisk1 bs=1m

Plug in SD card to BeagleBone, hold down boot button when resetting and/or turning on power. Hold the boot button down until the blue lights all turn on.

On this build, udhcpc is broken. (See output of systemd-journalctl | grep udhcp for example.) We'll connect over TTY first:

screen /dev/tty.usbmodem1d113 115200

Now, run the following commands:

sudo touch /var/lib/misc/udhcpd.leases
sudo chown -R $USER /var/lib/misc/udhcpd.leases

You can now reset (unplug and plug back in) the board. You can now SSH to the board over USB. (If not, see Troubleshooting below.)

ssh debian@192.168.7.2

Password is temporarily "temppwd".

Configuring

You can resize the image to fill an SD card easily. First we'll rebuild the partition, then reboot, then resize the filesystem. Run this on the Beaglebone:

sudo fdisk /dev/mmcblk0
p
d
2
n
p
2


p
w

Then reboot. Then:

sudo resize2fs /dev/mmcblk0p2

Now with an internet connection (if over USB, see below) and the space to update apt repositories:

sudo apt-get update
sudo apt-get upgrade

To update the hostname, edit /etc/hostname to be e.g.

steward

and /etc/hosts to be

127.0.0.1 localhost
127.0.0.1 steward

You should now change your password, and also the root password:

passwd
sudo passwd root

To install Node.js, make sure to follow the correct instructions.

Ethernet over USB

Trying to use Internet Sharing on OS X with udhcpd has issues, so you can try udhcpc instead. To get internet over USB, scp the Debian Wheezy ARMHF package of udhcpc to the Beaglebone:

wget http://ftp.us.debian.org/debian/pool/main/b/busybox/udhcpc_1.20.0-7_armhf.deb
scp udhcpc_1.20.0-7_armhf.deb debian@192.168.7.2:~/

Then on the Beaglebone, use the TTY to install the package:

cd ~
sudo dpkg -i udhcpc_1.20.0-7_armhf.deb

Again over TTY, kill udhcpd then launch the USB<->Ethernet bridge:

sudo killall udhcpd
sudo udhcpc -i usb0

Then SSH in as normal, using the IP that was leased to the device in the output of udhcpc.

Troubleshooting

If you can't connect over USB0 (debian@192.168.7.2), ensure that in your OS X network configuration there exists an entry Beaglebone Black (en) that has a manual DHCP address to 192.168.7.1.

Further work

TODO creating systemd service?

TODO building custom kernel? from what source

TODO have to hold down boot button while booting?

External links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment