準備が終わったら、次はLFSを作るための環境作りです。
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
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
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
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
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
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
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
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
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
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 ..
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
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
tar zxf bzip2-1.0.2.tar.gz cd bzip2-1.0.2 make PREFIX=/tools install cd .. rm -rf bzip2-1.0.2
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
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
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
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
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
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
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
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
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 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
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
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
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
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}