t3ll0

LFS command log (7.3) 2013

Apr 26th, 2013
554
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## Host System Requirements
  2. cat > version-check.sh << "EOF"
  3. #!/bin/bash
  4. # Simple script to list version numbers of critical development tools
  5.  
  6. export LC_ALL=C
  7. bash --version | head -n1 | cut -d" " -f2-4
  8. echo "/bin/sh -> `readlink -f /bin/sh`"
  9. echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-
  10. bison --version | head -n1
  11. if [ -e /usr/bin/yacc ];
  12.   then echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`";
  13.   else echo "yacc not found"; fi
  14.  
  15. bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f1,6-
  16. echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2
  17. diff --version | head -n1
  18. find --version | head -n1
  19. gawk --version | head -n1
  20. if [ -e /usr/bin/awk ];
  21.   then echo "/usr/bin/awk -> `readlink -f /usr/bin/awk`";
  22.   else echo "awk not found"; fi
  23.  
  24. gcc --version | head -n1
  25. ldd --version | head -n1 | cut -d" " -f2-  # glibc version
  26. grep --version | head -n1
  27. gzip --version | head -n1
  28. cat /proc/version
  29. m4 --version | head -n1
  30. make --version | head -n1
  31. patch --version | head -n1
  32. echo Perl `perl -V:version`
  33. sed --version | head -n1
  34. tar --version | head -n1
  35. echo "Texinfo: `makeinfo --version | head -n1`"
  36. xz --version | head -n1
  37.  
  38. echo 'main(){}' > dummy.c && gcc -o dummy dummy.c
  39. if [ -x dummy ]
  40.   then echo "gcc compilation OK";
  41.   else echo "gcc compilation failed"; fi
  42. rm -f dummy.c dummy
  43. EOF
  44.  
  45. bash version-check.sh
  46.  
  47. ###  Mounting the New Partition
  48. export LFS=/mnt/lfs
  49. mkdir -pv $LFS
  50. mount -v -t ext3 /dev/sdb1 $LFS
  51.  
  52. ###  Introduction
  53. mkdir -v $LFS/sources
  54. chmod -v a+wt $LFS/sources
  55. wget -i wget-list -P $LFS/sources
  56. pushd $LFS/sources
  57. md5sum -c md5sums
  58. popd
  59.  
  60. ###  4. Final Preparations
  61.  
  62. ###  About $LFS
  63. echo $LFS
  64. export LFS=/mnt/lfs
  65.  
  66. ###  Creating the $LFS/tools Directory
  67. mkdir -v $LFS/tools
  68. ln -sv $LFS/tools /
  69.  
  70. ###  Adding the LFS User
  71. groupadd lfs
  72. useradd -s /bin/bash -g lfs -m -k /dev/null lfs
  73. passwd lfs
  74. chown -v lfs $LFS/tools
  75. chown -v lfs $LFS/sources
  76. su - lfs
  77.  
  78. ###  Setting Up the Environment
  79. cat > ~/.bash_profile << "EOF"
  80. exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
  81. EOF
  82. cat > ~/.bashrc << "EOF"
  83. set +h
  84. umask 022
  85. LFS=/mnt/lfs
  86. LC_ALL=POSIX
  87. LFS_TGT=$(uname -m)-lfs-linux-gnu
  88. PATH=/tools/bin:/bin:/usr/bin
  89. export LFS LC_ALL LFS_TGT PATH
  90. EOF
  91. source ~/.bash_profile
  92.  
  93. ###  General Compilation Instructions
  94. echo $LFS
  95.  
  96. ###  Binutils-2.23.1 - Pass 1
  97. cd $LFS/sources/
  98. tar xf binutils-2.23.1.tar.bz2
  99. cd $LFS/sources/binutils-2.23.1/
  100. mkdir -v ../binutils-build
  101. cd ../binutils-build
  102. ../binutils-2.23.1/configure     \
  103.     --prefix=/tools            \
  104.     --with-sysroot=$LFS        \
  105.     --with-lib-path=/tools/lib \
  106.     --target=$LFS_TGT          \
  107.     --disable-nls              \
  108.     --disable-werror
  109. make
  110. case $(uname -m) in
  111.   x86_64) mkdir -v /tools/lib && ln -sv lib /tools/lib64 ;;
  112. esac
  113. make install
  114. cd $LFS/sources/
  115. rm -rf $LFS/sources/binutils-build/
  116. cd $LFS/sources/
  117. rm -rf $LFS/sources/binutils-2.23.1/
  118.  
  119. ###  GCC-4.7.2 - Pass 1
  120. cd $LFS/sources/
  121. tar xf gcc-4.7.2.tar.bz2
  122. cd $LFS/sources/gcc-4.7.2/
  123. tar -Jxf ../mpfr-3.1.1.tar.xz
  124. mv -v mpfr-3.1.1 mpfr
  125. tar -Jxf ../gmp-5.1.1.tar.xz
  126. mv -v gmp-5.1.1 gmp
  127. tar -zxf ../mpc-1.0.1.tar.gz
  128. mv -v mpc-1.0.1 mpc
  129. for file in \
  130.  $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
  131. do
  132.   cp -uv $file{,.orig}
  133.   sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
  134.       -e 's@/usr@/tools@g' $file.orig > $file
  135.   echo '
  136. #undef STANDARD_STARTFILE_PREFIX_1
  137. #undef STANDARD_STARTFILE_PREFIX_2
  138. #define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
  139. #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
  140.   touch $file.orig
  141. done
  142. sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure
  143. sed -i 's/BUILD_INFO=info/BUILD_INFO=/' gcc/configure
  144. mkdir -v ../gcc-build
  145. cd ../gcc-build
  146. ../gcc-4.7.2/configure         \
  147.     --target=$LFS_TGT          \
  148.     --prefix=/tools            \
  149.     --with-sysroot=$LFS        \
  150.     --with-newlib              \
  151.     --without-headers          \
  152.     --with-local-prefix=/tools \
  153.     --with-native-system-header-dir=/tools/include \
  154.     --disable-nls              \
  155.     --disable-shared           \
  156.     --disable-multilib         \
  157.     --disable-decimal-float    \
  158.     --disable-threads          \
  159.     --disable-libmudflap       \
  160.     --disable-libssp           \
  161.     --disable-libgomp          \
  162.     --disable-libquadmath      \
  163.     --enable-languages=c       \
  164.     --with-mpfr-include=$(pwd)/../gcc-4.7.2/mpfr/src \
  165.     --with-mpfr-lib=$(pwd)/mpfr/src/.libs
  166. make
  167. make install
  168. ln -sv libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | sed 's/libgcc/&_eh/'`
  169. cd $LFS/sources/
  170. rm -rf $LFS/sources/gcc-build/
  171. cd $LFS/sources/
  172. rm -rf $LFS/sources/gcc-4.7.2/
  173.  
  174. ###  Linux-3.8.3 API Headers
  175. cd $LFS/sources/
  176. tar xf linux-3.8.1.tar.xz
  177. cd $LFS/sources/linux-3.8.1/
  178. make mrproper
  179. make headers_check
  180. make INSTALL_HDR_PATH=dest headers_install
  181.  
  182. cp -rv dest/include/* /tools/include
  183. cd $LFS/sources/
  184. rm -rf $LFS/sources/linux-3.8.1/
  185.  
  186. ###  Glibc-2.17
  187. cd $LFS/sources/
  188. rm -rf $LFS/sources/glibc-2.17/
  189. cd $LFS/sources/
  190. tar xf glibc-2.17.tar.xz
  191. cd $LFS/sources/glibc-2.17/
  192. if [ ! -r /usr/include/rpc/types.h ]; then
  193.   su -c 'mkdir -p /usr/include/rpc'
  194.   su -c 'cp -v sunrpc/rpc/*.h /usr/include/rpc'
  195. fi
  196. mkdir -v ../glibc-build
  197. cd ../glibc-build
  198. ../glibc-2.17/configure                             \
  199.       --prefix=/tools                                 \
  200.       --host=$LFS_TGT                                 \
  201.       --build=$(../glibc-2.17/scripts/config.guess) \
  202.       --disable-profile                               \
  203.       --enable-kernel=2.6.25                          \
  204.       --with-headers=/tools/include                   \
  205.       libc_cv_forced_unwind=yes                       \
  206.       libc_cv_ctors_header=yes                        \
  207.       libc_cv_c_cleanup=yes
  208. make
  209. make install
  210. echo 'main(){}' > dummy.c
  211. $LFS_TGT-gcc dummy.c
  212. readelf -l a.out | grep ': /tools'
  213. rm -v dummy.c a.out
  214. cd $LFS/sources/
  215. rm -rf $LFS/sources/glibc-build/
  216. cd $LFS/sources/
  217. rm -rf $LFS/sources/glibc-2.17/
  218. ok
  219. ###  Binutils-2.23.1 - Pass 2
  220. cd $LFS/sources/
  221. tar xf binutils-2.23.1.tar.bz2
  222. cd $LFS/sources/binutils-2.23.1/
  223. mkdir -v ../binutils-build
  224. cd ../binutils-build
  225. CC=$LFS_TGT-gcc            \
  226. AR=$LFS_TGT-ar             \
  227. RANLIB=$LFS_TGT-ranlib     \
  228. ../binutils-2.23.1/configure \
  229.     --prefix=/tools        \
  230.     --disable-nls          \
  231.     --with-lib-path=/tools/lib
  232. make
  233. make install
  234. make -C ld clean
  235. make -C ld LIB_PATH=/usr/lib:/lib
  236. cp -v ld/ld-new /tools/bin
  237. cd $LFS/sources/
  238. rm -rf $LFS/sources/binutils-build/
  239. rm -rf $LFS/sources/binutils-2.23.1/
  240.  
  241. ###  GCC-4.7.2 - Pass 2
  242. cd $LFS/sources/
  243. tar xf gcc-4.7.2.tar.bz2
  244. cd $LFS/sources/gcc-4.7.2/
  245. cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
  246.   `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/include-fixed/limits.h
  247. cp -v gcc/Makefile.in{,.tmp}
  248. sed 's/^T_CFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \
  249.   > gcc/Makefile.in
  250. for file in \
  251.  $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
  252. do
  253.   cp -uv $file{,.orig}
  254.   sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
  255.   -e 's@/usr@/tools@g' $file.orig > $file
  256.   echo '
  257. #undef STANDARD_STARTFILE_PREFIX_1
  258. #undef STANDARD_STARTFILE_PREFIX_2
  259. #define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
  260. #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
  261.   touch $file.orig
  262. done
  263. tar -Jxf ../mpfr-3.1.1.tar.xz
  264. mv -v mpfr-3.1.1 mpfr
  265. tar -Jxf ../gmp-5.1.1.tar.xz
  266. mv -v gmp-5.1.1 gmp
  267. tar -zxf ../mpc-1.0.1.tar.gz
  268. mv -v mpc-1.0.1 mpc
  269. sed -i 's/BUILD_INFO=info/BUILD_INFO=/' gcc/configure
  270. mkdir -v ../gcc-build
  271. cd ../gcc-build
  272. CC=$LFS_TGT-gcc \
  273. AR=$LFS_TGT-ar                  \
  274. RANLIB=$LFS_TGT-ranlib          \
  275. ../gcc-4.7.2/configure          \
  276.     --prefix=/tools             \
  277.     --with-local-prefix=/tools  \
  278.     --with-native-system-header-dir=/tools/include \
  279.     --enable-clocale=gnu        \
  280.     --enable-shared             \
  281.     --enable-threads=posix      \
  282.     --enable-__cxa_atexit       \
  283.     --enable-languages=c,c++    \
  284.     --disable-libstdcxx-pch     \
  285.     --disable-multilib          \
  286.     --disable-bootstrap         \
  287.     --disable-libgomp           \
  288.     --with-mpfr-include=$(pwd)/../gcc-4.7.2/mpfr/src \
  289.     --with-mpfr-lib=$(pwd)/mpfr/src/.libs
  290. make
  291. make install
  292. ln -sv gcc /tools/bin/cc
  293. echo 'main(){}' > dummy.c
  294. cc dummy.c
  295. readelf -l a.out | grep ': /tools'
  296. rm -v dummy.c a.out
  297. cd $LFS/sources/
  298. rm -rf $LFS/sources/gcc-build/
  299. cd $LFS/sources/
  300. rm -rf $LFS/sources/gcc-4.7.2/
  301.  
  302. ###  Tcl-8.6.0
  303. cd $LFS/sources/
  304. tar xf tcl8.6.0-src.tar.gz
  305. cd $LFS/sources/tcl8.6.0/
  306. cd unix
  307. ./configure --prefix=/tools
  308. make
  309. TZ=UTC make test
  310. make install
  311. chmod -v u+w /tools/lib/libtcl8.6.so
  312. make install-private-headers
  313. ln -sv tclsh8.6 /tools/bin/tclsh
  314. cd $LFS/sources/
  315. rm -rf $LFS/sources/tcl8.6.0/
  316.  
  317. ###  Expect-5.45
  318. cd $LFS/sources/
  319. tar xf expect5.45.tar.gz
  320. cd $LFS/sources/expect5.45/
  321. cp -v configure{,.orig}
  322. sed 's:/usr/local/bin:/bin:' configure.orig > configure
  323. ./configure --prefix=/tools --with-tcl=/tools/lib \
  324.   --with-tclinclude=/tools/include
  325. make
  326. make test
  327. make SCRIPTS="" install
  328. cd $LFS/sources/
  329. rm -rf $LFS/sources/expect5.45/
  330.  
  331. ###  DejaGNU-1.5
  332. cd $LFS/sources/
  333. tar xf dejagnu-1.5.tar.gz
  334. cd $LFS/sources/dejagnu-1.5/
  335. ./configure --prefix=/tools
  336. make install
  337. make check
  338. cd $LFS/sources/
  339. rm -rf $LFS/sources/dejagnu-1.5/
  340.  
  341. ###  Check-0.9.9
  342. cd $LFS/sources/
  343. tar xf check-0.9.9.tar.gz
  344. cd $LFS/sources/check-0.9.9/
  345. ./configure --prefix=/tools
  346. make
  347. #make check
  348. make install
  349. cd $LFS/sources/
  350. rm -rf $LFS/sources/check-0.9.9/
  351.  
  352. ###  Ncurses-5.9
  353. cd $LFS/sources/
  354. tar xf ncurses-5.9.tar.gz
  355. cd $LFS/sources/ncurses-5.9/
  356. ./configure --prefix=/tools --with-shared \
  357.     --without-debug --without-ada --enable-overwrite
  358. make
  359. make install
  360. cd $LFS/sources/
  361. rm -rf $LFS/sources/ncurses-5.9/
  362.  
  363. ###  Bash-4.2
  364. cd $LFS/sources/
  365. tar xf bash-4.2.tar.gz
  366. cd $LFS/sources/bash-4.2/
  367. patch -Np1 -i ../bash-4.2-fixes-11.patch
  368. ./configure --prefix=/tools --without-bash-malloc
  369. make
  370. #make tests
  371. make install
  372. ln -sv bash /tools/bin/sh
  373. cd $LFS/sources/
  374. rm -rf $LFS/sources/bash-4.2/
  375.  
  376. ###  Bzip2-1.0.6
  377. cd $LFS/sources/
  378. tar xf bzip2-1.0.6.tar.gz
  379. cd $LFS/sources/bzip2-1.0.6/
  380. make
  381. make PREFIX=/tools install
  382. cd $LFS/sources/
  383. rm -rf $LFS/sources/bzip2-1.0.6/
  384.  
  385. ###  Coreutils-8.21
  386. cd $LFS/sources/
  387. tar xf coreutils-8.21.tar.xz
  388. cd $LFS/sources/coreutils-8.21/
  389. ./configure --prefix=/tools --enable-install-program=hostname
  390. make
  391. #make RUN_EXPENSIVE_TESTS=yes check
  392. make install
  393. cd $LFS/sources/
  394. rm -rf $LFS/sources/coreutils-8.21/
  395.  
  396. ###  Diffutils-3.2
  397. cd $LFS/sources/
  398. tar xf diffutils-3.2.tar.gz
  399. cd $LFS/sources/diffutils-3.2/
  400. sed -i -e '/gets is a/d' lib/stdio.in.h
  401. ./configure --prefix=/tools
  402. make
  403. #make check
  404. make install
  405. cd $LFS/sources/
  406. rm -rf $LFS/sources/diffutils-3.2/
  407.  
  408. ###  File-5.13
  409. cd $LFS/sources/
  410. tar xf file-5.13.tar.gz
  411. cd $LFS/sources/file-5.13/
  412. ./configure --prefix=/tools
  413. make
  414. #make check
  415. make install
  416. cd $LFS/sources/
  417. rm -rf $LFS/sources/file-5.13/
  418.  
  419. ###  Findutils-4.4.2
  420. cd $LFS/sources/
  421. tar xf findutils-4.4.2.tar.gz
  422. cd $LFS/sources/findutils-4.4.2/
  423. ./configure --prefix=/tools
  424. make
  425. #make check
  426. make install
  427. cd $LFS/sources/
  428. rm -rf $LFS/sources/findutils-4.4.2/
  429.  
  430. ###  Gawk-4.0.2
  431. cd $LFS/sources/
  432. tar xf gawk-4.0.2.tar.xz
  433. cd $LFS/sources/gawk-4.0.2/
  434. ./configure --prefix=/tools
  435. make
  436. #make check
  437. make install
  438. cd $LFS/sources/
  439. rm -rf $LFS/sources/gawk-4.0.2/
  440.  
  441. ###  Gettext-0.18.2
  442. cd $LFS/sources/
  443. tar xf gettext-0.18.2.tar.gz
  444. cd $LFS/sources/gettext-0.18.2/
  445. cd gettext-tools
  446. EMACS="no" ./configure --prefix=/tools --disable-shared
  447. make -C gnulib-lib
  448. make -C src msgfmt
  449. cp -v src/msgfmt /tools/bin
  450. cd $LFS/sources/
  451. rm -rf $LFS/sources/gettext-0.18.2/
  452.  
  453. ###  Grep-2.14
  454. cd $LFS/sources/
  455. tar xf grep-2.14.tar.xz
  456. cd $LFS/sources/grep-2.14/
  457. ./configure --prefix=/tools
  458. make
  459. #make check
  460. make install
  461. cd $LFS/sources/
  462. rm -rf $LFS/sources/grep-2.14/
  463.  
  464. ###  Gzip-1.5
  465. cd $LFS/sources/
  466. tar xf gzip-1.5.tar.xz
  467. cd $LFS/sources/gzip-1.5/
  468. ./configure --prefix=/tools
  469. make
  470. #make check
  471. make install
  472. cd $LFS/sources/
  473. rm -rf $LFS/sources/gzip-1.5/
  474.  
  475. ###  M4-1.4.16
  476. cd $LFS/sources/
  477. tar xf m4-1.4.16.tar.bz2
  478. cd $LFS/sources/m4-1.4.16/
  479. sed -i -e '/gets is a/d' lib/stdio.in.h
  480. ./configure --prefix=/tools
  481. make
  482. #make check
  483. make install
  484. cd $LFS/sources/
  485. rm -rf $LFS/sources/m4-1.4.16/
  486.  
  487. ###  Make-3.82
  488. cd $LFS/sources/
  489. tar xf make-3.82.tar.bz2
  490. cd $LFS/sources/make-3.82/
  491. ./configure --prefix=/tools
  492. make
  493. #make check
  494. make install
  495. cd $LFS/sources/
  496. rm -rf $LFS/sources/make-3.82/
  497.  
  498. ###  Patch-2.7.1
  499. cd $LFS/sources/
  500. tar xf patch-2.7.1.tar.xz
  501. cd $LFS/sources/patch-2.7.1/
  502. ./configure --prefix=/tools
  503. make
  504. #make check
  505. make install
  506. cd $LFS/sources/
  507. rm -rf $LFS/sources/patch-2.7.1/
  508.  
  509. ###  Perl-5.16.2
  510. cd $LFS/sources/
  511. tar xf perl-5.16.2.tar.bz2
  512. cd $LFS/sources/perl-5.16.2/
  513. patch -Np1 -i ../perl-5.16.2-libc-1.patch
  514. sh Configure -des -Dprefix=/tools
  515. make
  516. cp -v perl cpan/podlators/pod2man /tools/bin
  517. mkdir -pv /tools/lib/perl5/5.16.2
  518. cp -Rv lib/* /tools/lib/perl5/5.16.2
  519. cd $LFS/sources/
  520. rm -rf $LFS/sources/perl-5.16.2/
  521.  
  522. ###  Sed-4.2.2
  523. cd $LFS/sources/
  524. tar xf sed-4.2.2.tar.bz2
  525. cd $LFS/sources/sed-4.2.2/
  526. ./configure --prefix=/tools
  527. make
  528. #make check
  529. make install
  530. cd $LFS/sources/
  531. rm -rf $LFS/sources/sed-4.2.2/
  532.  
  533. ###  Tar-1.26
  534. cd $LFS/sources/
  535. tar xf tar-1.26.tar.bz2
  536. cd $LFS/sources/tar-1.26/
  537. sed -i -e '/gets is a/d' gnu/stdio.in.h
  538. ./configure --prefix=/tools
  539. make
  540. #make check
  541. make install
  542. cd $LFS/sources/
  543. rm -rf $LFS/sources/tar-1.26/
  544.  
  545. ###  Texinfo-5.0
  546. cd $LFS/sources/
  547. tar xf texinfo-5.0.tar.xz
  548. cd $LFS/sources/texinfo-5.0/
  549. ./configure --prefix=/tools
  550. make
  551. #make check
  552. make install
  553. cd $LFS/sources/
  554. rm -rf $LFS/sources/texinfo-5.0/
  555.  
  556. ###  Xz-5.0.4
  557. cd $LFS/sources/
  558. tar xf xz-5.0.4.tar.xz
  559. cd $LFS/sources/xz-5.0.4/
  560. ./configure --prefix=/tools
  561. make
  562. #make check
  563. make install
  564. cd $LFS/sources/
  565. rm -rf $LFS/sources/xz-5.0.4/
  566.  
  567. ###  Stripping
  568. #strip --strip-debug /tools/lib/*
  569. #strip --strip-unneeded /tools/{,s}bin/*
  570. rm -rf /tools/{,share}/{info,man,doc}
  571.  
  572. ###  Changing Ownership
  573. chown -R root:root $LFS/tools
  574.  
  575. ###  Preparing Virtual Kernel File Systems
  576. mkdir -v $LFS/{dev,proc,sys}
  577. mknod -m 600 $LFS/dev/console c 5 1
  578. mknod -m 666 $LFS/dev/null c 1 3
  579. mount -v --bind /dev $LFS/dev
  580. mount -vt devpts devpts $LFS/dev/pts
  581. mount -vt proc proc $LFS/proc
  582. mount -vt sysfs sysfs $LFS/sys
  583. if [ -h $LFS/dev/shm ]; then
  584.   link=$(readlink $LFS/dev/shm)
  585.   mkdir -p $LFS/$link
  586.   mount -vt tmpfs shm $LFS/$link
  587.   unset link
  588. else
  589.   mount -vt tmpfs shm $LFS/dev/shm
  590. fi
  591.  
  592. ###  Entering the Chroot Environment
  593. chroot "$LFS" /tools/bin/env -i \
  594.     HOME=/root                  \
  595.     TERM="$TERM"                \
  596.     PS1='\u:\w\$ '              \
  597.     PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
  598.     /tools/bin/bash --login +h
  599.  
  600. ###  Creating Directories
  601. mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib,mnt,opt,run}
  602. mkdir -pv /{media/{floppy,cdrom},sbin,srv,var}
  603. install -dv -m 0750 /root
  604. install -dv -m 1777 /tmp /var/tmp
  605. mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
  606. mkdir -pv /usr/{,local/}share/{doc,info,locale,man}
  607. mkdir -v  /usr/{,local/}share/{misc,terminfo,zoneinfo}
  608. mkdir -pv /usr/{,local/}share/man/man{1..8}
  609. for dir in /usr /usr/local; do
  610.   ln -sv share/{man,doc,info} $dir
  611. done
  612. case $(uname -m) in
  613.  x86_64) ln -sv lib /lib64 && ln -sv lib /usr/lib64 ;;
  614. esac
  615. mkdir -v /var/{log,mail,spool}
  616. ln -sv /run /var/run
  617. ln -sv /run/lock /var/lock
  618. mkdir -pv /var/{opt,cache,lib/{misc,locate},local}
  619.  
  620. ###  Creating Essential Files and Symlinks
  621. ln -sv /tools/bin/{bash,cat,echo,pwd,stty} /bin
  622. ln -sv /tools/bin/perl /usr/bin
  623. ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib
  624. ln -sv /tools/lib/libstdc++.so{,.6} /usr/lib
  625. sed 's/tools/usr/' /tools/lib/libstdc++.la > /usr/lib/libstdc++.la
  626. ln -sv bash /bin/sh
  627. touch /etc/mtab
  628. cat > /etc/passwd << "EOF"
  629. root:x:0:0:root:/root:/bin/bash
  630. bin:x:1:1:bin:/dev/null:/bin/false
  631. nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
  632. EOF
  633. cat > /etc/group << "EOF"
  634. root:x:0:
  635. bin:x:1:
  636. sys:x:2:
  637. kmem:x:3:
  638. tape:x:4:
  639. tty:x:5:
  640. daemon:x:6:
  641. floppy:x:7:
  642. disk:x:8:
  643. lp:x:9:
  644. dialout:x:10:
  645. audio:x:11:
  646. video:x:12:
  647. utmp:x:13:
  648. usb:x:14:
  649. cdrom:x:15:
  650. mail:x:34:
  651. nogroup:x:99:
  652. EOF
  653. exec /tools/bin/bash --login +h
  654. touch /var/log/{btmp,lastlog,wtmp}
  655. chgrp -v utmp /var/log/lastlog
  656. chmod -v 664  /var/log/lastlog
  657. chmod -v 600  /var/log/btmp
  658.  
  659. ###  Linux-3.8.3 API Headers
  660. cd $LFS/sources/
  661. tar xf linux-3.8.3.tar.xz
  662. cd $LFS/sources/linux-3.8.3/
  663. make mrproper
  664. make headers_check
  665. make INSTALL_HDR_PATH=dest headers_install
  666. find dest/include \( -name .install -o -name ..install.cmd \) -delete
  667.  
  668. cp -rv dest/include/* /usr/include
  669. cd $LFS/sources/
  670. rm -rf $LFS/sources/linux-3.8.3/
  671.  
  672. ###  Man-pages-3.47
  673. cd $LFS/sources/
  674. tar xf man-pages-3.47.tar.xz
  675. cd $LFS/sources/man-pages-3.47/
  676. make install
  677. cd $LFS/sources/
  678. rm -rf $LFS/sources/man-pages-3.47/
  679.  
  680. ###  Glibc-2.17
  681. cd $LFS/sources/
  682. tar xf glibc-2.17.tar.xz
  683. cd $LFS/sources/glibc-2.17/
  684. mkdir -v ../glibc-build
  685. cd ../glibc-build
  686. ../glibc-2.17/configure  \
  687.     --prefix=/usr          \
  688.     --disable-profile      \
  689.     --enable-kernel=2.6.25 \
  690.     --libexecdir=/usr/lib/glibc
  691. make
  692. make -k check 2>&1 | tee glibc-check-log
  693. grep Error glibc-check-log
  694. touch /etc/ld.so.conf
  695. make install
  696. cp -v ../glibc-2.17/sunrpc/rpc/*.h /usr/include/rpc
  697. cp -v ../glibc-2.17/sunrpc/rpcsvc/*.h /usr/include/rpcsvc
  698. cp -v ../glibc-2.17/nis/rpcsvc/*.h /usr/include/rpcsvc
  699. mkdir -pv /usr/lib/locale
  700. localedef -i en_US -f ISO-8859-1 en_US
  701. localedef -i en_US -f UTF-8 en_US.UTF-8
  702. cat > /etc/nsswitch.conf << "EOF"
  703. # Begin /etc/nsswitch.conf
  704.  
  705. passwd: files
  706. group: files
  707. shadow: files
  708.  
  709. hosts: files dns
  710. networks: files
  711.  
  712. protocols: files
  713. services: files
  714. ethers: files
  715. rpc: files
  716.  
  717. # End /etc/nsswitch.conf
  718. EOF
  719. tar -xf ../tzdata2012j.tar.gz
  720.  
  721. ZONEINFO=/usr/share/zoneinfo
  722. mkdir -pv $ZONEINFO/{posix,right}
  723.  
  724. for tz in etcetera southamerica northamerica europe africa antarctica  \
  725.           asia australasia backward pacificnew solar87 solar88 solar89 \
  726.           systemv; do
  727.     zic -L /dev/null   -d $ZONEINFO       -y "sh yearistype.sh" ${tz}
  728.     zic -L /dev/null   -d $ZONEINFO/posix -y "sh yearistype.sh" ${tz}
  729.     zic -L leapseconds -d $ZONEINFO/right -y "sh yearistype.sh" ${tz}
  730. done
  731.  
  732. cp -v zone.tab iso3166.tab $ZONEINFO
  733. zic -d $ZONEINFO -p Asia/Hong_Kong
  734. unset ZONEINFO
  735. tzselect
  736. cp -v --remove-destination /usr/share/zoneinfo/Asia/Hong_Kong \
  737.     /etc/localtime
  738. cat > /etc/ld.so.conf << "EOF"
  739. # Begin /etc/ld.so.conf
  740. /usr/local/lib
  741. /opt/lib
  742.  
  743. EOF
  744. cat >> /etc/ld.so.conf << "EOF"
  745. # Add an include directory
  746. include /etc/ld.so.conf.d/*.conf
  747.  
  748. EOF
  749. mkdir /etc/ld.so.conf.d
  750. cd $LFS/sources/
  751. rm -rf $LFS/sources/glibc-build/
  752. cd $LFS/sources/
  753. rm -rf $LFS/sources/glibc-2.17/
  754.  
  755. ###  Adjusting the  Toolchain
  756. mv -v /tools/bin/{ld,ld-old}
  757. mv -v /tools/$(gcc -dumpmachine)/bin/{ld,ld-old}
  758. mv -v /tools/bin/{ld-new,ld}
  759. ln -sv /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld
  760. gcc -dumpspecs | sed -e 's@/tools@@g' \
  761.     -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
  762.     -e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > \
  763.     `dirname $(gcc --print-libgcc-file-name)`/specs
  764. echo 'main(){}' > dummy.c
  765. cc dummy.c -v -Wl,--verbose &> dummy.log
  766. readelf -l a.out | grep ': /lib'
  767. grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log
  768. grep -B1 '^ /usr/include' dummy.log
  769. grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
  770. grep "/lib.*/libc.so.6 " dummy.log
  771. grep found dummy.log
  772. rm -v dummy.c a.out dummy.log
  773.  
  774. ###  Zlib-1.2.7
  775. cd $LFS/sources/
  776. tar xf zlib-1.2.7.tar.bz2
  777. cd $LFS/sources/zlib-1.2.7/
  778. ./configure --prefix=/usr
  779. make
  780. make check
  781. make install
  782. mv -v /usr/lib/libz.so.* /lib
  783. ln -sfv ../../lib/libz.so.1.2.7 /usr/lib/libz.so
  784. cd $LFS/sources/
  785. rm -rf $LFS/sources/zlib-1.2.7/
  786.  
  787. ###  File-5.13
  788. cd $LFS/sources/
  789. tar xf file-5.13.tar.gz
  790. cd $LFS/sources/file-5.13/
  791. ./configure --prefix=/usr
  792. make
  793. make check
  794. make install
  795. cd $LFS/sources/
  796. rm -rf $LFS/sources/file-5.13/
  797.  
  798. ###  Binutils-2.23.1
  799. cd $LFS/sources/
  800. tar xf binutils-2.23.1.tar.bz2
  801. cd $LFS/sources/binutils-2.23.1/
  802. expect -c "spawn ls"
  803. rm -fv etc/standards.info
  804. sed -i.bak '/^INFO/s/standards.info //' etc/Makefile.in
  805. patch -Np1 -i ../binutils-2.23.1-testsuite_fix-1.patch
  806. mkdir -v ../binutils-build
  807. cd ../binutils-build
  808. ../binutils-2.23.1/configure --prefix=/usr --enable-shared
  809. make tooldir=/usr
  810. make check
  811. make tooldir=/usr install
  812. cp -v ../binutils-2.23.1/include/libiberty.h /usr/include
  813. cd $LFS/sources/
  814. rm -rf $LFS/sources/binutils-build/
  815. rm -rf $LFS/sources/binutils-2.23.1/
  816.  
  817. ###  GMP-5.1.1
  818. cd $LFS/sources/
  819. tar xf gmp-5.1.1.tar.xz
  820. cd $LFS/sources/gmp-5.1.1/
  821. ABI=32 ./configure --prefix=/usr --enable-cxx
  822. make
  823. make check 2>&1 | tee gmp-check-log
  824. awk '/tests passed/{total+=$2} ; END{print total}' gmp-check-log
  825. make install
  826. mkdir -v /usr/share/doc/gmp-5.1.1
  827. cp    -v doc/{isa_abi_headache,configuration} doc/*.html \
  828.          /usr/share/doc/gmp-5.1.1
  829. cd $LFS/sources/
  830. rm -rf $LFS/sources/gmp-5.1.1/
  831.  
  832. ###  MPFR-3.1.1
  833. cd $LFS/sources/
  834. tar xf mpfr-3.1.1.tar.xz
  835. cd $LFS/sources/mpfr-3.1.1/
  836. ./configure  --prefix=/usr        \
  837.              --enable-thread-safe \
  838.              --docdir=/usr/share/doc/mpfr-3.1.1
  839. make
  840. make check
  841. make install
  842. make html
  843.  
  844. make install-html
  845. cd $LFS/sources/
  846. rm -rf $LFS/sources/mpfr-3.1.1/
  847.  
  848. ###  MPC-1.0.1
  849. cd $LFS/sources/
  850. tar xf mpc-1.0.1.tar.gz
  851. cd $LFS/sources/mpc-1.0.1/
  852. ./configure --prefix=/usr
  853. make
  854. make check
  855. make install
  856. cd $LFS/sources/
  857. rm -rf $LFS/sources/mpc-1.0.1/
  858.  
  859. ###  GCC-4.7.2
  860. cd $LFS/sources/
  861. tar xf gcc-4.7.2.tar.bz2
  862. cd $LFS/sources/gcc-4.7.2/
  863. sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
  864. sed -i 's/BUILD_INFO=info/BUILD_INFO=/' gcc/configure
  865. case `uname -m` in
  866.   i?86) sed -i 's/^T_CFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in ;;
  867. esac
  868. sed -i -e /autogen/d -e /check.sh/d fixincludes/Makefile.in
  869. mkdir -v ../gcc-build
  870. cd ../gcc-build
  871. ../gcc-4.7.2/configure --prefix=/usr            \
  872.                        --libexecdir=/usr/lib    \
  873.                        --enable-shared          \
  874.                        --enable-threads=posix   \
  875.                        --enable-__cxa_atexit    \
  876.                        --enable-clocale=gnu     \
  877.                        --enable-languages=c,c++ \
  878.                        --disable-multilib       \
  879.                        --disable-bootstrap      \
  880.                        --with-system-zlib
  881. make
  882. ulimit -s 32768
  883. make -k check
  884. ../gcc-4.7.2/contrib/test_summary
  885. make install
  886. ln -sv ../usr/bin/cpp /lib
  887. ln -sv gcc /usr/bin/cc
  888. echo 'main(){}' > dummy.c
  889. cc dummy.c -v -Wl,--verbose &> dummy.log
  890. readelf -l a.out | grep ': /lib'
  891. grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log
  892. grep -B4 '^ /usr/include' dummy.log
  893. grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
  894. grep "/lib.*/libc.so.6 " dummy.log
  895. grep found dummy.log
  896. rm -v dummy.c a.out dummy.log
  897. mkdir -pv /usr/share/gdb/auto-load/usr/lib
  898. mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib
  899. cd $LFS/sources/
  900. rm -rf $LFS/sources/gcc-build/
  901. rm -rf $LFS/sources/gcc-4.7.2/
  902.  
  903. ###  Sed-4.2.2
  904. cd $LFS/sources/
  905. tar xf sed-4.2.2.tar.bz2
  906. cd $LFS/sources/sed-4.2.2/
  907. ./configure --prefix=/usr --bindir=/bin --htmldir=/usr/share/doc/sed-4.2.2
  908. make
  909. make html
  910. make check
  911. make install
  912. make -C doc install-html
  913. cd $LFS/sources/
  914. rm -rf $LFS/sources/sed-4.2.2/
  915.  
  916. ###  Bzip2-1.0.6
  917. cd $LFS/sources/
  918. tar xf bzip2-1.0.6.tar.gz
  919. cd $LFS/sources/bzip2-1.0.6/
  920. patch -Np1 -i ../bzip2-1.0.6-install_docs-1.patch
  921. sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile
  922. sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile
  923. make -f Makefile-libbz2_so
  924. make clean
  925. make
  926. make PREFIX=/usr install
  927. cp -v bzip2-shared /bin/bzip2
  928. cp -av libbz2.so* /lib
  929. ln -sv ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so
  930. rm -v /usr/bin/{bunzip2,bzcat,bzip2}
  931. ln -sv bzip2 /bin/bunzip2
  932. ln -sv bzip2 /bin/bzcat
  933. cd $LFS/sources/
  934. rm -rf $LFS/sources/bzip2-1.0.6/
  935.  
  936. ###  Pkg-config-0.28
  937. cd $LFS/sources/
  938. tar xf pkg-config-0.28.tar.gz
  939. cd $LFS/sources/pkg-config-0.28/
  940. ./configure --prefix=/usr         \
  941.             --with-internal-glib  \
  942.             --disable-host-tool   \
  943.             --docdir=/usr/share/doc/pkg-config-0.28
  944. make
  945. make check
  946. make install
  947. cd $LFS/sources/
  948. rm -rf $LFS/sources/pkg-config-0.28/
  949.  
  950. ###  Ncurses-5.9
  951. cd $LFS/sources/
  952. tar xf ncurses-5.9.tar.gz
  953. cd $LFS/sources/ncurses-5.9/
  954. ./configure --prefix=/usr           \
  955.             --mandir=/usr/share/man \
  956.             --with-shared           \
  957.             --without-debug         \
  958.             --enable-pc-files       \
  959.             --enable-widec
  960. make
  961. make install
  962. mv -v /usr/lib/libncursesw.so.5* /lib
  963. ln -sfv ../../lib/libncursesw.so.5 /usr/lib/libncursesw.so
  964. for lib in ncurses form panel menu ; do
  965.     rm -vf                    /usr/lib/lib${lib}.so
  966.     echo "INPUT(-l${lib}w)" > /usr/lib/lib${lib}.so
  967.     ln -sfv lib${lib}w.a      /usr/lib/lib${lib}.a
  968.     ln -sfv ${lib}w.pc        /usr/lib/pkgconfig/${lib}.pc
  969. done
  970.  
  971. ln -sfv libncurses++w.a /usr/lib/libncurses++.a
  972. rm -vf                     /usr/lib/libcursesw.so
  973. echo "INPUT(-lncursesw)" > /usr/lib/libcursesw.so
  974. ln -sfv libncurses.so      /usr/lib/libcurses.so
  975. ln -sfv libncursesw.a      /usr/lib/libcursesw.a
  976. ln -sfv libncurses.a       /usr/lib/libcurses.a
  977. mkdir -v       /usr/share/doc/ncurses-5.9
  978. cp -v -R doc/* /usr/share/doc/ncurses-5.9
  979. cd $LFS/sources/
  980. rm -rf $LFS/sources/ncurses-5.9/
  981.  
  982. ###  Util-linux-2.22.2
  983. cd $LFS/sources/
  984. tar xf util-linux-2.22.2.tar.xz
  985. cd $LFS/sources/util-linux-2.22.2/
  986. sed -i -e 's@etc/adjtime@var/lib/hwclock/adjtime@g' \
  987.      $(grep -rl '/etc/adjtime' .)
  988.  
  989. mkdir -pv /var/lib/hwclock
  990. ./configure --disable-su --disable-sulogin --disable-login
  991. make
  992. make install
  993.  
  994. ###  Psmisc-22.20
  995. cd $LFS/sources/
  996. tar xf psmisc-22.20.tar.gz
  997. cd $LFS/sources/psmisc-22.20/
  998. ./configure --prefix=/usr
  999. make
  1000. make install
  1001. mv -v /usr/bin/fuser   /bin
  1002. mv -v /usr/bin/killall /bin
  1003. cd $LFS/sources/
  1004. rm -rf $LFS/sources/psmisc-22.20/
  1005.  
  1006. ###  Procps-ng-3.3.6
  1007. cd $LFS/sources/
  1008. tar xf procps-ng-3.3.6.tar.xz
  1009. cd $LFS/sources/procps-ng-3.3.6/
  1010. ./configure --prefix=/usr                           \
  1011.             --exec-prefix=                          \
  1012.             --libdir=/usr/lib                       \
  1013.             --docdir=/usr/share/doc/procps-ng-3.3.6 \
  1014.             --disable-static                        \
  1015.             --disable-skill                         \
  1016.             --disable-kill
  1017. make
  1018. pushd testsuite
  1019.   sed -i -e 's|exec which sleep|exec echo /tools/bin/sleep|' \
  1020.          -e 's|999999|&9|'                       config/unix.exp
  1021.   sed -i -e 's|pmap_initname\\\$|pmap_initname|' pmap.test/pmap.exp
  1022.   make site.exp
  1023.   DEJAGNU=global-conf.exp runtest
  1024. popd
  1025. make install
  1026. mv -v /usr/lib/libprocps.so.* /lib
  1027. ln -sfv ../../lib/libprocps.so.1.1.0 /usr/lib/libprocps.so
  1028. cd $LFS/sources/
  1029. rm -rf $LFS/sources/procps-ng-3.3.6/
  1030.  
  1031. ###  E2fsprogs-1.42.7
  1032. cd $LFS/sources/
  1033. tar xf e2fsprogs-1.42.7.tar.gz
  1034. cd $LFS/sources/e2fsprogs-1.42.7/
  1035. mkdir -v build
  1036. cd build
  1037. ../configure --prefix=/usr         \
  1038.              --with-root-prefix="" \
  1039.              --enable-elf-shlibs   \
  1040.              --disable-libblkid    \
  1041.              --disable-libuuid     \
  1042.              --disable-uuidd       \
  1043.              --disable-fsck
  1044. make
  1045. make check
  1046. make install
  1047. make install-libs
  1048. chmod -v u+w /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a
  1049. gunzip -v /usr/share/info/libext2fs.info.gz
  1050. install-info --dir-file=/usr/share/info/dir /usr/share/info/libext2fs.info
  1051. makeinfo -o      doc/com_err.info ../lib/et/com_err.texinfo
  1052. install -v -m644 doc/com_err.info /usr/share/info
  1053. install-info --dir-file=/usr/share/info/dir /usr/share/info/com_err.info
  1054. cd $LFS/sources/
  1055. rm -rf $LFS/sources/e2fsprogs-1.42.7/
  1056.  
  1057. ###  Shadow-4.1.5.1
  1058. cd $LFS/sources/
  1059. tar xf shadow-4.1.5.1.tar.bz2
  1060. cd $LFS/sources/shadow-4.1.5.1/
  1061. sed -i 's/groups$(EXEEXT) //' src/Makefile.in
  1062. find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;
  1063. sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \
  1064.        -e 's@/var/spool/mail@/var/mail@' etc/login.defs
  1065. ./configure --sysconfdir=/etc
  1066. make
  1067. make install
  1068. mv -v /usr/bin/passwd /bin
  1069. pwconv
  1070. grpconv
  1071. sed -i 's/yes/no/' /etc/default/useradd
  1072. passwd root
  1073. cd $LFS/sources/
  1074. rm -rf $LFS/sources/shadow-4.1.5.1/
  1075.  
  1076. ###  Coreutils-8.21
  1077. cd $LFS/sources/
  1078. tar xf coreutils-8.21.tar.xz
  1079. cd $LFS/sources/coreutils-8.21/
  1080. patch -Np1 -i ../coreutils-8.21-i18n-1.patch
  1081. FORCE_UNSAFE_CONFIGURE=1 ./configure \
  1082.             --prefix=/usr         \
  1083.             --libexecdir=/usr/lib \
  1084.             --enable-no-install-program=kill,uptime
  1085. make
  1086. make NON_ROOT_USERNAME=nobody check-root
  1087. echo "dummy:x:1000:nobody" >> /etc/group
  1088. chown -Rv nobody .
  1089. su nobody -s /bin/bash \
  1090.           -c "PATH=$PATH make RUN_EXPENSIVE_TESTS=yes check"
  1091. sed -i '/dummy/d' /etc/group
  1092. make install
  1093. mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /bin
  1094. mv -v /usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} /bin
  1095. mv -v /usr/bin/{rmdir,stty,sync,true,uname,test,[} /bin
  1096. mv -v /usr/bin/chroot /usr/sbin
  1097. mv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8
  1098. sed -i s/\"1\"/\"8\"/1 /usr/share/man/man8/chroot.8
  1099. mv -v /usr/bin/{head,sleep,nice} /bin
  1100. cd $LFS/sources/
  1101. rm -rf $LFS/sources/coreutils-8.21/
  1102.  
  1103. ###  Iana-Etc-2.30
  1104. cd $LFS/sources/
  1105. tar xf iana-etc-2.30.tar.bz2
  1106. cd $LFS/sources/iana-etc-2.30/
  1107. make
  1108. make install
  1109. cd $LFS/sources/
  1110. rm -rf $LFS/sources/iana-etc-2.30/
  1111.  
  1112. ###  M4-1.4.16
  1113. cd $LFS/sources/
  1114. tar xf m4-1.4.16.tar.bz2
  1115. cd $LFS/sources/m4-1.4.16/
  1116. sed -i -e '/gets is a/d' lib/stdio.in.h
  1117. ./configure --prefix=/usr
  1118. make
  1119. sed -i -e '41s/ENOENT/& || errno == EINVAL/' tests/test-readlink.h
  1120. make check
  1121. make install
  1122. cd $LFS/sources/
  1123. rm -rf $LFS/sources/m4-1.4.16/
  1124.  
  1125. ###  Bison-2.7
  1126. cd $LFS/sources/
  1127. tar xf bison-2.7.tar.xz
  1128. cd $LFS/sources/bison-2.7/
  1129. ./configure --prefix=/usr
  1130. echo '#define YYENABLE_NLS 1' >> lib/config.h
  1131. make
  1132. make check
  1133. make install
  1134. cd $LFS/sources/
  1135. rm -rf $LFS/sources/bison-2.7/
  1136.  
  1137. ###  Grep-2.14
  1138. cd $LFS/sources/
  1139. tar xf grep-2.14.tar.xz
  1140. cd $LFS/sources/grep-2.14/
  1141. ./configure --prefix=/usr --bindir=/bin
  1142. make
  1143. make check
  1144. make install
  1145. cd $LFS/sources/
  1146. rm -rf $LFS/sources/grep-2.14/
  1147.  
  1148. ###  Readline-6.2
  1149. cd $LFS/sources/
  1150. tar xf readline-6.2.tar.gz
  1151. cd $LFS/sources/readline-6.2/
  1152. sed -i '/MV.*old/d' Makefile.in
  1153. sed -i '/{OLDSUFF}/c:' support/shlib-install
  1154. patch -Np1 -i ../readline-6.2-fixes-1.patch
  1155. ./configure --prefix=/usr --libdir=/lib
  1156. make SHLIB_LIBS=-lncurses
  1157. make install
  1158. mv -v /lib/lib{readline,history}.a /usr/lib
  1159. rm -v /lib/lib{readline,history}.so
  1160. ln -sfv ../../lib/libreadline.so.6 /usr/lib/libreadline.so
  1161. ln -sfv ../../lib/libhistory.so.6 /usr/lib/libhistory.so
  1162. mkdir   -v       /usr/share/doc/readline-6.2
  1163. install -v -m644 doc/*.{ps,pdf,html,dvi} \
  1164.                  /usr/share/doc/readline-6.2
  1165. cd $LFS/sources/
  1166. rm -rf $LFS/sources/readline-6.2/
  1167.  
  1168. ###  Bash-4.2
  1169. cd $LFS/sources/
  1170. tar xf bash-4.2.tar.gz
  1171. cd $LFS/sources/bash-4.2/
  1172. patch -Np1 -i ../bash-4.2-fixes-11.patch
  1173. ./configure --prefix=/usr                     \
  1174.             --bindir=/bin                     \
  1175.             --htmldir=/usr/share/doc/bash-4.2 \
  1176.             --without-bash-malloc             \
  1177.             --with-installed-readline
  1178. make
  1179. chown -Rv nobody .
  1180. su nobody -s /bin/bash -c "PATH=$PATH make tests"
  1181. make install
  1182. exec /bin/bash --login +h
  1183. cd $LFS/sources/
  1184. rm -rf $LFS/sources/bash-4.2/
  1185.  
  1186. ###  Libtool-2.4.2
  1187. cd $LFS/sources/
  1188. tar xf libtool-2.4.2.tar.gz
  1189. cd $LFS/sources/libtool-2.4.2/
  1190. ./configure --prefix=/usr
  1191. make
  1192. make check
  1193. make install
  1194. cd $LFS/sources/
  1195. rm -rf $LFS/sources/libtool-2.4.2/
  1196.  
  1197. ###  GDBM-1.10
  1198. cd $LFS/sources/
  1199. tar xf gdbm-1.10.tar.gz
  1200. cd $LFS/sources/gdbm-1.10/
  1201. ./configure --prefix=/usr --enable-libgdbm-compat
  1202. make
  1203. make check
  1204. make install
  1205. cd $LFS/sources/
  1206. rm -rf $LFS/sources/gdbm-1.10/
  1207.  
  1208. ###  Inetutils-1.9.1
  1209. cd $LFS/sources/
  1210. tar xf inetutils-1.9.1.tar.gz
  1211. cd $LFS/sources/inetutils-1.9.1/
  1212. sed -i -e '/gets is a/d' lib/stdio.in.h
  1213. ./configure --prefix=/usr  \
  1214.     --libexecdir=/usr/sbin \
  1215.     --localstatedir=/var   \
  1216.     --disable-ifconfig     \
  1217.     --disable-logger       \
  1218.     --disable-syslogd      \
  1219.     --disable-whois        \
  1220.     --disable-servers
  1221. make
  1222. make check
  1223. make install
  1224. mv -v /usr/bin/{hostname,ping,ping6,traceroute} /bin
  1225. cd $LFS/sources/
  1226. rm -rf $LFS/sources/inetutils-1.9.1/
  1227.  
  1228. ###  Perl-5.16.2
  1229. cd $LFS/sources/
  1230. tar xf perl-5.16.2.tar.bz2
  1231. cd $LFS/sources/perl-5.16.2/
  1232. echo "127.0.0.1 localhost $(hostname)" > /etc/hosts
  1233. sed -i -e "s|BUILD_ZLIB\s*= True|BUILD_ZLIB = False|"           \
  1234.        -e "s|INCLUDE\s*= ./zlib-src|INCLUDE    = /usr/include|" \
  1235.        -e "s|LIB\s*= ./zlib-src|LIB        = /usr/lib|"         \
  1236.     cpan/Compress-Raw-Zlib/config.in
  1237. sh Configure -des -Dprefix=/usr                 \
  1238.                   -Dvendorprefix=/usr           \
  1239.                   -Dman1dir=/usr/share/man/man1 \
  1240.                   -Dman3dir=/usr/share/man/man3 \
  1241.                   -Dpager="/usr/bin/less -isR"  \
  1242.                   -Duseshrplib
  1243. make
  1244. make -k test
  1245. make install
  1246. cd $LFS/sources/
  1247. rm -rf $LFS/sources/perl-5.16.2/
  1248.  
  1249. ###  Autoconf-2.69
  1250. cd $LFS/sources/
  1251. tar xf autoconf-2.69.tar.xz
  1252. cd $LFS/sources/autoconf-2.69/
  1253. ./configure --prefix=/usr
  1254. make
  1255. #make check
  1256. make install
  1257. cd $LFS/sources/
  1258. rm -rf $LFS/sources/autoconf-2.69/
  1259.  
  1260. ###  Automake-1.13.1
  1261. cd $LFS/sources/
  1262. tar xf automake-1.13.1.tar.xz
  1263. cd $LFS/sources/automake-1.13.1/
  1264. ./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.13.1
  1265. make
  1266. #make check
  1267. make install
  1268. cd $LFS/sources/
  1269. rm -rf $LFS/sources/automake-1.13.1/
  1270.  
  1271. ###  Diffutils-3.2
  1272. cd $LFS/sources/
  1273. tar xf diffutils-3.2.tar.gz
  1274. cd $LFS/sources/diffutils-3.2/
  1275. sed -i -e '/gets is a/d' lib/stdio.in.h
  1276. ./configure --prefix=/usr
  1277. make
  1278. make check
  1279. make install
  1280. cd $LFS/sources/
  1281. rm -rf $LFS/sources/diffutils-3.2/
  1282.  
  1283. ###  Gawk-4.0.2
  1284. cd $LFS/sources/
  1285. tar xf gawk-4.0.2.tar.xz
  1286. cd $LFS/sources/gawk-4.0.2/
  1287. ./configure --prefix=/usr --libexecdir=/usr/lib
  1288. make
  1289. make check
  1290. make install
  1291. mkdir -v /usr/share/doc/gawk-4.0.2
  1292. cp    -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-4.0.2
  1293. cd $LFS/sources/
  1294. rm -rf $LFS/sources/gawk-4.0.2/
  1295.  
  1296. ###  Findutils-4.4.2
  1297. cd $LFS/sources/
  1298. tar xf findutils-4.4.2.tar.gz
  1299. cd $LFS/sources/findutils-4.4.2/
  1300. ./configure --prefix=/usr                   \
  1301.             --libexecdir=/usr/lib/findutils \
  1302.             --localstatedir=/var/lib/locate
  1303. make
  1304. make check
  1305. make install
  1306. mv -v /usr/bin/find /bin
  1307. sed -i 's/find:=${BINDIR}/find:=\/bin/' /usr/bin/updatedb
  1308. cd $LFS/sources/
  1309. rm -rf $LFS/sources/findutils-4.4.2/
  1310.  
  1311. ###  Flex-2.5.37
  1312. cd $LFS/sources/
  1313. tar xf flex-2.5.37.tar.bz2
  1314. cd $LFS/sources/flex-2.5.37/
  1315. patch -Np1 -i ../flex-2.5.37-bison-2.6.1-1.patch
  1316. ./configure --prefix=/usr             \
  1317.             --docdir=/usr/share/doc/flex-2.5.37
  1318. make
  1319. make check
  1320. make install
  1321. ln -sv libfl.a /usr/lib/libl.a
  1322. cat > /usr/bin/lex << "EOF"
  1323. #!/bin/sh
  1324. # Begin /usr/bin/lex
  1325.  
  1326. exec /usr/bin/flex -l "$@"
  1327.  
  1328. # End /usr/bin/lex
  1329. EOF
  1330. chmod -v 755 /usr/bin/lex
  1331. cd $LFS/sources/
  1332. rm -rf $LFS/sources/flex-2.5.37/
  1333.  
  1334. ###  Gettext-0.18.2
  1335. cd $LFS/sources/
  1336. tar xf gettext-0.18.2.tar.gz
  1337. cd $LFS/sources/gettext-0.18.2/
  1338. ./configure --prefix=/usr \
  1339.             --docdir=/usr/share/doc/gettext-0.18.2
  1340. make
  1341. make check
  1342. make install
  1343. cd $LFS/sources/
  1344. rm -rf $LFS/sources/gettext-0.18.2/
  1345.  
  1346. ###  Groff-1.22.2
  1347. cd $LFS/sources/
  1348. tar xf groff-1.22.2.tar.gz
  1349. cd $LFS/sources/groff-1.22.2/
  1350. PAGE=A4 ./configure --prefix=/usr
  1351. make
  1352. mkdir -p /usr/share/doc/groff-1.22/pdf
  1353. make install
  1354. ln -sv eqn /usr/bin/geqn
  1355. ln -sv tbl /usr/bin/gtbl
  1356. cd $LFS/sources/
  1357. rm -rf $LFS/sources/groff-1.22.2/
  1358.  
  1359. ###  Xz-5.0.4
  1360. cd $LFS/sources/
  1361. tar xf xz-5.0.4.tar.xz
  1362. cd $LFS/sources/xz-5.0.4/
  1363. ./configure --prefix=/usr --libdir=/lib --docdir=/usr/share/doc/xz-5.0.4
  1364. make
  1365. make check
  1366. make pkgconfigdir=/usr/lib/pkgconfig install
  1367. cd $LFS/sources/
  1368. rm -rf $LFS/sources/xz-5.0.4/
  1369.  
  1370. ###  GRUB-2.00
  1371. cd $LFS/sources/
  1372. tar xf grub-2.00.tar.xz
  1373. cd $LFS/sources/grub-2.00/
  1374. sed -i -e '/gets is a/d' grub-core/gnulib/stdio.in.h
  1375. ./configure --prefix=/usr          \
  1376.             --sysconfdir=/etc      \
  1377.             --disable-grub-emu-usb \
  1378.             --disable-efiemu       \
  1379.             --disable-werror
  1380. make
  1381. make install
  1382. cd $LFS/sources/
  1383. rm -rf $LFS/sources/grub-2.00/
  1384.  
  1385. ###  Less-451
  1386. cd $LFS/sources/
  1387. tar xf less-451.tar.gz
  1388. cd $LFS/sources/less-451/
  1389. ./configure --prefix=/usr --sysconfdir=/etc
  1390. make
  1391. make install
  1392. cd $LFS/sources/
  1393. rm -rf $LFS/sources/less-451/
  1394.  
  1395. ###  Gzip-1.5
  1396. cd $LFS/sources/
  1397. tar xf gzip-1.5.tar.xz
  1398. cd $LFS/sources/gzip-1.5/
  1399. ./configure --prefix=/usr --bindir=/bin
  1400. make
  1401. make check
  1402. make install
  1403. mv -v /bin/{gzexe,uncompress,zcmp,zdiff,zegrep} /usr/bin
  1404. mv -v /bin/{zfgrep,zforce,zgrep,zless,zmore,znew} /usr/bin
  1405. cd $LFS/sources/
  1406. rm -rf $LFS/sources/gzip-1.5/
  1407.  
  1408. ###  IPRoute2-3.8.0
  1409. cd $LFS/sources/
  1410. tar xf iproute2-3.8.0.tar.xz
  1411. cd $LFS/sources/iproute2-3.8.0/
  1412. sed -i '/^TARGETS/s@arpd@@g' misc/Makefile
  1413. sed -i /ARPD/d Makefile
  1414. sed -i 's/arpd.8//' man/man8/Makefile
  1415. sed -i 's/-Werror//' Makefile
  1416. make DESTDIR=
  1417. make DESTDIR=              \
  1418.      MANDIR=/usr/share/man \
  1419.      DOCDIR=/usr/share/doc/iproute2-3.8.0 install
  1420. cd $LFS/sources/
  1421. rm -rf $LFS/sources/iproute2-3.8.0/
  1422.  
  1423. ###  Kbd-1.15.5
  1424. cd $LFS/sources/
  1425. tar xf kbd-1.15.5.tar.gz
  1426. cd $LFS/sources/kbd-1.15.5/
  1427. patch -Np1 -i ../kbd-1.15.5-backspace-1.patch
  1428. sed -i -e '326 s/if/while/' src/loadkeys.analyze.l
  1429. sed -i 's/\(RESIZECONS_PROGS=\)yes/\1no/g' configure
  1430. sed -i 's/resizecons.8 //' man/man8/Makefile.in
  1431. ./configure --prefix=/usr --datadir=/lib/kbd \
  1432.   --disable-vlock
  1433. make
  1434. make install
  1435. mv -v /usr/bin/{kbd_mode,loadkeys,openvt,setfont} /bin
  1436. mkdir -v /usr/share/doc/kbd-1.15.5
  1437. cp -R -v doc/* \
  1438.          /usr/share/doc/kbd-1.15.5
  1439. cd $LFS/sources/
  1440. rm -rf $LFS/sources/kbd-1.15.5/
  1441.  
  1442. ###  Kmod-12
  1443. cd $LFS/sources/
  1444. tar xf kmod-12.tar.xz
  1445. cd $LFS/sources/kmod-12/
  1446. ./configure --prefix=/usr       \
  1447.             --bindir=/bin       \
  1448.             --libdir=/lib       \
  1449.             --sysconfdir=/etc   \
  1450.             --disable-manpages  \
  1451.             --with-xz           \
  1452.             --with-zlib
  1453. make
  1454. make check
  1455. make pkgconfigdir=/usr/lib/pkgconfig install
  1456.  
  1457. for target in depmod insmod modinfo modprobe rmmod; do
  1458.   ln -sv ../bin/kmod /sbin/$target
  1459. done
  1460.  
  1461. ln -sv kmod /bin/lsmod
  1462. cd $LFS/sources/
  1463. rm -rf $LFS/sources/kmod-12/
  1464.  
  1465. ###  Libpipeline-1.2.2
  1466. cd $LFS/sources/
  1467. tar xf libpipeline-1.2.2.tar.gz
  1468. cd $LFS/sources/libpipeline-1.2.2/
  1469. PKG_CONFIG_PATH=/tools/lib/pkgconfig ./configure --prefix=/usr
  1470. make
  1471. make check
  1472. make install
  1473. cd $LFS/sources/
  1474. rm -rf $LFS/sources/libpipeline-1.2.2/
  1475.  
  1476. ###  Make-3.82
  1477. cd $LFS/sources/
  1478. tar xf make-3.82.tar.bz2
  1479. cd $LFS/sources/make-3.82/
  1480. patch -Np1 -i ../make-3.82-upstream_fixes-3.patch
  1481. ./configure --prefix=/usr
  1482. make
  1483. make check
  1484. make install
  1485. cd $LFS/sources/
  1486. rm -rf $LFS/sources/make-3.82/
  1487.  
  1488. ###  Man-DB-2.6.3
  1489. cd $LFS/sources/
  1490. tar xf man-db-2.6.3.tar.xz
  1491. cd $LFS/sources/man-db-2.6.3/
  1492. ./configure --prefix=/usr                        \
  1493.             --libexecdir=/usr/lib                \
  1494.             --docdir=/usr/share/doc/man-db-2.6.3 \
  1495.             --sysconfdir=/etc                    \
  1496.             --disable-setuid                     \
  1497.             --with-browser=/usr/bin/lynx         \
  1498.             --with-vgrind=/usr/bin/vgrind        \
  1499.             --with-grap=/usr/bin/grap
  1500. make
  1501. make check
  1502. make install
  1503. cd $LFS/sources/
  1504. rm -rf $LFS/sources/man-db-2.6.3/
  1505.  
  1506. ###  Patch-2.7.1
  1507. cd $LFS/sources/
  1508. tar xf patch-2.7.1.tar.xz
  1509. cd $LFS/sources/patch-2.7.1/
  1510. ./configure --prefix=/usr
  1511. make
  1512. make check
  1513. make install
  1514. cd $LFS/sources/
  1515. rm -rf $LFS/sources/patch-2.7.1/
  1516.  
  1517. ###  Sysklogd-1.5
  1518. cd $LFS/sources/
  1519. tar xf sysklogd-1.5.tar.gz
  1520. cd $LFS/sources/sysklogd-1.5/
  1521. make
  1522. make BINDIR=/sbin install
  1523. cat > /etc/syslog.conf << "EOF"
  1524. # Begin /etc/syslog.conf
  1525.  
  1526. auth,authpriv.* -/var/log/auth.log
  1527. *.*;auth,authpriv.none -/var/log/sys.log
  1528. daemon.* -/var/log/daemon.log
  1529. kern.* -/var/log/kern.log
  1530. mail.* -/var/log/mail.log
  1531. user.* -/var/log/user.log
  1532. *.emerg *
  1533.  
  1534. # End /etc/syslog.conf
  1535. EOF
  1536. cd $LFS/sources/
  1537. rm -rf $LFS/sources/sysklogd-1.5/
  1538.  
  1539. ###  Sysvinit-2.88dsf
  1540. cd $LFS/sources/
  1541. tar xf sysvinit-2.88dsf.tar.bz2
  1542. cd $LFS/sources/sysvinit-2.88dsf/
  1543. sed -i 's@Sending processes@& configured via /etc/inittab@g' src/init.c
  1544. sed -i -e '/utmpdump/d' \
  1545.        -e '/mountpoint/d' src/Makefile
  1546. make -C src
  1547. make -C src install
  1548. cd $LFS/sources/
  1549. rm -rf $LFS/sources/sysvinit-2.88dsf/
  1550.  
  1551. ###  Tar-1.26
  1552. cd $LFS/sources/
  1553. tar xf tar-1.26.tar.bz2
  1554. cd $LFS/sources/tar-1.26/
  1555. sed -i -e '/gets is a/d' gnu/stdio.in.h
  1556. FORCE_UNSAFE_CONFIGURE=1  \
  1557. ./configure --prefix=/usr \
  1558.             --bindir=/bin \
  1559.             --libexecdir=/usr/sbin
  1560. make
  1561. make check
  1562. make install
  1563. make -C doc install-html docdir=/usr/share/doc/tar-1.26
  1564. cd $LFS/sources/
  1565. rm -rf $LFS/sources/tar-1.26/
  1566.  
  1567. ###  Texinfo-5.0
  1568. cd $LFS/sources/
  1569. tar xf texinfo-5.0.tar.xz
  1570. cd $LFS/sources/texinfo-5.0/
  1571. ./configure --prefix=/usr
  1572. make
  1573. make check
  1574. make install
  1575. make TEXMF=/usr/share/texmf install-tex
  1576. cd /usr/share/info
  1577. rm -v dir
  1578. for f in *
  1579. do install-info $f dir 2>/dev/null
  1580. done
  1581. cd $LFS/sources/
  1582. rm -rf $LFS/sources/texinfo-5.0/
  1583.  
  1584. ###  Udev-197 (Extracted from systemd-197)
  1585. cd $LFS/sources/
  1586. tar xf systemd-197.tar.xz
  1587. cd $LFS/sources/systemd-197/
  1588. tar -xvf ../udev-lfs-197-2.tar.bz2
  1589. make -f udev-lfs-197-2/Makefile.lfs
  1590. make -f udev-lfs-197-2/Makefile.lfs install
  1591. build/udevadm hwdb --update
  1592. bash udev-lfs-197-2/init-net-rules.sh
  1593. cd $LFS/sources/
  1594. rm -rf $LFS/sources/systemd-197/
  1595.  
  1596. ###  Vim-7.3
  1597. cd $LFS/sources/
  1598. tar xf vim-7.3.tar.bz2
  1599. cd $LFS/sources/vim73/
  1600. echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h
  1601. ./configure --prefix=/usr --enable-multibyte
  1602. make
  1603. make test
  1604. make install
  1605. ln -sv vim /usr/bin/vi
  1606. for L in  /usr/share/man/{,*/}man1/vim.1; do
  1607.     ln -sv vim.1 $(dirname $L)/vi.1
  1608. done
  1609. ln -sv ../vim/vim73/doc /usr/share/doc/vim-7.3
  1610. cat > /etc/vimrc << "EOF"
  1611. " Begin /etc/vimrc
  1612.  
  1613. set nocompatible
  1614. set backspace=2
  1615. syntax on
  1616. if (&term == "iterm") || (&term == "putty")
  1617.  set background=dark
  1618. endif
  1619.  
  1620. " End /etc/vimrc
  1621. EOF
  1622. vim -c ':options'
  1623. cd $LFS/sources/
  1624. rm -rf $LFS/sources/vim73/
  1625.  
  1626. ###  Stripping Again
  1627. logout
  1628. chroot $LFS /tools/bin/env -i \
  1629.     HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
  1630.     PATH=/bin:/usr/bin:/sbin:/usr/sbin \
  1631.     /tools/bin/bash --login
  1632. /tools/bin/find /{,usr/}{bin,lib,sbin} -type f \
  1633.   -exec /tools/bin/strip --strip-debug '{}' ';'
  1634.  
  1635. ###  Cleaning Up
  1636. chroot "$LFS" /usr/bin/env -i \
  1637.     HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
  1638.     PATH=/bin:/usr/bin:/sbin:/usr/sbin \
  1639.     /bin/bash --login
  1640.  
  1641. ###  General Network Configuration
  1642. cat /etc/udev/rules.d/70-persistent-net.rules
  1643. cd /etc/sysconfig/
  1644. cat > ifconfig.eth0 << "EOF"
  1645. ONBOOT=yes
  1646. IFACE=eth0
  1647. SERVICE=ipv4-static
  1648. IP=192.168.60.60
  1649. GATEWAY=192.168.60.1
  1650. PREFIX=24
  1651. BROADCAST=192.168.60.255
  1652. EOF
  1653. cat > /etc/resolv.conf << "EOF"
  1654. # Begin /etc/resolv.conf
  1655.  
  1656. nameserver 219.232.48.61
  1657. nameserver 219.141.136.10
  1658. nameserver 211.147.6.3
  1659.  
  1660. # End /etc/resolv.conf
  1661. EOF
  1662.  
  1663. ###  Customizing the /etc/hosts File
  1664. cat > /etc/hosts << "EOF"
  1665. # Begin /etc/hosts (network card version)
  1666.  
  1667. 127.0.0.1 localhost
  1668. 192.168.60.60 lfs
  1669.  
  1670. # End /etc/hosts (network card version)
  1671. EOF
  1672.  
  1673. ###  LFS-Bootscripts-20130123
  1674. cd $LFS/sources/
  1675. tar xf lfs-bootscripts-20130123.tar.bz2
  1676. cd $LFS/sources/lfs-bootscripts-20130123/
  1677. make install
  1678. cd $LFS/sources/
  1679. rm -rf $LFS/sources/lfs-bootscripts-20130123/
  1680.  
  1681. ###  How Do These Bootscripts Work?
  1682. cat > /etc/inittab << "EOF"
  1683. # Begin /etc/inittab
  1684.  
  1685. id:3:initdefault:
  1686.  
  1687. si::sysinit:/etc/rc.d/init.d/rc S
  1688.  
  1689. l0:0:wait:/etc/rc.d/init.d/rc 0
  1690. l1:S1:wait:/etc/rc.d/init.d/rc 1
  1691. l2:2:wait:/etc/rc.d/init.d/rc 2
  1692. l3:3:wait:/etc/rc.d/init.d/rc 3
  1693. l4:4:wait:/etc/rc.d/init.d/rc 4
  1694. l5:5:wait:/etc/rc.d/init.d/rc 5
  1695. l6:6:wait:/etc/rc.d/init.d/rc 6
  1696.  
  1697. ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
  1698.  
  1699. su:S016:once:/sbin/sulogin
  1700.  
  1701. 1:2345:respawn:/sbin/agetty --noclear tty1 9600
  1702. 2:2345:respawn:/sbin/agetty tty2 9600
  1703. 3:2345:respawn:/sbin/agetty tty3 9600
  1704. 4:2345:respawn:/sbin/agetty tty4 9600
  1705. 5:2345:respawn:/sbin/agetty tty5 9600
  1706. 6:2345:respawn:/sbin/agetty tty6 9600
  1707.  
  1708. # End /etc/inittab
  1709. EOF
  1710.  
  1711. ###  Configuring the system hostname
  1712. echo "HOSTNAME=lfs" > /etc/sysconfig/network
  1713.  
  1714. ###  Configuring the setclock Script
  1715. cat > /etc/sysconfig/clock << "EOF"
  1716. # Begin /etc/sysconfig/clock
  1717.  
  1718. UTC=1
  1719.  
  1720. # Set this to any options you might need to give to hwclock,
  1721. # such as machine hardware clock type for Alphas.
  1722. CLOCKPARAMS=
  1723.  
  1724. # End /etc/sysconfig/clock
  1725. EOF
  1726.  
  1727. ###  Configuring the Linux Console
  1728. cat > /etc/sysconfig/console << "EOF"
  1729. # Begin /etc/sysconfig/console
  1730.  
  1731. CHARMAP="UTF-8"
  1732.  
  1733. CODESET="Lat15"
  1734. FONTFACE="Fixed"
  1735. FONTSIZE="8x16"
  1736.  
  1737. # End /etc/sysconfig/console
  1738. EOF
  1739.  
  1740. ###  Configuring the sysklogd Script
  1741.  
  1742. ###  The rc.site File
  1743.  
  1744. ###  The Bash Shell Startup Files
  1745. locale -a
  1746. LC_ALL=en_US.utf8 locale charmap
  1747. LC_ALL=en_US.utf8 locale language
  1748. LC_ALL=en_US.utf8 locale charmap
  1749. LC_ALL=en_US.utf8 locale int_curr_symbol
  1750. LC_ALL=en_US.utf8 locale int_prefix
  1751. cat > /etc/profile << "EOF"
  1752. # Begin /etc/profile
  1753.  
  1754. export LANG=en_US.UTF-8
  1755.  
  1756. # End /etc/profile
  1757. EOF
  1758.  
  1759. ###  Creating the /etc/inputrc File
  1760. cat > /etc/inputrc << "EOF"
  1761. # Begin /etc/inputrc
  1762. # Modified by Chris Lynn <roryo@roryo.dynup.net>
  1763.  
  1764. # Allow the command prompt to wrap to the next line
  1765. set horizontal-scroll-mode Off
  1766.  
  1767. # Enable 8bit input
  1768. set meta-flag On
  1769. set input-meta On
  1770.  
  1771. # Turns off 8th bit stripping
  1772. set convert-meta Off
  1773.  
  1774. # Keep the 8th bit for display
  1775. set output-meta On
  1776.  
  1777. # none, visible or audible
  1778. set bell-style none
  1779.  
  1780. # All of the following map the escape sequence of the value
  1781. # contained in the 1st argument to the readline specific functions
  1782. "\eOd": backward-word
  1783. "\eOc": forward-word
  1784.  
  1785. # for linux console
  1786. "\e[1~": beginning-of-line
  1787. "\e[4~": end-of-line
  1788. "\e[5~": beginning-of-history
  1789. "\e[6~": end-of-history
  1790. "\e[3~": delete-char
  1791. "\e[2~": quoted-insert
  1792.  
  1793. # for xterm
  1794. "\eOH": beginning-of-line
  1795. "\eOF": end-of-line
  1796.  
  1797. # for Konsole
  1798. "\e[H": beginning-of-line
  1799. "\e[F": end-of-line
  1800.  
  1801. # End /etc/inputrc
  1802. EOF
  1803.  
  1804. ###  8. Making the LFS System Bootable
  1805.  
  1806. ###  Creating the /etc/fstab File
  1807. cat > /etc/fstab << "EOF"
  1808. # Begin /etc/fstab
  1809.  
  1810. # file system  mount-point  type     options             dump  fsck
  1811. #                                                              order
  1812.  
  1813. /dev/sda1      /            ext3     defaults            1     1
  1814. proc           /proc        proc     nosuid,noexec,nodev 0     0
  1815. sysfs          /sys         sysfs    nosuid,noexec,nodev 0     0
  1816. devpts         /dev/pts     devpts   gid=5,mode=620      0     0
  1817. tmpfs          /run         tmpfs    defaults            0     0
  1818. devtmpfs       /dev         devtmpfs mode=0755,nosuid    0     0
  1819.  
  1820. # End /etc/fstab
  1821. EOF
  1822.  
  1823. ###  Linux-3.8.3
  1824. cd $LFS/sources/
  1825. tar xf linux-3.8.3.tar.xz
  1826. cd $LFS/sources/linux-3.8.3/
  1827. make mrproper
  1828. make LANG=en_US.UTF-8 LC_ALL= menuconfig
  1829. make
  1830. make modules_install
  1831. cp -v arch/x86/boot/bzImage /boot/vmlinuz-3.8.3-lfs-7.3
  1832. cp -v System.map /boot/System.map-3.8.3
  1833. cp -v .config /boot/config-3.8.3
  1834. install -d /usr/share/doc/linux-3.8.3
  1835. cp -r Documentation/* /usr/share/doc/linux-3.8.3
  1836. install -v -m755 -d /etc/modprobe.d
  1837. cat > /etc/modprobe.d/usb.conf << "EOF"
  1838. # Begin /etc/modprobe.d/usb.conf
  1839.  
  1840. install ohci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i ohci_hcd ; true
  1841. install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i uhci_hcd ; true
  1842.  
  1843. # End /etc/modprobe.d/usb.conf
  1844. EOF
  1845. cd $LFS/sources/
  1846. #rm -rf $LFS/sources/linux-3.8.3/
  1847.  
  1848. ###  Using GRUB to Set Up the Boot Process
  1849. #cd /tmp &&
  1850. #grub-mkrescue --output=grub-img.iso &&
  1851. #xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso
  1852. grub-install /dev/sdb
  1853. cat > /boot/grub/grub.cfg << "EOF"
  1854. # Begin /boot/grub/grub.cfg
  1855. set default=0
  1856. set timeout=5
  1857.  
  1858. insmod ext2
  1859. set root=(hd0,1)
  1860.  
  1861. menuentry "GNU/Linux, Linux 3.8.3-lfs-7.3" {
  1862.         linux   /boot/vmlinuz-3.8.3-lfs-7.3 root=/dev/sda1 ro
  1863. }
  1864. EOF
  1865.  
  1866. ###  9. The End
  1867.  
  1868. ###  The End
  1869. echo 7.3 > /etc/lfs-release
  1870. cat > /etc/lsb-release << "EOF"
  1871. DISTRIB_ID="Linux From Scratch"
  1872. DISTRIB_RELEASE="7.3"
  1873. DISTRIB_CODENAME="lfs"
  1874. DISTRIB_DESCRIPTION="Linux From Scratch"
  1875. EOF
  1876.  
  1877. ###  Rebooting the System
  1878. logout
  1879. umount -v $LFS/dev/pts
  1880.  
  1881. if [ -h $LFS/dev/shm ]; then
  1882.   link=$(readlink $LFS/dev/shm)
  1883.   umount -v $LFS/$link
  1884.   unset link
  1885. else
  1886.   umount -v $LFS/dev/shm
  1887. fi
  1888.  
  1889. umount -v $LFS/dev
  1890. umount -v $LFS/proc
  1891. umount -v $LFS/sys
  1892. umount -v $LFS
  1893. shutdown -r now
  1894.  
  1895. ## sukzezz :)
RAW Paste Data