Cross-architecture compiling

1 view
Skip to first unread message

Jan Dušátko

unread,
Nov 23, 2011, 9:37:39 AM11/23/11
to freebsd...@freebsd.org
Hi,

I would like to ask people in this conference for advice regards
cross-architecture compiling.
Right now I have 32-bit system, where I need to boot over TFTP/NFS diferrent
architectures (i386/AMD64). I need to populate appropriate directory
structure using some "generalized" kernel configuration, each platform have
thein own kernel.conf.

I did those steps bellow, but this not work. Can someone help me?

Regards

Jan


#!bin/sh
export CC="/usr/cross/usr/bin/gcc"
export AS="/usr/cross/usr/bin/as"
export NM="/usr/cross/usr/bin/nm"
export RANLIB=/usr/cross/usr/bin/ranlib"
export LD="/usr/cross/usr/bin/ld"
export OBJCOPY="/usr/cross/usr/bin/objcopy"
export SIZE="/usr/cross/usr/bin/size"
export CPUTYPE="native"
export KERNCONF=""
for TARGET_ARCH in i386 amd64
do
export MACHINE=${TARGET_ARCH}
export MACHINE_ARCH=${TARGET_ARCH}
export DESTDIR="/pxeboot/diskless/${TARGET_ARCH}"
mkdir $DESTDIR
mkdir -p ${DESTDIR}usr/bin
mkdir -p ${DESTDIR}usr/lib
mkdir -p ${DESTDIR}usr/include
mkdir -p ${DESTDIR}usr/share/man/man1
mkdir -p ${DESTDIR}usr/share/info
mkdir -p ${DESTDIR}usr/libdata/ldscripts
mkdir -p ${DESTDIR}usr/libexec
cd /usr/obj
rm -rf usr
cd /usr/src
make world TARGET_ARCH=$TARGET_ARCH TOOLS_PREFIX=$DESTDIR
DESTDIR=$DESTDIR install
make kernel TARGET_ARCH=$TARGET_ARCH TOOLS_PREFIX=$DESTDIR
DESTDIR=$DESTDIR install
cd etc
make distribution
mkdir $DESTDIR/boot
cp /boot/device.hints $DESTDIR/boot
done
mkdir -p /pxeboot/diskless/conf/default/etc
ln -s /pxeboot/diskless/conf/default /pxeboot/diskless/i386/conf/default
ln -s /pxeboot/diskless/conf/default /pxeboot/diskless/amd64/conf/default


_______________________________________________
freebsd...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-curre...@freebsd.org"

Boris Samorodov

unread,
Nov 23, 2011, 2:16:10 PM11/23/11
to j...@dusatko.org, freebsd...@freebsd.org
Hi All,

23.11.2011 18:37, Jan Dušátko пишет:


> Hi,
>
> I would like to ask people in this conference for advice regards
> cross-architecture compiling.
> Right now I have 32-bit system, where I need to boot over TFTP/NFS diferrent
> architectures (i386/AMD64). I need to populate appropriate directory
> structure using some "generalized" kernel configuration, each platform have
> thein own kernel.conf.

At my previous $JOB we configured an amd64 system to load i386 diskless
stations.

> I did those steps bellow, but this not work. Can someone help me?

"Not work" is not a diagnostic message. Please, be more specific here.

> Regards
>
> Jan
>
>
> #!bin/sh
> export CC="/usr/cross/usr/bin/gcc"
> export AS="/usr/cross/usr/bin/as"
> export NM="/usr/cross/usr/bin/nm"
> export RANLIB=/usr/cross/usr/bin/ranlib"
> export LD="/usr/cross/usr/bin/ld"
> export OBJCOPY="/usr/cross/usr/bin/objcopy"
> export SIZE="/usr/cross/usr/bin/size"
> export CPUTYPE="native"

I'm not sure if those varialbes are needed.

> export KERNCONF=""

Well, does this really work? Is it the same as KERNCONF=GENERIC?
Not sure.

> for TARGET_ARCH in i386 amd64
> do
> export MACHINE=${TARGET_ARCH}
> export MACHINE_ARCH=${TARGET_ARCH}
> export DESTDIR="/pxeboot/diskless/${TARGET_ARCH}"
> mkdir $DESTDIR
> mkdir -p ${DESTDIR}usr/bin
> mkdir -p ${DESTDIR}usr/lib
> mkdir -p ${DESTDIR}usr/include
> mkdir -p ${DESTDIR}usr/share/man/man1
> mkdir -p ${DESTDIR}usr/share/info
> mkdir -p ${DESTDIR}usr/libdata/ldscripts
> mkdir -p ${DESTDIR}usr/libexec
> cd /usr/obj
> rm -rf usr
> cd /usr/src
> make world TARGET_ARCH=$TARGET_ARCH TOOLS_PREFIX=$DESTDIR
> DESTDIR=$DESTDIR install
> make kernel TARGET_ARCH=$TARGET_ARCH TOOLS_PREFIX=$DESTDIR
> DESTDIR=$DESTDIR install

I'm not sure about TOOLS_PREFIX (do not recall we used it).

> cd etc

I'd say this is not needed.

> make distribution

And that should be "make distribution DESTDIR=$DESTDIR".

> mkdir $DESTDIR/boot

That directory should already present.
And the rest I don't understand (may be OK).

> cp /boot/device.hints $DESTDIR/boot
> done
> mkdir -p /pxeboot/diskless/conf/default/etc
> ln -s /pxeboot/diskless/conf/default /pxeboot/diskless/i386/conf/default
> ln -s /pxeboot/diskless/conf/default /pxeboot/diskless/amd64/conf/default

--
WBR, Boris Samorodov (bsam)
FreeBSD Committer, http://www.FreeBSD.org The Power To Serve

Craig Rodrigues

unread,
Nov 23, 2011, 3:34:14 PM11/23/11
to j...@dusatko.org, freebsd...@freebsd.org
2011/11/23 Jan Dušátko <j...@dusatko.org>:


Hi,

I don't have experience setting up a cross-build environment for
FreeBSD, but you may want to read this:

http://bsdimp.blogspot.com/2006/09/cross-building-freebsd.html

However, I have more experience setting up PXE (TFTP + NFS) booting
systems of FreeBSD. You should read this
document which I wrote:

http://www.freebsd.org/doc/handbook/network-pxe-nfs.html

--
Craig Rodrigues
rod...@crodrigues.org

Reply all
Reply to author
Forward
0 new messages