]> git.proxmox.com Git - grub2.git/commitdiff
2009-11-14 Robert Millan <rmh.grub@aybabtu.com>
authorRobert Millan <rmh@aybabtu.com>
Sat, 14 Nov 2009 18:38:11 +0000 (18:38 +0000)
committerRobert Millan <rmh@aybabtu.com>
Sat, 14 Nov 2009 18:38:11 +0000 (18:38 +0000)
        * conf/i386-coreboot.rmk (grub_mkrescue_SOURCES): Replace
        `util/i386/coreboot/grub-mkrescue.in' with `util/grub-mkrescue.in'.
        * conf/i386-pc.rmk (grub_mkrescue_SOURCES): Replace
        `util/i386/pc/grub-mkrescue.in' with `util/grub-mkrescue.in'.
        (bin_SCRIPTS): Add `grub-mkfloppy'.
        (grub_mkfloppy_SOURCES): New variable.

        * util/grub-mkrescue.in: New file.
        * util/i386/pc/grub-mkfloppy.in: New file.

        * util/i386/coreboot/grub-mkrescue.in: Remove.
        * util/i386/pc/grub-mkrescue.in: Remove.

ChangeLog
conf/i386-coreboot.rmk
conf/i386-pc.rmk
util/grub-mkrescue.in [new file with mode: 0644]
util/i386/coreboot/grub-mkrescue.in [deleted file]
util/i386/pc/grub-mkfloppy.in [new file with mode: 0644]
util/i386/pc/grub-mkrescue.in [deleted file]

index 487c0f3efe33e61eeebb74ca3c803778e060b0b9..04ff39c84fb80594817d08a0675b07c3790f4fb9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2009-11-14  Robert Millan  <rmh.grub@aybabtu.com>
+
+       * conf/i386-coreboot.rmk (grub_mkrescue_SOURCES): Replace
+       `util/i386/coreboot/grub-mkrescue.in' with `util/grub-mkrescue.in'.
+       * conf/i386-pc.rmk (grub_mkrescue_SOURCES): Replace
+       `util/i386/pc/grub-mkrescue.in' with `util/grub-mkrescue.in'.
+       (bin_SCRIPTS): Add `grub-mkfloppy'.
+       (grub_mkfloppy_SOURCES): New variable.
+
+       * util/grub-mkrescue.in: New file.
+       * util/i386/pc/grub-mkfloppy.in: New file.
+
+       * util/i386/coreboot/grub-mkrescue.in: Remove.
+       * util/i386/pc/grub-mkrescue.in: Remove.
+
 2009-11-13  Robert Millan  <rmh.grub@aybabtu.com>
 
        * include/grub/multiboot.h (struct grub_multiboot_header): Move
index b65833776897e3f05d8f07c8da98239ddb09b665..9a60db785a7c9c44f35041e875f9d74d74759dfa 100644 (file)
@@ -153,7 +153,7 @@ sbin_SCRIPTS += grub-install
 grub_install_SOURCES = util/grub-install.in
 
 bin_SCRIPTS += grub-mkrescue
-grub_mkrescue_SOURCES = util/i386/coreboot/grub-mkrescue.in
+grub_mkrescue_SOURCES = util/grub-mkrescue.in
 
 # Modules.
 pkglib_MODULES = linux.mod multiboot.mod               \
index 74b88f0df7edd9448ace97e0ba55bbb6e566c5b4..a3aae6bad394b9c6cbcfae630799a9eb569298ea 100644 (file)
@@ -168,15 +168,14 @@ grub_emu_SOURCES += disk/usbms.c util/usb.c bus/usb/usb.c \
 grub_emu_LDFLAGS += $(LIBCURSES) $(LIBUSB)
 endif
 
-# Scripts.
-sbin_SCRIPTS = grub-install
-bin_SCRIPTS = grub-mkrescue
-
-# For grub-install.
+sbin_SCRIPTS += grub-install
 grub_install_SOURCES = util/grub-install.in
 
-# For grub-mkrescue.
-grub_mkrescue_SOURCES = util/i386/pc/grub-mkrescue.in
+bin_SCRIPTS += grub-mkrescue
+grub_mkrescue_SOURCES = util/grub-mkrescue.in
+
+bin_SCRIPTS += grub-mkfloppy
+grub_mkfloppy_SOURCES = util/i386/pc/grub-mkfloppy.in
 
 pkglib_MODULES = biosdisk.mod chain.mod \
        multiboot.mod reboot.mod halt.mod       \
diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in
new file mode 100644 (file)
index 0000000..5db287a
--- /dev/null
@@ -0,0 +1,151 @@
+#! /bin/sh -e
+
+# Make GRUB rescue image
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009  Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+
+# Initialize some variables.
+transform="@program_transform_name@"
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+bindir=@bindir@
+libdir=@libdir@
+PACKAGE_NAME=@PACKAGE_NAME@
+PACKAGE_TARNAME=@PACKAGE_TARNAME@
+PACKAGE_VERSION=@PACKAGE_VERSION@
+target_cpu=@target_cpu@
+
+coreboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-coreboot
+pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-pc
+grub_mkisofs="grub-mkisofs"
+
+# Usage: usage
+# Print the usage.
+usage () {
+    cat <<EOF
+Usage: $0 [OPTION] SOURCE...
+Make GRUB rescue image.
+
+  -h, --help              print this message and exit
+  -v, --version           print the version information and exit
+  --modules=MODULES       pre-load specified modules MODULES
+  --output=FILE           save output in FILE
+
+$0 generates a bootable rescue image with specified source files or directories.
+
+Report bugs to <bug-grub@gnu.org>.
+EOF
+}
+
+# Check the arguments.
+for option in "$@"; do
+    case "$option" in
+    -h | --help)
+       usage
+       exit 0 ;;
+    -v | --version)
+       echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
+       exit 0 ;;
+    --modules=*)
+       modules=`echo "$option" | sed 's/--modules=//'` ;;
+    --output=*)
+       output_image=`echo "$option" | sed 's/--output=//'` ;;
+    -*)
+       echo "Unrecognized option \`$option'" 1>&2
+       usage
+       exit 1
+       ;;
+    *)
+       source="${source} ${option}" ;;
+    esac
+done
+
+iso9660_dir=`mktemp -d`
+mkdir -p ${iso9660_dir}/boot/grub
+
+for platform in pc coreboot ; do
+    input_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-${platform}
+    if test -e ${input_dir} ; then
+        mkdir -p ${iso9660_dir}/boot/grub/${target_cpu}-${platform}
+        for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \
+            ${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
+            ${input_dir}/handler.lst ${input_dir}/parttool.lst; do
+            if test -f "$file"; then
+                cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/
+            fi
+        done
+    fi
+done
+
+# build coreboot core.img
+if test -e ${coreboot_dir} ; then
+    memdisk_img=`mktemp`
+    memdisk_dir=`mktemp -d`
+    mkdir -p ${memdisk_dir}/boot/grub
+    # obtain date-based UUID
+    iso_uuid=$(date +%Y-%m-%d-%H-%M-%S-00)
+
+    modules="$(cat ${coreboot_dir}/partmap.lst) ${modules}"
+    cat << EOF > ${memdisk_dir}/boot/grub/grub.cfg
+search --fs-uuid --set ${iso_uuid}
+set prefix=(\${root})/boot/grub/${target_cpu}-coreboot
+EOF
+    (for i in ${modules} ; do
+        echo "insmod $i"
+    done ; \
+    echo "source /boot/grub/grub.cfg") \
+    > ${iso9660_dir}/boot/grub/i386-pc/grub.cfg
+
+    tar -C ${memdisk_dir} -cf ${memdisk_img} boot
+    rm -rf ${memdisk_dir}
+    grub-mkelfimage -d ${coreboot_dir}/ -m ${memdisk_img} -o ${iso9660_dir}/boot/multiboot.img \
+        memdisk tar search iso9660 configfile sh \
+        ata at_keyboard
+    rm -f ${memdisk_img}
+    grub_mkisofs="${grub_mkisofs} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)"
+fi
+
+if [ "${source}" != "" ] ; then
+    for d in ${source}; do
+      echo "Processing $d"
+      cp -dpRl "${d}" ${iso9660_dir}/
+    done
+fi
+
+# build eltorito core.img
+if test -e ${pc_dir} ; then
+    core_img=`mktemp`
+    grub-mkimage -d ${pc_dir}/ -o ${core_img} --prefix=/boot/grub/i386-pc \
+        memdisk tar search iso9660 configfile sh \
+        biosdisk
+    cat ${pc_dir}/cdboot.img ${core_img} > ${iso9660_dir}/boot/grub/i386-pc/eltorito.img
+    rm -f ${core_img}
+
+    modules="$(cat ${pc_dir}/partmap.lst) ${modules}"
+    (for i in ${modules} ; do
+        echo "insmod $i"
+    done ; \
+    echo "source /boot/grub/grub.cfg") \
+    > ${iso9660_dir}/boot/grub/i386-pc/grub.cfg
+
+    grub_mkisofs="${grub_mkisofs} -b boot/grub/i386-pc/eltorito.img -boot-info-table"
+fi
+
+# build iso image
+${grub_mkisofs} -o ${output_image} -r -J ${iso9660_dir}
+rm -rf ${iso9660_dir}
+
+exit 0
diff --git a/util/i386/coreboot/grub-mkrescue.in b/util/i386/coreboot/grub-mkrescue.in
deleted file mode 100644 (file)
index 6731e74..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-#! /bin/sh -e
-
-# Make GRUB rescue image
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009  Free Software Foundation, Inc.
-#
-# GRUB is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# GRUB is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
-
-# Initialize some variables.
-transform="@program_transform_name@"
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-bindir=@bindir@
-libdir=@libdir@
-PACKAGE_NAME=@PACKAGE_NAME@
-PACKAGE_TARNAME=@PACKAGE_TARNAME@
-PACKAGE_VERSION=@PACKAGE_VERSION@
-target_cpu=@target_cpu@
-platform=@platform@
-pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
-
-grub_mkimage=${bindir}/`echo grub-mkelfimage | sed ${transform}`
-grub_mkisofs=${bindir}/`echo grub-mkisofs | sed ${transform}`
-
-# Usage: usage
-# Print the usage.
-usage () {
-    cat <<EOF
-Usage: $0 [OPTION] output_image
-Make GRUB rescue image.
-
-  -h, --help              print this message and exit
-  -v, --version           print the version information and exit
-  --modules=MODULES       pre-load specified modules MODULES
-  --overlay=DIR           overlay directory DIR in the memdisk image
-                          (may be specified multiple times)
-  --pkglibdir=DIR         use images from directory DIR instead of ${pkglibdir}
-  --grub-mkimage=FILE     use FILE as grub-mkimage
-  --grub-mkisofs=FILE     use FILE as grub-mkisofs
-
-$0 generates a bootable rescue image.
-
-Report bugs to <bug-grub@gnu.org>.
-EOF
-}
-
-input_dir=${pkglibdir}
-
-# Check the arguments.
-for option in "$@"; do
-    case "$option" in
-    -h | --help)
-       usage
-       exit 0 ;;
-    -v | --version)
-       echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
-       exit 0 ;;
-    --modules=*)
-       modules=`echo "$option" | sed 's/--modules=//'` ;;
-    --overlay=*)
-       overlay=${overlay}${overlay:+ }`echo "$option" | sed 's/--overlay=//'` ;;
-    --pkglibdir=*)
-       input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;;
-    --grub-mkimage=*)
-       grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
-    --grub-mkisofs=*)
-       grub_mkisofs=`echo "$option" | sed 's/--grub-mkisofs=//'` ;;
-    -*)
-       echo "Unrecognized option \`$option'" 1>&2
-       usage
-       exit 1
-       ;;
-    *)
-       if test "x$output_image" != x; then
-           echo "Unrecognized option \`$option'" 1>&2
-           usage
-           exit 1
-       fi
-       output_image="${option}" ;;
-    esac
-done
-
-if test "x$output_image" = x; then
-  usage
-  exit 1
-fi
-
-memdisk_dir=`mktemp -d`
-iso9660_dir=`mktemp -d`
-mkdir -p ${memdisk_dir}/boot/grub ${iso9660_dir}/boot/grub
-
-for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \
-  ${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
-  ${input_dir}/handler.lst ${input_dir}/parttool.lst; do
-  if test -f "$file"; then
-    cp -f "$file" ${iso9660_dir}/boot/grub/
-  fi
-done
-
-# obtain date-based UUID
-iso_uuid=$(date +%Y-%m-%d-%H-%M-%S-00)
-
-# first-stage grub.cfg
-cat << EOF >> ${memdisk_dir}/boot/grub/grub.cfg
-search --fs-uuid --set ${iso_uuid}
-set prefix=(\${root})/boot/grub
-source /boot/grub/grub.cfg
-EOF
-
-# build memdisk
-memdisk_img=`mktemp`
-tar -C ${memdisk_dir} -cf ${memdisk_img} boot
-rm -rf ${memdisk_dir}
-
-# build core.img
-mkdir -p ${iso9660_dir}/boot/grub
-${grub_mkimage} -d ${input_dir}/ -m ${memdisk_img} -o ${iso9660_dir}/boot/multiboot.img \
-  at_keyboard memdisk tar ata search iso9660 configfile sh
-rm -f ${memdisk_img}
-
-for d in ${overlay}; do
-  echo "Overlaying $d"
-  cp -dpR "${d}"/* "${iso9660_dir}"/
-done
-
-# second-stage grub.cfg
-modules="`cat ${input_dir}/partmap.lst` ${modules}"
-for i in ${modules} ; do
-  echo "insmod $i"
-done > ${iso9660_dir}/boot/grub/grub.cfg
-
-# build iso image
-${grub_mkisofs} \
-  --modification-date=$(echo ${iso_uuid} | sed -e s/-//g) \
-  -o ${output_image} -r -J ${iso9660_dir}
-
-exit 0
diff --git a/util/i386/pc/grub-mkfloppy.in b/util/i386/pc/grub-mkfloppy.in
new file mode 100644 (file)
index 0000000..3b55186
--- /dev/null
@@ -0,0 +1,116 @@
+#! /bin/sh -e
+
+# Make GRUB rescue floppy
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008  Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+
+# Initialize some variables.
+transform="@program_transform_name@"
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+bindir=@bindir@
+libdir=@libdir@
+PACKAGE_NAME=@PACKAGE_NAME@
+PACKAGE_TARNAME=@PACKAGE_TARNAME@
+PACKAGE_VERSION=@PACKAGE_VERSION@
+target_cpu=@target_cpu@
+platform=@platform@
+pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
+
+# Usage: usage
+# Print the usage.
+usage () {
+    cat <<EOF
+Usage: $0 [OPTION] output_image
+Make GRUB rescue floppy.
+
+  -h, --help              print this message and exit
+  -v, --version           print the version information and exit
+  --modules=MODULES       pre-load specified modules MODULES
+  --output=FILE           save output in FILE
+
+$0 generates a bootable rescue floppy.
+
+Report bugs to <bug-grub@gnu.org>.
+EOF
+}
+
+input_dir=${pkglibdir}
+
+# Check the arguments.
+for option in "$@"; do
+    case "$option" in
+    -h | --help)
+       usage
+       exit 0 ;;
+    -v | --version)
+       echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
+       exit 0 ;;
+    --modules=*)
+       modules=`echo "$option" | sed 's/--modules=//'` ;;
+    --output=*)
+       output_image=`echo "$option" | sed 's/--output=//'` ;;
+    -*)
+       echo "Unrecognized option \`$option'" 1>&2
+       usage
+       exit 1
+       ;;
+    *)
+       if test "x$output_image" != x; then
+           echo "Unrecognized option \`$option'" 1>&2
+           usage
+           exit 1
+       fi
+       output_image="${option}" ;;
+    esac
+done
+
+if test "x$output_image" = x; then
+  usage
+  exit 1
+fi
+
+aux_dir=`mktemp -d`
+mkdir -p ${aux_dir}/boot/grub
+
+for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \
+  ${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
+  ${input_dir}/handler.lst ${input_dir}/parttool.lst; do
+  if test -f "$file"; then
+    cp -f "$file" ${aux_dir}/boot/grub/
+  fi
+done
+
+modules="$(cat ${input_dir}/partmap.lst) ${modules}"
+for i in ${modules} ; do
+  echo "insmod $i"
+done > ${aux_dir}/boot/grub/grub.cfg
+
+# build memdisk
+memdisk_img=`mktemp`
+tar -C ${aux_dir} -cf ${memdisk_img} boot
+rm -rf ${aux_dir}
+
+# build core.img
+core_img=`mktemp`
+grub-mkimage -d ${input_dir}/ -m ${memdisk_img} -o ${core_img} memdisk tar biosdisk
+rm -f ${memdisk_img}
+
+# build floppy image
+cat ${input_dir}/boot.img ${core_img} /dev/zero | dd bs=1024 count=1440 > ${output_image}
+rm -f ${core_img}
+
+exit 0
diff --git a/util/i386/pc/grub-mkrescue.in b/util/i386/pc/grub-mkrescue.in
deleted file mode 100644 (file)
index cc581bf..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-#! /bin/sh -e
-
-# Make GRUB rescue image
-# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008  Free Software Foundation, Inc.
-#
-# GRUB is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# GRUB is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
-
-# Initialize some variables.
-transform="@program_transform_name@"
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-bindir=@bindir@
-libdir=@libdir@
-PACKAGE_NAME=@PACKAGE_NAME@
-PACKAGE_TARNAME=@PACKAGE_TARNAME@
-PACKAGE_VERSION=@PACKAGE_VERSION@
-target_cpu=@target_cpu@
-platform=@platform@
-pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
-
-grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
-
-# Usage: usage
-# Print the usage.
-usage () {
-    cat <<EOF
-Usage: $0 [OPTION] output_image
-Make GRUB rescue image.
-
-  -h, --help              print this message and exit
-  -v, --version           print the version information and exit
-  --modules=MODULES       pre-load specified modules MODULES
-  --overlay=DIR           overlay directory DIR in the memdisk image
-                          (may be specified multiple times)
-  --pkglibdir=DIR         use images from directory DIR instead of ${pkglibdir}
-  --grub-mkimage=FILE     use FILE as grub-mkimage
-  --image-type=TYPE       select floppy or cdrom (default)
-  --emulation=TYPE        select El Torito boot emulation type floppy
-                          or none (default) (cdrom only)
-
-$0 generates a bootable rescue image of the specified type.
-
-Report bugs to <bug-grub@gnu.org>.
-EOF
-}
-
-image_type=cdrom
-input_dir=${pkglibdir}
-emulation=none
-
-# Check the arguments.
-for option in "$@"; do
-    case "$option" in
-    -h | --help)
-       usage
-       exit 0 ;;
-    -v | --version)
-       echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
-       exit 0 ;;
-    --modules=*)
-       modules=`echo "$option" | sed 's/--modules=//'` ;;
-    --overlay=*)
-       overlay=${overlay}${overlay:+ }`echo "$option" | sed 's/--overlay=//'` ;;
-    --pkglibdir=*)
-       input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;;
-    --grub-mkimage=*)
-       grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
-    --image-type=*)
-       image_type=`echo "$option" | sed 's/--image-type=//'`
-        case "$image_type" in
-          floppy|cdrom) ;;
-          *)
-            echo "Unknown image type \`$image_type'" 1>&2
-            exit 1 ;;
-        esac ;;
-    --emulation=*)
-       emulation=`echo "$option" | sed 's/--emulation=//'`
-        case "$emulation" in
-          floppy|none) ;;
-          *)
-            echo "Unknown emulation type \`$emulation'" 1>&2
-            exit 1 ;;
-        esac ;;
-    -*)
-       echo "Unrecognized option \`$option'" 1>&2
-       usage
-       exit 1
-       ;;
-    *)
-       if test "x$output_image" != x; then
-           echo "Unrecognized option \`$option'" 1>&2
-           usage
-           exit 1
-       fi
-       output_image="${option}" ;;
-    esac
-done
-
-if test "x$output_image" = x; then
-  usage
-  exit 1
-fi
-
-aux_dir=`mktemp -d`
-mkdir -p ${aux_dir}/boot/grub
-
-for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \
-  ${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
-  ${input_dir}/handler.lst ${input_dir}/parttool.lst; do
-  if test -f "$file"; then
-    cp -f "$file" ${aux_dir}/boot/grub/
-  fi
-done
-
-modules="biosdisk `cat ${input_dir}/partmap.lst` ${modules}"
-for i in ${modules} ; do
-  echo "insmod $i"
-done > ${aux_dir}/boot/grub/grub.cfg
-
-for d in ${overlay}; do
-  echo "Overlaying $d"
-  cp -dpR "${d}"/* "${aux_dir}"/
-done
-
-if [ "x${image_type}" = xfloppy -o "x${emulation}" = xfloppy ] ; then
-  # build memdisk
-  memdisk_img=`mktemp`
-  tar -C ${aux_dir} -cf ${memdisk_img} boot
-  rm -rf ${aux_dir}
-
-  # build core.img
-  core_img=`mktemp`
-  ${grub_mkimage} -d ${input_dir}/ -m ${memdisk_img} -o ${core_img} memdisk tar
-  rm -f ${memdisk_img}
-
-  # build floppy image
-  if [ "x${image_type}" = xcdrom ] ; then
-    floppy_dir=`mktemp -d`
-    floppy_img=${floppy_dir}/grub_floppy.img
-  else
-    floppy_img=${output_image}
-  fi
-  cat ${input_dir}/boot.img ${core_img} /dev/zero | dd bs=1024 count=1440 > ${floppy_img}
-  rm -f ${core_img}
-
-  if [ "x${image_type}" = xcdrom ] ; then
-    # build iso image
-    genisoimage -b grub_floppy.img \
-      -o ${output_image} -r -J ${floppy_dir}
-    rm -rf ${floppy_dir}
-  fi
-else
-  # build core.img
-  core_img=`mktemp`
-  ${grub_mkimage} -d ${input_dir}/ -o ${core_img} biosdisk iso9660
-
-  # build grub_eltorito image
-  cat ${input_dir}/cdboot.img ${core_img} > ${aux_dir}/boot/grub/grub_eltorito
-  rm -f ${core_img}
-
-  # build iso image
-  genisoimage -b boot/grub/grub_eltorito \
-    -no-emul-boot -boot-load-size 4 -boot-info-table \
-    -o ${output_image} -r -J ${aux_dir}
-  rm -rf ${aux_dir}
-fi
-
-exit 0