一. 准备工作
1. 需要一个Linux宿主系统,例如早先版本的 LFS,Ubuntu/Fedora,SuSE 或者是在你的架构上可以运行的其它发行版
如果想实现Win7与Linux双系统,可参考我的上一篇博文:Win7下硬盘安装Ubuntu双系统
2. 一个8G的U盘,LFS系统将安装在上面
3. 参考网址:Linux From Scratch V7.10
4. 中文版参考网址:Linux From Scratch Version 7.7-systemd (简体中文版)
5. 参考文档:LFS-BOOK-7.10.pdf
二. LFS目标架构
LFS主要支持 AMD/Intel 的 x86(32 位)和 x86_64(64 位) 的目标架构。
假如按照本文的默认方式构建,那么你将得到一个“纯” 64 位系统————这意味着你仅能够执行64 位的程序。
三. 宿主系统需求
1. 如果未设置root密码,先设置,再以root用户登录
sudo passwd root
su - root
2. 请执行以下命令,查看宿主机的各个软件包的版本以及编译环境是否准备妥当:
cat > version-check.sh << "EOF" #!/bin/bash # Simple script to list version numbers of critical development tools export LC_ALL=C bash --version | head -n1 | cut -d" " -f2-4 MYSH=$(readlink -f /bin/sh) echo "/bin/sh -> $MYSH" echo $MYSH | grep -q bash || echo "ERROR: /bin/sh does not point to bash" unset MYSH echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3- bison --version | head -n1 if [ -h /usr/bin/yacc ]; then echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`"; elif [ -x /usr/bin/yacc ]; then echo yacc is `/usr/bin/yacc --version | head -n1` else echo "yacc not found" fi bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f1,6- echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2 diff --version | head -n1 find --version | head -n1 gawk --version | head -n1 if [ -h /usr/bin/awk ]; then echo "/usr/bin/awk -> `readlink -f /usr/bin/awk`"; elif [ -x /usr/bin/awk ]; then echo awk is `/usr/bin/awk --version | head -n1` else echo "awk not found" fi gcc --version | head -n1 g++ --version | head -n1 ldd --version | head -n1 | cut -d" " -f2- # glibc version grep --version | head -n1 gzip --version | head -n1 cat /proc/version m4 --version | head -n1 make --version | head -n1 patch --version | head -n1 echo Perl `perl -V:version` sed --version | head -n1 tar --version | head -n1 makeinfo --version | head -n1 xz --version | head -n1 echo 'int main(){}' > dummy.c && g++ -o dummy dummy.c if [ -x dummy ] then echo "g++ compilation OK"; else echo "g++ compilation failed"; fi rm -f dummy.c dummy EOF bash version-check.sh