Maragda: Running Linux from CD
These files are created by the scripts on the system working directory and the files found there, starting with the source installation.
Cp_root is in charge of creating ROOT.FS, while Cp_whole will build WHOLE.FS. Both scripts use Make_fs to create file systems inside a file.
ROOT.FS should contain files and directories that need to be written and cannot live on a read-only file system. Writing will be possible since ROOT.FS will reside on a RAM disk. It is difficult to find out exactly what is required to be in ROOT.FS. After several attempts, I decided to copy at least the following directories: bin, sbin, lib (including lib/modules), home, var, etc.
For those directories notcopied, symbolic links are created, pointing to where WHOLE.FS will be mounted once Maragda is running (/mnt/whole_fs).
In addition, binaries and libraries are unstripped (symbols removed) to reduce space.
The configuration files for ROOT.FS are kept under system/config. Once ROOT.FS is populated from the source installation, system/config files are written to ROOT.FS overwriting existing files. Typical system/config files are:
the /home/jordi directory
/etc/X11/X and /etc/X11/XF86Config for configuring X
/etc/hosts* and /etc/sysconfig/network-scripts, for setting up network
/etc/passwd, for users' accounts
/etc/rc.d/init.d/* files, to drive the startup process
Especially important is the script system/config/etc/rc.d/rc.sysinit. It is run by init (in the second-stage boot). I patched it to complete the Maragda system. It adds some lines to Maragda's /etc/fstab to reflect where the CD is and, therefore, where WHOLE.FS is. Remember that this was announced by linuxrc (first-stage boot) on the file /initrd/cdrom_dev. Once fstab is completed, rc.sysinit goes on with the “side effect” that WHOLE.FS will be correctly mounted.
Of course, to test your emerging system, you do not need to record a CD. It can be booted easily by means of LILO, arranging files this way:
/system/MARAGDA /system/ROOT.FS /system/WHOLE.FS /boot/bzImage-rd (the kernel) /boot/1INITRD.GZ (the initial RAM disk for the first stage boot)
(System may be a symbolic link to the working directory.) You should add the following entry to /etc/lilo.conf:
image=/boot/bzImage-rd label=maragda initrd=/boot/1INITRD.GZ literal="ramdisk_size=20480" # size of ROOT.FS read-only vga=0x315and run LILO every time you make any change.
As you have already learned, the source installation is a directory containing a complete, installed Linux system. It can be the source for copying the ROOT.FS and WHOLE.FS files or even for installing Linux onto a hard-disk partition or onto a 250MB zip floppy. The script Prepare_install (under the system working directory) sets up a directory to receive RPM packages. Then, you can use Install_rpm to install those packages onto the source-installation directory.
Install_rpm installs packages from the Red Hat's 6.2 distribution CD (or from another place, if you change it). The names of packages to be installed are grouped in files under system/RPM_lists. For instance, base_inst lists the packages for the base-system installation. I created the listing files starting with the file RedHat/base/comps on the Red Hat CD.
If you install the packages in the right order (as it appears on Install_rpm) they should be installed with no problem. Install_rpm also reports which packages were not installed. In the case of base_inst it creates base_inst_not_installed. This is the only group of rpms that poses a problem. But, if you tell Install_rpm to install packages on base_inst_not_installed, finally all packages will be installed.
You may find all the scripts used on http://navel.eugan.upv.es/maragda/doc, including raw CD images of Maragda (and the instructions to record them).
- One Port to Rule Them All!
- Privacy Is Personal
- PHP for Non-Developers
- Secure Server Deployments in Hostile Territory
- Linux Kernel 4.1 Released
- Django Templates
- July 2015 Issue of Linux Journal: Mobile
- A Code Boot Camp for Underprivileged Kids
- Practical Books for the Most Technical People on the Planet
- Attack of the Drones