Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Host System Requirements
- cat > version-check.sh << "EOF"
- #!/bin/bash
- # Simple script to list version numbers of critical development tools
- export LC_ALL=C
- 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
- ldd --version | head -n1 | cut -d" " -f2- # glibc version
- 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 "gcc compilation OK";
- else echo "gcc compilation failed"; fi
- rm -f dummy.c dummy
- EOF
- bash version-check.sh
- ### Mounting the New Partition
- export LFS=/mnt/lfs
- mkdir -pv $LFS
- mount -v -t ext3 /dev/sdb1 $LFS
- ### Introduction
- mkdir -v $LFS/sources
- chmod -v a+wt $LFS/sources
- wget -i wget-list -P $LFS/sources
- pushd $LFS/sources
- md5sum -c md5sums
- popd
- ### 4. Final Preparations
- ### About $LFS
- echo $LFS
- export LFS=/mnt/lfs
- ### Creating the $LFS/tools Directory
- mkdir -v $LFS/tools
- ln -sv $LFS/tools /
- ### Adding the LFS User
- groupadd lfs
- useradd -s /bin/bash -g lfs -m -k /dev/null lfs
- passwd lfs
- chown -v lfs $LFS/tools
- chown -v lfs $LFS/sources
- su - lfs
- ### Setting Up the Environment
- cat > ~/.bash_profile << "EOF"
- exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
- EOF
- 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
- source ~/.bash_profile
- ### General Compilation Instructions
- echo $LFS
- ### Binutils-2.23.1 - Pass 1
- cd $LFS/sources/
- tar xf binutils-2.23.1.tar.bz2
- cd $LFS/sources/binutils-2.23.1/
- mkdir -v ../binutils-build
- cd ../binutils-build
- ../binutils-2.23.1/configure \
- --prefix=/tools \
- --with-sysroot=$LFS \
- --with-lib-path=/tools/lib \
- --target=$LFS_TGT \
- --disable-nls \
- --disable-werror
- make
- case $(uname -m) in
- x86_64) mkdir -v /tools/lib && ln -sv lib /tools/lib64 ;;
- esac
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/binutils-build/
- cd $LFS/sources/
- rm -rf $LFS/sources/binutils-2.23.1/
- ### GCC-4.7.2 - Pass 1
- cd $LFS/sources/
- tar xf gcc-4.7.2.tar.bz2
- cd $LFS/sources/gcc-4.7.2/
- tar -Jxf ../mpfr-3.1.1.tar.xz
- mv -v mpfr-3.1.1 mpfr
- tar -Jxf ../gmp-5.1.1.tar.xz
- mv -v gmp-5.1.1 gmp
- tar -zxf ../mpc-1.0.1.tar.gz
- mv -v mpc-1.0.1 mpc
- 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_STARTFILE_PREFIX_1
- #undef STANDARD_STARTFILE_PREFIX_2
- #define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
- #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
- touch $file.orig
- done
- sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure
- sed -i 's/BUILD_INFO=info/BUILD_INFO=/' gcc/configure
- mkdir -v ../gcc-build
- cd ../gcc-build
- ../gcc-4.7.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-libmudflap \
- --disable-libssp \
- --disable-libgomp \
- --disable-libquadmath \
- --enable-languages=c \
- --with-mpfr-include=$(pwd)/../gcc-4.7.2/mpfr/src \
- --with-mpfr-lib=$(pwd)/mpfr/src/.libs
- make
- make install
- ln -sv libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | sed 's/libgcc/&_eh/'`
- cd $LFS/sources/
- rm -rf $LFS/sources/gcc-build/
- cd $LFS/sources/
- rm -rf $LFS/sources/gcc-4.7.2/
- ### Linux-3.8.3 API Headers
- cd $LFS/sources/
- tar xf linux-3.8.1.tar.xz
- cd $LFS/sources/linux-3.8.1/
- make mrproper
- make headers_check
- make INSTALL_HDR_PATH=dest headers_install
- cp -rv dest/include/* /tools/include
- cd $LFS/sources/
- rm -rf $LFS/sources/linux-3.8.1/
- ### Glibc-2.17
- cd $LFS/sources/
- rm -rf $LFS/sources/glibc-2.17/
- cd $LFS/sources/
- tar xf glibc-2.17.tar.xz
- cd $LFS/sources/glibc-2.17/
- if [ ! -r /usr/include/rpc/types.h ]; then
- su -c 'mkdir -p /usr/include/rpc'
- su -c 'cp -v sunrpc/rpc/*.h /usr/include/rpc'
- fi
- mkdir -v ../glibc-build
- cd ../glibc-build
- ../glibc-2.17/configure \
- --prefix=/tools \
- --host=$LFS_TGT \
- --build=$(../glibc-2.17/scripts/config.guess) \
- --disable-profile \
- --enable-kernel=2.6.25 \
- --with-headers=/tools/include \
- libc_cv_forced_unwind=yes \
- libc_cv_ctors_header=yes \
- libc_cv_c_cleanup=yes
- make
- make install
- echo 'main(){}' > dummy.c
- $LFS_TGT-gcc dummy.c
- readelf -l a.out | grep ': /tools'
- rm -v dummy.c a.out
- cd $LFS/sources/
- rm -rf $LFS/sources/glibc-build/
- cd $LFS/sources/
- rm -rf $LFS/sources/glibc-2.17/
- ok
- ### Binutils-2.23.1 - Pass 2
- cd $LFS/sources/
- tar xf binutils-2.23.1.tar.bz2
- cd $LFS/sources/binutils-2.23.1/
- mkdir -v ../binutils-build
- cd ../binutils-build
- CC=$LFS_TGT-gcc \
- AR=$LFS_TGT-ar \
- RANLIB=$LFS_TGT-ranlib \
- ../binutils-2.23.1/configure \
- --prefix=/tools \
- --disable-nls \
- --with-lib-path=/tools/lib
- make
- make install
- make -C ld clean
- make -C ld LIB_PATH=/usr/lib:/lib
- cp -v ld/ld-new /tools/bin
- cd $LFS/sources/
- rm -rf $LFS/sources/binutils-build/
- rm -rf $LFS/sources/binutils-2.23.1/
- ### GCC-4.7.2 - Pass 2
- cd $LFS/sources/
- tar xf gcc-4.7.2.tar.bz2
- cd $LFS/sources/gcc-4.7.2/
- cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
- `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/include-fixed/limits.h
- cp -v gcc/Makefile.in{,.tmp}
- sed 's/^T_CFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \
- > gcc/Makefile.in
- 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_STARTFILE_PREFIX_1
- #undef STANDARD_STARTFILE_PREFIX_2
- #define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
- #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
- touch $file.orig
- done
- tar -Jxf ../mpfr-3.1.1.tar.xz
- mv -v mpfr-3.1.1 mpfr
- tar -Jxf ../gmp-5.1.1.tar.xz
- mv -v gmp-5.1.1 gmp
- tar -zxf ../mpc-1.0.1.tar.gz
- mv -v mpc-1.0.1 mpc
- sed -i 's/BUILD_INFO=info/BUILD_INFO=/' gcc/configure
- mkdir -v ../gcc-build
- cd ../gcc-build
- CC=$LFS_TGT-gcc \
- AR=$LFS_TGT-ar \
- RANLIB=$LFS_TGT-ranlib \
- ../gcc-4.7.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.7.2/mpfr/src \
- --with-mpfr-lib=$(pwd)/mpfr/src/.libs
- make
- make install
- ln -sv gcc /tools/bin/cc
- echo 'main(){}' > dummy.c
- cc dummy.c
- readelf -l a.out | grep ': /tools'
- rm -v dummy.c a.out
- cd $LFS/sources/
- rm -rf $LFS/sources/gcc-build/
- cd $LFS/sources/
- rm -rf $LFS/sources/gcc-4.7.2/
- ### Tcl-8.6.0
- cd $LFS/sources/
- tar xf tcl8.6.0-src.tar.gz
- cd $LFS/sources/tcl8.6.0/
- 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 $LFS/sources/
- rm -rf $LFS/sources/tcl8.6.0/
- ### Expect-5.45
- cd $LFS/sources/
- tar xf expect5.45.tar.gz
- cd $LFS/sources/expect5.45/
- cp -v configure{,.orig}
- sed 's:/usr/local/bin:/bin:' configure.orig > configure
- ./configure --prefix=/tools --with-tcl=/tools/lib \
- --with-tclinclude=/tools/include
- make
- make test
- make SCRIPTS="" install
- cd $LFS/sources/
- rm -rf $LFS/sources/expect5.45/
- ### DejaGNU-1.5
- cd $LFS/sources/
- tar xf dejagnu-1.5.tar.gz
- cd $LFS/sources/dejagnu-1.5/
- ./configure --prefix=/tools
- make install
- make check
- cd $LFS/sources/
- rm -rf $LFS/sources/dejagnu-1.5/
- ### Check-0.9.9
- cd $LFS/sources/
- tar xf check-0.9.9.tar.gz
- cd $LFS/sources/check-0.9.9/
- ./configure --prefix=/tools
- make
- #make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/check-0.9.9/
- ### Ncurses-5.9
- cd $LFS/sources/
- tar xf ncurses-5.9.tar.gz
- cd $LFS/sources/ncurses-5.9/
- ./configure --prefix=/tools --with-shared \
- --without-debug --without-ada --enable-overwrite
- make
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/ncurses-5.9/
- ### Bash-4.2
- cd $LFS/sources/
- tar xf bash-4.2.tar.gz
- cd $LFS/sources/bash-4.2/
- patch -Np1 -i ../bash-4.2-fixes-11.patch
- ./configure --prefix=/tools --without-bash-malloc
- make
- #make tests
- make install
- ln -sv bash /tools/bin/sh
- cd $LFS/sources/
- rm -rf $LFS/sources/bash-4.2/
- ### Bzip2-1.0.6
- cd $LFS/sources/
- tar xf bzip2-1.0.6.tar.gz
- cd $LFS/sources/bzip2-1.0.6/
- make
- make PREFIX=/tools install
- cd $LFS/sources/
- rm -rf $LFS/sources/bzip2-1.0.6/
- ### Coreutils-8.21
- cd $LFS/sources/
- tar xf coreutils-8.21.tar.xz
- cd $LFS/sources/coreutils-8.21/
- ./configure --prefix=/tools --enable-install-program=hostname
- make
- #make RUN_EXPENSIVE_TESTS=yes check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/coreutils-8.21/
- ### Diffutils-3.2
- cd $LFS/sources/
- tar xf diffutils-3.2.tar.gz
- cd $LFS/sources/diffutils-3.2/
- sed -i -e '/gets is a/d' lib/stdio.in.h
- ./configure --prefix=/tools
- make
- #make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/diffutils-3.2/
- ### File-5.13
- cd $LFS/sources/
- tar xf file-5.13.tar.gz
- cd $LFS/sources/file-5.13/
- ./configure --prefix=/tools
- make
- #make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/file-5.13/
- ### Findutils-4.4.2
- cd $LFS/sources/
- tar xf findutils-4.4.2.tar.gz
- cd $LFS/sources/findutils-4.4.2/
- ./configure --prefix=/tools
- make
- #make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/findutils-4.4.2/
- ### Gawk-4.0.2
- cd $LFS/sources/
- tar xf gawk-4.0.2.tar.xz
- cd $LFS/sources/gawk-4.0.2/
- ./configure --prefix=/tools
- make
- #make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/gawk-4.0.2/
- ### Gettext-0.18.2
- cd $LFS/sources/
- tar xf gettext-0.18.2.tar.gz
- cd $LFS/sources/gettext-0.18.2/
- cd gettext-tools
- EMACS="no" ./configure --prefix=/tools --disable-shared
- make -C gnulib-lib
- make -C src msgfmt
- cp -v src/msgfmt /tools/bin
- cd $LFS/sources/
- rm -rf $LFS/sources/gettext-0.18.2/
- ### Grep-2.14
- cd $LFS/sources/
- tar xf grep-2.14.tar.xz
- cd $LFS/sources/grep-2.14/
- ./configure --prefix=/tools
- make
- #make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/grep-2.14/
- ### Gzip-1.5
- cd $LFS/sources/
- tar xf gzip-1.5.tar.xz
- cd $LFS/sources/gzip-1.5/
- ./configure --prefix=/tools
- make
- #make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/gzip-1.5/
- ### M4-1.4.16
- cd $LFS/sources/
- tar xf m4-1.4.16.tar.bz2
- cd $LFS/sources/m4-1.4.16/
- sed -i -e '/gets is a/d' lib/stdio.in.h
- ./configure --prefix=/tools
- make
- #make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/m4-1.4.16/
- ### Make-3.82
- cd $LFS/sources/
- tar xf make-3.82.tar.bz2
- cd $LFS/sources/make-3.82/
- ./configure --prefix=/tools
- make
- #make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/make-3.82/
- ### Patch-2.7.1
- cd $LFS/sources/
- tar xf patch-2.7.1.tar.xz
- cd $LFS/sources/patch-2.7.1/
- ./configure --prefix=/tools
- make
- #make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/patch-2.7.1/
- ### Perl-5.16.2
- cd $LFS/sources/
- tar xf perl-5.16.2.tar.bz2
- cd $LFS/sources/perl-5.16.2/
- patch -Np1 -i ../perl-5.16.2-libc-1.patch
- sh Configure -des -Dprefix=/tools
- make
- cp -v perl cpan/podlators/pod2man /tools/bin
- mkdir -pv /tools/lib/perl5/5.16.2
- cp -Rv lib/* /tools/lib/perl5/5.16.2
- cd $LFS/sources/
- rm -rf $LFS/sources/perl-5.16.2/
- ### Sed-4.2.2
- cd $LFS/sources/
- tar xf sed-4.2.2.tar.bz2
- cd $LFS/sources/sed-4.2.2/
- ./configure --prefix=/tools
- make
- #make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/sed-4.2.2/
- ### Tar-1.26
- cd $LFS/sources/
- tar xf tar-1.26.tar.bz2
- cd $LFS/sources/tar-1.26/
- sed -i -e '/gets is a/d' gnu/stdio.in.h
- ./configure --prefix=/tools
- make
- #make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/tar-1.26/
- ### Texinfo-5.0
- cd $LFS/sources/
- tar xf texinfo-5.0.tar.xz
- cd $LFS/sources/texinfo-5.0/
- ./configure --prefix=/tools
- make
- #make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/texinfo-5.0/
- ### Xz-5.0.4
- cd $LFS/sources/
- tar xf xz-5.0.4.tar.xz
- cd $LFS/sources/xz-5.0.4/
- ./configure --prefix=/tools
- make
- #make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/xz-5.0.4/
- ### Stripping
- #strip --strip-debug /tools/lib/*
- #strip --strip-unneeded /tools/{,s}bin/*
- rm -rf /tools/{,share}/{info,man,doc}
- ### Changing Ownership
- chown -R root:root $LFS/tools
- ### Preparing Virtual Kernel File Systems
- mkdir -v $LFS/{dev,proc,sys}
- mknod -m 600 $LFS/dev/console c 5 1
- mknod -m 666 $LFS/dev/null c 1 3
- mount -v --bind /dev $LFS/dev
- mount -vt devpts devpts $LFS/dev/pts
- mount -vt proc proc $LFS/proc
- mount -vt sysfs sysfs $LFS/sys
- if [ -h $LFS/dev/shm ]; then
- link=$(readlink $LFS/dev/shm)
- mkdir -p $LFS/$link
- mount -vt tmpfs shm $LFS/$link
- unset link
- else
- mount -vt tmpfs shm $LFS/dev/shm
- fi
- ### Entering the Chroot Environment
- chroot "$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 +h
- ### Creating Directories
- mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib,mnt,opt,run}
- mkdir -pv /{media/{floppy,cdrom},sbin,srv,var}
- install -dv -m 0750 /root
- install -dv -m 1777 /tmp /var/tmp
- mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
- mkdir -pv /usr/{,local/}share/{doc,info,locale,man}
- mkdir -v /usr/{,local/}share/{misc,terminfo,zoneinfo}
- mkdir -pv /usr/{,local/}share/man/man{1..8}
- for dir in /usr /usr/local; do
- ln -sv share/{man,doc,info} $dir
- done
- case $(uname -m) in
- x86_64) ln -sv lib /lib64 && ln -sv lib /usr/lib64 ;;
- esac
- mkdir -v /var/{log,mail,spool}
- ln -sv /run /var/run
- ln -sv /run/lock /var/lock
- mkdir -pv /var/{opt,cache,lib/{misc,locate},local}
- ### Creating Essential Files and Symlinks
- ln -sv /tools/bin/{bash,cat,echo,pwd,stty} /bin
- ln -sv /tools/bin/perl /usr/bin
- ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib
- ln -sv /tools/lib/libstdc++.so{,.6} /usr/lib
- sed 's/tools/usr/' /tools/lib/libstdc++.la > /usr/lib/libstdc++.la
- ln -sv bash /bin/sh
- touch /etc/mtab
- cat > /etc/passwd << "EOF"
- root:x:0:0:root:/root:/bin/bash
- bin:x:1:1:bin:/dev/null:/bin/false
- nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
- EOF
- cat > /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/lastlog
- chmod -v 664 /var/log/lastlog
- chmod -v 600 /var/log/btmp
- ### Linux-3.8.3 API Headers
- cd $LFS/sources/
- tar xf linux-3.8.3.tar.xz
- cd $LFS/sources/linux-3.8.3/
- make mrproper
- make headers_check
- make INSTALL_HDR_PATH=dest headers_install
- find dest/include \( -name .install -o -name ..install.cmd \) -delete
- cp -rv dest/include/* /usr/include
- cd $LFS/sources/
- rm -rf $LFS/sources/linux-3.8.3/
- ### Man-pages-3.47
- cd $LFS/sources/
- tar xf man-pages-3.47.tar.xz
- cd $LFS/sources/man-pages-3.47/
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/man-pages-3.47/
- ### Glibc-2.17
- cd $LFS/sources/
- tar xf glibc-2.17.tar.xz
- cd $LFS/sources/glibc-2.17/
- mkdir -v ../glibc-build
- cd ../glibc-build
- ../glibc-2.17/configure \
- --prefix=/usr \
- --disable-profile \
- --enable-kernel=2.6.25 \
- --libexecdir=/usr/lib/glibc
- make
- 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.17/sunrpc/rpc/*.h /usr/include/rpc
- cp -v ../glibc-2.17/sunrpc/rpcsvc/*.h /usr/include/rpcsvc
- cp -v ../glibc-2.17/nis/rpcsvc/*.h /usr/include/rpcsvc
- mkdir -pv /usr/lib/locale
- localedef -i en_US -f ISO-8859-1 en_US
- localedef -i en_US -f UTF-8 en_US.UTF-8
- 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
- tar -xf ../tzdata2012j.tar.gz
- ZONEINFO=/usr/share/zoneinfo
- mkdir -pv $ZONEINFO/{posix,right}
- for tz in etcetera southamerica northamerica europe africa antarctica \
- asia australasia backward pacificnew solar87 solar88 solar89 \
- 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 iso3166.tab $ZONEINFO
- zic -d $ZONEINFO -p Asia/Hong_Kong
- unset ZONEINFO
- tzselect
- cp -v --remove-destination /usr/share/zoneinfo/Asia/Hong_Kong \
- /etc/localtime
- 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 /etc/ld.so.conf.d
- cd $LFS/sources/
- rm -rf $LFS/sources/glibc-build/
- cd $LFS/sources/
- rm -rf $LFS/sources/glibc-2.17/
- ### Adjusting the Toolchain
- mv -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.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.2.7
- cd $LFS/sources/
- tar xf zlib-1.2.7.tar.bz2
- cd $LFS/sources/zlib-1.2.7/
- ./configure --prefix=/usr
- make
- make check
- make install
- mv -v /usr/lib/libz.so.* /lib
- ln -sfv ../../lib/libz.so.1.2.7 /usr/lib/libz.so
- cd $LFS/sources/
- rm -rf $LFS/sources/zlib-1.2.7/
- ### File-5.13
- cd $LFS/sources/
- tar xf file-5.13.tar.gz
- cd $LFS/sources/file-5.13/
- ./configure --prefix=/usr
- make
- make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/file-5.13/
- ### Binutils-2.23.1
- cd $LFS/sources/
- tar xf binutils-2.23.1.tar.bz2
- cd $LFS/sources/binutils-2.23.1/
- expect -c "spawn ls"
- rm -fv etc/standards.info
- sed -i.bak '/^INFO/s/standards.info //' etc/Makefile.in
- patch -Np1 -i ../binutils-2.23.1-testsuite_fix-1.patch
- mkdir -v ../binutils-build
- cd ../binutils-build
- ../binutils-2.23.1/configure --prefix=/usr --enable-shared
- make tooldir=/usr
- make check
- make tooldir=/usr install
- cp -v ../binutils-2.23.1/include/libiberty.h /usr/include
- cd $LFS/sources/
- rm -rf $LFS/sources/binutils-build/
- rm -rf $LFS/sources/binutils-2.23.1/
- ### GMP-5.1.1
- cd $LFS/sources/
- tar xf gmp-5.1.1.tar.xz
- cd $LFS/sources/gmp-5.1.1/
- ABI=32 ./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.1
- cp -v doc/{isa_abi_headache,configuration} doc/*.html \
- /usr/share/doc/gmp-5.1.1
- cd $LFS/sources/
- rm -rf $LFS/sources/gmp-5.1.1/
- ### MPFR-3.1.1
- cd $LFS/sources/
- tar xf mpfr-3.1.1.tar.xz
- cd $LFS/sources/mpfr-3.1.1/
- ./configure --prefix=/usr \
- --enable-thread-safe \
- --docdir=/usr/share/doc/mpfr-3.1.1
- make
- make check
- make install
- make html
- make install-html
- cd $LFS/sources/
- rm -rf $LFS/sources/mpfr-3.1.1/
- ### MPC-1.0.1
- cd $LFS/sources/
- tar xf mpc-1.0.1.tar.gz
- cd $LFS/sources/mpc-1.0.1/
- ./configure --prefix=/usr
- make
- make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/mpc-1.0.1/
- ### GCC-4.7.2
- cd $LFS/sources/
- tar xf gcc-4.7.2.tar.bz2
- cd $LFS/sources/gcc-4.7.2/
- sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
- sed -i 's/BUILD_INFO=info/BUILD_INFO=/' gcc/configure
- case `uname -m` in
- i?86) sed -i 's/^T_CFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in ;;
- esac
- sed -i -e /autogen/d -e /check.sh/d fixincludes/Makefile.in
- mkdir -v ../gcc-build
- cd ../gcc-build
- ../gcc-4.7.2/configure --prefix=/usr \
- --libexecdir=/usr/lib \
- --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.7.2/contrib/test_summary
- make install
- ln -sv ../usr/bin/cpp /lib
- ln -sv gcc /usr/bin/cc
- echo '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
- cd $LFS/sources/
- rm -rf $LFS/sources/gcc-build/
- rm -rf $LFS/sources/gcc-4.7.2/
- ### Sed-4.2.2
- cd $LFS/sources/
- tar xf sed-4.2.2.tar.bz2
- cd $LFS/sources/sed-4.2.2/
- ./configure --prefix=/usr --bindir=/bin --htmldir=/usr/share/doc/sed-4.2.2
- make
- make html
- make check
- make install
- make -C doc install-html
- cd $LFS/sources/
- rm -rf $LFS/sources/sed-4.2.2/
- ### Bzip2-1.0.6
- cd $LFS/sources/
- tar xf bzip2-1.0.6.tar.gz
- cd $LFS/sources/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/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
- cd $LFS/sources/
- rm -rf $LFS/sources/bzip2-1.0.6/
- ### Pkg-config-0.28
- cd $LFS/sources/
- tar xf pkg-config-0.28.tar.gz
- cd $LFS/sources/pkg-config-0.28/
- ./configure --prefix=/usr \
- --with-internal-glib \
- --disable-host-tool \
- --docdir=/usr/share/doc/pkg-config-0.28
- make
- make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/pkg-config-0.28/
- ### Ncurses-5.9
- cd $LFS/sources/
- tar xf ncurses-5.9.tar.gz
- cd $LFS/sources/ncurses-5.9/
- ./configure --prefix=/usr \
- --mandir=/usr/share/man \
- --with-shared \
- --without-debug \
- --enable-pc-files \
- --enable-widec
- make
- make install
- mv -v /usr/lib/libncursesw.so.5* /lib
- ln -sfv ../../lib/libncursesw.so.5 /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${lib}w.a /usr/lib/lib${lib}.a
- ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc
- done
- ln -sfv libncurses++w.a /usr/lib/libncurses++.a
- rm -vf /usr/lib/libcursesw.so
- echo "INPUT(-lncursesw)" > /usr/lib/libcursesw.so
- ln -sfv libncurses.so /usr/lib/libcurses.so
- ln -sfv libncursesw.a /usr/lib/libcursesw.a
- ln -sfv libncurses.a /usr/lib/libcurses.a
- mkdir -v /usr/share/doc/ncurses-5.9
- cp -v -R doc/* /usr/share/doc/ncurses-5.9
- cd $LFS/sources/
- rm -rf $LFS/sources/ncurses-5.9/
- ### Util-linux-2.22.2
- cd $LFS/sources/
- tar xf util-linux-2.22.2.tar.xz
- cd $LFS/sources/util-linux-2.22.2/
- sed -i -e 's@etc/adjtime@var/lib/hwclock/adjtime@g' \
- $(grep -rl '/etc/adjtime' .)
- mkdir -pv /var/lib/hwclock
- ./configure --disable-su --disable-sulogin --disable-login
- make
- make install
- ### Psmisc-22.20
- cd $LFS/sources/
- tar xf psmisc-22.20.tar.gz
- cd $LFS/sources/psmisc-22.20/
- ./configure --prefix=/usr
- make
- make install
- mv -v /usr/bin/fuser /bin
- mv -v /usr/bin/killall /bin
- cd $LFS/sources/
- rm -rf $LFS/sources/psmisc-22.20/
- ### Procps-ng-3.3.6
- cd $LFS/sources/
- tar xf procps-ng-3.3.6.tar.xz
- cd $LFS/sources/procps-ng-3.3.6/
- ./configure --prefix=/usr \
- --exec-prefix= \
- --libdir=/usr/lib \
- --docdir=/usr/share/doc/procps-ng-3.3.6 \
- --disable-static \
- --disable-skill \
- --disable-kill
- make
- pushd testsuite
- sed -i -e 's|exec which sleep|exec echo /tools/bin/sleep|' \
- -e 's|999999|&9|' config/unix.exp
- sed -i -e 's|pmap_initname\\\$|pmap_initname|' pmap.test/pmap.exp
- make site.exp
- DEJAGNU=global-conf.exp runtest
- popd
- make install
- mv -v /usr/lib/libprocps.so.* /lib
- ln -sfv ../../lib/libprocps.so.1.1.0 /usr/lib/libprocps.so
- cd $LFS/sources/
- rm -rf $LFS/sources/procps-ng-3.3.6/
- ### E2fsprogs-1.42.7
- cd $LFS/sources/
- tar xf e2fsprogs-1.42.7.tar.gz
- cd $LFS/sources/e2fsprogs-1.42.7/
- mkdir -v build
- cd build
- ../configure --prefix=/usr \
- --with-root-prefix="" \
- --enable-elf-shlibs \
- --disable-libblkid \
- --disable-libuuid \
- --disable-uuidd \
- --disable-fsck
- make
- make 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
- cd $LFS/sources/
- rm -rf $LFS/sources/e2fsprogs-1.42.7/
- ### Shadow-4.1.5.1
- cd $LFS/sources/
- tar xf shadow-4.1.5.1.tar.bz2
- cd $LFS/sources/shadow-4.1.5.1/
- sed -i 's/groups$(EXEEXT) //' src/Makefile.in
- find 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=/etc
- make
- make install
- mv -v /usr/bin/passwd /bin
- pwconv
- grpconv
- sed -i 's/yes/no/' /etc/default/useradd
- passwd root
- cd $LFS/sources/
- rm -rf $LFS/sources/shadow-4.1.5.1/
- ### Coreutils-8.21
- cd $LFS/sources/
- tar xf coreutils-8.21.tar.xz
- cd $LFS/sources/coreutils-8.21/
- patch -Np1 -i ../coreutils-8.21-i18n-1.patch
- FORCE_UNSAFE_CONFIGURE=1 ./configure \
- --prefix=/usr \
- --libexecdir=/usr/lib \
- --enable-no-install-program=kill,uptime
- 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,test,[} /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,sleep,nice} /bin
- cd $LFS/sources/
- rm -rf $LFS/sources/coreutils-8.21/
- ### Iana-Etc-2.30
- cd $LFS/sources/
- tar xf iana-etc-2.30.tar.bz2
- cd $LFS/sources/iana-etc-2.30/
- make
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/iana-etc-2.30/
- ### M4-1.4.16
- cd $LFS/sources/
- tar xf m4-1.4.16.tar.bz2
- cd $LFS/sources/m4-1.4.16/
- sed -i -e '/gets is a/d' lib/stdio.in.h
- ./configure --prefix=/usr
- make
- sed -i -e '41s/ENOENT/& || errno == EINVAL/' tests/test-readlink.h
- make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/m4-1.4.16/
- ### Bison-2.7
- cd $LFS/sources/
- tar xf bison-2.7.tar.xz
- cd $LFS/sources/bison-2.7/
- ./configure --prefix=/usr
- echo '#define YYENABLE_NLS 1' >> lib/config.h
- make
- make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/bison-2.7/
- ### Grep-2.14
- cd $LFS/sources/
- tar xf grep-2.14.tar.xz
- cd $LFS/sources/grep-2.14/
- ./configure --prefix=/usr --bindir=/bin
- make
- make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/grep-2.14/
- ### Readline-6.2
- cd $LFS/sources/
- tar xf readline-6.2.tar.gz
- cd $LFS/sources/readline-6.2/
- sed -i '/MV.*old/d' Makefile.in
- sed -i '/{OLDSUFF}/c:' support/shlib-install
- patch -Np1 -i ../readline-6.2-fixes-1.patch
- ./configure --prefix=/usr --libdir=/lib
- make SHLIB_LIBS=-lncurses
- make install
- mv -v /lib/lib{readline,history}.a /usr/lib
- rm -v /lib/lib{readline,history}.so
- ln -sfv ../../lib/libreadline.so.6 /usr/lib/libreadline.so
- ln -sfv ../../lib/libhistory.so.6 /usr/lib/libhistory.so
- mkdir -v /usr/share/doc/readline-6.2
- install -v -m644 doc/*.{ps,pdf,html,dvi} \
- /usr/share/doc/readline-6.2
- cd $LFS/sources/
- rm -rf $LFS/sources/readline-6.2/
- ### Bash-4.2
- cd $LFS/sources/
- tar xf bash-4.2.tar.gz
- cd $LFS/sources/bash-4.2/
- patch -Np1 -i ../bash-4.2-fixes-11.patch
- ./configure --prefix=/usr \
- --bindir=/bin \
- --htmldir=/usr/share/doc/bash-4.2 \
- --without-bash-malloc \
- --with-installed-readline
- make
- chown -Rv nobody .
- su nobody -s /bin/bash -c "PATH=$PATH make tests"
- make install
- exec /bin/bash --login +h
- cd $LFS/sources/
- rm -rf $LFS/sources/bash-4.2/
- ### Libtool-2.4.2
- cd $LFS/sources/
- tar xf libtool-2.4.2.tar.gz
- cd $LFS/sources/libtool-2.4.2/
- ./configure --prefix=/usr
- make
- make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/libtool-2.4.2/
- ### GDBM-1.10
- cd $LFS/sources/
- tar xf gdbm-1.10.tar.gz
- cd $LFS/sources/gdbm-1.10/
- ./configure --prefix=/usr --enable-libgdbm-compat
- make
- make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/gdbm-1.10/
- ### Inetutils-1.9.1
- cd $LFS/sources/
- tar xf inetutils-1.9.1.tar.gz
- cd $LFS/sources/inetutils-1.9.1/
- sed -i -e '/gets is a/d' lib/stdio.in.h
- ./configure --prefix=/usr \
- --libexecdir=/usr/sbin \
- --localstatedir=/var \
- --disable-ifconfig \
- --disable-logger \
- --disable-syslogd \
- --disable-whois \
- --disable-servers
- make
- make check
- make install
- mv -v /usr/bin/{hostname,ping,ping6,traceroute} /bin
- cd $LFS/sources/
- rm -rf $LFS/sources/inetutils-1.9.1/
- ### Perl-5.16.2
- cd $LFS/sources/
- tar xf perl-5.16.2.tar.bz2
- cd $LFS/sources/perl-5.16.2/
- echo "127.0.0.1 localhost $(hostname)" > /etc/hosts
- sed -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.in
- sh Configure -des -Dprefix=/usr \
- -Dvendorprefix=/usr \
- -Dman1dir=/usr/share/man/man1 \
- -Dman3dir=/usr/share/man/man3 \
- -Dpager="/usr/bin/less -isR" \
- -Duseshrplib
- make
- make -k test
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/perl-5.16.2/
- ### Autoconf-2.69
- cd $LFS/sources/
- tar xf autoconf-2.69.tar.xz
- cd $LFS/sources/autoconf-2.69/
- ./configure --prefix=/usr
- make
- #make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/autoconf-2.69/
- ### Automake-1.13.1
- cd $LFS/sources/
- tar xf automake-1.13.1.tar.xz
- cd $LFS/sources/automake-1.13.1/
- ./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.13.1
- make
- #make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/automake-1.13.1/
- ### Diffutils-3.2
- cd $LFS/sources/
- tar xf diffutils-3.2.tar.gz
- cd $LFS/sources/diffutils-3.2/
- sed -i -e '/gets is a/d' lib/stdio.in.h
- ./configure --prefix=/usr
- make
- make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/diffutils-3.2/
- ### Gawk-4.0.2
- cd $LFS/sources/
- tar xf gawk-4.0.2.tar.xz
- cd $LFS/sources/gawk-4.0.2/
- ./configure --prefix=/usr --libexecdir=/usr/lib
- make
- make check
- make install
- mkdir -v /usr/share/doc/gawk-4.0.2
- cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-4.0.2
- cd $LFS/sources/
- rm -rf $LFS/sources/gawk-4.0.2/
- ### Findutils-4.4.2
- cd $LFS/sources/
- tar xf findutils-4.4.2.tar.gz
- cd $LFS/sources/findutils-4.4.2/
- ./configure --prefix=/usr \
- --libexecdir=/usr/lib/findutils \
- --localstatedir=/var/lib/locate
- make
- make check
- make install
- mv -v /usr/bin/find /bin
- sed -i 's/find:=${BINDIR}/find:=\/bin/' /usr/bin/updatedb
- cd $LFS/sources/
- rm -rf $LFS/sources/findutils-4.4.2/
- ### Flex-2.5.37
- cd $LFS/sources/
- tar xf flex-2.5.37.tar.bz2
- cd $LFS/sources/flex-2.5.37/
- patch -Np1 -i ../flex-2.5.37-bison-2.6.1-1.patch
- ./configure --prefix=/usr \
- --docdir=/usr/share/doc/flex-2.5.37
- make
- make check
- make install
- ln -sv libfl.a /usr/lib/libl.a
- cat > /usr/bin/lex << "EOF"
- #!/bin/sh
- # Begin /usr/bin/lex
- exec /usr/bin/flex -l "$@"
- # End /usr/bin/lex
- EOF
- chmod -v 755 /usr/bin/lex
- cd $LFS/sources/
- rm -rf $LFS/sources/flex-2.5.37/
- ### Gettext-0.18.2
- cd $LFS/sources/
- tar xf gettext-0.18.2.tar.gz
- cd $LFS/sources/gettext-0.18.2/
- ./configure --prefix=/usr \
- --docdir=/usr/share/doc/gettext-0.18.2
- make
- make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/gettext-0.18.2/
- ### Groff-1.22.2
- cd $LFS/sources/
- tar xf groff-1.22.2.tar.gz
- cd $LFS/sources/groff-1.22.2/
- PAGE=A4 ./configure --prefix=/usr
- make
- mkdir -p /usr/share/doc/groff-1.22/pdf
- make install
- ln -sv eqn /usr/bin/geqn
- ln -sv tbl /usr/bin/gtbl
- cd $LFS/sources/
- rm -rf $LFS/sources/groff-1.22.2/
- ### Xz-5.0.4
- cd $LFS/sources/
- tar xf xz-5.0.4.tar.xz
- cd $LFS/sources/xz-5.0.4/
- ./configure --prefix=/usr --libdir=/lib --docdir=/usr/share/doc/xz-5.0.4
- make
- make check
- make pkgconfigdir=/usr/lib/pkgconfig install
- cd $LFS/sources/
- rm -rf $LFS/sources/xz-5.0.4/
- ### GRUB-2.00
- cd $LFS/sources/
- tar xf grub-2.00.tar.xz
- cd $LFS/sources/grub-2.00/
- sed -i -e '/gets is a/d' grub-core/gnulib/stdio.in.h
- ./configure --prefix=/usr \
- --sysconfdir=/etc \
- --disable-grub-emu-usb \
- --disable-efiemu \
- --disable-werror
- make
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/grub-2.00/
- ### Less-451
- cd $LFS/sources/
- tar xf less-451.tar.gz
- cd $LFS/sources/less-451/
- ./configure --prefix=/usr --sysconfdir=/etc
- make
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/less-451/
- ### Gzip-1.5
- cd $LFS/sources/
- tar xf gzip-1.5.tar.xz
- cd $LFS/sources/gzip-1.5/
- ./configure --prefix=/usr --bindir=/bin
- make
- make check
- make install
- mv -v /bin/{gzexe,uncompress,zcmp,zdiff,zegrep} /usr/bin
- mv -v /bin/{zfgrep,zforce,zgrep,zless,zmore,znew} /usr/bin
- cd $LFS/sources/
- rm -rf $LFS/sources/gzip-1.5/
- ### IPRoute2-3.8.0
- cd $LFS/sources/
- tar xf iproute2-3.8.0.tar.xz
- cd $LFS/sources/iproute2-3.8.0/
- sed -i '/^TARGETS/s@arpd@@g' misc/Makefile
- sed -i /ARPD/d Makefile
- sed -i 's/arpd.8//' man/man8/Makefile
- sed -i 's/-Werror//' Makefile
- make DESTDIR=
- make DESTDIR= \
- MANDIR=/usr/share/man \
- DOCDIR=/usr/share/doc/iproute2-3.8.0 install
- cd $LFS/sources/
- rm -rf $LFS/sources/iproute2-3.8.0/
- ### Kbd-1.15.5
- cd $LFS/sources/
- tar xf kbd-1.15.5.tar.gz
- cd $LFS/sources/kbd-1.15.5/
- patch -Np1 -i ../kbd-1.15.5-backspace-1.patch
- sed -i -e '326 s/if/while/' src/loadkeys.analyze.l
- sed -i 's/\(RESIZECONS_PROGS=\)yes/\1no/g' configure
- sed -i 's/resizecons.8 //' man/man8/Makefile.in
- ./configure --prefix=/usr --datadir=/lib/kbd \
- --disable-vlock
- make
- make install
- mv -v /usr/bin/{kbd_mode,loadkeys,openvt,setfont} /bin
- mkdir -v /usr/share/doc/kbd-1.15.5
- cp -R -v doc/* \
- /usr/share/doc/kbd-1.15.5
- cd $LFS/sources/
- rm -rf $LFS/sources/kbd-1.15.5/
- ### Kmod-12
- cd $LFS/sources/
- tar xf kmod-12.tar.xz
- cd $LFS/sources/kmod-12/
- ./configure --prefix=/usr \
- --bindir=/bin \
- --libdir=/lib \
- --sysconfdir=/etc \
- --disable-manpages \
- --with-xz \
- --with-zlib
- make
- make check
- make pkgconfigdir=/usr/lib/pkgconfig install
- for target in depmod insmod modinfo modprobe rmmod; do
- ln -sv ../bin/kmod /sbin/$target
- done
- ln -sv kmod /bin/lsmod
- cd $LFS/sources/
- rm -rf $LFS/sources/kmod-12/
- ### Libpipeline-1.2.2
- cd $LFS/sources/
- tar xf libpipeline-1.2.2.tar.gz
- cd $LFS/sources/libpipeline-1.2.2/
- PKG_CONFIG_PATH=/tools/lib/pkgconfig ./configure --prefix=/usr
- make
- make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/libpipeline-1.2.2/
- ### Make-3.82
- cd $LFS/sources/
- tar xf make-3.82.tar.bz2
- cd $LFS/sources/make-3.82/
- patch -Np1 -i ../make-3.82-upstream_fixes-3.patch
- ./configure --prefix=/usr
- make
- make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/make-3.82/
- ### Man-DB-2.6.3
- cd $LFS/sources/
- tar xf man-db-2.6.3.tar.xz
- cd $LFS/sources/man-db-2.6.3/
- ./configure --prefix=/usr \
- --libexecdir=/usr/lib \
- --docdir=/usr/share/doc/man-db-2.6.3 \
- --sysconfdir=/etc \
- --disable-setuid \
- --with-browser=/usr/bin/lynx \
- --with-vgrind=/usr/bin/vgrind \
- --with-grap=/usr/bin/grap
- make
- make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/man-db-2.6.3/
- ### Patch-2.7.1
- cd $LFS/sources/
- tar xf patch-2.7.1.tar.xz
- cd $LFS/sources/patch-2.7.1/
- ./configure --prefix=/usr
- make
- make check
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/patch-2.7.1/
- ### Sysklogd-1.5
- cd $LFS/sources/
- tar xf sysklogd-1.5.tar.gz
- cd $LFS/sources/sysklogd-1.5/
- make
- make BINDIR=/sbin install
- 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
- cd $LFS/sources/
- rm -rf $LFS/sources/sysklogd-1.5/
- ### Sysvinit-2.88dsf
- cd $LFS/sources/
- tar xf sysvinit-2.88dsf.tar.bz2
- cd $LFS/sources/sysvinit-2.88dsf/
- sed -i 's@Sending processes@& configured via /etc/inittab@g' src/init.c
- sed -i -e '/utmpdump/d' \
- -e '/mountpoint/d' src/Makefile
- make -C src
- make -C src install
- cd $LFS/sources/
- rm -rf $LFS/sources/sysvinit-2.88dsf/
- ### Tar-1.26
- cd $LFS/sources/
- tar xf tar-1.26.tar.bz2
- cd $LFS/sources/tar-1.26/
- sed -i -e '/gets is a/d' gnu/stdio.in.h
- FORCE_UNSAFE_CONFIGURE=1 \
- ./configure --prefix=/usr \
- --bindir=/bin \
- --libexecdir=/usr/sbin
- make
- make check
- make install
- make -C doc install-html docdir=/usr/share/doc/tar-1.26
- cd $LFS/sources/
- rm -rf $LFS/sources/tar-1.26/
- ### Texinfo-5.0
- cd $LFS/sources/
- tar xf texinfo-5.0.tar.xz
- cd $LFS/sources/texinfo-5.0/
- ./configure --prefix=/usr
- make
- make check
- make install
- make TEXMF=/usr/share/texmf install-tex
- cd /usr/share/info
- rm -v dir
- for f in *
- do install-info $f dir 2>/dev/null
- done
- cd $LFS/sources/
- rm -rf $LFS/sources/texinfo-5.0/
- ### Udev-197 (Extracted from systemd-197)
- cd $LFS/sources/
- tar xf systemd-197.tar.xz
- cd $LFS/sources/systemd-197/
- tar -xvf ../udev-lfs-197-2.tar.bz2
- make -f udev-lfs-197-2/Makefile.lfs
- make -f udev-lfs-197-2/Makefile.lfs install
- build/udevadm hwdb --update
- bash udev-lfs-197-2/init-net-rules.sh
- cd $LFS/sources/
- rm -rf $LFS/sources/systemd-197/
- ### Vim-7.3
- cd $LFS/sources/
- tar xf vim-7.3.tar.bz2
- cd $LFS/sources/vim73/
- echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h
- ./configure --prefix=/usr --enable-multibyte
- make
- make test
- 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/vim73/doc /usr/share/doc/vim-7.3
- cat > /etc/vimrc << "EOF"
- " Begin /etc/vimrc
- set nocompatible
- set backspace=2
- syntax on
- if (&term == "iterm") || (&term == "putty")
- set background=dark
- endif
- " End /etc/vimrc
- EOF
- vim -c ':options'
- cd $LFS/sources/
- rm -rf $LFS/sources/vim73/
- ### Stripping Again
- logout
- chroot $LFS /tools/bin/env -i \
- HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
- PATH=/bin:/usr/bin:/sbin:/usr/sbin \
- /tools/bin/bash --login
- /tools/bin/find /{,usr/}{bin,lib,sbin} -type f \
- -exec /tools/bin/strip --strip-debug '{}' ';'
- ### Cleaning Up
- chroot "$LFS" /usr/bin/env -i \
- HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
- PATH=/bin:/usr/bin:/sbin:/usr/sbin \
- /bin/bash --login
- ### General Network Configuration
- cat /etc/udev/rules.d/70-persistent-net.rules
- cd /etc/sysconfig/
- cat > ifconfig.eth0 << "EOF"
- ONBOOT=yes
- IFACE=eth0
- SERVICE=ipv4-static
- IP=192.168.60.60
- GATEWAY=192.168.60.1
- PREFIX=24
- BROADCAST=192.168.60.255
- EOF
- cat > /etc/resolv.conf << "EOF"
- # Begin /etc/resolv.conf
- nameserver 219.232.48.61
- nameserver 219.141.136.10
- nameserver 211.147.6.3
- # End /etc/resolv.conf
- EOF
- ### Customizing the /etc/hosts File
- cat > /etc/hosts << "EOF"
- # Begin /etc/hosts (network card version)
- 127.0.0.1 localhost
- 192.168.60.60 lfs
- # End /etc/hosts (network card version)
- EOF
- ### LFS-Bootscripts-20130123
- cd $LFS/sources/
- tar xf lfs-bootscripts-20130123.tar.bz2
- cd $LFS/sources/lfs-bootscripts-20130123/
- make install
- cd $LFS/sources/
- rm -rf $LFS/sources/lfs-bootscripts-20130123/
- ### How Do These Bootscripts Work?
- cat > /etc/inittab << "EOF"
- # Begin /etc/inittab
- id:3:initdefault:
- si::sysinit:/etc/rc.d/init.d/rc S
- l0:0:wait:/etc/rc.d/init.d/rc 0
- l1:S1:wait:/etc/rc.d/init.d/rc 1
- l2:2:wait:/etc/rc.d/init.d/rc 2
- l3:3:wait:/etc/rc.d/init.d/rc 3
- l4:4:wait:/etc/rc.d/init.d/rc 4
- l5:5:wait:/etc/rc.d/init.d/rc 5
- l6:6:wait:/etc/rc.d/init.d/rc 6
- ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
- su:S016:once:/sbin/sulogin
- 1:2345:respawn:/sbin/agetty --noclear tty1 9600
- 2:2345:respawn:/sbin/agetty tty2 9600
- 3:2345:respawn:/sbin/agetty tty3 9600
- 4:2345:respawn:/sbin/agetty tty4 9600
- 5:2345:respawn:/sbin/agetty tty5 9600
- 6:2345:respawn:/sbin/agetty tty6 9600
- # End /etc/inittab
- EOF
- ### Configuring the system hostname
- echo "HOSTNAME=lfs" > /etc/sysconfig/network
- ### Configuring the setclock Script
- cat > /etc/sysconfig/clock << "EOF"
- # Begin /etc/sysconfig/clock
- UTC=1
- # Set this to any options you might need to give to hwclock,
- # such as machine hardware clock type for Alphas.
- CLOCKPARAMS=
- # End /etc/sysconfig/clock
- EOF
- ### Configuring the Linux Console
- cat > /etc/sysconfig/console << "EOF"
- # Begin /etc/sysconfig/console
- CHARMAP="UTF-8"
- CODESET="Lat15"
- FONTFACE="Fixed"
- FONTSIZE="8x16"
- # End /etc/sysconfig/console
- EOF
- ### Configuring the sysklogd Script
- ### The rc.site File
- ### The Bash Shell Startup Files
- locale -a
- LC_ALL=en_US.utf8 locale charmap
- LC_ALL=en_US.utf8 locale language
- LC_ALL=en_US.utf8 locale charmap
- LC_ALL=en_US.utf8 locale int_curr_symbol
- LC_ALL=en_US.utf8 locale int_prefix
- cat > /etc/profile << "EOF"
- # Begin /etc/profile
- export LANG=en_US.UTF-8
- # End /etc/profile
- EOF
- ### Creating the /etc/inputrc File
- cat > /etc/inputrc << "EOF"
- # Begin /etc/inputrc
- # Modified by Chris Lynn <roryo@roryo.dynup.net>
- # Allow the command prompt to wrap to the next line
- set horizontal-scroll-mode Off
- # Enable 8bit input
- set meta-flag On
- set input-meta On
- # Turns off 8th bit stripping
- set convert-meta Off
- # Keep the 8th bit for display
- set output-meta On
- # none, visible or audible
- set bell-style none
- # All of the following map the escape sequence of the value
- # contained in the 1st argument to the readline specific functions
- "\eOd": backward-word
- "\eOc": forward-word
- # for linux console
- "\e[1~": beginning-of-line
- "\e[4~": end-of-line
- "\e[5~": beginning-of-history
- "\e[6~": end-of-history
- "\e[3~": delete-char
- "\e[2~": quoted-insert
- # for xterm
- "\eOH": beginning-of-line
- "\eOF": end-of-line
- # for Konsole
- "\e[H": beginning-of-line
- "\e[F": end-of-line
- # End /etc/inputrc
- EOF
- ### 8. Making the LFS System Bootable
- ### Creating the /etc/fstab File
- cat > /etc/fstab << "EOF"
- # Begin /etc/fstab
- # file system mount-point type options dump fsck
- # order
- /dev/sda1 / ext3 defaults 1 1
- proc /proc proc nosuid,noexec,nodev 0 0
- sysfs /sys sysfs nosuid,noexec,nodev 0 0
- devpts /dev/pts devpts gid=5,mode=620 0 0
- tmpfs /run tmpfs defaults 0 0
- devtmpfs /dev devtmpfs mode=0755,nosuid 0 0
- # End /etc/fstab
- EOF
- ### Linux-3.8.3
- cd $LFS/sources/
- tar xf linux-3.8.3.tar.xz
- cd $LFS/sources/linux-3.8.3/
- make mrproper
- make LANG=en_US.UTF-8 LC_ALL= menuconfig
- make
- make modules_install
- cp -v arch/x86/boot/bzImage /boot/vmlinuz-3.8.3-lfs-7.3
- cp -v System.map /boot/System.map-3.8.3
- cp -v .config /boot/config-3.8.3
- install -d /usr/share/doc/linux-3.8.3
- cp -r Documentation/* /usr/share/doc/linux-3.8.3
- install -v -m755 -d /etc/modprobe.d
- cat > /etc/modprobe.d/usb.conf << "EOF"
- # Begin /etc/modprobe.d/usb.conf
- install ohci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i ohci_hcd ; true
- install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i uhci_hcd ; true
- # End /etc/modprobe.d/usb.conf
- EOF
- cd $LFS/sources/
- #rm -rf $LFS/sources/linux-3.8.3/
- ### Using GRUB to Set Up the Boot Process
- #cd /tmp &&
- #grub-mkrescue --output=grub-img.iso &&
- #xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso
- grub-install /dev/sdb
- cat > /boot/grub/grub.cfg << "EOF"
- # Begin /boot/grub/grub.cfg
- set default=0
- set timeout=5
- insmod ext2
- set root=(hd0,1)
- menuentry "GNU/Linux, Linux 3.8.3-lfs-7.3" {
- linux /boot/vmlinuz-3.8.3-lfs-7.3 root=/dev/sda1 ro
- }
- EOF
- ### 9. The End
- ### The End
- echo 7.3 > /etc/lfs-release
- cat > /etc/lsb-release << "EOF"
- DISTRIB_ID="Linux From Scratch"
- DISTRIB_RELEASE="7.3"
- DISTRIB_CODENAME="lfs"
- DISTRIB_DESCRIPTION="Linux From Scratch"
- EOF
- ### Rebooting the System
- logout
- umount -v $LFS/dev/pts
- if [ -h $LFS/dev/shm ]; then
- link=$(readlink $LFS/dev/shm)
- umount -v $LFS/$link
- unset link
- else
- umount -v $LFS/dev/shm
- fi
- umount -v $LFS/dev
- umount -v $LFS/proc
- umount -v $LFS/sys
- umount -v $LFS
- shutdown -r now
- ## sukzezz :)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement