summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2018-03-17 12:12:19 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2018-03-17 12:12:19 +0000
commitb99684a3efafea61bad4c43095f56d04623d04f9 (patch)
treeaa1ee96f8a2a73c6061afa34fd11daecca9b3d60
parent8834463bdd43dab422016b720b42eb1869e4192f (diff)
downloaddrakiso-b99684a3efafea61bad4c43095f56d04623d04f9.tar
drakiso-b99684a3efafea61bad4c43095f56d04623d04f9.tar.gz
drakiso-b99684a3efafea61bad4c43095f56d04623d04f9.tar.bz2
drakiso-b99684a3efafea61bad4c43095f56d04623d04f9.tar.xz
drakiso-b99684a3efafea61bad4c43095f56d04623d04f9.zip
Support 32-bit EFI with 64-bit system (and vice-versa).
-rw-r--r--examples/gui/config/build.cfg2
-rw-r--r--examples/minimal/config/build.cfg2
-rw-r--r--examples/xfce/config/build.cfg2
-rw-r--r--lib/MGA/DrakISO/BuildBoot.pm37
-rw-r--r--lib/MGA/DrakISO/BuildISO.pm9
5 files changed, 38 insertions, 14 deletions
diff --git a/examples/gui/config/build.cfg b/examples/gui/config/build.cfg
index 3f9c4d1..b21b5fd 100644
--- a/examples/gui/config/build.cfg
+++ b/examples/gui/config/build.cfg
@@ -204,9 +204,11 @@ my $_l = {
mbr_boot_img => '/usr/share/drakiso-bootloader/images/boot_hybrid.img',
eltorito_img => '/usr/share/drakiso-bootloader/images/eltorito.img',
if_($arch eq 'i586',
+ efi_type => '32bit',
boot_efi => '/usr/share/drakiso-bootloader/images/bootia32.efi'
),
if_($arch eq 'x86_64',
+ efi_type => '64bit',
boot_efi => '/usr/share/drakiso-bootloader/images/bootx64.efi'
),
},
diff --git a/examples/minimal/config/build.cfg b/examples/minimal/config/build.cfg
index e731f08..079c5f6 100644
--- a/examples/minimal/config/build.cfg
+++ b/examples/minimal/config/build.cfg
@@ -180,9 +180,11 @@ my $_l = {
mbr_boot_img => '/usr/share/drakiso-bootloader/images/boot_hybrid.img',
eltorito_img => '/usr/share/drakiso-bootloader/images/eltorito.img',
if_($arch eq 'i586',
+ efi_type => '32bit',
boot_efi => '/usr/share/drakiso-bootloader/images/bootia32.efi'
),
if_($arch eq 'x86_64',
+ efi_type => '64bit',
boot_efi => '/usr/share/drakiso-bootloader/images/bootx64.efi'
),
},
diff --git a/examples/xfce/config/build.cfg b/examples/xfce/config/build.cfg
index c02e738..7e99cab 100644
--- a/examples/xfce/config/build.cfg
+++ b/examples/xfce/config/build.cfg
@@ -254,9 +254,11 @@ my $_l = {
mbr_boot_img => '/usr/share/drakiso-bootloader/images/boot_hybrid.img',
eltorito_img => '/usr/share/drakiso-bootloader/images/eltorito.img',
if_($arch eq 'i586',
+ efi_type => '32bit',
boot_efi => '/usr/share/drakiso-bootloader/images/bootia32.efi'
),
if_($arch eq 'x86_64',
+ efi_type => '64bit',
boot_efi => '/usr/share/drakiso-bootloader/images/bootx64.efi'
),
},
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
diff --git a/lib/MGA/DrakISO/BuildISO.pm b/lib/MGA/DrakISO/BuildISO.pm
index 0042b43..f4278b1 100644
--- a/lib/MGA/DrakISO/BuildISO.pm
+++ b/lib/MGA/DrakISO/BuildISO.pm
@@ -46,13 +46,15 @@ our @EXPORT = qw(build_iso);
sub build_iso {
my ($build) = @_;
+ my $efi_type = $build->{media}{efi_type} // 'none';
+
my $loopbacks = $build->get_build_dir('loopbacks');
my $files = $build->get_build_dir('files');
build_iso_image(
$build,
'/boot=' . $build->get_build_dir('boot'),
- if_($build->{settings}{arch} eq 'x86_64',
+ if_($efi_type ne 'none',
'/EFI=' . $build->get_build_dir('EFI'),
),
if_(-d $loopbacks,
@@ -99,11 +101,12 @@ sub build_iso_image {
my $arch = $build->{settings}{arch};
+ my $efi_type = $build->{media}{efi_type} // 'none';
+
my $mbr_image = $build->get_absolute_path($build->{media}{mbr_boot_img}) // '/usr/lib/grub/i386-pc/boot_hybrid.img';
-e $mbr_image or die "ERROR: cannot find MBR boot image $mbr_image\n";
my $esp_image = $build->get_build_dir('images') . '/esp.img';
- -e $esp_image || $arch ne 'x86_64' or die "ERROR: cannot find ESP image $esp_image\n";
my $build_dir = $build->get_build_dir('dist');
mkdir_p($build_dir);
@@ -136,7 +139,7 @@ sub build_iso_image {
'-boot-load-size', 4,
'-boot-info-table',
'--grub2-boot-info',
- if_(!$build->{media}{legacy_boot_only},
+ if_($efi_type ne 'none',
# for DVD UEFI boot
'--efi-boot', '--interval:appended_partition_2:all::',
# for USB UEFI boot