Re: Fw: [CBLX] CD Customisé de Debian Lenny

[ Thread Index | Date Index | More lists.tuxfamily.org/carrefourblinux Archives ]


Le mercredi 07 octobre à 18:10, Philippe Delavalade a écrit :
> par contre, pour en venir au sujet de ton message, j'ai pas d'idée mais
> chez LFS il est expliqué comment customiser le livecd ; peut-être que
> ça pourrait te donner des idées :
> 
> http://www.linuxfromscratch.org/livecd/documentation.html
> 
> C'est un peu ancien puisque LFS ne fait plus de livecd...
> 
> Je ne sais plus où, il est fait référence à l'ajout ou suppression de
> fichiers.

Je viens de booter sur le cd en question et j'ai récupéré le fichier ; le
voici en pièce jointe.

Philippe
AUTHOR:		Alexander E. Patrakov <patrakov@xxxxxxxxx>, Sylvie Migneault <alisou@xxxxxxxxx>

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.

This hint uses the $WORK environment variable as a name of a directory on that
partition. E.g.:
	export WORK=/mnt/lfslivecd

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 ./configure --prefix=/usr && make && make install

Mount the CD:
	mount /media/cdrom

Look at the root.ext2 file size:
	ls -l /media/cdrom/root.ext2

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:
	cp /media/cdrom/root.ext2 $WORK/root.ext2

If it is only 500 MB, you have to rebuild your kernel with ZISOFS support, or
uncompress this file manually:
	mkzftree -u -F /media/cdrom/root.ext2 $WORK/root.ext2

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:

	mkdir $WORK/root
	mount -o loop $WORK/root.ext2 $WORK/root

It is a good idea to create and bind-mount a temporary directory, in order to
preserve as many zeroed sectors as possible:

	mkdir $WORK/build $WORK/root/build
	mount --bind $WORK/build $WORK/root/build

Mount other directories necessary for chrooting:
	mount -t proc proc $WORK/root/proc
	mount -t sysfs sysfs $WORK/root/sys
	mount -t devpts devpts $WORK/root/dev/pts
	mount -t tmpfs tmpfs $WORK/root/dev/shm

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:
	cp /etc/resolv.conf $WORK/root/etc/resolv.conf

Chroot to the filesystem:
	chroot $WORK/root

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:
	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

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:
	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

For x86_64:
	create-initramfs x86_64-6.3-custom 2.6.22.5-64bit initramfs_data64.cpio.gz

(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:
	cp initramfs_data*.cpio.gz /build

Exit from the chroot and clean up the mounts:
	exit
	umount $WORK/root/dev/shm
	umount $WORK/root/dev/pts
	umount $WORK/root/sys
	umount $WORK/root/proc
	umount $WORK/root/build
	rmdir $WORK/root/build

Clean up bash history and DNS configuration:
	rm $WORK/root/root/.bash_history
	rm $WORK/root/etc/resolv.conf

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:
	dd if=/dev/zero of=$WORK/root/zeroes

This command will print a message that the disk is full. This is not an error.
Then, remove the file that fills the filesystem:
	rm $WORK/root/zeroes

Now you can unmount the root.ext2 file:
	umount $WORK/root
	sync

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:
	mkdir $WORK/iso

Copy the directory structure from the original LiveCD:
	cp -r /media/cdrom/*/ /media/cdrom/README.html $WORK/iso

Replace the stock initramfs images (and, possibly, kernel images) with your
own:
	cp $WORK/build/initramfs_data*.cpio.gz \
	    $WORK/iso/boot/isolinux/

Recompress the root.ext2 file:
	mkzftree -F $WORK/root.ext2 $WORK/iso/root.ext2

Recreate the CD image (the string avter "lfslivecd-" must be the same as you
used when creating the initramfs):
	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" ./

Burn and test. Have a fun.

ACKNOWLEDGEMENTS:

	The team of "Linux From Scratch" and all users.
	Sylvie Migneault <alisou@xxxxxxxxx> 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


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/