2 # Make a Marionette CD image
4 KERNEL
=build
/kernel
/kernel.elf
5 MODS
="build/kernel/testmodule.ko"
7 GRUBDIR
=/usr
/lib
/grub
/i386-pc
10 # create directory if it doesn't exist - die on failure
12 [ -d "$1" ] || mkdir
-v "$1" || die
"failed to create directory $1"
20 [ "$1" == "--help" ] && {
22 echo "(This command takes no arguments)"
24 echo "Creates a bootable CD image for Marionette."
25 echo "Requires mkisofs and GRUB"
27 echo "Please edit this script to alter the settings."
29 echo "CD-ROM directory: $CDDIR"
30 echo "GRUB files in: $GRUBDIR"
31 echo "Kernel image: $KERNEL"
32 echo "Output ISO image: $OUTPUT"
38 mkdir_e
"$CDDIR/boot/grub"
40 if [ ! -f "$CDDIR/boot/grub/stage2_eltorito" ]
42 STAGE2
="$GRUBDIR/stage2_eltorito"
43 if [ -f "$STAGE2" -a -r "$STAGE2" ]
45 cp -v "$GRUBDIR/stage2_eltorito" "$CDDIR/boot/grub/" || die
"failed to copy $STAGE2"
48 echo "$STAGE2 does not exist, is not a file, or is not readable. Attempting to download it."
49 wget
"http://xlq-experiment.com/marionette/res/stage2_eltorito" -O "$CDDIR/boot/grub/stage2_eltorito" \
50 || die
"$STAGE2 does not exist, and I couldn't download it."
54 # install a file into the CD image
56 [ -f "$1" ] || die
"$1 does not exist. Maybe you forgot to build it?"
57 cp -v "$1" "$CDDIR/boot/" || die
"could not install $1"
67 cat > "$CDDIR/boot/grub/menu.lst" << EOF
72 kernel /boot/kernel.elf
73 module /boot/testmodule.ko
75 title Boot from hard disk
79 mkisofs
-R -b boot
/grub
/stage2_eltorito
-no-emul-boot -boot-load-size 4 \
80 -boot-info-table -A "Marionette CD" -o "$OUTPUT" "$CDDIR" \
81 || die
"failed to create the CD image"
83 echo "Your CD image ($OUTPUT) awaits."