Subject: Re: Crosscompilation Alpha -> i386/ELF w curr -> errors..
To: Peter B <pb@ludd.luth.se>
From: Perry E. Metzger <perry@wasabisystems.com>
List: current-users
Date: 05/25/2002 20:14:14
You should be using the in-tree tools for doing cross compilation,
not the pkgsrc tools. If you download 1.6 or -current sources, you
will notice that there is a file called BUILDING at the top level,
and a script that it describes called build.sh which is designed
for cross building of the entire system.
Perry
Peter B <pb@ludd.luth.se> writes:
> Hi!
>
> I'm trying to crosscompile i386 netbsd ELF current kernel on a:
> NetBSD speedy 1.5_BETA NetBSD 1.5_BETA (SPEEDY) #6: Sun Dec 6 17:15:55 CET 2020
> (an 500 MHz alpha machine)
>
> I downloaded the kernel source from:
> ftp.netbsd.org:/pub/NetBSD/NetBSD-current/tar_files/src/sys.tar.gz
>
> And the crosscompile tools:
> cross-i386-netbsdelf-1.3.0.0.tgz (for 1.5/alpha)
>
> Using:
> /usr/sbin/config GENERIC
> cd ../compile/GENERIC
> ./build-script depend
>
> But it won't compile..:
> *Initialization*:1: warning: this is the location of the previous definition
> *Initialization*:1: warning: `__GNUC__' redefined
> *Initialization*:1: warning: this is the location of the previous definition
> rm -f param.c
> cp ../../../../conf/param.c .
> cat ../../../../arch/i386/i386/genassym.cf | sh ../../../../kern/genassym.sh /home/tmp/pb/nbsd_i386/cross-i386-netbsdelf-1.3.0.0/bin/i386-netbsdelf-gcc -D__NetBSD__ -ffreestanding -O2 -Werror -Wall -Wno-main -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wno-uninitialized -Di386 -I. -I../../../../arch -I../../../.. -nostdinc -DLKM -DDIAGNOSTIC -DMAXUSERS=32 -D_KERNEL -D_KERNEL_OPT > assym.h.tmp && mv -f assym.h.tmp assym.h
> *Initialization*:1: warning: `__GNUC__' redefined
> *Initialization*:1: warning: this is the location of the previous definition
> *** Error code 1
>
> Stop.
> Exit 1
>
> Any hints on how to fix it?
> I tried the same with 1.5/i386/elf kernel without sucess and more errors.
> (My intention is to create custom kernels for a much slower machine..)
>
> /Peter
>
> Btw, I'm not subscribed to this list.
>
>
> ........................... build-script ...........................
> #!/bin/sh
>
> # just helping for cross compilation.
>
> # http://www.netbsd.org/Documentation/cross/#host-system
> # http://www.netbsd.org/Ports/
> # cross-i386-netbsdelf-1.3.0.0.tgz
> # syssrc.tgz
>
> # Like m68k
> MACHINE=i386
> # Like amiga, atari etc..
> MACHINE_ARCH=i386
>
> WHICH=i386-netbsdelf
> LOCAL=/home/tmp/pb/nbsd_i386
> BINDIR=$LOCAL/cross-i386-netbsdelf-1.3.0.0/i386-netbsdelf/bin
> PATH=$PATH:$BINDIR:$LOCAL/cross-i386-netbsdelf-1.3.0.0/i386-netbsdelf/bin:$PATH:
> $LOCAL export PATH
>
> GCC_EXEC_PREFIX=$WHICH
>
> MKPROFILE=no export MKPROFILE
> MKLINT=no export MKLINT
> HOSTED_CC=cc export HOSTED_CC
> MAKE=make export MAKE
> set -x
>
> # just in case you forgot to specify this when you built gcc...
> CFLAGS="-D__NetBSD__"
> export MACHINE MACHINE_ARCH CFLAGS
> #TARGET=/usr/pkg/cross/bin/sh-netbsdcoff
> TARGET=/home/tmp/pb/nbsd_i386/cross-i386-netbsdelf-1.3.0.0/bin/i386-netbsdelf
>
> CPP=`$TARGET-gcc -print-prog-name=cpp`
> echo "ARGS:"$*
> make AR=$TARGET-ar AS=$TARGET-as CC=$TARGET-gcc LD=$TARGET-ld NM=$TARGET-nm \
> RANLIB=$TARGET-ranlib SIZE=$TARGET-size \
> STRIP=$TARGET-strip OBJCOPY=$TARGET-objcopy \
> CXX=$TARGET-c++ CPP=$CPP \
> FC=$TARGET-f77 ADDR2LINE=$TARGET-addr2line OBJDUMP=$TARGET-objdum
> p STRINGS=$TARGET-strings \
> $*
> ........................... build-script ...........................
>
>
--
Perry E. Metzger perry@wasabisystems.com
--
NetBSD: The right OS for your embedded design. http://www.wasabisystems.com/