Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Jul 2015 13:34:51 -0700
From:      Tim Kientzle <tim@kientzle.com>
To:        Leonardo Fogel <leonardofogel@yahoo.com.br>
Cc:        freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: How to Xbuild to BBB?
Message-ID:  <19291C97-5A51-42D2-AC08-6B067AB8D2BD@kientzle.com>
In-Reply-To: <1436542993.46776.YahooMailBasic@web120803.mail.ne1.yahoo.com>
References:  <1436542993.46776.YahooMailBasic@web120803.mail.ne1.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help

> I'd also tried different instructions that Google had suggested. =
They'd all failed too. Please, could you kindly point me to right =
instructions on how to cross-build to BBB?

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
1. If you just want a working system, start with the official snapshot =
images which can just be copied onto an SD card and booted:

ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/arm/armv6/ISO-IMAGES/11.0

ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/arm/armv6/ISO-IMAGES/10.0

After you=E2=80=99ve booted from there, you can do a native upgrade from =
source using the same instructions as for i386 or any other FreeBSD =
platform.  (This requires some patience: native source upgrades on BBB =
take about 40 hours.)

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
2. If you want to build a semi-custom image, you might look at Crochet:

    https://github.com/freebsd/crochet

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
3. If you really want the thrill of doing it yourself from scratch, =
here=E2=80=99s the outline.  (This is based on how Crochet does it; =
there are many variations.)  Note that the hard part here is getting the =
boot bits (U-Boot and ubldr) right.  Actually cross-building FreeBSD and =
installing it on the SD card is quite straightforward.

Caveat:  It is *essential* that you have a working serial console cable =
such as Adafruit 954.  Without this, it is practically impossible to =
diagnose boot problems.

1) Cross-build the system and kernel:

$ cd /usr/src
$ make TARGET=3Darm TARGET_ARCH=3Darmv6 buildworld
$ make TARGET=3Darm TARGET_ARCH=3Darmv6 KERNCONF=3DBEAGLEBONE =
buildkernel

2) Get a suitable version of U-Boot.  The easiest way to do this is from =
ports:  sysutils/u-boot-beaglebone

(Building U-Boot from source is more complicated; you=E2=80=99ll have to =
set up a suitable cross-compiler and track down the necessary patches.)

3) Build a suitable ubldr

$ cd /usr/src
$ make TARGET=3Darm TARGET_ARCH=3Darmv6 buildenv
# Above command starts a new shell with the appropriate ARM build =
environment
$ cd sys/boot
$ make UBLDR_LOADADDR=3D0x88000000 -m /usr/src/share/mk all
$ exit

4) Format your SD card appropriately with MBR, a 2-megabyte FAT =
partition, and the rest  as UFS.  Mount it as /mnt.

5) Here is a somewhat outdated description of the BeagleBone boot file =
layout that you can use to populate the FAT partition (note that the old =
BeagleBone and the new BBB work the same way):

   https://wiki.freebsd.org/FreeBSD/arm/BeagleBone

If you=E2=80=99re using the U-Boot port, just copy all of the files from =
/usr/local/share/u-boot/u-boot-beaglebone onto the FAT partition to =
start.

The Wiki page is outdated in the sense that:
 * The =E2=80=98BB=E2=80=99 prefix on ubldr, uboot.img and uEnv.txt is =
the old Crochet convention; if you=E2=80=99re using U-Boot from ports, =
omit that.
 * The new convention is to put the DTB on the UFS partition, though I =
don=E2=80=99t recall the exact layout offhand.
(Hopefully someone knowledgable will update that page with more current =
information.)

6) install FreeBSD onto the SD card UFS partition (be *very* certain =
that you get the DESTDIR argument right here!).

$ cd /usr/src
$ make TARGET=3Darm TARGET_ARCH=3Darmv6 DESTDIR=3D/mnt installworld
$ make TARGET=3Darm TARGET_ARCH=3Darmv6 DESTDIR=3D/mnt distrib-dirs
$ make TARGET=3Darm TARGET_ARCH=3Darmv6 DESTDIR=3D/mnt distribution
$ make TARGET=3Darm TARGET_ARCH=3Darmv6 DESTDIR=3D/mnt installkernel
$ echo =E2=80=9CKERNCONF=3DBEAGLEBONE=E2=80=9D > /mnt/etc/src.conf
$ touch /mnt/firstboot

7) Customize the UFS setup as you wish.  This might include tweaking =
rc.conf or changing any other configuration settings of interest.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19291C97-5A51-42D2-AC08-6B067AB8D2BD>