Subject: Cross-compiling ramdisk
To: NetBSD Toolchain <tech-toolchain@NetBSD.org>
From: Markus Mayer <mmayer@redback.com>
List: tech-toolchain
Date: 03/09/2006 12:44:43
Hi,

I was wondering if NetBSD supports cross-compiling a mini-root/ramdisk 
based kernel.

What I am trying to do is to cross-build on NetBSD 3.0 x86 for NetBSD 
1.5.3 PowerPC. I do have the right compilers and binutils. 
Cross-compiling regular kernel and user-space works without issues. Even 
cross-compiling a kernel that has space for a ramdisk in it works. 
However, there seem to be some problems with crunchgen and the way the 
makefile for the crunched binaries is created, so I can't build the ramdisk.

I end up with an error like that (I am running NetBSD 1.5.3's make in 
"netbsd153/usr/src/distrib/macppc/floppies/ramdisk"):

[...]
echo "int _crunched_sh_stub(int argc, char **argv, char **envp){return 
main(argc,argv,envp);}" >sh_stub.c
/tools/swdev/bin/powerpc-netbsdelf-gcc-1.5.3 -O -g -Werror   -nostdinc 
-idirafter /home/mmayer/pkt/generic-powerpc/usr/include -c sh_stub.c
/tools/swdev/bin/powerpc-netbsdelf-gcc-1.5.3 -O -g -Werror   -nostdinc 
-idirafter /home/mmayer/pkt/generic-powerpc/usr/include -c 
/home/mmayer/pkt/sw/netbsd153/usr/src/distrib/macppc/floppies/ramdisk/../../../../bin/sh/echo.c
/home/mmayer/pkt/sw/netbsd153/usr/src/distrib/macppc/floppies/ramdisk/../../../../bin/sh/echo.c:47: 
bltin.h: No such file or directory
*** Error code 1
Stop.

I have been fiddling with this for quite a while now, always running 
into another obstacle after solving the previous one (mdsetimage being 
the next hurdle, because bfd aware mdsetimage on x86 segfaults right now 
dealing with the PPC ramdisk).

The question I have right now is, is this supposed to work or am I 
trying something that either nobody has ever tried or that is even known 
to be unsupported / not-working?

Thanks and please let me know if I should be posting to a different list.

Best regards,
Markus