3 # Generate a isolinux ISO boot image
6 echo "usage: ${0} [OPTIONS] foo.lkrn [bar.lkrn,...]"
8 echo "where OPTIONS are:"
9 echo " -h show this help"
10 echo " -l build legacy image with floppy emulation"
11 echo " -o FILE save iso image to file"
17 while getopts "hlo:" opt; do
34 if [ -z "${OUT}" ]; then
35 echo "${0}: no output file given" >&2
40 # There should either be mkisofs or the compatible genisoimage program
41 for command in genisoimage mkisofs; do
42 if ${command} --version >/dev/null 2>/dev/null; then
48 if [ -z "${mkisofs}" ]; then
49 echo "${0}: mkisofs or genisoimage not found, please install or set PATH" >&2
53 dir=$(mktemp -d bin/iso.dir.XXXXXX)
54 cfg=${dir}/isolinux.cfg
56 mkisofs+=(-quiet -l -volid "iPXE" -preparer "iPXE build system"
57 -appid "iPXE ${VERSION} - Open Source Network Boot Firmware"
58 -publisher "http://ipxe.org/" -c boot.cat)
62 # These default options can be changed in the geniso script
63 SAY iPXE ISO boot image
67 if [ ! -r ${f} ]; then
68 echo "${f} does not exist, skipping" >&2
89 case "$(mtools -V)" in
90 Mtools\ version\ 3.9.9*|Mtools\ version\ 3.9.1[0-9]*|[mM]tools\ *\ [4-9].*)
93 echo "Mtools version 3.9.9 or later is required" >&2
98 # generate floppy image
100 mformat -f 1440 -C -i ${img} ::
102 # copy lkrn file to floppy image
103 for f in ${dir}/*.krn; do
104 mcopy -m -i ${img} ${f} ::$(basename ${g})
108 # copy config file to floppy image
109 mcopy -i ${img} ${cfg} ::syslinux.cfg
112 # write syslinux bootloader to floppy image
113 if ! syslinux ${img}; then
114 echo "${0}: failed writing syslinux to floppy image ${img}" >&2
118 # generate the iso image
119 "${mkisofs[@]}" -b boot.img -output ${OUT} ${dir}
122 # copy isolinux bootloader
123 cp ${ISOLINUX_BIN} ${dir}
125 # syslinux 6.x needs a file called ldlinux.c32
126 LDLINUX_C32=$(dirname ${ISOLINUX_BIN})/ldlinux.c32
127 if [ -s ${LDLINUX_C32} ]; then
128 cp ${LDLINUX_C32} ${dir}
131 # generate the iso image
132 "${mkisofs[@]}" -b isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -output ${OUT} ${dir}
134 # isohybrid will be used if available
135 if isohybrid --version >/dev/null 2>/dev/null; then
136 isohybrid ${OUT} >/dev/null
141 # clean up temporary dir