# "Cross-Compile" the FreeBSD kernel



## honk (Jan 20, 2009)

Hi folks,

I have a runnning i386 6.1-RELEASE and built a new system (7.1-RELEASE amd64!) in a directory (extracting base, kernels, src... with install.sh to $DESTDIR).

Is it possible to build a custom kernel on the i386-6.1 machine for the amd64-7.1 ? Just by issuing make buildkernel kernconf... in $DESTDIR/sys?

Or where is the magic line which I shouldn't pass when compiling software on FBSD?


Another question is, can I share one /usr/ports directory via NFS to provide it to multiple FBSD systems (mixed versions) for software installation from ports.

Thanks a lot!
cheers,
Honk


----------



## kamikaze (Jan 20, 2009)

Just set TARGET=amd64. This should do it.

About the Ports, yes you can. However you should set WRKDIRPREFIX to somewhere outside the ports on these systems, so that you only require read access.


----------



## GD (Jun 16, 2009)

Installed on a amd64 the i386 version,  can I recompile the kernel and world to amd64 from 386 such as to be native ? Is there any howto somewhere?


----------



## phoenix (Jun 16, 2009)

While it is possible to "upgrade" an i386 install to amd64, it's generally not advised.  It's a very advanced setup, and not guaranteed to work.  You can try, but be sure to have a full backup of your working system (or at the very least, your data).  There are how-tos and guides available on the Internet.  I won't link to them, as I don't recommend using them.   _Caveat emptor_, and all that.

The recommended method for "upgrading" from 32-bit to 64-bit install is to wipe the disk, and re-install from the CD.

Note also:  all 64-bit x86 CPUs are native 64-bit **and** native 32-bit CPUs.  You can run either 32-bit or 64-bit software without any penalties.  You aren't running "non-native" if you use a 32-bit OS on a 64-bit capable x86 CPU.


----------



## GD (Jun 18, 2009)

Thanks for the note.


----------

