目前中英文版有版本上的差異所以建議英文版為主
================ 先前準備 ================
在時做之前請先執行此script看看自己的linux Host缺少了什麼套件
[root@localhost /]# cat > version-check.sh << "EOF"
> #!/bin/bash
> export LC_ALL=C
> # Simple script to list version numbers of critical development tools
> bash --version | head -n1 | cut -d" " -f2-4
> echo "/bin/sh -> `readlink -f /bin/sh`"
> echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-
> bison --version | head -n1
> if [ -e /usr/bin/yacc ];
> then echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`";
> else echo "yacc not found"; fi
> bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f1,6-
> echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2
> diff --version | head -n1
> find --version | head -n1
> gawk --version | head -n1
> if [ -e /usr/bin/awk ];
> then echo "/usr/bin/awk -> `readlink -f /usr/bin/awk`";
> else echo "awk not found"; fi
> gcc --version | head -n1
> /lib/libc.so.6 | head -n1 | cut -d"," -f1
> grep --version | head -n1
> gzip --version | head -n1
> cat /proc/version
> m4 --version | head -n1
> make --version | head -n1
> patch --version | head -n1
> echo perl `perl -V:version`
> sed --version | head -n1
> tar --version | head -n1
> echo "Texinfo: `makeinfo --version | head -n1`"
> xz --version | head -n1
> echo 'main(){}' > dummy.c && gcc -o dummy dummy.c
> if [ -x dummy ]; then echo "Compilation OK";
> else echo "Compilation failed"; fi
> rm -f dummy.c dummy
> EOF
bash version-check.sh
在CentOs 64bit中缺少了
1. yacc
[root@localhost /]# yum install byacc
2. glibc-2.5.1[root@localhost /]# yum install glibc*
3. perl[root@localhost /]# yum install perl*
4. texinfo[root@localhost /]# yum install texinfo
5. bison[root@localhost /]# yum install bison
6. Xz[root@localhost /]# yum install xz
================ 軟體下載 ================
下載lfs需要的軟體
下載的方式有很多種我是選擇下載全部軟體的壓縮檔
================ 建立環境 ================
Chapter 2. Preparing a New Partition
2.2. Creating a New Partition
新增一個10G空間的磁區給系統
[root@localhost /]# fdisk -l #看一下新增的10G系統是否有找到
2.3. Creating a File System on the Partition
[root@localhost /]# mke2fs -jv /dev/<xxx> #xxx代表新增的磁區目前是sdb
.......
Proceed anyway? (y,n) y #打y就會開始建立
2.4. Mounting the New Partition
[root@localhost /]# export LFS=/mnt/lfs
[root@localhost /]# mkdir -pv $LFS #在mnt下建立lfs資料夾
[root@localhost /]# mount -v -t ext3 /dev/sdb $LFS #/dev/sdb mount到mnt/lfs格式為ext3
Chapter 3. Packages and Patches
[root@localhost /]# mkdir -v $LFS/sources
[root@localhost /]# cp /home/lfs-packages-7.0.tar $LFS/sources
[root@localhost /]# tar -jxvf $LFS/sources/lfs-packages-7.0.tar
[root@localhost /]# mv $LFS/sources/7.0/* $LFS/sources/
[root@localhost /]# chmod -v a+wt $LFS/sources
Chapter 4. Final Preparations
[root@localhost /]# echo $LFS
/mnt/lfs
[root@localhost /]# export LFS=/mnt/lfs
4.2. Creating the $LFS/tools Directory
[root@localhost /]# mkdir -v $LFS/tools
[root@localhost /]# ln -sv $LFS/tools /
/tools -> /mnt/lfs/tools
[root@localhost /]# ll #查看連接是否建立成功
4.3. Adding the LFS User
[root@localhost /]# groupadd lfs
[root@localhost /]# useradd -s /bin/bash -g lfs -m -k /dev/null lfs
[root@localhost /]# passwd lfs
請輸入新密碼....
[root@localhost /]# chown -v lfs $LFS/tools
[root@localhost /]# chown -v lfs $LFS/sources
[root@localhost /]# su - lfs
-bash-4.1$
4.4. Setting Up the Environment
-bash-4.1$ cat > ~/.bash_profile << "EOF"
> exec env -i HOME=$HOME TERM=$TERM PS1='\u: \w\$ ' /bin/bash
> EOF
-bash-4.1$ cat > ~/.bashrc << "EOF"
> set +h
> umask 022
> LFS=/mnt/lfs
> LC_ALL=POSIX
> LFS_TGT=$(uname -m)-lfs-linux-gnu
> PATH=/tools/bin:/bin:/usr/bin
> export LFS LC_ALL LFS_TGT PATH
> EOF
-bash-4.1$ source ~/.bash_profile
lfs: ~$
Chapter 5. Constructing a Temporary System
5.2. Toolchain Technical Notes
在繼續之前要先知道工作平台名稱即"target triplet" or動態連接器[dynamic linker]的名稱
有兩種方式可得知
lfs [ ~ ]# ./mnt/lfs/sources/binutils-2.21.1/config.guess
x86_64-unknown-linux-gnu
lfs [ ~ ]# readelf -l /bin/raw | grep interpreter
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
怎麼會出現兩種結果不同,目前還不清楚,推測是執行bin file是在HOST下所以結果不同
5.3. Binutils-2.17 - Pass 1
The Binutils package contains a linker, an assembler, and other tools for handling object files.
5.4.1. Installation of Cross Binutils
lfs: ~$ cd /mnt/lfs/sources
lfs: /mnt/lfs/sources$ tar xvf binutils-2.21.1a.tar.bz2
lfs: /mnt/lfs/sources$ cd binutils-2.21.1
lfs: /mnt/lfs/sources/binutils-2.21.1$ mkdir -v ../binutils-build #會在/mnt/lfs/sources建立一個binutils-build資料夾
lfs: /mnt/lfs/sources/binutils-2.21.1$ cd ..binutils-build
lfs: /mnt/lfs/sources/binutils-build$ ../binutils-2.21.1/configure \
> --target=$LFS_TGT --prefix=/tools \
> --disable-nls --disable-werror
.........
config.status: creating Makefile
lfs: /mnt/lfs/sources/binutils-build$
lfs: /mnt/lfs/sources/binutils-build$ make
lfs: /mnt/lfs/sources/binutils-build$ case $(uname -m) in
> x86_64) mkdir -v /tools/lib && ln -sv lib /tools/lib64 ;;
> esac
lfs: /mnt/lfs/sources/binutils-build$ make install
lfs: /mnt/lfs/sources/binutils-build$ cd ..
lfs: /mnt/lfs/sources$ rm -fr binutils-build
5.5. GCC-4.6.1 - Pass 1
The GCC package contains the GNU compiler collection, which includes the C and C++ compilers
5.5.1. Installation of Cross GCC
lfs: ~$ cd /mnt/lfs/sources
lfs: /mnt/lfs/sources$ tar xvf gcc-4.6.1.tar.bz2
lfs: /mnt/lfs/sources$ cd gcc-4.6.1
lfs: /mnt/lfs/sources/gcc-4.6.1$ tar -jxf ../mpfr-3.1.0.tar.bz2 #解壓到/mnt/lfs/sources/gcc-4.6.1/
lfs: /mnt/lfs/sources/gcc-4.6.1$ mv -v mpfr-3.1.0 mpfr
lfs: /mnt/lfs/sources/gcc-4.6.1$ tar -jxf ../gmp-5.0.2.tar.bz2
lfs: /mnt/lfs/sources/gcc-4.6.1$ mv -v gmp-5.0.2 gmp
lfs: /mnt/lfs/sources/gcc-4.6.1$ tar -zxf ../mpc-0.9.tar.gz
lfs: /mnt/lfs/sources/gcc-4.6.1$ mv -v mpc-0.9 mpc
lfs: /mnt/lfs/sources/gcc-4.6.1$ patch -Np1 -i ../gcc-4.6.1-cross_compile-1.patch
lfs: /mnt/lfs/sources/gcc-4.6.1$ mkdir ../gcc-build #會在/mnt/lfs/sources建立一個gcc-build資料夾
lfs: /mnt/lfs/sources/gcc-4.6.1$ cd ../gcc-build
lfs: /mnt/lfs/sources/gcc-build$ ../gcc-4.6.1/configure \
> --target=$LFS_TGT --prefix=/tools \
> --disable-nls --disable-shared --disable-multilib \
> --disable-decimal-float --disable-threads \
> --disable-libmudflap --disable-libssp \
> --disable-libgomp --disable-libquadmath \
> --disable-target-libiberty --disable-target-zlib \
> --enable-languages=c --without-ppl --without-cloog \
> --with-mpfr-include=$(pwd)/../gcc-4.6.1/mpfr/src \
> --with-mpfr-lib=$(pwd)/mpfr/src/.libs
..............
config.status: creating Makefile
lfs: /mnt/lfs/sources/gcc-build$
lfs: /mnt/lfs/sources/gcc-build$ make
lfs: /mnt/lfs/sources/gcc-build$ make install
lfs: /mnt/lfs/sources/gcc-build$ ln -vs libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | \
> sed 's/libgcc/&_eh/'`
lfs: /mnt/lfs/sources/gcc-build$ cd ..
lfs: /mnt/lfs/sources$ rm -rf gcc-build gcc-4.6.1
5.6. Linux-3.1 API Headers
lfs: /mnt/lfs/sources$ tar xvf linux-3.1.tar.bz2
lfs: /mnt/lfs/sources$ cd linux-3.1
5.6.1. Installation of Linux API Headers
make mrproper 會移除先前重製核心時不必要的殘餘檔案, 這樣可以避免這些檔案對原始碼目錄樹產生不必要的干擾. 執行 make mrproper 時, 會砍除設定配置檔 .config, 如果您認為它很重要的話, 應該予以備份.
lfs: /mnt/lfs/sources/linux-3.1$ make mrproper
lfs: /mnt/lfs/sources/linux-3.1$ make headers_check
lfs: /mnt/lfs/sources/linux-3.1$ make INSTALL_HDR_PATH=dest headers_install
lfs: /mnt/lfs/sources/linux-3.1$ cp -rv dest/include/* /tools/include
Kernel 重製
lfs: /mnt/lfs/sources/linux-3.1$ cd ..
lfs: /mnt/lfs/sources$ rm -fr linux-3.1
5.7. Glibc-2.14.1
The Glibc package contains the main C library. This library provides the basic routines for allocating memory,searching directories, opening and closing files, reading and writing files, string handling, pattern matching,arithmetic, and so on.
lfs: /mnt/lfs/sources$ tar xvf glibc-2.14.1.tar.bz2
lfs: /mnt/lfs/sources$ cd glibc-2.14.1
lfs: /mnt/lfs/sources/glibc-2.14.1$ patch -Np1 -i ../glibc-2.14.1-gcc_fix-1.patch
lfs: /mnt/lfs/sources/glibc-2.14.1$ patch -Np1 -i ../glibc-2.14.1-cpuid-1.patch
lfs: /mnt/lfs/sources/glibc-2.14.1$ mkdir ../glibc-build #會在/mnt/lfs/sources建立一個glibc-build資料夾
lfs: /mnt/lfs/sources/glibc-2.14.1$ cd ../glibc-build
lfs: /mnt/lfs/sources/glibc-build$ case `uname -m` in
> i?86) echo "CFLAGS += -march=i486 -mtune=native" > configparms ;;
> esac
lfs: /mnt/lfs/sources/glibc-build$ ../glibc-2.14.1/configure --prefix=/tools \
> --host=$LFS_TGT --build=$(../glibc-2.14.1/scripts/config.guess) \
> --disable-profile --enable-add-ons \
> --enable-kernel=2.6.25 --with-headers=/tools/include \
..............
configure: creating ./config.status
config.status: creating config.make
config.status: creating Makefile
config.status: creating config.h
config.status: executing default commands
lfs: /mnt/lfs/sources/glibc-build$ make
lfs: /mnt/lfs/sources/glibc-build$ make install
lfs: /mnt/lfs/sources/glibc-build$ cd ..
lfs: /mnt/lfs/sources$ rm -fr glibc-2.14.1 glibc-build
5.8. Adjusting the Toolchain
lfs: /mnt/lfs/sources$ SPECS=`dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/specs
lfs: /mnt/lfs/sources$ $LFS_TGT-gcc -dumpspecs | sed \
> -e 's@/lib\(64\)\?/ld@/tools&@g' \
> -e "/^\*cpp:$/{n;s,$, -isystem /tools/include,}" > $SPECS
lfs: /mnt/lfs/sources$ echo "New specs file is: $SPECS"
lfs: /mnt/lfs/sources$ unset SPECS
lfs: /mnt/lfs/sources$ echo 'main(){}' > dummy.c
lfs: /mnt/lfs/sources$ $LFS_TGT-gcc -B/tools/lib dummy.c
lfs: /mnt/lfs/sources$ readelf -l a.out | grep ': /tools'
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
lfs: /mnt/lfs/sources/glibc-build$ rm -v dummy.c a.out
removed `dummy.c`
removed `a.out`
5.9. Binutils-2.21.1a - Pass 2
The Binutils package contains a linker, an assembler, and other tools for handling object files
5.9.1. Installation of Binutils
lfs: /mnt/lfs/sources$ mkdir -v ../binutils-build
lfs: /mnt/lfs/sources$ cd ../binutils-build
lfs: /mnt/lfs/sources/binutils-build$ CC="$LFS_TGT-gcc -B/tools/lib/" \
> AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \
> ../binutils-2.21.1/configure --prefix=/tools \
> --disable-nls --with-lib-path=/tools/lib
lfs: /mnt/lfs/sources/binutils-build$ make
lfs:/mnt/lfs/sources/binutils-build$ make install
lfs: /mnt/lfs/sources/binutils-build$ make -C ld clean
lfs: /mnt/lfs/sources/binutils-build$ make -C ld LIB_PATH=/usr/lib:/lib
lfs: /mnt/lfs/sources/binutils-build$ cp -v ld/ld-new /tools/bin
5.10. GCC-4.6.1 - Pass 2
The GCC package contains the GNU compiler collection, which includes the C and C++ compilers
5.10.1. Installation of GCC
lfs: /mnt/lfs/sources$ tar xvf gcc-4.6.1.tar.bz2
lfs: /mnt/lfs/sources$ cd gcc-4.6.1
lfs: /mnt/lfs/sources/gcc-4.6.1$ patch -Np1 -i ../gcc-4.6.1-startfiles_fix-1.patch
lfs: /mnt/lfs/sources/gcc-4.6.1$ cp -v gcc/Makefile.in{,.orig}
lfs: /mnt/lfs/sources/gcc-4.6.1$ sed 's@\./fixinc\.sh@-c true@' gcc/Makefile.in.orig > gcc/Makefile.in
lfs: /mnt/lfs/sources/gcc-4.6.1$ cp -v gcc/Makefile.in{,.tmp}
lfs: /mnt/lfs/sources/gcc-4.6.1$ sed 's/^T_CFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \
> > gcc/Makefile.in
lfs: /mnt/lfs/sources/gcc-4.6.1$ for 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_INCLUDE_DIR
> #define STANDARD_INCLUDE_DIR 0
> #define STANDARD_STARTFILE_PREFIX_1 ""
> #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
> touch $file.orig
> done
gcc/config/m68k/linux.h' -> `gcc/config/m68k/linux.h.orig'
lfs: /mnt/lfs/sources/gcc-4.6.1$ case $(uname -m) in
> x86_64)
> for file in $(find gcc/config -name t-linux64) ; do \
> cp -v $file{,.orig}
> sed '/MULTILIB_OSDIRNAMES/d' $file.orig > $file
> done
> ;;
> esac
...........
gcc/config/pa/t-linux64' -> `gcc/config/pa/t-linux64.orig'
lfs: /mnt/lfs/sources/gcc-4.6.1$ tar -jxf ../mpfr-3.1.0.tar.bz2 #解壓到/mnt/lfs/sources/gcc-4.6.1/
lfs: /mnt/lfs/sources/gcc-4.6.1$ mv -v mpfr-3.1.0 mpfr
lfs: /mnt/lfs/sources/gcc-4.6.1$ tar -jxf ../gmp-5.0.2.tar.bz2
lfs: /mnt/lfs/sources/gcc-4.6.1$ mv -v gmp-5.0.2 gmp
lfs: /mnt/lfs/sources/gcc-4.6.1$ tar -zxf ../mpc-0.9.tar.gz
lfs: /mnt/lfs/sources/gcc-4.6.1$ mv -v mpc-0.9 mpc
lfs: /mnt/lfs/sources$ mkdir -v ../gcc-build
lfs: /mnt/lfs/sources/gcc-4.6.1$ cd ../gcc-build
lfs: /mnt/lfs/sources/gcc-build$ CC="$LFS_TGT-gcc -B/tools/lib/" \
> AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \
> ../gcc-4.6.1/configure --prefix=/tools \
> --with-local-prefix=/tools --enable-clocale=gnu \
> --enable-shared --enable-threads=posix \
> --enable-__cxa_atexit --enable-languages=c,c++ \
> --disable-libstdcxx-pch --disable-multilib \
> --disable-bootstrap --disable-libgomp \
> --without-ppl --without-cloog \
> --with-mpfr-include=$(pwd)/../gcc-4.6.1/mpfr/src \
> --with-mpfr-lib=$(pwd)/mpfr/src/.libs
lfs: /mnt/lfs/sources/gcc-build$ make
lfs: /mnt/lfs/sources/gcc-build$ make install
lfs: /mnt/lfs/sources/gcc-build$ ln -vs gcc /tools/bin/cc
`/tools/bin/cc' -> `gcc'
lfs: /mnt/lfs/sources/gcc-build$echo 'main(){}' > dummy.c
lfs: /mnt/lfs/sources/gcc-build$ cc dummy.c
lfs: /mnt/lfs/sources/glibc-build$ readelf -l a.out | grep ': /tools'
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
lfs: /mnt/lfs/sources/gcc-build$ rm -v dummy.c a.out
removed `dummy.c'
removed `a.out
lfs: /mnt/lfs/sources/gcc-build$ cd ..
lfs: /mnt/lfs/sources$ rm -rf gcc-build gcc-4.6.1
5.11. Tcl-8.5.10
The Tcl package contains the Tool Command Language
5.11.1. Installation of Tcl
lfs: /mnt/lfs/sources$ tar xvf tcl8.5.10-src.tar.gz
lfs: /mnt/lfs/sources$ cd tcl8.5.10/unix/
lfs: /mnt/lfs/sources/tcl8.5.10/unix$
lfs: /mnt/lfs/sources/tcl8.5.10/unix$ ./configure --prefix=/tools
..................
configure: creating ./config.status
config..status: creating Makefile
config.status: creating dltest/Makefile
config.status: creating tclConfig.sh
lfs: /mnt/lfs/sources/tcl8.5.10/unix$
lfs: /mnt/lfs/sources/tcl8.5.10/unix$ make
lfs: /mnt/lfs/sources/tcl8.5.10/unix$ TZ=UTC make test
lfs: /mnt/lfs/sources/tcl8.5.10/unix$ make install
lfs: /mnt/lfs/sources/tcl8.5.10/unix$ chmod -v u+w /tools/lib/libtcl8.5.so
mode of `/tools/lib/libtcl8.5.so' changed to 0755 (rwxr-xr-x)
lfs: /mnt/lfs/sources/tcl8.5.10/unix$ make install-private-headers
Installing private header files
lfs: /mnt/lfs/sources/tcl8.5.10/unix$ ln -sv tclsh8.5 /tools/bin/tclsh
`/tools/bin/tclsh' -> `tclsh8.5'
lfs: /mnt/lfs/sources/tcl8.5.10/unix$ cd ../..
lfs: /mnt/lfs/sources$ rm -rf tcl8.5.10/
5.12. Expect-5.45
The Expect package contains a program for carrying out scripted dialogues with other interactive programs
5.12.1. Installation of Expect
lfs: /mnt/lfs/sources$ tar xvf expect5.45.tar.gz
lfs: /mnt/lfs/sources$ cd expect5.45
lfs: /mnt/lfs/sources/expect5.45$
lfs: /mnt/lfs/sources/expect5.45$ cp -v configure{,.orig}
`configure' -> `configure.orig'
lfs: /mnt/lfs/sources/expect5.45$ sed 's:/usr/local/bin:/bin:' configure.orig > configure
lfs: /mnt/lfs/sources/expect5.45$ ./configure --prefix=/tools --with-tcl=/tools/lib \
> --with-tclinclude=/tools/include
.........
config.status: creating Makefile
lfs: /mnt/lfs/sources/expect5.45$ make
lfs: /mnt/lfs/sources/expect5.45$ make test
............
all.tcl: Total 29 Passed 29 Skipped 0 Failed 0
Sourced 0 Test Files.
lfs: /mnt/lfs/sources/expect5.45$ make SCRIPTS="" install
lfs: /mnt/lfs/sources/expect5.45$ cd ..
lfs: /mnt/lfs/sources$ rm -rf expect5.45/
5.13. DejaGNU-1.5
The DejaGNU package contains a framework for testing other programs
5.13.1. Installation of DejaGNU
lfs: /mnt/lfs/sources$ tar xvf dejagnu-1.5.tar.gz
lfs: /mnt/lfs/sources$ cd dejagnu-1.5/
lfs: /mnt/lfs/sources/dejagnu-1.5$
lfs: /mnt/lfs/sources/dejagnu-1.5$./configure --prefix=/tools
..............
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
lfs: /mnt/lfs/sources/dejagnu-1.5$ make install
lfs: /mnt/lfs/sources/dejagnu-1.5$ make check
.......
# of expected passes 66
make[1]: Leaving directory `/mnt/lfs/sources/dejagnu-1.5'
lfs: /mnt/lfs/sources/dejagnu-1.5$ cd ..
lfs: /mnt/lfs/sources$ rm -rf dejagnu-1.5/
5.14. Check-0.9.8
Check is a unit testing framework for C
5.14.1. Installation of Check
lfs: /mnt/lfs/sources$ tar xvf check-0.9.8.tar.gz
lfs: /mnt/lfs/sources$ cd check-0.9.8
lfs: /mnt/lfs/sources/check-0.9.8$
lfs: /mnt/lfs/sources/check-0.9.8$ ./configure --prefix=/tools
.............
configure: creating ./config.status
config.status: creating check.pc
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating lib/Makefile
config.status: creating src/check.h
config.status: creating src/Makefile
config.status: creating tests/Makefile
config.status: creating tests/test_vars
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
lfs: /mnt/lfs/sources/check-0.9.8$ make
lfs: /mnt/lfs/sources/check-0.9.8$ make check
................
PASS: check_check
PASS: test_output.sh
PASS: test_xml_output.sh
PASS: test_log_output.sh
==================
All 5 tests passed
==================
lfs: /mnt/lfs/sources/check-0.9.8$ make install
lfs: /mnt/lfs/sources/check-0.9.8$ cd ..
lfs: /mnt/lfs/sources$ rm -rf check-0.9.8/
5.15. Ncurses-5.9
The Ncurses package contains libraries for terminal-independent handling of character screens
5.15.1. Installation of Ncurses
lfs: /mnt/lfs/sources$ tar xvf ncurses-5.9.tar.gz
lfs: /mnt/lfs/sources$ cd ncurses-5.9/
lfs: /mnt/lfs/sources/ncurses-5.9$
lfs: /mnt/lfs/sources/ncurses-5.9$ ./configure --prefix=/tools --with-shared \
> --without-debug --without-ada --enable-overwrite
.............
** Configuration summary for NCURSES 5.9 20110404:
extended funcs: yes
xterm terminfo: xterm-new
bin directory: /tools/bin
lib directory: /tools/lib
include directory: /tools/include
man directory: /tools/man
terminfo directory: /tools/share/terminfo
lfs: /mnt/lfs/sources/ncurses-5.9$
lfs: /mnt/lfs/sources/ncurses-5.9$ make
lfs: /mnt/lfs/sources/ncurses-5.9$ make install
lfs: /mnt/lfs/sources/ncurses-5.9$ cd ..
lfs: /mnt/lfs/sources$ rm -rf ncurses-5.9/
5.16. Bash-4.2
The Bash package contains the Bourne-Again SHell
5.16.1. Installation of Bash
lfs: /mnt/lfs/sources$ tar xvf bash-4.2.tar.gz
lfs: /mnt/lfs/sources$ cd bash-4.2
lfs: /mnt/lfs/sources/bash-4.2$
lfs: /mnt/lfs/sources/bash-4.2$ patch -Np1 -i ../bash-4.2-fixes-3.patch
lfs: /mnt/lfs/sources/bash-4.2$ ./configure --prefix=/tools --without-bash-malloc
.............
config.status: creating po/POTFILES
config.status: creating po/Makefile
config.status: executing default commands
lfs: /mnt/lfs/sources/bash-4.2$ make
................
text data bss dec hex filename
878982 35928 23112 938022 e5026 bash
lfs: /mnt/lfs/sources/bash-4.2$ make tests
lfs: /mnt/lfs/sources/bash-4.2$ make install
lfs: /mnt/lfs/sources/bash-4.2$ ln -vs bash /tools/bin/sh
`/tools/bin/sh' -> `bash'
lfs: /mnt/lfs/sources/bash-4.2$ cd ..
lfs: /mnt/lfs/sources$ rm -rf bash-4.2/
5.17. Bzip2-1.0.6
The Bzip2 package contains programs for compressing and decompressing files. Compressing text files with bzip2,yields a much better compression percentage than with the traditional gzip
5.17.1. Installation of Bzip2
lfs: /mnt/lfs/sources$ tar xvf bzip2-1.0.6.tar.gz
lfs: /mnt/lfs/sources$ cd bzip2-1.0.6/
lfs: /mnt/lfs/sources/bzip2-1.0.6$
lfs: /mnt/lfs/sources/bzip2-1.0.6$ make
........
You can also do "bzip2 --help" to see some helpful information.
"bzip2 -L" displays the software license.
lfs: /mnt/lfs/sources/bzip2-1.0.6$ make PREFIX=/tools install
........
echo ".so man1/bzmore.1" > /tools/man/man1/bzless.1
echo ".so man1/bzdiff.1" > /tools/man/man1/bzcmp.1
lfs: /mnt/lfs/sources/bzip2-1.0.6$ cd ..
lfs: /mnt/lfs/sources$ rm -rf bzip2-1.0.6/
5.18. Coreutils-8.14
The Coreutils package contains utilities for showing and setting the basic system characteristics
5.18.1. Installation of Coreutils
lfs: /mnt/lfs/sources$ tar xvf coreutils-8.14.tar.xz
lfs: /mnt/lfs/sources$ cd coreutils-8.14
lfs: /mnt/lfs/sources/coreutils-8.14$
lfs: /mnt/lfs/sources/coreutils-8.14$ ./configure --prefix=/tools --enable-install-program=hostname
.............
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
lfs: /mnt/lfs/sources/coreutils-8.14$ make
lfs: /mnt/lfs/sources/coreutils-8.14$ make RUN_EXPENSIVE_TESTS=yes check
.......
=======================
All 258 tests passed
(36 tests were not run)
=======================
lfs: /mnt/lfs/sources/coreutils-8.14$ make install
lfs: /mnt/lfs/sources/coreutils-8.14$ cp -v src/su /tools/bin/su-tools
`src/su' -> `/tools/bin/su-tools'
lfs: /mnt/lfs/sources/coreutils-8.14$ cd ..
lfs: /mnt/lfs/sources$ rm -rf coreutils-8.14/
5.19. Diffutils-3.2
The Diffutils package contains programs that show the differences between files or directories.
5.19.1. Installation of Diffutils
lfs: /mnt/lfs/sources$ tar xvf diffutils-3.2.tar.gz
lfs: /mnt/lfs/sources$ cd diffutils-3.2/
lfs: /mnt/lfs/sources/diffutils-3.2$
lfs: /mnt/lfs/sources/diffutils-3.2$ ./configure --prefix=/tools
..............
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
lfs: /mnt/lfs/sources/diffutils-3.2$ make
lfs: /mnt/lfs/sources/diffutils-3.2$ make check
............
=======================
All 93 tests passed
(28 tests were not run)
=======================
lfs: /mnt/lfs/sources/diffutils-3.2$ make install
lfs: /mnt/lfs/sources/diffutils-3.2$ cd ..
lfs: /mnt/lfs/sources$ rm -rf diffutils-3.2/
5.20. File-5.09
The File package contains a utility for determining the type of a given file or files.
5.20.1. Installation of File
lfs: /mnt/lfs/sources$ tar xvf file-5.09.tar.gz
lfs: /mnt/lfs/sources$ cd file-5.09
lfs: /mnt/lfs/sources/file-5.09$
lfs: /mnt/lfs/sources/file-5.09$ ./configure --prefix=/tools
............
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
lfs: /mnt/lfs/sources/file-5.09$ make
lfs: /mnt/lfs/sources/file-5.09$ make check
lfs: /mnt/lfs/sources/file-5.09$ make install
lfs: /mnt/lfs/sources/file-5.09$ cd ..
lfs: /mnt/lfs/sources$ rm -rf file-5.09/
5.21. Findutils-4.4.2
The Findutils package contains programs to find files. These programs are provided to recursively search through a directory tree and to create, maintain, and search a database (often faster than the recursive find, but unreliable if the database has not been recently updated).
5.21.1. Installation of Findutils
lfs: /mnt/lfs/sources$ tar xvf findutils-4.4.2.tar.gz
lfs: /mnt/lfs/sources$ cd findutils-4.4.2/
lfs: /mnt/lfs/sources/findutils-4.4.2$
lfs: /mnt/lfs/sources/findutils-4.4.2$ ./configure --prefix=/tools
...........
config.status: creating po/Makefile
lfs: /mnt/lfs/sources/findutils-4.4.2$ make
lfs: /mnt/lfs/sources/findutils-4.4.2$ make check
lfs: /mnt/lfs/sources/findutils-4.4.2$ make install
lfs: /mnt/lfs/sources/findutils-4.4.2$ cd ..
lfs: /mnt/lfs/sources$ rm -rf findutils-4.4.2/
5.22. Gawk-4.0.0
The Gawk package contains programs for manipulating text files
5.22.1. Installation of Gawk
lfs: /mnt/lfs/sources$ tar xvf gawk-4.0.0.tar.bz2
lfs: /mnt/lfs/sources$ cd gawk-4.0.0/
lfs: /mnt/lfs/sources/gawk-4.0.0$
lfs: /mnt/lfs/sources/gawk-4.0.0$ ./configure --prefix=/tools
............
config.status: creating po/Makefile
lfs: /mnt/lfs/sources/gawk-4.0.0$ make
lfs: /mnt/lfs/sources/gawk-4.0.0$ make ckeck
lfs: /mnt/lfs/sources/gawk-4.0.0$ make install
lfs: /mnt/lfs/sources/gawk-4.0.0$ cd ..
lfs: /mnt/lfs/sources$ rm -rf gawk-4.0.0/
5.23. Gettext-0.18.1.1
The Gettext package contains utilities for internationalization and localization. These allow programs to be compiled with NLS (Native Language Support), enabling them to output messages in the user's native language
5.23.1. Installation of Gettext
lfs: /mnt/lfs/sources$ tar xvf gettext-0.18.1.1.tar.gz
lfs: /mnt/lfs/sources$ cd gettext-0.18.1.1
lfs: /mnt/lfs/sources/gettext-0.18.1.1$ cd gettext-tools
lfs: /mnt/lfs/sources/gettext-0.18.1.1/gettext-tools$
lfs: /mnt/lfs/sources/gettext-0.18.1.1/gettext-tools$ ./configure --prefix=/tools --disable-shared
................
config.status: executing po-directories commands
lfs: /mnt/lfs/sources/gettext-0.18.1.1/gettext-tools$ make -C gnulib-lib
lfs: /mnt/lfs/sources/gettext-0.18.1.1/gettext-tools$ make -C src msgfmt
lfs: /mnt/lfs/sources/gettext-0.18.1.1/gettext-tools$ cp -v src/msgfmt /tools/bin
`src/msgfmt' -> `/tools/bin/msgfmt'
lfs: /mnt/lfs/sources/gettext-0.18.1.1/gettext-tools$ cd ../..
lfs: /mnt/lfs/sources$ rm -rf gettext-0.18.1.1/
5.24. Grep-2.9
The Grep package contains programs for searching through files
5.24.1. Installation of Grep
lfs: /mnt/lfs/sources$ tar xvf grep-2.9.tar.gz
lfs: /mnt/lfs/sources$ cd grep-2.9
lfs: /mnt/lfs/sources/grep-2.9$
lfs: /mnt/lfs/sources/grep-2.9$ ./configure --prefix=/tools \
> --disable-perl-regexp
lfs: /mnt/lfs/sources/grep-2.9$ make
lfs: /mnt/lfs/sources/grep-2.9$ make check
..........
=======================
All 83 tests passed
(27 tests were not run)
=======================
lfs: /mnt/lfs/sources/grep-2.9$ make install
lfs: /mnt/lfs/sources/grep-2.9$ cd ..
lfs: /mnt/lfs/sources$ rm -rf grep-2.9/
5.25. Gzip-1.4
The Gzip package contains programs for compressing and decompressing files
5.25.1. Installation of Gzip
lfs: /mnt/lfs/sources$ tar xvf gzip-1.4.tar.gz
lfs: /mnt/lfs/sources$ cd gzip-1.4
lfs: /mnt/lfs/sources/gzip-1.4$
lfs: /mnt/lfs/sources/gzip-1.4$ ./configure --prefix=/tools
lfs: /mnt/lfs/sources/gzip-1.4$ make
lfs: /mnt/lfs/sources/gzip-1.4$ make check
lfs: /mnt/lfs/sources/gzip-1.4$ make install
lfs: /mnt/lfs/sources/gzip-1.4$ cd ..
lfs: /mnt/lfs/sources$ rm -rf gzip-1.4/
5.26. M4-1.4.16
The M4 package contains a macro processor
5.26.1. Installation of M4
lfs: /mnt/lfs/sources$ tar xvf m4-1.4.16.tar.bz2
lfs: /mnt/lfs/sources$ cd m4-1.4.16
lfs: /mnt/lfs/sources/m4-1.4.16$
lfs: /mnt/lfs/sources/m4-1.4.16$ ./configure --prefix=/tools
lfs: /mnt/lfs/sources/m4-1.4.16$ make
lfs: /mnt/lfs/sources/m4-1.4.16$ make check
............
=======================
All 109 tests passed
(21 tests were not run)
=======================
lfs: /mnt/lfs/sources/m4-1.4.16$ make install
lfs: /mnt/lfs/sources/m4-1.4.16$ cd ..
lfs: /mnt/lfs/sources$ rm -rf m4-1.4.16/
5.27. Make-3.82
The Make package contains a program for compiling packages
5.27.1. Installation of Make
lfs: /mnt/lfs/sources$ tar xvf make-3.82.tar.bz2
lfs: /mnt/lfs/sources$ cd make-3.82/
lfs: /mnt/lfs/sources/make-3.82$
lfs: /mnt/lfs/sources/make-3.82$ ./configure --prefix=/tools
lfs: /mnt/lfs/sources/make-3.82$ make
lfs: /mnt/lfs/sources/make-3.82$ make check
........
==================================================================
Regression PASSED: GNU Make 3.82 (x86_64-unknown-linux-gnu) built with gcc
==================================================================
lfs: /mnt/lfs/sources/make-3.82$ make install
lfs: /mnt/lfs/sources/make-3.82$ cd ..
lfs: /mnt/lfs/sources$ rm -rf make-3.82/
5.28. Patch-2.6.1
The Patch package contains a program for modifying or creating files by applying a “patch” file typically created by the diff program
5.28.1. Installation of Patch
lfs: /mnt/lfs/sources$ tar xvf patch-2.6.1.tar.bz2
lfs: /mnt/lfs/sources$ cd patch-2.6.1/
lfs: /mnt/lfs/sources/patch-2.6.1$
lfs: /mnt/lfs/sources/patch-2.6.1$ ./configure --prefix=/tools
lfs: /mnt/lfs/sources/patch-2.6.1$ make
lfs: /mnt/lfs/sources/patch-2.6.1$ make check
..........
5 tests (5 passed, 0 failed)
All tests succeeded!
lfs: /mnt/lfs/sources/patch-2.6.1$ make install
lfs: /mnt/lfs/sources/patch-2.6.1$ cd ..
lfs: /mnt/lfs/sources$ rm -rf patch-2.6.1/
5.29. Perl-5.14.2
The Perl package contains the Practical Extraction and Report Language
5.29.1. Installation of Perl
lfs: /mnt/lfs/sources$ tar xvf perl-5.14.2.tar.bz2
lfs: /mnt/lfs/sources$ cd perl-5.14.2
lfs: /mnt/lfs/sources/perl-5.14.2$
lfs: /mnt/lfs/sources/perl-5.14.2$ patch -Np1 -i ../perl-5.14.2-libc-1.patch
patching file hints/linux.sh
lfs: /mnt/lfs/sources/perl-5.14.2$ sh Configure -des -Dprefix=/tools
lfs: /mnt/lfs/sources/perl-5.14.2$ make
lfs: /mnt/lfs/sources/perl-5.14.2$ cp -v perl cpan/podlators/pod2man /tools/bin
`perl' -> `/tools/bin/perl'
`cpan/podlators/pod2man' -> `/tools/bin/pod2man'
lfs: /mnt/lfs/sources/perl-5.14.2$ mkdir -pv /tools/lib/perl5/5.14.2
mkdir: created directory `/tools/lib/perl5'
mkdir: created directory `/tools/lib/perl5/5.14.2'
lfs: /mnt/lfs/sources/perl-5.14.2$ cp -Rv lib/* /tools/lib/perl5/5.14.2
lfs: /mnt/lfs/sources/perl-5.14.2$ cd ..
lfs: /mnt/lfs/sources$ rm -rf perl-5.14.2/
5.30. Sed-4.2.1
The Sed package contains a stream editor
5.30.1. Installation of Sed
lfs: /mnt/lfs/sources$ tar xvf sed-4.2.1.tar.bz2
lfs: /mnt/lfs/sources$ cd sed-4.2.1
lfs: /mnt/lfs/sources/sed-4.2.1$
lfs: /mnt/lfs/sources/sed-4.2.1$ ./configure --prefix=/tools
lfs: /mnt/lfs/sources/sed-4.2.1$ make
lfs: /mnt/lfs/sources/sed-4.2.1$ make check
...........
======================================================
All 65 tests behaved as expected (4 expected failures)
======================================================
lfs: /mnt/lfs/sources/sed-4.2.1$ make install
lfs: /mnt/lfs/sources/sed-4.2.1$ cd ..
lfs: /mnt/lfs/sources$ rm -rf sed-4.2.1/
5.31. Tar-1.26
The Tar package contains an archiving program
5.31.1. Installation of Tar
lfs: /mnt/lfs/sources$ tar xvf tar-1.26.tar.bz2
lfs: /mnt/lfs/sources$ cd tar-1.26
lfs: /mnt/lfs/sources/tar-1.26$
lfs: /mnt/lfs/sources/tar-1.26$ ./configure --prefix=/tools
開始組譯
lfs: /mnt/lfs/sources/tar-1.26$ make
lfs: /mnt/lfs/sources/tar-1.26$ make check
............
113 tests were successful.
8 tests were skipped.
lfs: /mnt/lfs/sources/tar-1.26$ make install
lfs: /mnt/lfs/sources/tar-1.26$ cd ..
lfs: /mnt/lfs/sources$ rm -rf tar-1.26/
5.32. Texinfo-4.13a
The Texinfo package contains programs for reading, writing, and converting info pages
5.32.1. Installation of Texinfo
lfs: /mnt/lfs/sources$ tar xvf texinfo-4.13a.tar.gz
lfs: /mnt/lfs/sources$ cd texinfo-4.13
lfs: /mnt/lfs/sources/texinfo-4.13$
lfs: /mnt/lfs/sources/texinfo-4.13$ ./configure --prefix=/tools
開始組譯
lfs: /mnt/lfs/sources/texinfo-4.13$ make
lfs: /mnt/lfs/sources/texinfo-4.13$ make check
lfs: /mnt/lfs/sources/texinfo-4.13$ make install
lfs: /mnt/lfs/sources/texinfo-4.13$ cd ..
lfs: /mnt/lfs/sources$ rm -rf texinfo-4.13/
5.33. Xz-5.0.3
The Xz package contains programs for compressing and decompressing files. It provides capabilities for the lzma and the newer xz compression formats. Compressing text files with xz yields a better compression percentage than with the traditional gzip or bzip2 commands
5.33.1. Installation of Xz-Utils
lfs: /mnt/lfs/sources$ tar xvf xz-5.0.3.tar.bz2
lfs: /mnt/lfs/sources$ cd xz-5.0.3
lfs: /mnt/lfs/sources/xz-5.0.3$
lfs: /mnt/lfs/sources/xz-5.0.3$ ./configure --prefix=/tools
開始組譯
lfs: /mnt/lfs/sources/xz-5.0.3$ make
lfs: /mnt/lfs/sources/xz-5.0.3$ make check
........
==================
All 7 tests passed
==================
lfs: /mnt/lfs/sources/xz-5.0.3$ make install
lfs: /mnt/lfs/sources/xz-5.0.3$ cd ..
lfs: /mnt/lfs/sources$ rm -rf xz-5.0.3/
5.34. Stripping
The steps in this section are optional, but if the LFS partition is rather small, it is beneficial to learn that unnecessary items can be removed. The executables and libraries built so far contain about 70 MB of unneeded debugging symbols.Remove those symbols with
lfs: /mnt/lfs/sources$ strip --strip-debug /tools/lib64/*
lfs: /mnt/lfs/sources$ strip --strip-unneeded /tools/{,s}bin/*
lfs: /mnt/lfs/sources$ rm -rf /tools/{,share}/{info,man,doc}
5.35. Changing Ownership
lfs: /# sudo chown -R root:root $LFS/tools