Add memtest support.
[syslinux-debian/hramrach.git] / gpxe / src / util / genliso
blob1f1c1168bb3650980d3e27105b78591542d93058
1 #!/bin/bash
3 # Generate a legacy floppy emulation ISO boot image
5 # genliso foo.liso foo.lkrn bar.lkrn ...
7 # The .liso image filename is the first argument followed by
8 # a list of .lkrn images include in .liso image
10 case $# in
11 0|1)
12 echo Usage: $0 foo.liso foo.lkrn ...
13 exit 1
15 esac
17 case "`mtools -V`" in
18 Mtools\ version\ 3.9.9*|Mtools\ version\ 3.9.1[0-9]*|[mM]tools\ *\ [4-9].*)
21 echo Mtools version 3.9.9 or later is required
22 exit 1
24 esac
26 out=$1
27 shift
29 dir=`mktemp -d bin/liso.dir.XXXXXX`
31 img=$dir/boot.img
32 mformat -f 1440 -C -i $img ::
34 cfg=$dir/syslinux.cfg
35 cat > $cfg <<EOF
36 # These default options can be changed in the genliso script
37 SAY gPXE ISO boot image generated by genliso
38 TIMEOUT 30
39 EOF
41 first=
42 for f
44 if [ ! -r $f ]
45 then
46 echo $f does not exist, skipping 1>&2
47 continue
49 # shorten name for 8.3 filesystem
50 b=$(basename $f)
51 g=${b%.lkrn}
52 g=${g//[^a-z0-9]}
53 g=${g:0:8}.krn
54 case "$first" in
55 "")
56 echo DEFAULT $g
58 esac
59 first=$g
60 echo LABEL $b
61 echo "" KERNEL $g
62 mcopy -m -i $img $f ::$g
63 done >> $cfg
65 mcopy -i $img $cfg ::syslinux.cfg
67 if ! syslinux $img
68 then
69 exit 1
72 mkisofs -q -o $out -c boot.cat -b boot.img $dir
74 rm -fr $dir