To compile a kernel, you first need to build cross-compile tools.
First, create the following directories into the destination directory:
mkdir -p usr/bin
mdkir -p usr/lib
mkdir -p usr/include
mkdir -p usr/share/man/man1
mkdir -p usr/share/info
mkdir -p usr/libdata/ldscripts
mkdir -p usr/libexec
Go in
/usr/src/gnu/usr.bin/cc
, and do :
make TARGET_ARCH=arm TOOLS_PREFIX=/usr/cross clean depend all
make TARGET_ARCH=arm TOOLS_PREFIX=/usr/cross DESTDIR=/usr/cross install
Then go in
/usr/src/gnu/usr.bin/binutils
, and do :
make TARGET_ARCH=arm TOOLS_PREFIX=/usr/cross clean depend all
make TARGET_ARCH=arm TOOLS_PREFIX=/usr/cross DESTDIR=/usr/cross install
You should get what is needed to cross-compile a kernel.
You need to set the following environment variables for cross-compiling :
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 MACHINE=arm
export MACHINE_ARCH=arm
Then you can compile the kernel the usual way, ie :
cd /sys/arm/conf
config IQ31244
cd ../compile/IQ31244 && make depend all
To boot the resulting kernel, I configured a BOOTP and a TFTP server, asked
RedBoot to use BOOTP, and then use the following little script to automatically
boot the kernel :
load -b 0x00200000 kernel
go
To go multiuser, a full world is needed too.
To obtain one, simply go to /usr/src and do :
make TARGET_ARCH=arm TARGET_CPUTYPE=xscale buildworld
make TARGET_ARCH=arm TARGET_CPUTYPE=xscale DESTDIR=/path/to/arm/root installworld
Note: Optimisation flags for userland seems to work now, but use with caution.
Then just export
/path/to/arm/root
via NFS, and setup your BOOTP server to use
that as a NFS root.
Populate
/path/to/arm/root/etc
as well with your conf files.
The arm board should then be able to boot multiuser with a serial console.