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:

  1. Disconnect the power to the Beagleboard
  2. Connect the serial cable to both the Beagleboard and the computer
  3. Insert the micro-SD card
  4. Hold the Boot switch.  This is the switch at the opposite end of the board from the LEDs, adjacent to the SD card slot
  5. Connect the power to the Beagleboard
  6. 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.

 

8 Responses to "Building a Beaglebone FreeBSD Kernel"

  • Dan
    July 27, 2013 - 7:57 pm Reply

    Your image did not work on Beaglebone Black for me. I tried holding down the user/boot and got only the power light. When I tried to boot without holding down the user/boot I got 3 solid green lights and the power led lit. I need to run an program written for a FreeBSD system (it will not compile on Debian) and all I have is a MacBook Pro OS/Lion. Any chance of getting a bootable image for BBB (8 or 16 gb micro sd)? I am trying to load dragonfly livecd. Or, can I create the image in ubuntu – I have a working 12.04 running in VMWare. Also, the uenv.txt file was empty, and I currently do not have a serial cable. This mean I need to be able to ssh into FreeBSD once it loads. I got my BBB 2 weeks ago – so it should be the latest version. I don’t need to press the boot switch to have it load from an SD card – debian or ubuntu.

  • Isaac
    January 14, 2014 - 5:41 pm Reply

    I have the “FreeBSD-arm-10.0-BEAGLEBONE.img” image already applied to the “SD Card”, but want to know how to replace the default “Angstrom” on the “eMMC” with the applied image on the “SD Card”.

    It boots-up fine from the “SD Card”, but when I type “df -h”, I get the following…

    Filesystem Size Used Avail Capacity Mounted on
    /dev/mmcsd0s2a 921M 305M 542M 36% /
    devfs 1.0k 1.0k 0B 100% /dev
    /dev/mmcsd0s1 2M 691k 1.3M 34% /boot/msdos
    /dev/md0 28M 24k 26M 0% /tmp
    /dev/md1 14M 76k 13M 1% /var/log
    /dev/md2 4.4M 8.0k 4.0M 0% /var/tmp

    …and to me…none of these standout as the “Beaglebone Blacks eMMC”.

    Yes, I’m pretty new, but I’ve gotten everything to work just as you’ve said so far.

    Thanks a billion as it would have taken me a LONG TIME to achieve what you’ve done in such a short time.

    • tom@khubla.com
      January 14, 2014 - 8:43 pm Reply

      Hi. Firstly, I should mention that Crochet was not just me, and in fact I am a minor contributor. There is quite a large community around Crochet.

      As far as replacing Angstrom on the BB, I’ve never tried that. I’ll build a kernel, give it a try this weekend, and get back to you.

      • Isaac
        February 1, 2014 - 9:57 am Reply

        Sounds good sounds good!

        Been offline due to catching the flu, but I’m back now.

        Not rushing you as I realize life surely can get busy, but what all have you found yet?

      • Isaac
        February 1, 2014 - 5:08 pm Reply

        Update…

        I found out that not only is HDMI still not supported as of the 31st of December, 2013, but also putting FreeBSD 10 on the eMMC isn’t supported yet either.

        The eMMC support for the BeagleBone Black is in the works…but…no firm date as of yet.

        On a sidenote…I’m running Mac OS X 10.8.5 and figured I’d try to compile my own up.

        svn co http://svn0.us-east.freebsd.org/base/head /src/FreeBSD/

        …pulls down all the files from what it appears, but when I try to do…

        make XDEV=arm XDEV_ARCH=armv6

        …I am greeted with “Makefile:129: *** missing separator. Stop.”.

        Level with me…how can I do with on a Mac OS X 10.8.5 or something I can edit to get this show on the road?

        • tom@khubla.com
          February 2, 2014 - 7:39 pm Reply

          The easiest platform to compile crochet on is FreeBSD. Have you tried installing FreeBSD in VirtualBox, and building it there?

          • Isaac
            February 3, 2014 - 3:54 pm

            I tried with the latest version of FreeBSD 10 on Mac OS X 10.8.5 on VirtualBox.
            Unless I’m mistaken…try it there, and you’ll get the same error I did after it commenced installing the ports and docs and stopped short and tried to redo itself once more.

            I tried the i386 flavor for CD not the DVD iso.

            FreeBSD 9 I was able to get to work flawlessly though.

          • tom@khubla.com
            February 8, 2014 - 3:16 pm

            Could you post the full error log?

Leave a Reply