Subject: Cross compiling kernel
To: None <port-mac68k@netbsd.org>
From: Patrick Swieskowski <swies@uswest.net>
List: port-mac68k
Date: 09/27/1999 17:41:17
    I've tried building a linux-686 to netbsd-mac68k cross compiler
numerous times and am now the closest I have ever been to building a
kernel.  I built it using binutils-2.9.1 and gcc-2.8.1 with
--target=m68k-apple-netbsd, including --with-gnu-as and with-gnu-ld for
gcc.  The snag that I run into is when compiling a kernel it issues the
commands:


 /usr/cross/m68k-apple-netbsd/bin/ld: warning: cannot find entry symbol
start; defaulting to 00002020
"../../../../arch/m68k/fpsp/Makefile.inc", line 22: warning: Couldn't
read shell's output for "printf "#ifdef
FPSP\n/usr/crosswork/netbsd/src/sys/arch/mac68k/compile/MYKERNEL/lib/fpsp/fpsp.o\n#endif\n"
| m68k-apple-netbsd-c++ -P -undef "
making sure the compat library is up to date...
`libcompat.a' is up to date.
making sure the kern library is up to date...
`libkern.o' is up to date.
sh ../../../../conf/newvers.sh
m68k-apple-netbsd-gcc  -O2 -Wall -Wstrict-prototypes
-Wmissing-prototypes  -Wpointer-arith -Wno-main -msoft-float -I.
-I../../../../arch -I../../../.. -nostdinc -DHZ="0x3c" -DM68030
-DFPU_EMULATE -DLKM -DDIAGNOSTIC -DNFSCLIENT -DMAXUSERS=16 -D_KERNEL
-Dmac68k  -c vers.c
m68k-apple-netbsd-ld -n -Ttext 0 -S -o netbsd ${SYSTEM_OBJ} vers.o
db_command.o(.text+0x4ee): undefined reference to `setjmp'
db_command.o(.text+0x572): undefined reference to `longjmp'
db_xxx.o(.text+0x600): undefined reference to `spl0'
ccd.o(.text+0x1e0): undefined reference to `copyinstr'


    This follows by many, many undefined reference errors.  I think this
is close to compiling because it seems to be actually making the netbsd
file (judging by the "-o netbsd" when it calls ld) I just need to find
out what is wrong.  I think it might be the linker, although it could be
something else that screwed up the object files.  If anyone here has any
ideas/suggestions I would like to hear them.  Also, if it's of
significance, I modified the makefile to get rid of the -Werror flag to
gcc, it would not even get this far without removing that.  I get
similar errors when making the shared libm library, that output is
below.


building shared object m library
m68k-apple-netbsd-ranlib libm_pic.a
building shared m library (version 0.1)
m68k-apple-netbsd-ld -x -shared  -o libm.so.0.1    --whole-archive
libm_pic.a --no-whole-archive
libm_pic.a(w_sinhf.so)(.text+0x5c): relocation truncated to fit: 16
_fdlib_version
libm_pic.a(w_sinhf.so)(.text+0x6a): relocation truncated to fit: 16
finitef
libm_pic.a(w_sinhf.so)(.text+0x98): relocation truncated to fit: 16
__kernel_standard
libm_pic.a(w_sinh.so)(.text+0x64): relocation truncated to fit: 16
_fdlib_versio
libm_pic.a(w_sinh.so)(.text+0x74): relocation truncated to fit: 16
finite
libm_pic.a(w_sinh.so)(.text+0x98): relocation truncated to fit: 16
__kernel_standard
libm_pic.a(w_scalbf.so)(.text+0x70): relocation truncated to fit: 16
_fdlib_version

    With errors like these following.  I'm pretty much stumped on this
and need any help I can get.  If anyone reading this has built a cross
compiler from anything to a netbsd system (any arch) it would really
help me if you could try to remember what you did.


-Patrick Swieskowski

swies@uswest.net