david/ipxe
Archived
1
0
This repository has been archived on 2020-12-06. You can view files and clone it, but cannot push or open issues or pull requests.
ipxe/src/util/genliso

76 lines
1.2 KiB
Plaintext
Raw Normal View History

2005-03-08 19:53:11 +01:00
#!/bin/bash
#
# Generate a legacy floppy emulation ISO boot image
#
# genliso foo.liso foo.lkrn bar.lkrn ...
2005-03-08 19:53:11 +01:00
#
# The .liso image filename is the first argument followed by
# a list of .lkrn images include in .liso image
2005-03-08 19:53:11 +01:00
case $# in
0|1)
echo Usage: $0 foo.liso foo.lkrn ...
2005-03-08 19:53:11 +01:00
exit 1
;;
esac
2005-03-08 19:53:11 +01:00
case "`mtools -V`" in
Mtools\ version\ 3.9.9*|Mtools\ version\ 3.9.1[0-9]*|Mtools\ version\ 4.*)
2005-03-08 19:53:11 +01:00
;;
*)
echo Mtools version 3.9.9 or later is required
exit 1
;;
esac
2005-03-08 19:53:11 +01:00
out=$1
shift
2005-03-08 19:53:11 +01:00
dir=bin/liso.dir
mkdir -p $dir
img=$dir/boot.img
2005-03-08 19:53:11 +01:00
mformat -f 1440 -C -i $img ::
2005-03-08 19:53:11 +01:00
cfg=bin/syslinux.cfg
cat > $cfg <<EOF
# These default options can be changed in the genliso script
SAY gPXE ISO boot image generated by genliso
2005-03-08 19:53:11 +01:00
TIMEOUT 30
EOF
2005-03-08 19:53:11 +01:00
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)
g=${b%.lkrn}
2005-03-08 19:53:11 +01:00
g=${g//[^a-z0-9]}
g=${g:0:8}.krn
2005-03-08 19:53:11 +01:00
case "$first" in
"")
echo DEFAULT $g
;;
esac
first=$g
echo LABEL $b
echo "" KERNEL $g
mcopy -m -i $img $f ::$g
done >> $cfg
2005-03-08 19:53:11 +01:00
mcopy -i $img $cfg ::syslinux.cfg
2005-03-08 19:53:11 +01:00
if ! syslinux $img
then
exit 1
fi
mkisofs -o $out -c boot.cat -b boot.img $dir
2005-03-08 19:53:11 +01:00
rm -fr $dir