summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2018-03-02 17:55:03 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2018-03-02 23:15:23 +0000
commit931b82be93b6c068a91a59f4c6b7ebb9bdfa158a (patch)
treedefeab6464750635d2204796ff4060fbe949ec83
parent112b0f37aa475e2c1a4f4bdaca9a4d5e333e9c40 (diff)
downloaddrakiso-931b82be93b6c068a91a59f4c6b7ebb9bdfa158a.tar
drakiso-931b82be93b6c068a91a59f4c6b7ebb9bdfa158a.tar.gz
drakiso-931b82be93b6c068a91a59f4c6b7ebb9bdfa158a.tar.bz2
drakiso-931b82be93b6c068a91a59f4c6b7ebb9bdfa158a.tar.xz
drakiso-931b82be93b6c068a91a59f4c6b7ebb9bdfa158a.zip
Add support for 32-bit EFI.
-rw-r--r--bootloader/Makefile6
-rw-r--r--lib/MGA/DrakISO/BuildBoot.pm33
-rw-r--r--lib/MGA/DrakISO/BuildISO.pm2
3 files changed, 25 insertions, 16 deletions
diff --git a/bootloader/Makefile b/bootloader/Makefile
index 5e7feba..112bf14 100644
--- a/bootloader/Makefile
+++ b/bootloader/Makefile
@@ -13,6 +13,8 @@ GRUB_IMAGES = images/boot_hybrid.img images/eltorito.img
ifeq ($(ARCH),x86_64)
GRUB_IMAGES += images/bootx64.efi
+else
+ GRUB_IMAGES += images/bootia32.efi
endif
INSTALL_DIR = $(PREFIX)/usr/share/drakiso-bootloader
@@ -29,6 +31,10 @@ images/eltorito.img:
@mkdir -p images
grub2-mkimage --output $@ --prefix /boot/grub2 --format i386-pc-eltorito biosdisk $(GRUB2_MODULES)
+images/bootia32.efi:
+ @mkdir -p images
+ grub2-mkimage --output $@ --prefix /EFI/BOOT --format i386-efi $(GRUB2_MODULES)
+
images/bootx64.efi:
@mkdir -p images
grub2-mkimage --output $@ --prefix /EFI/BOOT --format x86_64-efi $(GRUB2_MODULES)
diff --git a/lib/MGA/DrakISO/BuildBoot.pm b/lib/MGA/DrakISO/BuildBoot.pm
index c499b1d..2233c2a 100644
--- a/lib/MGA/DrakISO/BuildBoot.pm
+++ b/lib/MGA/DrakISO/BuildBoot.pm
@@ -100,10 +100,12 @@ sub prepare_live_system_boot {
sub prepare_iso_bootloader {
my ($build) = @_;
+ my $arch = $build->{settings}{arch};
+
# If the user has supplied a list of files to copy from the repository,
# do that now. We may need some of those files to correctly auto-detect
# the default kernel and initrd.
- my $repo_prefix = $build->{settings}{repository} . '/' . $build->{settings}{arch} . '/';
+ my $repo_prefix = $build->{settings}{repository} . '/' . $arch . '/';
my $copy_prefix = $build->get_build_dir . '/';
foreach (group_by2(@{$build->{copy_from_repo}})) {
my ($src, $dst) = @$_;
@@ -211,7 +213,7 @@ sub prepare_iso_bootloader {
}
my $title = $build->{media}{bootloader_title} // $label =~ s/-/ /gr;
- my $mode = $build->{settings}{arch} eq 'x86_64' ? '64-bit' : '32-bit';
+ my $mode = $arch eq 'x86_64' ? '64-bit' : '32-bit';
# If we have a theme, replace the menu title with the name of the ISO
# (extracted from the disk label).
@@ -220,9 +222,8 @@ sub prepare_iso_bootloader {
run_('sed', '-i', qq(s/title-text:.*/title-text: "$title ($mode)"/), $base_theme_txt);
}
- # If we are building a 32-bit ISO, we are done, as we don't support
- # 32-bit UEFI boot.
- return if $build->{settings}{arch} ne 'x86_64';
+ # If we are building a legacy-boot only ISO, we are done.
+ return if $build->{media}{legacy_boot_only};
# Create another build directory. This will contain all the files we need
# to exist in the /EFI directory on the ISO.
@@ -232,12 +233,14 @@ sub prepare_iso_bootloader {
# If the user has supplied a grub2 image for UEFI boot, copy that,
# otherwise build one.
- my $bootx64_efi = $build->get_absolute_path($build->{media}{bootx64_efi});
- if (defined $bootx64_efi) {
- -e $bootx64_efi or die "ERROR: cannot find EFI boot image $bootx64_efi\n";
- cp_f($bootx64_efi, $efi_boot_dir . '/bootx64.efi');
+ 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_bootx64_efi($efi_boot_dir . '/bootx64.efi');
+ build_grub2_boot_efi($efi_boot_dir . '/bootia32.efi', 'i386-efi');
}
# Build a grub2 configuration file for UEFI boot. This just chains to the
@@ -250,7 +253,7 @@ sub prepare_iso_bootloader {
if (-e $base_theme_txt) {
my $uefi_theme_txt = $grub2_dir . "/themes/$theme_name/theme-uefi.txt";
cp_f($base_theme_txt, $uefi_theme_txt);
- run_('sed', '-i', qq(s/title-text:.*/title-text: "$title (UEFI)"/), $uefi_theme_txt);
+ run_('sed', '-i', qq(s/title-text:.*/title-text: "$title ($mode UEFI)"/), $uefi_theme_txt);
}
# Create another build directory for temporarily storing the ESP image.
@@ -266,7 +269,7 @@ sub prepare_iso_bootloader {
# Now we've built the ESP image, we can delete the grub2 image. We need
# to leave the grub2.cfg file, as DVD boot sets the initial grub2 root
# location to the iso9960 partition, not the ESP.
- rm_rf($efi_boot_dir . '/bootx64.efi');
+ rm_rf(glob($efi_boot_dir . '/*.efi'));
}
sub build_grub2_eltorito_img {
@@ -284,8 +287,8 @@ sub build_grub2_eltorito_img {
);
}
-sub build_grub2_bootx64_efi {
- my ($output) = @_;
+sub build_grub2_boot_efi {
+ my ($output, $format) = @_;
my @modules = qw(iso9660 fat part_msdos all_video font png gfxterm gfxmenu
keylayouts at_keyboard usb_keyboard configfile echo gettext
@@ -294,7 +297,7 @@ sub build_grub2_bootx64_efi {
run_('grub2-mkimage',
'--output', $output,
'--prefix', '/EFI/BOOT',
- '--format', 'x86_64-efi',
+ '--format', $format,
@modules
);
}
diff --git a/lib/MGA/DrakISO/BuildISO.pm b/lib/MGA/DrakISO/BuildISO.pm
index ff77679..941050c 100644
--- a/lib/MGA/DrakISO/BuildISO.pm
+++ b/lib/MGA/DrakISO/BuildISO.pm
@@ -136,7 +136,7 @@ sub build_iso_image {
'-boot-load-size', 4,
'-boot-info-table',
'--grub2-boot-info',
- if_($arch eq 'x86_64',
+ if_(!$build->{media}{legacy_boot_only},
# for DVD UEFI boot
'--efi-boot', '--interval:appended_partition_2:all::',
# for USB UEFI boot