Since every attempt to produce a compiler for my NAS that can be used to compile the OpenJDK failed, I decided to create a toolchain on the NAS to compile this stuff. The reason for a separate toolchain is that libraries are needed that are used by the running system. Replacing them is a bad idea. Therefore I set up a native toolchain to compile other programs into the running system. Basically this is the same as the first couple of chapters form the Linux from Scratch (Version 6.5) approach, which I used as guidance. The following listing does not produce the desired results but it is never the less a good starting point.
First pass
Binutilities 2.19.1
LDFLAGS="-L/opt/usr/lib" ../binutils-2.19.1/configure --target=$LFS_TGT --prefix=$LFS --disable-nls --disable-werror
The LDFLAGS is necessary because the libz.so resides in /opt/usr/lib and not in the standard search path /usr/lib. Without this library the size of the type off_t (File pointer) cannot be computed.
GCC 4.4.3
To be able to compile the JDK I need a bootstrap JDK compiler. This will be GCJ. But in the first pass the Java extension is not included. I included the packages GMP, MPFR and MPC in the compile process of GCC.
../gcc-4.4.3/configure --target=$LFS_TGT --prefix=$LFS --disable-nls --disable-shared --disable-multilib --disable-decimal-float --disable-threads
--disable-libmudflap --disable-libssp --disable-libgomp --enable-languages=c
The next step is to install the linux headers of the appropriate version. The version can be retrieved by uname -a
GLibC 2.10.1
../glibc-2.10.1/configure --prefix=$LFS --host=$LFS_TGT --build=$(../glibc-2.10.1/scripts/config.guess) --disable-profile --enable-add-ons --enable-kernel=2.6.18 --with-headers=$LFS/include libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes
After that the specs file of the compile has to be adjusted.
Second run
Binutils
CC="$LFS_TGT-gcc -B$LFS/lib/" \
AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \
../binutils-2.19.1/configure --prefix=$LFS \
--disable-nls --with-lib-path=$LFS/lib
The linker must be created with a special linking to the libary directories:
make -C ld LIB_PATH=/opt/usr/lib:/opt/lib:/usr/lib:/lib
GCC
Even though the version used here differes from the LFS script (4.4.1) the same fixtures can be applied.
CC="$LFS_TGT-gcc -B$LFS/lib/" \
AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \
../gcc-4.4.3/configure --prefix=$LFS \
--with-local-prefix=$LFS --enable-clocale=gnu \
--enable-shared --enable-threads=posix \
--enable-__cxa_atexit --enable-languages=c,c++ \
--disable-libstdcxx-pch --disable-multilib \
--disable-bootstrap
The configure may fail due to the CC variable (compiler not found). If so replace $LFS_TGT-gcc with the actual path to the corresponding compiler.
Tcl 8.5.7
This package is compiled into the original host system:
./configure --prefix=/opt/usr/local
Expect 5.43.0
./configure --prefix=/opt/usr/local --with-tcl=/opt/usr/local/lib \
--with-tclinclude=/opt/usr/local/include --with-x=no
DejaGNU 1.4.4
./configure --prefix=/opt/usr/local
These last three packages were not installed into the toolchain. Therefore I compiled them a second time for the toolchain.
Ncurses 5.7
./configure --prefix=$LFS --with-shared \
--without-debug --without-ada --enable-overwrite
Bash 4.0
./configure --prefix=$LFS --without-bash-malloc
Bzip 1.0.5
This package has no configuration, the prefix parameter is passed to the make install command:
make PREFIX=$LFS install
Corutils 7.4
./configure --prefix=$LFS --enable-install-program=hostname
The tests are very excessive and do not run with user root.
Diffutils 2.8.1
./configure --prefix=$LFS
Findutils 5.19
./configure --prefix=$LFS
Gawk 3.1.7
./configure --prefix=$LFS
Gettext 0.17
./configure --prefix=$LFS --disable-shared
Gzip 1.3.12
./configure --prefix=$LFS
Patch 2.5.9
./configure --prefix=$LFS
Java
For the compilation of the JDK i followed the BLFS and its acompanign user site.
After patching up the gcc sources:
CFLAGS="-I/opt/include" ../gcc-4.4.3/configure --prefix=/opt/usr/local/gcc-4.4.3 --libexecdir=/opt/usr/local/lib --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++,java --disable-bootstrap --with-gmp-include=/usr/include --with-gmp-lib=/usr/lib
The disable bootstrap because of an error in building bootstrap with powerpc.