lfs(systemv版本)學習筆記-第2頁的地址:http://www.javashuo.com/article/p-xhservmq-e.htmlcss
第六章節中構建的全部包必須進行測試。html
終端的環境應該是:python
1.設置變量linux
2.掛載你爲lfs建立的全部分區
3.逐步完成6.2.2與6.2.3章節內容後c++
4.chroot進入lfs分區繼續操做。shell
編譯安裝Linux API Headers包bootstrap
根據上一章節的構建要求,首先進入到$LFS/sources目錄vim
cd /sources
由於Linux API Headers在linux包中,因此解壓並進入linux包bash
tar -xvf linux-4.20.12.tar.xz
cd linux-4.20.12
2.參照書中說明編譯安裝app
make mrproper make INSTALL_HDR_PATH=dest headers_install find dest/include \( -name .install -o -name ..install.cmd \) -delete cp -rv dest/include/* /usr/include
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources
rm -rf linux-4.20.12
編譯安裝man-pages包
1.解壓並進入man-pages包目錄
tar -xvf man-pages-4.16.tar.xz cd man-pages-4.16
2.參照書中說明編譯安裝
make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf man-pages-4.16
編譯安裝glibc包
1.解壓並進入glibc包目錄
tar -xvf glibc-2.29.tar.xz cd glibc-2.29
2.參照書中說明編譯安裝
patch -Np1 -i ../glibc-2.29-fhs-1.patch ln -sfv /tools/lib/gcc /usr/lib case $(uname -m) in i?86) GCC_INCDIR=/usr/lib/gcc/$(uname -m)-pc-linux-gnu/8.2.0/include ln -sfv ld-linux.so.2 /lib/ld-lsb.so.3 ;; x86_64) GCC_INCDIR=/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64 ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.3 ;; esac rm -f /usr/include/limits.h mkdir -v build cd build CC="gcc -isystem $GCC_INCDIR -isystem /usr/include" \ ../configure --prefix=/usr \ --disable-werror \ --enable-kernel=3.2 \ --enable-stack-protector=strong \ libc_cv_slibdir=/lib unset GCC_INCDIR make -j8 make -j8 check touch /etc/ld.so.conf sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile make install cp -v ../nscd/nscd.conf /etc/nscd.conf mkdir -pv /var/cache/nscd
3.配置glibc包
按照書籍安裝步驟到(能夠使用localedef程序安裝單個語言環境)步驟
咱們須要安裝英文語言環境和中文語言環境
1.建立語言環境安裝目錄
mkdir -pv /usr/lib/locale
2.安裝語言環境
localedef -i en_US -f UTF-8 en_US.UTF-8 localedef -i zh_CN -f UTF-8 zh_CN.UTF-8
3.建立/etc/nsswitch.conf文件
cat > /etc/nsswitch.conf << "EOF" # Begin /etc/nsswitch.conf passwd: files group: files shadow: files hosts: files dns networks: files protocols: files services: files ethers: files rpc: files # End /etc/nsswitch.conf EOF
4.安裝和設置時區數據
tar -xf ../../tzdata2018e.tar.gz ZONEINFO=/usr/share/zoneinfo mkdir -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} done cp -v zone.tab zone1970.tab iso3166.tab $ZONEINFO zic -d $ZONEINFO -p America/New_York unset ZONEINFO
5.肯定時區
tzselect
Please identify a location so that time zone rules can be set correctly. Please select a continent, ocean, "coord", or "TZ". 1) Africa 2) Americas 3) Antarctica 4) Asia 5) Atlantic Ocean 6) Australia 7) Europe 8) Indian Ocean 9) Pacific Ocean 10) coord - I want to use geographical coordinates. 11) TZ - I want to specify the time zone using the Posix TZ format.
6.這裏咱們選擇4亞洲
Please select a country whose clocks agree with yours. 1) Afghanistan 18) Israel 35) Palestine 2) Armenia 19) Japan 36) Philippines 3) Azerbaijan 20) Jordan 37) Qatar 4) Bahrain 21) Kazakhstan 38) Russia 5) Bangladesh 22) Korea (North) 39) Saudi Arabia 6) Bhutan 23) Korea (South) 40) Singapore 7) Brunei 24) Kuwait 41) Sri Lanka 8) Cambodia 25) Kyrgyzstan 42) Syria 9) China 26) Laos 43) Taiwan 10) Cyprus 27) Lebanon 44) Tajikistan 11) East Timor 28) Macau 45) Thailand 12) Georgia 29) Malaysia 46) Turkmenistan 13) Hong Kong 30) Mongolia 47) United Arab Emirates 14) India 31) Myanmar (Burma) 48) Uzbekistan 15) Indonesia 32) Nepal 49) Vietnam 16) Iran 33) Oman 50) Yemen 17) Iraq 34) Pakistan
7.這裏咱們選擇9中國
Please select one of the following time zone regions. 1) Beijing Time 2) Xinjiang Time
8.這裏咱們選擇1北京時間
The following information has been given: China Beijing Time Therefore TZ='Asia/Shanghai' will be used. Selected time is now: Sun Dec 30 18:00:59 CST 2018. Universal Time is now: Sun Dec 30 10:00:59 UTC 2018. Is the above information OK? 1) Yes 2) No #? yes Please enter a number in range.
9.是否選擇以上信息?這裏選擇1
You can make this change permanent for yourself by appending the line TZ='Asia/Shanghai'; export TZ to the file '.profile' in your home directory; then log out and log in again. Here is that TZ value again, this time on standard output so that you can use the /usr/bin/tzselect command in shell scripts: Asia/Shanghai
這句的意思是你能夠將該配置文件添加到/usr/bin/tzselect使其生效(這個命令是建立一個時區環境變量,重啓後會失效)
10.運行如下命令建立時區文件/etc/localtime
cp -v /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
11.配置動態加載文件
cat > /etc/ld.so.conf << "EOF" # Begin /etc/ld.so.conf /usr/local/lib /opt/lib EOF cat >> /etc/ld.so.conf << "EOF" # Add an include directory include /etc/ld.so.conf.d/*.conf EOF mkdir -pv /etc/ld.so.conf.d
12.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf glibc-2.29
調整工具鏈
1.輸入書中命令覈對輸出便可
mv -v /tools/bin/{ld,ld-old} mv -v /tools/$(uname -m)-pc-linux-gnu/bin/{ld,ld-old} mv -v /tools/bin/{ld-new,ld} ln -sv /tools/bin/ld /tools/$(uname -m)-pc-linux-gnu/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 'int main(){}' > dummy.c cc dummy.c -v -Wl,--verbose &> dummy.log readelf -l a.out | grep ': /lib' grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log grep -B1 '^ /usr/include' dummy.log grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g' grep "/lib.*/libc.so.6 " dummy.log grep found dummy.log rm -v dummy.c a.out dummy.log
編譯安裝zlib包
1.解壓並進入zlib包目錄
tar -xvf zlib-1.2.11.tar.xz cd zlib-1.2.11
2.參照書中內容編譯安裝
./configure --prefix=/usr make -j8 make -j8 check make install mv -v /usr/lib/libz.so.* /lib ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.so
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf zlib-1.2.11
構建安裝file包
1.解壓並進入file包目錄
tar -xvf file-5.36.tar.gz cd file-5.36
2.參照書中內容編譯安裝
./configure --prefix=/usr make -j8 make -j8 check make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf file-5.36
編譯安裝readline包
1.解壓並進入readline包目錄
tar -xvf readline-8.0.tar.gz cd readline-8.0
2.參照書中說明編譯安裝
sed -i '/MV.*old/d' Makefile.in sed -i '/{OLDSUFF}/c:' support/shlib-install ./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/readline-8.0 make SHLIB_LIBS="-L/tools/lib -lncursesw" make SHLIB_LIBS="-L/tools/lib -lncurses" install mv -v /usr/lib/lib{readline,history}.so.* /lib chmod -v u+w /lib/lib{readline,history}.so.* ln -sfv ../../lib/$(readlink /usr/lib/libreadline.so) /usr/lib/libreadline.so ln -sfv ../../lib/$(readlink /usr/lib/libhistory.so ) /usr/lib/libhistory.so install -v -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline-8.0
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf readline-8.0
編譯安裝m4包
1.解壓並進入m4包目錄
tar -xvf m4-1.4.18.tar.xz cd m4-1.4.18
2.參照書中說明編譯安裝
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h ./configure --prefix=/usr make -j8 make -j8 check make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf m4-1.4.18
編譯安裝bc包
1.解壓並進入bc包目錄
tar -xvf bc-1.07.1.tar.gz cd bc-1.07.1
2.參照書中內容編譯安裝
cat > bc/fix-libmath_h << "EOF" #! /bin/bash sed -e '1 s/^/{"/' \ -e 's/$/",/' \ -e '2,$ s/^/"/' \ -e '$ d' \ -i libmath.h sed -e '$ s/$/0}/' \ -i libmath.h EOF ln -sv /tools/lib/libncursesw.so.6 /usr/lib/libncursesw.so.6 ln -sfv libncurses.so.6 /usr/lib/libncurses.so sed -i -e '/flex/s/as_fn_error/: ;; # &/' configure ./configure --prefix=/usr \ --with-readline \ --mandir=/usr/share/man \ --infodir=/usr/share/info make -j8 echo "quit" | ./bc/bc -l Test/checklib.b make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf bc-1.07.1
編譯安裝binutils包
1.解壓並進入binutils包目錄
tar -xvf binutils-2.32.tar.xz cd binutils-2.32
2.參照書中說明編譯安裝
expect -c "spawn ls" mkdir -v build cd build ../configure --prefix=/usr \ --enable-gold \ --enable-ld=default \ --enable-plugins \ --enable-shared \ --disable-werror \ --enable-64-bit-bfd \ --with-system-zlib make tooldir=/usr make -k check make tooldir=/usr install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf binutils-2.32
編譯安裝gmp包
1.解壓並進入gmp包目錄
tar -xvf gmp-6.1.2.tar.xz cd gmp-6.1.2
2.參照書中說明編譯安裝
./configure --prefix=/usr \ --enable-cxx \ --disable-static \ --docdir=/usr/share/doc/gmp-6.1.2 make -j8 make html make check 2>&1 | tee gmp-check-log awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log make install make install-html
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf gmp-6.1.2
編譯安裝mpfr包
1.解壓並進入mpfr包目錄
tar -xvf mpfr-4.0.2.tar.xz cd mpfr-4.0.2
2.參照書中說明編譯安裝
./configure --prefix=/usr \ --disable-static \ --enable-thread-safe \ --docdir=/usr/share/doc/mpfr-4.0.2 make -j8 make -j8 html make -j8 check make install make install-html
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf mpfr-4.0.2
安裝編譯mpc包
1.解壓並進入mpc包目錄
tar -xvf mpc-1.1.0.tar.gz cd mpc-1.1.0
2.參照書中內容編譯安裝
./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/mpc-1.1.0 make -j8 make -j8 html make -j8 check make install make install-html
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf mpc-1.1.0
編譯安裝shadow包
1.解壓並進入shadow包目錄
tar -xvf shadow-4.6.tar.xz cd shadow-4.6
2.參照書中說明編譯安裝
sed -i 's/groups$(EXEEXT) //' src/Makefile.in find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \; find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \; find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \; sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \ -e 's@/var/spool/mail@/var/mail@' etc/login.defs sed -i 's/1000/999/' etc/useradd ./configure --sysconfdir=/etc --with-group-name-max-length=32 make -j8 make install mv -v /usr/bin/passwd /bin
3.配置shadow包
pwconv grpconv sed -i 's/yes/no/' /etc/default/useradd
4.爲root用戶設置密碼
passwd root
5.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf shadow-4.6
編譯安裝gcc包
1.解壓並進入gcc包目錄
tar -xvf gcc-8.2.0.tar.xz cd gcc-8.2.0
2.參照書中的說明進行編譯安裝
case $(uname -m) in x86_64) sed -e '/m64=/s/lib64/lib/' \ -i.orig gcc/config/i386/t-linux64 ;; esac rm -f /usr/lib/gcc mkdir -v build cd build SED=sed \ ../configure --prefix=/usr \ --enable-languages=c,c++ \ --disable-multilib \ --disable-bootstrap \ --disable-libmpx \ --with-system-zlib make -j8 ulimit -s 32768 rm ../gcc/testsuite/g++.dg/pr83239.C chown -Rv nobody . su nobody -s /bin/bash -c "PATH=$PATH make -k check" ../contrib/test_summary make install ln -sv ../usr/bin/cpp /lib ln -sv gcc /usr/bin/cc install -v -dm755 /usr/lib/bfd-plugins ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/8.2.0/liblto_plugin.so \ /usr/lib/bfd-plugins/
3.檢查工具鏈並覈對輸出結果
echo 'int main(){}' > dummy.c cc dummy.c -v -Wl,--verbose &> dummy.log readelf -l a.out | grep ': /lib' grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log grep -B4 '^ /usr/include' dummy.log grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g' grep "/lib.*/libc.so.6 " dummy.log grep found dummy.log rm -v dummy.c a.out dummy.log mkdir -pv /usr/share/gdb/auto-load/usr/lib mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib
5.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf gcc-8.2.0
編譯安裝 bzip2包
1.解壓並進入bzip2包目錄
tar -xvf bzip2-1.0.6.tar.gz cd bzip2-1.0.6
2.參照書中說明編譯安裝
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 -j8 make PREFIX=/usr install cp -v bzip2-shared /bin/bzip2 cp -av libbz2.so* /lib ln -sv ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so rm -v /usr/bin/{bunzip2,bzcat,bzip2} ln -sv bzip2 /bin/bunzip2 ln -sv bzip2 /bin/bzcat
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf bzip2-1.0.6
編譯安裝pkg-config包
1.解壓並進入pkg-config包
tar -xvf pkg-config-0.29.2.tar.gz cd pkg-config-0.29.2
2.參照書中說明編譯安裝
./configure --prefix=/usr \ --with-internal-glib \ --disable-host-tool \ --docdir=/usr/share/doc/pkg-config-0.29.2 make -j8 make -j8 check make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf pkg-config-0.29.2
編譯安裝ncurses包
1.解壓並進入ncurses包目錄
tar -xvf ncurses-6.1.tar.gz cd ncurses-6.1
2.參照書中說明編譯安裝
sed -i '/LIBTOOL_INSTALL/d' c++/Makefile.in ./configure --prefix=/usr \ --mandir=/usr/share/man \ --with-shared \ --without-debug \ --without-normal \ --enable-pc-files \ --enable-widec make -j8 make install mv -v /usr/lib/libncursesw.so.6* /lib ln -sfv ../../lib/$(readlink /usr/lib/libncursesw.so) /usr/lib/libncursesw.so for 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}w.pc /usr/lib/pkgconfig/${lib}.pc done rm -vf /usr/lib/libcursesw.so echo "INPUT(-lncursesw)" > /usr/lib/libcursesw.so ln -sfv libncurses.so /usr/lib/libcurses.so mkdir -v /usr/share/doc/ncurses-6.1 cp -v -R doc/* /usr/share/doc/ncurses-6.1 make distclean ./configure --prefix=/usr \ --with-shared \ --without-normal \ --without-debug \ --without-cxx-binding \ --with-abi-version=5 make sources libs cp -av lib/lib*.so.5* /usr/lib
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf ncurses-6.1
編譯安裝attr包
1.解壓並進入attr包目錄
tar -xvf attr-2.4.48.tar.gz cd attr-2.4.48
2.參照書中說明進行編譯安裝
./configure --prefix=/usr \ --bindir=/bin \ --disable-static \ --sysconfdir=/etc \ --docdir=/usr/share/doc/attr-2.4.48 make -j8 make -j8 check make install mv -v /usr/lib/libattr.so.* /lib ln -sfv ../../lib/$(readlink /usr/lib/libattr.so) /usr/lib/libattr.so
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf attr-2.4.48
編譯安裝acl包
1.解壓並進入acl包目錄
tar -xvf acl-2.2.53.tar.gz cd acl-2.2.53
2.參照書中說明編譯安裝
./configure --prefix=/usr \ --bindir=/bin \ --disable-static \ --libexecdir=/usr/lib \ --docdir=/usr/share/doc/acl-2.2.53 make -j8 make install mv -v /usr/lib/libacl.so.* /lib ln -sfv ../../lib/$(readlink /usr/lib/libacl.so) /usr/lib/libacl.so
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf acl-2.2.53
編譯安裝libcap包
1.解壓並進入libcap包目錄
tar -xvf libcap-2.26.tar.xz cd libcap-2.26
2.參照書中說明編譯安裝
sed -i '/install.*STALIBNAME/d' libcap/Makefile make -j8 make RAISE_SETFCAP=no lib=lib prefix=/usr install chmod -v 755 /usr/lib/libcap.so.2.26 mv -v /usr/lib/libcap.so.* /lib ln -sfv ../../lib/$(readlink /usr/lib/libcap.so) /usr/lib/libcap.so
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf libcap-2.26
編譯安裝sed包
1.解壓並進入sed包
tar -xvf sed-4.7.tar.xz cd sed-4.7
2.參照書中內容編譯安裝
sed -i 's/usr/tools/' build-aux/help2man sed -i 's/testsuite.panic-tests.sh//' Makefile.in ./configure --prefix=/usr --bindir=/bin make -j8 make -j8 html make -j8 check make install install -d -m755 /usr/share/doc/sed-4.7 install -m644 doc/sed.html /usr/share/doc/sed-4.7
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf sed-4.7
編譯安裝psmisc包
1.解壓並進入psmisc包目錄
tar -xvf psmisc-23.2.tar.xz cd psmisc-23.2
2.參照書中說明編譯安裝
./configure --prefix=/usr make -j8 make install mv -v /usr/bin/fuser /bin mv -v /usr/bin/killall /bin
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf psmisc-23.2
編譯安裝iana-etc包
1.解壓並進入iana-etc包
tar -xvf iana-etc-2.30.tar.bz2 cd iana-etc-2.30
2.參照書中說明編譯安裝
make -j8 make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf iana-etc-2.30
編譯安裝bison包
1.解壓並進入bison包目錄
tar -xvf bison-3.3.2.tar.xz cd bison-3.3.2
2.參照書中說明編譯安裝
./configure --prefix=/usr --docdir=/usr/share/doc/bison-3.3.2 make -j8 make install
若是須要測試,在下一節中安裝flex後,能夠重建bison,而且能夠經過make check來運行bison檢查。(不推薦重建)
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf bison-3.3.2
編譯安裝flex包
1.解壓並進入flex包目錄
tar -xvf flex-2.6.4.tar.gz cd flex-2.6.4
2.參照書中說明編譯安裝
sed -i "/math.h/a #include <malloc.h>" src/flexdef.h HELP2MAN=/tools/bin/true \ ./configure --prefix=/usr --docdir=/usr/share/doc/flex-2.6.4 make -j8 make -j8 check make install ln -sv flex /usr/bin/lex
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf flex-2.6.4
編譯安裝grep包
1.解壓並進入grep包目錄
tar -xvf grep-3.3.tar.xz cd grep-3.3
2.參照書中說明編譯安裝
./configure --prefix=/usr --bindir=/bin make -j8 make -kj8 check make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf grep-3.3
編譯安裝bash包
1.解壓並進入bash包目錄
tar -xvf bash-5.0.tar.gz cd bash-5.0
2.參照書中說明編譯安裝
./configure --prefix=/usr \ --docdir=/usr/share/doc/bash-5.0 \ --without-bash-malloc \ --with-installed-readline make -j8 chown -Rv nobody . su nobody -s /bin/bash -c "PATH=$PATH make tests" make install mv -vf /usr/bin/bash /bin exec /bin/bash --login +h
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf bash-5.0
編譯安裝libtool
1.解壓並進入libtool包目錄
tar -xvf libtool-2.4.6.tar.xz cd libtool-2.4.6
2.參照書中內容編譯安裝
./configure --prefix=/usr make -j8 make -j8 check make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf libtool-2.4.6
編譯安裝gdbm包
1.解壓並進入gdbm包目錄
tar -xvf gdbm-1.18.1.tar.gz cd gdbm-1.18.1
2.參照書中說明編譯安裝
./configure --prefix=/usr \ --disable-static \ --enable-libgdbm-compat make -j8 make -j8 check make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf gdbm-1.18.1
編譯安裝gperf包
1.解壓並進入gperf包目錄
tar -xvf gperf-3.1.tar.gz cd gperf-3.1
2.參照書中說明編譯安裝
./configure --prefix=/usr --docdir=/usr/share/doc/gperf-3.1 make -j8 make -j1 check make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf gperf-3.1
編譯安裝expat包
1.解壓並進入expat包目錄
tar -xvf expat-2.2.6.tar.bz2 cd expat-2.2.6
2.參照書中說明編譯安裝
sed -i 's|usr/bin/env |bin/|' run.sh.in ./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/expat-2.2.6 make -j8 make -j8 check make install install -v -m644 doc/*.{html,png,css} /usr/share/doc/expat-2.2.6
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf expat-2.2.6
編譯安裝inetutils包
1.解壓並進入inetutils包目錄
tar -xvf inetutils-1.9.4.tar.xz cd inetutils-1.9.4
2.參照書中說明編譯安裝
./configure --prefix=/usr \ --localstatedir=/var \ --disable-logger \ --disable-whois \ --disable-rcp \ --disable-rexec \ --disable-rlogin \ --disable-rsh \ --disable-servers make -j8 make -j8 check make install mv -v /usr/bin/{hostname,ping,ping6,traceroute} /bin mv -v /usr/bin/ifconfig /sbin
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf inetutils-1.9.4
編譯安裝perl包
1.解壓並進入perl包目錄
tar -xvf perl-5.28.1.tar.xz cd perl-5.28.1
2.參照書中說明編譯安裝
echo "127.0.0.1 localhost $(hostname)" > /etc/hosts export BUILD_ZLIB=False export BUILD_BZIP2=0 sh Configure -des -Dprefix=/usr \ -Dvendorprefix=/usr \ -Dman1dir=/usr/share/man/man1 \ -Dman3dir=/usr/share/man/man3 \ -Dpager="/usr/bin/less -isR" \ -Duseshrplib \ -Dusethreads make -j8 make -kj8 test make install unset BUILD_ZLIB BUILD_BZIP2
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf perl-5.28.1
編譯安裝XML-Parser包
1.解壓並進入XML-Parser包目錄
tar -xvf XML-Parser-2.44.tar.gz cd XML-Parser-2.44
2.參照書中說明編譯安裝
perl Makefile.PL make -j8 make -j8 test make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf XML-Parser-2.44
編譯安裝intltool包
1.解壓並進入intltool包目錄
tar -xvf intltool-0.51.0.tar.gz cd intltool-0.51.0
2.參照書中的說明編譯安裝
sed -i 's:\\\${:\\\$\\{:' intltool-update.in ./configure --prefix=/usr make -j8 make -j8 check make install install -v -Dm644 doc/I18N-HOWTO /usr/share/doc/intltool-0.51.0/I18N-HOWTO
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf intltool-0.51.0
編譯安裝autoconf包
1.解壓並進入autoconf包目錄
tar -xvf autoconf-2.69.tar.xz cd autoconf-2.69
2.參照書中的說明編譯安裝
sed '361 s/{/\\{/' -i bin/autoscan.in
./configure --prefix=/usr make -j8 make -j8 check make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf autoconf-2.69
編譯安裝automake包
1.解壓並進入automake包目錄
tar -xvf automake-1.16.1.tar.xz cd automake-1.16.1
2.參照書中的說明進行編譯安裝
./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.16.1 make -j8 make -j8 check make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf automake-1.16.1
編譯安裝xz包
1.解壓並進入xz包目錄
tar -xvf xz-5.2.4.tar.xz cd xz-5.2.4
2.參照書中說明編譯安裝
./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/xz-5.2.4 make -j8 make -j8 check make install mv -v /usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} /bin mv -v /usr/lib/liblzma.so.* /lib ln -svf ../../lib/$(readlink /usr/lib/liblzma.so) /usr/lib/liblzma.so
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf xz-5.2.4
編譯安裝kmod包
1.解壓並進入kmod包目錄
tar -xvf kmod-26.tar.xz cd kmod-26
2.參照書中說明編譯安裝
./configure --prefix=/usr \ --bindir=/bin \ --sysconfdir=/etc \ --with-rootlibdir=/lib \ --with-xz \ --with-zlib make -j8 make install for target in depmod insmod lsmod modinfo modprobe rmmod; do ln -sfv ../bin/kmod /sbin/$target done ln -sfv kmod /bin/lsmod
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf kmod-26
編譯安裝gettext包
1.解壓並進入gettext包目錄
tar -xvf gettext-0.19.8.1.tar.xz cd gettext-0.19.8.1
2.參照書中說明編譯安裝
sed -i '/^TESTS =/d' gettext-runtime/tests/Makefile.in && sed -i 's/test-lock..EXEEXT.//' gettext-tools/gnulib-tests/Makefile.in sed -e '/AppData/{N;N;p;s/\.appdata\./.metainfo./}' \ -i gettext-tools/its/appdata.loc ./configure --prefix=/usr \ --disable-static \ --docdir=/usr/share/doc/gettext-0.19.8.1 make -j8 make -j8 check make install chmod -v 0755 /usr/lib/preloadable_libintl.so
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf gettext-0.19.8.1
編譯安裝libelf包
1.Libelf是elfutils-0.176包的一部分,因此須要解壓並進入elfutils-0.173包目錄
tar -xvf elfutils-0.176.tar.bz2 cd elfutils-0.176
2.參照書中說明編譯安裝
./configure --prefix=/usr make -j8 make -j8 check make -C libelf install install -vm644 config/libelf.pc /usr/lib/pkgconfig
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf elfutils-0.176
編譯安裝libffi包
1.解壓並進入libffi包目錄
tar -xvf libffi-3.2.1.tar.gz cd libffi-3.2.1
2.參照書中說明編譯安裝
sed -e '/^includesdir/ s/$(libdir).*$/$(includedir)/' \ -i include/Makefile.in sed -e '/^includedir/ s/=.*$/=@includedir@/' \ -e 's/^Cflags: -I${includedir}/Cflags:/' \ -i libffi.pc.in ./configure --prefix=/usr --disable-static --with-gcc-arch=native make -j8 make -j8 check make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf libffi-3.2.1
編譯安裝openssl包
1.解壓並進入openssl包目錄
tar -xvf openssl-1.1.1a.tar.gz cd openssl-1.1.1a
2.參照書中內容編譯安裝
./config --prefix=/usr \ --openssldir=/etc/ssl \ --libdir=lib \ shared \ zlib-dynamic make -j8 make -j8 test sed -i '/INSTALL_LIBS/s/libcrypto.a libssl.a//' Makefile make MANSUFFIX=ssl install mv -v /usr/share/doc/openssl /usr/share/doc/openssl-1.1.1a
cp -vfr doc/* /usr/share/doc/openssl-1.1.1a
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf openssl-1.1.1a
編譯安裝python包
1.解壓並進入python包目錄
tar -xvf Python-3.7.2.tar.xz cd Python-3.7.2
2.參照書中說明編譯安裝
./configure --prefix=/usr \ --enable-shared \ --with-system-expat \ --with-system-ffi \ --with-ensurepip=yes make -j8 make install chmod -v 755 /usr/lib/libpython3.7m.so chmod -v 755 /usr/lib/libpython3.so install -v -dm755 /usr/share/doc/python-3.7.2/html tar --strip-components=1 \ --no-same-owner \ --no-same-permissions \ -C /usr/share/doc/python-3.7.2/html \ -xvf ../python-3.7.2-docs-html.tar.bz2
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf Python-3.7.2
編譯安裝ninja包
1.解壓並進入ninja包目錄
tar -xvf ninja-1.9.0.tar.gz cd ninja-1.9.0
2.參照書中說明編譯安裝
python3 configure.py --bootstrap python3 configure.py ./ninja ninja_test ./ninja_test --gtest_filter=-SubprocessTest.SetWithLots install -vm755 ninja /usr/bin/ install -vDm644 misc/bash-completion /usr/share/bash-completion/completions/ninja install -vDm644 misc/zsh-completion /usr/share/zsh/site-functions/_ninja
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf ninja-1.9.0
編譯安裝meson包
1.解壓並進入meson包目錄
tar -xvf meson-0.49.2.tar.gz cd meson-0.49.2
2.參照書中說明編譯安裝
python3 setup.py build python3 setup.py install --root=dest cp -rv dest/* /
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf meson-0.49.2
編譯安裝coreutils包
1.解壓並進入coreutils包目錄
tar -xvf coreutils-8.30.tar.xz cd coreutils-8.30
2.參照書中說明編譯安裝
patch -Np1 -i ../coreutils-8.30-i18n-1.patch sed -i '/test.lock/s/^/#/' gnulib-tests/gnulib.mk autoreconf -fiv FORCE_UNSAFE_CONFIGURE=1 ./configure \ --prefix=/usr \ --enable-no-install-program=kill,uptime FORCE_UNSAFE_CONFIGURE=1 make make NON_ROOT_USERNAME=nobody check-root echo "dummy:x:1000:nobody" >> /etc/group chown -Rv nobody . su nobody -s /bin/bash \ -c "PATH=$PATH make RUN_EXPENSIVE_TESTS=yes check" sed -i '/dummy/d' /etc/group make install mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /bin mv -v /usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} /bin mv -v /usr/bin/{rmdir,stty,sync,true,uname} /bin mv -v /usr/bin/chroot /usr/sbin mv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8 sed -i s/\"1\"/\"8\"/1 /usr/share/man/man8/chroot.8 mv -v /usr/bin/{head,nice,sleep,touch} /bin
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf coreutils-8.30
編譯安裝check包
1.解壓並進入check包目錄
tar -xvf check-0.12.0.tar.gz
cd check-0.12.0
2.參照書中說明編譯安裝
./configure --prefix=/usr make -j8 make -j8 check make install sed -i '1 s/tools/usr/' /usr/bin/checkmk
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf check-0.12.0
編譯安裝diffutils包
1.解壓並進入diffutils包目錄
tar -xvf diffutils-3.7.tar.xz cd diffutils-3.7
2.參照書中說明編譯安裝
./configure --prefix=/usr make -j8 make -j8 check make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf diffutils-3.7
編譯安裝gawk包
1.解壓並進入gawk包目錄
tar -xvf gawk-4.2.1.tar.xz cd gawk-4.2.1
2.參照書中說明編譯安裝
sed -i 's/extras//' Makefile.in ./configure --prefix=/usr make -j8 make -j8 check make install mkdir -v /usr/share/doc/gawk-4.2.1 cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-4.2.1
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf gawk-4.2.1
編譯安裝findutils包
1.解壓並進入findutils包目錄
tar -xvf findutils-4.6.0.tar.gz cd findutils-4.6.0
2.參照書中說明編譯安裝
sed -i 's/test-lock..EXEEXT.//' tests/Makefile.in sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' gl/lib/*.c sed -i '/unistd/a #include <sys/sysmacros.h>' gl/lib/mountlist.c echo "#define _IO_IN_BACKUP 0x100" >> gl/lib/stdio-impl.h ./configure --prefix=/usr --localstatedir=/var/lib/locate make -j8 make -j8 check make install mv -v /usr/bin/find /bin sed -i 's|find:=${BINDIR}|find:=/bin|' /usr/bin/updatedb
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf findutils-4.6.0
編譯安裝groff包
1.解壓並進入groff包目錄
tar -xvf groff-1.22.4.tar.gz
cd groff-1.22.4
2.參照書中說明編譯安裝
PAGE=A4 ./configure --prefix=/usr
make -j1 make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf groff-1.22.4
編譯安裝grub包
1.解壓並進入grub包目錄
tar -xvf grub-2.02.tar.xz
cd grub-2.02
2.參照書中說明編譯安裝
./configure --prefix=/usr \
--sbindir=/sbin \ --sysconfdir=/etc \ --disable-efiemu \ --disable-werror make -j8 make install
mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf grub-2.02
編譯安裝less包
1.解壓並進入less包目錄
tar -xvf less-530.tar.gz
cd less-530
2.參照書中說明編譯安裝
./configure --prefix=/usr --sysconfdir=/etc
make -j8 make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf less-530
編譯安裝gzip包
1.解壓並進入bzip包目錄
tar -xvf gzip-1.10.tar.xz
cd gzip-1.10
2.參照書中說明編譯安裝
./configure --prefix=/usr make -j8 make -j8 check make install mv -v /usr/bin/gzip /bin
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf gzip-1.10
編譯安裝iproute包
1.解壓並進入iproute包目錄
tar -xvf iproute2-4.20.0.tar.xz
cd iproute2-4.20.0
2.參照書中說明編譯安裝
sed -i /ARPD/d Makefile
rm -fv man/man8/arpd.8
sed -i 's/.m_ipt.o//' tc/Makefile make -j8 make DOCDIR=/usr/share/doc/iproute2-4.20.0 install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf iproute2-4.20.0
編譯安裝kbd包
1.解壓並進入kbd包目錄
tar -xvf kbd-2.0.4.tar.xz
cd kbd-2.0.4
2.參照書中說明編譯安裝
patch -Np1 -i ../kbd-2.0.4-backspace-1.patch
sed -i 's/\(RESIZECONS_PROGS=\)yes/\1no/g' configure
sed -i 's/resizecons.8 //' docs/man/man8/Makefile.in PKG_CONFIG_PATH=/tools/lib/pkgconfig ./configure --prefix=/usr --disable-vlock make -j8 make -j8 check make install mkdir -v /usr/share/doc/kbd-2.0.4 cp -R -v docs/doc/* /usr/share/doc/kbd-2.0.4
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf kbd-2.0.4
編譯安裝libpipeline包
1.解壓並進入libpipeline包目錄
tar -xvf libpipeline-1.5.1.tar.gz
cd libpipeline-1.5.1
2.參照書中說明編譯安裝
./configure --prefix=/usr
make -j8 make -j8 check make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf libpipeline-1.5.1
編譯安裝make包
1.解壓並進入make包目錄
tar -xvf make-4.2.1.tar.bz2
cd make-4.2.1
2.參照書中說明編譯安裝
sed -i '211,217 d; 219,229 d; 232 d' glob/glob.c
./configure --prefix=/usr make -j8 make PERL5LIB=$PWD/tests/ check make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf make-4.2.1
編譯安裝patch包
1.解壓並進入patch包目錄
tar -xvf patch-2.7.6.tar.xz
cd patch-2.7.6
2.參照書中說明編譯安裝patch包
./configure --prefix=/usr
make -j8 make -j8 check make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf patch-2.7.6
編譯安裝man-db包
1.解壓並進入man-db包目錄
tar -xvf man-db-2.8.5.tar.xz
cd man-db-2.8.5
2.參照書中說明編譯安裝
./configure --prefix=/usr \ --docdir=/usr/share/doc/man-db-2.8.5 \ --sysconfdir=/etc \ --disable-setuid \ --enable-cache-owner=bin \ --with-browser=/usr/bin/lynx \ --with-vgrind=/usr/bin/vgrind \ --with-grap=/usr/bin/grap \ --with-systemdtmpfilesdir= \ --with-systemdsystemunitdir= make -j8 make -j8 check make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf man-db-2.8.5
編譯安裝tar包
1.解壓並進入tar包
tar -xvf tar-1.31.tar.xz
cd tar-1.31
2.參照書中說明編譯安裝
sed -i 's/abort.*/FALLTHROUGH;/' src/extract.c FORCE_UNSAFE_CONFIGURE=1 \ ./configure --prefix=/usr \ --bindir=/bin make -j8 make -j8 check make install make -C doc install-html docdir=/usr/share/doc/tar-1.31
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf tar-1.31
編譯安裝texinfo包
1.解壓並進入texinfo包目錄
tar -xvf texinfo-6.5.tar.xz cd texinfo-6.5
2.參照書中說明編譯安裝
sed -i '5481,5485 s/({/(\\{/' tp/Texinfo/Parser.pm ./configure --prefix=/usr --disable-static make -j8 make -j8 check make install make TEXMF=/usr/share/texmf install-tex pushd /usr/share/info rm -v dir for f in * do install-info $f dir 2>/dev/null done popd
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf texinfo-6.5
編譯安裝util-linux包
1.解壓並進入util-linux包目錄
tar -xvf util-linux-2.32.1.tar.xz cd util-linux-2.32.1
2.參照書中說明編譯安裝
mkdir -pv /var/lib/hwclock rm -vf /usr/include/{blkid,libmount,uuid} ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ --docdir=/usr/share/doc/util-linux-2.32.1 \ --disable-chfn-chsh \ --disable-login \ --disable-nologin \ --disable-su \ --disable-setpriv \ --disable-runuser \ --disable-pylibmount \ --disable-static \ --without-python \ --without-systemd \ --without-systemdsystemunitdir make -j8 chown -Rv nobody . su nobody -s /bin/bash -c "PATH=$PATH make -k check" make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf util-linux-2.32.1
編譯安裝vim包
1.解壓並進入vim包目錄
tar -xvf vim-8.1.tar.bz2 cd vim81/
2.參照書中說明編譯安裝
echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h ./configure --prefix=/usr make -j8 LANG=en_US.UTF-8 make -j1 test &> vim-test.log make install ln -sv vim /usr/bin/vi for L in /usr/share/man/{,*/}man1/vim.1; do ln -sv vim.1 $(dirname $L)/vi.1 done ln -sv ../vim/vim81/doc /usr/share/doc/vim-8.1
3.建立vim配置文件
cat > /etc/vimrc << "EOF" " Begin /etc/vimrc " Ensure defaults are set before customizing settings, not after source $VIMRUNTIME/defaults.vim let skip_defaults_vim=1 set nocompatible set backspace=2 set mouse= syntax on if (&term == "xterm") || (&term == "putty") set background=dark endif " End /etc/vimrc EOF
4.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf vim81/
編譯安裝procps-ng包
1.解壓並進入procps-ng包目錄
tar -xvf procps-ng-3.3.15.tar.xz cd procps-ng-3.3.15
2.參照書中內容編譯安裝
./configure --prefix=/usr \ --exec-prefix= \ --libdir=/usr/lib \ --docdir=/usr/share/doc/procps-ng-3.3.15 \ --disable-static \ --disable-kill make -j8 sed -i -r 's|(pmap_initname)\\\$|\1|' testsuite/pmap.test/pmap.exp sed -i '/set tty/d' testsuite/pkill.test/pkill.exp rm testsuite/pgrep.test/pgrep.exp make -j8 check make install mv -v /usr/lib/libprocps.so.* /lib ln -sfv ../../lib/$(readlink /usr/lib/libprocps.so) /usr/lib/libprocps.so
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf procps-ng-3.3.15
編譯安裝util-linux包
1.解壓並進入util-linux包目錄
tar -xvf util-linux-2.33.1.tar.xz cd util-linux-2.33.1
2.參照書中內容編譯安裝
mkdir -pv /var/lib/hwclock rm -vf /usr/include/{blkid,libmount,uuid} ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ --docdir=/usr/share/doc/util-linux-2.33.1 \ --disable-chfn-chsh \ --disable-login \ --disable-nologin \ --disable-su \ --disable-setpriv \ --disable-runuser \ --disable-pylibmount \ --disable-static \ --without-python \ --without-systemd \ --without-systemdsystemunitdir make -j8 chown -Rv nobody . su nobody -s /bin/bash -c "PATH=$PATH make -k check" make install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf util-linux-2.33.1
編譯安裝e2fsprogs包
1.解壓並進入e2fsprogs包目錄
tar -xvf e2fsprogs-1.44.5.tar.gz
cd e2fsprogs-1.44.5
2.參照書中內容編譯安裝
mkdir -v build cd build ../configure --prefix=/usr \ --bindir=/bin \ --with-root-prefix="" \ --enable-elf-shlibs \ --disable-libblkid \ --disable-libuuid \ --disable-uuidd \ --disable-fsck make -j8 make -j8 check make install make install-libs chmod -v u+w /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a gunzip -v /usr/share/info/libext2fs.info.gz install-info --dir-file=/usr/share/info/dir /usr/share/info/libext2fs.info makeinfo -o doc/com_err.info ../lib/et/com_err.texinfo install -v -m644 doc/com_err.info /usr/share/info install-info --dir-file=/usr/share/info/dir /usr/share/info/com_err.info
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources
rm -rf e2fsprogs-1.44.5
編譯安裝sysklogd包
1.解壓並進入sysklogd包目錄
tar -xvf sysklogd-1.5.1.tar.gz‘ cd sysklogd-1.5.1
2.參照書中說明編譯安裝
sed -i '/Error loading kernel symbols/{n;n;d}' ksym_mod.c sed -i 's/union wait/int/' syslogd.c make -j8 make BINDIR=/sbin install
3.建立配置文件
cat > /etc/syslog.conf << "EOF" # Begin /etc/syslog.conf auth,authpriv.* -/var/log/auth.log *.*;auth,authpriv.none -/var/log/sys.log daemon.* -/var/log/daemon.log kern.* -/var/log/kern.log mail.* -/var/log/mail.log user.* -/var/log/user.log *.emerg * # End /etc/syslog.conf EOF
4.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf sysklogd-1.5.1
編譯安裝sysvinit包
1.解壓並進入sysvinit包目錄
tar -xvf sysvinit-2.93.tar.xz cd sysvinit-2.93
2.參照書中內容編譯安裝
patch -Np1 -i ../sysvinit-2.93-consolidated-1.patch make -C src make -C src install
3.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf sysvinit-2.93
編譯安裝eudev包
1.解壓並進入eudev包目錄
tar -xvf eudev-3.2.7.tar.gz cd eudev-3.2.7
2.參照書中說明編譯安裝
cat > config.cache << "EOF" HAVE_BLKID=1 BLKID_LIBS="-lblkid" BLKID_CFLAGS="-I/tools/include" EOF ./configure --prefix=/usr \ --bindir=/sbin \ --sbindir=/sbin \ --libdir=/usr/lib \ --sysconfdir=/etc \ --libexecdir=/lib \ --with-rootprefix= \ --with-rootlibdir=/lib \ --enable-manpages \ --disable-static \ --config-cache LIBRARY_PATH=/tools/lib make mkdir -pv /lib/udev/rules.d mkdir -pv /etc/udev/rules.d make LD_LIBRARY_PATH=/tools/lib check make LD_LIBRARY_PATH=/tools/lib install tar -xvf ../udev-lfs-20171102.tar.bz2 make -f udev-lfs-20171102/Makefile.lfs install
3.每次更新硬件信息時都須要運行此命令
LD_LIBRARY_PATH=/tools/lib udevadm hwdb --update
4.返回sources目錄並刪除包目錄
cd /mnt/lfs/sources rm -rf eudev-3.2.7
從二進制文件和庫中刪除調試符號 按照書籍中的命令操做便可(可選)建議執行此項操做
save_lib="ld-2.29.so libc-2.29.so libpthread-2.29.so libthread_db-1.0.so" cd /lib for LIB in $save_lib; do objcopy --only-keep-debug $LIB $LIB.dbg strip --strip-unneeded $LIB objcopy --add-gnu-debuglink=$LIB.dbg $LIB done save_usrlib="libquadmath.so.0.0.0 libstdc++.so.6.0.25 libitm.so.1.0.0 libatomic.so.1.2.0" cd /usr/lib for LIB in $save_usrlib; do objcopy --only-keep-debug $LIB $LIB.dbg strip --strip-unneeded $LIB objcopy --add-gnu-debuglink=$LIB.dbg $LIB done unset LIB save_lib save_usrlib exec /tools/bin/bash /tools/bin/find /usr/lib -type f -name \*.a \ -exec /tools/bin/strip --strip-debug {} ';' /tools/bin/find /lib /usr/lib -type f \( -name \*.so* -a ! -name \*dbg \) \ -exec /tools/bin/strip --strip-unneeded {} ';' /tools/bin/find /{bin,sbin} /usr/{bin,sbin,libexec} -type f \ -exec /tools/bin/strip --strip-all {} ';'
1.清理運行測試剩下的一些額外文件
rm -rf /tmp/*
2.退出
exit
3.chroot進入lfs系統目錄
chroot "$LFS" /usr/bin/env -i \ HOME=/root TERM="$TERM" \ PS1='(lfs chroot) \u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ /bin/bash --login
4.刪除tools目錄
rm -rf tools/
5.刪除無用的庫
rm -f /usr/lib/lib{bfd,opcodes}.a rm -f /usr/lib/libbz2.a rm -f /usr/lib/lib{com_err,e2p,ext2fs,ss}.a rm -f /usr/lib/libltdl.a rm -f /usr/lib/libfl.a rm -f /usr/lib/libz.a find /usr/lib /usr/libexec -name \*.la -delete
lfs(systemv版本)學習筆記第4頁:http://www.javashuo.com/article/p-dbuyybzf-be.html