[scripts] copy the whole UEFI GRUB2 stuff to the EFI Boot Partition image to make isohybrid happy

This commit is contained in:
Fabio Erculiani
2012-12-25 17:20:33 +01:00
parent 4ce7de0e5b
commit c037cc7516
+30 -18
View File
@@ -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