Remaster LFS6.3的方法(转)
时间:2008-12-31
来源:互联网
经过本人测试,可以成功实现。
注:本文加入了本人少量修改。
AUTHOR: Alexander E. Patrakov <[email protected]>, Sylvie Migneault [email protected]
DATE: 2007-11-28
LICENSE: GNU Free Documentation License Version 1.2
SYNOPSIS: lfscd-remastering-HOWTO, for LFS LiveCD version 6.3
DESCRIPTION: This is a guide that shows you how to remaster LFS LiveCD 6.3
PREREQUISITES: LFS LiveCD 6.3
For LFS LiveCD 6.1-x, see the old "lfscd-remastering-howto-6.1.txt" hint by Sylvie Migneault. For LFS LiveCD 6.1.1-x, the old hint should work if one globally replaces LFS_CD with lfslivecd-VERSION, e.g. lfslivecd-x86-6.1.1-3.
For LFS LiveCD 6.2-x, see the old "lfscd-remastering-howto-6.2.txt" hint.
For LFS LiveCD 6.3-rX with x<2124, see the old "lfscd-remastering-howto-6.3-old.txt" hint.
HINT:
You will need:
* Any Linux system with loop device, CD-ROM and ISO9660 filesystem support.
* 3 GB of free hard disk space on one partition.
Use LFS LiveCD 6.3-rX CD boot:
Remote link with SecureCRT.
Partition, format:
This hint uses the $WORK environment variable as a name of a directory on that partition. E.g.:
Mount partition to $WORK:
The LiveCD uses the ISO9660 filesystem with Linux-specific transparent decompression extension. On that filesystem, there are the following files:
boot/*
root.ext2
The boot directory contains the Linux kernel, the initramfs image and the bootloader. The actual root filesystem (ext2) is in the root.ext2 file.
In order to remaster the CD, you have to install the following packages:
cdrtools-2.01:
see the BLFS book
zisofs-tools-1.0.6:
Download from http://www.kernel.org/pub/linux/utils/fs/zisofs/
Build with
Mount the CD:
Look at the root.ext2 file size:
If it is approximately 1.5 GB, the kernel uncompresses the CD for you. In this case, you can copy the file to your hard disk as usual:
If it is only 500 MB, you have to rebuild your kernel with ZISOFS support, or uncompress this file manually:
In either case, you end up with a $WORK/root.ext2 file that is 1.5 GB in size.
This may or may not be sufficient for your remastered CD (or DVD) filesystem. If you want, you can resize the file with the resize2fs program from e2fsprogs version >= 1.39. Earlier versions of e2fsprogs cannot resize filesystem images directly.
Mounting the filesystem image is achieved with a loop device:
It is a good idea to create and bind-mount a temporary directory, in order to preserve as many zeroed sectors as possible:
Mount other directories necessary for chrooting:
Note: contrary to the instructions in the LFS book, tmpfs is not mounted on $WORK/root/dev. This is because all the necessary devices are already created as static nodes.
Copy the DNS configuration into the chroot:
Chroot to the filesystem:
Compile apache:
Add group and user apache:
Edit apache configure file httpd.conf:
Test apache configure file:
Add apache to System Server:
In the chroot, change the current directory to /build, and install any additional packages you want. Modify other files as necessary. If you want to compile a new kernel, please include the following options:
Generate initramfs images for your CD by running the create-initramfs command for each kernel. This command accepts the following parameters: the LiveCD version, the kernel version, and the name of the initramfs file to create.
For self-compiled kernels, the list of directories to search for modules is not accurate, and you can either ignore "no such file" errors (if you feel lucky)
or edit the /usr/bin/create-initramfs script. For the default LiveCD kernel, the shipped script should just work.
For x86:
For x86_64:
(you can replace the "6.3-custom" with your own string). This produces the initramfs_data.cpio.gz and possibly initramfs_data64.cpio.gz files in the current directory. Copy them (and kernel bzImages, if you have built any) to /build:
Exit from the chroot and clean up the mounts:
Clean up bash history and DNS configuration:
You may also want to remove other history files.
If you, by mistake, created and removed some files, the sectors previously occupied by those files begin to contain non-zero data. Such sectors are useless, but they don't compress well. Zero them out:
This command will print a message that the disk is full. This is not an error.
Then, remove the file that fills the filesystem:
Now you can unmount the root.ext2 file:
The "sync" command is needed due to a bug in the loop driver in some kernels that leads to a filesystem with errors otherwise.
Now make the directory structure for your LiveCD:
Copy the directory structure from the original LiveCD:
Replace the stock initramfs images (and, possibly, kernel images) with your own:
Recompress the root.ext2 file:
Recreate the CD image (the string avter "lfslivecd-" must be the same as you used when creating the initramfs):
Burn and test. Have a fun.
ACKNOWLEDGEMENTS:
The team of "Linux From Scratch" and all users.
Sylvie Migneault <[email protected]> for the initial hint.
All users wich contribute at the OpenSource project. :-)
CHANGELOG:
[2005-11-07]
* Initial hint by Sylvie Migneault
[2006-08-06]
* Updated to LFS LiveCD based on device mapper (6.2-pre4 and later)
[2007-06-11]
* Updated for 6.3-pre2
[2007-08-28]
* Updated for the final 6.3 version
[2007-10-21]
* Updated for the new create-initramfs script
[2007-11-28[
* Updated my e-mail address
* Added kernel instructions
注:本文加入了本人少量修改。
AUTHOR: Alexander E. Patrakov <[email protected]>, Sylvie Migneault [email protected]
DATE: 2007-11-28
LICENSE: GNU Free Documentation License Version 1.2
SYNOPSIS: lfscd-remastering-HOWTO, for LFS LiveCD version 6.3
DESCRIPTION: This is a guide that shows you how to remaster LFS LiveCD 6.3
PREREQUISITES: LFS LiveCD 6.3
For LFS LiveCD 6.1-x, see the old "lfscd-remastering-howto-6.1.txt" hint by Sylvie Migneault. For LFS LiveCD 6.1.1-x, the old hint should work if one globally replaces LFS_CD with lfslivecd-VERSION, e.g. lfslivecd-x86-6.1.1-3.
For LFS LiveCD 6.2-x, see the old "lfscd-remastering-howto-6.2.txt" hint.
For LFS LiveCD 6.3-rX with x<2124, see the old "lfscd-remastering-howto-6.3-old.txt" hint.
HINT:
You will need:
* Any Linux system with loop device, CD-ROM and ISO9660 filesystem support.
* 3 GB of free hard disk space on one partition.
Use LFS LiveCD 6.3-rX CD boot:
代码:
net-setup /etc/rc.d/init.d/sshd start passwd
Partition, format:
代码:
fdisk -l fdisk /dev/sda mkfs.ext3 /dev/sda1
代码:
export WORK=/mnt/lfslivecd mkdir -pv $WORK
代码:
mount -t ext3 -v /dev/sda1 $WORK
boot/*
root.ext2
The boot directory contains the Linux kernel, the initramfs image and the bootloader. The actual root filesystem (ext2) is in the root.ext2 file.
In order to remaster the CD, you have to install the following packages:
cdrtools-2.01:
see the BLFS book
代码:
cd cdrtools-2.0.1 patch -Np1 -i ../cdrtools-2.01-mkisofs_iconv-1.patch patch -Np1 -i ../cdrtools-2.01-ascii-2.patch make INS_BASE=/usr DEFINSUSR=root DEFINSGRP=root make INS_BASE=/usr DEFINSUSR=root DEFINSGRP=root install && install -v -m755 -d /usr/share/doc/cdrtools-2.01 && install -v -m644 README* ABOUT doc/*.ps \ /usr/share/doc/cdrtools-2.01
Download from http://www.kernel.org/pub/linux/utils/fs/zisofs/
Build with
代码:
cd zisofs-tools-1.0.6 ./configure --prefix=/usr && make && make install
代码:
mount -t iso9660 -v /dev/cdrom /media/cdrom
代码:
ls -lh /media/cdrom/root.ext2
代码:
cp -av /media/cdrom/root.ext2 $WORK/root.ext2
代码:
mkzftree -u -F /media/cdrom/root.ext2 $WORK/root.ext2
This may or may not be sufficient for your remastered CD (or DVD) filesystem. If you want, you can resize the file with the resize2fs program from e2fsprogs version >= 1.39. Earlier versions of e2fsprogs cannot resize filesystem images directly.
Mounting the filesystem image is achieved with a loop device:
代码:
mkdir -pv $WORK/root mount -o loop -v $WORK/root.ext2 $WORK/root
代码:
mkdir -pv $WORK/build $WORK/root/build mount --bind -v $WORK/build $WORK/root/build
代码:
mount -t proc -v proc $WORK/root/proc mount -t sysfs -v sysfs $WORK/root/sys mount -t devpts -v devpts $WORK/root/dev/pts mount -t tmpfs -v tmpfs $WORK/root/dev/shm
Copy the DNS configuration into the chroot:
代码:
cp -av /etc/resolv.conf $WORK/root/etc/resolv.conf
代码:
chroot $WORK/root
代码:
cd /build tar xvf httpd-2.2.3.tar.gz cd httpd-2.2.3 ./configure --prefix=/usr/local/apache2 make make install
代码:
groupadd -g 80 apache useradd -u 80 -g 80 -c apache -d /dev/null -s /bin/false apache
代码:
User apache Group apache ServerName 127.0.0.1
代码:
/usr/local/apache2/bin/apachectl -t
代码:
cp -av /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
代码:
CONFIG_MD=y CONFIG_BLK_DEV_DM=y CONFIG_DM_SNAPSHOT=y CONFIG_EXT2_FS=y or m CONFIG_ISO9660_FS=y or m CONFIG_ZISOFS=y
For self-compiled kernels, the list of directories to search for modules is not accurate, and you can either ignore "no such file" errors (if you feel lucky)
or edit the /usr/bin/create-initramfs script. For the default LiveCD kernel, the shipped script should just work.
For x86:
代码:
create-initramfs x86-6.3-custom 2.6.22.5 initramfs_data.cpio.gz create-initramfs x86-6.3-custom 2.6.22.5-64bit initramfs_data64.cpio.gz
代码:
create-initramfs x86_64-6.3-custom 2.6.22.5-64bit initramfs_data64.cpio.gz
代码:
cp -av initramfs_data*.cpio.gz /build
代码:
exit umount -v $WORK/root/dev/shm umount -v $WORK/root/dev/pts umount -v $WORK/root/sys umount -v $WORK/root/proc umount -v $WORK/root/build rmdir -v $WORK/root/build
代码:
rm -vf $WORK/root/root/.bash_history rm -vf $WORK/root/etc/resolv.conf
If you, by mistake, created and removed some files, the sectors previously occupied by those files begin to contain non-zero data. Such sectors are useless, but they don't compress well. Zero them out:
代码:
dd if=/dev/zero of=$WORK/root/zeroes
Then, remove the file that fills the filesystem:
代码:
rm -vf $WORK/root/zeroes
代码:
umount -v $WORK/root sync
Now make the directory structure for your LiveCD:
代码:
mkdir -pv $WORK/iso
代码:
cp -rv /media/cdrom/*/ /media/cdrom/README.html $WORK/iso
代码:
cp -rv $WORK/build/initramfs_data*.cpio.gz \ $WORK/iso/boot/isolinux/
代码:
mkzftree -Fv $WORK/root.ext2 $WORK/iso/root.ext2
代码:
cd $WORK/iso ; mkisofs -z -R -l --allow-leading-dots -D -o \ ../lfslivecd-x86-6.3-custom.iso -b boot/isolinux/isolinux.bin \ -c boot/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \ -V "lfslivecd-x86-6.3-custom" ./
ACKNOWLEDGEMENTS:
The team of "Linux From Scratch" and all users.
Sylvie Migneault <[email protected]> for the initial hint.
All users wich contribute at the OpenSource project. :-)
CHANGELOG:
[2005-11-07]
* Initial hint by Sylvie Migneault
[2006-08-06]
* Updated to LFS LiveCD based on device mapper (6.2-pre4 and later)
[2007-06-11]
* Updated for 6.3-pre2
[2007-08-28]
* Updated for the final 6.3 version
[2007-10-21]
* Updated for the new create-initramfs script
[2007-11-28[
* Updated my e-mail address
* Added kernel instructions
作者: lonelycloud 发布时间: 2008-12-31
如果重新编译内核,还能从硬盘启动嘛?
作者: lonelyao 发布时间: 2009-02-14
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28