From c037cc75169a2baad0e59f2e0ea9abb015e81a91 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Tue, 25 Dec 2012 17:20:33 +0100 Subject: [PATCH] [scripts] copy the whole UEFI GRUB2 stuff to the EFI Boot Partition image to make isohybrid happy --- scripts/make_grub_efi.sh | 48 +++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/scripts/make_grub_efi.sh b/scripts/make_grub_efi.sh index bdd6809..5b32f9a 100755 --- a/scripts/make_grub_efi.sh +++ b/scripts/make_grub_efi.sh @@ -93,24 +93,6 @@ if [ -f "${efi_x86_64_file}" ]; then mv "${grub_efi_file}.signed" "${grub_efi_file}" || exit 1 fi -# now the tricky part, create an eltorito alternative image -_efi_img="${GRUB_BOOT_DIR}"/efi.img -# 3 floppies = 2880 x 3, we need more space for SecureBoot stuff -dd bs=512 count=$((2880 * 3)) if=/dev/zero of="${_efi_img}" || exit 1 -mkfs.msdos "${_efi_img}" || exit 1 - -tmp_dir=$(mktemp -d --suffix="make_grub_efi") -[[ -z "${tmp_dir}" ]] && exit 1 -MOUNT_DIRS+=( "${tmp_dir}" ) -mount -o loop "${_efi_img}" "${tmp_dir}" || exit 1 -mkdir -p "${tmp_dir}/efi/boot" || exit 1 - -if [ -f "${efi_x86_64_file}" ]; then - cp -Rp "${EFI_BOOT_DIR}"/* "${tmp_dir}/efi/boot"/ || exit 1 -fi -umount "${tmp_dir}" || exit 1 -rmdir "${tmp_dir}" # best effort - # These must exist. cp "${CHROOT_DIR}/usr/share/grub/unicode.pf2" "${GRUB_BOOT_DIR}"/ || exit 1 @@ -125,3 +107,33 @@ done # Copy splash, this is in sabayon-artwork-grub, we expect to find it cp "${CHROOT_DIR}/usr/share/grub/default-splash.png" "${GRUB_BOOT_DIR}"/ \ || exit 1 + +# now the tricky part, create an eltorito alternative image +_efi_img="${GRUB_BOOT_DIR}"/efi.img +# 12 floppies = 2880 x 12, we need more space for SecureBoot and GRUB2 +# stuff to make isohybrid work as expected. +dd bs=512 count=$((2880 * 12)) if=/dev/zero of="${_efi_img}" || exit 1 +mkfs.msdos "${_efi_img}" || exit 1 + +tmp_dir=$(mktemp -d --suffix="make_grub_efi") +[[ -z "${tmp_dir}" ]] && exit 1 +MOUNT_DIRS+=( "${tmp_dir}" ) +mount -o loop "${_efi_img}" "${tmp_dir}" || exit 1 +mkdir -p "${tmp_dir}/efi/boot" || exit 1 + +# copy our .efi executables in place +cp -Rp "${EFI_BOOT_DIR}"/* "${tmp_dir}/efi/boot/" || exit 1 + +# in order to make isohybrid work, we need to copy the grub +# stuff inside the EFI boot image +tmp_grub_dir="${tmp_dir}/boot/grub" +mkdir -p "${tmp_grub_dir}" || exit 1 +cp "${GRUB_BOOT_DIR}/grub.cfg" "${tmp_grub_dir}/" || exit 1 +cp "${GRUB_BOOT_DIR}/unicode.pf2" "${tmp_grub_dir}/" || exit 1 +cp "${GRUB_BOOT_DIR}/default-splash.png" "${tmp_grub_dir}/" || exit 1 +cp -Rp "${GRUB_BOOT_DIR}/locale" "${tmp_grub_dir}/" || exit 1 +cp -Rp "${GRUB_BOOT_DIR}/"*-efi "${tmp_grub_dir}/" || exit 1 + +umount "${tmp_dir}" || exit 1 +rmdir "${tmp_dir}" # best effort +exit 0