Subject: how to cross compile install kernel?
To: None <>
From: Christian Groessler <>
List: current-users
Date: 03/06/2001 01:26:05

(I've also cc'd this to port-macppc, although I'm not subscribed there
[yet]. Please cc responses from there to my mail address. Thanks.
I also don't know whether current-users is the correct forum, but
since the following was experienced with -current, it's maybe not
that off-topic..)

I've recently got a blue G3 with 350MHz CPU and some spare disk space
where I want to install NetBSD.

I tried with the Wasabi NetBSD 1.5 CD, the install kernel boots fine,
but doesn't find the hard disks. The hard disks are on a CMD646 ide
controller which doesn't seem to be compiled into the Wasabi install

I have an i386 machine running NetBSD and there I installed the
powerpc cross compiler from pkgsrc. With this I was able to compile a
INSTALL kernel which detects the hard disks. 

But my kernel bombed when mounting root, there was no root!
I looked a bit around in the source tree and found
distrib/macppc/floppies/ramdisk, which I assume should generate the
ramdisk root image used at installation.

Running make there with the cross-compiler settings works smoothly,
but at the end I get some strange warnings. There are files created
with the extension .cro, with are then run thru the crunchide utility
which complains e.g. 

crunchide -k _crunched_sh_stub sh.cro
sh.cro: unknown executable format

So it seems that crunchide can only "crunch" native files, my i386
crunchide has no idea of the powerpc object files.

How would I create a crunchide, hosted on i386 and working with
powerpc object files?

Ignoring this warnings, I get many linker warnings when the makefile
wants to create "ramdiskbin", as there is a hard coded library path
"/usr/lib", when I need (cross-compiling)

Ok, I changed this in the makefile, but still the final link of
ramdiskbin fails with many errors of the type

cat.cro: In function `main':
cat.cro(.text+0x64): multiple definition of `main'
ramdiskbin.o(.text+0x0): first defined here
/usr/pkg/cross/powerpc-netbsd/bin/ld: Warning: size of symbol `main' changed from 232 to 492 in cat.cro
chmod.cro: In function `main':
chmod.cro(.text+0xac): multiple definition of `main'
ramdiskbin.o(.text+0x0): first defined here

I think it's because cruchide isn't working correctly in this
cross-compilation environment.

So, I'd like to get this worked out (you know, nothing is better than
booting your own compiled kernel, especially when overcoming these
obstacles :-), but I would also accept a INSTALL kernel for macppc
with CMD646 compiled by someone else to get me going...

thanks for your help & many regards,