Martin Roth (martinroth@google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12714
-gerrit
commit 2995f055ce3bcf588bca3264a331f7d38763b661 Author: Martin Roth martinroth@google.com Date: Fri Dec 11 12:24:33 2015 -0700
Payloads: Add U-Boot as a coreboot-payload
- Add Kconfig and Makefile options to use U-Boot as a payload. - Add Kconfig option for extra cbfstool command line arguments. - Add Kconfig & Makefile option to load the payload as a flat binary. - Add u-boot directory to .gitignore.
This is currently working for X-86 only. I haven't tried graphics.
Tested in QEMU and on Minnowboard Max
Change-Id: Ia122a4ad7cd7d96107c1552b0376c8106ca8fb92 Signed-off-by: Martin Roth martinroth@google.com --- .gitignore | 1 + Makefile.inc | 12 +++++-- payloads/external/Makefile.inc | 5 +++ payloads/external/U-Boot/Kconfig | 36 +++++++++++++++++++ payloads/external/U-Boot/Kconfig.name | 11 ++++++ payloads/external/U-Boot/Makefile.inc | 68 +++++++++++++++++++++++++++++++++++ src/Kconfig | 12 +++++++ 7 files changed, 143 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore index 114d78f..581c4a4 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ coreboot-builds/ payloads/external/FILO/filo/ payloads/external/GRUB2/grub2/ payloads/external/SeaBIOS/seabios/ +payloads/external/U-Boot/u-boot/ util/crossgcc/acpica-unix-*/ util/crossgcc/binutils-*/ util/crossgcc/build-*BINUTILS/ diff --git a/Makefile.inc b/Makefile.inc index 976280c..a362948 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -441,6 +441,7 @@ clean-for-update-target: rm -f $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.* $(obj)/mainboard/$(MAINBOARDDIR)/dsdt.* rm -f $(obj)/cpu/x86/smm/smm_bin.c $(obj)/cpu/x86/smm/smm.* $(obj)/cpu/x86/smm/smm $(MAKE) -C payloads/external/SeaBIOS -f Makefile.inc clean + $(MAKE) -C payloads/external/U-Boot -f Makefile.inc clean
clean-target: rm -f $(obj)/coreboot* @@ -632,10 +633,10 @@ extract_nth=$(subst *,$(spc),$(patsubst -%-,%,$(word $(1), $(subst |,- -,-$(2)-) cbfs-add-cmd = \ printf " CBFS $(call extract_nth,2,$(file))\n"; \ $(CBFSTOOL) $@.tmp \ - add$(if $(filter stage,$(call extract_nth,3,$(file))),-stage)$(if $(filter payload,$(call extract_nth,3,$(file))),-payload) \ + add$(if $(filter stage,$(call extract_nth,3,$(file))),-stage)$(if $(filter payload,$(call extract_nth,3,$(file))),-payload)$(if $(filter flat-binary,$(call extract_nth,3,$(file))),-flat-binary) \ -f $(call extract_nth,1,$(file)) \ -n $(call extract_nth,2,$(file)) \ - $(if $(filter-out stage,$(call extract_nth,3,$(file))),-t $(call extract_nth,3,$(file))) \ + $(if $(filter-out flat-binary,$(filter-out stage,$(call extract_nth,3,$(file)))),-t $(call extract_nth,3,$(file))) \ $(if $(call extract_nth,4,$(file)),-c $(call extract_nth,4,$(file))) \ $(call extract_nth,7,$(file))
@@ -759,6 +760,9 @@ ifneq ($(strip $(call strip_quotes,$(CONFIG_LINUX_INITRD))),) ADDITIONAL_PAYLOAD_CONFIG+=-I $(CONFIG_LINUX_INITRD) endif endif +ifneq ($(strip $(call strip_quotes,$(CONFIG_PAYLOAD_OPTIONS))),) + ADDITIONAL_PAYLOAD_CONFIG+=$(strip $(call strip_quotes,$(CONFIG_PAYLOAD_OPTIONS))) +endif
ifeq ($(CONFIG_HAVE_REFCODE_BLOB),y) REFCODE_BLOB=$(obj)/refcode.rmod @@ -819,7 +823,11 @@ $(CONFIG_CBFS_PREFIX)/ramstage-compression := $(CBFS_COMPRESS_FLAG)
cbfs-files-y += $(CONFIG_CBFS_PREFIX)/payload $(CONFIG_CBFS_PREFIX)/payload-file := $(CONFIG_PAYLOAD_FILE) +ifeq ($(CONFIG_PAYLOAD_IS_FLAT_BINARY),y) +$(CONFIG_CBFS_PREFIX)/payload-type := flat-binary +else $(CONFIG_CBFS_PREFIX)/payload-type := payload +endif $(CONFIG_CBFS_PREFIX)/payload-compression := $(CBFS_PAYLOAD_COMPRESS_FLAG) $(CONFIG_CBFS_PREFIX)/payload-options := $(ADDITIONAL_PAYLOAD_CONFIG)
diff --git a/payloads/external/Makefile.inc b/payloads/external/Makefile.inc index 0854947..e573268 100644 --- a/payloads/external/Makefile.inc +++ b/payloads/external/Makefile.inc @@ -64,3 +64,8 @@ grub2: CONFIG_GRUB2_MASTER=$(CONFIG_GRUB2_MASTER)
payloads/external/GRUB2/grub2/build/default_payload.elf: grub2 + +payloads/external/U-Boot/u-boot/u-boot-dtb.bin u-boot: + $(MAKE) -C payloads/external/U-Boot -f Makefile.inc \ + CONFIG_UBOOT_MASTER=$(CONFIG_UBOOT_MASTER) \ + CONFIG_UBOOT_STABLE=$(CONFIG_UBOOT_STABLE) diff --git a/payloads/external/U-Boot/Kconfig b/payloads/external/U-Boot/Kconfig new file mode 100644 index 0000000..e9fc4ac --- /dev/null +++ b/payloads/external/U-Boot/Kconfig @@ -0,0 +1,36 @@ +config PAYLOAD_UBOOT + select PAYLOAD_IS_FLAT_BINARY + +if PAYLOAD_UBOOT + +choice + prompt "U-Boot version" + default UBOOT_STABLE + +config UBOOT_STABLE + bool "v2015.10" + help + Stable U-Boot version + +config UBOOT_MASTER + bool "master" + help + Newest U-Boot version + +endchoice + +config PAYLOAD_CONFIGFILE + string "U-Boot config file" + default "" + help + This option allows a platform to set Kconfig options for a basic + U-Boot payload. In general, if the option is used, the default + would be "$(top)/src/mainboard/$(MAINBOARDDIR)/config_uboot" + +config PAYLOAD_FILE + default "payloads/external/U-Boot/u-boot/u-boot-dtb.bin" + +config PAYLOAD_OPTIONS + default "-l 0x1110000 -e 0x1110015" + +endif diff --git a/payloads/external/U-Boot/Kconfig.name b/payloads/external/U-Boot/Kconfig.name new file mode 100644 index 0000000..960869a --- /dev/null +++ b/payloads/external/U-Boot/Kconfig.name @@ -0,0 +1,11 @@ +config PAYLOAD_UBOOT + bool "U-Boot" + depends on ARCH_X86 + help + Select this option if you want to build a coreboot image + with a U-Boot payload. + + See http://coreboot.org/Payloads and U-Boot's documentation + at http://git.denx.de/?p=u-boot.git;a=blob;f=doc/README.x86 + for more information. + diff --git a/payloads/external/U-Boot/Makefile.inc b/payloads/external/U-Boot/Makefile.inc new file mode 100644 index 0000000..84b64d8 --- /dev/null +++ b/payloads/external/U-Boot/Makefile.inc @@ -0,0 +1,68 @@ +## +## This file is part of the coreboot project. +## +## Copyright (C) 2015 Google Inc. +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; version 2 of the License. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## + +TAG-$(CONFIG_UBOOT_MASTER)=origin/master +TAG-$(CONFIG_UBOOT_STABLE)=5ec0003b19cbdf06ccd6941237cbc0d1c3468e2d + +project_name=U-Boot +project_dir=u-boot +project_git_repo=http://git.denx.de/u-boot.git +project_config_file=$(project_dir)/.config + +unexport KCONFIG_AUTOHEADER +unexport KCONFIG_AUTOCONFIG +unexport KCONFIG_DEPENDENCIES +unexport KCONFIG_SPLITCONFIG +unexport KCONFIG_TRISTATE +unexport KCONFIG_NEGATIVES + +all: build + +$(project_dir): + echo " Cloning $(project_name) from Git" + git clone $(project_git_repo) $(project_dir) + +fetch: $(project_dir) + cd $(project_dir); git show $(TAG-y) >/dev/null 2>&1 ; if [ $$? -ne 0 ]; \ + then echo " Fetching new commits from the $(project_name) git repo"; git fetch; fi + +checkout: fetch + echo " Checking out $(project_name) revision $(TAG-y)" + cd $(project_dir); git checkout master; git branch -D coreboot 2>/dev/null; git checkout -b coreboot $(TAG-y) + +config: checkout + rm -f $(project_config_file) +ifneq ($(CONFIG_PAYLOAD_CONFIGFILE),) +ifneq ("$(wildcard $(CONFIG_PAYLOAD_CONFIGFILE))","") + cat $(CONFIG_PAYLOAD_CONFIGFILE)" >> $(project_config_file) +else + echo "Error: File $(CONFIG_PAYLOAD_CONFIGFILE) does not exist" + false +endif +endif + cat $(project_dir)/configs/coreboot-x86_defconfig >> $(project_config_file) + $(MAKE) -C $(project_dir) olddefconfig + +build: config + echo " MAKE $(project_name) $(TAG-y)" + $(MAKE) -C $(project_dir) + +clean: + test -d $(project_dir) && $(MAKE) -C $(project_dir) clean || exit 0 + +distclean: + rm -rf $(project_dir) + +.PHONY: checkout config build clean distclean clone fetch diff --git a/src/Kconfig b/src/Kconfig index 818eb59..13de1f4 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -716,6 +716,18 @@ config COMPRESSED_PAYLOAD_LZMA In order to reduce the size payloads take up in the ROM chip coreboot can compress them using the LZMA algorithm.
+config PAYLOAD_OPTIONS + string + default "" + help + Additional cbfstool options for the payload + +config PAYLOAD_IS_FLAT_BINARY + def_bool n + help + Add the payload to cbfs as a flat binary type instead of as an + elf payload + endmenu
menu "Debugging"