ºÜ¼¤¶¯ÈËÐĵÄÏûÏ¢£¬ËäÈ»Î񼆾ûʱ¼ä²Î¼Ó¿ª·¢£¬µ«ÊÇ¿´×ÅÕâ¸ö¹¤¾ßÁ´µÄÖÆ×÷£¬ÓÐЩ¹ýÓÚ LFS »¯ÁË¡£
СµÜ²»²Å£¬ÌṩÁ½·ÝÖÆ×÷¹¤¾ßÁ´Ê±¿ÉÄÜÐèÒªÓõ½µÄ²Î¿¼×ÊÁÏ£º
Glibc GCC Binutils °²×°Ö¸ÄÏ
GCC±àÒëÓÅ»¯Ö¸ÄÏ
½¨Òé ML ¾ÍÒªÓÐ ML µÄÌØµã£¬¾¡Á¿´òÔì³ö¸ßЧÄܵŤ¾ßÁ´¡£
ÏÂÃæÊÇÎÒÔÚ×ö LFS ʱ±àÒ빤¾ßÁ´µÄÏà¹ØÃüÁ½ö¹©²Î¿¼[ÎÒûÓа²×°C++±àÒëÆ÷]£º
export LFS=$LFS
export SRC=$LFS/data
export PATH=/www/bin:/bin:/usr/bin
export LC_ALL=C TZ=UTC
export CFLAGS='-DNDEBUG -O3 -fomit-frame-pointer -pipe -fno-bounds-check -freg-struct-return -march=athlon-xp -maccumulate-outgoing-args -fmerge-all-constants -finline-limit=300'
export LDFLAGS='-s -Wl,-O1,-s'
alias make='make -j1' mkdir='mkdir -p' patch='patch -p1 -i' mv='mv -f' cp='cp -pf' rm='rm -fr'
( test ! -f $SRC/tmp.log ) && [ "`pwd`" = "$SRC" ] &&
tar -xf binutils-2.18.tar.bz2 && mkdir binutils-build && cd binutils-build &&
echo 'MAKEINFO = :' >> ../binutils-2.18/Makefile.in &&
CFLAGS="-O2 -fomit-frame-pointer -pipe -march=athlon-xp" LDFLAGS="-s" \
../binutils-2.18/configure --prefix=/www --disable-nls --disable-rpath --disable-multilib --disable-shared --enable-static --disable-64-bit-bfd --disable-cgen-maint --disable-libada --disable-libgcc-math --disable-libgcj --disable-libssp --disable-objc-gc --disable-werror --with-gnu-ld --without-gmp --without-mpfr --without-included-gettext --without-libiconv-prefix --without-libintl-prefix --with-pic &&
make all install tooldir=/www/ && cp ../binutils-2.18/include/libiberty.h /www/include &&
make clean-ld all-ld LIB_PATH=/www/lib CC="gcc -B/www/bin/" tooldir=/www/ && cp ld/ld-new /www/bin/ &&
cd $SRC && rm */ &&
echo '1-binutils-pass1' >> $SRC/tmp.log && sync &&
tar -xf gcc-core-4.2.2.tar.bz2 && mkdir gcc-build && cd gcc-build &&
sed -r -i 's|^LDFLAGS(_FOR_TARGET)? =|& @LDFLAGS@|' ../gcc-4.2.2/Makefile.in &&
sed -i 's/install_to_$(INSTALL_DEST) //' ../gcc-4.2.2/libiberty/Makefile.in &&
sed -i -e's@\./fixinc\.sh@-c true@' -e'/^LIBGCC2_DEBUG_CFLAGS/d' ../gcc-4.2.2/gcc/Makefile.in &&
sed -i '/MULTILIB_OSDIRNAMES/d' ../gcc-4.2.2/gcc/config/i386/t-linux64 &&
CC="gcc -B/www/bin/" CFLAGS="-O2 -fomit-frame-pointer -pipe -march=athlon-xp" LDFLAGS="-s" \
../gcc-4.2.2/configure --prefix=/www --with-local-prefix=/www --enable-languages=c --enable-bootstrap --enable-checking=yes --enable-largefile --disable-nls --disable-rpath --disable-multilib --disable-cpp --enable-shared=libgcc --enable-static=libgcc --disable-libada --disable-libgcj --disable-libgomp --disable-libmudflap --disable-libssp --disable-decimal-float --disable-install-libiberty --enable-linux-futex --enable-threads=posix --enable-tls --disable-symvers --with-arch=athlon-xp --with-long-double-128 --with-gnu-as --with-gnu-ld --with-as=/www/bin/as --with-ld=/www/bin/ld --without-included-gettext --without-libiconv-prefix --without-libintl-prefix --without-gmp --without-mpfr --without-system-libunwind --without-system-zlib --with-pic --without-x &&
make bootstrap4 install LIBCFLAGS="-O2 -fomit-frame-pointer -pipe -march=athlon-xp" BOOT_CFLAGS="-O2 -fomit-frame-pointer -pipe -march=athlon-xp" BOOT_LDFLAGS="-s" &&
ln -sf gcc /www/bin/cc &&
INC=`gcc -print-file-name=include` &&
TOL=`gcc -print-file-name=install-tools` &&
rm $INC/* &&
cp $TOL/include/* $INC &&
cp $TOL/gsyslimits.h $INC/syslimits.h &&
unset INC TOL &&
cd $SRC && rm */ &&
echo '2-gcc-pass1' >> $SRC/tmp.log && sync &&
tar -xf linux-2.6.23.13.tar.bz2 && cd linux-2.6.23.13 &&
sed -i '/scsi/d' include/Kbuild &&
make distclean && make headers_check ARCH=i386 &&
make headers_install ARCH=i386 INSTALL_HDR_PATH=temp &&
cp -r temp/include/* /www/include/ &&
cd $SRC && rm */ &&
echo '3-kernel-headers' >> $SRC/tmp.log && sync &&
tar -xf glibc-2.6.1.tar.bz2 && mkdir glibc-build && cd glibc-build &&
find .. -name configure | xargs touch &&
LDFLAGS="`echo $LDFLAGS | sed 's/,--hash-style=gnu//'`" \
../glibc-2.6.1/configure --prefix=/www --enable-add-ons=nptl --enable-shared --disable-static --disable-bind-now --disable-bounded --enable-force-install --enable-hidden-plt --enable-kernel=2.6.22 --disable-oldest-abi --enable-omitfp --disable-profile --enable-sanity-checks --enable-stackguard-randomization --disable-static-nss --with-headers=/www/include --with-binutils=/www/bin --without-cvs --with-elf --without-gd --without-gmp --without-selinux --with-fp --with-tls &&
make && ( make -k check 2> $SRC/tmp_glibc.log ; make install ) &&
rm /www/lib/*_g.* &&
cp --remove-destination /www/share/zoneinfo/UTC /www/etc/localtime &&
cd $SRC && rm */ &&
echo '4-glibc' >> $SRC/tmp.log && sync &&
mv /www/bin/{ld-new,ld} &&
gcc -dumpspecs | sed 's@/lib/ld-linux.so.2@/www/lib/ld-linux.so.2@g' > `dirname $(gcc -print-libgcc-file-name)`/specs &&
echo 'main(){}' > dummy.c && cc dummy.c && readelf -l a.out | fgrep '[Requesting program interpreter: /www/lib/ld-linux.so.2]' && rm dummy.c a.out &&
echo '5-Adjusting' >> $SRC/tmp.log && sync &&
tar -xf tcl8.4.16-src.tar.gz && cd tcl8.4.16/unix &&
./configure --prefix=/www --enable-threads --enable-shared --enable-load --enable-gcc --disable-symbols --disable-64bit --disable-64bit-vis --disable-langinfo --disable-corefoundation --disable-dtrace --disable-framework --disable-man-symlinks --disable-man-compression --disable-man-suffix &&
make && make install install-private-headers &&
ln -sf tclsh8.4 /www/bin/tclsh &&
cd $SRC && rm */ && sync &&
tar -xf expect-5.43.0.tar.bz2 && cd expect-5.43 &&
patch $SRC/expect-5.43.0-spawn-2.patch &&
sed -i 's/STTY_BIN=.*/STTY_BIN=stty/g' configure{.in,} &&
./configure --prefix=/www --enable-threads --enable-shared --enable-load --enable-gcc --with-tcl=/www/lib --with-tclinclude=/www/include --with-x=no --disable-symbols &&
make expect && make install SCRIPTS="" &&
cd $SRC && rm */ && sync &&
tar -xf dejagnu-1.4.4.tar.gz && cd dejagnu-1.4.4 &&
./configure --prefix=/www &&
make install &&
cd $SRC && rm */ &&
echo '6-tcl-expect-dejagnu' >> $SRC/tmp.log && sync &&
tar -xf gcc-core-4.2.2.tar.bz2 && tar -xf gcc-testsuite-4.2.2.tar.bz2 && cd gcc-4.2.2 &&
sed -r -i 's|^LDFLAGS(_FOR_TARGET)? =|& @LDFLAGS@|' Makefile.in &&
sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in &&
sed -i -e's@\./fixinc\.sh@-c true@' -e'/^LIBGCC2_DEBUG_CFLAGS/d' gcc/Makefile.in &&
sed -i '/MULTILIB_OSDIRNAMES/d' gcc/config/i386/t-linux64 &&
echo '/* Remove /usr/include from end of include search path. */
#undef STANDARD_INCLUDE_DIR
#define STANDARD_INCLUDE_DIR 0' | tee -a gcc/config/linux.h gcc/config/i386/linux{,64}.h &&
sed -i 's@/lib/ld.so@/www&@g' gcc/config/i386/gnu.h &&
sed -i 's@/lib/ld-linux.so.2@/www&@g' gcc/config/i386/linux{,64}.h &&
sed -i 's@/lib64/ld-linux-x86-64.so.2@/www&@g' gcc/config/i386/linux64.h &&
# sed -i '/LINK_SPEC/s/ "/&--hash-style=gnu /' gcc/config/i386/linux{,64}.h &&
mkdir ../gcc-build && cd ../gcc-build &&
../gcc-4.2.2/configure --prefix=/www --with-local-prefix=/www --enable-languages=c --enable-bootstrap --enable-checking=yes --enable-largefile --disable-nls --disable-rpath --disable-multilib --disable-cpp --enable-shared=libgcc --enable-static=libgcc --disable-libada --disable-libgcj --disable-libgomp --disable-libmudflap --disable-libssp --disable-decimal-float --disable-install-libiberty --enable-linux-futex --enable-threads=posix --enable-tls --disable-symvers --with-arch=athlon-xp --with-long-double-128 --with-gnu-as --with-gnu-ld --with-as=/www/bin/as --with-ld=/www/bin/ld --without-included-gettext --without-libiconv-prefix --without-libintl-prefix --without-gmp --without-mpfr --without-system-libunwind --without-system-zlib --with-pic --without-x &&
make profiledbootstrap LIBCFLAGS="$CFLAGS" BOOT_CFLAGS="$CFLAGS" BOOT_LDFLAGS="$LDFLAGS" &&
( make -k check | tee $SRC/tmp_gcc.log ; make install ) &&
INC=`gcc -print-file-name=include` &&
TOL=`gcc -print-file-name=install-tools` &&
rm $INC/* &&
cp $TOL/include/* $INC &&
cp $TOL/gsyslimits.h $INC/syslimits.h &&
unset INC TOL &&
cd $SRC && rm */ && sync &&
echo 'main(){}' > dummy.c && cc dummy.c && readelf -l a.out | fgrep '[Requesting program interpreter: /www/lib/ld-linux.so.2]' && rm dummy.c a.out &&
echo '7-gcc-pass2' >> $SRC/tmp.log && sync &&
tar -xf binutils-2.18.tar.bz2 && mkdir binutils-build && cd binutils-build &&
echo 'MAKEINFO = :' >> ../binutils-2.18/Makefile.in &&
CFLAGS="$CFLAGS -fno-inline-functions" \
../binutils-2.18/configure --prefix=/www --with-lib-path=/www/lib --disable-nls --disable-rpath --disable-multilib --disable-shared --enable-static --disable-64-bit-bfd --disable-cgen-maint --disable-libada --disable-libgcc-math --disable-libgcj --disable-libssp --disable-objc-gc --disable-werror --with-gnu-ld --without-gmp --without-mpfr --without-included-gettext --without-libiconv-prefix --without-libintl-prefix --with-pic &&
make all check install tooldir=/www/ &&
make clean-ld all-ld check-ld LIB_PATH=/lib:/usr/lib tooldir=/www/ && cp ld/ld-new /www/bin/ &&
cp ../binutils-2.18/include/libiberty.h /www/include/ &&
cd $SRC && rm */ &&
echo '8-binutils-pass2' >> $SRC/tmp.log && sync &&