LFS 学习日记(第5章构建临时系统之一)

2010年06月11日 星期五
http://www.linuxfromscratch.org/lfs/view/6.6/chapter05/introduction.html
构建第5章这一临时工具系统分两步走:一是独立于宿主机的工具链,二是用工具链编译其它重要工具。

todo:理解独立于宿主机的工具链到底独立到哪种程度

http://www.linuxfromscratch.org/lfs/view/6.6/chapter05/toolchaintechnotes.html
question: 可能因为我在64位机器上安装的是32位操作系统,./config.guess 显示的是: i686-pc-linux-gnu
readelf -l <name of binary> | grep interpreter 显示的是32位的: ld-linux.so.2

为了对比在64位CPU上的64位操作系统和32位操作系统宿主机环境编译LFS的区别,今天又下载一个64位的Ubuntu 10.04(ubuntu-10.04-desktop-amd64.iso)准备安装在vmware虚拟机中同时实验。

2010年06月12日 星期六
准备在 Vmware server 中安装64位的Ubuntu,但是好像本机CPU是老的E7400,不支持VT技术,所以在vmware中不能安装64位的操作系统,启动安装光盘告知是i686而不是64_x86的CPU,不能启动进行安装。故只能在32位的操作系统下编译LFS了。

gcc dummy.c -Wl,--verbose 2>&1 | grep succeeded 其中“2>&1”表示错误信息(用2表示)重定向到标准输出(用&1表示,参考:linux shell 中"2>&1"含义  http://www.cppblog.com/prayer/archive/2009/08/27/94589.aspx “find /home -name .bashrc > list 2>&1” 鸟哥称之为“寫入同一個檔案的特殊語法” http://linux.vbird.org/linux_basic/0320bash.php )

此节小点:
1、动态链接器(Glibc提供,名称:ld-linux.so.2 。 The name of the dynamic linker for a 32-bit Intel machine will be ld-linux.so.2. ),标准链接器(Binutils提供,名称:ld 。not to be confused with the standard linker ld  that is part of Binutils)

2、首次编译安装的Binutils和GCC都是交叉编译的;
Slightly adjusting the name of the working platform, by changing the "vendor" field target triplet by way of the LFS_TGT variable, ensures that the first build of Binutils and GCC produces a compatible cross-linker and cross-compiler.

The temporary libraries are cross-compiled.

3、编译安装顺序:第一次Binutils,GCC,Glibc;第二次编译GCC,Binutils;在第6章chroot进入安装Glibc到/usr。

4、Glibc根据各种参数配置行为,独立性很强,一般不依赖于工具链。

These items highlight an important aspect of the Glibc package—it is very self-sufficient in terms of its build machinery and generally does not rely on toolchain defaults.

todo: 正如此节提示,还不能深刻理解这节提到的工具链技术,只能在以后的编译中慢慢理解。question: 包括:为什么用这样的顺序编译工具链?每次编译又是怎样一步一步从宿主环境进入新的LFS环境,改变的关键之处是什么?假设缺失其中任何一步的改变会有什么结果发生?

2010年06月13日 星期日
General Compilation Instructions
http://www.linuxfromscratch.org/lfs/view/6.6/chapter05/generalinstructions.html

1、下载的补丁不是每次编译都要进行,要严格根据指令进行;
2、编译过程中的警告通常可以忽略;
3、除非特别指定,安装一个软件包就删除源码和编译目录;
4、使用bash;
5、以lfs用户解开源码包并cd进入解开的源码目录;

translation: Therefore, do not be concerned if instructions for a downloaded patch seem to be missing. (因此,不要在意似乎缺失了针对一个下载了的补丁的指令。)