summary refs log tree commit diff
diff options
context:
space:
mode:
authorIvan Nikolaenko <ivan.nikolaenko@unikie.com>2022-09-29 13:32:34 +0300
committerAlyssa Ross <alyssa.ross@unikie.com>2022-09-29 10:58:33 +0000
commit5c4f0da3ca58dfc33dc5f8da79cc1c80ef8cc15a (patch)
tree76faf3b2395bf995b9ac4b36ec8baa85f470923d
parent1886a354da6a5553381d604dda41c24deb0fba0f (diff)
downloadspectrum-5c4f0da3ca58dfc33dc5f8da79cc1c80ef8cc15a.tar
spectrum-5c4f0da3ca58dfc33dc5f8da79cc1c80ef8cc15a.tar.gz
spectrum-5c4f0da3ca58dfc33dc5f8da79cc1c80ef8cc15a.tar.bz2
spectrum-5c4f0da3ca58dfc33dc5f8da79cc1c80ef8cc15a.tar.lz
spectrum-5c4f0da3ca58dfc33dc5f8da79cc1c80ef8cc15a.tar.xz
spectrum-5c4f0da3ca58dfc33dc5f8da79cc1c80ef8cc15a.tar.zst
spectrum-5c4f0da3ca58dfc33dc5f8da79cc1c80ef8cc15a.zip
EFI Loader: use correct arch suffix
Previously there were hardcoded "x64" in EFI loaders' filenames.

Signed-off-by: Ivan Nikolaenko <ivan.nikolaenko@unikie.com>
Message-Id: <20220929103234.2460828-1-ivan.nikolaenko@unikie.com>
Reviewed-by: Alyssa Ross <alyssa.ross@unikie.com>
Tested-by: Alyssa Ross <alyssa.ross@unikie.com>
Signed-off-by: Alyssa Ross <alyssa.ross@unikie.com>
-rw-r--r--img/combined/default.nix9
-rw-r--r--img/live/Makefile2
-rw-r--r--img/live/default.nix6
3 files changed, 11 insertions, 6 deletions
diff --git a/img/combined/default.nix b/img/combined/default.nix
index 3989d55..2865376 100644
--- a/img/combined/default.nix
+++ b/img/combined/default.nix
@@ -1,12 +1,13 @@
 # SPDX-License-Identifier: MIT
 # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is>
 # SPDX-FileCopyrightText: 2021 Yureka <yuka@yuka.dev>
+# SPDX-FileCopyrightText: 2022 Unikie
 
 { config ? import ../../nix/eval-config.nix {} }: with config.pkgs;
 
 let
   inherit (builtins) storeDir;
-  inherit (pkgs.lib) removePrefix;
+  inherit (pkgs.lib) removePrefix toUpper;
 
   eosimages = import ./eosimages.nix { inherit config; };
 
@@ -31,6 +32,8 @@ let
             --owner 0 --group 0 | tar2sqfs $out
   '';
 
+  efiArch = stdenv.hostPlatform.efiArch;
+
   grub = grub2_efi;
 
   grubCfg = substituteAll {
@@ -74,8 +77,8 @@ let
     done
     mcopy -i $out ${grub}/share/grub/unicode.pf2 ::/grub/fonts
 
-    grub-mkimage -o grubx64.efi -p "(hd0,gpt1)/grub" -O ${grub.grubTarget} part_gpt fat
-    mcopy -i $out grubx64.efi ::/EFI/BOOT/BOOTX64.EFI
+    grub-mkimage -o grub${efiArch}.efi -p "(hd0,gpt1)/grub" -O ${grub.grubTarget} part_gpt fat
+    mcopy -i $out grub${efiArch}.efi ::/EFI/BOOT/BOOT${toUpper efiArch}.EFI
 
     fsck.vfat -n $out
   '';
diff --git a/img/live/Makefile b/img/live/Makefile
index 9815c88..e63c598 100644
--- a/img/live/Makefile
+++ b/img/live/Makefile
@@ -36,7 +36,7 @@ build/boot.fat: $(KERNEL) $(INITRAMFS) $(SYSTEMD_BOOT_EFI) build/spectrum.conf
 	$(MCOPY) -i $@ build/spectrum.conf ::/loader/entries
 	$(MCOPY) -i $@ $(KERNEL) ::/spectrum/linux
 	$(MCOPY) -i $@ $(INITRAMFS) ::/spectrum/initrd
-	$(MCOPY) -i $@ $(SYSTEMD_BOOT_EFI) ::/EFI/BOOT/BOOTX64.EFI
+	$(MCOPY) -i $@ $(SYSTEMD_BOOT_EFI) ::/EFI/BOOT/$(EFINAME)
 
 # veritysetup format produces two files, but Make only (portably)
 # supports one output per rule, so we combine the two outputs then
diff --git a/img/live/default.nix b/img/live/default.nix
index 1fa8da3..4301ccc 100644
--- a/img/live/default.nix
+++ b/img/live/default.nix
@@ -9,7 +9,7 @@
 
 let
   inherit (config) pkgs;
-  inherit (pkgs.lib) cleanSource cleanSourceWith hasSuffix;
+  inherit (pkgs.lib) cleanSource cleanSourceWith hasSuffix toUpper;
 
   extfs = pkgs.pkgsStatic.callPackage ../../host/initramfs/extfs.nix {
     inherit config;
@@ -17,6 +17,7 @@ let
   rootfs = import ../../host/rootfs { inherit config; };
   scripts = import ../../scripts { inherit config; };
   initramfs = import ../../host/initramfs { inherit config rootfs; };
+  efiArch = stdenv.hostPlatform.efiArch;
 in
 
 stdenvNoCC.mkDerivation {
@@ -35,7 +36,8 @@ stdenvNoCC.mkDerivation {
   INITRAMFS = initramfs;
   KERNEL = "${rootfs.kernel}/${stdenv.hostPlatform.linux-kernel.target}";
   ROOT_FS = rootfs;
-  SYSTEMD_BOOT_EFI = "${systemd}/lib/systemd/boot/efi/systemd-bootx64.efi";
+  SYSTEMD_BOOT_EFI = "${systemd}/lib/systemd/boot/efi/systemd-boot${efiArch}.efi";
+  EFINAME = "BOOT${toUpper efiArch}.EFI";
 
   buildFlags = [ "build/live.img" ];
   makeFlags = [ "SCRIPTS=${scripts}" ];