# Can I compile a FreeBSD kernel from Linux?



## ttabi (Feb 8, 2018)

I'm trying to compile and boot a FreeBSD kernel on an ARM64 system with ACPI.  The current v12 release starts to boot but fails during parsing of ACPI tables.  I'm sure I can debug and fix this myself.

I do have some stupid questions, though.  Is it possible to compile a FreeBSD kernel from a Linux system.  Since I can't boot the existing kernel on my ARM64 system, I would need to cross-compile from an x86 PC.  The question is, do I need to install FreeBSD on this system to do a cross-compile?


----------



## rigoletto@ (Feb 8, 2018)

I guess this is (at least) theoretically possible, but probably would involve a lot of work. Why not use VM for that instead? 

Other fellows may have better understanding of this subject then me, but CURRENT is unsupported in here (forums) because that is the development version (aka dev playground), and it is often broken. In other words, CURRENT is not meant to be normally used.


----------



## ShelLuser (Feb 8, 2018)

In my opinion it's definitely not worth the effort. I believe that Debian has (or had) a package called "FreeBSD make tools" (or something close enough) which should make it theoretically possible to build the whole thing.

But as lebarondemerde said: a virtual environment is a much better idea.


----------



## rigoletto@ (Feb 8, 2018)

Gentoo certainly can build the FreeBSD kernel because they have it in the Portage tree, due to Gentoo/FreeBSD project. But still, unless you are already using Gentoo, install VirtuBox and get the thing done would be rather less _expensive_.


----------



## Ericson2314 (Apr 13, 2020)

Nixpkgs aims to build all the thing all the ways. We already have NetBSD cross, and i am working on adding FreeBSD in https://github.com/NixOS/nixpkgs/pull/82131/files . For any OS, once the userland can built, it then makes senses to turn ones attention the kernel, since there is often various code generators and things that must be built in order to build the kernel.


----------



## 0mp (Sep 25, 2020)

Just a note that as of *366074 *13.0-CURRENT is buildable on Linux and macOS. I am not sure if it is going to be possible to cross-compile FreeBSD 11 or FreeBSD 12, but it looks like 13.0-RELEASE will be fine.


----------



## Jose (Sep 26, 2020)

rigoletto@ said:


> Gentoo certainly can build the FreeBSD kernel because they have it in the Portage tree, due to Gentoo/FreeBSD project. But still, unless you are already using Gentoo, install VirtuBox and get the thing done would be rather less _expensive_.


Gentoo Freebsd died some time ago. It may still build, but I doubt it.


----------

