1 AUTHOR: Alexander E. Patrakov <patrakov@ums.usu.ru>, Sylvie Migneault <alisou@alixe.org>
5 LICENSE: GNU Free Documentation License Version 1.2
7 SYNOPSIS: lfscd-remastering-HOWTO, for LFS LiveCD version 6.3
9 DESCRIPTION: This is a guide that shows you how to remaster LFS LiveCD 6.3
11 PREREQUISITES: LFS LiveCD 6.3
13 For LFS LiveCD 6.1-x, see the old "lfscd-remastering-howto-6.1.txt" hint by
14 Sylvie Migneault. For LFS LiveCD 6.1.1-x, the old hint should work if one
15 globally replaces LFS_CD with lfslivecd-VERSION, e.g. lfslivecd-x86-6.1.1-3.
17 For LFS LiveCD 6.2-x, see the old "lfscd-remastering-howto-6.2.txt" hint.
23 * Any Linux system with loop device, CD-ROM and ISO9660 filesystem support.
24 * 3 GB of free hard disk space on one partition.
26 This hint uses the $WORK environment variable as a name of a directory on that
28 export WORK=/mnt/lfslivecd
30 The LiveCD uses the ISO9660 filesystem with Linux-specific transparent
31 decompression extension. On that filesystem, there are the following files:
36 The boot directory contains the Linux kernel, the initramfs image and the
37 bootloader. The actual root filesystem (ext2) is in the root.ext2 file.
39 In order to remaster the CD, you have to install the following packages:
45 Download from http://www.kernel.org/pub/linux/utils/fs/zisofs/
46 Build with ./configure --prefix=/usr && make && make install
51 Look at the root.ext2 file size:
52 ls -l /media/cdrom/root.ext2
54 If it is approximately 1.5 GB, the kernel uncompresses the CD for you. In
55 this case, you can copy the file to your hard disk as usual:
56 cp /media/cdrom/root.ext2 $WORK/root.ext2
58 If it is only 500 MB, you have to rebuild your kernel with ZISOFS support, or
59 uncompress this file manually:
60 mkzftree -u -F /media/cdrom/root.ext2 $WORK/root.ext2
62 In either case, you end up with a $WORK/root.ext2 file that is 1.5 GB in size.
64 This may or may not be sufficient for your remastered CD (or DVD) filesystem.
65 If you want, you can resize the file with the resize2fs program from e2fsprogs
66 version >= 1.39. Earlier versions of e2fsprogs cannot resize filesystem images
69 Mounting the filesystem image is achieved with a loop device:
72 mount -o loop $WORK/root.ext2 $WORK/root
74 It is a good idea to create and bind-mount a temporary directory, in order to
75 preserve as many zeroed sectors as possible:
77 mkdir $WORK/build $WORK/root/build
78 mount --bind $WORK/build $WORK/root/build
80 Mount other directories necessary for chrooting:
81 mount -t proc proc $WORK/root/proc
82 mount -t sysfs sysfs $WORK/root/sys
83 mount -t devpts devpts $WORK/root/dev/pts
84 mount -t tmpfs tmpfs $WORK/root/dev/shm
86 Note: contrary to the instructions in the LFS book, tmpfs is not mounted on
87 $WORK/root/dev. This is because all the necessary devices are already created
90 Copy the DNS configuration into the chroot:
91 cp /etc/resolv.conf $WORK/root/etc/resolv.conf
93 Chroot to the filesystem:
96 In the chroot, change the current directory to /build, and install any
97 additional packages you want. Modify other files as necessary.
99 Check out the initramfs files:
100 svn co svn://svn.linuxfromscratch.org/livecd/trunk/packages/initramfs
102 Remove the "include $(ROOT)/scripts/functions" and
103 "cp initramfs_data.cpio.gz /boot/isolinux/initramfs_data.cpio.gz" lines
104 from the Makefile. Generate the initramfs image for your CD:
107 make compile-stage2 VERSION="x86-6.3-custom" LINKER=ld-linux.so.2
110 make compile-stage2 VERSION="x86_64-6.3-custom" \
111 LINKER=ld-linux-x86-64.so.2 64bit=true
113 (you can replace the "6.3-custom" with your own string). This produces the
114 initramfs_data.cpio.gz file in the current directory. Copy it to /build:
115 cp initramfs_data.cpio.gz /build
117 Exit from the chroot and clean up the mounts:
119 umount $WORK/root/dev/shm
120 umount $WORK/root/dev/pts
121 umount $WORK/root/sys
122 umount $WORK/root/proc
123 umount $WORK/root/build
124 rmdir $WORK/root/build
126 Clean up bash history and DNS configuration:
127 rm $WORK/root/root/.bash_history
128 rm $WORK/root/etc/resolv.conf
130 You may also want to remove other history files.
132 If you, by mistake, created and removed some files, the sectors previously
133 occupied by those files begin to contain non-zero data. Such sectors are
134 useless, but they don't compress well. Zero them out:
135 dd if=/dev/zero of=$WORK/root/zeroes
137 This command will print a message that the disk is full. This is not an error.
138 Then, remove the file that fills the filesystem:
141 Now you can unmount the root.ext2 file:
145 The "sync" command is needed due to a bug in the loop driver in some kernels
146 that leads to a filesystem with errors otherwise.
148 Now make the directory structure for your LiveCD:
151 Copy the directory structure from the original LiveCD:
152 cp -r /media/cdrom/*/ $WORK/iso
154 Replace the stock initramfs image with your own:
155 cp $WORK/build/initramfs_data.cpio.gz \
156 $WORK/iso/boot/isolinux/initramfs_data.cpio.gz
158 Recompress the root.ext2 file:
159 mkzftree -F $WORK/root.ext2 $WORK/iso/root.ext2
161 Recreate the CD image (the string avter "lfslivecd-" must be the same as you
162 used when creating the initramfs):
163 cd $WORK/iso ; mkisofs -z -R -l --allow-leading-dots -D -o \
164 ../lfslivecd-x86-6.3-custom.iso -b boot/isolinux/isolinux.bin \
165 -c boot/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \
166 -V "lfslivecd-x86-6.3-custom" ./
168 Burn and test. Have a fun.
172 The team of "Linux From Scratch" and all users.
173 Sylvie Migneault <alisou@alixe.org> for the initial hint.
174 All users wich contribute at the OpenSource project. :-)
179 * Initial hint by Sylvie Migneault
182 * Updated to LFS LiveCD based on device mapper (6.2-pre4 and later)
185 * Updated for 6.3-pre2
188 * Updated for the final 6.3 version