• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Solved Cross compiling FreeBSD from source

lint

New Member


Messages: 6

#1
Hi, I decided to make a FreeBSD fork. I want to know how to cross compile it (same processor) from Linux Mint instead of from FreeBSD (compiling it in a bootstrapped environment yields unexpected results (more specifically it will just install the new kernel to FreeBSD instead of making bootable images)).
Thanks.
 

Murph

Well-Known Member

Thanks: 175
Messages: 297

#2
You are miles away from anything that the FreeBSD build system is intended to do, completely 100% unsupported, to the best of my knowledge. The cross-compiling/cross-development available within the normal FreeBSD build system is for building for a different processor/machine architecture on FreeBSD (e.g. building an ARM release on a x86 system, and things like that), not for building in an alien OS environment. The tools for building release images are in /usr/src/release, and should let you build releases without any installation over the top of the build host's FreeBSD OS install.

Even if you can make it work, it seems like a recipe for constant pain and creation of exciting new bugs which don't exist when the code is compiled in a supported manner. Kernel builds, in particular, can be very sensitive to their build environment. I would be very unlikely to trust a BSD OS built in a Linux build environment, when it is designed to be built in a BSD build environment.

By all means create a new fork, and good luck with it. I just think you are taking a very wrong approach by considering Linux as a build environment for it if the desired result is a pure BSD OS (and not some hybrid). Do remember that the FreeBSD name is trademarked, the logo is trademarked and protected by copyright, and Beastie is protected by copyright; i.e. you may not use any of those pieces of intellectual property without formal permission.
 

wblock@

Administrator
Staff member
Administrator
Moderator
Developer

Thanks: 3,577
Messages: 13,856

#3
it will just install the new kernel to FreeBSD instead of making bootable images
I don't understand what that is saying. It might be as simple as not using the right targets to make(1), or something else described in release(7). Some people would probably like to be able to build FreeBSD from Linux. The build environments are vastly different, though.
 

lint

New Member


Messages: 6

#4
Well first I was trying to make a linux distro but gave up because of the GPL, and when I was making it when I ran make instead of making bootable images it for some reason just updated my existing kernel.
I'll happily build it under BSD, but as long as it will yield me with some kind of bootable image (.bin)

Also, the trademarks dont really matter, because I can do what fedora did to red hat (IIRC) - removed their trademarks so they didnt have to get explicit permission
 

ShelLuser

Daemon

Thanks: 1,090
Best answers: 2
Messages: 2,398

#7
Hi lint, Can you provide the details to cross-compile freebsd on linux?
Keep in mind that you're responding to a thread which is almost 2 years old, so it's not unlikely that lint (who was a new member at the time) isn't active anymore.

Anyway... the best way to set this up, in my opinion obviously, is to build yourself a virtual machine. For example VirtuaBox (or another variant), then install a FreeBSD version there after which you'll have everything available to actually build the whole thing and roll your own installation media.

Another option, but this heavily depends on your Linux distribution, is to get the appropriate build tools. I have no hands on experience with this myself, but I am still aware that Debian provides packages such as freebsd-buildutils and freebsd-glue which - theoretically - should be able to help you set up a working but emulated build environment. But if this actually works or not is something I can't say.

Hope this can help you.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Thanks: 5,875
Best answers: 6
Messages: 26,473

#8
so it's not unlikely that lint (who was a new member at the time) isn't active anymore.
I can confirm that. He hasn't been active since the last post in this thread. No logins since. He could still be lurking anonymously but that's usually unlikely.
 

Rajesh

New Member

Thanks: 1
Messages: 8

#9
Thanks ShelLuser and SirDice for the quick turnaround.

I am currently compiling FreeBSD natively (compiling head on top of 11.1). I was wondering if we could compile FreeBSD kernel on a linux box, so that I can use an existing Linux setup to build FreeBSD rather than having a separate FreeBSD box. I don't have a Debian distro currently, but let me explore the second option given. Thanks for the info.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Thanks: 5,875
Best answers: 6
Messages: 26,473

#10
I was wondering if we could compile FreeBSD kernel on a linux box, so that I can use an existing Linux setup to build FreeBSD rather than having a separate FreeBSD box.
Another option is to use something like VirtualBox and create a FreeBSD VM on Linux.
 
Top