首页 > 系统 > Linux > 正文

从头开始构建LINUX [LFS 脚本]

2024-06-28 13:24:02
字体:
来源:转载
供稿:网友
从头开始构建linux [LFS 脚本]

脚本共享在这 http://pan.baidu.com/s/1nt6yiH7

version-check.sh : 这个是检查HOST机器的软件依赖情况

host-dep.sh:针对Ubuntu10_64的缺少的包的安装【开发环境已安装】

comp.sh:LFS7.5的图书大量的编译代码的整理脚本 ,可参数运行,如 ./comp.sh -s=5.1表示对应章节的执行步骤

如下是comp.sh的内容

#!/bin/bash

:<<EOF安装依赖的包在这些独立的文件中,不用独立下载ftp://ftp.lfs-matrix.net/pub/lfs/lfs-packages/lfs-packages-7.5.tarhttp://ftp.lfs-matrix.net/pub/lfs/lfs-packages/lfs-packages-7.5.tarEOF

export LFS=/mnt/lfs#虚机上make并发存在死机的情况,不用#export MAKEFLAGS="-j 2"

STEP=1for i in "$@"do case $i in -s=*|--step=*) STEP="${i#*=}" shift ;; esacdone;

#chap2if [[ $STEP = "2" ]]; thenmkdir -pv $LFSmount -v -t ext4 /dev/sdb1 $LFS

/sbin/swapon -v /dev/sdb2#Add to /etc/fstab #/dev/sdb1 /mnt/lfs ext4 defaults 0 0fi

#chap3if [[ $STEP = "3" ]]; thenmkdir -v $LFS/sourceschmod -v a+wt $LFS/sources

pushd $LFS/sources #wget -i wget-list -P $LFS/sourcespopdfi

#chap4if [[ $STEP = "4" ]]; thenmkdir -v $LFS/toolsln -sv $LFS/tools /

groupadd lfsuseradd -s /bin/bash -g lfs -m -k /dev/null lfspasswd lfs

su - lfsfi

if [[ $STEP = "4.1" ]]; thenchown -v lfs $LFS/toolschown -v lfs $LFS/sourcescat > ~/.bash_PRofile << "EOF"exec env -i HOME=$HOME TERM=$TERM PS1='/u:/w/$ ' /bin/bashEOFcat > ~/.bashrc << "EOF"set +humask 022LFS=/mnt/lfsLC_ALL=POSIXLFS_TGT=$(uname -m)-lfs-linux-gnuPATH=/tools/bin:/bin:/usr/binexport LFS LC_ALL LFS_TGT PATHEOF

#source ~/.bash_profilefi

<<EOF!USE lfs usera. Using the tar program, extract the package to be built. In Chapter 5, ensure you are the lfs userwhen extracting the package.b. Change to the directory created when the package was extracted.c. Follow the book's instructions for building the package.d. Change back to the sources directory.e. Delete the extracted source directory and any <package>-build directories that were createdin the build process unless instructed otherwise.EOF#chap5if [[ $STEP = "5" ]]; then case $(uname -m) in x86_64) mkdir -v /tools/lib && ln -sv lib /tools/lib64 ;; esacfi

#Binutils#-----------------pushd $LFS/sourcesif [[ $STEP = "5.1" ]]; thentar xjf binutils-2.24.tar.bz2mkdir -v binutils-buildpushd binutils-build../binutils-2.24/configure / --prefix=/tools / --with-sysroot=$LFS / --with-lib-path=/tools/lib / --target=$LFS_TGT / --disable-nls / --disable-werrormakemake installpopdfi#GCCif [[ $STEP = "5.2" ]]; then tar xjf gcc-4.8.2.tar.bz2 #configure cd gcc-4.8.2tar -Jxf ../mpfr-3.1.2.tar.xzmv -v mpfr-3.1.2 mpfrtar -Jxf ../gmp-5.1.3.tar.xzmv -v gmp-5.1.3 gmptar -zxf ../mpc-1.0.2.tar.gzmv -v mpc-1.0.2 mpcfor file in / $(find gcc/config -name linux64.h -o -name 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_STARTFILE_PREFIX_1#undef STANDARD_STARTFILE_PREFIX_2#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file touch $file.origdone

sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configurecd .. #buildmkdir -v gcc-buildcd gcc-build

../gcc-4.8.2/configure / --target=$LFS_TGT / --prefix=/tools / --with-sysroot=$LFS / --with-newlib / --without-headers / --with-local-prefix=/tools / --with-native-system-header-dir=/tools/include / --disable-nls / --disable-shared / --disable-multilib / --disable-decimal-float / --disable-threads / --disable-libatomic / --disable-libgomp / --disable-libitm / --disable-libmudflap / --disable-libquadmath / --disable-libsanitizer / --disable-libssp / --disable-libstdc++-v3 / --enable-languages=c,c++ / --with-mpfr-include=$(pwd)../gcc-4.8.2/mpfr/src / --with-mpfr-lib=$(pwd)/mpfr/src/.libsmake #-jmake installln -sv libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | sed 's/libgcc/&_eh/'`cd ..

fi#LINUX HEADERif [[ $STEP = "5.3" ]]; then tar xf linux-3.13.3.tar.xz cd linux-3.13.3 make mrproper make headers_check make INSTALL_HDR_PATH=dest headers_install cp -rv dest/include/* /tools/include cd ..fi#GLIBCif [[ $STEP = "5.4" ]]; then tar xf glibc-2.19.tar.xz cd glibc-2.19 if [ ! -r /usr/include/rpc/types.h ]; then su -c 'mkdir -pv /usr/include/rpc' su -c 'cp -v sunrpc/rpc/*.h /usr/include/rpc' fi cd .. mkdir -v glibc-build cd glibc-build../glibc-2.19/configure / --prefix=/tools / --host=$LFS_TGT / --build=$(../glibc-2.19/scripts/config.guess) / --disable-profile / --enable-kernel=2.6.32 / --with-headers=/tools/include / libc_cv_forced_unwind=yes / libc_cv_ctors_header=yes / libc_cv_c_cleanup=yes make make install cd ..

fi#libstdc++ [of gcc]if [[ $STEP = "5.5" ]]; then cd gcc-build ../gcc-4.8.2/libstdc++-v3/configure / --host=$LFS_TGT / --prefix=/tools / --disable-multilib / --disable-shared / --disable-nls / --disable-libstdcxx-threads / --disable-libstdcxx-pch / --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/4.8.2 make make install cd ..fi#Binutils-2.24 - Pass 2if [[ $STEP = "5.9" ]]; thenrm -rf binutils-buildrm -rf binutils-2.24tar xjf binutils-2.24.tar.bz2mkdir -v binutils-buildcd binutils-buildCC=$LFS_TGT-gcc /AR=$LFS_TGT-ar /RANLIB=$LFS_TGT-ranlib /../binutils-2.24/configure / --prefix=/tools / --disable-nls / --with-lib-path=/tools/lib / --with-sysroot

makemake install# prepare the linker for the “Re-adjusting” phase in make -C ld cleanmake -C ld LIB_PATH=/usr/lib:/libcp -v ld/ld-new /tools/bincd ..fi#GCC-4.8.2 - Pass 2if [[ $STEP = "5.10" ]]; then rm -rf gcc-4.8.2 tar xjf gcc-4.8.2.tar.bz2 cd gcc-4.8.2tar -Jxf ../mpfr-3.1.2.tar.xzmv -v mpfr-3.1.2 mpfrtar -Jxf ../gmp-5.1.3.tar.xzmv -v gmp-5.1.3 gmptar -zxf ../mpc-1.0.2.tar.gzmv -v mpc-1.0.2 mpc

cat gcc/limitx.h gcc/glimits.h gcc/limity.h > / `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/include-fixed/limits.hcase `uname -m` in i?86) sed -i 's/^T_CFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in ;;esacfor file in / $(find gcc/config -name linux64.h -o -name 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_STARTFILE_PREFIX_1#undef STANDARD_STARTFILE_PREFIX_2#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file touch $file.origdonecd .. #build rm -rf gcc-build mkdir -v gcc-build cd gcc-buildCC=$LFS_TGT-gcc /CXX=$LFS_TGT-g++ /AR=$LFS_TGT-ar /RANLIB=$LFS_TGT-ranlib /../gcc-4.8.2/configure / --prefix=/tools / --with-local-prefix=/tools / --with-native-system-header-dir=/tools/include / --enable-clocale=gnu / --enable-shared / --enable-threads=posix / --enable-__cxa_atexit / --enable-languages=c,c++ / --disable-libstdcxx-pch / --disable-multilib / --disable-bootstrap / --disable-libgomp / --with-mpfr-include=$(pwd)/../gcc-4.8.2/mpfr/src / --with-mpfr-lib=$(pwd)/mpfr/src/.libsmakemake installln -sv gcc /tools/bin/ccecho 'main(){}' > dummy.ccc dummy.creadelf -l a.out | grep ': /tools'#rm -v dummy.c a.out cd ..fi#5.11. Tcl-8.6.1if [[ $STEP = "5.11" ]]; then tar xzf tcl8.6.1-src.tar.gz cd tcl8.6.1 cd unix ./configure --prefix=/tools make TZ=UTC make test make install chmod -v u+w /tools/lib/libtcl8.6.so make install-private-headers ln -sv tclsh8.6 /tools/bin/tclsh cd .. cd ..fi#5.12. Expect-5.45if [[ $STEP = "5.12" ]]; thentar xzf expect5.45.tar.gzcd expect5.45cp -v configure{,.orig}sed 's:/usr/local/bin:/bin:' configure.orig > configure./configure --prefix=/tools / --with-tcl=/tools/lib / --with-tclinclude=/tools/includemakemake testmake SCRIPTS="" installcd ..fi#5.13. DejaGNU-1.5.1if [[ $STEP = "5.13" ]]; thentar xzf dejagnu-1.5.1.tar.gzcd dejagnu-1.5.1./configure --prefix=/toolsmake installmake checkcd ..fi#5.14. Check-0.9.12if [[ $STEP = "5.14" ]]; thentar xzf check-0.9.12.tar.gzcd check-0.9.12 PKG_CONFIG= ./configure --prefix=/tools make make check make installcd ..fi#5.15. Ncurses-5.9if [[ $STEP = "5.15" ]]; then tar xzf ncurses-5.9.tar.gz cd ncurses-5.9 ./configure --prefix=/tools / --with-shared / --without-debug / --without-ada / --enable-widec / --enable-overwrite make make install cd ..fi#5.16. Bash-4.2if [[ $STEP = "5.16" ]]; then tar xzf bash-4.2.tar.gz cd bash-4.2 patch -Np1 -i ../bash-4.2-fixes-12.patch ./configure --prefix=/tools --without-bash-malloc make make tests make install ln -sv bash /tools/bin/sh cd ..fi#5.17. Bzip2-1.0.6if [[ $STEP = "5.17" ]]; then tar bzip2-1.0.6.tar.gz cd bzip2-1.0.6 make make PREFIX=/tools install cd ..fi#5.18. Coreutils-8.22if [[ $STEP = "5.18" ]]; thentar -Jxf coreutils-8.22.tar.xzcd coreutils-8.22 ./configure --prefix=/tools --enable-install-program=hostname make make RUN_EXPENSIVE_TESTS=yes check make installcd ..fi#5.19. Diffutils-3.3if [[ $STEP = "5.19" ]]; then tar -Jxf diffutils-3.3.tar.xz cd diffutils-3.3 ./configure --prefix=/tools make make check make install cd ..fi#5.20. File-5.17if [[ $STEP = "5.20" ]]; thentar xzf file-5.17.tar.gzcd file-5.17 ./configure --prefix=/tools make make check make installcd ..fi#5.21. Findutils-4.4.2if [[ $STEP = "5.21" ]]; then tar xzf findutils-4.4.2.tar.gz cd findutils-4.4.2 ./configure --prefix=/tools make make check make install cd ..fi#5.22. Gawk-4.1.0if [[ $STEP = "5.22" ]]; thentar -Jxf gawk-4.1.0.tar.xzcd gawk-4.1.0 ./configure --prefix=/tools make make check make installcd ..fi#5.23. Gettext-0.18.3.2if [[ $STEP = "5.23" ]]; thentar xzf gettext-0.18.3.2.tar.gzcd gettext-0.18.3.2cd gettext-toolsEMACS="no" ./configure --prefix=/tools --disable-sharedmake -C gnulib-libmake -C src msgfmtmake -C src msgmergemake -C src xgettextcp -v src/{msgfmt,msgmerge,xgettext} /tools/bincd ..fi#5.24. Grep-2.16if [[ $STEP = "5.24" ]]; then tar -Jxf grep-2.16.tar.xz cd grep-2.16 ./configure --prefix=/tools make make check make install cd ..fi#5.25. Gzip-1.6if [[ $STEP = "5.25" ]]; then tar -Jxf gzip-1.6.tar.xz cd gzip-1.6 ./configure --prefix=/tools make make check make install cd ..fi#5.26. M4-1.4.17if [[ $STEP = "5.26" ]]; thentar -Jxf m4-1.4.17.tar.xzcd m4-1.4.17 ./configure --prefix=/tools make make check make installcd ..fi#5.27. Make-4.0if [[ $STEP = "5.27" ]]; thentar xjf make-4.0.tar.bz2cd make-4.0 ./configure --prefix=/tools --without-guile make make check make installcd ..fi#5.28. Patch-2.7.1if [[ $STEP = "5.28" ]]; thentar -Jxf patch-2.7.1.tar.xzcd patch-2.7.1 ./configure --prefix=/tools make make check make installcd ..fi#5.29. Perl-5.18.2if [[ $STEP = "5.29" ]]; thentar xjf perl-5.18.2.tar.bz2cd perl-5.18.2 patch -Np1 -i ../perl-5.18.2-libc-1.patch sh Configure -des -Dprefix=/tools make

cp -v perl cpan/podlators/pod2man /tools/bin mkdir -pv /tools/lib/perl5/5.18.2 cp -Rv lib/* /tools/lib/perl5/5.18.2cd ..fi#5.30. Sed-4.2.2if [[ $STEP = "5.30" ]]; thentar xjf sed-4.2.2.tar.bz2cd sed-4.2.2./configure --prefix=/toolsmakemake checkmake installcd ..fi#5.31. Tar-1.27.1if [[ $STEP = "5.31" ]]; thentar -Jxf tar-1.27.1.tar.xzcd tar-1.27.1 ./configure --prefix=/tools make make check make installcd ..fi#5.32. Texinfo-5.2if [[ $STEP = "5.32" ]]; thentar -Jxf texinfo-5.2.tar.xzcd texinfo-5.2 ./configure --prefix=/tools make make check make installcd ..fi#5.33. Util-linux-2.24.1if [[ $STEP = "5.33" ]]; thentar -Jxf util-linux-2.24.1.tar.xzcd util-linux-2.24.1 ./configure --prefix=/tools / --disable-makeinstall-chown / --without-systemdsystemunitdir / PKG_CONFIG="" make make installcd ..fi#5.34. Xz-5.0.5if [[ $STEP = "5.34" ]]; thentar -Jxf xz-5.0.5.tar.xzcd xz-5.0.5 ./configure --prefix=/tools make make check make installcd ..fi#5.35. Strippingif [[ $STEP = "5.35" ]]; thenstrip --strip-debug /tools/lib/*/usr/bin/strip --strip-unneeded /tools/{,s}bin/*rm -rf /tools/{,share}/{info,man,doc}fi#5.36. Changing Ownershipif [[ $STEP = "5.36" ]]; then chown -R root:root $LFS/toolsfi#-----------------popd

#chap6if [[ $STEP = "6" ]]; then #Preparing Virtual Kernel File Systems mkdir -pv $LFS/{dev,proc,sys,run}#6.2.1. Creating Initial Device Nodesmknod -m 600 $LFS/dev/console c 5 1mknod -m 666 $LFS/dev/null c 1 3#6.2.2. Mounting and Populating /devmount -v --bind /dev $LFS/dev#6.2.3. Mounting Virtual Kernel File Systemsmount -vt devpts devpts $LFS/dev/pts -o gid=5,mode=620mount -vt proc proc $LFS/procmount -vt sysfs sysfs $LFS/sysmount -vt tmpfs tmpfs $LFS/runif [ -h $LFS/dev/shm ]; then mkdir -pv $LFS/$(readlink $LFS/dev/shm)fifi#As user root, run the following command to enter the realm that isif [[ $STEP = "6.1" ]]; thenchroot "$LFS" /tools/bin/env -i / HOME=/root / TERM="$TERM" / PS1='/u:/w/$ ' / PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin / /tools/bin/bash --login +hfi

if [[ $STEP = "6.2" ]]; then#6.5. Creating Directoriesmkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib,mnt,opt}mkdir -pv /{media/{floppy,cdrom},sbin,srv,var}install -dv -m 0750 /rootinstall -dv -m 1777 /tmp /var/tmpmkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}mkdir -v /usr/{,local/}share/{misc,terminfo,zoneinfo}mkdir -v /usr/libexecmkdir -pv /usr/{,local/}share/man/man{1..8}case $(uname -m) in x86_64) ln -sv lib /lib64 && ln -sv lib /usr/lib64 && ln -sv lib /usr/local/lib64 ;;esacmkdir -v /var/{log,mail,spool}ln -sv /run /var/runln -sv /run/lock /var/lockmkdir -pv /var/{opt,cache,lib/{color,misc,locate},local}#6.6. Creating Essential Files and Symlinksln -sv /tools/bin/{bash,cat,echo,pwd,stty} /binln -sv /tools/bin/perl /usr/binln -sv /tools/lib/libgcc_s.so{,.1} /usr/libln -sv /tools/lib/libstdc++.so{,.6} /usr/libsed 's/tools/usr/' /tools/lib/libstdc++.la > /usr/lib/libstdc++.laln -sv bash /bin/sh

ln -sv /proc/self/mounts /etc/mtabcat > /etc/passwd << "EOF"root:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/dev/null:/bin/falsenobody:x:99:99:Unprivileged User:/dev/null:/bin/falseEOFcat > /etc/group << "EOF"root:x:0:bin:x:1:sys:x:2:kmem:x:3:tape:x:4:tty:x:5:daemon:x:6:floppy:x:7:disk:x:8:lp:x:9:dialout:x:10:audio:x:11:video:x:12:utmp:x:13:usb:x:14:cdrom:x:15:mail:x:34:nogroup:x:99:EOF

exec /tools/bin/bash --login +h

touch /var/log/{btmp,lastlog,wtmp}chgrp -v utmp /var/log/lastlogchmod -v 664 /var/log/lastlogchmod -v 600 /var/log/btmpfi

pushd $LFS/sources#6.7. Linux-3.13.3 API Headersif [[ $STEP = "6.7" ]]; then tar xf linux-3.13.3.tar.xz cd linux-3.13.3 make mrpropermake headers_checkmake INSTALL_HDR_PATH=dest headers_installfind dest/include /( -name .install -o -name ..install.cmd /) -deletecp -rv dest/include/* /usr/include cd .. fi#6.8. Man-pages-3.59if [[ $STEP = "6.8" ]]; thentar -Jxf man-pages-3.59.tar.xzcd man-pages-3.59 make installcd ..fi#6.9. Glibc-2.19if [[ $STEP = "6.9" ]]; thentar xf glibc-2.19.tar.xzcd glibc-2.19 sed -i 's///$$(pwd)/`pwd`/' timezone/Makefile patch -Np1 -i ../glibc-2.19-fhs-1.patchcd ..mkdir -v glibc-buildcd glibc-build../glibc-2.19/configure / --prefix=/usr / --disable-profile / --enable-kernel=2.6.32 / --enable-obsolete-rpc make -k check 2>&1 | tee glibc-check-log grep Error glibc-check-log touch /etc/ld.so.conf make install cp -v ../glibc-2.19/nscd/nscd.conf /etc/nscd.conf mkdir -pv /var/cache/nscd

mkdir -pv /usr/lib/localelocaledef -i cs_CZ -f UTF-8 cs_CZ.UTF-8localedef -i de_DE -f ISO-8859-1 de_DElocaledef -i de_DE@euro -f ISO-8859-15 de_DE@eurolocaledef -i de_DE -f UTF-8 de_DE.UTF-8localedef -i en_GB -f UTF-8 en_GB.UTF-8localedef -i en_HK -f ISO-8859-1 en_HKlocaledef -i en_PH -f ISO-8859-1 en_PHlocaledef -i en_US -f ISO-8859-1 en_USlocaledef -i en_US -f UTF-8 en_US.UTF-8localedef -i es_MX -f ISO-8859-1 es_MXlocaledef -i fa_IR -f UTF-8 fa_IRlocaledef -i fr_FR -f ISO-8859-1 fr_FRlocaledef -i fr_FR@euro -f ISO-8859-15 fr_FR@eurolocaledef -i fr_FR -f UTF-8 fr_FR.UTF-8localedef -i it_IT -f ISO-8859-1 it_ITlocaledef -i it_IT -f UTF-8 it_IT.UTF-8localedef -i ja_JP -f EUC-JP ja_JPlocaledef -i ru_RU -f KOI8-R ru_RU.KOI8-Rlocaledef -i ru_RU -f UTF-8 ru_RU.UTF-8localedef -i tr_TR -f UTF-8 tr_TR.UTF-8localedef -i zh_CN -f GB18030 zh_CN.GB18030

make localedata/install-localescat > /etc/nsswitch.conf << "EOF"# Begin /etc/nsswitch.confpasswd: filesgroup: filesshadow: fileshosts: files dnsnetworks: filesprotocols: filesservices: filesethers: filesrpc: files# End /etc/nsswitch.confEOF

tar -xf ../tzdata2013i.tar.gzZONEINFO=/usr/share/zoneinfomkdir -pv $ZONEINFO/{posix,right}for tz in etcetera southamerica northamerica europe africa antarctica / asia australasia backward pacificnew systemv; do zic -L /dev/null -d $ZONEINFO -y "sh yearistype.sh" ${tz} zic -L /dev/null -d $ZONEINFO/posix -y "sh yearistype.sh" ${tz} zic -L leapseconds -d $ZONEINFO/right -y "sh yearistype.sh" ${tz}donecp -v zone.tab iso3166.tab $ZONEINFOzic -d $ZONEINFO -p America/New_Yorkunset ZONEINFO

tzselect

cp -v /usr/share/zoneinfo/<xxx> /etc/localtime

cat > /etc/ld.so.conf << "EOF"# Begin /etc/ld.so.conf/usr/local/lib/opt/libEOFcat >> /etc/ld.so.conf << "EOF"# Add an include directoryinclude /etc/ld.so.conf.d/*.confEOFmkdir -pv /etc/ld.so.conf.d

cd ..fi

#6.10. Adjusting the Toolchainif [[ $STEP = "6.10" ]]; thenmv -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 -e 's@/tools@@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.ccc dummy.c -v -Wl,--verbose &> dummy.logreadelf -l a.out | grep ': /lib'

grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.loggrep -B1 '^ /usr/include' dummy.loggrep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |/n|g'grep "/lib.*/libc.so.6 " dummy.loggrep found dummy.logsrm -v dummy.c a.out dummy.log

fi#6.11. Zlib-1.2.8if [[ $STEP = "6.11" ]]; thentar -Jxf zlib-1.2.8.tar.xzcd zlib-1.2.8 ./configure --prefix=/usr make make check make install mv -v /usr/lib/libz.so.* /lib ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.socd ..fi#6.12. File-5.17if [[ $STEP = "6.12" ]]; thentar xzf file-5.17.tar.gzcd file-5.17 ./configure --prefix=/usr make make check make installcd ..fi#6.13. Binutils-2.24if [[ $STEP = "6.13" ]]; thentar xjf binutils-2.24.tar.bz2cd binutils-2.24expect -c "spawn ls"rm -fv etc/standards.infosed -i.bak '/^INFO/s/standards.info //' etc/Makefile.incd ..

mkdir -v binutils-build ../binutils-2.24/configure --prefix=/usr --enable-shared make tooldir=/usr make check make tooldir=/usr installcd binutils-buildcd ..fi#6.14. GMP-5.1.3if [[ $STEP = "6.14" ]]; thentar -Jxf gmp-5.1.3.tar.xzcd gmp-5.1.3 ./configure --prefix=/usr --enable-cxx make make check 2>&1 | tee gmp-check-log awk '/tests passed/{total+=$2} ; END{print total}' gmp-check-log make install mkdir -v /usr/share/doc/gmp-5.1.3 cp -v doc/{isa_abi_headache,configuration} doc/*.html / /usr/share/doc/gmp-5.1.3cd ..fi#6.15. MPFR-3.1.2if [[ $STEP = "6.15" ]]; thentar -Jxf mpfr-3.1.2.tar.xzcd mpfr-3.1.2./configure --prefix=/usr / --enable-thread-safe / --docdir=/usr/share/doc/mpfr-3.1.2makemake checkmake installmake htmlmake install-htmlcd ..fi#6.16. MPC-1.0.2if [[ $STEP = "6.16" ]]; thentar xzf mpc-1.0.2.tar.gzcd mpc-1.0.2 ./configure --prefix=/usr make make check make installcd ..fi#6.17. GCC-4.8.2if [[ $STEP = "6.17" ]]; then tar xjf gcc-4.8.2.tar.bz2 #configure cd gcc-4.8.2case `uname -m` in i?86) sed -i 's/^T_CFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in ;;esacsed -i -e /autogen/d -e /check.sh/d fixincludes/Makefile.in mv -v libmudflap/testsuite/libmudflap.c++/pass41-frag.cxx{,.disable} cd ..mkdir -v gcc-buildcd gcc-build SED=sed /../gcc-4.8.2/configure / --prefix=/usr / --enable-shared / --enable-threads=posix / --enable-__cxa_atexit / --enable-clocale=gnu / --enable-languages=c,c++ / --disable-multilib / --disable-bootstrap / --with-system-zlib make ulimit -s 32768 make -k check ../gcc-4.8.2/contrib/test_summary make install ln -sv ../usr/bin/cpp /lib ln -sv gcc /usr/bin/ccecho 'main(){}' > dummy.ccc dummy.c -v -Wl,--verbose &> dummy.logreadelf -l a.out | grep ': /lib'grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log

mkdir -pv /usr/share/gdb/auto-load/usr/libmv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/libcd ..fi#6.18. Sed-4.2.2if [[ $STEP = "6.18" ]]; thentar xjf sed-4.2.2.tar.bz2cd sed-4.2.2./configure --prefix=/usr --bindir=/bin --htmldir=/usr/share/doc/sed-4.2.2makemake htmlmake checkmake installmake -C doc install-htmlcd ..fi#6.19. Bzip2-1.0.6if [[ $STEP = "6.19" ]]; thentar bzip2-1.0.6.tar.gzcd bzip2-1.0.6 patch -Np1 -i ../bzip2-1.0.6-install_docs-1.patch sed -i 's@/(ln -s -f /)$(PREFIX)/bin/@/1@' Makefile sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile make -f Makefile-libbz2_so make clean make make PREFIX=/usr install

cp -v bzip2-shared /bin/bzip2cp -av libbz2.so* /libln -sv ../../lib/libbz2.so.1.0 /usr/lib/libbz2.sorm -v /usr/bin/{bunzip2,bzcat,bzip2}ln -sv bzip2 /bin/bunzip2ln -sv bzip2 /bin/bzcatcd ..fi#6.20. Pkg-config-0.28if [[ $STEP = "6.20" ]]; thentar xzf pkg-config-0.28.tar.gzcd pkg-config-0.28./configure --prefix=/usr / --with-internal-glib / --disable-host-tool / --docdir=/usr/share/doc/pkg-config-0.28makemake checkmake installcd ..fi#6.21. Ncurses-5.9if [[ $STEP = "6.21" ]]; then tar xzf ncurses-5.9.tar.gz cd ncurses-5.9./configure --prefix=/usr / --mandir=/usr/share/man / --with-shared / --without-debug / --enable-pc-files / --enable-widecmakemake installmv -v /usr/lib/libncursesw.so.5* /libln -sfv ../../lib/$(readlink /usr/lib/libncursesw.so) /usr/lib/libncursesw.sofor lib in ncurses form panel menu ; do rm -vf /usr/lib/lib${lib}.so echo "INPUT(-l${lib}w)" > /usr/lib/lib${lib}.so ln -sfv lib${lib}w.a /usr/lib/lib${lib}.a ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pcdoneln -sfv libncurses++w.a /usr/lib/libncurses++.a

rm -vf /usr/lib/libcursesw.soecho "INPUT(-lncursesw)" > /usr/lib/libcursesw.soln -sfv libncurses.so /usr/lib/libcurses.soln -sfv libncursesw.a /usr/lib/libcursesw.aln -sfv libncurses.a /usr/lib/libcurses.a

mkdir -v /usr/share/doc/ncurses-5.9cp -v -R doc/* /usr/share/doc/ncurses-5.9 cd ..fi#6.22. Shadow-4.1.5.1if [[ $STEP = "6.22" ]]; thentar xzf shadow_4.1.5.1.orig.tar.gzcd shadow_4.1.5.1

sed -i 's/groups$(EXEEXT) //' src/Makefile.infind man -name Makefile.in -exec sed -i 's/groups/.1 / /' {} /;

sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' / -e 's@/var/spool/mail@/var/mail@' etc/login.defs

./configure --sysconfdir=/etcmakemake installmv -v /usr/bin/passwd /bincd ..#pwconv grpconvfi#6.23. Psmisc-22.20if [[ $STEP = "6.23" ]]; thentar xzf psmisc-22.20.tar.gzcd psmisc-22.20./configure --prefix=/usrmakemake installmv -v /usr/bin/fuser /binmv -v /usr/bin/killall /bincd ..fi#6.24. Procps-ng-3.3.9if [[ $STEP = "6.24" ]]; thentar -Jxf procps-ng-3.3.9.tar.xzcd procps-ng-3.3.9./configure --prefix=/usr / --exec-prefix= / --libdir=/usr/lib / --docdir=/usr/share/doc/procps-ng-3.3.9 / --disable-static / --disable-killmakesed -i -r 's|(pmap_initname)///$|/1|' testsuite/pmap.test/pmap.expmake checkmake install

mv -v /usr/bin/pidof /binmv -v /usr/lib/libprocps.so.* /libln -sfv ../../lib/$(readlink /usr/lib/libprocps.so) /usr/lib/libprocps.so cd ..fi#6.25. E2fsprogs-1.42.9if [[ $STEP = "6.25" ]]; thentar xzf e2fsprogs-1.42.9.tar.gzcd e2fsprogs-1.42.9 sed -i -e 's|^LD_LIBRARY_PATH.*|&:/tools/lib|' tests/test_configmkdir -v buildcd buildLIBS=-L/tools/lib /CFLAGS=-I/tools/include /PKG_CONFIG_PATH=/tools/lib/pkgconfig /../configure --prefix=/usr / --with-root-prefix="" / --enable-elf-shlibs / --disable-libblkid / --disable-libuuid / --disable-uuidd / --disable-fsckmakemake checkmake installmake install-libschmod -v u+w /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a

gunzip -v /usr/share/info/libext2fs.info.gzinstall-info --dir-file=/usr/share/info/dir /usr/share/info/libext2fs.info

makeinfo -o doc/com_err.info ../lib/et/com_err.texinfoinstall -v -m644 doc/com_err.info /usr/share/infoinstall-info --dir-file=/usr/share/info/dir /usr/share/info/com_err.info

cd ..cd ..fi#6.26. Coreutils-8.22if [[ $STEP = "6.26" ]]; thentar -Jxf coreutils-8.22.tar.xzcd coreutils-8.22patch -Np1 -i ../coreutils-8.22-i18n-4.patchFORCE_UNSAFE_CONFIGURE=1 ./configure / --prefix=/usr / --enable-no-install-program=kill,uptimemakemake NON_ROOT_USERNAME=nobody check-rootecho "dummy:x:1000:nobody" >> /etc/groupchown -Rv nobody . su nobody -s /bin/bash / -c "PATH=$PATH make RUN_EXPENSIVE_TESTS=yes check"sed -i '/dummy/d' /etc/groupmake install

mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /binmv -v /usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} /binmv -v /usr/bin/{rmdir,stty,sync,true,uname,test,[} /binmv -v /usr/bin/chroot /usr/sbinmv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8sed -i s//"1/"//"8/"/1 /usr/share/man/man8/chroot.8

mv -v /usr/bin/{head,sleep,nice} /bin

cd ..fi#6.27. Iana-Etc-2.30if [[ $STEP = "6.27" ]]; thentar xjf iana-etc-2.30.tar.bz2cd iana-etc-2.30makemake installcd ..fi#6.28. M4-1.4.17if [[ $STEP = "6.28" ]]; thentar -Jxf m4-1.4.17.tar.xzcd m4-1.4.17 ./configure --prefix=/usr make make check make installcd ..fi#6.29. Flex-2.5.38if [[ $STEP = "6.29" ]]; thentar xjf flex-2.5.38.tar.bz2cd flex-2.5.38 sed -i -e '/test-bison/d' tests/Makefile.in./configure --prefix=/usr --docdir=/usr/share/doc/flex-2.5.38makemake checkmake installcd ..cat > /usr/bin/lex << "EOF"#!/bin/sh# Begin /usr/bin/lexexec /usr/bin/flex -l "$@"# End /usr/bin/lexEOFchmod -v 755 /usr/bin/lexfi#6.30. Bison-3.0.2if [[ $STEP = "6.30" ]]; thentar -Jxf bison-3.0.2.tar.xzcd bison-3.0.2./configure --prefix=/usrmakemake checkmake installcd ..fi#6.31. Grep-2.16if [[ $STEP = "6.31" ]]; thentar -Jxf grep-2.16.tar.xzcd grep-2.16./configure --prefix=/usr --bindir=/binmakemake checkmake installcd ..fi#6.32. Readline-6.2if [[ $STEP = "6.32" ]]; thentar xzf readline-6.2.tar.gzcd readline-6.2sed -i '/MV.*old/d' Makefile.insed -i '/{OLDSUFF}/c:' support/shlib-installpatch -Np1 -i ../readline-6.2-fixes-2.patch./configure --prefix=/usrmake SHLIB_LIBS=-lncursesmake install

mv -v /usr/lib/lib{readline,history}.so.* /libln -sfv ../../lib/$(readlink /usr/lib/libreadline.so) /usr/lib/libreadline.soln -sfv ../../lib/$(readlink /usr/lib/libhistory.so ) /usr/lib/libhistory.so

mkdir -v /usr/share/doc/readline-6.2install -v -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline-6.2cd ..fi#6.33. Bash-4.2if [[ $STEP = "6.33" ]]; thentar xzf bash-4.2.tar.gzcd bash-4.2patch -Np1 -i ../bash-4.2-fixes-12.patch./configure --prefix=/usr / --bindir=/bin / --htmldir=/usr/share/doc/bash-4.2 / --without-bash-malloc / --with-installed-readlinemakechown -Rv nobody .su nobody -s /bin/bash -c "PATH=$PATH make tests"make installexec /bin/bash --login +hcd ..fi#6.34. Bc-1.06.95if [[ $STEP = "6.34" ]]; thentar xjf bc-1.06.95.tar.bz2cd bc-1.06.95./configure --prefix=/usr / --with-readline / --mandir=/usr/share/man / --infodir=/usr/share/infomakeecho "quit" | ./bc/bc -l Test/checklib.bmake installcd ..fi#6.35. Libtool-2.4.2if [[ $STEP = "6.35" ]]; thentar xzf libtool-2.4.2.tar.gzcd libtool-2.4.2 ./configure --prefix=/usrmakemake checkmake installcd ..fi#6.36. GDBM-1.11if [[ $STEP = "6.36" ]]; thentar xzf gdbm-1.11.tar.gzcd gdbm-1.11 ./configure --prefix=/usr --enable-libgdbm-compatmakemake checkmake installcd ..fi#6.37. Inetutils-1.9.2if [[ $STEP = "6.37" ]]; thentar zxf inetutils-1.9.2.tar.gzcd inetutils-1.9.2echo '#define PATH_PROCNET_DEV "/proc/net/dev"' >> ifconfig/system/linux.h./configure --prefix=/usr / --localstatedir=/var / --disable-logger / --disable-syslogd / --disable-whois / --disable-serversmakemake checkmake install

mv -v /usr/bin/{hostname,ping,ping6,traceroute} /binmv -v /usr/bin/ifconfig /sbincd ..fi#6.38. Perl-5.18.2if [[ $STEP = "6.38" ]]; thentar xjf perl-5.18.2.tar.bz2cd perl-5.18.2 echo "127.0.0.1 localhost $(hostname)" > /etc/hostssed -i -e "s|BUILD_ZLIB/s*= True|BUILD_ZLIB = False|" / -e "s|INCLUDE/s*= ./zlib-src|INCLUDE = /usr/include|" / -e "s|LIB/s*= ./zlib-src|LIB = /usr/lib|" / cpan/Compress-Raw-Zlib/config.insh Configure -des -Dprefix=/usr / -Dvendorprefix=/usr / -Dman1dir=/usr/share/man/man1 / -Dman3dir=/usr/share/man/man3 / -Dpager="/usr/bin/less -isR" / -Duseshrplibmakemake -k testmake installcd ..fi#6.39. Autoconf-2.69if [[ $STEP = "6.39" ]]; thentar -Jxf autoconf-2.69.tar.xzcd autoconf-2.69./configure --prefix=/usrmakemake checkmake installcd ..fi#6.40. Automake-1.14.1if [[ $STEP = "6.40" ]]; thentar -Jxf automake-1.14.1.tar.xzcd automake-1.14.1 ./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.14.1make

sed -i "s:./configure:LEXLIB=/usr/lib/libfl.a &:" t/lex-{clean,depend}-cxx.shmake -j4 checkmake install

cd ..fi#6.41. Diffutils-3.3if [[ $STEP = "6.41" ]]; then tar -Jxf diffutils-3.3.tar.xz cd diffutils-3.3sed -i 's:= @mkdir_p@:= /bin/mkdir -p:' po/Makefile.in.in./configure --prefix=/usrmakemake checkmake installcd ..fi#6.42. Gawk-4.1.0if [[ $STEP = "6.42" ]]; thentar -Jxf gawk-4.1.0.tar.xzcd gawk-4.1.0 ./configure --prefix=/usr make make check make install

mkdir -v /usr/share/doc/gawk-4.1.0cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-4.1.0cd ..fi#6.43. Findutils-4.4.2if [[ $STEP = "6.43" ]]; thentar xzf findutils-4.4.2.tar.gzcd findutils-4.4.2./configure --prefix=/usr --localstatedir=/var/lib/locatemakemake checkmake install

mv -v /usr/bin/find /binsed -i 's/find:=${BINDIR}/find:=//bin/' /usr/bin/updatedbcd ..fi#6.44. Gettext-0.18.3.2if [[ $STEP = "6.44" ]]; thentar xzf gettext-0

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表