Difference between revisions of "Compilation"
(moved here from Hacking) |
m (1 revision(s)) |
(No difference)
|
Revision as of 17:05, 10 November 2007
(moved here from Hacking)
Create your own Terastation cross toolchain
Note: If you want a nice structured build environment, try the ELDK instead.
- Get prepared with the appropriate files:
- Crosstool v. 0.42 Crosstool Website. Extract this to a working location.
- A kernel config file from the Linkstation Wiki site. Put this file in the crosstools directory.
- Create a powerpc-603e.dat file in the crosstools directory:
- KERNELCONFIG=`pwd`/powerpc-603e.config
- TARGET=powerpc-603e-linux-gnu
- TARGET_CFLAGS="-O -mcpu=603e"
- GCC_EXTRA_CONFIG="--with-cpu=603e --enable-cxx-flags=-mcpu=603e"
- Create a build shell script in the crosstools directory:
- #!/bin/sh</code>
- set -ex</code>
- TARBALLS_DIR=/tmp/downloads
- RESULT_TOP=/opt/crosstool
- export TARBALLS_DIR RESULT_TOP
- #GCC_LANGUAGES="c,c++,java"
- GCC_LANGUAGES="c,c++"
- export GCC_LANGUAGES
- # Really, you should do the mkdir before running this,
- # and chown /opt/crosstool to yourself so you don't need to run as root.
- # mkdir -p $RESULT_TOP
- # Build the toolchain. Takes a couple hours and a couple gigabytes.
- eval `cat powerpc-603e.dat gcc-3.3.6-glibc-2.3.2.dat` sh all.sh --notest
- echo Done.
- A couple of things to note here. The Terastation stock gcc/glibc is 3.3.1/2.3.2. The gcc crossbuild #:of 3.3.1 requires a couple of extra patches to compile and 3.3.6 compiles cleanly. It's unlikely #:that something would specifically require 3.3.1 so I used 3.3.6.
- Also, note that the java language is not built. It does not compile without error in the crossbuild. #:It's probably trivial to get it to compile, I just quit trying because I don't currently have a use #:for it. If you get it to compile, please post the patch here.
- Start the Build
- First create the /opt/crosstools directory and make sure your compiling user (hopefully not root) has #:access to write files there, then:
- ./powerpc-603e.sh
- (Go have a beer, or six. This will take awhile. On my 1.4 GHz machine, it takes roughly 4 hours #:(hey, just be happy you're not building it on your wimpy TS). It will use about 2 GB of disk space #:as well.)
- First create the /opt/crosstools directory and make sure your compiling user (hopefully not root) has #:access to write files there, then:
--Entropy 10:08, 30 November 2006 (CET)
Using a 3rd party Cross Toolchain
Recently, I've been using the Embedded Linux Development Kit toolchain from Denx Software Engineering. This is a FREE cross-platform toolchain with support for a number of target CPUs (including the PPC 603e in the Terastation). The complete system is managed by RPM, including the cross-build process. The base toolchain comes with quite a few "ready to install" RPMs for your target platform.
I'm using the 3.1.1-2005-06-07 version as it most closely matches the libraries already on the Terastation.
Package / Platform | Terastation Pro | ELDK 3.1.1-2005-06-07 |
---|---|---|
gcc | 3.3.1 | 3.3.3 |
glibc | 2.3.2 | 2.3.1 |
--Entropy 10:50, 6 December 2006 (CET)
Building code on the Terastation using Gentoo
This is a quick and dirty way to get a working gcc build environment on the Terastation itself.
Due to the size of the Gentoo base layout, we don't want to do this on the root filesystem, or we'll fill it up. The easiest thing to do is create a new shared folder called (for example) gentoo under /mnt/array1.
Download the 2004.1 stage3 ppc tarball from one of the Gentoo Mirrors. You will need to look in the releases/historical/ppc/2004.1/stages/ppc/ directory for stage3-ppc-2004.1.tar.bz2. Put this in the gentoo folder.
cd /mnt/array1/gentoo tar xpjvf stage3-ppc-2004.1.tar.bz2 mount -t proc proc ./proc
Copy some files over:
cp /etc/fstab etc cp /etc/passwd etc cp /etc/group etc cp /etc/resolv.conf etc cp /etc/hosts etc
Now chroot into the Gentoo environment:
bin/chroot . /bin/bash source /etc/profile
At this point, you should have access to gcc, nano, ssh, and a host of other useful tools - certainly enough to download tarballs and build applications. I've succeeded in building unfs3, openssh, and a bunch of other apps this way. Note that anything you build must either be run from inside the chroot'd environment, OR you must resolve any additional library dependencies by copying new required libs into /lib on the real root filesystem.
I did try unsuccessfully to get the whole Gentoo portage system working - which would be pretty sweet, but I kept running into problems which I think are due to the 2004.1 release being so old. Unfortunately later versions of the stage3 tarball don't work because its libs are designed to work with a 2.6 kernel.
--Foobar 20:05, 20 February 2007 (CET)