[coreboot-gerrit] Change in coreboot[master]: payloads/external/GRUB2: add arm support
Marty Plummer (Code Review)
gerrit at coreboot.org
Sat Jan 20 22:15:41 CET 2018
Hello Marty E. Plummer,
I'd like you to do a code review. Please visit
https://review.coreboot.org/23340
to review the following change.
Change subject: payloads/external/GRUB2: add arm support
......................................................................
payloads/external/GRUB2: add arm support
Certain grub modules are not built when compiled for arm-coreboot as of
this moment, so set defaults differently on ARCH_ARM.
Add the ability to specify a dtb file (required on arm-coreboot for now,
added via grub-mkimage and not added to cbfs)
Set GRUB2 version to HEAD if ARCH_ARM, as the stable release does not
support arm-coreboot.
Change-Id: I37ec1191fede8e333d9571b2fd34353ed38b8fd1
Signed-off-by: Marty E. Plummer <hanetzer at startmail.com>
---
M payloads/external/GRUB2/Kconfig
M payloads/external/GRUB2/Kconfig.name
M payloads/external/GRUB2/Makefile
M payloads/external/Makefile.inc
4 files changed, 23 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/40/23340/1
diff --git a/payloads/external/GRUB2/Kconfig b/payloads/external/GRUB2/Kconfig
index 757b1c2..64e21e5 100644
--- a/payloads/external/GRUB2/Kconfig
+++ b/payloads/external/GRUB2/Kconfig
@@ -2,6 +2,7 @@
choice
prompt "GRUB2 version"
+ default GRUB2_MASTER if ARCH_ARM
default GRUB2_STABLE
config GRUB2_STABLE
@@ -38,12 +39,14 @@
config GRUB2_DEFAULT_MODULES
string "Default modules to include in GRUB image" if GRUB2_EXPERT_OPTIONS
+ default "configfile echo gzio halt help hexdump linux ls lsmmap memrw minicmd normal password_pbkdf2 reboot regexp search serial syslinuxcfg test" if ARCH_ARM
default "cbls cbmemc cbtime chain configfile echo gzio halt help hexdump iorw linux linux16 ls lsacpi lsmmap lspci memrw minicmd multiboot normal password_pbkdf2 pcidump reboot regexp search serial setpci syslinuxcfg test xnu"
help
Space-separated list of modules to include
config GRUB2_PRELOAD_MODULES
string "Modules to pre-load" if GRUB2_EXPERT_OPTIONS
+ default "cbfs ehci ext2 fat part_gpt part_msdos usb_keyboard usbms usbserial_usbdebug" if ARCH_ARM
default "ahci at_keyboard cbfs ehci ext2 fat ohci part_gpt part_msdos pata uhci usb_keyboard usbms usbserial_usbdebug"
help
Space-separated list of modules to pre-load
@@ -93,4 +96,10 @@
help
The path of the GRUB2 runtime configuration file to be added to CBFS.
+config GRUB2_ARM_DTB_FILE
+ string "Path of dtb file to embed in GRUB image"
+ depends on ARCH_ARM
+ help
+ The path of the DTB file to pass to grub-mkimage
+
endif
diff --git a/payloads/external/GRUB2/Kconfig.name b/payloads/external/GRUB2/Kconfig.name
index cf94bb4..fe60d76 100644
--- a/payloads/external/GRUB2/Kconfig.name
+++ b/payloads/external/GRUB2/Kconfig.name
@@ -1,6 +1,6 @@
config PAYLOAD_GRUB2
bool "GRUB2"
- depends on ARCH_X86
+ depends on ARCH_X86 || ARCH_ARM
help
Select this option if you want to build a coreboot image
with a GRUB2 payload. If you don't know what this is
diff --git a/payloads/external/GRUB2/Makefile b/payloads/external/GRUB2/Makefile
index d26abc8..7d4745f 100644
--- a/payloads/external/GRUB2/Makefile
+++ b/payloads/external/GRUB2/Makefile
@@ -25,10 +25,15 @@
git checkout $(NAME-y) || true
ARCH_TRIPLE=unsupported
+DTB=
ifeq ($(CONFIG_ARCH_X86),y)
ARCH_TRIPLE=i386-linux-gnu
IMAGE_FORMAT=i386-coreboot
endif
+ifeq ($(CONFIG_ARCH_ARM),y)
+DTB=--dtb=
+ARCH_TRIPLE=arm-eabi
+endif
grub2/build/config.h: $(CONFIG_DEP) | checkout
echo " CONFIG GRUB2 $(NAME-y)"
@@ -37,6 +42,7 @@
cd grub2 && ./autogen.sh
cd grub2/build && ../configure CC="$(HOSTCC)" LD="$(LD)" \
TARGET_CC="$(CC)" TARGET_OBJCOPY="$(OBJCOPY)" TARGET_STRIP="$(STRIP)" \
+ TARGET_AS="$(CC)-as" TARGET_RANLIB="$(CC)-ranlib" \
CFLAGS=-O2 TARGET_CFLAGS=-Os --target=$(ARCH_TRIPLE) \
--with-platform=coreboot --enable-boot-time --disable-werror
diff --git a/payloads/external/Makefile.inc b/payloads/external/Makefile.inc
index 7777aea..ff2bd65 100644
--- a/payloads/external/Makefile.inc
+++ b/payloads/external/Makefile.inc
@@ -156,13 +156,18 @@
# Grub
+ifneq ($(strip $(CONFIG_GRUB2_ARM_DTB_FILE)),)
+CONFIG_GRUB2_ARM_DTB_FILE := ../../../$(CONFIG_GRUB2_ARM_DTB_FILE)
+endif
grub2: $(obj)/config.h
$(MAKE) -C payloads/external/GRUB2 \
HOSTCC="$(HOSTCC)" \
- CC="$(CC_x86_32)" LD="$(LD_x86_32)" \
- OBJCOPY="$(OBJCOPY_x86_32)" STRIP="$(STRIP_x86_32)" \
+ CC="$(CC_$(ARCH-ramstage-y))" LD="$(LD_$(ARCH-ramstage-y))" \
+ OBJCOPY="$(OBJCOPY_$(ARCH-ramstage-y))" STRIP="$(STRIP_$(ARCH-ramstage-y))" \
+ CONFIG_ARCH_ARM=$(CONFIG_ARCH_ARM) \
CONFIG_ARCH_X86=$(CONFIG_ARCH_X86) \
CONFIG_DEP="$(abspath $(obj)/config.h)" \
+ CONFIG_GRUB2_ARM_DTB_FILE=$(CONFIG_GRUB2_ARM_DTB_FILE) \
CONFIG_GRUB2_PRELOAD_MODULES=$(CONFIG_GRUB2_PRELOAD_MODULES) \
CONFIG_GRUB2_DEFAULT_MODULES=$(CONFIG_GRUB2_DEFAULT_MODULES) \
CONFIG_GRUB2_FS_MODULES=$(CONFIG_GRUB2_FS_MODULES) \
--
To view, visit https://review.coreboot.org/23340
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I37ec1191fede8e333d9571b2fd34353ed38b8fd1
Gerrit-Change-Number: 23340
Gerrit-PatchSet: 1
Gerrit-Owner: Marty Plummer <hanetzer at protonmail.com>
Gerrit-Reviewer: Marty E. Plummer <hanetzer at startmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180120/a50b1d1e/attachment-0001.html>
More information about the coreboot-gerrit
mailing list