aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathew McBride <matt@traverse.com.au>2021-02-24 04:53:40 +0000
committerPetr Štetiar <ynezz@true.cz>2023-06-13 14:12:26 +0200
commitf48985861a26f175682e49ce87e6d5b674a22d1a (patch)
tree6321949813112d73f0ceece7015d1e3b780ae5cf
parent649d3a75e2d29a999aabb80d9a4d63cc4cfb7c56 (diff)
downloadupstream-f48985861a26f175682e49ce87e6d5b674a22d1a.tar.gz
upstream-f48985861a26f175682e49ce87e6d5b674a22d1a.tar.bz2
upstream-f48985861a26f175682e49ce87e6d5b674a22d1a.zip
grub2: enable EFI for armvirt
This adds a separate package for EFI on Arm SystemReady compatible machines. 32-bit Arm UEFI is supported as well. It is very similar to x86-64 EFI setup, without the need for BIOS backward compatibility and slightly different default modules. Signed-off-by: Mathew McBride <matt@traverse.com.au> (cherry picked from commit 8f29b1573ddf3b7ed7c53bee1a7d55e574806205)
-rw-r--r--config/Config-images.in9
-rw-r--r--package/boot/grub2/Makefile40
-rw-r--r--package/boot/grub2/files/grub-early-gpt.cfg2
3 files changed, 41 insertions, 10 deletions
diff --git a/config/Config-images.in b/config/Config-images.in
index 8c4616f37c..cbf1e9f26d 100644
--- a/config/Config-images.in
+++ b/config/Config-images.in
@@ -204,11 +204,12 @@ menu "Target Images"
config GRUB_EFI_IMAGES
bool "Build GRUB EFI images (Linux x86 or x86_64 host only)"
- depends on TARGET_x86
+ depends on TARGET_x86 || TARGET_armvirt
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
- select PACKAGE_grub2
- select PACKAGE_grub2-efi
- select PACKAGE_grub2-bios-setup
+ select PACKAGE_grub2 if TARGET_x86
+ select PACKAGE_grub2-efi if TARGET_x86
+ select PACKAGE_grub2-bios-setup if TARGET_x86
+ select PACKAGE_grub2-efi-arm if TARGET_armvirt
select PACKAGE_kmod-fs-vfat
default y
diff --git a/package/boot/grub2/Makefile b/package/boot/grub2/Makefile
index 0613f46f99..50bf96360d 100644
--- a/package/boot/grub2/Makefile
+++ b/package/boot/grub2/Makefile
@@ -33,14 +33,15 @@ include $(INCLUDE_DIR)/package.mk
define Package/grub2/Default
CATEGORY:=Boot Loaders
SECTION:=boot
- TITLE:=GRand Unified Bootloader ($(1))
+ TITLE:=GRand Unified Bootloader ($(2))
URL:=http://www.gnu.org/software/grub/
- DEPENDS:=@TARGET_x86
- VARIANT:=$(1)
+ DEPENDS:=@TARGET_$(1)
+ VARIANT:=$(2)
endef
-Package/grub2=$(call Package/grub2/Default,pc)
-Package/grub2-efi=$(call Package/grub2/Default,efi)
+Package/grub2=$(call Package/grub2/Default,x86,pc)
+Package/grub2-efi=$(call Package/grub2/Default,x86,efi)
+Package/grub2-efi-arm=$(call Package/grub2/Default,armvirt,efi)
define Package/grub2-editenv
CATEGORY:=Utilities
@@ -107,6 +108,10 @@ ifneq ($(BUILD_VARIANT),none)
MAKE_PATH := grub-core
endif
+ifeq ($(CONFIG_arm),y)
+ TARGET_CFLAGS := $(filter-out -mfloat-abi=hard,$(TARGET_CFLAGS))
+endif
+
define Host/Configure
$(SED) 's,(RANLIB),(TARGET_RANLIB),' $(HOST_BUILD_DIR)/grub-core/Makefile.in
$(Host/Configure/Default)
@@ -162,9 +167,31 @@ define Package/grub2-efi/install
-O $(CONFIG_ARCH)-efi \
-c ./files/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/iso-boot$(if $(CONFIG_x86_64),x64,ia32).efi \
- at_keyboard boot chain configfile fat iso9660 linux ls part_msdos part_gpt reboot serial test efi_gop efi_uga
+ boot chain configfile fat iso9660 linux ls part_msdos part_gpt reboot serial test efi_gop efi_uga
endef
+define Package/grub2-efi-arm/install
+ $(INSTALL_DIR) $(STAGING_DIR_IMAGE)/grub2
+ cp ./files/grub-early-gpt.cfg $(PKG_BUILD_DIR)/grub-early.cfg
+ $(STAGING_DIR_HOST)/bin/grub-mkimage \
+ -d $(PKG_BUILD_DIR)/grub-core \
+ -p /boot/grub \
+ -O arm$(if $(CONFIG_aarch64),64,)-efi \
+ -c $(PKG_BUILD_DIR)/grub-early.cfg \
+ -o $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_aarch64),aa64,arm).efi \
+ boot chain configfile fat linux ls part_gpt part_msdos reboot search \
+ search_fs_uuid search_label serial efi_gop lsefi minicmd ext2
+ $(STAGING_DIR_HOST)/bin/grub-mkimage \
+ -d $(PKG_BUILD_DIR)/grub-core \
+ -p /boot/grub \
+ -O arm$(if $(CONFIG_aarch64),64,)-efi \
+ -c ./files/grub-early.cfg \
+ -o $(STAGING_DIR_IMAGE)/grub2/iso-bootaa$(if $(CONFIG_aarch64),aa64,arm).efi \
+ boot chain configfile fat iso9660 linux ls lsefi minicmd part_msdos part_gpt \
+ reboot serial test efi_gop
+endef
+
+
define Package/grub2-editenv/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/grub-editenv $(1)/usr/sbin/
@@ -178,5 +205,6 @@ endef
$(eval $(call HostBuild))
$(eval $(call BuildPackage,grub2))
$(eval $(call BuildPackage,grub2-efi))
+$(eval $(call BuildPackage,grub2-efi-arm))
$(eval $(call BuildPackage,grub2-editenv))
$(eval $(call BuildPackage,grub2-bios-setup))
diff --git a/package/boot/grub2/files/grub-early-gpt.cfg b/package/boot/grub2/files/grub-early-gpt.cfg
new file mode 100644
index 0000000000..c295d1f7d7
--- /dev/null
+++ b/package/boot/grub2/files/grub-early-gpt.cfg
@@ -0,0 +1,2 @@
+search --set=root --label kernel
+configfile ($root)/efi/openwrt/grub.cfg