Home | History | Annotate | Download | only in util
      1 #!/bin/bash
      2 #
      3 # Generate a isolinux ISO boot image
      4 #
      5 # geniso foo.iso foo.lkrn
      6 #
      7 # the ISO image is the first argument so that a list of .lkrn images
      8 # to include can be specified
      9 #
     10 case $# in
     11 0|1)
     12 	echo Usage: $0 foo.iso foo.lkrn ...
     13 	exit 1
     14 	;;
     15 esac
     16 # This should be the default location of the isolinux.bin file
     17 isolinux_bin=${ISOLINUX_BIN:-util/isolinux.bin}
     18 if [ ! -r $isolinux_bin ]
     19 then
     20 	echo $0: $isolinux_bin not found, please install, or set ISOLINUX_BIN in arch/i386/Makefile correctly
     21 	exit 1
     22 fi
     23 out=$1
     24 shift
     25 dir=`mktemp -d bin/iso.dir.XXXXXX`
     26 cfg=$dir/isolinux.cfg
     27 cp -p $isolinux_bin $dir
     28 cat > $cfg <<EOF
     29 # These default options can be changed in the geniso script
     30 SAY Etherboot ISO boot image generated by geniso
     31 TIMEOUT 30
     32 EOF
     33 first=
     34 for f
     35 do
     36 	if [ ! -r $f ]
     37 	then
     38 		echo $f does not exist, skipping 1>&2
     39 		continue
     40 	fi
     41 	b=$(basename $f)
     42 	g=${b%.lkrn}
     43 	g=${g//[^a-z0-9]}.krn
     44 	case "$first" in
     45 	"")
     46 		echo DEFAULT $g
     47 		;;
     48 	esac
     49 	first=$g
     50 	echo LABEL $b
     51 	echo "" KERNEL $g
     52 	cp -p $f $dir/$g
     53 done >> $cfg
     54 mkisofs -q -l -o $out -c boot.cat -b isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table $dir
     55 rm -fr $dir
     56