1. Embedded Linux Development Kit

The Embedded Linux Development Kit (ELDK) includes the GNU cross development tools, such as the compilers, binutils, gdb, etc., and a number of pre-built target tools and libraries necessary to provide some functionality on the target system.

It is provided for free with full source code, including all patches, extensions, programs and scripts used to build the tools.

Packaging and installation is based on the RPM package manager.

1.1. ELDK Availability

The ELDK is available

1.2. Supported Host Systems

The ELDK can be installed onto and operate with the following operating systems:

Users also reported successful installation and use of the ELDK on the following host systems:

Note: It may be necessary, and is usually recommended, to install the latest available software updates on your host system. For example, on Fedora Core systems, you can use one of yum, apt-get or up2date to keep your systems current.

1.3. Supported Target Architectures

The ELDK includes target components and supports code generation for the following PowerPC types of processors:

There is also an ELDK for ARM and MIPS systems.

1.4. Installation

1.4.1. Product Packaging

Stable versions of the ELDK are distributed in the form of an ISO image, which can be either burned onto a DVD or mounted directly, using the loopback Linux device driver (Linux host only).

For the PowerPC target, the ELDK distribution was split into three independent ISO images: one targeting the 4xx family of processors (AMCC), one targeting the ppc64 family of processors, and another one for the 8xx, 6xx, 74xx and 85xx families (Freescale). This makes the ISO images fit on standard DVDROM media.

If you are not bound by the DVDROM size limitiation there is still a single image containing all 32-bit targets (AMCC and Freeescale).

Development versions of the ELDK are available as directory trees so it is easy to update individual packages; instructions for download of these trees and creation of ISO images from it is described in section 1.4.2. Downloading the ELDK.

The ELDK contains an installation utility and a number of RPM packages, which are installed onto the hard disk of the cross development host by the installation procedure. The RPM packages can be logically divided into two parts:

The first part contains the cross development tools that are executed on the host system. Most notably, these are the GNU cross compiler, binutils, and gdb. For a full list of the provided ELDT packages, refer to section 1.8.1. List of ELDT Packages below.

The target components are pre-built tools and libraries which are executed on the target system. The ELDK includes necessary target components to provide a minimal working NFS-based environment for the target system. For a list of the target packages included in the ELDK, refer to section 1.8.2. List of Target Packages below.

The ELDK contains several independent sets of the target packages, one for each supported target architecture CPU family. Each set has been built using compiler code generation and optimization options specific to the respective target CPU family.

1.4.2. Downloading the ELDK

You can either download the ready-to-burn ISO-images from one of the mirror sites (see 1.1. ELDK Availability), or you can download the individual files of the ELDK from the development directory tree and either use these directly for installation or create an ISO image that can be burned on DVD-ROM.

Change to a directory with sufficient free disk space; for the PowerPC version of the ELDK you need about 1.6 GiB, or twice as much (3.2 GiB) if you also want to create an ISO image in this directory.

To download the ISO image from the ppc-linux-x86/iso directory of one of the mirror sites you can use standard tools like wget or ncftpget, for example:

bash$ wget ftp://ftp.sunet.se/pub/Linux/distributions/eldk/4.2/ppc-linux-x86/iso/ppc-2007-01-19.iso

If you want to download the whole ELDK directory tree instead you can - for example - use the ncftp FTP client:

bash$ ncftp ftp.sunet.se
...
ncftp / > cd /pub/Linux/distributions/eldk/4.2
ncftp /pub/Linux/distributions/eldk/4.2 > bin
ncftp /pub/Linux/distributions/eldk/4.2 > get -R ppc-linux-x86/distribution
...
ncftp /pub/Linux/distributions/eldk/4.2 > bye

Note: If you don't find the ncftp tool on your system you can download the NcFTP client from http://www.ncftp.com/download/

There are a few executable files (binaries and scripts) in the ELDK tree. Make sure they have the execute permissions set in your local copy:

bash$ for file in \
>       tools/bin/rpm \
>       tools/usr/lib/rpm/rpmd \
>       install \
>       ELDK_MAKEDEV \
>       ELDK_FIXOWNER
> do
> chmod +x ppc-linux-x86/distribution/$file
> done

Now create an ISO image from the directory tree:

bash$ mkisofs \
> -A "ELDK-4.2 -- Target: PowerPC -- Host: x86 Linux" \
> -publisher "(C) `date "+%Y"` DENX Software Engineering,   www.denx.de" \
> -p "`id -nu`@`hostname` -- `date`" \
> -V ppc-linux-x86 \
> -l -J -R -o eldk-ppc-linux-x86.iso ppc-linux-x86/distribution

This will create an ISO image eldk-ppc-linux-x86.iso in your local directory that can be burned on DVD or mounted using the loopback device and used for installation as described above. Of course you can use the local copy of the directory tree directly for the installation, too.

Please refer to section 1.9.2. Setting Up ELDK Build Environment for instructions on obtaining the build environment needed to re-build the ELDK from scratch.

1.4.3. Initial Installation

The initial installation is performed using the install utility located in the root of the ELDK ISO image directory tree. The install utility has the following syntax:

$ ./install [-d <dir>] [<cpu_family1>] [<cpu_family2>] ...

-d <dir> Specifies the root directory of the ELDK being installed. If omitted, the ELDK goes into the current directory.
<cpu_family> Specifies the target CPU family the user desires to install. If one or more <cpu_family> parameters are specified, only the target components specific to the respective CPU families are installed onto the host. If omitted, the target components for all supported target architecture CPU families are installed.

Note: Make sure that the "exec" option to the mount command is in effect when mounting the ELDK ISO image. Otherwise the install program cannot be executed. On some distributions, it may be necessary to modify the /etc/fstab file, adding the "exec" mount option to the cdrom entry - it may also be the case that other existing mount options, such as "user" prevent a particular configuration from mounting the ELDK DVD with appropriate "exec" permission. In such cases, consult your distribution documentation or mount the DVD explicitly using a command such as "sudo mount -o exec /dev/cdrom /mnt/cdrom" (sudo allows regular users to run certain privileged commands but may not be configured - run the previous command as root without "sudo" in the case that "sudo" has not been setup for use on your particular GNU/Linux system).

You can install the ELDK to any empty directory you wish, the only requirement being that you have to have write and execute permissions on the directory. The installation process does not require superuser privileges.

Depending on the parameters the install utility is invoked with, it installs one or more sets of target components. The ELDT packages are installed in any case.

Refer to section 1.5. Working with ELDK for a sample usage of the ELDK.

Note: If you intend to use the installation as a root filesystem exported over NFS, then you now have to finish the configuration of the ELDK following the instructions in 1.6. Mounting Target Components via NFS.

Note: Installation of the Glibc- and uClibc-based ELDK versions into one directory is not yet supported. Note: Installation of the 32-bit and 64-bit ELDK versions into one directory is not yet supported.

1.4.4. Installation and Removal of Individual Packages

The ELDK has an RPM-based structure. This means that on the ISO image, individual components of the ELDK are in the form of RPM packages, and after installation, the ELDK maintains its own database which contains information about installed packages. The RPM database is kept local to the specific ELDK installation, which allows you to have multiple independent ELDK installations on your host system. (That is, you can install several instances of ELDK under different directories and work with them independently). Also, this provides for easy installation and management of individual ELDK packages.

To list the installed ELDK RPM packages, use the following command:

bash$ ${CROSS_COMPILE}rpm -qa

To remove an ELDK package, use the following command:

bash$ ${CROSS_COMPILE}rpm -e <package_name>

To install a package, use the following command:

bash$ ${CROSS_COMPILE}rpm -i <package_file_name>

To update a package, use the following command:

bash$ ${CROSS_COMPILE}rpm -U <package_file_name>

For the above commands to work correctly, it is crucial that the correct rpm binary gets invoked. In case of multiple ELDK installations and RedHat-based host system, there may well be several rpm tools installed on the host system.

You must make sure, either by using an explicit path or by having set an appropriate PATH environment variable, that when you invoke rpm to install/remove components of a ELDK installation, it is the ELDK's rpm utility that gets actually invoked. The rpm utility is located in the bin subdirectory relative to the ELDK root installation directory.

To avoid confusion with the host OS (RedHat) rpm utility, the ELDK creates symlinks to its rpm binary with the names such that it could be invoked using the ${CROSS_COMPILE}rpm notation, for all supported $CROSS_COMPILE values.

Note: The standard (host OS) rpm utility allows various macros and configuration parameters to specified in user-specific ~/.rpmrc and ~/.rpmmacros files. The ELDK rpm tool also has this capability, but the names of the user-specific configuration files are ~/.eldk_rpmrc and ~/.eldk_rpmmacros, respectively.

1.4.5. Removal of the Entire Installation

To remove the entire ELDK installation, use the following command while in the ELDK root directory:

bash$ rm -rf <dir>

where <dir> specifies the root directory of the ELDK to be removed.

1.5. Working with ELDK

After the initial installation is complete, all you have to do to start working with the ELDK is to set and export the CROSS_COMPILE environment variable. Optionally, you may wish to add the bin and usr/bin directories of your ELDK installation to the value of your PATH environment variable. For instance, a sample ELDK installation and usage scenario looks as follows:

The value of the CROSS_COMPILE variable must correspond to the target CPU family you want the cross tools to work for. Refer to the table below for the supported CROSS_COMPILE variable values:

1.5.A Table of possible values for $CROSS_COMPILE

CROSS_COMPILE Value Predefined Compiler Flag FPU present or not
ppc_4xx- -mcpu=403 No
ppc_4xxFP- -mcpu=405fp Yes
ppc_6xx- -mcpu=603 Yes
ppc_74xx- -mcpu=7400 Yes
ppc_8xx- -mcpu=860 No
ppc_85xx- -mcpu=8540 Yes
ppc64-linux- -mcpu=powerpc64 Yes
Note: For compatibility with older versions of the ELDK and with other toolkits the following values for $CROSS_COMPILE can be used, too: ppc_7xx- and ppc_82xx-. These are synonyms for ppc_6xx.

1.5.1. Switching Between Multiple Installations

No special actions are required from the user to switch between multiple ELDK installations on the same host system. Which ELDK installation is used is determined entirely by the filesystem location of the binary that is being invoked. This approach can be illustrated using the following example.

Assume the directory /work/denx_tools/usr/bin, where the ppc-linux-gcc compiler binary has been installed, is a part of the PATH environment variable. The user types the command as follows:

$ ppc_8xx-gcc -c myfile.c

To load the correct include files, find the correct libraries, spec files, etc., the compiler needs to know the ELDK root directory. The compiler determines this information by analyzing the shell command it was invoked with ( ppc_8xx-gcc - without specifying the explicit path in this example) and, if needed, the value of the PATH environment variable. Thus, the compiler knows that it has been executed from the /work/denx_tools/usr/bin directory.

Then, it knows that the compiler is installed in the usr/bin subdirectory of the root installation directory, so the ELDK, the compiler is a part of, has been installed in the subdirectories of the /work/denx_tools directory. This means that the target include files are in /work/denx_tools/<target_cpu_variant>/usr/include, and so on.

1.6. Mounting Target Components via NFS

The target components of the ELDK can be mounted via NFS as the root file system for your target machine. For instance, for an 8xx-based target, and assuming the ELDK has been installed into the /opt/eldk directory, you can use the following directory as the NFS-based root file system:

/opt/eldk/ppc_8xx

Note: Before the NFS-mounted root file system can work, you must create necessary device nodes in the <ELDK_root>/<target_cpu_variant>/dev directory. This process requires superuser privileges and thus cannot be done by the installation procedure (which typically runs as non-root). To facilitate creation of the device nodes, the ELDK provides a script named ELDK_MAKEDEV, which is located in the root of the ELDK distribution ISO image. The script acccepts the following optional arguments:

-d <dir> Specifies the root directory of the ELDK being installed. If omitted, then the current directory is assumed.
-a <cpu_family> Specifies the target CPU family directory. If omitted, all installed target architecture directories will be populated with the device nodes.
-h Prints usage.
NOTE: Compared to older versions of the ELDK, options and behaviour of this command have been changed significantly. Please read the documentation.

Note: Some of the target utilities included in the ELDK, such as mount and su, have the SUID bit set. This means that when run, they will have privileges of the file owner of these utilities. That is, normally, they will have the privileges of the user who installed the ELDK on the host system. However, for these utilities to work properly, they must have superuser privileges. This means that if the ELDK was not installed by the superuser, the file owner of the target ELDK utilities that have the SUID bit set must be changed to root before a target component may be mounted as the root file system. The ELDK distribution image contains an ELDK_FIXOWNER script, which you can use to change file owners of all the appropriate files of the ELDK installation to root. The script accepts the same arguments as the ELDK_MAKEDEV script above. Please note that you must have superuser privileges to run this script. For instance, if you have installed the ELDK in the /opt/eldk directory, you can use the following commands:

# cd /opt/eldk
# /mnt/cdrom/ELDK_FIXOWNER

Please note, that in the case that the installation directory, where the new ELDK distribution is being installed, is already populated with other ELDK distributions, the execution of the ELDK_FIXOWNER script without arguments will make the script work with all installed ELDK target architecture directories. This could take some time. To save the time, please use the -a argument to specify the appropriate target architecture. For instance:

# cd /opt/eldk
# /mnt/cdrom/ELDK_FIXOWNER -a ppc_8xx

1.7. Rebuilding ELDK Components

1.7.1. ELDK Source Distribution

The ELDK is distributed with the full sources of all the components, so you may rebuild any ELDK package. The sources are provided in the form of SRPM packages, distributed as a separate ISO image.

To rebuild a target or ELDT package, you must first install the appropriate source RPM package from the ISO image into the ELDK environment. This can be done using the following command:

$ ${CROSS_COMPILE}rpm -i /mnt/cdrom/SRPMS/<source_rpm_file_name>.src.rpm

After an ELDK source RPM is installed using the above command, its spec file and sources can be found in the subdirectories of the <ELDK_root>/usr/src/denx subdirectory.

The sections that follow provide detailed instructions on rebuilding ELDT and target components of the ELDK.

1.7.2. Rebuilding Target Packages

All the target packages can be rebuilt from the provided source RPM packages. At first you have to install the Source RPM itself:

bash$ ${CROSS_COMPILE}rpm -iv <package_name>.src.rpm

Then you can rebuild the binary target RPM using the following command from the ELDK environment:

bash$ ${CROSS_COMPILE}rpmbuild -ba <package_name>.spec

In order for the rebuilding process to work correctly, the following conditions must be true:

1.7.3. Rebuilding ELDT Packages

All the ELDT packages allow for rebuilding from the provided source RPM packages using the following command from the ELDK environment:

$ unset CROSS_COMPILE
$ <ELDK_root>/usr/bin/rpmbuild -ba <package_name.spec>

In order for the rebuilding process to work correctly, make sure all of the following is true:

1.8. ELDK Packages

1.8.1. List of ELDT Packages

Package Name Package Version
autoconf 2.61-8
automake 1.10-5
bison 2.3-3
crosstool-devel 0.43-1
dtc 20070802-1
ftdump 20070802-1
gdb 6.7-1
genext2fs 1.4.1-1
info 4.8-15
ldd 0.1-1
libtool 1.5.22-11
make 3.81-6
mkcramfs 1.1-1
mkimage 1.3.1-1
mtd-utils 1.0.1-2
rpm 4.4.2-46
rpm-build 4.4.2-46
sed 4.1.4-1
texinfo 4.8-15

Note: The crosstool 0.43 ELDT package provides the following packages: gcc 4.2.2, gcc-c++ 4.2.2, cpp 4.2.2 and binutils 2.17.50. For more information about the crosstool package please refer to http://kegel.com/crosstool.

1.8.2. List of Target Packages

Package Name Package Version
acl 2.2.39-3.1
appweb 2.2.2-5
attr 2.4.32-2
autoconf 2.61-8
bash 3.2-9
bc 1.06-26
bind 9.4.1-8.P1
binutils 2.17.50.0.12-4
binutils-devel 2.17.50.0.12-4
boa 0.94.14-0.5.rc21
busybox 1.7.1-1
byacc 1.9.20050813-1
bzip2 1.0.4-10
bzip2-devel 1.0.4-10
bzip2-libs 1.0.4-10
ccid 1.2.1-10
chkconfig 1.3.34-1
coreutils 6.9-3
cpio 2.6-27
cpp 4.2.2-1
cracklib 2.8.9-11
cracklib-dicts 2.8.9-11
crosstool-targetcomponents 0.43-1
curl 7.16.2-1
cyrus-sasl 2.1.22-6
cyrus-sasl-devel 2.1.22-6
cyrus-sasl-lib 2.1.22-6
db4 4.5.20-5
db4-devel 4.5.20-5
db4-utils 4.5.20-5
device-mapper 1.02.17-7
device-mapper-devel 1.02.17-7
device-mapper-libs 1.02.17-7
dhclient 3.0.5-38
dhcp 3.0.5-38
diffutils 2.8.1-16
directfb 1.0.0-1
dosfstools 2.11-8
dropbear 0.50-1
dtc 20070802-1
duma 2.5.8-2
e2fsprogs 1.39-11
e2fsprogs-devel 1.39-11
e2fsprogs-libs 1.39-11
ethtool 5-1
expat 1.95.8-9
expat-devel 1.95.8-9
file 4.21-1
file-libs 4.21-1
findutils 4.2.29-2
flex 2.5.33-9
freetype 2.3.4-3
freetype-devel 2.3.4-3
ftdump 20070802-1
ftp 0.17-40
gawk 3.1.5-15
gcc 4.2.2-1
gcc-c++ 4.2.2-1
gcc-java 4.2.2-1
gdb 6.7-1
glib 1.2.10-26
glib2 2.12.13-1
glib2-devel 2.12.13-1
glib-devel 1.2.10-26
gmp 4.1.4-12.3
grep 2.5.1-57
groff 1.18.1.4-2
gzip 1.3.11-2
hdparm 6.9-3
httpd 2.2.4-4.1
httpd-devel 2.2.4-4.1
httpd-manual 2.2.4-4.1
initscripts 8.54.1-1
iproute 2.6.20-2
iptables 1.3.8-2
iputils 20070202-3
iscsitarget 0.4.15-1
kbd 1.12-22
kernel-headers 2.6.23-1
kernel-source 2.6.23-1
krb5-devel 1.6.1-2.1
krb5-libs 1.6.1-2.1
less 394-9
libattr 2.4.32-2
libattr-devel 2.4.32-2
libcap 1.10-29
libcap-devel 1.10-29
libpng 1.2.16-1
libpng-devel 1.2.16-1
libsysfs 2.1.0-1
libsysfs-devel 2.1.0-1
libtermcap 2.0.8-46.1
libtermcap-devel 2.0.8-46.1
libtirpc 0.1.7-7
libtirpc-devel 0.1.7-7
libtool 1.5.22-11
libtool-ltdl 1.5.22-11
libtool-ltdl-devel 1.5.22-11
libusb 0.1.12-7
libusb-devel 0.1.12-7
libuser 0.56.2-1
libuser-devel 0.56.2-1
libxml2 2.6.29-1
logrotate 3.7.5-3.1
lrzsz 0.12.20-22.1
lsof 4.78-5
lvm2 2.02.24-1
m4 1.4.8-2
mailcap 2.1.23-1
make 3.81-6
MAKEDEV 3.23-1.2
man 1.6e-3
mdadm 2.6.2-4
microwindows 0.91-1
microwindows-fonts 0.91-1
mingetty 1.07-5.2.2
mktemp 1.5-25
module-init-tools 3.3-0.pre11.1.0
mtd-utils 1.0.1-2
ncompress 4.2.4-49
ncurses 5.6-17
ncurses-devel 5.6-17
net-snmp 5.4-14
net-snmp-devel 5.4-14
net-snmp-libs 5.4-14
net-snmp-utils 5.4-14
net-tools 1.60-82
newt 0.52.6-30
newt-devel 0.52.6-30
nfs-utils 1.1.0-1
ntp 4.2.4p2-1
open-iscsi 2.0-865.15
openldap 2.3.34-3
openldap-devel 2.3.34-3
openssl 0.9.8b-12
openssl-devel 0.9.8b-12
oprofile 0.9.2-8
pam 0.99.7.1-5.1
pam-devel 0.99.7.1-5.1
passwd 0.74-3
patch 2.5.4-29.2.2
pciutils 2.2.4-3
pciutils-devel 2.2.4-3
pcmciautils 014-9
pcre 7.0-2
pcsc-lite 1.3.3-1.0
pcsc-lite-devel 1.3.3-1.0
pcsc-lite-libs 1.3.3-1.0
perl 5.8.8-18
perl-libs 5.8.8-18
popt 1.12-1
postgresql 8.2.4-1
postgresql-devel 8.2.4-1
postgresql-libs 8.2.4-1
procps 3.2.7-14
psmisc 22.3-2
rdate 1.4-6
readline 5.2-4
readline-devel 5.2-4
routed 0.17-12_1
rpcbind 0.1.4-6
rpm 4.4.2-46
rpm-build 4.4.2-46
rpm-devel 4.4.2-46
rpm-libs 4.4.2-46
rsh 0.17-40
rsh-server 0.17-40
screen 4.0.3-50
sed 4.1.5-7
SELF 1.0-12
setup 2.6.4-1
shadow-utils 4.0.18.1-15
slang 2.0.7-17
slang-devel 2.0.7-17
strace 4.5.15-1
sysfsutils 2.1.0-1
sysklogd 1.4.2-9
sysvinit 2.86-17
tar 1.15.1-26
tcp_wrappers 7.6-48
tcp_wrappers-devel 7.6-48
tcp_wrappers-libs 7.6-48
telnet 0.17-38
telnet-server 0.17-38
termcap 5.5-1.20060701.1
tftp 0.42-4
tftp-server 0.42-4
thttpd 2.25b
time 1.7-29
u-boot 1.3.1-1
udev 106-4.1
unixODBC 2.2.12-2
unzip 5.52-4
util-linux 2.13-0.52
vim-common 7.1.12-1
vim-minimal 7.1.12-1
vixie-cron 4.1-82
vsftpd 2.0.5-16
which 2.16-8
wireless-tools 28-4
wpa_supplicant 0.5.7-3
wu-ftpd 2.6.2-1
xdd 65.013007-1
xenomai 2.4.0-1
xinetd 2.3.14-12
zip 2.31-3
zlib 1.2.3-10
zlib-devel 1.2.3-10

Note 1: Not all packages will be installed automatically; for example the boa and thttpd web servers are mutually exclusive - you will have to remove one package before you can (manually) install the other one.

Note 2: The crosstool 0.43 target package provides the following packages: glibc 2.6, glibc-common 2.6, glibc-devel 2.6, libstdc++ 4.2.2, libstdc++-devel 4.2.2, libgcj 4.2.2, libgcj-devel 4.2.2 and libstdc++-devel 4.2.2. For more information about the crosstool package please refer to http://kegel.com/crosstool

1.9. Rebuilding the ELDK from Scratch

In this section, you will find instructions on how to build the ELDK from scratch, using the pristine package sources available on the Internet, and patches, spec files, and build scripts provided on the ELDK source CD-ROM.

1.9.1. ELDK Build Process Overview

The ELDK uses Fedora Core 7 Linux distribution as a source code reference. Any modifications to Fedora Core's sources the ELDK has introduced are in the form of patches applied by the RPM tool while building the packages. Also, the ELDK uses modified spec files for its RPM packages. So, the sources of almost every ELDK package consist of the following parts:

The Fedora Core pristine sources may be obtained from the Internet, see http://download.fedora.redhat.com/pub/fedora/linux/core.

The ELDK patches and spec files are available on the ELDK source CD-ROM and from the DENX GIT repositories.

Please use the following commands to clone a copy of one of the modules:

git-clone git://www.denx.de/git/eldk/module
The following ELDK modules are available:

Module Name Contents
tarballs Source tarballs
build Build tools, patches, and spec files

Then you may switch to a specific release of the ELDK using the "git checkout" command; for example, to get the files for ELDK release 4.0, please do the following from the module directory:

git-checkout ELDK_4_0

It must be noted that some of the packages which are included in the ELDK are not included in Fedora Core. Examples of such packages are appWeb, microwindows, and wu-ftpd. For these packages tarballs are provided on the DENX GIT repository.

To facilitate building of the ELDK, a build infrastructure has been developed. The infrastructure is composed of the following components:

The ELDK_BUILD script is the main script of the ELDK build procedure. It is the tool that you would normally use to build the ELDK from scratch. In the simplest case, the script may be invoked without arguments, and it will perform all necessary steps to build the ELDK in a fully automated way. You may pass the following optional arguments to the ELDK_BUILD script:

-d <arch> target architecture: "ppc", "arm" or "mips", defaults to "ppc".
-n <build_name> an identification string for the build. Defaults to the value based on the build architecture and current date, and has the following format: <arch>-YYYY-MM-DD
-u build the uClibc-based ELDK version.

Warning: The ELDK build scripts rely on standard behaviour of the RPM tool. Make sure you don't use non-standard settings in your personal ~/.rpmmacros file that might cause conflicts.

build.sh is a supplementary script that is called by ELDK_BUILD to accomplish certain steps of the build. Refer to section 1.9.3. build.sh Usage below for more details.

The cpkgs.lst and tpkgs.lst files are read by build.sh and must contain lines describing sub-steps of the eldt and trg build procedure steps. Essentially, the files contain the list of the ELDT and target packages to be included in the ELDK. The SRPMS.lst file contains the list of the Fedora Core source RPM packages used during the ELDK build. The tarballs.lst file contains the list of source tarballs of the packages that are included in the ELDK but are not present in Fedora Core 7.

For the ELDK_BUILD script to work correctly, it must be invoked from a certain build environment created on the host system. The build environment can be either checked out from the DENX GIT repository (see section 1.9.2. Setting Up ELDK Build Environment below for details) or copied from the ELDK build environment CD-ROM.

To be more specific, the following diagram outlines the build environment needed for correct operation of the ELDK_BUILD script:

<some_directory>/
                 build/cross_rpms/<package_name>/SPECS/...
                                                 SOURCES/...
                       target_rpms/<package_name>/SPECS/...
                                                  SOURCES/...
                       install/install.c
                               Makefile
                       misc/ELDK_MAKEDEV
                            ELDK_FIXOWNER
                            README.html
                       cpkgs.lst
                       tpkgs.lst
                       build.sh
                                                                                
                       ELDK_BUILD
                                                                                
                       SRPMS.lst
                                                                                
                       tarballs.lst

                 tarballs/....
                                                                                
                 SRPMS/....
                 SRPMS-updates/....

In subdirectories of the cross_rpms and target_rpms directories, the sources and RPM spec files of, respectively, the ELDT and target packages are stored. The install subdirectory contains the sources of the installation utility which will be built and placed in the root of the ISO image. tarballs directory contains the source tarballs of the packages that are included in the ELDK but are not present in Fedora Core 4.

The SRPMS and SRPMS-updates directories may contain the source RPM packages of Fedora Core 7. The ELDK_BUILD script looks for a package in the SRPMS directory and then, if the package is not found, in the SRPMS-updates directory. If some (or all) of the Fedora Core SRPMs needed for the build are missing in the directory, the ELDK_BUILD script will download the source RPMs automatically from the Internet.

The ELDK build environment CD-ROM provides a ready-to-use ELDK build environment. Please refer to section 1.9.2. Setting Up ELDK Build Environment below for detailed instructions on setting up the build environment.

The ELDK_BUILD script examines the contents of the ELDK_PREFIX environment variable to determine the root directory of the ELDK build environment. If the variable is not set when the script is invoked, it is assumed that the root directory of the ELDK build environment is /opt/eldk. To build the ELDK in the example directory layout given above, you must set and export the ELDK_PREFIX variable <some_directory> prior to invoking ELDK_BUILD.

After all the build steps are complete, the following subdirectories are created in the ELDK build environment:

build/<build_name>/work/             - full ELDK environment
build/<build_name>/logs/             - build procedure log files
build/<build_name>/results/b_cdrom/  - binary cdrom tree, ready for mkisofs
                   results/s_cdrom/  - source cdrom tree, ready for mkisofs
                   results/d_cdrom/  - debuginfo cdrom tree, ready for mkisofs

On Linux hosts, the binary and source ISO images are created automatically by the ELDK_BUILD script and placed in the results directory. On Solaris hosts, creating the ISO images is a manual step. Use the contents of the b_cdrom and s_cdrom directories for the contents of the ISO images.

1.9.2. Setting Up ELDK Build Environment

For your convenience, the ELDK build environment CD-ROM provides full ELDK build environment. All you need to do is copy the contents of the CD-ROM to an empty directory on your host system. Assuming the ELDK build environment CD-ROM is mounted at /mnt/cdrom, and the empty directory where you want to create the build environment is named /opt/eldk, use the following commands to create the build environment:

bash$ cd /opt/eldk
bash$ cp -r /mnt/cdrom/* .

These commands will create the directory structure as described in section 1.9.1. ELDK Build Process Overview above. All necessary scripts and ELDK specific source files will be placed in the build subdirectory, and the required tarballs can be found in the tarballs subdirectory. In the SRPMS subdirectory, you will find all the Fedora Core 4 SRPMS needed to build the ELDK.

Alternatively, you can obtain the ELDK build environment from the DENX GIT repository. Two modules are provided for check out: build and tarballs. The first one contains the files for the build subdirectory in the build environment, and the second one contains source tarballs of the packages that are included in the ELDK but are not present in Fedora Core 4. To create the ELDK build environment from the DENX GIT repository, use the following commands (the example below assumes that the root directory of the build environment is /opt/eldk):

bash$ cd /opt/eldk
bash$ git-clone git://www.denx.de/git/eldk/build
bash$ git-clone git://www.denx.de/git/eldk/tarballs

After the build and tarballs modules have been checked out, the only remaining piece that is needed for the build is the Fedora Core 4 source RPM packages, which will, if required, be automatically downloaded by the ELDK_BUILD script.

1.9.3. build.sh Usage

If you wish to perform only a part of the ELDK build procedure, for instance to re-build or update a certain package, it may sometimes be convenient to invoke the build.sh script manually, without the aid of the ELDK_BUILD script. Please note, however, that this approach is in general discouraged.

The whole build procedure is logically divided into six steps, and the build.sh must be told which of the build steps to perform. The build steps are defined as follows:

Further, the eldt and trg build steps are devided into sub-steps, as defined in the cpkgs.lst and tpkgs.lst

files (see below for details). You may specify which sub-steps of the build step are to be performed.

The formal syntax for the usage of build.sh is as follows:

bash$ ./build.sh [-a <arch>] [-n <name>] [-p <prefix>] [-r <result>] \
                 [-w <work>] <step_name> [<sub_step_number>]

-a <arch> target architecture: "ppc", "ppc64", "arm" or "mips", defaults to "ppc".
-n <build_name> an identification string for the build. It is used as a name for some directories created during the build. You may use for example the current date as the build name.
-p <prefix> is the name of the directory that contains the build environment. Refer to build overview above for description of the build environment.
-r <result> is the name of the directory where the resulting RPMs and SRPMs created on this step will be placed.
-w <work> is the name of the directory where the build is performed.
<stepname> is the name of the build step that is to be performed. Refer to the list of the build procedure steps above.
<sub_step_number> is an optional parameter which identifies sub-steps of the step which are to be performed. This is useful when you want to re-build only some specific packages. The numbers are defined in the cpkgs.lst and tpkgs.lst files discussed below. You can specify a range of numbers here. For instance, "2 5" means do steps from 2 to 5, while simply "2" means do all steps starting at 2.

By default, the invocation of build.sh assumes that the Glibc-based ELDK version is being built. For the uClibc-based ELDK build, set the UCLIBC environment variable to 1 prior to running build.sh :

bash$ export UCLIBC=1

Note: Please note that you must never use build.sh to build the ELDK from scratch. For build.sh to work correctly, the script must be invoked from the build environment after a successful build using the ELDK_BUILD script. A possible scenario of build.sh usage is such that you have a build environment with results of a build performed using the ELDK_BUILD script and want to re-build certain ELDT and target packages, for instance, because you have updated sources of a package or added a new package to the build.

When building the target packages (during the trg buildstep), build.sh examines the contents of the TARGET_CPU_FAMILY_LIST environment variable, which may contain a list indicating which target CPU variants the packages must be built for. Possible CPU variants are 4xx, 4xxFP, 6xx, 74xx, 8xx and 85xx. For example, the command below rebuilds the target RPM listed in the tpckgs.lst file under the number of 47 (see section 1.9.4. Format of the cpkgs.lst and tpkgs.lst Files for description of the tpckgs.lst and cpkgs.lst files), for the 8xx and 85xx CPUs:

bash$ TARGET_CPU_FAMILY_LIST="8xx 85xx" \
> /opt/eldk/build.sh -a ppc \
>                    -n 2008-01-19 \
>                    -p /opt/eldk/build/ppc-2008-01-19 \
>                    -r /opt/eldk/build/ppc-2008-01-19/results \
>                    -w /opt/eldk/build/ppc-2008-01-19/work \
>                    trg 47 47

Note: If you are going to invoke build.sh to re-build a package that has already been built in the build environment by the ELDK_BUILD script, then you must first manually uninstall the package from ELDK installation created by the build procedure under the work directory of the build environment.

Note: It is recommended that you use the build.sh script only at the final stage of adding/updating a package to the ELDK. For debugging purposes, it is much more convenient and efficient to build both ELDT and target packages using a working ELDK installation, as described in the sections 1.7.2. Rebuilding Target Packages and 1.7.3. Rebuilding ELDT Packages above.

1.9.4. Format of the cpkgs.lst and tpkgs.lst Files

Each line of these files has the following format:

<sub_step_number> <package_name> <spec_file_name> \
  <binary_package_name> <package_version>

The ELDK source CD-ROM contains the cpkgs.lst and tpkgs.lst files used to build this version of the ELDK distribution. Use them as reference if you want to include any additional packages into the ELDK, or remove unneeded packages.

To add a package to the ELDK you must add a line to either the cpkgs.lst file, if you are adding a ELDT package, or to the tpkgs.lst file, if it is a target package. Keep in mind that the relative positions of packages in the cpkgs.lst and tpkgs.lst files (the sub-step numbers) are very important. The build procedure builds the packages sequentially as defined in the *.lst files and installs the packages in the "work" environment as they are built. This implies that if a package depends on other packages, those packages must be specified earlier (with smaller sub-step numbers) in the *.lst files.

Note: For cpkgs.lst, the package_version may be replaced by the special keyword "RHAUX". Such packages are used as auxiliary when building ELDK 4.2 on non-Fedora hosts. These packages will be built and used during the build process, but will not be put into the ELDK 4.2 distribution ISO images.