Hatena::Grouparaistudy

czk-htnの日記

2010-05-11

[] LFS 番外編 $LFSのマウント 07:28

lfs ユーザで $LFS 以下をマウント、アンマウントするには sudo 権限を与えておく必要がある。root になって /etc/sudoers を編集する。

# visudo
lfs     ALL=STORAGE

これで mount, unmount コマンドが実行できるようになる。

lfs ユーザに戻り、sudo で mount する。

$ sudo mount -v -t ext3 /dev/sdb2 $LFS
$ sudo mount -v -t ext3 /dev/sdb1 $LFS/boot

[] LFS part4 07:28

5.4. Binutils-2.20 - 1回め

標準ビルド単位(Standard Build Unit; SBU)値をtimeを用いて計測する。

$ cd $LFS/sources
$ tar xjf binutils-2.20.tar.bz2
$ mkdir -v ../binutils-build
$ cd ../binutils-build
$ time { ../binutils-2.20/configure \
    --target=$LFS_TGT --prefix=/tools \
    --disable-nls --disable-werror \
    && make && make install; } 

...

real    3m45.427s
user    1m30.113s
sys     1m39.119s

概ね4分。ということで SBU = 4。

binutils でインストールされたファイルを確認してみる。

$ find /tools/ -type f |xargs file
/tools/lib64/libiberty.a:                                 current ar archive
/tools/bin/x86_64-lfs-linux-gnu-size:                     ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
/tools/bin/x86_64-lfs-linux-gnu-strip:                    ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
/tools/bin/x86_64-lfs-linux-gnu-readelf:                  ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
/tools/bin/x86_64-lfs-linux-gnu-ar:                       ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
/tools/bin/x86_64-lfs-linux-gnu-ranlib:                   ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
/tools/bin/x86_64-lfs-linux-gnu-addr2line:                ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped/tools/bin/x86_64-lfs-linux-gnu-objdump:                  ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped/tools/bin/x86_64-lfs-linux-gnu-objcopy:                  ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped/tools/bin/x86_64-lfs-linux-gnu-ld:                       ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped/tools/bin/x86_64-lfs-linux-gnu-strings:                  ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped/tools/bin/x86_64-lfs-linux-gnu-c++filt:                  ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped/tools/bin/x86_64-lfs-linux-gnu-as:                       ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped/tools/bin/x86_64-lfs-linux-gnu-nm:                       ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped/tools/bin/x86_64-lfs-linux-gnu-gprof:                    ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
/tools/share/info/configure.info:                         data
/tools/share/info/standards.info:                         data
/tools/share/info/bfd.info:                               data
/tools/share/info/as.info:                                data
/tools/share/info/gprof.info:                             data
/tools/share/info/binutils.info:                          data
/tools/share/info/ld.info:                                data
/tools/share/man/man1/x86_64-lfs-linux-gnu-ar.1:          troff or preprocessor input text
/tools/share/man/man1/x86_64-lfs-linux-gnu-c++filt.1:     troff or preprocessor input text
/tools/share/man/man1/x86_64-lfs-linux-gnu-nlmconv.1:     troff or preprocessor input text
/tools/share/man/man1/x86_64-lfs-linux-gnu-windres.1:     troff or preprocessor input text
/tools/share/man/man1/x86_64-lfs-linux-gnu-nm.1:          troff or preprocessor input text
/tools/share/man/man1/x86_64-lfs-linux-gnu-objcopy.1:     troff or preprocessor input text
/tools/share/man/man1/x86_64-lfs-linux-gnu-as.1:          troff or preprocessor input text
/tools/share/man/man1/x86_64-lfs-linux-gnu-ld.1:          troff or preprocessor input text
/tools/share/man/man1/x86_64-lfs-linux-gnu-ranlib.1:      troff or preprocessor input text
/tools/share/man/man1/x86_64-lfs-linux-gnu-objdump.1:     troff or preprocessor input text
/tools/share/man/man1/x86_64-lfs-linux-gnu-size.1:        troff or preprocessor input text
/tools/share/man/man1/x86_64-lfs-linux-gnu-readelf.1:     troff or preprocessor input text
/tools/share/man/man1/x86_64-lfs-linux-gnu-strip.1:       troff or preprocessor input text
/tools/share/man/man1/x86_64-lfs-linux-gnu-strings.1:     troff or preprocessor input text
/tools/share/man/man1/x86_64-lfs-linux-gnu-dlltool.1:     troff or preprocessor input text
/tools/share/man/man1/x86_64-lfs-linux-gnu-windmc.1:      troff or preprocessor input text
/tools/share/man/man1/x86_64-lfs-linux-gnu-addr2line.1:   troff or preprocessor input text
/tools/share/man/man1/x86_64-lfs-linux-gnu-gprof.1:       troff or preprocessor input text
/tools/x86_64-lfs-linux-gnu/bin/nm:                       ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
/tools/x86_64-lfs-linux-gnu/bin/ar:                       ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
/tools/x86_64-lfs-linux-gnu/bin/strip:                    ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
/tools/x86_64-lfs-linux-gnu/bin/as:                       ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
/tools/x86_64-lfs-linux-gnu/bin/objdump:                  ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
/tools/x86_64-lfs-linux-gnu/bin/objcopy:                  ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
/tools/x86_64-lfs-linux-gnu/bin/ranlib:                   ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
/tools/x86_64-lfs-linux-gnu/bin/ld:                       ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/i386linux.xu:   ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xdc:   ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xu:    ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/i386linux.xbn:  ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xdc: ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/i386linux.x:    ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xdw: ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/i386linux.xr:   ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.x:     ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xn:    ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xu:  ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xr:  ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xr:    ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xbn:   ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xsw:   Palm OS dynamic library data "/* Script for --shared -z combr"
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xw:    ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xdw:   ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xd:  ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xsc:   ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xs:  ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xsc: ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xs:    ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xdw:   ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xsc:   ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xw:  ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.x:   ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xdc:   ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xc:    ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xw:    ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/i386linux.xn:   ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.x:     ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xn:  ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xs:    ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xc:  ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xn:    ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xd:    ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xbn: ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_x86_64.xsw: Palm OS dynamic library data "/* Script for --shared -z combr"
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xbn:   ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xsw:   Palm OS dynamic library data "/* Script for --shared -z combr"
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xc:    ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xr:    ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_l1om.xu:    ASCII C program text
/tools/x86_64-lfs-linux-gnu/lib/ldscripts/elf_i386.xd:    ASCII C program text

/bin (/tools/x86_64-lfs-linux-gnu/bin) の下のファイルに注目してみる。

ar
create, modify, and extract from archives:
as
the portable GNU assembler.:
ld
The GNU linker:
nm
list symbols from object files:
objcopy
copy and translate object files:
objdump
objdump - display information from object files.:
ranlib
generate index to archive.:
strip
Discard symbols from object files.:

コンパイルが終わったら作業ディレクトリを消しておく。

$ cd $LFS/sources
$ rm -rf binutils-build/ binutils-2.20/

[] LFS part5 07:28

5.5. GCC-4.4.3 - 1回め

gccのTARファイルを展開したディレクトリにmpfrとgmpも展開する。ビルドは専用ディレクトリ(gcc-build)を作成し、そこで行う。

$ cd $LFS/sources
$ tar xjf gcc-4.4.3.tar.bz2
$ cd gcc-4.4.3
$ tar xjf ../mpfr-2.4.2.tar.bz2
$ mv -v mpfr-2.4.2 mpfr
$ tar xjf ../gmp-5.0.0.tar.bz2
$ mv -v gmp-5.0.0 gmp
$ mkdir -v gcc-build
$ cd gcc-build
$ ../gcc-4.4.3/configure \
    --target=$LFS_TGT --prefix=/tools \
    --disable-nls --disable-shared --disable-multilib \
    --disable-decimal-float --disable-threads \
    --disable-libmudflap --disable-libssp \
    --disable-libgomp --enable-languages=c
$ make && make install

...

real    20m38.935s
user    8m12.243s
sys     5m53.496s

gccはSBUが5なので予定通り20分ほどで完了。

LFSの説明にある通り、libgcc_eh.a が作成されないので libgcc.a へのシンボリックリンクを作成する。

$ $LFS_TGT-gcc -print-libgcc-file-name
/mnt/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.4.3/libgcc.a
$ ln -vs libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | sed  's/libgcc/&_eh/'`
トラックバック - http://araistudy.g.hatena.ne.jp/czk-htn/20100511