Linux From Scratch / 5. 準備 2



準備が終わったら、次はLFSを作るための環境作りです。

Binutils のインストール - 第 1 段階

cd $LFS/sources
tar jxf binutils-2.14.tar.bz2
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 のインストール 第1段階

cd $LFS/sources
tar jxf gcc-core-3.3.3.tar.bz2
tar jxf gcc-g++-3.3.3.tar.bz2
tar jxf gcc-testsuite-3.3.3.tar.bz2
mkdir gcc-build
cd gcc-build
../gcc-3.3.3/configure --prefix=/tools \
--with-local-prefix=/tools \
--disable-nls --enable-shared \
--enable-languages=c
make BOOT_LDFLAGS="-static" bootstrap
make install
ln -sf gcc /tools/bin/cc
cd ..
rm -rf gcc-build

Linux headers のインストール

tar jxvf linux-2.4.26.tar.bz2
cd linux-2.4.26
make mrproper
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
cd ..
rm -rf linux-2.4.26

Glibc のインストール

mkdir /tools/etc
touch /tools/etc/ld.so.conf
cd $LFS/sources
tar jxvf glibc-2.3.3-lfs-5.1.tar.bz2
mkdir glibc-build
cd glibc-build
../glibc-2.3.3-lfs-5.1/configure --prefix=/tools \
--disable-profile --enable-add-ons=linuxthreads \
--with-binutils=/tools/bin --with-headers=/tools/include \
--without-gd --without-cvs
make
make check
make install
make localedata/install-locales

Glibc の"閉じ込め"

cd $LFS/sources/binutils-build
make -C ld install
cd ..
SPECFILE=/tools/lib/gcc-lib/*/*/specs &&
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}
rm -rf binutils-build
rm -rf binutils-2.14
rm -rf glibc-build
rm -rf glibc-2.3.3-lfs-5.1

TCL のインストール

cd $LFS/sources
tar zxvf tcl8.4.6-src.tar.gz
cd tcl8.4.6/unix
./configure --prefix=/tools
make;make install
ln -s tclsh8.4 /tools/bin/tclsh

Expect のインストール

tar zxf expect.tar.gz
cd expect-5.40
patch -Np1 -i ../expect-5.40.0-spawn.patch
./configure --prefix=/tools --with-tcl=/tools/lib --with-x=no
make
make test
make SCRIPTS="" install
cd ..
rm -rf tcl8.4.6
rm -rf expect-5.40

DejaGNU のインストール

tar zxf dejagnu-1.4.4.tar.gz
cd dejagnu-1.4.4
./configure --prefix=/tools
make
make install
cd ..
rm -rf dejagnu-1.4.4

GCC のインストール pass 2

cd gcc-3.3.2
patch -Np1 -i ../gcc-3.3.2-no_fixincludes-1.patch
patch -Np1 -i ../gcc-3.3.2-specs-1.patch
mkdir ../gcc-build
cd ../gcc-build
../gcc-3.3.2/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
make install
cd ..
rm -rf gcc-3.3.2
rm -rf gcc-build

Binutils のインストール pass 2

tar jxf binutils-2.14.tar.bz2
cd binutils-2.14
mkdir ../binutils-build
cd ../binutils-build
../binutils-2.14/configure --prefix=/tools \
 --enable-shared --with-lib-path=/tools/lib
make
make check
make install
make -C ld clean
make -C ld LIB_PATH=/usr/lib:/lib
cd ..

Gawk のインストール

tar jxf gawk-3.1.3.tar.bz2
cd gawk-3.1.3
patch -Np1 -i ../gawk-3.1.3-libexecdir.patch
./configure --prefix=/tools
make
make install
cd ..
rm -rf gawk-3.1.3

Coreutils のインストール

tar jxf coreutils-5.0.tar.bz2
cd coreutils-5.0
patch -Np1 -i ../coreutils-5.0-hostname-2.patch
patch -Np1 -i ../coreutils-5.0-posixver-2.patch
patch -Np1 -i ../coreutils-5.0-uname.patch
./configure --prefix=/tools
make
make RUN_EXPENSIVE_TESTS=yes check
make install
cd ..
rm -rf coreutils-5.0

Bzip2 のインストール

tar zxf bzip2-1.0.2.tar.gz
cd bzip2-1.0.2
make PREFIX=/tools install
cd ..
rm -rf bzip2-1.0.2

Gzip のインストール

tar zxf gzip-1.3.5.tar.gz
cd gzip-1.3.5
./configure --prefix=/tools
make
make install
cd ..
rm -rf gzip-1.3.5

Diffutils のインストール

tar zxf diffutils-2.8.1.tar.gz
cd diffutils-2.8.1
./configure --prefix=/tools
make
make install
cd ..
rm -rf diffutils-2.8.1

Findutils のインストール

tar zxf findutils-4.1.20.tar.gz
cd findutils-4.1.20
./configure --prefix=/tools
make
make check
make install
cd ..
rm -rf findutils-4.1.20

Make のインストール

tar jxf make-3.80.tar.bz2
cd make-3.80
./configure --prefix=/tools
make
make check
make install
cd ..
rm -rf make-3.80

Grep のインストール

tar jxf grep-2.5.tar.bz2
cd grep-2.5
LDFLAGS="-static" CPPFLAGS=-Dre_max_failures=re_max_failures2 \
 ./configure --prefix=/tools --disable-nls \
 --disable-perl-regexp
make
make install
cd ..
rm -rf grep-2.5

Sed のインストール

tar zxf sed-4.0.9.tar.gz
cd sed-4.0.9
./configure --prefix=/tools
make
make check
make install
cd ..
rm -rf sed-4.0.9

Gettext のインストール

tar zxf gettext-0.14.1.tar.gz
cd gettext-0.14.1
./configure --prefix=/tools
make
make check
make install
cd ..
rm -rf gettext-0.14.1

Ncurses のインストール

tar zxf ncurses-5.4.tar.gz
cd ncurses-5.4
./configure --prefix=/tools --with-shared \
 --without-debug --without-ada --enable-overwrite
make
make install
cd ..
rm -rf ncurses-5.4

Patch のインストール

tar zxf patch-2.5.4.tar.gz
cd patch-2.5.4
CPPFLAGS=-D_GNU_SOURCE ./configure --prefix=/tools
make
make install
cd ..
rm -rf patch-2.5.4

Tar のインストール

tar zxf tar-1.13.25.tar.gz
cd tar-1.13.25
./configure --prefix=/tools
make
make check
make install
cd ..
rm -rf tar-1.13.25

Texinfo のインストール

tar jxf texinfo-4.6.tar.bz2
cd texinfo-4.6
./configure --prefix=/tools
make
make check
make install
cd ..
rm -rf texinfo-4.6

Bash のインストール

tar zxf bash-2.05b.tar.gz
cd bash-2.05b
patch -Np1 -i ../bash-2.05b-2.patch
./configure --prefix=/tools
make
make tests
make install
ln -s bash /tools/bin/sh
cd ..
rm -rf bash-2.05b

Util-linux のインストール

tar zxf util-linux-2.12.tar.gz
cd 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
cd ..
rm -rf util-linux-2.12

Perl のインストール

tar zxf perl-5.8.3.tar.gz
cd perl-5.8.3
patch -Np1 -i ../perl-5.8.3-libc-1.patch
./configure.gnu --prefix=/tools -Dstatic_ext='IO Fcntl'
make perl utilities
cp perl pod/pod2man /tools/bin
mkdir -p /tools/lib/perl5/5.8.3
cp -R lib/* /tools/lib/perl5/5.8.3
cd ..
rm -rf perl-5.8.3

デバッグ情報の削除

strip --strip-unneeded /tools/{,s}bin/*
strip --strip-debug /tools/lib/*
rm -rf /tools/{,share/}{doc,info,man}