On 04/19/16 02:54, Bruce Dubbs wrote:
Douglas R. Reno wrote:

This will take me a while.  I have not built a live-dd/iso before and
I'm just researching what is needed now.  I do think a hint would be
appropriate right now, but if everything works out, we might want to add
something to BLFS like the section on Firewalls or Certificates.


As I've done a live/rescue CD based on LFS/BLS and Douglas asked me directly about my approach, I thought I'd share how I went about it, and why. I'm sure some stuff could be simplified and would of course be glad to hear about it.

My goal was to create a rescue CD with everything needed on it, that looks like a regular LFS system, e.g. with a writable, ext4 root partition. To my knowledge, a kernel can

- either mount a root directly using root=/dev/sd.
- mount an initrd as temporary root using initrd=..

For directly mounting root read/write, there would have to be read/writable partition somewhere, which is not the case on a CD. That's why I went for the initrd approach.

To get a read/writable root partition, I went for the combined approach of squashfs/overlayfs. both natively supported by the kernel. The initrd init will mount the squashfs ro and then overlay a tmpfs memory filesystem to create the rw root partition.

Whithin the squashfs file, everything you want to use is contained, the initial ramdisk will only need the stuff to run the init script, mount the squashfs and the overlayfs, and not much else.


So, the sequence of things is:

1. Put everything you want to be on your live CD (including important directories, static device files) into a directory, with the right permissions etc. The

2. Pack this directory into a squashfs filesystem

3. Create an initrd containing the squashfs and an /init script that will mount the squashfs and overlay it with a tmpfs

4. Put isolinux, a kernel, the initrd and a config onto a iso.

5. Test the iso in qemu

6. Burn it on a cd


BLFS stuff you need to create the rescue disk

- cpio, to create the initramfs
- mkinitramfs, to create the initramfs, as in http://www.linuxfromscratch.org/blfs/view/svn/postlfs/initramfs.html
- libisoburn to create the image

Stuff outside BLFS you need:

- syslinux 6.03, from http://www.syslinux.org, to create the boot image
- squashfs 4.3 from http://squashfs.sourceforge.net/, to create the squashfs


If there is interest, I will gladly write up a hint, detailing all the steps on a working example.


Kind regards
Tim





















--
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to