##### Udated 5.13.2011 with new features and options.
This script will take your existing tce directory and place it in /opt/tce in a seperate initrd in a CD iso. Works with tinycore and microcore iso's, though tinycore is used as example. It will also, when specified, make your current backup available on the cd to be loaded upon boot. These are the files in the iso that are affected:
/boot/optfiles.gz
/boot/backup.gz
/isolinux/isolinux.cfg
optfiles.gz and backup.gz are new created files, while isolinux.cfg has this line changed:
append initrd=/boot/tinycore.gz quiet max_loop=255
If extensions are added to the /opt/tce in an initrd, but no backup, then this is what that line looks like in the new iso:
append initrd=/boot/tinycore.gz,/boot/optfiles.gz quiet max_loop=255
If both extensions and a backup are added, then the line looks like this:
append initrd=/boot/tinycore.gz,/boot/optfiles.gz,/boot/backup.gz quiet max_loop=255
The backup is made by essentially the same process as the normal backup is made, but the contents are simply placed in it's own initrd. To make further backups once the cd is booted, just make a backup as usual but you will simple have to specify a backup device, such as "hda2" to save in /mnt/hda2. Then on reboot, use the restore boot option:
tinycore restore=hda2
Of course, your backup initrd is still there, so if you want to boot without and use a new backup instead, enter this at the boot prompt:
tinycore initrd=/boot/tinycore,gz,/boot/optfiles.gz restore=hda2
That will not load the backup initrd. If you want the cd to start as only the original base, you can start like this:
tinycore initrd=/boot/tinycore.gz base norestore
That is the same as "tinycore base norestore" with the official release.
------
Now for the making of the custom cd. It is pretty simple. While running TC, load your favorite extensions as usual with the appbrowser and prepare your backup settings the normal way. Then download a current release iso of tinycore. Name this script mkiso.sh and run it in the same directory as the downloaded iso. Here are the options:
$ sudo ./mkiso.sh tinycore-2.6.iso
You will be prompted with questions about what you would like to include in your remastered iso, if you want to use different kernel image and tinycore/microcore initrds, and if you want to either use /opt/tce or the base directory of the cd for your tce directory.
Right now using /opt/tce for extensions,I am running a 393MB iso of my desktop, and idle the RAM use is 477MB out of 1GB after flushing the cache. Though I am not going to run my desktop like this every day, the RAM use is not too bad given the mounted mode of the extensions. My /tmp/tcloop disk usage is 600MB, which means that a copy-to-system approach would use over 1GB of ram once you copied the contents of the extensions to RAM. Since the extensions are already in RAM, copy-to-system would just add insult to injury so it is not an option. For RAM savings, use the base directory of the cd for the tce directory. If one is interested they could add the command to their script to touch the appropriate flag in the tce directory.
Script is attached.