HOWTO make a custom linux livecd that can also install to the HDD
Damn Small Linux turned out to be the most convenient distro for modifications
of this nature. It's also made to be small (50MB) and has a bunch of useful
apps built into it.
1.) Download DSL and burn a copy.
http://www.damnsmalllinux.org/download.html
2.) Boot off the DSL cd on a PC with linux pre-installed on the HDD. (or, just
plug in an empty hdd, and when DSL boots, cfdisk and mkfs.ext2 it)
3.) Start a term and $ sudo su
4.) Once DSL has started, mount a linux partition you can use to copy source
files from the DSL cd to. (i.e. # mount /dev/hda /mnt/hda )
5.) # cd /mnt/hda
6.) # mkdir source newcd newcd/KNOPPIX
7.) # cp -Rp /KNOPPIX/* source
# cp -Rp /KNOPPIX/.bash_profile source
# cp -Rp /cdrom/boot newcd
# cp -Rp /cdrom/* newcd
8.) So here you've copied the contents of the cd over, and the changes you
want to make are to be made in the source directory. Here are some of things
I've changed for the netpubs iso:
A.) in etc/skel/.xtdesktop you can make changes the the desktop icons
so you can either remove most as I did, or just modify the launch
parameters.
B.) Also in etc/skel is .xinitrc, you can comment out stuff that
launches by default in DSL, as I did. I cut out torsmo, fluxter,
wmswallow, dillo. If you wanted something to launch when X began this
would be the place to put it.
C.) There's a pretty good shell script already included in DSL which
ask questions to install the livecd onto your harddrive. I just
automated the answers, and make the installer a clickable icon in the
desktop. It's pretty destructive, but I put one disclaimer at the
very beginning which should keep people from obliterating their
harddrives unintentionally. After you select "y," then it just writes
everything to the disk without further intervention. The script is
called usr/sbin/dsl-hdinstall and it links to another one called
usr/sbin/dsl-installboot which installs lilo or grub. I usually
prefer grub but the lilo installer works without a hitch whereas the
grub one sometimes causes problems.
The launcher for the text based HDD install is "aterm -e /usr/bin/sudo
/usr/sbin/dsl-hdinstall-auto" (I copied the install script to another
name before I modified it - if you do this don't forget to chmod +x
the new script) The reason I did it this way was so that there'd be
some output to look at while the installer was completely destroying
what was on the drive. :) A good idea is to put a quick "Are you
sure?" prompt at the very beginning of the script like I did.
D.) Jim Cooke requested that the workstations run at 1280x1024 by
default. I set this in usr/sbin/xsetup.sh - just changed XCOMMAND to
my own string, which I got from ~/.xserverrc which is generated after
running xsetup.sh for the first time. This is also the place to make
sure the scroll button on your mouse works (add a ,5 behind
$MOUSE_DEVICE)
9.) Once you've got everything how you want it, you'll be making a compressed
filesystem. Change to /mnt/hda or wherever you have your source directory and
run this command:
# mkisofs -R source | create_compressed_fs - 65536 > newcd/KNOPPIX/KNOPPIX
That makes a compressed FS called KNOPPIX.
10.) Now you're going to actually make the iso. Run this command:
# mkisofs --no-pad -l -r -J --no-emul-boot --boot-load-size 4
--boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat
--hide-rr-moved -o my.iso newcd
Now don't be confused about the paths for -b/-c, they are relative to the last
argument, newcd. You're telling mkisofs to build an iso using newcd as /.
11.) The final step is to run # cdw, which is a burning app (this is presuming
there's a burner in the pc you are working with. If not, copy the iso you
made to a pc where it can be burned, and you're done). Tell cdw the location
of your iso file (under options) and then select "Write data CD."
12.) Reboot, and try out the new disc.