Subject: RE: Kernel cross-compiling howto
To: 'Florian Stoehr' <netbsd@wolfnode.de>
From: Li Mingyu <limingyu@huawei-3com.com>
List: tech-kern
Date: 12/25/2004 08:42:43
Good job! 
I wonder whether you cross-compile the NetBSD on Windows i386 platform
successfully? I tried it ever on Windows XP + Cygwin, but it wasn't
successful.

> -----Original Message-----
> From: tech-kern-owner@NetBSD.org 
> [mailto:tech-kern-owner@NetBSD.org] On Behalf Of Florian Stoehr
> Sent: Friday, December 24, 2004 10:57 PM
> To: netbsd-docs@netbsd.org; tech-kern@netbsd.org
> Subject: Kernel cross-compiling howto
> 
> 
> Hi,
> 
> since I shot myself in the foot cross-compiling a kernel 
> yesterday and had 
> to figure things out (I found no documentation except VERY 
> old mailing 
> list entries), I wrote a litte howto. As far as I see, this 
> one worked.
> 
> Maybe someone can proof the steps here and add it to the 
> Kernel FAQ on the 
> website?
> 
> Hehe ... my Xmas-present to NeBSD ;-)
> 
> -Florian
> 
> Now the howto:
> 
> 
> 
> In order to cross-compile the kernel, a toolchain for the 
> destination architecture is needed first.
> 
> We assume NetBSD source is in /usr/src.
> We will build a kernel for sgimips on a i386 in this howto,
> so replace "sgimips" with your platform of choice.
> 
> We store the toolchain in the /usr/TOOLS directory.
> 
> First create the toolchain directories:
> 
> mkdir /usr/TOOLS
> 
> Now build the toolchain:
> 
> cd /usr/src
> ./build.sh -T ../TOOLS -m sgimips tools
> 
> A new kernel config file "MYKERNEL" for sgimips was
> created in the /usr/src/sys/arch/sgimips/conf directory.
> 
> Configure the new kernel:
> 
> cd /usr/src/sys/arch/sgimips/conf
> /usr/TOOLS/bin/nbconfig MYKERNEL
> 
> Now "make depend" the kernel:
> 
> cd ../compile
> /usr/TOOLS/bin/nbmake-sgimips depend
> 
> Finally, let's make the kernel:
> 
> /usr/TOOLS/bin/nbmake-sgimips
> 
> One thing to remember: If you want to keep toolchains for 
> several architectures (toolchain-SGIMIPS, toolchain-SPARC, 
> ...), note that if you RENAME the toolchain directory OR MOVE 
> THE DIRECTORY, you have to adjust the "bin/nbmake-<platform>" script.
> 
> Make sure you call "nbmake-<platform>", not just "nbmake".
>