LinuxFromScratch安装学习笔记
LFS -- Linux from Scratch,就是一种从网上直接下载源码,从头编译LINUX的安装方式。它不是发行版,只是一个菜谱,告诉你到哪里去买菜(下载源码),怎么把这些生东西( raw code) 作成符合自己口味的菜肴---个性化的linux,不单单是个性的桌面。优点:了解Linux工作方式;自定义你的系统;建立袖珍型Linux;安全性
我的LFS计划:
本来计划先通过VMWare在虚拟机中做一下试验,结果编译时间太长了,未果。
所以不太甘心,晚上卸载掉Fedura Core 1,重新安装了一个只带GCC等编译必须软件的最小化Fedura系统,
大概才1G多,腾出来空间划分出一个2G的留给LFS。
机器环境介绍:
Athlon XP 1700+ OC 2000+
512MB PC133内存
80GB ATA100 IDE硬盘
已安装系统: Windows XP, Fedura Core 1
Linux myhost 2.4.22-1.2115.nptl #1 Wed Oct 29 15:31:21 EST 2003 i686 athlon i386 GNU/Linux
关于$LFS: 设定LFS分区路径,使用
export LFS=/mnt/lfs
加载。使用范例:
./configure --prefix=$LFS/tools
关于SBUs: Static Binutils Unittime, 静态 Binutils 单位时间
Binutils是LFS中第一个需要编译的软件包,以它编译的时间作为基准单位,可以估算出其它软件包的编译时间
Chapter 3. 准备新分区
3.1 创建一个新分区:(LFS主分区2G + swap分区)
fdisk /dev/hda
n - 增加分区 t - 更改分区类型 p - 显示分区表 w - 写入磁盘
3.2 在新分区上创建文件系统:(ext2)
mke2fs /dev/hda4
[root@myhost root]# mke2fs /dev/hda4
mke2fs 1.34 (25-Jul-2003)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
251392 inodes, 502031 blocks
25101 blocks (5.00%) reserved for the super user
First data block=0
16 block groups
32768 blocks per group, 32768 fragments per group
15712 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
建立swap分区(由于我的内存比较大 所以没建立swap分区):
mkswap /dev/hda8
附:当前/dev/hda分区情况
Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 637 5116671 7 HPFS/NTFS
/dev/hda2 1160 9729 68838525 f Win95 Ext'd (LBA)
/dev/hda3 638 828 1534207+ 83 Linux
/dev/hda4 829 1078 2008125 83 Linux
/dev/hda5 1160 1912 6048441 b Win95 FAT32
/dev/hda6 2015 4564 20482843+ 7 HPFS/NTFS
/dev/hda7 4565 9729 41487831 7 HPFS/NTFS
3.3 加载新的分区
[root@myhost root]# export LFS=/mnt/lfs
[root@myhost root]# mkdir -p $LFS
[root@myhost root]# mount /dev/hda4 $LFS
mkdir -p, --parents: no error if existing, make parent directories as needed
建立sources目录
[root@myhost root]# mkdir $LFS/sources
[root@myhost root]# chmod a+wt $LFS/sources
t: sticky
STICKY DIRECTORIES
When the sticky bit is set on a directory, files in that directory may
be unlinked or renamed only by root or their owner. Without the sticky
bit, anyone able to write to the directory can delete or rename files.
The sticky bit is commonly found on directories, such as /tmp, that are
world-writable.
#---- install script begin ----------------------------------------------------
export LFS=/mnt/lfs
mkdir -p $LFS
mount /dev/hda4 $LFS
mkdir $LFS/sources
chmod a+wt $LFS/sources
#---- install script end ------------------------------------------------------
Chapter 4 安装材料: 包和补丁
4.1 所需软件包及补丁:
使用 Linux From Scratch 官方提供的 LFS 5.0:
http://packages.lfs-es.org/lfs-packages-5.0.tar
中国 linuxsir 镜像:
http://lfs.linuxsir.org/htdocs/files/lfs-packages-5.0.tar
内含软件清单如下:
autoconf-2.57.tar.bz2 inetutils-1.4.2.tar.bz2
automake-1.7.6.tar.bz2 kbd-1.08-more-programs.patch
bash-2.05b-2.patch kbd-1.08.tar.bz2
bash-2.05b.tar.bz2 less-381.tar.bz2
binutils-2.14.tar.bz2 lfs-bootscripts-1.12.tar.bz2
bison-1.875-attribute.patch lfs-utils-0.3.tar.bz2
bison-1.875.tar.bz2 libtool-1.5.tar.bz2
bzip2-1.0.2.tar.bz2 linux-2.4.22.tar.bz2
coreutils-5.0-hostname-2.patch m4-1.4.tar.bz2
coreutils-5.0.tar.bz2 make-3.80.tar.bz2
coreutils-5.0-uname.patch MAKEDEV-1.7.bz2
dejagnu-1.4.3.tar.bz2 man-1.5m2-80cols.patch
diffutils-2.8.1.tar.bz2 man-1.5m2-manpath.patch
e2fsprogs-1.34.tar.bz2 man-1.5m2-pager.patch
ed-0.2-mkstemp.patch man-1.5m2.tar.bz2
ed-0.2.tar.bz2 man-pages-1.60.tar.bz2
expect-5.39.0-spawn.patch modutils-2.4.25.tar.bz2
expect-5.39.0.tar.bz2 ncurses-5.3-etip-2.patch
file-4.04.tar.bz2 ncurses-5.3.tar.bz2
findutils-4.1.20.tar.bz2 ncurses-5.3-vsscanf.patch
flex-2.5.4a.tar.bz2 net-tools-1.60-miitool-gcc33-1.patch
gawk-3.1.3-libexecdir.patch net-tools-1.60.tar.bz2
gawk-3.1.3.tar.bz2 patch-2.5.4.tar.bz2
gcc-2.95.3-2.patch perl-5.8.0-libc-3.patch
gcc-2.95.3-no-fixinc.patch perl-5.8.0.tar.bz2
gcc-2.95.3-returntype-fix.patch procinfo-18.tar.bz2
gcc-2.95.3.tar.bz2 procps-3.1.11-locale-fix.patch
gcc-3.3.1-no_fixincludes-2.patch procps-3.1.11.tar.bz2
gcc-3.3.1-specs-2.patch psmisc-21.3.tar.bz2
gcc-3.3.1-suppress-libiberty.patch sed-4.0.7.tar.bz2
gcc-core-3.3.1.tar.bz2 shadow-4.0.3-newgrp-fix.patch
gcc-g++-3.3.1.tar.bz2 shadow-4.0.3.tar.bz2
gcc-testsuite-3.3.1.tar.bz2 sysklogd-1.4.1.tar.bz2
gettext-0.12.1.tar.bz2 sysvinit-2.85.tar.bz2
glibc-2.3.2-sscanf-1.patch tar-1.13.25.tar.bz2
glibc-2.3.2.tar.bz2 tcl8.4.4-src.tar.bz2
glibc-linuxthreads-2.3.2.tar.bz2 texinfo-4.6.tar.bz2
grep-2.5.1.tar.bz2 util-linux-2.12.tar.bz2
groff-1.19.tar.bz2 vim-6.2.tar.bz2
grub-0.93-gcc33-1.patch zlib-1.1.4.tar.bz2
grub-0.93.tar.bz2 zlib-1.1.4-vsnprintf.patch
gzip-1.3.5.tar.bz2
Chapter 5 创建临时系统
5.1