Skip to contentSkip to conversation

board, boot, package: remove usage of startup.nsh in EFI partition

Buildroot Yann E. MORIN 1 participant 1 message Sep 27, 2021

lore
Share & tools
lore
#0 lore raw

commit: https://git.buildroot.net/buildroot/commit/?id=3efb5e31fc05705ce3c46b1f0ec031978a5cfab6
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

The startup.nsh file is useless to boot EFI payloads. We just need to follow the naming detection specified in the UEFI spec.
The EFI payload need to be placed in the boot/efi folder in the EFI partition and follow the architecture naming as described below:
32bit : bootia32.efi
x64 : bootx64.efi
aarch32 : bootarm.efi
aarch64 : bootaa64.efi

This naming is already right in the packages involved (systemd, grub2, gummiboot), therefore we just need to drop the generation of the startup.nsh file.

The usage of the startup.nsh in genimage is also dropped to avoid errors in the image generation.

---
 board/aarch64-efi/genimage-efi.cfg   | 3 ---
 board/intel/galileo/genimage.cfg     | 3 ---
 board/minnowboard/genimage.cfg       | 3 ---
 board/pc/genimage-efi.cfg            | 3 ---
 board/pc/post-build.sh               | 2 +-
 board/qemu/aarch64-sbsa/genimage.cfg | 3 ---
 boot/grub2/grub2.mk                  | 8 --------
 boot/gummiboot/gummiboot.mk          | 2 --
 package/systemd/systemd.mk           | 2 --
 9 files changed, 1 insertion(+), 28 deletions(-)
board/aarch64-efi/genimage-efi.cfg +0 -3
index 34cca1d64e..2daa70c361 100644
@@ -1,8 +1,5 @@
 image efi-part.vfat {
   vfat {
-    file startup.nsh {
-      image = "efi-part/startup.nsh"
-    }
     file EFI {
       image = "efi-part/EFI"
     }
board/intel/galileo/genimage.cfg +0 -3
index 31add21e67..b930c0deb9 100644
@@ -1,9 +1,6 @@
 # Create an image of the efi partition
 image efi-part.vfat {
 	vfat {
-		file startup.nsh {
-			image = "efi-part/startup.nsh"
-		}
 		file EFI {
 			image = "efi-part/EFI"
 		}
board/minnowboard/genimage.cfg +0 -3
index c5b07179b4..521385aadd 100644
@@ -1,9 +1,6 @@
 # Create an image of the efi partition
 image efi-part.vfat {
 	vfat {
-		file startup.nsh {
-			image = "efi-part/startup.nsh"
-		}
 		file EFI {
 			image = "efi-part/EFI"
 		}
board/pc/genimage-efi.cfg +0 -3
index ec7e85b06c..34befb7d69 100644
@@ -1,8 +1,5 @@
 image efi-part.vfat {
   vfat {
-    file startup.nsh {
-      image = "efi-part/startup.nsh"
-    }
     file EFI {
       image = "efi-part/EFI"
     }
board/pc/post-build.sh +1 -1
index ed37b3b87e..db23795e27 100755
@@ -5,7 +5,7 @@ set -e
 BOARD_DIR=$(dirname "$0")
 
 # Detect boot strategy, EFI or BIOS
-if [ -f "$BINARIES_DIR/efi-part/startup.nsh" ]; then
+if [ -d "$BINARIES_DIR/efi-part/" ]; then
     cp -f "$BOARD_DIR/grub-efi.cfg" "$BINARIES_DIR/efi-part/EFI/BOOT/grub.cfg"
 else
     cp -f "$BOARD_DIR/grub-bios.cfg" "$TARGET_DIR/boot/grub/grub.cfg"
board/qemu/aarch64-sbsa/genimage.cfg +0 -3
index 285b308d90..c75d9fcca1 100644
@@ -1,8 +1,5 @@
 image efi-part.vfat {
   vfat {
-    file startup.nsh {
-      image = "efi-part/startup.nsh"
-    }
     file EFI {
       image = "efi-part/EFI"
     }
boot/grub2/grub2.mk +0 -8
index 52e9199ae9..ad2edf17aa 100644
@@ -168,13 +168,5 @@ define GRUB2_INSTALL_IMAGES_CMDS
 	$(GRUB2_IMAGE_INSTALL_ELTORITO)
 endef
 
-ifeq ($(GRUB2_PLATFORM),efi)
-define GRUB2_EFI_STARTUP_NSH
-	echo $(notdir $(GRUB2_IMAGE)) > \
-		$(BINARIES_DIR)/efi-part/startup.nsh
-endef
-GRUB2_POST_INSTALL_IMAGES_HOOKS += GRUB2_EFI_STARTUP_NSH
-endif
-
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
boot/gummiboot/gummiboot.mk +0 -2
index 748e87030e..eb1f3da78c 100644
@@ -32,8 +32,6 @@ GUMMIBOOT_CONF_OPTS = \
 define GUMMIBOOT_INSTALL_IMAGES_CMDS
 	$(INSTALL) -D -m 0644 $(@D)/gummiboot$(GUMMIBOOT_IMGARCH).efi \
 		$(BINARIES_DIR)/efi-part/EFI/BOOT/boot$(GUMMIBOOT_IMGARCH).efi
-	echo "boot$(GUMMIBOOT_IMGARCH).efi" > \
-		$(BINARIES_DIR)/efi-part/startup.nsh
 	$(INSTALL) -D -m 0644 boot/gummiboot/loader.conf \
 		$(BINARIES_DIR)/efi-part/loader/loader.conf
 	$(INSTALL) -D -m 0644 boot/gummiboot/buildroot.conf \
package/systemd/systemd.mk +0 -2
index 5a76f2f246..c403896759 100644
@@ -514,8 +514,6 @@ SYSTEMD_BOOT_EFI_ARCH = $(call qstrip,$(BR2_PACKAGE_SYSTEMD_BOOT_EFI_ARCH))
 define SYSTEMD_INSTALL_BOOT_FILES
 	$(INSTALL) -D -m 0644 $(@D)/build/src/boot/efi/systemd-boot$(SYSTEMD_BOOT_EFI_ARCH).efi \
 		$(BINARIES_DIR)/efi-part/EFI/BOOT/boot$(SYSTEMD_BOOT_EFI_ARCH).efi
-	echo "boot$(SYSTEMD_BOOT_EFI_ARCH).efi" > \
-		$(BINARIES_DIR)/efi-part/startup.nsh
 	$(INSTALL) -D -m 0644 $(SYSTEMD_PKGDIR)/boot-files/loader.conf \
 		$(BINARIES_DIR)/efi-part/loader/loader.conf
 	$(INSTALL) -D -m 0644 $(SYSTEMD_PKGDIR)/boot-files/buildroot.conf \

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot