2020-07-25 04:04:05 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
2012-09-22 20:10:38 +00:00
|
|
|
#
|
2020-07-25 04:04:05 +00:00
|
|
|
# Copyright (C) 2006-2021 OpenWrt.org
|
2012-09-22 20:10:38 +00:00
|
|
|
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
include $(INCLUDE_DIR)/kernel.mk
|
|
|
|
|
|
|
|
PKG_NAME:=grub
|
2021-06-10 10:15:58 +00:00
|
|
|
PKG_VERSION:=2.06
|
2020-07-25 04:04:05 +00:00
|
|
|
PKG_RELEASE:=$(AUTORELEASE)
|
2012-09-22 20:10:38 +00:00
|
|
|
|
2014-03-12 11:21:16 +00:00
|
|
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
2021-06-10 10:15:58 +00:00
|
|
|
PKG_SOURCE_URL:=@GNU/grub
|
|
|
|
PKG_HASH:=b79ea44af91b93d17cd3fe80bdae6ed43770678a9a5ae192ccea803ebb657ee1
|
2012-09-22 20:10:38 +00:00
|
|
|
|
2022-04-04 11:17:25 +00:00
|
|
|
PKG_LICENSE:=GPL-3.0-or-later
|
|
|
|
PKG_CPE_ID:=cpe:/a:gnu:grub2
|
|
|
|
|
2012-09-22 20:10:38 +00:00
|
|
|
HOST_BUILD_PARALLEL:=1
|
|
|
|
PKG_BUILD_DEPENDS:=grub2/host
|
|
|
|
|
2020-07-25 05:14:52 +00:00
|
|
|
ifneq ($(BUILD_VARIANT),none)
|
|
|
|
PKG_ASLR_PIE:=0
|
|
|
|
PKG_SSP:=0
|
|
|
|
endif
|
2015-06-25 11:20:39 +00:00
|
|
|
|
2017-01-19 08:18:57 +00:00
|
|
|
PKG_FLAGS:=nonshared
|
2023-01-28 15:04:10 +00:00
|
|
|
PKG_BUILD_FLAGS:=no-lto
|
2017-01-19 08:18:57 +00:00
|
|
|
|
2012-09-22 20:10:38 +00:00
|
|
|
include $(INCLUDE_DIR)/host-build.mk
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
|
2020-03-26 05:51:32 +00:00
|
|
|
define Package/grub2/Default
|
2016-10-26 15:51:44 +00:00
|
|
|
CATEGORY:=Boot Loaders
|
|
|
|
SECTION:=boot
|
2020-03-26 05:51:32 +00:00
|
|
|
TITLE:=GRand Unified Bootloader ($(1))
|
2012-09-22 20:10:38 +00:00
|
|
|
URL:=http://www.gnu.org/software/grub/
|
2019-01-13 20:37:47 +00:00
|
|
|
DEPENDS:=@TARGET_x86
|
2020-03-26 05:51:32 +00:00
|
|
|
VARIANT:=$(1)
|
2012-09-22 20:10:38 +00:00
|
|
|
endef
|
|
|
|
|
2020-03-26 05:51:32 +00:00
|
|
|
Package/grub2=$(call Package/grub2/Default,pc)
|
|
|
|
Package/grub2-efi=$(call Package/grub2/Default,efi)
|
|
|
|
|
2013-05-07 12:35:07 +00:00
|
|
|
define Package/grub2-editenv
|
|
|
|
CATEGORY:=Utilities
|
|
|
|
SECTION:=utils
|
2016-10-23 19:04:49 +00:00
|
|
|
SUBMENU:=Boot Loaders
|
2013-05-07 12:35:07 +00:00
|
|
|
TITLE:=Grub2 Environment editor
|
|
|
|
URL:=http://www.gnu.org/software/grub/
|
2019-01-13 20:37:47 +00:00
|
|
|
DEPENDS:=@TARGET_x86
|
2020-07-25 04:48:36 +00:00
|
|
|
VARIANT:=none
|
2013-05-07 12:35:07 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/grub2-editenv/description
|
|
|
|
Edit grub2 environment files.
|
|
|
|
endef
|
|
|
|
|
2020-07-25 04:04:05 +00:00
|
|
|
define Package/grub2-bios-setup
|
|
|
|
CATEGORY:=Utilities
|
|
|
|
SECTION:=utils
|
|
|
|
SUBMENU:=Boot Loaders
|
|
|
|
TITLE:=Grub2 BIOS boot setup tool
|
|
|
|
URL:=http://www.gnu.org/software/grub/
|
|
|
|
DEPENDS:=@TARGET_x86
|
2020-07-25 04:48:36 +00:00
|
|
|
VARIANT:=none
|
2020-07-25 04:04:05 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/grub2-bios-setup/description
|
|
|
|
Set up images to bootable.
|
|
|
|
endef
|
|
|
|
|
2016-01-21 11:46:18 +00:00
|
|
|
HOST_BUILD_PREFIX := $(STAGING_DIR_HOST)
|
|
|
|
|
2016-11-21 15:36:56 +00:00
|
|
|
CONFIGURE_VARS += \
|
|
|
|
grub_build_mkfont_excuse="don't want fonts"
|
|
|
|
|
2013-05-07 12:35:07 +00:00
|
|
|
CONFIGURE_ARGS += \
|
|
|
|
--target=$(REAL_GNU_TARGET_NAME) \
|
|
|
|
--disable-werror \
|
2014-03-30 19:55:39 +00:00
|
|
|
--disable-nls \
|
2014-03-30 19:55:43 +00:00
|
|
|
--disable-device-mapper \
|
2014-08-01 11:19:46 +00:00
|
|
|
--disable-libzfs \
|
2021-05-20 08:39:35 +00:00
|
|
|
--disable-liblzma \
|
2018-02-22 08:29:54 +00:00
|
|
|
--disable-grub-mkfont \
|
2020-03-26 05:51:32 +00:00
|
|
|
--with-platform=$(BUILD_VARIANT)
|
2013-05-07 12:35:07 +00:00
|
|
|
|
2016-11-21 15:36:56 +00:00
|
|
|
HOST_CONFIGURE_VARS += \
|
|
|
|
grub_build_mkfont_excuse="don't want fonts"
|
|
|
|
|
2012-09-22 20:10:38 +00:00
|
|
|
HOST_CONFIGURE_ARGS += \
|
2016-11-21 15:36:56 +00:00
|
|
|
--disable-grub-mkfont \
|
2012-09-22 20:10:38 +00:00
|
|
|
--target=$(REAL_GNU_TARGET_NAME) \
|
|
|
|
--sbindir="$(STAGING_DIR_HOST)/bin" \
|
2012-09-23 09:49:56 +00:00
|
|
|
--disable-werror \
|
2014-08-01 11:19:46 +00:00
|
|
|
--disable-libzfs \
|
2020-03-26 05:51:32 +00:00
|
|
|
--disable-nls \
|
|
|
|
--with-platform=none
|
2012-09-22 20:10:38 +00:00
|
|
|
|
|
|
|
HOST_MAKE_FLAGS += \
|
2012-09-23 10:38:06 +00:00
|
|
|
TARGET_RANLIB=$(TARGET_RANLIB) \
|
|
|
|
LIBLZMA=$(STAGING_DIR_HOST)/lib/liblzma.a
|
2012-09-22 20:10:38 +00:00
|
|
|
|
2020-03-26 05:51:32 +00:00
|
|
|
|
2020-07-25 04:48:36 +00:00
|
|
|
ifneq ($(BUILD_VARIANT),none)
|
2020-07-25 05:14:52 +00:00
|
|
|
TARGET_CFLAGS := $(filter-out -O2 -O3 -fno-plt,$(TARGET_CFLAGS))
|
2020-07-25 04:48:36 +00:00
|
|
|
MAKE_PATH := grub-core
|
|
|
|
endif
|
|
|
|
|
2012-09-22 20:10:38 +00:00
|
|
|
define Host/Configure
|
|
|
|
$(SED) 's,(RANLIB),(TARGET_RANLIB),' $(HOST_BUILD_DIR)/grub-core/Makefile.in
|
|
|
|
$(Host/Configure/Default)
|
|
|
|
endef
|
|
|
|
|
2020-03-26 05:51:32 +00:00
|
|
|
define Package/grub2/install
|
|
|
|
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)/grub2
|
|
|
|
$(CP) $(PKG_BUILD_DIR)/grub-core/boot.img $(STAGING_DIR_IMAGE)/grub2/
|
|
|
|
$(CP) $(PKG_BUILD_DIR)/grub-core/cdboot.img $(STAGING_DIR_IMAGE)/grub2/
|
|
|
|
sed 's#msdos1#gpt1#g' ./files/grub-early.cfg >$(PKG_BUILD_DIR)/grub-early.cfg
|
|
|
|
$(STAGING_DIR_HOST)/bin/grub-mkimage \
|
|
|
|
-d $(PKG_BUILD_DIR)/grub-core \
|
|
|
|
-p /boot/grub \
|
|
|
|
-O i386-pc \
|
|
|
|
-c $(PKG_BUILD_DIR)/grub-early.cfg \
|
|
|
|
-o $(STAGING_DIR_IMAGE)/grub2/gpt-core.img \
|
2023-01-23 13:44:50 +00:00
|
|
|
at_keyboard biosdisk boot chain configfile fat linux ls part_gpt reboot search serial test vga
|
2020-03-20 10:10:54 +00:00
|
|
|
$(STAGING_DIR_HOST)/bin/grub-mkimage \
|
2020-03-26 05:51:32 +00:00
|
|
|
-d $(PKG_BUILD_DIR)/grub-core \
|
2020-03-20 10:10:54 +00:00
|
|
|
-p /boot/grub \
|
|
|
|
-O i386-pc \
|
|
|
|
-c ./files/grub-early.cfg \
|
2020-03-26 05:51:32 +00:00
|
|
|
-o $(STAGING_DIR_IMAGE)/grub2/generic-core.img \
|
2023-01-23 13:44:50 +00:00
|
|
|
at_keyboard biosdisk boot chain configfile ext2 linux ls part_msdos reboot search serial test vga
|
2020-03-20 10:10:54 +00:00
|
|
|
$(STAGING_DIR_HOST)/bin/grub-mkimage \
|
2020-03-26 05:51:32 +00:00
|
|
|
-d $(PKG_BUILD_DIR)/grub-core \
|
2020-03-20 10:10:54 +00:00
|
|
|
-p /boot/grub \
|
|
|
|
-O i386-pc \
|
|
|
|
-c ./files/grub-early.cfg \
|
2020-03-26 05:51:32 +00:00
|
|
|
-o $(STAGING_DIR_IMAGE)/grub2/eltorito.img \
|
2022-02-10 17:46:55 +00:00
|
|
|
at_keyboard biosdisk boot chain configfile iso9660 linux ls part_msdos reboot search serial test vga
|
2020-03-20 10:10:54 +00:00
|
|
|
$(STAGING_DIR_HOST)/bin/grub-mkimage \
|
2020-03-26 05:51:32 +00:00
|
|
|
-d $(PKG_BUILD_DIR)/grub-core \
|
2020-03-20 10:10:54 +00:00
|
|
|
-p /boot/grub \
|
|
|
|
-O i386-pc \
|
|
|
|
-c ./files/grub-early.cfg \
|
2020-03-26 05:51:32 +00:00
|
|
|
-o $(STAGING_DIR_IMAGE)/grub2/legacy-core.img \
|
2022-02-10 17:46:55 +00:00
|
|
|
biosdisk boot chain configfile ext2 linux ls part_msdos reboot search serial vga
|
2020-03-20 10:10:54 +00:00
|
|
|
endef
|
|
|
|
|
2020-03-26 05:51:32 +00:00
|
|
|
define Package/grub2-efi/install
|
|
|
|
sed 's#msdos1#gpt1#g' ./files/grub-early.cfg >$(PKG_BUILD_DIR)/grub-early.cfg
|
|
|
|
$(STAGING_DIR_HOST)/bin/grub-mkimage \
|
|
|
|
-d $(PKG_BUILD_DIR)/grub-core \
|
|
|
|
-p /boot/grub \
|
|
|
|
-O $(CONFIG_ARCH)-efi \
|
|
|
|
-c $(PKG_BUILD_DIR)/grub-early.cfg \
|
|
|
|
-o $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_x86_64),x64,ia32).efi \
|
2023-01-23 13:44:50 +00:00
|
|
|
at_keyboard boot chain configfile fat linux ls part_gpt reboot serial test efi_gop efi_uga
|
2020-03-26 05:51:32 +00:00
|
|
|
$(STAGING_DIR_HOST)/bin/grub-mkimage \
|
|
|
|
-d $(PKG_BUILD_DIR)/grub-core \
|
|
|
|
-p /boot/grub \
|
|
|
|
-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
|
2020-01-14 17:45:44 +00:00
|
|
|
endef
|
|
|
|
|
2013-05-07 12:35:07 +00:00
|
|
|
define Package/grub2-editenv/install
|
|
|
|
$(INSTALL_DIR) $(1)/usr/sbin
|
|
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/grub-editenv $(1)/usr/sbin/
|
|
|
|
endef
|
|
|
|
|
2020-07-25 04:04:05 +00:00
|
|
|
define Package/grub2-bios-setup/install
|
|
|
|
$(INSTALL_DIR) $(1)/usr/sbin
|
|
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/grub-bios-setup $(1)/usr/sbin/
|
|
|
|
endef
|
|
|
|
|
2012-09-22 20:10:38 +00:00
|
|
|
$(eval $(call HostBuild))
|
|
|
|
$(eval $(call BuildPackage,grub2))
|
2020-03-26 05:51:32 +00:00
|
|
|
$(eval $(call BuildPackage,grub2-efi))
|
2013-05-07 12:35:07 +00:00
|
|
|
$(eval $(call BuildPackage,grub2-editenv))
|
2020-07-25 04:04:05 +00:00
|
|
|
$(eval $(call BuildPackage,grub2-bios-setup))
|