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#
10case $# in
110|1)
12	echo Usage: $0 foo.iso foo.lkrn ...
13	exit 1
14	;;
15esac
16# This should be the default location of the isolinux.bin file
17isolinux_bin=${ISOLINUX_BIN:-util/isolinux.bin}
18if [ ! -r $isolinux_bin ]
19then
20	echo $0: $isolinux_bin not found, please install, or set ISOLINUX_BIN in arch/i386/Makefile correctly
21	exit 1
22fi
23out=$1
24shift
25dir=`mktemp -d bin/iso.dir.XXXXXX`
26cfg=$dir/isolinux.cfg
27cp -p $isolinux_bin $dir
28cat > $cfg <<EOF
29# These default options can be changed in the geniso script
30SAY Etherboot ISO boot image generated by geniso
31TIMEOUT 30
32EOF
33first=
34for f
35do
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
53done >> $cfg
54mkisofs -q -l -o $out -c boot.cat -b isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table $dir
55rm -fr $dir
56