|
发表于 2008-1-25 17:22:28
|
显示全部楼层
下面是 chroot 后的命令
------------------下面是 chroot 后的命令---------------------
( test ! -f $SRC/build.log ) && [ "`pwd`" = "$SRC" ] &&
R=/root/linux-headers-2.6.23.13/ &&
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=$R/usr &&
cp -r $R/usr/include /usr/ &&
cd $SRC && rm */ &&
echo '1-kernel-headers' >> $SRC/build.log && sync &&
R=/root/glibc-2.6.1/ && mkdir {,$R}/usr/lib/locale &&
tar -xf glibc-2.6.1.tar.bz2 && cd glibc-2.6.1 &&
sed -i 's|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=/lib/ld-linux.so.2 -o|' scripts/test-installation.pl &&
sed -r -i 's:/bin/(pwd|cat):\1:g' configure{.in,} io/ftwtest-sh stdio-common/{test-popen,xbug,tstscanf}.c &&
sed -i -e's|^rootsbindir =.*|rootsbindir=/usr/bin|' -e's|^sbindir = .*|sbindir=/usr/bin|' Makeconfig &&
sed -i 's|^sbindir=.*|sbindir=/usr/bin|' {,posix/glob/}configure &&
sed -i 's|libc_cv_rootsbindir=.*|libc_cv_rootsbindir=/usr/bin|' sysdeps/unix/sysv/linux/configure &&
find . -name configure | xargs touch &&
mkdir ../glibc-build && cd ../glibc-build &&
../glibc-2.6.1/configure --prefix=/usr --sbindir=/usr/bin --enable-add-ons=nptl --enable-shared --disable-static --disable-bind-now --disable-bounded --enable-force-install --enable-hidden-plt --enable-kernel=2.6.23 --disable-oldest-abi --enable-omitfp --disable-profile --enable-sanity-checks --enable-stackguard-randomization --disable-static-nss --with-headers=/usr/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/build_glibc.log ; make install ) &&
make install install_root=$R &&
localedef -i zh_CN -f UTF-8 zh_CN.UTF-8 && cp /usr/lib/locale/* $R/usr/lib/locale/ &&
rm {,$R}/etc/rpc {,$R}/{,usr}/lib/*_g.* {,$R}/usr/libexec/pt_chown {,$R}/usr/share/locale &&
echo 'passwd: files
group: files
shadow: files
hosts: files dns
networks: files
protocols: files
services: files
ethers: files
rpc: files' | tee {,$R}/etc/nsswitch.conf &&
cp --remove-destination /usr/share/zoneinfo/UTC /etc/localtime &&
cp --remove-destination /usr/share/zoneinfo/UTC $R/etc/localtime &&
cp /etc/{passwd,group,hosts} $R/etc/ &&
cd $SRC && rm */ &&
echo '2-glibc' >> $SRC/build.log && sync &&
mv /www/bin/{ld-new,ld} &&
gcc -dumpspecs | sed -e'/^\*link:$/{n;s@$@ -L/usr/lib@}' -e's@/www/lib/ld-linux.so.2@/lib/ld-linux.so.2@g' -e'/^\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' -e'/^\*cpp:$/{n;s@$@ -isystem /usr/include@}' > `dirname $(gcc -print-libgcc-file-name)`/specs &&
echo 'main(){}' > dummy.c && cc dummy.c -v -Wl,--verbose &> dummy.log &&
readelf -l a.out | fgrep '[Requesting program interpreter: /lib/ld-linux.so.2]' &&
fgrep 'attempt to open /usr/lib/crt1.o succeeded' dummy.log &&
fgrep 'attempt to open /usr/lib/crti.o succeeded' dummy.log &&
fgrep 'attempt to open /usr/lib/crtn.o succeeded' dummy.log &&
fgrep '#include <...> search starts here:
/usr/include
/www/include' dummy.log &&
# fgrep 'SEARCH_DIR("/www/i686-pc-linux-gnu/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");' dummy.log &&
fgrep 'attempt to open /lib/libc.so.6 succeeded' dummy.log &&
fgrep 'found ld-linux.so.2 at /lib/ld-linux.so.2' dummy.log &&
rm dummy.c a.out dummy.log &&
echo '3-adjusting' >> $SRC/build.log && sync &&
R=/root/binutils-2.18/ &&
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=/usr --sbindir=/usr/bin --with-lib-path=/lib:/usr/lib --disable-nls --disable-rpath --disable-multilib --enable-shared --disable-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=/usr/ && cp ../binutils-2.18/include/libiberty.h /usr/include/ &&
make install tooldir=/usr/ DESTDIR=$R && cp ../binutils-2.18/include/libiberty.h $R/usr/include/ &&
cd $SRC && rm */ &&
echo '5-binutils' >> $SRC/build.log && sync &&
R=/root/gcc-4.2.2/ &&
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 -e's@\./fixinc\.sh@-c true@' -e'/^LIBGCC2_DEBUG_CFLAGS/d' gcc/Makefile.in &&
sed -i '/MULTILIB_OSDIRNAMES/d' gcc/config/i386/t-linux64 &&
sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in &&
sed -i 's/@have_mktemp_command@/yes/' gcc/gccbug.in &&
# 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=/usr --sbindir=/usr/bin --with-local-prefix=/usr/local --enable-languages=c --enable-bootstrap --enable-checking=yes --enable-largefile --disable-nls --disable-rpath --disable-multilib --disable-cpp --enable-shared=libgcc --disable-static --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=/usr/bin/as --with-ld=/usr/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/build_gcc.log ; make install ) &&
make install DESTDIR=$R &&
ln -sf gcc /usr/bin/cc &&
ln -sf gcc $R/usr/bin/cc &&
INC=`gcc -print-file-name=include` &&
TOL=`gcc -print-file-name=install-tools` &&
rm {,$R}/$INC/* &&
cp $TOL/include/* $INC &&
cp $TOL/include/* $R/$INC &&
cp $TOL/gsyslimits.h $INC/syslimits.h &&
cp $TOL/gsyslimits.h $R/$INC/syslimits.h &&
unset INC TOL &&
cd $SRC && rm */ && sync &&
echo 'main(){}' > dummy.c && cc dummy.c -v -Wl,--verbose &> dummy.log &&
readelf -l a.out | fgrep '[Requesting program interpreter: /lib/ld-linux.so.2]' &&
fgrep 'attempt to open /usr/lib/gcc/i686-pc-linux-gnu/4.2.2/../../../crt1.o succeeded' dummy.log &&
fgrep 'attempt to open /usr/lib/gcc/i686-pc-linux-gnu/4.2.2/../../../crti.o succeeded' dummy.log &&
fgrep 'attempt to open /usr/lib/gcc/i686-pc-linux-gnu/4.2.2/../../../crtn.o succeeded' dummy.log &&
fgrep '#include <...> search starts here:
/usr/lib/gcc/i686-pc-linux-gnu/4.2.2/include
/usr/include
End of search list.' dummy.log &&
fgrep 'SEARCH_DIR("/usr/i686-pc-linux-gnu/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");' dummy.log &&
fgrep 'attempt to open /lib/libc.so.6 succeeded' dummy.log &&
fgrep 'found ld-linux.so.2 at /lib/ld-linux.so.2' dummy.log &&
rm dummy.c a.out dummy.log &&
echo '6-gcc' >> $SRC/build.log && sync && |
|