#!/bin/bash -e
# Linux From Scratch My Version 2.4-r1 Toolchain
WORK_DIR="$LFS/Work"
BUILD_DIR="$WORK_DIR/Build"
PKG_DIR="$WORK_DIR/Sources"
LOG_DIR="$WORK_DIR/Log/Chapter-05"
# Binutils (Pass1)
# GCC (Pass1)
# Linux API Headers
# Glibc
# Adjusting the Toolchain
# Tcl
# Expect
# Dejagnu
# GCC (Pass2)
# Binutils (Pass2)
# Ncurses
# Bash
# Bzip2
# Coreutils
# Diffutils
# E2fsprogs
# Findutils
# Gawk
# Gettext
# Grep
# Gzip
# Make
# Patch
# Perl
# Sed
# Tar
# Texinfo
# Util-linux-ng
# Stripping
# End of Toolchain.
# Linux From Scratch My Version 2.4-r1 Toolchain
- # Binutils-2.16.1
- # GCC-3.3.6
- # Linux-2.4.36.4
- # Glibc-2.3.6
- # Tcl-8.4.19
- # Expect-5.43.0
- # Dejagnu-1.4.4
- # Ncurses-5.6
- # Bash-3.2
- # Bzip2-1.0.5
- # Coreutils-6.10
- # Diffutils-2.8.1
- # E2fsprogs-1.40.9
- # Findutils-4.2.33
- # Gawk-3.1.6
- # Gettext-0.17
- # Grep-2.5.3
- # Gzip-1.3.12
- # Make-3.81
- # Patch-2.5.4
- # Perl-5.8.8
- # Sed-4.1.5
- # Tar-1.20
- # Texinfo-4.9
- # Util-linux-ng-2.13.1.1
WORK_DIR="$LFS/Work"
BUILD_DIR="$WORK_DIR/Build"
PKG_DIR="$WORK_DIR/Sources"
LOG_DIR="$WORK_DIR/Log/Chapter-05"
# Binutils (Pass1)
pkg="binutils"
ver="2.16.1"
cd $BUILD_DIR && tar jxvf $PKG_DIR/$pkg-$ver.tar.bz2
mkdir -v $pkg-build
cd $pkg-build
CC="gcc -B/usr/bin/" ../$pkg-$ver/configure --prefix=/tools
--disable-nls --disable-werror
make
make install
make -C ld clean
make -C ld LIB_PATH=/tools/lib
cp -v ld/ld-new /tools/bin
cd $BUILD_DIR && rm -rf $pkg-build $pkg-$ver && unset pkg ver
# GCC (Pass1)
pkg="gcc"
ver="3.3.6"
cd $BUILD_DIR && tar jxvf $PKG_DIR/$pkg-core-$ver.tar.bz2
mkdir -v $pkg-build
cd $pkg-build
CC="gcc -B/usr/bin/" ../$pkg-$ver/configure --prefix=/tools
--with-local-prefix=/tools --disable-nls
--enable-shared --enable-languages=c
make BOOT_LDFLAGS="-static" bootstrap
make install
ln -sv gcc /tools/bin/cc
cd $BUILD_DIR && rm -rf $pkg-build $pkg-$ver && unset pkg ver
# Linux API Headers
pkg="linux"
ver="2.4.36.4"
cd $BUILD_DIR && tar jxvf $PKG_DIR/$pkg-$ver.tar.bz2
cd $pkg-$ver
make mrproper &&
make include/linux/version.h &&
make symlinks &&
mkdir -v /tools/include/asm &&
cp -v include/asm/* /tools/include/asm &&
cp -Rv include/asm-generic /tools/include &&
cp -Rv include/linux /tools/include
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# Glibc
pkg="glibc"
ver="2.3.6"
cd $BUILD_DIR && tar jxvf $PKG_DIR/$pkg-$ver.tar.bz2
cd $pkg-$ver
tar jxvf $PKG_DIR/$pkg-linuxthreads-$ver.tar.bz2
mkdir ../$pkg-build
cd ../$pkg-build
../$pkg-$ver/configure --prefix=/tools
--disable-profile --enable-add-ons=linuxthreads
--enable-kernel=2.4.22 --with-binutils=/tools/bin
--without-gd --with-headers=/tools/include
--without-selinux
make
#make -k check | tee $LOG_DIR/$pkg-$ver-check.log
mkdir -v /tools/etc
touch /tools/etc/ld.so.conf
make install
make localedata/install-locales
cd $BUILD_DIR && rm -rf $pkg-build $pkg-$ver && unset pkg ver
# Adjusting the Toolchain
mv -v /tools/bin/{ld,ld-old}
mv -v /tools/$(gcc -dumpmachine)/bin/{ld,ld-old}
mv -v /tools/bin/{ld-new,ld}
ln -sv /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld
gcc -dumpspecs | sed 's@/lib/ld-linux.so.2@/tools&@g'
> `dirname $(gcc -print-libgcc-file-name)`/specs
GCC_INCLUDEDIR=`dirname $(gcc -print-libgcc-file-name)`/include &&
find ${GCC_INCLUDEDIR}/* -maxdepth 0 -xtype d -exec rm -rvf '{}' ; &&
rm -f `grep -l "DO NOT EDIT THIS FILE" ${GCC_INCLUDEDIR}/*` &&
unset GCC_INCLUDEDIR
# Tcl
pkg="tcl"
ver="8.4.19"
cd $BUILD_DIR && tar zxvf $PKG_DIR/$pkg$ver-src.tar.gz
cd $pkg$ver/unix
./configure --prefix=/tools
make
make install
make install-private-headers
ln -sv tclsh8.4 /tools/bin/tclsh
cd $BUILD_DIR && rm -rf $pkg$ver && unset pkg ver
# Expect
pkg="expect"
ver="5.43.0"
cd $BUILD_DIR && tar jxvf $PKG_DIR/$pkg-$ver.tar.bz2
cd $pkg-5.43
patch -Np1 -i $PKG_DIR/$pkg-$ver-spawn-1.patch
#patch -Np1 -i $PKG_DIR/$pkg-$ver-spawn-2.patch <- This patch fail
cp configure{,.bak}
sed 's:/usr/local/bin:/bin:' configure.bak > configure
./configure --prefix=/tools
--with-tcl=/tools/lib --with-tclinclude=/tools/include --with-x=no
make
make SCRIPTS="" install
cd $BUILD_DIR && rm -rf $pkg-5.43 && unset pkg ver
# Dejagnu
pkg="dejagnu"
ver="1.4.4"
cd $BUILD_DIR && tar zxvf $PKG_DIR/$pkg-$ver.tar.gz
cd $pkg-$ver
./configure --prefix=/tools
make install
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# GCC (Pass2)
pkg="gcc"
ver="3.3.6"
cd $BUILD_DIR && tar jxvf $PKG_DIR/$pkg-core-$ver.tar.bz2
tar jxvf $PKG_DIR/$pkg-g++-$ver.tar.bz2
tar jxvf $PKG_DIR/$pkg-testsuite-$ver.tar.bz2
cd $pkg-$ver
patch -Np1 -i $PKG_DIR/$pkg-$ver-no_fixincludes-1.patch
for file in $(find gcc/config -name linux64.h
-o -name linux.h
-o -name linux-elf.h
-o -name gnu.h
-o -name pa-linux.h
-o -name sysv4.h); do
cp -uv $file{,.orig}
sed -e 's@/lib(64)?(32)?/ld@/tools&@g'
-e 's@/usr@/tools@g' $file.orig > $file
echo "
#undef STANDARD_INCLUDE_DIR
#define STANDARD_INCLUDE_DIR 0" >> $file
touch $file.orig;
done
mkdir ../$pkg-build
cd ../$pkg-build
../$pkg-$ver/configure --prefix=/tools
--with-local-prefix=/tools
--enable-clocale=gnu --enable-shared
--enable-threads=posix --enable-__cxa_atexit
--enable-languages=c,c++
make
#make -k check 2>&1 | tee $LOG_DIR/$pkg-$ver-check.log
make install
cd $BUILD_DIR && rm -rf $pkg-build $pkg-$ver && unset pkg ver
# Binutils (Pass2)
pkg="binutils"
ver="2.16.1"
cd $BUILD_DIR && tar jxvf $PKG_DIR/$pkg-$ver.tar.bz2
mkdir $pkg-build
cd $pkg-build
../$pkg-$ver/configure --prefix=/tools
--disable-nls --with-lib-path=/tools/lib
make
#make -k check 2>&1 | tee $LOG_DIR/$pkg-$ver-check.log
make install
make -C ld clean
make -C ld LIB_PATH=/usr/lib:/lib
cp -v ld/ld-new /tools/bin
cd $BUILD_DIR && rm -rf $pkg-build $pkg-$ver && unset pkg ver
# Ncurses
pkg="ncurses"
ver="5.6"
cd $BUILD_DIR && tar zxvf $PKG_DIR/$pkg-$ver.tar.gz
cd $pkg-$ver
./configure --prefix=/tools
--with-shared --without-debug --without-ada --enable-overwrite
make
make install
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# Bash
pkg="bash"
ver="3.2"
cd $BUILD_DIR && tar zxvf $PKG_DIR/$pkg-$ver.tar.gz
cd $pkg-$ver
patch -Np1 -i $PKG_DIR/$pkg-$ver-fixes-7.patch
./configure --prefix=/tools
--without-bash-malloc
make
#make tests 2>&1 | tee $LOG_DIR/$pkg-$ver-check.log
make install
ln -vs bash /tools/bin/sh
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# Bzip2
pkg="bzip2"
ver="1.0.5"
cd $BUILD_DIR && tar zxvf $PKG_DIR/$pkg-$ver.tar.gz
cd $pkg-$ver
make
make PREFIX=/tools install
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# Coreutils
pkg="coreutils"
ver="6.10"
cd $BUILD_DIR && tar zxvf $PKG_DIR/$pkg-$ver.tar.gz
cd $pkg-$ver
./configure --prefix=/tools
make
#make RUN_EXPENSIVE_TESTS=yes check 2>&1 | tee $LOG_DIR/$pkg-$ver-check.log
make install
cp -v src/su /tools/bin/su-tools
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# Diffutils
pkg="diffutils"
ver="2.8.1"
cd $BUILD_DIR && tar zxvf $PKG_DIR/$pkg-$ver.tar.gz
cd $pkg-$ver
./configure --prefix=/tools
make
make install
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# E2fsprogs
pkg="e2fsprogs"
ver="1.40.9"
cd $BUILD_DIR && tar zxvf $PKG_DIR/$pkg-$ver.tar.gz
mkdir $pkg-$ver/build
cd $pkg-$ver/build
../configure --prefix=/tools
make
make install-libs
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# Findutils
pkg="findutils"
ver="4.2.33"
cd $BUILD_DIR && tar zxvf $PKG_DIR/$pkg-$ver.tar.gz
cd $pkg-$ver
./configure --prefix=/tools
make
#make check 2>&1 | tee $LOG_DIR/$pkg-$ver-check.log
make install
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# Gawk
pkg="gawk"
ver="3.1.6"
cd $BUILD_DIR && tar jxvf $PKG_DIR/$pkg-$ver.tar.bz2
cd $pkg-$ver
./configure --prefix=/tools
make
#make check 2>&1 | tee $LOG_DIR/$pkg-$ver-check.log
make install
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# Gettext
pkg="gettext"
ver="0.17"
cd $BUILD_DIR && tar zxvf $PKG_DIR/$pkg-$ver.tar.gz
cd $pkg-$ver/gettext-tools
./configure --prefix=/tools
--disable-shared
make -C gnulib-lib
make -C src msgfmt
cp -v src/msgfmt /tools/bin
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# Grep
pkg="grep"
ver="2.5.3"
cd $BUILD_DIR && tar jxvf $PKG_DIR/$pkg-$ver.tar.bz2
cd $pkg-$ver
./configure --prefix=/tools
--disable-perl-regexp
make
#make check 2>&1 | tee $LOG_DIR/$pkg-$ver-check.log
make install
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# Gzip
pkg="gzip"
ver="1.3.12"
cd $BUILD_DIR && tar zxvf $PKG_DIR/$pkg-$ver.tar.gz
cd $pkg-$ver
./configure --prefix=/tools
make
#make check 2>&1 | tee $LOG_DIR/$pkg-$ver-check.log
make install
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# Make
pkg="make"
ver="3.81"
cd $BUILD_DIR && tar jxvf $PKG_DIR/$pkg-$ver.tar.bz2
cd $pkg-$ver
./configure --prefix=/tools
make
#make check 2>&1 | tee $LOG_DIR/$pkg-$ver-check.log
make install
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# Patch
pkg="patch"
ver="2.5.4"
cd $BUILD_DIR && tar zxvf $PKG_DIR/$pkg-$ver.tar.gz
cd $pkg-$ver
./configure --prefix=/tools
make
make install
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# Perl
pkg="perl"
ver="5.8.8"
cd $BUILD_DIR && tar jxvf $PKG_DIR/$pkg-$ver.tar.bz2
cd $pkg-$ver
patch -Np1 -i $PKG_DIR/$pkg-$ver-libc-2.patch
./configure.gnu --prefix=/tools
-Dstatic_ext='Data/Dumper Fcntl IO POSIX'
make perl utilities
#make test 2>&1 | tee $LOG_DIR/$pkg-$ver-check.log
cp -v perl pod/pod2man /tools/bin
mkdir -pv /tools/lib/perl5/5.8.8
cp -Rv lib/* /tools/lib/perl5/5.8.8
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# Sed
pkg="sed"
ver="4.1.5"
cd $BUILD_DIR && tar zxvf $PKG_DIR/$pkg-$ver.tar.gz
cd $pkg-$ver
./configure --prefix=/tools
make
#make check 2>&1 | tee $LOG_DIR/$pkg-$ver-check.log
make install
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# Tar
pkg="tar"
ver="1.20"
cd $BUILD_DIR && tar jxvf $PKG_DIR/$pkg-$ver.tar.bz2
cd $pkg-$ver
./configure --prefix=/tools
make
#make check 2>&1 | tee $LOG_DIR/$pkg-$ver-check.log
make install
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# Texinfo
pkg="texinfo"
ver="4.9"
cd $BUILD_DIR && tar jxvf $PKG_DIR/$pkg-$ver.tar.bz2
cd $pkg-$ver
./configure --prefix=/tools
make
#make check 2>&1 | tee $LOG_DIR/$pkg-$ver-check.log
make install
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# Util-linux-ng
pkg="util-linux-ng"
ver="2.13.1.1"
cd $BUILD_DIR && tar jxvf $PKG_DIR/$pkg-$ver.tar.bz2
cd $pkg-$ver
./configure --prefix=/tools
make -C mount mount umount
make -C text-utils more
#make check 2>&1 | tee $LOG_DIR/$pkg-$ver-check.log
cp -v mount/{,u}mount text-utils/more /tools/bin
cd $BUILD_DIR && rm -rf $pkg-$ver && unset pkg ver
# Stripping
strip --strip-debug /tools/lib/*
strip --strip-unneeded /tools/{,s}bin/*
rm -rf /tools/{info,man}
# End of Toolchain.
コメント
コメントを投稿