From 4efbf69cd80d861c813f181a5e2bb73d4e190594 Mon Sep 17 00:00:00 2001 From: Christian Hofstaedtler Date: Wed, 21 Dec 2011 03:24:15 +0100 Subject: [PATCH] Use sane paths for intermediate EFI files This way we also don't remove them from the chroot *after* building the squashfs. --- etc/grml/fai/config/scripts/GRMLBASE/45-efi | 32 ++++++++++++++--------------- grml-live | 26 +++++++++++------------ 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/etc/grml/fai/config/scripts/GRMLBASE/45-efi b/etc/grml/fai/config/scripts/GRMLBASE/45-efi index 0711698..673ac6b 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/45-efi +++ b/etc/grml/fai/config/scripts/GRMLBASE/45-efi @@ -21,11 +21,11 @@ if ! [ -r "${target}"/usr/lib/grub/x86_64-efi/moddep.lst ] ; then exit 0 fi -GRUB_EFI_IMAGE="${target}/tmp/grub_efi_image" +BOOTX64="${target}/boot/bootx64.efi" +EFI_IMG="${target}/boot/efi.img" TMP_CONFIG="${target}/tmp/grub_config_efi" -EFI_IMAGE="${target}/tmp/efi_image" -rm -f "$GRUB_EFI_IMAGE" "$TMP_CONFIG" "$EFI_IMAGE" +rm -f "$BOOTX64" "$EFI_IMG" "$TMP_CONFIG" cat > "$TMP_CONFIG" <&2 exit 1 fi -SIZE=$(du -sk "${target}/${GRUB_EFI_IMAGE}" | awk -F" " '{print $1'}) +SIZE=$(du -sk "${target}/${BOOTX64}" | awk -F" " '{print $1'}) SIZE=$(((($SIZE / 32 )+2)*32)) -dd if=/dev/zero of="${target}/${EFI_IMAGE}" bs=1k count="$SIZE" 2>/dev/null -$ROOTCMD mkfs.vfat -n GRML "$EFI_IMAGE" >/dev/null -$ROOTCMD mmd -i "$EFI_IMAGE" ::EFI -$ROOTCMD mmd -i "$EFI_IMAGE" ::EFI/BOOT -$ROOTCMD mcopy -i "$EFI_IMAGE" "$GRUB_EFI_IMAGE" ::EFI/BOOT/bootx64.efi >/dev/null +dd if=/dev/zero of="${target}/${EFI_IMG}" bs=1k count="$SIZE" 2>/dev/null +$ROOTCMD mkfs.vfat -n GRML "$EFI_IMG" >/dev/null +$ROOTCMD mmd -i "$EFI_IMG" ::EFI +$ROOTCMD mmd -i "$EFI_IMG" ::EFI/BOOT +$ROOTCMD mcopy -i "$EFI_IMG" "$BOOTX64" ::EFI/BOOT/bootx64.efi >/dev/null rm -f "${target}/${TMP_CONFIG}" -mv "${target}/${EFI_IMAGE}" "${target}/var/lib/grml_live_efi.img" -mv "${target}/${GRUB_EFI_IMAGE}" "${target}/var/lib/grml_live_bootx64.efi" -echo "Generated EFI image ${target}/var/lib/grml_live_efi.img" -echo "Generated bootx64 image ${target}/var/lib/grml_live_bootx64.efi" +echo "Generated EFI image $BOOTX64" +echo "Generated bootx64 image $EFI_IMG" ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2 diff --git a/grml-live b/grml-live index 923c934..2fa42a8 100755 --- a/grml-live +++ b/grml-live @@ -1213,24 +1213,21 @@ else eindent if ! dpkg --compare-versions $(dpkg-query -W -f='${Version}\n' xorriso 2>/dev/null) gt-nl 1.1.6-1 ; then - log "Disabling (U)EFI boot support since xorriso version is not recent enough." - ewarn "Disabling (U)EFI boot support since xorriso version is not recent enough." ; eend 0 + log "Disabling (U)EFI boot support because xorriso version is too old." + ewarn "Disabling (U)EFI boot support because xorriso version is too old." ; eend 0 else - log "xorriso with -eltorito-alt-boot present, enabling (U)EFI boot support." - einfo "xorriso with -eltorito-alt-boot present, enabling (U)EFI boot support." ; eend 0 - - if [ -r "${CHROOT_OUTPUT}/var/lib/grml_live_efi.img" ] ; then - einfo "Found /var/lib/grml_live_efi.img - moving to /boot/efi.img for ISO." - log "Found /var/lib/grml_live_efi.img - moving to /boot/efi.img for ISO." - mv "${CHROOT_OUTPUT}/var/lib/grml_live_efi.img" "${BUILD_OUTPUT}/boot/efi.img" + if [ -r "${CHROOT_OUTPUT}/boot/efi.img" ] ; then + einfo "Found /boot/efi.img - using for ISO." + log "Found /boot/efi.img - using for ISO." + cp "${CHROOT_OUTPUT}/boot/efi.img" "${BUILD_OUTPUT}/boot/efi.img" eend $? fi - if [ -r "${CHROOT_OUTPUT}/var/lib/grml_live_bootx64.efi" ] ; then - einfo "Found /var/lib/grml_live_bootx64.efi - moving to /efi/boot/bootx64.efi for ISO" - log "Found /var/lib/grml_live_bootx64.efi - moving to /efi/boot/bootx64.efi for ISO" + if [ -r "${CHROOT_OUTPUT}/boot/bootx64.efi" ] ; then + einfo "Found /boot/bootx64.efi - using as /efi/boot/bootx64.efi for ISO." + log "Found /boot/bootx64.efi - using as /efi/boot/bootx64.efi for ISO." mkdir -p "${BUILD_OUTPUT}/efi/boot/" - mv "${CHROOT_OUTPUT}/var/lib/grml_live_bootx64.efi" "${BUILD_OUTPUT}/efi/boot/bootx64.efi" + cp "${CHROOT_OUTPUT}/boot/bootx64.efi" "${BUILD_OUTPUT}/efi/boot/bootx64.efi" eend $? fi @@ -1239,6 +1236,9 @@ else log "/boot/efi.img found and amd64 architecture present, extending boot arguments." BOOT_ARGS="$BOOT_ARGS -boot-info-table -eltorito-alt-boot -e boot/efi.img -no-emul-boot" eend $? + else + log "Disabling (U)EFI boot support because /boot/efi.img is missing." + ewarn "Disabling (U)EFI boot support because /boot/efi.img is missing." ; eend 0 fi fi -- 2.1.4