# 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@
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+datarootdir="@datarootdir@"
+bindir="@bindir@"
+libdir="@libdir@"
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
-target_cpu=@target_cpu@
-native_platform=@platform@
pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst"
self=`basename $0`
-multiboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-multiboot
-coreboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-coreboot
-qemu_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-qemu
-pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-pc
-efi32_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-efi
-efi64_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/x86_64-efi
+multiboot_dir="${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-multiboot"
+coreboot_dir="${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-coreboot"
+qemu_dir="${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-qemu"
+pc_dir="${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-pc"
+efi32_dir="${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-efi"
+efi64_dir="${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/x86_64-efi"
rom_directory=
override_dir=
-grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
+grub_mkimage="${bindir}/`echo grub-mkimage | sed ${transform}`"
xorriso=xorriso
$self generates a bootable rescue image with specified source files, source
directories, or mkisofs options listed by: xorriso -as mkisofs -help
-Option -- switches to native xorriso command mode. or directories.
+
+Option -- switches to native xorriso command mode.
Report bugs to <bug-grub@gnu.org>.
Mail xorriso support requests to <bug-xorriso@gnu.org>.
--xorriso)
xorriso=`argument $option "$@"`; shift ;;
--xorriso=*)
- xorriso=`echo "${option}/" | sed 's/--xorriso=//'` ;;
+ xorriso=`echo "${option}" | sed 's/--xorriso=//'` ;;
*)
source="${source} ${option} $@"; break ;;
exit 1
fi
-if test "x$TMP" != x; then
- MKTEMP_TEMPLATE="$TMP/grub-mkrescue.XXXXXXXXXX"
-elif test "x$TEMP" != x; then
- MKTEMP_TEMPLATE="$TEMP/grub-mkrescue.XXXXXXXXXX"
-else
- MKTEMP_TEMPLATE="/tmp/grub-mkrescue.XXXXXXXXXX"
-fi
-
-iso9660_dir=`mktemp -d "$MKTEMP_TEMPLATE"`
+iso9660_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
mkdir -p ${iso9660_dir}/boot/grub
process_input_dir ()
input_dir="$1"
platform="$2"
mkdir -p ${iso9660_dir}/boot/grub/${platform}
- for file in ${input_dir}/*.mod; do
+ for file in "${input_dir}/"*.mod "${input_dir}/"efiemu32.o "${input_dir}/"efiemu64.o; do
if test -f "$file"; then
cp -f "$file" ${iso9660_dir}/boot/grub/${platform}/
fi
echo "Enabling $2 support ..."
- memdisk_img=`mktemp "$MKTEMP_TEMPLATE"`
- memdisk_dir=`mktemp -d "$MKTEMP_TEMPLATE"`
+ memdisk_img=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
+ memdisk_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
mkdir -p ${memdisk_dir}/boot/grub
cat << EOF > ${memdisk_dir}/boot/grub/grub.cfg
-search --fs-uuid --set ${iso_uuid}
+search --fs-uuid --set=root ${iso_uuid}
set prefix=(\${root})/boot/grub/${platform}
source \$prefix/grub.cfg
EOF
process_input_dir ${efi64_dir} x86_64-efi
fi
else
- process_input_dir ${override_dir} ${target_cpu}-${native_platform}
+ . "${override_dir}"/modinfo.sh
+ process_input_dir "${override_dir}" ${grub_modinfo_target_cpu}-${grub_modinfo_platform}
multiboot_dir=
pc_dir=
efi32_dir=
efi64_dir=
coreboot_dir=
qemu_dir=
- case "${target_cpu}-${native_platform}" in
+ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
i386-multiboot) multiboot_dir=${override_dir} ;;
i386-coreboot) coreboot_dir=${override_dir} ;;
i386-qemu) qemu_dir=${override_dir} ;;
# build BIOS core.img
if test -e "${pc_dir}" ; then
echo "Enabling BIOS support ..."
- core_img=`mktemp "$MKTEMP_TEMPLATE"`
+ core_img=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
$grub_mkimage -O i386-pc -d ${pc_dir}/ -o ${core_img} --prefix=/boot/grub/i386-pc \
iso9660 biosdisk
cat ${pc_dir}/cdboot.img ${core_img} > ${iso9660_dir}/boot/grub/i386-pc/eltorito.img
- embed_img=`mktemp "$MKTEMP_TEMPLATE"`
+ embed_img=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
cat ${pc_dir}/boot.img ${core_img} > ${embed_img}
rm -f ${core_img}
fi
# build multiboot core.img
-make_image "${multiboot_dir}" i386-multiboot "${iso9660_dir}/boot/multiboot.img" "ata at_keyboard"
+make_image "${multiboot_dir}" i386-multiboot "${iso9660_dir}/boot/multiboot.img" "pata ahci at_keyboard"
if test -e "${efi64_dir}" || test -e "${efi32_dir}"; then
- efi_dir=`mktemp -d "$MKTEMP_TEMPLATE"`
+ efi_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
mkdir -p "${efi_dir}/efi/boot"
# build bootx64.efi
make_image "${efi64_dir}" x86_64-efi "${efi_dir}"/efi/boot/bootx64.efi ""
# build bootia32.efi
make_image "${efi32_dir}" i386-efi "${efi_dir}"/efi/boot/bootia32.efi ""
+ if [ -e "${efi_dir}"/efi/boot/bootia32.efi ]; then
+ # For old macs. Suggested by Peter Jones.
+ cp "${efi_dir}"/efi/boot/bootia32.efi "${efi_dir}"/efi/boot/boot.efi
+ fi
mformat -C -f 2880 -L 16 -i "${iso9660_dir}"/efi.img ::
mcopy -s -i "${iso9660_dir}"/efi.img ${efi_dir}/efi ::/
grub_mkisofs_arguments="${grub_mkisofs_arguments} --efi-boot efi.img"
fi
-make_image "${qemu_dir}" i386-qemu "${iso9660_dir}/boot/qemu.img" "ata at_keyboard"
+make_image "${qemu_dir}" i386-qemu "${iso9660_dir}/boot/qemu.img" "pata at_keyboard"
if [ -e "${iso9660_dir}/boot/qemu.img" ] && [ -d "${rom_directory}" ]; then
cp "${iso9660_dir}/boot/qemu.img" "${rom_directory}/qemu.img"
fi
-make_image "${coreboot_dir}" i386-coreboot "${iso9660_dir}/boot/coreboot.elf" "ata at_keyboard"
+make_image "${coreboot_dir}" i386-coreboot "${iso9660_dir}/boot/coreboot.elf" "pata ahci at_keyboard"
if [ -e "${iso9660_dir}/boot/coreboot.elf" ] && [ -d "${rom_directory}" ]; then
cp "${iso9660_dir}/boot/coreboot.elf" "${rom_directory}/coreboot.elf"
fi