Last change: 2000-07-22, Written by Clifford Wolf. ** Mini-Howto for building a rescue system for the PowerPC platform When reading this document (and performing the steps described here) you should have allready some experience with making native builds of ROCK Linux. First you need to download the ROCK Linux sources and the package sources, as described in the documentation for the native builds. You don't need an NFS server becouse we only can do a stage-1-build (the NFS server is only needed for the stages 2-5). Let's say you installed all this stuff in /rock-linux. ** Step 1: Configuring ROCK Linux You need to tell ROCK Linux what you want to do (a cross build for the powerpc architecture): murphy:/rock-linux# echo arch=powerpc > Config murphy:/rock-linux# echo buildoptpkgs=0 >> Config murphy:/rock-linux# echo buildextpkgs=0 >> Config murphy:/rock-linux# echo crossnative=cross >> Config Optionally you can also turn off the 'abort-on-error' feature - so the build system will continue building the other packages if one package failed to build. For sure - that doesn't work well if a package like glibc fails to build. murphy:/rock-linux# echo abortonerror=0 >> Config ** Step 2: Creating a cross compiler If you have allready installed a cross compiler for PowerPCs, you need to remove it (only do this if you don't need it anymore or can re-install it later): murphy:/rock-linux# rm -rf /usr/powerpc-unknown-linux-gnu murphy:/rock-linux# rm -rf /usr/bin/powerpc-unknown-linux-gnu-* murphy:/rock-linux# rm -rf /usr/lib/gcc-lib/powerpc-unknown-linux-gnu murphy:/rock-linux# rm -rf /usr/local/powerpc-unknown-linux-gnu murphy:/rock-linux# rm -rf /usr/local/bin/powerpc-unknown-linux-gnu-* murphy:/rock-linux# rm -rf /usr/local/lib/gcc-lib/powerpc-unknown-linux-gnu Now you need to build the cross compiler. That's really easy with ROCK Linux: murphy:/rock-linux# ./scripts/Create-CrossCC This creates a slightly modified cross compiler which contains some references to you ROCK Linux build tree (in that example /rock-linux). So you need to rebuild it when you change the base directory of the build system. ** Step 3: Building the system Now build the system (that will take a while): murphy:/rock-linux# ./scripts/Build-All COPY The 'COPY' parameter will be ignored since we only build a stage 1 system. After that you will find all packages in rock-powerpc-/* . ** Step 4: Installing it If you have allready an other Linux distribution which runns on the PowerPC architecture you can perform the following steps allready on your target machine. But If you need to cross-build ROCK Linux you pretty sure don't have a Linux running on your PowerPC. So we install it in an NFS-shared directory on the build host (we simply call that directory /powerpc-root): murphy:/rock-linux# for x in rock-powerpc-*/base-pkgs/*.tar.bz2 > do tar xvIf $x -C /powerpc-root ; done Now you need to change the lines for 'root' and 'toor' in the new systems /etc/passwd and /etc/shadow files like that: /etc/passwd: root:x:0:0:root:/root:/bin/sh toor:x:0:0:emergency root:/root:/bin/kiss /etc/shadow: root:::::::: toor:::::::: And we need to create a /bin/sh file becouse there is no bash yet: murphy:/rock-linux# ln -svf sh_pdksh /powerpc-root/bin/sh That's it. Export the /powerpc-root directory using NFS and boot your (NFS-root enabled) kernel on the target machine. Now you can create a filesystem on your PowerPC host, copy the cross built system on it, boot from the local disks and make a native rebuild. ** Appendix 1: Cross-Building a Kernel Cross-building a linux kernel is pretty easy. We have built allready the cross compiler. All you need to do now is to extract you kernel sources somewhere and change the 'ARCH := $(shell uname ...' line in the Makefile to 'ARCH := ppc'. Now run 'make menuconfig' and 'make vmlinux' as usual. Don't forget to enable the devfs and nfs-root drivers. ** Appendix 2: Booting the Linux Kernel on PowerPC [ FIXME: Someone want to write this? ] ** Appendix 3: Booting the Linux Kernel with NFS root Please read /usr/src/linux/Documentation/nfsroot.txt for details.