概述
现在用的操作系统是Win8.1,用VMware创建一个虚拟机,3G内存(物理内存是6G,分一半),23G硬盘,其中3G用于swap分区,10G用于host
system,10G用于建立LFS系统。
创建虚拟机
使用VMware7.1.2创建一个虚拟机,硬盘23G,内存3G。
硬盘分区
分3个区,sda1,3G,用于swap;sda2,10G,用于ubuntu;sda3,10G,用于LFS。之所以要安装ubuntu,是因为需要有一个系统执行分区、建立文件系统、下载源代码、编译源代码等工作。分区在安装ubuntu时进行。
安装utuntu
安装的ubuntu版本为ubuntukylin-13.10-desktop-amd64。之所以安装这个版本,是因为硬盘里正好有这个镜像,懒得再下载其他镜像了。这里要注意的就是host
system版本不能太低,否则不能满足编译需求。
在安装ubuntu的同时,按照上边的方案进行硬盘分区。
检测必须的软件包
LFS里列出了编译系统所必须的软件包列表,同时给出了一个脚本用于检测各软件包的版本。
- Bash-3.2 (/bin/sh should be a symbolic or hard link to
bash) - Binutils-2.17 (Versions greater than 2.24 are not
recommended as they have not been tested) - Bison-2.3 (/usr/bin/yacc should be a link to bison or
small script that executes bison) - Bzip2-1.0.4
- Coreutils-6.9
- Diffutils-2.8.1
- Findutils-4.2.31
- Gawk-4.0.1 (/usr/bin/awk should be a link to
gawk) - GCC-4.1.2 including the C++ compiler, g++
(Versions greater than 4.8.2 are not recommended as they have not been
tested) - Glibc-2.5.1 (Versions greater than 2.19 are not
recommended as they have not been tested) - Grep-2.5.1a
- Gzip-1.3.12
- Linux Kernel-2.6.32
- M4-1.4.10
- Make-3.81
- Patch-2.5.4
- Perl-5.8.8
- Sed-4.1.5
- Tar-1.18
- Xz-5.0.0
cat > version-check.sh << "EOF"
#!/bin/bash
# Simple script to list version numbers of critical development toolsexport LC_ALL=C
bash --version | head -n1 | cut -d" " -f2-4
echo "/bin/sh -> `readlink -f /bin/sh`"
echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-
bison --version | head -n1
if [ -e /usr/bin/yacc ];
then echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`";
else echo "yacc not found"; fibzip2 --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 [ -e /usr/bin/awk ];
then echo "/usr/bin/awk -> `readlink -f /usr/bin/awk`";
else echo "awk not found"; figcc --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
xz --version | head -n1echo ‘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 dummyfor lib in lib{gmp,mpfr,mpc}.la; do
echo $lib: $(if find /usr/lib* -name $lib|
grep -q $lib;then :;else echo not;fi) found
done
unset lib
EOFbash version-check.sh
安装缺失的软件包
sudo apt-get install bison
sudo apt-get install gawk
sudo apt-get install build-essential
Changelog
2014-05-25 首次发布