Subject: Re: Kernel cross-compiling howto
To: None <tech-kern@netbsd.org>
From: Sascha Retzki <lantis@iqranet.info>
List: tech-kern
Date: 12/25/2004 13:22:23
On Fri, Dec 24, 2004 at 03:57:16PM +0100, Florian Stoehr wrote:
> Hi,

Hi,

first off, why did you send it to tech-kern? Not that I *really* care, but
netbsd-users or similar lists sounds better for such sort of mails ;)

> 
> 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 ;-)
hehe 

> 
> -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
compile/ ? Not compile/MYKERNEL ? It should not make a difference if you
crosscompile or compile nativly, imho. So, is that right? If yes, why?

> /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".
> 
> 
>