Cross compiling FreeBSD

Christian Kratzer ck-lists at cksoft.de
Fri Jan 16 01:50:17 PST 2009


Hi,

On Wed, 14 Jan 2009, Andrew Hotlab wrote:

>
>> From: andrew.hotlab at hotmail.com
>> To: freebsd-questions at freebsd.org
>> Subject: Builder for many architectures and releases
>> Date: Sat, 10 Jan 2009 02:37:37 +0000
>>
>> [...] I looked for any documentation about setup a FreeBSD builder machine which will track sources and build binaries for all the hardware platform and OS releases I need to support in my network. I have found some interesting articles (http://www.onlamp.com/pub/a/bsd/2006/04/13/freebsd-build-system.html - http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/small-lan.html), but nothing which actually addresses my needs. [...]
>>
>
> At this time, I've tried to build RELENG_7_1 for the i386 architecture using an amd64 machine (running RELENG_7_0 for amd64) then, exporting /usr/src and /usr/obj via NFS in read-only mode to target machines, I've experienced a lot of troubles trying to install both kernel and world, which made impossible for me to install FreeBSD on target i386 machines.
> Can anyone kindly confirm that it's a supported procedure to compile FreeBSD for a Tier1 architecture by using another Tier1-architecture machine? Maybe I didn't understood documentation or I'm missing some essential steps in the build process?

as you already found out this does not work as the crossbuild process
will build the native host tools in /usr/obj and the target system
binaries in /usr/obj/i386.

On recent RELENG_7 or HEAD machines you should be able to build 
in an i386 chroot.  This would produce a clean /usr/obj you
can copy to your i386 machines and install from there.

The hack to enable building in an i386 chroot is to set UNAME_m
and UNAME_p to i386. I use following in the chroots .cshrc

 	setenv  UNAME_m i386
 	setenv  UNAME_p i386

This will avoid any crossbuild magic and you will be able to build
as if on an i386 machine.

This of course only works for the amd64, i386 combination.

Greetings
Christian

-- 
Christian Kratzer                      CK Software GmbH
Email:   ck at cksoft.de                  Schwarzwaldstr. 31
Phone:   +49 7452 889 135              D-71131 Jettingen
Fax:     +49 7452 889 136              HRB 245288, Amtsgericht Stuttgart
Web:     http://www.cksoft.de/         Geschaeftsfuehrer: Christian Kratzer


More information about the freebsd-arch mailing list