|
|
|
Cross-Building ROCK Linux
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
1. Cross building ROCK Linux itself
|
|
===================================
|
|
|
|
Cross-Building ROCK Linux from one architecture to another is pretty easy.
|
|
Just follow the steps described in the Documentation/BUILD file and make
|
|
sure that you selected the 'This is a cross-build between architectures'
|
|
configuration option.
|
|
|
|
Now, when you start './scripts/Build-Target' it will first build a cross
|
|
compiler and then cross compile a minimal ROCK Linux for you. This minimal
|
|
system contains everything needed for a full-functional command-line system
|
|
including init-process, shell, etc. but excluding the linux kernel itself.
|
|
|
|
You can install this cross-compiled ROCK Linux system on your target
|
|
architecture and make a full rebuild of ROCK Linux there if you need the
|
|
more advanced packages (like X11).
|
|
|
|
Note that not all targets can be cross-compiled without errors - but the
|
|
target 'generic' should do fine.
|
|
|
|
|
|
2. Cross building the kernel
|
|
============================
|
|
|
|
First extract the kernel sources somewhere. Do not cross-build the linux kernel
|
|
in /usr/src/linux - this might screw up your system headers! Change to the
|
|
linux kernel source directory.
|
|
|
|
Before we can build the kernel we need to tell the system where the cross
|
|
compiler we build with './scripts/Build-Target' is installed. It's in the
|
|
ROCK Linux base directory under build/<config-id>/tools/crosscc. So we extend
|
|
the PATH variable using a command like e.g. for PowerPC:
|
|
|
|
export PATH="/rock-linux/build/powerpc-1.7.0-DEV-powerpc-cross-generic/tools/crosscc:$PATH"
|
|
|
|
We also need to tell the kernel about the architecture and cross-compiler. Set
|
|
in the Makefile the variables ARCH and CROSS_COMPILE to e.g. for PowerPC:
|
|
|
|
ARCH = ppc
|
|
CROSS_COMPILE = powerpc-unknown-linux-gnu-
|
|
|
|
Now you can configure and build a kernel as usual using "make menuconfig"
|
|
and "make vmlinux" (or something like "make bzImage").
|
|
|
|
|
|
3. Installing the results
|
|
=========================
|
|
|
|
This is the most complitated step and may be diffircult for some architectures.
|
|
You need to export the system in build/<config-id>/root using NFS and boot the
|
|
cross-built kernel on the target architecture with nfs-root.
|
|
|
|
Let's say we want to install our PowerPC cross-built on an RS/6000 with
|
|
OpenFirmware. In that case we need to copy the kernel chrp image to a floppy
|
|
disk and boot the kernel with the Openfirmware command:
|
|
|
|
boot floppy:,zImage.prep root=/dev/nfs nfsroot=/ppc-nfs-root \
|
|
ip=192.168.0.2:192.168.0.1
|
|
|
|
Assuming that the nfs server has the ip 192.168.0.1, the client should
|
|
use 192.168.0.2 and the exported directory is "/ppc-nfs-root". Read
|
|
Documentation/nfsroot.txt from the linux kernel sources for details.
|
|
|
|
Now you can use the standard Linux commands for creating a filesystem on a
|
|
local partition and copy all system data.
|
|
|