続いて第5章の一時的環境の構築を進めます。
システム環境の確認
- target tripletの確認
 ホストシステムでbinutilパッケージの最上位ディレクトリからconfig.guessを抽出し、実行
 結果は「i686-pc-linux-gnu」であった。
- 同様にダイナミックリンカーの名前を確認
 $ readelf -l /bin/ls | grep interpreter
 [Requesting program interpreter: /bin/ld-linux.so.2]
- LFS環境変数の確認
 $ echo $LFS
 /mnt/lfs
その他の確認
- shのリンク先確認
 $ which sh
 /bin/sh
 $ ls -la /bin/sh
 lrwxrwxrwx 1 root root 4 Aug 4 17:10 /bin/sh -> dash
 ・・・だめですね。bashへのリンクを想定しているとのことなので要修正です。
 $ sudo dpkg-reconfigure dash
 で、システムの標準シェルからdashを外します。
 $ ls -la /bin/sh
 lrwxrwxrwx 1 root root 4 Aug 4 19:59 /bin/sh -> bash
 直りました。
- /usr/bin/awkのリンク先確認
 $ ls -la /usr/bin/awk
 lrwxrwxrwx 1 root root 4 Aug 4 17:10 /usr/bin/sh -> /etc/alternatives/awk
 Synapticでみると、そもそもgawkがインストールされていないので、インストール。
 $ ls -la /usr/bin/awk
 lrwxrwxrwx 1 root root 21 Aug 4 17:10 /usr/bin/sh -> /etc/alternatives/awk
 変わらず。
 $ ls -la /etc/alternatives/awk
 lrwxrwxrwx 1 root root 13 Aug 4 /etc/alternatives/awk -> /usr/bin/gawk
 ・・・・まあ、いいでしょ。
- /usr/bin/yaccのリンク先確認
 $ ls -la /usr/bin/yacc
 ls: cannot access /usr/bin/yacc: No such file or directory
 Synapticでbisonをインストールしてからリンクをたどっていくと、/usr/bin/bisonを起動するスクリプトになっていたのでOK。
以降の作業ではユーザーlfsで作業する。5.4以降の個々のパッケージについては特に注意点がある場合のみ記載する。
- bintuils-2.23.1のコンパイル
 ユーザーlfsにて、以下の作業を実施。赤字はbinutils固有の作業
 $ cd $LFS/sources
 $ tar xvfj binutils-2.23.1.tar.bz2
 $ cd 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
 $ time { make && make install ; }
 real 1m45.851s
 user 1m10.820s
 sys 0m6.572s
 $ cd ..
 $ pwd
 /mnt/lfs/sources
 $ rm -fr binutils-2.23.1
 $ rm -fr binutils-build
- GCC-4.7.2 – 1回め
 ユーザーlfsにて、以下の作業を実施。
 $ cd $LFS/sources
 $ tar xvfj gcc-4.7.2.tar.bz
 $ cd gcc-4.7.2
 — ここからパッケージ固有の項目(5.5.1項記載の項目)
 :
 コマンドをコピペをする際にはHTML版から行う。PDF版からだと複数行に渡るコマンドがうまく処理されない。
 :
 — ここまでがパッケージ固有の項目
 $ cd ..
 $ pwd
 /mnt/lfs/sources
 $ rm -fr gcc-4.7.2
 $ rm -fr gcc-build
- Linux-3.8.1 APIヘッダー
 ユーザーlfsにて、以下の作業を実施。
 $ cd $LFS/sources
 $ tar xvfJ linux-3.8.1.xz
 $ cd linux-3.8.1
 — パッケージ固有の項目(5.6.1項記載の項目)
 $ cd ..
 $ pwd
 /mnt/lfs/sources
 $ rm -fr linux-3.8.1
- Glibc-2.17
 ユーザーlfsにて、以下の作業を実施。
 $ cd $LFS/sources
 $ tar xvfJ glibc-2.17.tar.xz
 $ cd glibc-2.17
 — パッケージ固有の項目(5.6.1項記載の項目)
 ・configureスクリプトの中に、カーネルのバージョンが出てくるが、「2.6.25以上のサポートを指示」という意味なので、そのままでOK
 $ cd ..
 $ pwd
 /mnt/lfs/sources
 $ rm -fr glibc-2.17
- Binutil-2.23.1  2回目
 ユーザーlfsにて、以下の作業を実施。
 $ cd $LFS/sources
 $ tar xvfj binutils-2.23.1.tar.bz2
 $ cd binutils-2.23.1
 — ここから binutil 固有の項目
 $ 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
 ・・・ここでエラー発生。ldがsysrootを使うようになっていない・・・とのこと。
 1回目はPDF版からコピペしていたため。2回目はHTML版からコピペしたので先へ進めた。
 $ cp -v ld/ld-new /tools/bin
 $ cd ..
 $ pwd
 /mnt/lfs/sources
 $ rm -fr binutils-build binutils-2.23.1
- GCC-4.7.2 2回目
 ユーザーlfsにて、以下の作業を実施。
 $ cd $LFS/sources
 $ tar xvfj gcc-4.7.2.tar.bz2
 $ cd gcc-4.7.2
 — GCC 固有の項目を作業する。LFS-BOOK HTML版に従う。
 $ cd ..
 $ pwd
 /mnt/lfs/sources
 $ rm -fr gcc-4.7.2 gcc-build
- Tcl-8.6.0
 ユーザーlfsにて、以下の作業を実施。
 $ cd $LFS/sources
 $ tar xvfz tcl8.6.0-src.tar.gz
 $ cd tcl8.6.0
 — Tcl 固有の項目を作業する。LFS-BOOK HTML版に従う。
 $ cd ../..
 $ pwd
 /mnt/lfs/sources
 $ rm -fr tcl8.6.0
- Expect-5.45
 ユーザーlfsにて、以下の作業を実施。
 $ cd $LFS/sources
 $ tar xvfz expext5.45.tar.gz
 $ cd expect5.45
 — Expect 固有の項目を作業する。LFS-BOOK HTML版に従う。
 $ cd ..
 $ pwd
 /mnt/lfs/sources
 $ rm -fr expect5.45
- DejaGNU-1.5
 ユーザーlfsにて、以下の作業を実施。
 $ cd $LFS/sources
 $ tar xvfz dejagnu-1.5.tar.gz
 $ cd dejagnu-1.5
 — DejaGNU 固有の項目を作業する。LFS-BOOK HTML版に従う。
 $ cd ..
 $ pwd
 /mnt/lfs/sources
 $ rm -fr dejagnu-1.5
- Check-0.9.9
 ユーザーlfsにて、以下の作業を実施。
 $ cd $LFS/sources
 $ tar xvfz check-0.9.9.tar.gz
 $ cd chech-0.9.9
 — Check 固有の項目を作業するが、Errataがあるので以下の手順で行う。
 $ CFLAGS=”-L/tools/lib -lpthread” ./configure –prefix=/tools
 $ CFLAGS=”-L/tools/lib -lpthread” make
 $ make check
 $ make install
 $ cd ..
 $ pwd
 /mnt/lfs/sources
 $ rm -fr check-0.9.9
- Ncurses-5.9
 ユーザーlfsにて、以下の作業を実施。
 $ cd $LFS/sources
 $ tar xvfz ncurses-5.9.tar.gz
 $ cd ncurses-5.9
 — Ncurses 固有の項目を作業する。LFS-BOOK HTML版に従う。
 $ cd ..
 $ pwd
 /mnt/lfs/sources
 $ rm -fr ncurses-5.9
- Bash-4.2
 ユーザーlfsにて、以下の作業を実施。
 $ cd $LFS/sources
 $ tar xvfz bash-4.2.tar.gz
 $ cd bash-4.2
 — Bash 固有の項目を作業する。LFS-BOOK HTML版に従う。
 $ cd ..
 $ pwd
 /mnt/lfs/sources
 $ rm -fr bash-4.2
- Bzip2-1.0.6
 ユーザーlfsにて、以下の作業を実施。
 $ cd $LFS/sources
 $ tar xvfz bzip2-1.0.6.tar.gz
 $ cd bzip2-1.0.6
 — Bzip2 固有の項目を作業する。LFS-BOOK HTML版に従う。
 $ cd ..
 $ pwd
 /mnt/lfs/sources
 $ rm -fr bzip2-1.0.6
- Coreutils-8.21
 ユーザーlfsにて、以下の作業を実施。
 $ cd $LFS/sources
 $ tar xvfJ coreutils-8.21.tar.xz
 $ cd coreutils-8.21
 — Coreutils 固有の項目を作業する。LFS-BOOK HTML版に従う。
 うーん、テストスイートの実行でエラー発生。どうしたものか・・・。まあ、このまま進めてしまおう・・・。
 $ cd ..
 $ pwd
 /mnt/lfs/sources
 $ rm -fr coreutils-8.21
- Diffutils
 ユーザーlfsにて、以下の作業を実施。
 $ cd $LFS/sources
 $ tar xvfz diffutils-3.2.tar.gz
 $ cd diffutils-3.2
 — Diffutils 固有の項目を作業する。LFS-BOOK HTML版に従う。
 $ cd ..
 $ pwd
 /mnt/lfs/sources
 $ rm -fr diffutils-3.2
- File-5.13
 ユーザーlfsにて、以下の作業を実施。
 $ cd $LFS/sources
 $ tar xvfz file-5.13.tar.gz
 $ cd file-5.13
 — File 固有の項目を作業する。LFS-BOOK HTML版に従う。
 $ cd ..
 $ pwd
 /mnt/lfs/sources
 $ rm -fr file-5.13
- Findutils-4.4.2
 (以降、特に問題なければファイル展開、ディレクトリの消去についても記載しない)
- Gawk-4.0.2
 う~ん、make check で2つエラー。無視して進めることにする。
- Gettext-0.18.2
- Grep-2.14
- Gzip-1.5
- M4-1.4.16
- Make-3.82
- Patch-2.7.1
- Perl-5.16.2
- Sed-4.2.2
- Tar-1.26
- Texinfo-5.0
- Xz-5.0.4
ストリップ(デバッグシンボル情報の削除)
$ strip --strip-debug /tools/lib/*
$ strip --strip-unneeded /tools/{,s}bin/*
$ rm -rf /tools/{,share}/{info,man,doc}
所有者の変更
rootでログインしなおしたあと、作業継続。
# chown -R root:root $LFS/tools
ここまでの作業のバックアップ
# umount /dev/sda3
partimageで/dev/sda3パーティションのバックアップ作成する。
