1 #!/bin/bash 2 # 3 # Generate a legacy floppy emulation ISO boot image 4 # 5 # genliso foo.liso foo.lkrn bar.lkrn ... 6 # 7 # The .liso image filename is the first argument followed by 8 # a list of .lkrn images include in .liso image 9 10 case $# in 11 0|1) 12 echo Usage: $0 foo.liso foo.lkrn ... 13 exit 1 14 ;; 15 esac 16 17 case "`mtools -V`" in 18 Mtools\ version\ 3.9.9*|Mtools\ version\ 3.9.1[0-9]*|[mM]tools\ *\ [4-9].*) 19 ;; 20 *) 21 echo Mtools version 3.9.9 or later is required 22 exit 1 23 ;; 24 esac 25 26 out=$1 27 shift 28 29 dir=`mktemp -d bin/liso.dir.XXXXXX` 30 31 img=$dir/boot.img 32 mformat -f 1440 -C -i $img :: 33 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 40 41 first= 42 for f 43 do 44 if [ ! -r $f ] 45 then 46 echo $f does not exist, skipping 1>&2 47 continue 48 fi 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 57 ;; 58 esac 59 first=$g 60 echo LABEL $b 61 echo "" KERNEL $g 62 mcopy -m -i $img $f ::$g 63 done >> $cfg 64 65 mcopy -i $img $cfg ::syslinux.cfg 66 67 if ! syslinux $img 68 then 69 exit 1 70 fi 71 72 mkisofs -q -o $out -c boot.cat -b boot.img $dir 73 74 rm -fr $dir 75