Building the FreeBSD kernel on another OS

Is it possible to compile the FreeBSD kernel (not world) on another Operating System (For instance Mac OS X, Windows, or Linux)? Has anyone tried this before? I am interested in compiling in on Mac OS X.

Thanks,
Ian
 
IanSeyler, this has been done with Linux on both Debian and Gentoo. Take a look at the following links for more information:

http://www.debian.org/ports/kfreebsd-gnu/

http://www.gentoo.org/proj/en/gentoo-alt/bsd/fbsd/

I am sure there are probably other Linux distributions that have done something similar, but those are the only two I am familiar with.

Since most of OSX is closed, I am not sure that it would be possible to compile the FreeBSD kernel with the OSX userland. Would certainly be interesting to study, though. Good luck to you if you attempt such a feat.
 
Just wondering, are you just trying to get it compiled or are you actually planning on using the FreeBSD kernel on OS-X?

The first might be possible but I seriously doubt you will ever achieve the second.
 
Running [cmd=]make buildkernel[/cmd] yields the following:
Code:
Makefile:122: *** missing separator.  Stop.
This seems to be because it is GNU make. I tried again with [cmd=]bsdmake buildkernel[/cmd] with the following results:
Code:
"Makefile.inc1", line 142: Unknown target unknown:x86_64.
*** Error code 1

Again somewhat expected as FreeBSD uses amd64. How about specifying a target with [cmd=]bsdmake buildkernel TARGET=amd64[/cmd] with these results:
Code:
macbook-pro:os Ian$ bsdmake buildkernel TARGET=amd64

--------------------------------------------------------------
>>> Kernel build for GENERIC started on Fri May 25 17:38:35 EDT 2012
--------------------------------------------------------------
===> GENERIC
mkdir -p /usr/obj/amd64.amd64/Users/Ian/Code/os/sys

--------------------------------------------------------------
>>> stage 1: configuring the kernel
--------------------------------------------------------------
cd /Users/Ian/Code/os/sys/amd64/conf;  PATH=/usr/obj/amd64.amd64/Users/Ian/Code/os/tmp/legacy/usr/sbin:
/usr/obj/amd64.amd64/Users/Ian/Code/os/tmp/legacy/usr/bin:/usr/obj/amd64.amd64/Users/Ian/Code/os/tmp/legacy/usr/games:
/usr/obj/amd64.amd64/Users/Ian/Code/os/tmp/usr/sbin:/usr/obj/amd64.amd64/Users/Ian/Code/os/tmp/usr/bin:
/usr/obj/amd64.amd64/Users/Ian/Code/os/tmp/usr/games:/sbin:/bin:/usr/sbin:/usr/bin  config  -d
/usr/obj/amd64.amd64/Users/Ian/Code/os/sys/GENERIC  /Users/Ian/Code/os/sys/amd64/conf/GENERIC
config: line 23: syntax error
config: line 74: syntax error
config: line 77: syntax error
config: line 78: syntax error
config: line 81: syntax error
config: line 84: syntax error
config: line 85: syntax error
config: line 88: syntax error
config: line 89: syntax error
config: line 92: syntax error
config: line 95: syntax error
config: line 98: syntax error
config: line 99: syntax error
config: line 100: syntax error
config: line 102: syntax error
config: line 103: syntax error
config: line 105: syntax error
config: line 106: syntax error
config: line 108: syntax error
config: line 109: syntax error
config: line 110: syntax error
config: line 111: syntax error
config: line 114: syntax error
config: line 115: syntax error
config: line 116: syntax error
config: line 117: syntax error
config: line 118: syntax error
config: line 119: syntax error
config: line 120: syntax error
config: line 123: syntax error
config: line 124: syntax error
config: line 127: syntax error
config: line 128: syntax error
config: line 129: syntax error
config: line 130: syntax error
config: line 131: syntax error
config: line 132: syntax error
config: line 133: syntax error
config: line 134: syntax error
config: line 137: syntax error
config: line 138: syntax error
config: line 139: syntax error
config: line 140: syntax error
config: line 141: syntax error
config: line 144: syntax error
config: line 145: syntax error
config: line 148: syntax error
config: line 149: syntax error
config: line 150: syntax error
config: line 152: syntax error
config: line 154: syntax error
config: line 156: syntax error
config: line 159: syntax error
config: line 162: syntax error
config: line 166: syntax error
config: line 167: syntax error
config: line 168: syntax error
config: line 171: syntax error
config: line 174: syntax error
config: line 175: syntax error
config: line 176: syntax error
config: line 177: syntax error
config: line 178: syntax error
config: line 181: syntax error
config: line 184: syntax error
config: line 185: syntax error
config: line 186: syntax error
config: line 187: syntax error
config: line 188: syntax error
config: line 189: syntax error
config: line 190: syntax error
config: line 191: syntax error
config: line 192: syntax error
config: line 196: syntax error
config: line 197: syntax error
config: line 198: syntax error
config: line 199: syntax error
config: line 200: syntax error
config: line 201: syntax error
config: line 202: syntax error
config: line 203: syntax error
config: line 204: syntax error
config: line 205: syntax error
config: line 206: syntax error
config: line 207: syntax error
config: line 208: syntax error
config: line 209: syntax error
config: line 210: syntax error
config: line 211: syntax error
config: line 213: syntax error
config: line 214: syntax error
config: line 215: syntax error
config: line 216: syntax error
config: line 217: syntax error
config: line 218: syntax error
config: line 219: syntax error
config: line 220: syntax error
config: line 221: syntax error
config: line 222: syntax error
config: line 223: syntax error
config: line 224: syntax error
config: line 225: syntax error
config: line 226: syntax error
config: line 227: syntax error
config: line 230: syntax error
config: line 232: syntax error
config: line 233: syntax error
config: line 234: syntax error
config: line 235: syntax error
config: line 236: syntax error
config: line 237: syntax error
config: line 240: syntax error
config: line 244: syntax error
config: line 245: syntax error
config: line 246: syntax error
config: line 247: syntax error
config: line 248: syntax error
config: line 249: syntax error
config: line 250: syntax error
config: line 251: syntax error
config: line 253: syntax error
config: line 256: syntax error
config: line 257: syntax error
config: line 258: syntax error
config: line 259: syntax error
config: line 260: syntax error
config: line 261: syntax error
config: line 262: syntax error
config: line 263: syntax error
config: line 266: syntax error
config: line 267: syntax error
config: line 268: syntax error
config: line 269: syntax error
config: line 270: syntax error
config: line 271: syntax error
config: line 272: syntax error
config: line 273: syntax error
config: line 274: syntax error
config: line 275: syntax error
config: line 280: syntax error
config: line 284: syntax error
config: line 285: syntax error
config: line 286: syntax error
config: line 287: syntax error
config: line 288: syntax error
config: line 290: syntax error
config: line 291: syntax error
config: line 292: syntax error
config: line 293: syntax error
config: line 294: syntax error
config: line 295: syntax error
config: line 297: syntax error
config: line 298: syntax error
config: line 299: syntax error
config: line 300: syntax error
config: line 301: syntax error
config: line 302: syntax error
config: line 303: syntax error
config: line 304: syntax error
config: line 305: syntax error
config: line 307: syntax error
config: line 308: syntax error
config: line 309: syntax error
config: line 310: syntax error
config: line 311: syntax error
config: line 312: syntax error
config: line 313: syntax error
config: line 315: syntax error
config: line 316: syntax error
config: line 317: syntax error
config: line 318: syntax error
config: line 319: syntax error
config: line 320: syntax error
config: line 321: syntax error
config: line 324: syntax error
config: line 327: syntax error
config: line 328: syntax error
config: line 329: syntax error
config: line 330: syntax error
config: line 333: syntax error
config: line 334: syntax error
config: line 335: syntax error
config: line 336: syntax error
config: line 337: syntax error
config: line 338: syntax error
Specify machine type, e.g. ``machine vax''
*** Error code 1

Stop in /Users/Ian/Code/os.
*** Error code 1

Stop in /Users/Ian/Code/os.

Is there another argument I should try passing to bsdmake (in regards to the 'machine vax' line)?

Thanks,
Ian
 
Run [cmd=]make kernel-toolchain[/cmd] or [cmd=]make buildworld[/cmd] first. Otherwise it will try to use the native tools, which will not work from another OS.
 
Last time I've checked, it was actually impossible to _checkout_ FreeBSD source on OSX, due to the fact that HFS+ is not case-sensitive, and there is a name clash between some man pages. It might be possible to work around this by using case-sensitive filesystem.
 
Could you please not necropost 11 year old threads?
 
Back
Top