17th Jan 2008
LFS 6.3 with reiser4 and initrd
上周用了一周时间搞了 LFS 6.3, 用 reiser4 作根分区.
LFS 本身没什么, 细心看 LFS Book 应该就没问题了. 我就分享一下用 reiser4 的经验吧.
www.namesys.com 无法访问, 所以 reiser4 需要的东西可以从这里下载:
http://chichkin_i.zelnet.ru/namesys/
参考文章:
http://www.linuxfromscratch.org/hints/downloads/files/initrd.txt
http://www.linuxfromscratch.org/hints/downloads/files/reiser4-on-2.6.txt
需要的 mkinitrd 脚本:
http://www.linuxfromscratch.org/hints/downloads/files/ATTACHMENTS/initrd/
首先刚开始准备分区时要格式化成 reiser4 ( LiveCD 支持 reiser4 )
然后准备内核:
tar xfv linux-2.6.22.5.tar.bz2
cd linux-2.6.22.5
zcat path-to-patch/reiser4-for-2.6.22-2.patch.gz | patch -p1
cd ..
tar jcfv linux-2.6.22.5-patched.tar.bz2 linux-2.6.22.5
rm linux-2.6.22.5
以后用到内核源码就用这个 linux-2.6.22.5-patched.tar.bz2
然后到了 grub 那节, 跳过. 用grub 启动 reiser4 比较麻烦, 用 lilo 会方便点.
第六章安装完最后一个软件 vim 后, 就要安装 reiser4 的东西了
首先是 libaal
./configure --prefix=/usr --sbindir=/sbin --enable-libminimal --enable-static
make
make install
然后是reiser4progs
./configure --prefix=/usr --sbindir=/sbin --enable-libminimal --enable-full-static
make
make install
编译内核时文件系统选上 reiser4 就可以了
下面是 initrd 用的:
第八章编译内核时要注意这几个配置:
-> General setup -> Initial RAM filesystem and RAM disk (initramfs/initrd) support 选 y
-> Device Drivers -> Block devices -> RAM disk support 选 y
-> File systems -> Ext3 journalling file system support 选 y
然后编译内核.
initrd 需要 busybox 作 shell.
下载: http://www.busybox.net/downloads/busybox-1.01.tar.bz2 切勿贪新.
配置:
make defconfig
sed -r 's/^([^#=]+).+/# \1 is not set/g' -i .config # 配置全部选 n
make menuconfig
像这样配置
General Configuration --->
[*] Support for devfs
NOTE - only if you using devfs
Build Options --->
[*] Build BusyBox as a static binary (no shared libs)
Coreutils --->
[*] echo (basic SUSv3 version taking no options
Linux Module Utilities --->
[*] insmod
[*] Support version 2.1.x to 2.4.x Linux kernels
NOTE - only if your using a 2.4 kernel
[*] Support version 2.6.x Linux kernels
NOTE - only if your using a 2.6 kernel
Another Bourne-like Shell --->
[*] Optimize for size instead of speed
[*] Enable alias support
(0) history size
Linux System Utilities --->
[*] pivot_root
[*] mount
然后编译安装:
make
cp busybox /bin/busybox.static
制作 initrd 镜像:
mkinitrd kernel_version=2.6.22.5 initrdfs=ext3 +module="piix libata ata_piix reiser4 ata_generic reiser4"
附加的 module 按需选择, 看一下 lsmod 是个好主意.
接着添加一个启动脚本, 在启动后清理 initrd :
#!/bin/sh
# Begin $rc_base/init.d/initrd
# Based on sysklogd script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
source /etc/sysconfig/rc
source $rc_functions
case "$1" in
start)
if [ -e /initrd/dev/.devfsd ]
then
umount /initrd/dev
fi
if [ -e /initrd/proc ]
then
umount /initrd/proc
fi
if [ -e /initrd/sys ]
then
umount /initrd/sys
fi
if [ -e /initrd/linuxrc ]
then
umount /initrd
echo "Clearing Initial RAM Disk..."
blockdev --flushbufs /dev/ram0
evaluate_retval
fi
;;
*)
echo "Usage: $0 {start}"
exit 1
;;
esac
# End $rc_base/init.d/initrd
保存为 /etc/rc.d/init.d/initrd, 然后在 /etc/rc.d/rcsysinit.d 建一个符号链接:
ln -sf ../init.d/initrd S41initrd
Reboot and enjoy !

上周用了一周时间搞了 LFS 6.3, 用 reiser4 作根分区.
LFS 本身没什么, 细心看 LFS Book 应该就没问题了. 我就分享一下用 reiser4 的经验吧.
www.namesys.com 无法访问, 所以 reiser4 需要的东西可以从这里下载:
http://chichkin_i.zelnet.ru/namesys/
参考文章:
http://www.linuxfromscratch.org/hints/downloads/files/initrd.txt
http://www.linuxfromscratch.org/hints/downloads/files/reiser4-on-2.6.txt
需要的 mkinitrd 脚本:
http://www.linuxfromscratch.org/hints/downloads/files/ATTACHMENTS/initrd/
首先刚开始准备分区时要格式化成 reiser4 ( LiveCD 支持 reiser4 )
然后准备内核:
tar xfv linux-2.6.22.5.tar.bz2 cd linux-2.6.22.5 zcat path-to-patch/reiser4-for-2.6.22-2.patch.gz | patch -p1 cd .. tar jcfv linux-2.6.22.5-patched.tar.bz2 linux-2.6.22.5 rm linux-2.6.22.5
以后用到内核源码就用这个 linux-2.6.22.5-patched.tar.bz2
然后到了 grub 那节, 跳过. 用grub 启动 reiser4 比较麻烦, 用 lilo 会方便点.
第六章安装完最后一个软件 vim 后, 就要安装 reiser4 的东西了
首先是 libaal
./configure --prefix=/usr --sbindir=/sbin --enable-libminimal --enable-static make make install
然后是reiser4progs
./configure --prefix=/usr --sbindir=/sbin --enable-libminimal --enable-full-static make make install
编译内核时文件系统选上 reiser4 就可以了
下面是 initrd 用的:
第八章编译内核时要注意这几个配置:
-> General setup -> Initial RAM filesystem and RAM disk (initramfs/initrd) support 选 y
-> Device Drivers -> Block devices -> RAM disk support 选 y
-> File systems -> Ext3 journalling file system support 选 y
然后编译内核.
initrd 需要 busybox 作 shell.
下载: http://www.busybox.net/downloads/busybox-1.01.tar.bz2 切勿贪新.
配置:
make defconfig sed -r 's/^([^#=]+).+/# \1 is not set/g' -i .config # 配置全部选 n make menuconfig
像这样配置
General Configuration ---> [*] Support for devfs NOTE - only if you using devfs Build Options ---> [*] Build BusyBox as a static binary (no shared libs) Coreutils ---> [*] echo (basic SUSv3 version taking no options Linux Module Utilities ---> [*] insmod [*] Support version 2.1.x to 2.4.x Linux kernels NOTE - only if your using a 2.4 kernel [*] Support version 2.6.x Linux kernels NOTE - only if your using a 2.6 kernel Another Bourne-like Shell ---> [*] Optimize for size instead of speed [*] Enable alias support (0) history size Linux System Utilities ---> [*] pivot_root [*] mount
然后编译安装:
make cp busybox /bin/busybox.static
制作 initrd 镜像:
mkinitrd kernel_version=2.6.22.5 initrdfs=ext3 +module="piix libata ata_piix reiser4 ata_generic reiser4"
附加的 module 按需选择, 看一下 lsmod 是个好主意.
接着添加一个启动脚本, 在启动后清理 initrd :
#!/bin/sh
# Begin $rc_base/init.d/initrd
# Based on sysklogd script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
source /etc/sysconfig/rc
source $rc_functions
case "$1" in
start)
if [ -e /initrd/dev/.devfsd ]
then
umount /initrd/dev
fi
if [ -e /initrd/proc ]
then
umount /initrd/proc
fi
if [ -e /initrd/sys ]
then
umount /initrd/sys
fi
if [ -e /initrd/linuxrc ]
then
umount /initrd
echo "Clearing Initial RAM Disk..."
blockdev --flushbufs /dev/ram0
evaluate_retval
fi
;;
*)
echo "Usage: $0 {start}"
exit 1
;;
esac
# End $rc_base/init.d/initrd
保存为 /etc/rc.d/init.d/initrd, 然后在 /etc/rc.d/rcsysinit.d 建一个符号链接:
ln -sf ../init.d/initrd S41initrd
Reboot and enjoy !

Posted by autumncat under
Linux
2 Comments »
