summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Roth <martinroth@google.com>2015-12-11 12:24:33 -0700
committerMartin Roth <martinroth@google.com>2016-02-18 20:53:42 +0100
commitdbae4d03ef6f1915a9508116e1bc9777f4ba33ec (patch)
treec3e80fb4395087c734a3bcba65120805bb966296
parent654fd0703ad8f785faa49b22bf59036c6eb47f6c (diff)
downloadcoreboot-dbae4d03ef6f1915a9508116e1bc9777f4ba33ec.tar.xz
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. Graphics worked in U-Boot correctly by initializing the VBIOS and setting up a console mode. Tested in QEMU and on Minnowboard Max. Got into U-Boot, have not booted an OS yet. Change-Id: Ia122a4ad7cd7d96107c1552b0376c8106ca8fb92 Signed-off-by: Martin Roth <martinroth@google.com> Signed-off-by: Lee Leahy <leroy.p.leahy@intel.com> Reviewed-on: https://review.coreboot.org/12714 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
-rw-r--r--.gitignore1
-rw-r--r--Makefile.inc15
-rw-r--r--payloads/Kconfig12
-rw-r--r--payloads/external/Makefile.inc5
-rw-r--r--payloads/external/U-Boot/Kconfig40
-rw-r--r--payloads/external/U-Boot/Kconfig.name11
-rw-r--r--payloads/external/U-Boot/Makefile.inc82
7 files changed, 164 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 114d78fc8e..581c4a4a3f 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 8f45fc29ce..b8cba07bb0 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -448,6 +448,7 @@ clean-for-update-target:
rm -f $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.* $(obj)/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*
@@ -590,10 +591,13 @@ endif
# $(call cbfs-add-cmd-for-region,file in extract_nth format,region name)
define cbfs-add-cmd-for-region
$(CBFSTOOL) $@.tmp \
- add$(if $(filter stage,$(call extract_nth,3,$(1))),-stage)$(if $(filter payload,$(call extract_nth,3,$(1))),-payload) \
+ add$(if $(filter stage,$(call extract_nth,3,$(1))),-stage)$(if \
+ $(filter payload,$(call extract_nth,3,$(1))),-payload)$(if \
+ $(filter flat-binary,$(call extract_nth,3,$(1))),-flat-binary) \
-f $(call extract_nth,1,$(1)) \
-n $(call extract_nth,2,$(1)) \
- $(if $(filter-out stage,$(call extract_nth,3,$(1))),-t $(call extract_nth,3,$(1))) \
+ $(if $(filter-out flat-binary,$(filter-out stage,$(call \
+ extract_nth,3,$(1)))),-t $(call extract_nth,3,$(1))) \
$(if $(call extract_nth,4,$(1)),-c $(call extract_nth,4,$(1))) \
$(cbfs-autogen-attributes) \
-r $(2) \
@@ -730,6 +734,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
@@ -790,7 +797,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/Kconfig b/payloads/Kconfig
index 51c89eae45..9037b30a67 100644
--- a/payloads/Kconfig
+++ b/payloads/Kconfig
@@ -47,5 +47,17 @@ 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
diff --git a/payloads/external/Makefile.inc b/payloads/external/Makefile.inc
index 37435071ce..6a76020ffe 100644
--- a/payloads/external/Makefile.inc
+++ b/payloads/external/Makefile.inc
@@ -77,3 +77,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: $(top)/$(DOTCONFIG)
+ $(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 0000000000..2afe1cd5e1
--- /dev/null
+++ b/payloads/external/U-Boot/Kconfig
@@ -0,0 +1,40 @@
+if PAYLOAD_UBOOT
+
+config PAYLOAD_SPECIFIC_OPTIONS # dummy
+ def_bool y
+ select PAYLOAD_IS_FLAT_BINARY
+
+choice
+ prompt "U-Boot version"
+ default UBOOT_STABLE
+
+config UBOOT_STABLE
+ bool "v2016.1"
+ 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"
+ for a config stored in the coreboot mainboard directory, or
+ "$(project_dir)/configs/coreboot-x86_defconfig" to use a config
+ from the U-Boot config directory
+
+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 0000000000..2e6a64c2ad
--- /dev/null
+++ b/payloads/external/U-Boot/Kconfig.name
@@ -0,0 +1,11 @@
+config PAYLOAD_UBOOT
+ bool "U-Boot (Experimental)"
+ 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 0000000000..f0abee170e
--- /dev/null
+++ b/payloads/external/U-Boot/Makefile.inc
@@ -0,0 +1,82 @@
+##
+## 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.
+##
+
+# 2016-1 tag
+STABLE_COMMIT_ID=fa85e826c16b9ce1ad302a57e9c4b24db0d8b930
+
+TAG-$(CONFIG_UBOOT_MASTER)=origin/master
+TAG-$(CONFIG_UBOOT_STABLE)=$(STABLE_COMMIT_ID)
+
+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)
+ifeq ($(CONFIG_UBOOT_MASTER),y)
+ echo " Fetching new commits from the $(project_name) git repo"
+ git fetch
+
+ #master doesn't get a file, so it's continuously updated
+ rm -f $(project_dir)/$(STABLE_COMMIT_ID)
+else
+ 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
+ touch $(project_dir)/$(STABLE_COMMIT_ID)
+endif
+
+$(project_dir)/$(TAG-y): 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: $(project_dir)/$(TAG-y)
+ 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
+else
+ cat $(project_dir)/configs/coreboot-x86_defconfig >> $(project_config_file)
+endif
+
+ $(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: config build clean distclean fetch