July 2013

Building a Beaglebone FreeBSD Kernel

Building a FreeBSD kernel for Beaglebone is not terribly difficult.  Firstly, you need the FreeBSD-Current sources: svn co http://svn0.us-east.freebsd.org/base/head /src/FreeBSD/ Next, build the cross-development tools for FreeBSD: cd /src/FreeBSD/head make XDEV=arm XDEV_ARCH=armv6 xdev Then get Crochet-FreeBSD.  This is by far the easiest way to build a FreeBSD kernel for Beaglebone git clone git://github.com/kientzle/crochet-freebsd.git Once you have Crochet, you’ll need u-boot. You can get the latest sources here.  You’ll need to drop them into your crochet directory. Crochet needs the “auditdistd” user, so if you’re not on FreeBSD-10, or CURRENT, you’ll need to add that user: pw useradd auditdistd  -s /usr/sbin/nologin -g wheel Finally, once you’ve editted “config.sh” to set up the source directory for FreeBSD and to select the Beaglebone build, you can run it: sh crochet.sh -c config.sh Once crochet has finished, it will have produced an image file into the /work/ subdirectory of crochet-freebsd.  Write that image file to a sd card. dd if=FreeBSD-armv6-BEAGLEBONE.img of=/dev/rdisk1 bs=1m You’ll likely want to set up a serial console.  In order to do that, you need one of these, a PL2303 serial cable.  You can get one here.  The pin connections are as described at circuitco. Function      Beagleboard    Wire Ground        Pin1           Black Receive       Pin4           Green Transmit     Pin5           White On OS X, you’ll need PL2303 serial drivers.  You can get those here.  You should then have this device on OS X /dev/tty.PL2303-000013FA Once the Beagleboard is plugged in, you can get a serial console like this: screen /dev/tty.PL2303-000013FA 115200 To boot the SD card, follow the instructions here.  For simplicity sake, I have included the instructions: Disconnect the power to the Beagleboard Connect the serial cable to both the Beagleboard and the computer Insert the micro-SD card Hold the Boot switch.  This is the switch at the opposite end of the board from the LEDs, adjacent to the SD card slot Connect the power to the Beagleboard Release the Boot switch In my case, I had connected the serial cable and brought up screen previously; that way I could see the boot-up messages. If you want to try it for yourself, the .img file is here.  

Beaglebone Serial Console on OS X

I recently got a Beaglebone Black.   I was very excited; it’s similar to a Pi, but has 60 GPIO ports! Getting a serial console up on it was not quite a simple as I thought, since the BeagleBone uses FTDI.  Following the instructions here I installed the OS X serial driver for FTDI.   After plugging in the device, I had this new serial device: /dev/tty.usbmodemfa133 So to get a serial console up I typed: screen /dev/tty.usbmodemfa133 115200 Once I had the Beaglebone started and had a network connection, the next step was to update the package manager.  If you’re interested, the default OS on the Beaglebone is Angstrom Linux, and the package system is Itsy.  You can view the available packages here. opkg update opkg upgrade Since I had a USB Wifi Adapter, it seemed to make sense to use it.  My adapter is an PCUSBW1150. opkg list ‘linux-firmware-rt*’opkg install linux-firmware-rtl8192cu After a reboot, I now have a wlan0 device: wlan0 Link encap:Ethernet HWaddr 00:02:72:C3:AB:72 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Angstrom uses connman to manage network settings.  My connman configuration for my wifi is in the file ‘/var/lib/connman/wifi.config’ and looks like: [service_home] Type=wifi Name=shrek2.5 Security=wpa Passphrase=passpasspass Once connman is configured, restart it systemctl restart connman.service Finally, some additional configuration. I installed nano opkg install nano To change the hostname, edit the file ‘/etc/hostname’