KL Davis info at
Wed Jul 26 09:30:13 PDT 2000

Gerard Beekmans wrote:
> > It is really simple to write a short script that does all of the work
> > for you.
> Could you post this script so we all can see how it's done (Jesse's not
> the only one who wants a bootable cd)

Naturally, a lot depends on where you are working and your file
structure, but here is an overview of how I do it...

First, I build whatever the CD is going to look like on a seperate
partition, then mount that partiton on /mnt.

I use the following directories under one directory named `build`

boot - this will hold the initrd.img, also put syslinux.cfg, vmlinuz
(kernel), message.txt and optional syslinux.f1 and stuff in here.

rootfs - this is where I build the small root file system (you can use
an existing boot disk hor this)

syslinux - unpack syslinux in here

The script varies, but here are the big parts...

#! /bin/bash

#define your variables

echo 'drive x: file="/tmp/livecd/floppyimage"' > $MTOOLSRC

mkdir /tmp/livecd
mkdir /tmp/livecd/bootsrc
mkdir /tmp/livecd/floppymount

dd if=/dev/zero of=/tmp/livecd/bootfile bs=1k count=6000 <=count varies

echo "y" | mke2fs -m 0 -i 1024 /tmp/livecd/bootfile
mount -o loop -t ext2 /tmp/livecd/bootfile /tmp/livecd/bootsrc

cp -a rootfs/* /tmp/livecd/bootsrc

umount /tmp/livecd/bootfile

dd if=/tmp/livecd/bootfile | gzip -v9 > ~/boot/initrd.img

dd if=/dev/zero of=/tmp/livecd/floppyimage bs=1k count=2880
mformat -t 80 -h 2 -s 36 x:

syslinux/syslinux /tmp/livecd/floppyimage
mount -o loop -t msdos /tmp/livecd/floppyimage /tmp/livecd/floppymount
cp boot/vmlinuz /tmp/livecd/floppymount
cp boot/message.txt /tmp/livecd/floppymount
cp boot/syslinux.cfg /tmp/livecd/floppymount
cp boot/initrd.img /tmp/livecd/floppymount
# and cp anything else optional (messages and stuff)

umount /tmp/livecd/floppyimage

cp /tmp/livecd/floppyimage /mnt/boot.image

# make the CD
mkisofs -R -o cdimage.raw -c boot.catatlog -b boot.image /mnt
# edit this line for your speed and dev
cdrecord -v speed=4 dev=0,3,0 cdimage.raw


May need a little work to do what you want to do... there are other ways
of doing it -- this uses a loop device, I also have a script that makes
it in RAMDRIVE but I like this one.

        Kino L. Davis                    n,
LycanthroLabs - Linux Solutions        _/ | _
"It's Time To Make The Change"       _/'  `'/           <~    .'               .'    |
                                   /      |
Mail archive:
IRC access: server: port: 6667 channel: #LFS
Unsubscribe: email alfs-discuss-request at and put
"unsubscribe" (without the quotation marks) in the body of the message
(no subject is required)

More information about the alfs-discuss mailing list