Skip to content

Commit

Permalink
temp add grub-2.12-rc1 for loongarch64 bootloader, make image generat…
Browse files Browse the repository at this point in the history
…ion work.
  • Loading branch information
phorcys committed Dec 7, 2023
1 parent 485906d commit 03b4ede
Show file tree
Hide file tree
Showing 12 changed files with 2,185,891 additions and 7 deletions.
18 changes: 13 additions & 5 deletions config/Config-images.in
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,12 @@ menu "Target Images"
default y

config GRUB_EFI_IMAGES
bool "Build GRUB EFI images (Linux x86 or x86_64 host only)"
depends on TARGET_x86 || TARGET_armsr
bool "Build GRUB EFI images (Linux x86 or x86_64 or loongarch64 host only)"
depends on TARGET_x86 || TARGET_armsr || TARGET_loongson
depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
select PACKAGE_grub2 if TARGET_x86
select PACKAGE_grub2-efi if TARGET_x86
select PACKAGE_grub2-efi-loongarch64 if TARGET_loongson
select PACKAGE_grub2-bios-setup if TARGET_x86
select PACKAGE_grub2-efi-arm if TARGET_armsr
select PACKAGE_kmod-fs-vfat
Expand Down Expand Up @@ -252,9 +253,16 @@ menu "Target Images"

config ISO_IMAGES
bool "Build LiveCD image (ISO)"
depends on TARGET_x86
depends on TARGET_x86 || TARGET_loongson
depends on GRUB_IMAGES || GRUB_EFI_IMAGES


config QEMU_IMAGES
bool "Build QEMU image files (qcow2)"
depends on TARGET_loongson
depends on GRUB_EFI_IMAGES
select PACKAGE_kmod-e1000

config VDI_IMAGES
bool "Build VirtualBox image files (VDI)"
depends on TARGET_x86
Expand All @@ -275,12 +283,12 @@ menu "Target Images"

config TARGET_SERIAL
string "Serial port device"
depends on TARGET_x86 || TARGET_armsr
depends on TARGET_x86 || TARGET_armsr || TARGET_loongarch64
default "ttyS0"

config TARGET_IMAGES_GZIP
bool "GZip images"
depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armsr || TARGET_malta
depends on TARGET_ROOTFS_EXT4FS || TARGET_x86 || TARGET_armsr || TARGET_malta || TARGET_loongarch64
default y

comment "Image Options"
Expand Down
22 changes: 20 additions & 2 deletions package/boot/grub2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@GNU/grub
PKG_HASH:=b79ea44af91b93d17cd3fe80bdae6ed43770678a9a5ae192ccea803ebb657ee1

PKG_LICENSE:=GPL-3.0-or-later
PKG_CPE_ID:=cpe:/a:gnu:grub2

HOST_BUILD_PARALLEL:=1
Expand Down Expand Up @@ -41,6 +40,7 @@ endef

Package/grub2=$(call Package/grub2/Default,x86,pc)
Package/grub2-efi=$(call Package/grub2/Default,x86,efi)
Package/grub2-efi-loongarch64=$(call Package/grub2/Default,loongson,efi)
Package/grub2-efi-arm=$(call Package/grub2/Default,armsr,efi)

define Package/grub2-editenv
Expand Down Expand Up @@ -113,7 +113,6 @@ ifeq ($(CONFIG_arm),y)
endif

define Host/Configure
$(SED) 's,(RANLIB),(TARGET_RANLIB),' $(HOST_BUILD_DIR)/grub-core/Makefile.in
$(Host/Configure/Default)
endef

Expand Down Expand Up @@ -191,6 +190,24 @@ define Package/grub2-efi-arm/install
reboot serial test efi_gop
endef

define Package/grub2-efi-loongarch64/install
$(INSTALL_DIR) $(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 $(CONFIG_ARCH)-efi \
-c $(PKG_BUILD_DIR)/grub-early.cfg \
-o $(STAGING_DIR_IMAGE)/grub2/bootloongarch64.efi \
boot chain configfile exfat ext2 fat linux ls part_msdos part_gpt reboot serial squash4 test efi_gop
$(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/bootloongarch64.efi \
boot chain configfile exfat ext2 fat iso9660 linux ls part_msdos part_gpt reboot serial squash4 test efi_gop
endef

define Package/grub2-editenv/install
$(INSTALL_DIR) $(1)/usr/sbin
Expand All @@ -206,5 +223,6 @@ $(eval $(call HostBuild))
$(eval $(call BuildPackage,grub2))
$(eval $(call BuildPackage,grub2-efi))
$(eval $(call BuildPackage,grub2-efi-arm))
$(eval $(call BuildPackage,grub2-efi-loongarch64))
$(eval $(call BuildPackage,grub2-editenv))
$(eval $(call BuildPackage,grub2-bios-setup))
Loading

0 comments on commit 03b4ede

Please sign in to comment.