Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Dec 2014 22:05:29 -0700
From:      Warner Losh <wlosh@netflix.com>
To:        Baptiste Daroussin <bapt@FreeBSD.org>
Cc:        current@FreeBSD.org
Subject:   Re: External toolchain support
Message-ID:  <F29A9EDB-A3DF-4D63-9EC4-598F64675416@gmail.com>
In-Reply-To: <20141129150440.GC88765@ivaldir.etoilebsd.net>
References:  <20141129150440.GC88765@ivaldir.etoilebsd.net>

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

> On Nov 29, 2014, at 8:04 AM, Baptiste Daroussin <bapt@FreeBSD.org> =
wrote:
>=20
> Hi all,
>=20
> It is now possible to use an external toolchain to build the kernel =
and base
> (tested with gcc 4.9.1 and latest binutils)
>=20
> Of course a lot of work is needed to make it build cleanly (aka lots =
of warning
> to fix).
>=20
> What have been tested so far:
> - sparc64 kernel + world
> - amd64 kernel + world
> - powerpc64 kernel + world
>=20
> mips cannot be tested because upstream gcc never heard of FreeBSD =
running on
> mips, and I did not receive any patches for mips.

I have patches for 4.8 or so knocking around somewhere...

> for amd64, in the kernel two things had to be removed from the build:
> - aesni: (it request a header which is compiler specific and on recent =
gcc
> will end up including stdlib.h which gives errors because kernel =
version of free
> and malloc are not compatible with the version defined in stdlib.h)
> - hptmv: I had to remove it from GENERIC and kernel building.
>=20
> The result is:
>=20
> $ sysctl kern.ostype kern.osrelease kern.osrevision =
kern.compiler_version
>=20
> kern.ostype: FreeBSD
> kern.osrelease: 11.0-CURRENT
> kern.osrevision: 199506
> kern.compiler_version: gcc version 4.9.1 (FreeBSD Ports Collection for =
amd64)
>=20
> so yes it boots and runs
>=20
> How to do you own testing:
> in the ports tree/packages (the amd64 version will appear in packages =
next week)
> install:
> amd64-xtoolchain-gcc or powerpc64-xtoolchain-gcc or =
sparc64-xtoolchain-gcc
>=20
> if your source tree:
> make CROSS_TOOLCHAIN=3Damd64-gcc -j8 buildkernel
> or
> make CROSS_TOOLCHAIN=3Dpowerpc64-gcc -j8 buildkernel
> or
> make CROSS_TOOLCHAIN=3Dsparc64-gcc -j8 buildkernel
>=20
> To build world:
> same operation with buildworld. Please note that for world you will =
need to add
> define NO_WERROR (world will also require a change in =
share/mk/bsd.lib.mk:
> s/--fatal-warnings/--no-fatal-warnings/)
>=20
> also notes that for the kernel a lots of warnings are disabled in
> share/sys/kern.mk so do not hesitate to remove yourself those =
-Wno-error=3D and
> fix the issue they are hidding!

Cool. Please coordinate with me before removing the -Wno-error because =
they vary by
architecture.

Warner




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F29A9EDB-A3DF-4D63-9EC4-598F64675416>