Subject: Cross-compile problems.
To: None <port-dreamcast@netbsd.org>
From: Josh Tolbert <hemi@scoundrelz.net>
List: port-dreamcast
Date: 08/19/2002 00:15:29
Hi,
	I'm fairly new to NetBSD, but I have some experience with FreeBSD
(and linux...). I picked up a Sega Dreamcast fairly cheaply, and managed
to obtain a Broadband Adapter and keyboard quite easily. I decided to get
NetBSD running on the Dreamcast.
	I managed to get the current source downloaded, but when I tried
to build on my 1.5.3 i386 machine I found that I couldn't config the
Dreamcast kernel properly. I then updated my machine to current:

NetBSD netbsd.home.lan 1.6_RC1 NetBSD 1.6_RC1 (GENERIC) #0: Sun Aug 18
11:24:32 CDT 2002
root@netbsd.home.lan:/usr/src/sys/arch/i386/compile/GENERIC i386

I went with a GENERIC kernel mainly cause I'm worried about the Dreamcast
cross-compile, not the i386 machine.
	I went back to the dreamcast cross-compile. I installed the
correct cross/cross-shel-netbsdcoff-1.3.0.0 port and build a "dc-build.sh"
file consisting of:

#! /bin/sh
MACHINE=dreamcast export MACHINE
MACHINE_ARCH=sh3el export MACHINE_ARCH
WHICH=shel-netbsdcoff

LOCAL=/usr/pkg
BINDIR=$LOCAL/cross/bin
PATH=$PATH:$BINDIR:$LOCAL/cross/$WHICH/bin:$PATH:$LOCAL/cross/bin export
PATH

GCC_EXEC_PREFIX=$WHICH

AR=$BINDIR/$WHICH-ar export AR
AS=$BINDIR/$WHICH-as export AS
CC=$BINDIR/$WHICH-gcc export CC
CPP=`$CC -print-prog-name=cpp` export CPP
CXX=$BINDIR/$WHICH-c++ export CXX
FC=$BINDIR/$WHICH-f77 export FC
LD=$BINDIR/$WHICH-ld export LD
NM=$BINDIR/$WHICH-nm export NM
RANLIB=$BINDIR/$WHICH-ranlib export RANLIB
SIZE=$BINDIR/$WHICH-size export SIZE
ADDR2LINE=$BINDIR/$WHICH-addr2line export ADDR2LINE
GASP=$BINDIR/$WHICH-gasp export GASP
OBJCOPY=$BINDIR/$WHICH-objcopy export OBJCOPY
OBJDUMP=$BINDIR/$WHICH-objdump export OBJDUMP
STRINGS=$BINDIR/$WHICH-strings export STRINGS
STRIP=$BINDIR/$WHICH-strip export STRIP

MKPROFILE=no export MKPROFILE
#MKMAN=no export MKMAN
MKLINT=no export MKLINT

HOSTED_CC=cc export HOSTED_CC

MAKE=make export MAKE
#MAKE="make -f ${DESTDIR}/usr/share/mk/sys.mk -f Makefile"; export MAKE
#MAKEFLAGS="-I ${DESTDIR}/usr/share/mk" ; export MAKEFLAGS

set -x
exec $MAKE "$@"

That file is ripped almost directly from the linked file from NetBSD's
cross-compiling info page.

I'm also using an /etc/mk.conf of

USA_RESIDENT=YES
DESTDIR="/usr/dreamcast"
MKPROFILE=NO
OBJMACHINE=YES

	I was able to successfully build a kernel

-rwxr-xr-x  1 root  wheel  2490373 Aug 18 15:51 netbsd
netbsd: Hitachi SH little-endian COFF executable, not stripped

but I can't seem to build a userland. When I run "sh ./dc-build sh
beforeinstall" in /usr/src (the top-level source dir of the same tree I
used to build i386 in), there's no problems. However, when I run "sh
./dc-build.sh includes" I get:

bash-2.05# sh ./dc-build.sh includes
+ exec make includes
includes ===> include
STRIP=/usr/src/tools/tools.NetBSD-1.6_RC1-i386/bin/shle--netbsdelf-strip
/usr/src/tools/tools.NetBSD-1.6_RC1-i386/bin/nbinstall -r -c -o root -g
wheel  -m 444 a.out.h /usr/dreamcast/usr/include/a.out.h
/usr/src/tools/tools.NetBSD-1.6_RC1-i386/bin/nbinstall: not found
*** Error code 127

Stop.
make: stopped in /usr/src/include
*** Error code 1

Stop.
make: stopped in /usr/src

	What's the deal? I'd like to be able to cross-compile a userland
from the same tree I used for i386, mainly cause it takes so long to
download a new tree. Apparently I'm getting some sort of pollution from
the i386 build, but I'm not sure how to clean up the tree. I've tried
"make cleandir" in /usr/src, but still get the same errors. Is there
anything else I can do? I checked in /usr/src/include and STRIP doesn't
appear to be set by anything in that directory. Do I need to remove
everything in /usr/src and redownload the latest tree? Any advice you can
give me will be appreciated.

Thanks,
Josh

------     ---   -
Josh Tolbert
hemi@scoundrelz.net

Every time the power flickers, a squirrel gets his wings.