Subject: Re: Cross-compiling from FreeBSD
To: None <port-hpcarm@netbsd.org>
From: SAKAI Hiroaki <hsakai@m8.people.or.jp>
List: port-hpcarm
Date: 06/23/2001 18:02:49
<993153093.23779.0.camel@desk.mcneil.com>
sean@mcneil.com wrote:

>> I have a FreeBSD machine that I am trying to build the npcarm kernel
>> from and I'm having some troubles.  Here is what I've done so far:

I have a FreeBSD machine and use it to compile the NetBSD/hpcarm kernel.

>> 1) built the cross tools and installed as /usr/local/cross.
>> 2) built config with make -f Makefile.boot and copied to
>> /usr/local/cross/bin.
>> 3) built make with make -f Makefile.boot and copied to
>> /usr/local/cross/bin

You need to use NetBSD's mkdep. mkdep needs
basesrc/lib/libc/gen/setprogname.c.
And you need NetBSD's /usr/share/mk.
If you want to build the userland application, You need to use NetBSD's
install (basesrc/usr.bin/xinstall) too.

After "config IPAQ", You may modify compile/IPAQ/Makefile to delete
-Werror, and modify init_main.c and locore.S to change "main()" to
"hpcmain()".

I use this shell script to make NetBSD/hpcarm kernel and applications on
FreeBSD. You may use it as you like.
(But, I cannot to make the applications...)



#!/bin/sh -x
#DESTDIR= export DESTDIR
# make.sh
#

MACHINE=hpcarm export MACHINE
MACHINE_ARCH=arm export MACHINE_ARCH
OBJECT_FMT=ELF export OBJECT_FMT

LOCAL=/usr/local
TARGET=arm-elf
TARGETDIR=$LOCAL/$TARGET
MKFDIR=$TARGETDIR/share/mk

DESTDIR=/usr/tmp/dist export DESTDIR

#INCSDIR=$TARGETDIR/include export INCSDIR
#INCSDIR=$DESTDIR/include export INCSDIR
#INCSDIR=/usr/include export INCSDIR

#LIBDIR=/usr/lib export LIBDIR

LIBOWN=`whoami` export LIBOWN
LIBGRP=user export LIBGRP
DOCOWN=`whoami` export DOCOWN
DOCGRP=user export DOCGRP
MANOWN=`whoami` export MANOWN
MANGRP=user export MANGRP
BINOWN=`whoami` export BINOWN
BINGRP=user export BINGRP
NLSOWN=`whoami` export NLSOWN
NLSGRP=user export NLSGRP
KMODOWN=`whoami` export KMODOWN
KMODGRP=user export KMODGRP

BINDIR=$LOCAL/bin
PATH=$TARGETDIR/bin:$PATH:$BINDIR export PATH

GCC_EXEC_PREFIX=$TARGETDIR/bin export GCC_EXEC_PREFIX

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

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

HOSTED_CC=/usr/bin/cc export HOSTED_CC
NOGCCERROR=yes export NOGCCERROR
OBJECT_FMT=ELF export OBJECT_FMT

#MKDEP="$BINDIR/netbsd_mkdep -I$TARGETDIR/include -I$TARGETDIR/include/sys -I$TARGETDIR/include/machine" export MKDEP
MKDEP="$BINDIR/netbsd_mkdep" export MKDEP

INSTALL="$BINDIR/netbsd_install" export INSTALL

COPTS="-O2 -D__NetBSD__" export COPTS
#COPTS="-O2 -D__NetBSD__ -D__STDC__=1" export COPTS
#CFLAGS="-D__NetBSD__" export CFLAGS

#CPPFLAGS="-I$TARGETDIR/include -I$TARGETDIR/include/sys -I$TARGETDIR/include/machine" export CPPFLAGS

#MAKE=make
MAKE="$BINDIR/netbsd_make -m $MKFDIR -I $MKFDIR/sys.mk -f Makefile"; export MAKE

set -x
exec $MAKE "$@"

--
Sakai Hiroaki
hsakai@m8.people.or.jp