Vince Greg wrote:
Hello,
I want help to build an lfs live_cd or usb from the system installed.
I want to integrate a choice to use live_cd or install on the computer but I
don't know how beginning.
Thanks
Reusing an existing system is a very bad idea. Your own system is
preconfigured as _you_ want it. When someone else wants to use this CD,
or when you want to use this CD on a different system, the configuration
will be inevitably different. And you have to redo the configuration
steps for every reboot. So, the initial step is exactly choosing
packages for the LiveCD that don't require configuration.
Before even trying to make your own CD, please checkout from SVN (be
sure to use the 6.2 branch, not trunk) and build the official LFS
LiveCD. The buildscripts are easy to customize (i.e., to add or remove
packages). Read the rest of this mail if you insist in doing your own CD
from scratch, not as a fork of the official one.
You have to invent some method to achieve the following tasks:
* Boot the kernel from the CD.
* Find which device contains the CD.
* Make the needed parts of the filesystem read-write.
* Provide a way to eject the CD.
The first part can be solved using either isolinux or GRUB. The official
CD uses isolinux.
The second part involves creating an initramfs. This is just a cpio.gz
archive containing special programs. The kernel unpacks it and runs the
/init file there. That /init script (this is not the same as sysVinit,
you should write it yourself) should find the CD (e.g., by reading bytes
from 32808 till 32840 and comparing that with the known ISO9660 volume
label padded with spaces). Then it should mount the CD (I oversimplify
things here, see the third part below) into some temporary directory
(e.g., /realroot) and do the following commands:
cd /realroot
mount --move . /
chroot . exec /sbin/init "$@"
Ideally, before "mount --move", the /init program should remove
everything (including itself) from initramfs, in order to free the RAM
occupied by initramfs. This is achievable only by using a binary, e.g.,
the "run_init" program from klibc package (it does the same as the three
above-listed commands). The official LFS LiveCD uses a custom C program
as /init, but it has its own drawbacks becauise C is not a very good
language for scripting.
As an alternative, keep everything except /usr in the initramfs, and
mount /usr from the CD.
The third part can be solved by three different methods:
* By replacing files and directories that need write access with
symlinks to places in /dev/shm, and writing a bootscript that populates
these places with defaults.
* By using unionfs. This was the method employed in LFS-6.1.x LiveCDs,
and at that time unionfs was too crashy. So I cannot recommend it.
* By using device mapper snapshot target. This is the method used by
the current CD. It is too complex to explain here, and I will explain it
only after you make the CD according to the first method.
The last part is optional. One way of doing this is to reuse the
shutdown helper from the official LiveCD (be sure to mention it in
inittab). If you employ the "mount /usr, not /, from the CD" approach,
that's as easy as unmounting /usr.
Hope this helps.
--
Alexander E. Patrakov
--
http://linuxfromscratch.org/mailman/listinfo/livecd
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page