From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id BD9441382C5 for ; Mon, 5 Mar 2018 20:21:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D11C2E081E; Mon, 5 Mar 2018 20:21:40 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A1A56E081E for ; Mon, 5 Mar 2018 20:21:40 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 56F31335C05 for ; Mon, 5 Mar 2018 20:21:39 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 9E1E21ED for ; Mon, 5 Mar 2018 20:21:37 +0000 (UTC) From: "Richard Farina" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Richard Farina" Message-ID: <1520281219.ae7fbbf99102ced2ef6d67426c5240e8e29c8adf.zerochaos@gentoo> Subject: [gentoo-commits] proj/catalyst:master commit in: targets/support/ X-VCS-Repository: proj/catalyst X-VCS-Files: targets/support/create-iso.sh X-VCS-Directories: targets/support/ X-VCS-Committer: zerochaos X-VCS-Committer-Name: Richard Farina X-VCS-Revision: ae7fbbf99102ced2ef6d67426c5240e8e29c8adf X-VCS-Branch: master Date: Mon, 5 Mar 2018 20:21:37 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 624caa5c-6e2c-46ea-9d41-d4e0de0be768 X-Archives-Hash: 6fde76cb2627bff7c806f94187df4bac commit: ae7fbbf99102ced2ef6d67426c5240e8e29c8adf Author: Ben Kohler gmail com> AuthorDate: Mon Feb 19 17:19:47 2018 +0000 Commit: Richard Farina gentoo org> CommitDate: Mon Mar 5 20:20:19 2018 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=ae7fbbf9 create-iso.sh: rework UEFI support for amd64/x86 targets/support/create-iso.sh | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh index b7c4a7aa..7d0c4800 100755 --- a/targets/support/create-iso.sh +++ b/targets/support/create-iso.sh @@ -254,54 +254,69 @@ case ${clst_hostarch} in ;; x86|amd64) - if [ -e "${clst_target_path}/boot/elilo.efi" ] + # detect if an EFI bootloader is desired + if [ -d "${clst_target_path}/boot/efi" ] || \ + [ -d "${clst_target_path}/boot/EFI" ] || \ + [ -e "${clst_target_path}/gentoo.efimg" ] then - if [ ! -e "${clst_target_path}/gentoo.efimg" ] + if [ -e "${clst_target_path}/gentoo.efimg" ] then + echo "Found prepared EFI boot image at \ + ${clst_target_path}/gentoo.efimg" + # /boot must exist and be empty for later logic + echo "Removing /boot contents" + rm -rf "${clst_target_path}"/boot + mkdir -p "${clst_target_path}"/boot + else + echo "Preparing EFI boot image" + # prepare gentoo.efimg from cdtar's /boot dir iaSizeTemp=$(du -sk "${clst_target_path}/boot" 2>/dev/null) iaSizeB=$(echo ${iaSizeTemp} | cut '-d ' -f1) iaSize=$((${iaSizeB}+32)) # Add slack - + echo "Creating loopback file of size ${iaSize}kB" dd if=/dev/zero of="${clst_target_path}/gentoo.efimg" bs=1k \ count=${iaSize} + echo "Formatting loopback file with FAT16 FS" mkfs.vfat -F 16 -n GENTOO "${clst_target_path}/gentoo.efimg" mkdir "${clst_target_path}/gentoo.efimg.mountPoint" + echo "Mounting FAT16 loopback file" mount -t vfat -o loop "${clst_target_path}/gentoo.efimg" \ "${clst_target_path}/gentoo.efimg.mountPoint" - echo "Populating EFI image" + echo "Populating EFI image file from ${clst_target_path}/boot" cp -rv "${clst_target_path}"/boot/* \ "${clst_target_path}/gentoo.efimg.mountPoint" umount "${clst_target_path}/gentoo.efimg.mountPoint" rmdir "${clst_target_path}/gentoo.efimg.mountPoint" - if [ ! -e "${clst_target_path}/boot/grub/stage2_eltorito" ] - then - echo "Removing /boot" - rm -rf "${clst_target_path}/boot" - fi - else - echo "Found populated EFI image at \ - ${clst_target_path}/gentoo.efimg" + + echo "Removing /boot contents" + rm -rf "${clst_target_path}"/boot + mkdir -p "${clst_target_path}"/boot fi fi if [ -e "${clst_target_path}/isolinux/isolinux.bin" ] then + echo "** Found ISOLINUX bootloader" if [ -d "${clst_target_path}/boot" ] then if [ -n "$(ls ${clst_target_path}/boot)" ] + # have stray files in /boot, assume ISOLINUX only then + echo "** boot dir not empty, moving files to isolinux/ then removing it" mv "${clst_target_path}"/boot/* "${clst_target_path}/isolinux" rm -r "${clst_target_path}/boot" echo "Creating ISO using ISOLINUX bootloader" run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "${clst_target_path}"/ isohybrid "${1}" elif [ -e "${clst_target_path}/gentoo.efimg" ] + # have BIOS isolinux, plus an EFI loader image then echo "Creating ISO using both ISOLINUX and EFI bootloader" - run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -b gentoo.efimg -c boot.cat -no-emul-boot -z "${clst_target_path}"/ + run_mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o "${1}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -eltorito-platform efi -b gentoo.efimg -no-emul-boot -z "${clst_target_path}"/ + isohybrid --uefi "${1}" fi else echo "Creating ISO using ISOLINUX bootloader"