From 1d57139d25089fb7d00d8b532846ca3e06a0b6bf Mon Sep 17 00:00:00 2001 From: Steffen Winterfeldt Date: Tue, 14 Feb 2023 17:25:09 +0100 Subject: [PATCH 1/2] support 32 bit UEFI firmware on x86_64/i386 architecture (bsc#1208003, jsc#PED-2569) --- src/lib/bootloader/bootloader_factory.rb | 2 +- src/lib/bootloader/grub2efi.rb | 2 +- src/lib/bootloader/grub_install.rb | 2 +- src/lib/bootloader/systeminfo.rb | 31 ++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/lib/bootloader/bootloader_factory.rb b/src/lib/bootloader/bootloader_factory.rb index 9c9f2cb99..c49431b51 100644 --- a/src/lib/bootloader/bootloader_factory.rb +++ b/src/lib/bootloader/bootloader_factory.rb @@ -96,7 +96,7 @@ def boot_efi? def proposed_name return "grub2-efi" if Systeminfo.efi_mandatory? - return "grub2-efi" if Yast::Arch.x86_64 && boot_efi? + return "grub2-efi" if (Yast::Arch.x86_64 || Yast::Arch.i386) && boot_efi? "grub2" # grub2 works(c) everywhere end diff --git a/src/lib/bootloader/grub2efi.rb b/src/lib/bootloader/grub2efi.rb index 08c37dc63..91234934b 100644 --- a/src/lib/bootloader/grub2efi.rb +++ b/src/lib/bootloader/grub2efi.rb @@ -72,7 +72,7 @@ def name def packages res = super - case Yast::Arch.architecture + case Systeminfo.efi_arch when "i386" res << "grub2-i386-efi" when "x86_64" diff --git a/src/lib/bootloader/grub_install.rb b/src/lib/bootloader/grub_install.rb index 74f7c5858..8c4ea30ad 100644 --- a/src/lib/bootloader/grub_install.rb +++ b/src/lib/bootloader/grub_install.rb @@ -167,7 +167,7 @@ def target return @target if @target arch = Yast::Arch.architecture - target = efi ? EFI_TARGETS[arch] : NON_EFI_TARGETS[arch] + target = efi ? EFI_TARGETS[Systeminfo.efi_arch] : NON_EFI_TARGETS[arch] if !target raise "unsupported combination of architecture #{arch} and " \ diff --git a/src/lib/bootloader/systeminfo.rb b/src/lib/bootloader/systeminfo.rb index dc5f6d8df..9148d6e73 100644 --- a/src/lib/bootloader/systeminfo.rb +++ b/src/lib/bootloader/systeminfo.rb @@ -28,6 +28,9 @@ def secure_boot_active? # # @return [Boolean] true if secure boot is (in principle) supported on this system def secure_boot_supported? + # no shim for i386 (yet) + return false if efi_arch == "i386" + efi_supported? || s390_secure_boot_supported? || ppc_secure_boot_supported? end @@ -36,6 +39,9 @@ def secure_boot_supported? # @param bootloader_name [String] bootloader name # @return [Boolean] true if secure boot setting is available with this bootloader def secure_boot_available?(bootloader_name) + # no shim for i386 (yet) + return false if efi_arch == "i386" + efi_used?(bootloader_name) || s390_secure_boot_available? || ppc_secure_boot_available? end @@ -108,6 +114,31 @@ def shim_needed?(bootloader_name, secure_boot) secure_boot && efi_used?(bootloader_name) end + # UEFI platform size (32 or 64 bits). + # + # On x86_64 systems both variants are possible. + # + # @return [Integer] platform size - or 0 if not applicable + def efi_platform_size + bits = File.read("/sys/firmware/efi/fw_platform_size").to_i + log.info "EFI platform size: #{bits}" + bits + rescue StandardError + 0 + end + + # Effective UEFI architecture. + # + # Usually the same as the architecture except on x86_64 where it + # depends on the platform size. + # + # @return [String] architecture name + def efi_arch + arch = Yast::Arch.architecture + arch = "i386" if arch == "x86_64" && efi_platform_size == 32 + arch + end + # Check if secure boot is (in principle) available on an s390 machine. # # @return [Boolean] true if this is an s390 machine and it has secure boot support From 98c443de82019917e07419ca5df698adeddba646 Mon Sep 17 00:00:00 2001 From: Steffen Winterfeldt Date: Mon, 7 Aug 2023 11:03:27 +0200 Subject: [PATCH 2/2] release 6.4.3 --- package/yast2-bootloader.changes | 7 +++++++ package/yast2-bootloader.spec | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/package/yast2-bootloader.changes b/package/yast2-bootloader.changes index 7ffccc049..709faa020 100644 --- a/package/yast2-bootloader.changes +++ b/package/yast2-bootloader.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Aug 7 09:02:48 UTC 2023 - Steffen Winterfeldt + +- support 32 bit UEFI firmware on x86_64/i386 architecture (bsc#1208003, + jsc#PED-2569) +- 4.6.3 + ------------------------------------------------------------------- Thu Jun 15 09:51:19 UTC 2023 - José Iván López González diff --git a/package/yast2-bootloader.spec b/package/yast2-bootloader.spec index 143036238..8ad7c815e 100644 --- a/package/yast2-bootloader.spec +++ b/package/yast2-bootloader.spec @@ -17,7 +17,7 @@ Name: yast2-bootloader -Version: 4.6.2 +Version: 4.6.3 Release: 0 Summary: YaST2 - Bootloader Configuration License: GPL-2.0-or-later