FreeBSD on Beagle Bone Black (easy as pie)

Posted on

For a long time, my Beagle Bone Black  sat on my desk, gathering dust. Recently I decided I would give it a purpose: as a replacement for the crappy DHCP server and DNS on my home router (it’s a Huawei g655d, and it has poor wireless range, a lousy interface, and wonky internal DNS). I ran an update on the Bone, which promptly downloaded a whole bunch of packages from the angstrom distribution. Over plain unauthenticated http. With, as far as I could see, no further checksumming or anything. Bad doggy.

Resigned to replacing the on-board distro anyway, I decided I would try FreeBSD, since that’s my OS of choice — if it didn’t work out, OpenSUSE would do.

Anyway. I wouldn’t be writing this if there weren’t a whole bunch of giants on whose shoulders I could stand, since actually, the whole process was deceptively simple and well-documented.

Hardware Setup: Here’s a picture of my Beagle Bone, on an old DVD-case.

Beagle Bone Black
Beagle Bone Black on FreeBSD

I started from the FreeBSD Beagle Bone wiki page. I power the Bone over USB from a powered hub. There’s a Olimex 3-pin serial cable attached. I spent a frustrating hour with this until I read somewhere that sometimes the TX and RX wires are reversed — so I swapped red and green and voila! You can see that in the picture.

Here’s part of the boot messages:

KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2015 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 10.2-STABLE #0 r287149: Thu Aug 27 06:11:58 UTC 2015
root@releng1.nyi.freebsd.org:/usr/obj/arm.armv6/usr/src/sys/BEAGLEBONE arm
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
CPU: Cortex A8-r3 rev 2 (Cortex-A core)
Supported features: ARM_ISA THUMB2 JAZELLE THUMBEE ARMv4 Security_Ext
WB disabled EABT branch prediction enabled
LoUU:2 LoC:3 LoUIS:1
Cache level 1:
32KB/64B 4-way data cache WT WB Read-Alloc
32KB/64B 4-way instruction cache Read-Alloc
Cache level 2:
256KB/64B 8-way unified cache WT WB Read-Alloc Write-Alloc
real memory = 536870912 (512 MB)

The FreeBSD image for Beagle Bone expands to fill the SD card, so I have a nice 8GB drive with a basic FreeBSD installation — hardly any different from when I create a fresh FreeBSD VM in VirtualBox.

Software Setup: then I tried to compile something. There are no binary packages generally available for ARM targets from FreeBSD, but you can compile everything from FreeBSD ports, no problem. Except after about 40 minutes waiting on the very first port that needs to be done, pkg(8), I was about to give up on this path.

At that point, Ralf Nolden asked something that totally turned this little project around: why don’t you use poudriere for cross-compiling?

I’ll point to Randy Westlund for a simple and straightforward recipe. No need to repeat it here, since the only difference between my setup and his are a few minor filesystem path changes. Randy points at Doug and there’s more pointers from there if you want to follow the historical references. Giants.

Suffice to say that poudriere is awesome.

Really. Follow Randy’s “Installing the Tools” steps, take the required modifications
to poudriere.conf from Doug, then continue with “Build the Environment”.

On an i7 860 @2.8GHz, this took less than an hour, if I recall correctly. Maybe an hour and a half, which gave me time to read the documentation on other bits and pieces.

I picked a few packages — isc-dhcp42-server and unbound — and kicked off a poudriere build. I turned off all the DOCS and EXAMPLES options, since I can get those on the build host and they don’t need to be on the Bone. From the extensive logging poudriere produces, I can see that it took a little over an hour and a half. For an overnight build, that’s cheap.

And then the moment of truth:

root@beaglebone:/usr # pkg install isc-dhcp41-server
Updating bbbbuild repository catalogue...
bbbbuild repository is up-to-date.
All repositories are up-to-date.
Updating database digests format: 100%
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
isc-dhcp41-server: 4.1.e_9,2

The process will require 2 MiB more space.
473 KiB to be downloaded.

So there you go! FreeBSD and ARMv6 packaging is as easy as pie. Now the Bone is doing something useful, I can start using poudriere for silly things,
like building Qt5 so I can write a Qt application to control the user LEDs on the board.

5 Comment(s)

  1. I am a newbie and want to use FreeBSD on this BBB. I am using FreeBSD11-head for the HDMI output and a usb keyboard. On first boot I get all good except cannot login via local keyboard, blank password. On startup I am left with this login:
    Help.
    I tried the serial/Prolific cable with same result.
    I have tried putty via Windows to my proper com port with good results, no login though.

    Seems there is a root password, or something i cant find? I can try SSHd as well but would rather use local control..

  2. Looks like my problem is just affecting FreeBSD version 10.2 and Head. I got so distraught I tried FreeBSD 10.1-armv6 and it worked -Login:Root -blank password- first try….Glad to see it working…The script for copy-to-emmc.sh is broken.
    Thanks for the info here. I will need it.

  3. Well found the answer in the FreeBSD Release notes for arm.
    login:root
    password:root

    jackpot. time to get to work on an poudriere machine and maybe an NFS share…

    Thanks for Listening

  4. Just as a follow up. They did change passwords on version 10.2 and above. It is now root/root for user password.

    I also noticed a newer build in R11-current and tried it. Works well and there is a repository up now with limited software. I ran -pkg install- and it installed pkgng2 from the web..Then i ran pkg install nano and that pulled as well…Tried xorg with no luck..I think LXDE should be OK, Do You??

Comments are closed.