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>
This commit is contained in:
Martin Roth 2015-12-11 12:24:33 -07:00
parent 654fd0703a
commit dbae4d03ef
7 changed files with 164 additions and 2 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ coreboot-builds/
payloads/external/FILO/filo/ payloads/external/FILO/filo/
payloads/external/GRUB2/grub2/ payloads/external/GRUB2/grub2/
payloads/external/SeaBIOS/seabios/ payloads/external/SeaBIOS/seabios/
payloads/external/U-Boot/u-boot/
util/crossgcc/acpica-unix-*/ util/crossgcc/acpica-unix-*/
util/crossgcc/binutils-*/ util/crossgcc/binutils-*/
util/crossgcc/build-*BINUTILS/ util/crossgcc/build-*BINUTILS/

View File

@ -448,6 +448,7 @@ clean-for-update-target:
rm -f $(obj)/mainboard/$(MAINBOARDDIR)/bootblock.* $(obj)/dsdt.* 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 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/SeaBIOS -f Makefile.inc clean
$(MAKE) -C payloads/external/U-Boot -f Makefile.inc clean
clean-target: clean-target:
rm -f $(obj)/coreboot* rm -f $(obj)/coreboot*
@ -590,10 +591,13 @@ endif
# $(call cbfs-add-cmd-for-region,file in extract_nth format,region name) # $(call cbfs-add-cmd-for-region,file in extract_nth format,region name)
define cbfs-add-cmd-for-region define cbfs-add-cmd-for-region
$(CBFSTOOL) $@.tmp \ $(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)) \ -f $(call extract_nth,1,$(1)) \
-n $(call extract_nth,2,$(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))) \ $(if $(call extract_nth,4,$(1)),-c $(call extract_nth,4,$(1))) \
$(cbfs-autogen-attributes) \ $(cbfs-autogen-attributes) \
-r $(2) \ -r $(2) \
@ -730,6 +734,9 @@ ifneq ($(strip $(call strip_quotes,$(CONFIG_LINUX_INITRD))),)
ADDITIONAL_PAYLOAD_CONFIG+=-I $(CONFIG_LINUX_INITRD) ADDITIONAL_PAYLOAD_CONFIG+=-I $(CONFIG_LINUX_INITRD)
endif endif
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) ifeq ($(CONFIG_HAVE_REFCODE_BLOB),y)
REFCODE_BLOB=$(obj)/refcode.rmod REFCODE_BLOB=$(obj)/refcode.rmod
@ -790,7 +797,11 @@ $(CONFIG_CBFS_PREFIX)/ramstage-compression := $(CBFS_COMPRESS_FLAG)
cbfs-files-y += $(CONFIG_CBFS_PREFIX)/payload cbfs-files-y += $(CONFIG_CBFS_PREFIX)/payload
$(CONFIG_CBFS_PREFIX)/payload-file := $(CONFIG_PAYLOAD_FILE) $(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 $(CONFIG_CBFS_PREFIX)/payload-type := payload
endif
$(CONFIG_CBFS_PREFIX)/payload-compression := $(CBFS_PAYLOAD_COMPRESS_FLAG) $(CONFIG_CBFS_PREFIX)/payload-compression := $(CBFS_PAYLOAD_COMPRESS_FLAG)
$(CONFIG_CBFS_PREFIX)/payload-options := $(ADDITIONAL_PAYLOAD_CONFIG) $(CONFIG_CBFS_PREFIX)/payload-options := $(ADDITIONAL_PAYLOAD_CONFIG)

View File

@ -47,5 +47,17 @@ config COMPRESSED_PAYLOAD_LZMA
In order to reduce the size payloads take up in the ROM chip In order to reduce the size payloads take up in the ROM chip
coreboot can compress them using the LZMA algorithm. 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 endmenu

View File

@ -77,3 +77,8 @@ grub2:
CONFIG_GRUB2_MASTER=$(CONFIG_GRUB2_MASTER) CONFIG_GRUB2_MASTER=$(CONFIG_GRUB2_MASTER)
payloads/external/GRUB2/grub2/build/default_payload.elf: grub2 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)

40
payloads/external/U-Boot/Kconfig vendored Normal file
View File

@ -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

11
payloads/external/U-Boot/Kconfig.name vendored Normal file
View File

@ -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.

82
payloads/external/U-Boot/Makefile.inc vendored Normal file
View File

@ -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