从头开始构建LINUX [LFS]
“LINUX就是这个范”有一章专门介绍了Linux的构建,过程详细,很有意思。结合这方面的资料简要汇集一下
LFS
这个站点提供了从源代码构建一个Linux的详细步骤
书
http://archive.linuxfromscratch.org/lfs-museum/stable/LFS-BOOK-7.5.pdf
包
wget-list 经验证的包地址
http://archive.linuxfromscratch.org/lfs-museum/stable/wget-list
有的包拿不到的话,参考这个 http://www.linuxfromscratch.org/lfs/packages.html
如 ftp://ftp.lfs-matrix.net/pub/lfs/lfs-packages/lfs-packages-7.5.tar
http://ftp.lfs-matrix.net/pub/lfs/lfs-packages/lfs-packages-7.5.tar
这些是完整的包,找到
脚本
http://archive.linuxfromscratch.org/lfs-museum/stable/lfs-bootscripts-20130821.tar.bz2
Ubuntu10.0.4 64位实战
HOST机器检查
依赖的内容如下:
bash, version 4.1.5(1)-release
/bin/sh -> /bin/dash
Binutils: (GNU Binutils for Ubuntu) 2.20.1-system.20100303
bison (GNU Bison) 2.4.1
/usr/bin/yacc -> /usr/bin/bison.yacc
bzip2, Version 1.0.5, 10-Dec-2007.
Coreutils: 7.4
diff (GNU diffutils) 2.8.1
find (GNU findutils) 4.4.2
GNU Awk 3.1.6
/usr/bin/awk -> /usr/bin/gawk
gcc (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3
g++ (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3
(GNU libc) 2.19
GNU grep 2.5.4
gzip 1.3.12
Linux version 2.6.32-38-generic (buildd@allspice) (gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) ) #83-Ubuntu SMP Wed Jan 4 11:12:07 UTC 2012
m4 (GNU M4) 1.4.13
GNU Make 3.81
patch 2.6
Perl version='5.10.1';
GNU sed version 4.2.1
tar (GNU tar) 1.22
xz (XZ Utils) 4.999.9beta
gmp mpfr mpc库需要安装
具体的脚本如下:
#!/bin/bash
tar xf pkg/gawk-4.1.0.tar.xz
pushd gawk-4.1.0
./configure
make
sudo make install
gawk --version
popd
tar xf pkg/xz-5.0.5.tar.xz
pushd xz-5.0.5
./configure
make
sudo make install
xz --version
popd
#xz进行了ldconfig,第二次独立执行
ldconfig
tar xf pkg/gmp-5.1.3.tar.xz
pushd gmp-5.1.3
./configure --prefix=/usr
make
make check
sudo make install
popd
ldconfig
tar xf pkg/mpfr-3.1.2.tar.xz
pushd mpfr-3.1.2
./configure --prefix=/usr
make
make check
sudo make install
popd
ldconfig
tar xf pkg/mpc-1.0.2.tar.gz
pushd mpc-1.0.2
./configure --prefix=/usr
make
make check
sudo make install
popd
ldconfig
加新的磁盘
fdsik /dev/sdb
依次建立几个分区 n
分区类型 t 82 -- Linux Swap 83 -- LINUX
mkfs -v -t ext4 /dev/sdb1
mkswap /dev/sdb2
http://blog.csdn.net/mirage1993/article/category/2450253
http://blog.csdn.net/mirage1993/article/details/38356559 建立新分区并挂载
http://blog.csdn.net/mirage1993/article/details/38364823
参考信息
- Linux文档和一些基础书 http://www.tldp.org
- Linux参考部分标准
LSB/FHS http://www.linuxfoundation.org/
POSIX