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

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 2015-07-11 at 13:34 -0700, Tim Kientzle wrote:
> > 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?
> 
> ================
> 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’ve 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.)
> 
> ================
> 2. If you want to build a semi-custom image, you might look at Crochet:
> 
>     https://github.com/freebsd/crochet
> 
> ================
> 3. If you really want the thrill of doing it yourself from scratch, here’s 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=arm TARGET_ARCH=armv6 buildworld
> $ make TARGET=arm TARGET_ARCH=armv6 KERNCONF=BEAGLEBONE 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’ll have to set up a suitable cross-compiler and track down the necessary patches.)
> 
> 3) Build a suitable ubldr
> 
> $ cd /usr/src
> $ make TARGET=arm TARGET_ARCH=armv6 buildenv
> # Above command starts a new shell with the appropriate ARM build environment
> $ cd sys/boot
> $ make UBLDR_LOADADDR=0x88000000 -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’re 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 ‘BB’ prefix on ubldr, uboot.img and uEnv.txt is the old Crochet convention; if you’re using U-Boot from ports, omit that.
>  * The new convention is to put the DTB on the UFS partition, though I don’t 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=arm TARGET_ARCH=armv6 DESTDIR=/mnt installworld
> $ make TARGET=arm TARGET_ARCH=armv6 DESTDIR=/mnt distrib-dirs
> $ make TARGET=arm TARGET_ARCH=armv6 DESTDIR=/mnt distribution
> $ make TARGET=arm TARGET_ARCH=armv6 DESTDIR=/mnt installkernel
> $ echo “KERNCONF=BEAGLEBONE” > /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.

Here is some more info on arm cross-building...

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

It's oriented towards setting up a development environment for doing
edit/compile/test cycles on freebsd kernel or userland source, but it's
got a lot of good background info on cross building in general.

-- Ian





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1436648478.1334.183.camel>