From b99684a3efafea61bad4c43095f56d04623d04f9 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 17 Mar 2018 12:12:19 +0000 Subject: Support 32-bit EFI with 64-bit system (and vice-versa). --- lib/MGA/DrakISO/BuildBoot.pm | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) (limited to 'lib/MGA/DrakISO/BuildBoot.pm') diff --git a/lib/MGA/DrakISO/BuildBoot.pm b/lib/MGA/DrakISO/BuildBoot.pm index 2233c2a..89e4fc2 100644 --- a/lib/MGA/DrakISO/BuildBoot.pm +++ b/lib/MGA/DrakISO/BuildBoot.pm @@ -222,8 +222,11 @@ sub prepare_iso_bootloader { run_('sed', '-i', qq(s/title-text:.*/title-text: "$title ($mode)"/), $base_theme_txt); } + my $efi_type = $build->{media}{efi_type} // 'none'; + member($efi_type, qw(none 32bit 64bit all)) or die "ERROR: unrecognised EFI type '$efi_type'\n"; + # If we are building a legacy-boot only ISO, we are done. - return if $build->{media}{legacy_boot_only}; + return if $efi_type eq 'none'; # Create another build directory. This will contain all the files we need # to exist in the /EFI directory on the ISO. @@ -231,16 +234,28 @@ sub prepare_iso_bootloader { my $efi_boot_dir = $efi_root_dir . '/BOOT'; mkdir_p($efi_boot_dir); - # If the user has supplied a grub2 image for UEFI boot, copy that, - # otherwise build one. - my $boot_efi = $build->get_absolute_path($build->{media}{boot_efi}); - if (defined $boot_efi) { - -e $boot_efi or die "ERROR: cannot find EFI boot image $boot_efi\n"; - cp_f($boot_efi, $efi_boot_dir . '/'); - } elsif ($arch eq 'x86_64') { - build_grub2_boot_efi($efi_boot_dir . '/bootx64.efi', 'x86_64-efi'); - } else { - build_grub2_boot_efi($efi_boot_dir . '/bootia32.efi', 'i386-efi'); + if ($efi_type ne '64bit') { + # If the user has supplied a grub2 image for 32-bit UEFI boot, copy that, + # otherwise build one. + my $boot_efi = $build->get_absolute_path($build->{media}{bootia32_efi}); + if (defined $boot_efi) { + -e $boot_efi or die "ERROR: cannot find EFI boot image $boot_efi\n"; + cp_f($boot_efi, $efi_boot_dir . '/'); + } else { + build_grub2_boot_efi($efi_boot_dir . '/bootia32.efi', 'i386-efi'); + } + } + + if ($efi_type ne '32bit') { + # If the user has supplied a grub2 image for 64-bit UEFI boot, copy that, + # otherwise build one. + my $boot_efi = $build->get_absolute_path($build->{media}{boot_efi}); + if (defined $boot_efi) { + -e $boot_efi or die "ERROR: cannot find EFI boot image $boot_efi\n"; + cp_f($boot_efi, $efi_boot_dir . '/'); + } else { + build_grub2_boot_efi($efi_boot_dir . '/bootx64.efi', 'x86_64-efi'); + } } # Build a grub2 configuration file for UEFI boot. This just chains to the -- cgit v1.2.1