Virtual Linux --- How It All Works.
A reprint of posts to the sourceforge mailing list...might be insightful.
Reposted here by Dave Crouse (webmaster for virtual-linux.org) 07-11-2002

POSTED 5/13/02 to virtual-linux-support mailing list]
-----------------------------------------------------------
Hi Everyone! (Mårten especially!)

I have been following this project since the release of VL10devrelease1.iso I have to say, that I have found this project to very interesting. I have also seen other CDROM based distribution like knoppix (http://www.knopper.net/knoppix) that can boot from cdrom into a stand alone Linux environment. However, this project's approach is much closer to a REAL Linux install.

Now, onto what I started to write ... How It All Works.

In a nut shell the filesystem is abstracted into two parts; the static files, and the dynamic files. The static files are stored on the cdrom in a compressed loopback file (cloop) mounted in the root of the ramdisk. The dynamic files are in the initrd that get loaded at boot time and stored in the ramdisk (ram0). Additionally, files saved to disk during previous runs are loaded into the ramdisk over writing what was loaded by the initrd. In addition to the dynamic files, there are symbolic links that point to every static file in the .virtual_root folder. The system is essentially a standard Mandrake install except for some small parts in the startup and shutdown. Here is what I have been able to determine;

(please correct me or fill in where I'm wrong or missing something)
OPERATION:
->power
->bios
->cdrom boot
->isolinux (see isolinux.cfg)
->load Linux kernel (vmlinux)
->load initrd           (initrd.gz)
[KERNEL STARTS - with initrd.gz loaded into ram0 as root]
->/bin/init (init 3 or init 5 from the isolinux.cfg. 3 being multiuser and 5 being x11)
->/etc/rc.d/rc.sysinit
->/bin/findcd
(umount /initrd)
(compress ramdisk)(new ... nice!)
(make /.virtual_root directory)
(mount /proc)
(load scsi module)
(loops through cdrom drives looking for virtual Linux cdrom)
[CDROM FOUND]
(load cloop kernel driver (pointing to found iso.compressed image)
(mount cloop (device) image to /.virtual_root)
(mount devfs)
(mount devpts)
(exit (return) to rc.sysinit)
[CDROM NOT FOUND]
(bombs out waiting for user to reboot)
[VARIOUS OTHER INIT STUFF] (setting clock, keymap, ect.)
->/bin/vlutil swap
(creates a list of known swap partitions and dumps them into /etc/fstab)
(turns swap on)
(exit (return) to rc.sysinit)
[FSCK removed]
[MTAB clear removed]
[VARIOUS OTHER INIT STUFF] (setting hdparam, modules, devfsd.)
->/bin/vlutil locate
(creates a list of known hard disk)
(tries to mount all known hard disk and puts links onto /root/Desktop/...)
(exit (return) to rc.sysinit)
->/bin/vlutil settings
[checks /proc/cmdline for clean=]
(if yes, clear the virt_linux folder off hard disk)
(if no, load saved files over-writing initrd)(root.tgz, etc.tgz, update.tgz, etc.)
(exit (return) to rc.sysinit)
[VARIOUS OTHER INIT STUFF] (/etc/init.d/mandrake_everytime, etc.)
[init level 3 (multiuser) or 5 (X11) called by init](see isolinux.cfg)
[** SYSTEM IS UP AND RUNNING **]
[LOGIN](root account)
->.bashrc
(checks to see if /etc/.configure is present)
(if yes -> normal login)
(if no -> runs drakeconf in a loop until user cancels -> then normal login)
[SHUTDOWN REQUESTED (init 6)]
->/bin/init 6
->/etc/rc.d/init.d/halt
[VARIOUS OTHER INIT STUFF]
->/bin/vlutil umount
saves /etc & /root as tar gzip archives to the virt_linux folder
unmounts all mounted filesystems
[** SYSTEM REBOOTS **] 
FILES REFERENCED:
/etc/rc.d/rc.sysinit    (modified)
/etc/rc.d/init.d/halt   (modified)
/bin/findcd                     (added)
/bin/vlutil                     (added)
/etc/.configure         (used)
$vfat/virtual_root      (added, used for storage & settings)
QUESTIONS:

A few questions I have are;

1) Does the cdrom really need to have the (initrd?) filesystem present. If the files are being loaded from the initrd.gz and the virt_linux/*.tgz files, why are they also present on the root of the cdrom?

2) Is there a linuxrc step missing, or is this a leftover from previous versions? (in the isolinux.cfg it refers to init=/linuxrc)

3) Are there any other files, packages, and etc. that have been modified for this project?

(anything not noticeable from the surface?)

Scott Franzyshen


By: crixz ( mårten sundling )
RE: How It All Works
2002-05-17 05:46

Well , thanks for your very accurate disection of Virtual Linux ! Hmm , mailed me and got no answer ... strange ,, i normally answer all mail no matter what ....

Sorry, must have missed it :(

Answers :
1 : Yes, it must be in /isolinux directory,because isolinux loads it during boot, it is not hidden somewhere as with other boot loaders . should not be present in / of cdrom ??

2 . i was lazy and created a little /initrd script in the previous small initrd .
i had severe problems with my smaller initrds and decided to go back to one big 20 mb initrd instead, did a quickhack to test, forgot to remove it after .

3 . Well, i have poked a bit here and there, removed some lines in drakxconf and kudzu startup that i don't use, modified rights and ownerships for things to work properly , made a very custom kernel with e2compr and so on, but i have not modified any sourcecode besides drakxconf and kudzu .

I am trying to use everything as is, that is one of the goals for this project .
Do you have any ideas, feel that things should be done different or so ?
I am open for all ideas, and need more people for redoing /bin/vlutil and such, theses scripts look more of a disaster for every release . Should be trashed and rewritten .

My time is quite limited, i work as remote admin about 12 hrs /day :(