2005-03-08 18:53:11 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Generate a legacy floppy emulation ISO boot image
|
|
|
|
#
|
2007-07-06 12:04:06 +00:00
|
|
|
# genliso foo.liso foo.lkrn
|
2005-03-08 18:53:11 +00:00
|
|
|
#
|
2007-07-06 12:04:06 +00:00
|
|
|
# the ISO image is the first argument so that a list of .lkrn images
|
2005-03-08 18:53:11 +00:00
|
|
|
# to include can be specified
|
|
|
|
#
|
|
|
|
case $0 in
|
|
|
|
*genliso)
|
|
|
|
;;
|
|
|
|
*genfdimg)
|
|
|
|
genfdimg=1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
case $# in
|
|
|
|
0|1)
|
2007-07-06 12:04:06 +00:00
|
|
|
echo Usage: $0 foo.liso foo.lkrn ...
|
2005-03-08 18:53:11 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
case "`mtools -V`" in
|
2007-07-06 12:04:06 +00:00
|
|
|
Mtools\ version\ 3.9.9*|Mtools\ version\ 3.9.1[0-9]*|Mtools\ version\ 4.*)
|
2005-03-08 18:53:11 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo Mtools version 3.9.9 or later is required
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
out=$1
|
|
|
|
shift
|
|
|
|
dir=bin/liso.dir
|
|
|
|
mkdir -p $dir
|
|
|
|
case "$genfdimg" in
|
|
|
|
1)
|
|
|
|
img=$out
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
img=$dir/boot.img
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
mformat -f 1440 -C -i $img ::
|
|
|
|
cfg=bin/syslinux.cfg
|
|
|
|
cat > $cfg <<EOF
|
|
|
|
# These default options can be changed in the genliso script
|
|
|
|
SAY Etherboot ISO boot image generated by genliso
|
|
|
|
TIMEOUT 30
|
|
|
|
EOF
|
|
|
|
first=
|
|
|
|
for f
|
|
|
|
do
|
|
|
|
if [ ! -r $f ]
|
|
|
|
then
|
|
|
|
echo $f does not exist, skipping 1>&2
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
# shorten name for 8.3 filesystem
|
|
|
|
b=$(basename $f)
|
2007-07-06 12:04:06 +00:00
|
|
|
g=${b%.lkrn}
|
2005-03-08 18:53:11 +00:00
|
|
|
g=${g//[^a-z0-9]}
|
2007-07-06 12:04:06 +00:00
|
|
|
g=${g:0:8}.krn
|
2005-03-08 18:53:11 +00:00
|
|
|
case "$first" in
|
|
|
|
"")
|
|
|
|
echo DEFAULT $g
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
first=$g
|
|
|
|
echo LABEL $b
|
|
|
|
echo "" KERNEL $g
|
|
|
|
mcopy -m -i $img $f ::$g
|
|
|
|
done >> $cfg
|
|
|
|
mcopy -i $img $cfg ::syslinux.cfg
|
|
|
|
if ! syslinux $img
|
|
|
|
then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
case "$genfdimg" in
|
|
|
|
1)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
mkisofs -o $out -c boot.cat -b boot.img $dir
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
rm -fr $dir
|