LFS-II-准备工作
II 准备工作
第2节 准备宿主系统
换源
/etc/apt/sources.list
1 | deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse |
检查编译环境
1 |
|
未通过:
1 | bash, version 4.4.20(1)-release |
修复:
1 | sudo ln -sf /bin/bash /bin/sh |
通过
1 | bash, version 4.4.20(1)-release |
创建新分区
1 | root@ubuntu:/home/hippo# df / |
第3节 软件包和补丁
下载软件包
wget-list:
1 | https://mirrors.ustc.edu.cn/lfs/lfs-packages/11.0/acl-2.3.1.tar.xz |
1 | root@ubuntu:/home/hippo# |
1 | root@ubuntu:/mnt/lfs/sources# |
验证软件包完整性:
1 | md5sums |
第4节 最后的准备工作
1 | mkdir -pv $LFS/{etc,var} $LFS/usr/{bin,lib,sbin} |
重要
Important
The build instructions assume that the Host System Requirements, including symbolic links, have been set properly:
• bash is the shell in use.
• sh is a symbolic link to bash.
• /usr/bin/awk is a symbolic link to gawk.
• /usr/bin/yacc is a symbolic link to bison or a small script that executes bison.
重要
编译指南假定你已经正确地设置了 宿主系统要求 和符号链接:
- shell 使用的是 bash
- sh 是到 bash 的符号链接。
- /usr/bin/awk 是到 gawk 的符号链接。
- /usr/bin/yacc 是到 bison 的符号链接,或者是一个执行 bison 的小脚本。
再次强调构建的过程:
- 把所有源文件和补丁放到 chroot 环境可访问的目录,例如
/mnt/lfs/sources/
。但是千万不能把源文件放在/mnt/lfs/tools/
中。- 进入到源文件目录。
- 对于每个软件包:
- 用 tar 程序解压要编译的软件包。在第五章中,确保解压软件包时你使用的是 lfs 用户。
- 进入到解压后创建的目录中。
- 根据指南说明编译软件包。
- 回退到源文件目录。
- 除非特别说明,删除解压出来的目录。
Important
To re-emphasize the build process:
Place all the sources and patches in a directory that will be accessible from the chroot environment such as /mnt/lfs/sources/.
Change to the sources directory.
For each package:
a. Using the tar program, extract the package to be built. In Chapter 5 and Chapter 6, ensure you are the lfs user when extracting the package.
b. Change to the directory created when the package was extracted.
c. Follow the book’s instructions for building the package.
d. Change back to the sources ddirectory unless instructed otherwise
问题:
软件包的所有者不是lfs,而是root。
总结
(1) *.tar 用 tar –xvf 解压
(2) *.gz 用 gzip -d或者gunzip 解压
(3) .tar.gz和.tgz 用 tar –xzf 解压
(4) *.bz2 用 bzip2 -d或者用bunzip2 解压
(5) *.tar.bz2用tar –xjf 解压
(6) *.Z 用 uncompress 解压
(7) *.tar.Z 用tar –xZf 解压
(8) *.rar 用 unrar e解压
(9) *.zip 用 unzip 解压
(10) *.xz 用 xz -d 解压
(11) *.tar.xz 用 tar -zJf 解压 // 实测使用tar -xvf大家可以注意到后面所有的解包命令均使用tar xvf来完成,而不管文件的压缩方式是bz2还是gz,这是因为较新的tar程序都具有自动识别后缀名并自动调用相应的解压缩工具的能力,所以可以不需要指定压缩方式,但对于早期的tar命令则可能不具备这个功能因此需要你根据包的压缩方式来指定,如bz2使用j,gz使用z,对应上面的binutils则是tar xvjf /lfs-sources/binutils-2.17.tar.bz2
为lfs加入sudo权限:
1 | su root //进入root用户 |