LFS 学习日记(第5章构建临时系统之5.4. Binutils-2.20 - 第一遍)

2010年06月13日 星期日

http://www.linuxfromscratch.org/lfs/view/6.6/chapter05/binutils-pass1.html

在有MAKEFLAGS=-j 2 的情况下的编译安装记录和时间如下:
lfs:/mnt/lfs/sources/binutils-2.20$ mkdir -v ../binutils-build
mkdir: created directory `../binutils-build'
lfs:/mnt/lfs/sources/binutils-2.20$ cd ../binutils-build
lfs:/mnt/lfs/sources/binutils-build$ mkdir -v ~/buildlogs
mkdir: created directory `/home/lfs/buildlogs'
lfs:/mnt/lfs/sources/binutils-build$ time { ../binutils-2.20/configure     --target=$LFS_TGT --prefix=/tools     --disable-nls --disable-werror && make && make install; } > ~/buildlogs/binutils.pass1.parallel.log 2>&1

real    1m28.770s
user    1m12.945s
sys    1m26.849s

第二次测试:
real    1m29.374s
user    1m12.621s
sys    1m27.665s

http://www.linuxfromscratch.org/lfs/view/6.6/chapter04/aboutsbus.html
For example, consider a package whose compilation time is 4.5 SBUs. This means that if a system took 10 minutes to compile and install the first pass of Binutils, it will take approximately  45 minutes to build this example package.
和http://www.linuxfromscratch.org/lfs/view/6.6/chapter05/binutils-pass1.html
In order for the SBU values listed in the rest of the book to be of any use, measure the time it takes to build this package from the configuration, up to and including the first install.
可知SBU的计算时间包括配置、编译和安装(time { ./configure ... &&  make && make install; })

没有使用MAKEFLAGS=-j 2参数的情况下:In order for the SBU values listed in the rest of the book to be of any use, measure the time it takes to build this package from the configuration, up to and including the first install.
lfs:/mnt/lfs/sources/binutils-build$ time { ../binutils-2.20/configure     --target=$LFS_TGT --prefix=/tools     --disable-nls --disable-werror && make && make install; } > ~/buildlogs/binutils.pass1.single.log 2>&1
第一次无MAKEFLAGS参数的时间
real    2m43.823s
user    1m7.116s
sys    1m31.610s

第二次无MAKEFLAGS参数的时间(3‘40’‘~6‘17’‘)
real    2m37.250s
user    1m4.524s
sys    1m30.166s

所以,从上可以看出,并行编译确实差不多要减少一半时间。

为了理解Binutils中汇编器和链接器的作用,粗略浏览了一下:COMPILER, ASSEMBLER, LINKER AND LOADER: A BRIEF STORY http://www.tenouk.com/ModuleW.html Binutils的 ld 程序应该就是静态链接器?

新的$LFS/tools/bin/i686-lfs-linux-gnu-ld 的搜索路径是:
lfs:~$ i686-lfs-linux-gnu-ld --verbose | grep SEARCH
SEARCH_DIR("/tools/i686-lfs-linux-gnu/lib");
question: 是不是可以说,这个ld与宿主系统的ld的已经不一样,用这个新的ld链接的程序就离脱离宿主系统环境近了一步? 是否只要调用了这个ld,ld的搜索路径就固定了?假设,不编译这个Binutils,直接用宿主系统的ld,再手工指定ld的搜索路径是不是链接的程序仍然也同样程度的脱离了宿主系统一步?

One thought on “LFS 学习日记(第5章构建临时系统之5.4. Binutils-2.20 - 第一遍)”

  1. 因为此节的重复编译安装,我忘了重复安装之前是否删除了原来已有的安装,这也许会引起问题,因为刚编译安装完成的工具可能马上会被使用,那么也许当第二次编译这个工具时使用了第一次编译的这个工具,这与LFS BOOK是不符合的。因此,已经重新编译工具链(Binutils, Gcc, Linux API headers, Glibc )。见: LFS 学习日记(第5章构建临时系统之重新编译前面的临时工具链 )http://www.learndiary.com/home/space-1-do-blog-id-3796.html

Comments are closed.