The steps to be taken are entirely analogous to those in chapter 5 of LFS 5.0. Please refer there for full details.
The main differences from LFS 5 in this build are:
export PATH=/tools/bin:/opt/x86_64/x86_64-unknown-linux/bin:$PATH
The convention for dual i686/x86_64 configurations is for i686 libraries to
go in /lib, and x86_64 libraries to go in /lib64. Some of the components
we are going to build will install their libraries into /lib, even when
told to install them in /lib64. We want all the libraries in the same
directory, and since we are not building i686 libraries yet, we will make
the following symlink before building binutils:
mkdir /tools/lib
ln -s lib /tools/lib64
binutils-2.14, pass 1
Be sure the path is set up as indicated above, with the new cross-compiler
included before the host system's default compiler.
mkdir ../binutils-build
cd ../binutils-build
../binutils-2.14/configure \
--prefix=/tools --disable-nls
make configure-host
make LDFLAGS="-all-static"
make install
make -C ld clean
make -C ld LDFLAGS="-all-static" LIB_PATH=/tools/lib
gcc-3.1.1 pass 1
--with-local-prefix=/opt/x86-64 ensures that headers are used preferentially
from the cross-compiling toolchain.
mkdir ../gcc-build
cd ../gcc-build
../gcc-3.3.1/configure --prefix=/tools \
--with-local-prefix=/opt/x86-64 \
--disable-nls --enable-shared \
--enable-languages=c
make BOOT_LDFLAGS="-static" bootstrap
make install
ln -sf gcc /tools/bin/cc
linux-2.4.24 headers
make mrproper
yes "" | make config
make include/linux/version.h
make symlinks
mkdir /tools/include/asm
cp include/asm/* /tools/include/asm
cp -R include/asm-generic /tools/include
cp -R include/linux /tools/include
touch /tools/include/linux/autoconf.h
glibc-2.3.2
tar xjvf ../glibc-linuxthreads-2.3.2.tar.bz2
mkdir /tools/etc
touch /tools/etc/ld.so.conf
patch -Np1 -i ../glibc-2.3.2-sscanf-1.patch
mkdir ../glibc-build
cd ../glibc-build
../glibc-2.3.2/configure --prefix=/tools \
--disable-profile --enable-add-ons \
--with-headers=/tools/include \
--with-binutils=/tools/bin \
--without-gd
make
make install
make localedata/install-locales
Locking in glibc
Run this from within binutils-build:
The expected configuration for a dual i686/x86_64 system is for the
i686 libraries to be installed in /lib, and the x86_64 libraries to
be installed in /lib64. Also, the dynamic loaders have different names.
Technically, we should probably disable the 32-bit configuration completely
in the specs file, since we are not building 32-bit libraries. It does not
do any harm for this to be in the specs file as long as we do not actually
try to use it, so we leave it.
make -C ld install
SPECFILE=/tools/lib/gcc-lib/*/*/specs &&
sed -e 's@ /lib64/ld-linux-x86-64.so.2@ /tools/lib64/ld-linux-x86-64.so.2@g' \
$SPECFILE > tempspecfile &&
mv -f tempspecfile $SPECFILE &&
sed -e 's@ /lib/ld-linux.so.2@ /tools/lib/ld-linux.so.2@g' \
$SPECFILE > tempspecfile &&
mv -f tempspecfile $SPECFILE &&
unset SPECFILE
rm -f /tools/lib/gcc-lib/*/*/include/{pthread.h,bits/sigthread.h}
tcl-8.4.4
cd unix
./configure --prefix=/tools
make
make install
expect-5.39.0
patch -Np1 -i ../expect-5.39.0-spawn.patch
./configure --prefix=/tools --with-tcl=/tools/lib --with-x=no
make
make SCRIPTS="" install
DejaGnu-1.4.3
./configure --prefix=/tools
make install
gcc-3.3.1 pass 2
By default, when configured for x86_64, gcc-3.3.1 tries to support building for
both i686 and x86_64. --disable-multilib indicates that no attempt should be
made to enable support for i686.
patch -Np1 -i ../gcc-3.3.1-no_fixincludes-2.patch
patch -Np1 -i ../gcc-3.3.1-specs-2.patch
mkdir ../gcc-build
cd ../gcc-build
../gcc-3.3.1/configure --prefix=/tools \
--with-local-prefix=/tools \
--disable-multilib \
--enable-clocale=gnu --enable-shared \
--enable-threads=posix --enable-__cxa_atexit \
--enable-languages=c,c++
make
make -k check
make install
binutils-2.14, pass 2
mkdir ../binutils-build
cd ../binutils-build
../binutils-2.14/configure --prefix=/tools \
--enable-shared --with-lib-path=/tools/lib
make -j
make check
make install
make -C ld clean
make -C ld LIB_PATH=/usr/lib:/lib
gawk-3.1.3
./configure --prefix=/tools
make
make install
coreutils-5.0
./configure --prefix=/tools
make
make install
bzip2-1.0.2
make PREFIX=/tools install
gzip-1.3.5
./configure --prefix=/tools
make
make install
diffutils-2.8.1
./configure --prefix=/tools
make
make install
findutils-4.1.20
./configure --prefix=/tools
make
make install
make-3.80
./configure --prefix=/tools
make
make install
grep-2.5.1
./configure --prefix=/tools \
--disable-perl-regexp --with-included-regex
make
make install
sed-4.0.7
./configure --prefix=/tools
make
make install
gettext-0.12.1
I found that -nostdlib is needed to prevent the c++ compiler from attempting
to link two copies of part of the c runtime library.
CXXFLAGS='-nostdlib' ./configure --prefix=/tools
make -j $CC_PARALLEL
make install
ncurses-5.3
patch -Np1 -i ../ncurses-5.3-etip-2.patch
patch -Np1 -i ../ncurses-5.3-vsscanf.patch
./configure --prefix=/tools --with-shared \
--without-debug --without-ada --enable-overwrite
make
make install
patch-2.5.4
./configure --prefix=/tools
make
make install
tar-1.13.25
./configure --prefix=/tools
make
make install
texinfo-4.6
./configure --prefix=/tools
make
make install
bash-2.05b
patch -Np1 -i ../bash-2.05b-2.patch
./configure --prefix=/tools
make
make install
ln -s bash /tools/bin/sh
util-linux-2.12
cp configure configure.backup
sed "s@/usr/include@/tools/include@g" configure.backup > configure
./configure
make -C lib
make -C mount mount umount
make -C text-utils more
cp mount/{,u}mount text-utils/more /tools/bin
perl-5.8.0
patch -Np1 -i ../perl-5.8.0-libc-3.patch
chmod u+w hints/linux.sh
echo 'static_ext="IO re Fcntl"' >> hints/linux.sh
./configure.gnu --prefix=/tools
make perl utilities
cp perl pod/pod2man /tools/bin
mkdir -p /tools/lib/perl5/5.8.0
cp -R lib/* /tools/lib/perl5/5.8.0