summaryrefslogtreecommitdiff
path: root/payloads/external
diff options
context:
space:
mode:
authorSean Rhodes <sean@starlabs.systems>2022-02-04 07:41:16 +0000
committerMartin Roth - Personal <martinroth@google.com>2022-02-22 18:53:17 +0000
commit0884f21042de35645f0d08641b9a2669b3a7843c (patch)
tree67b66b0dcf202f133855c08b20c217a1ec2d40f1 /payloads/external
parente0e6f07220bdf33b224a7f62e1625f41e3d4d89b (diff)
payloads/tianocore: Rework Makefile
Rework edkii makefile so that the various build options are unified between CorebootPayloadPkg, uefipayload_202107 and upstream. This sets the project directory based on the git repository name i.e. https://github.com/mrchromebox/edk2 becomes mrchomebox Also builds to $(obj)/UEFIPAYLOAD.fd and allows using a commit ID without a branch. Signed-off-by: Sean Rhodes <sean@starlabs.systems> Change-Id: I3cc274e7385dd71c2aae315162cc48444b7eaa5f Reviewed-on: https://review.coreboot.org/c/coreboot/+/61620 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-by: Martin Roth - Personal <martinroth@google.com>
Diffstat (limited to 'payloads/external')
-rw-r--r--payloads/external/Makefile.inc16
-rw-r--r--payloads/external/tianocore/Kconfig87
-rw-r--r--payloads/external/tianocore/Makefile115
3 files changed, 118 insertions, 100 deletions
diff --git a/payloads/external/Makefile.inc b/payloads/external/Makefile.inc
index 836dda2d3c..5c15af5192 100644
--- a/payloads/external/Makefile.inc
+++ b/payloads/external/Makefile.inc
@@ -136,22 +136,23 @@ payloads/external/depthcharge/depthcharge/build/depthcharge.elf depthcharge: $(D
# Tianocore
-payloads/external/tianocore/tianocore/Build/UEFIPAYLOAD.fd tianocore: $(DOTCONFIG)
+$(obj)/UEFIPAYLOAD.fd tianocore: $(DOTCONFIG)
$(MAKE) -C payloads/external/tianocore all \
HOSTCC="$(HOSTCC)" \
CC="$(HOSTCC)" \
- CONFIG_TIANOCORE_REVISION_ID=$(CONFIG_TIANOCORE_REVISION_ID) \
- CONFIG_TIANOCORE_DEBUG=$(CONFIG_TIANOCORE_DEBUG) \
- CONFIG_TIANOCORE_TARGET_IA32=$(CONFIG_TIANOCORE_TARGET_IA32) \
- CONFIG_TIANOCORE_BOOTSPLASH_FILE=$(CONFIG_TIANOCORE_BOOTSPLASH_FILE) \
+ CONFIG_TIANOCORE_REPOSITORY=$(CONFIG_TIANOCORE_REPOSITORY) \
+ CONFIG_TIANOCORE_TAG_OR_REV=$(CONFIG_TIANOCORE_TAG_OR_REV) \
CONFIG_TIANOCORE_UEFIPAYLOAD=$(CONFIG_TIANOCORE_UEFIPAYLOAD) \
CONFIG_TIANOCORE_UPSTREAM=$(CONFIG_TIANOCORE_UPSTREAM) \
- CONFIG_ECAM_MMCONF_BASE_ADDRESS=$(CONFIG_ECAM_MMCONF_BASE_ADDRESS) \
+ CONFIG_TIANOCORE_COREBOOTPAYLOAD=$(CONFIG_TIANOCORE_COREBOOTPAYLOAD) \
+ CONFIG_TIANOCORE_DEBUG=$(CONFIG_TIANOCORE_DEBUG) \
+ CONFIG_TIANOCORE_RELEASE=$(CONFIG_TIANOCORE_RELEASE) \
CONFIG_TIANOCORE_ABOVE_4G_MEMORY=$(CONFIG_TIANOCORE_ABOVE_4G_MEMORY) \
+ CONFIG_TIANOCORE_BOOTSPLASH_FILE=$(CONFIG_TIANOCORE_BOOTSPLASH_FILE) \
CONFIG_TIANOCORE_BOOT_TIMEOUT=$(CONFIG_TIANOCORE_BOOT_TIMEOUT) \
CONFIG_TIANOCORE_CBMEM_LOGGING=$(CONFIG_TIANOCORE_CBMEM_LOGGING) \
- CONFIG_TIANOCORE_COREBOOTPAYLOAD=$(CONFIG_TIANOCORE_COREBOOTPAYLOAD) \
CONFIG_TIANOCORE_USE_8254_TIMER=$(CONFIG_TIANOCORE_USE_8254_TIMER) \
+ CONFIG_ECAM_MMCONF_BASE_ADDRESS=$(CONFIG_ECAM_MMCONF_BASE_ADDRESS) \
GCC_CC_x86_32=$(GCC_CC_x86_32) \
GCC_CC_x86_64=$(GCC_CC_x86_64) \
GCC_CC_arm=$(GCC_CC_arm) \
@@ -161,6 +162,7 @@ payloads/external/tianocore/tianocore/Build/UEFIPAYLOAD.fd tianocore: $(DOTCONFI
OBJCOPY_arm=$(OBJCOPY_arm) \
OBJCOPY_arm64=$(OBJCOPY_arm64) \
MFLAGS= MAKEFLAGS=
+ mv payloads/external/tianocore/output/UEFIPAYLOAD.fd $@
# FILO
diff --git a/payloads/external/tianocore/Kconfig b/payloads/external/tianocore/Kconfig
index b7069aaddd..2ef77ba480 100644
--- a/payloads/external/tianocore/Kconfig
+++ b/payloads/external/tianocore/Kconfig
@@ -2,7 +2,7 @@ if PAYLOAD_TIANOCORE
config PAYLOAD_FILE
string "Tianocore binary"
- default "payloads/external/tianocore/tianocore/Build/UEFIPAYLOAD.fd"
+ default "$(obj)/UEFIPAYLOAD.fd"
help
The result of a UefiPayloadPkg build
@@ -35,13 +35,30 @@ config TIANOCORE_COREBOOTPAYLOAD
Select this option to build using MrChromebox's older (now deprecated)
CorebootPayloadPkg-based Tianocore branch
+config TIANOCORE_CUSTOM
+ bool "Custom"
+ help
+ Specify your own edk2 repository and branch to use.
+
endchoice
-config TIANOCORE_REVISION_ID
+config TIANOCORE_REPOSITORY
+ string "URL to git repository for edk2"
+ default "https://github.com/tianocore/edk2" if TIANOCORE_UPSTREAM
+ default "https://github.com/mrchromebox/edk2" if TIANOCORE_UEFIPAYLOAD || TIANOCORE_COREBOOTPAYLOAD
+ help
+ coreboot supports an array of build options which can be found below. These options
+ will only have an effect if the relevant options exist in the target repository.
+
+config TIANOCORE_TAG_OR_REV
string "Insert a commit's SHA-1 or a branch name"
+ default "origin/uefipayload_202107" if TIANOCORE_UEFIPAYLOAD
+ default "origin/master" if TIANOCORE_UPSTREAM
+ default "origin/coreboot_fb" if TIANOCORE_COREBOOTPAYLOAD
help
- The commit's SHA-1 or branch name of the revision to use. Choose "upstream/master"
- for master branch of Tianocore release on github.
+ The commit's SHA-1 or branch name of the revision to use. This must exist in
+ TIANOCORE_REPOSITORY, and in the case of a branch name, prefixed with origin i.e.
+ "origin/uefipayload_202202"
choice
prompt "Tianocore build"
@@ -64,32 +81,33 @@ endchoice
if TIANOCORE_UEFIPAYLOAD
-config TIANOCORE_CBMEM_LOGGING
- bool "Enable Tianocore logging to CBMEM"
+config TIANOCORE_ABOVE_4G_MEMORY
+ bool "Enable above 4G memory"
+ default n
help
- Select this option if you want to enable Tianocore logging to CBMEM.
- You may want to increase the default cbmem buffer size when selecting
- this option, especially if using a debug (vs release) build.
- Selecting this option will increase the payload size in CBFS by ~220KB.
+ Select this option to enable Above 4G Decode. This will allow the
+ payload to use all of the memory, rather than an maximum of 4G.
+
+ Disabling memory above 4G is useful for bootloaders that are not
+ fully 64-bit aware such as Qubes R4.0.4 bootloader.
-config TIANOCORE_BOOTSPLASH_IMAGE
- bool "Use a custom bootsplash image"
- help
- Select this option if you have a bootsplash image that you would
- like to be used. If this option is not selected, the default
- coreboot logo (European Brown Hare) will used.
config TIANOCORE_BOOTSPLASH_FILE
string "Tianocore Bootsplash path and filename"
- depends on TIANOCORE_BOOTSPLASH_IMAGE
default "bootsplash.bmp"
help
+ Select this option if you have a bootsplash image that you would
+ like to be used. If this option is not selected, the default
+ coreboot logo (European Brown Hare) will used.
+
The path and filename of the file to use as graphical bootsplash
- image. The file must be an uncompressed BMP.
+ image. The file must be an uncompressed BMP, in BMP 3 format.
+
+ Linux can create these with the below command:
+ `convert splosh.bmp BMP3:splash.bmp`
This image will also be used as the BGRT boot image, which may
- persist through your OS boot process, and will be displayed
- vertically centered 38.2% from the top of the display.
+ persist through your OS boot process.
See ACPI spec 6.3, 5.2.22 Boot Graphics Resource Table (BGRT), and
Microsoft's documentation on BGRT positioning:
@@ -101,16 +119,21 @@ config TIANOCORE_BOOTSPLASH_FILE
If an absolute path is not given, the path will assumed to be
relative to the coreboot root directory.
-config TIANOCORE_ABOVE_4G_MEMORY
- bool "Enable above 4G memory"
- default n
+config TIANOCORE_BOOT_TIMEOUT
+ int
+ default 2
help
- Select this option to enable Above 4G Decode. This will allow the
- payload to use all of the memory, rather than an maximum of 4G.
+ The length of time in seconds for which the boot splash/menu prompt will be displayed.
+ For boards with an internal display, the default value of 2s is generally sufficient.
+ For boards with an external display, a value of 5s is generally sufficient.
- Disabling this option, which will reserve memory above 4G, is
- useful for bootloaders that are not fully 64-bit aware such as
- Qubes R4.0.4 bootloader.
+config TIANOCORE_CBMEM_LOGGING
+ bool "Enable Tianocore logging to CBMEM"
+ help
+ Select this option if you want to enable Tianocore logging to CBMEM.
+ You may want to increase the default cbmem buffer size when selecting
+ this option, especially if using a debug (vs release) build.
+ Selecting this option will increase the payload size in CBFS by 0x10000.
endif
@@ -123,12 +146,4 @@ config TIANOCORE_USE_8254_TIMER
endif
-config TIANOCORE_BOOT_TIMEOUT
- int
- default 2
- help
- The length of time in seconds for which the boot splash/menu prompt will be displayed.
- For boards with an internal display, the default value of 2s is generally sufficient.
- For boards without an internal display, a value of 5s is generally sufficient.
-
endif
diff --git a/payloads/external/tianocore/Makefile b/payloads/external/tianocore/Makefile
index a4ccfc7573..6dbfe7293c 100644
--- a/payloads/external/tianocore/Makefile
+++ b/payloads/external/tianocore/Makefile
@@ -3,84 +3,84 @@
# force the shell to bash - the edksetup.sh script doesn't work with dash
export SHELL := env bash
-project_name=Tianocore
-project_dir=$(CURDIR)/tianocore
-project_git_repo=https://github.com/mrchromebox/edk2
-project_git_branch=uefipayload_202107
-upstream_git_repo=https://github.com/tianocore/edk2
-
-build_flavor=-D BOOTLOADER=COREBOOT -D PCIE_BASE=$(CONFIG_ECAM_MMCONF_BASE_ADDRESS) -DPS2_KEYBOARD_ENABLE
+project_name = Tianocore
+project_dir = $(CURDIR)/$(word 3,$(subst /, ,$(CONFIG_TIANOCORE_REPOSITORY)))
+BUILD_STR = -a IA32 -a X64 -t COREBOOT
ifeq ($(CONFIG_TIANOCORE_COREBOOTPAYLOAD),y)
-project_git_branch=coreboot_fb
-bootloader=CorebootPayloadPkg
+BUILD_STR += -p CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc
else
-bootloader=UefiPayloadPkg
+BUILD_STR += -p UefiPayloadPkg/UefiPayloadPkg.dsc
endif
-
-ifeq ($(CONFIG_TIANOCORE_UPSTREAM),y)
-TAG=upstream/master
-else
-TAG=origin/$(project_git_branch)
+BUILD_STR += -D BOOTLOADER=COREBOOT -q
+
+#
+# EDK II has the following build options relevant to coreboot:
+#
+#
+# OPTION = DEFAULT_VALUE
+#
+# ABOVE_4G_MEMORY = TRUE
+ifneq ($(CONFIG_TIANOCORE_ABOVE_4G_MEMORY),y)
+BUILD_STR += -D ABOVE_4G_MEMORY=FALSE
endif
-
-ifneq ($(CONFIG_TIANOCORE_REVISION_ID),)
-TAG=$(CONFIG_TIANOCORE_REVISION_ID)
+# BOOTSPLASH_IMAGE = FALSE
+ifneq ($(CONFIG_TIANOCORE_BOOTSPLASH_FILE),)
+BUILD_STR += -D BOOTSPLASH_IMAGE=TRUE
endif
-
-export EDK_TOOLS_PATH=$(project_dir)/BaseTools
-
-ifeq ($(CONFIG_TIANOCORE_DEBUG),y)
-BUILD_TYPE=DEBUG
-else
-BUILD_TYPE=RELEASE
+# BUILD_TARGETS = DEBUG
+ifeq ($(CONFIG_TIANOCORE_RELEASE),y)
+BUILD_STR += -b RELEASE
endif
-
+# PLATFORM_BOOT_TIMEOUT = 3
+ifneq ($(TIANOCORE_BOOT_TIMEOUT),)
+BUILD_STR += -D PLATFORM_BOOT_TIMEOUT=$(CONFIG_TIANOCORE_BOOT_TIMEOUT)
+endif
+# USE_CBMEM_FOR_CONSOLE = FALSE
ifeq ($(CONFIG_TIANOCORE_CBMEM_LOGGING),y)
-CBMEM=-D USE_CBMEM_FOR_CONSOLE=TRUE
+BUILD_STR += -D USE_CBMEM_FOR_CONSOLE=TRUE
endif
-
-ifeq ($(CONFIG_TIANOCORE_ABOVE_4G_MEMORY),y)
-4G=-D ABOVE_4G_MEMORY=TRUE
-else
-4G=-D ABOVE_4G_MEMORY=FALSE
+#
+# The below are legacy options only available in CorebootPayloadPkg:
+#
+# PCIE_BASE = 0
+ifneq ($(CONFIG_ECAM_MMCONF_BASE_ADDRESS),)
+BUILD_STR += -D PCIE_BASE=$(CONFIG_ECAM_MMCONF_BASE_ADDRESS)
endif
-
-TIMEOUT=-D PLATFORM_BOOT_TIMEOUT=$(CONFIG_TIANOCORE_BOOT_TIMEOUT)
-
-ifneq ($(CONFIG_TIANOCORE_USE_8254_TIMER), y)
-TIMER=-DUSE_HPET_TIMER
+# USE_HPET_TIMER = FALSE
+ifeq ($(CONFIG_TIANOCORE_USE_8254_TIMER),y)
+BUILD_STR += -D USE_HPET_TIMER=TRUE
endif
-ifeq ($(CONFIG_TIANOCORE_COREBOOTPAYLOAD),y)
-BUILD_STR=-q -a IA32 -a X64 -p CorebootPayloadPkg/CorebootPayloadPkgIa32X64.dsc -t COREBOOT -b $(BUILD_TYPE) $(TIMER) -DPS2_KEYBOARD_ENABLE
-else
-BUILD_STR=-q -a IA32 -a X64 -p UefiPayloadPkg/UefiPayloadPkg.dsc -t COREBOOT -b $(BUILD_TYPE) $(TIMEOUT) $(build_flavor) $(CBMEM) $(4G)
-endif
+bootloader = $(word 8,$(subst /, ,$(BUILD_STR)))
+
+export EDK_TOOLS_PATH=$(project_dir)/BaseTools
all: clean build
$(project_dir):
- echo " Cloning $(project_name) from Git"
- git clone --branch $(project_git_branch) $(project_git_repo) $(project_dir); \
- cd $(project_dir); \
- git remote add upstream $(upstream_git_repo)
+ echo " Cloning $(project_name) from $(CONFIG_TIANOCORE_REPOSITORY)"
+ git clone $(CONFIG_TIANOCORE_REPOSITORY) $(project_dir); \
+ cd $(project_dir);
update: $(project_dir)
+ if [ ! -d "$(project_dir)" ]; then \
+ git clone $(CONFIG_TIANOCORE_REPOSITORY) $(project_dir); \
+ fi
cd $(project_dir); \
- echo " Fetching new commits from the $(project_name) repo"; \
- git fetch --multiple origin upstream 2>/dev/null; \
- if ! git rev-parse --verify -q $(TAG) >/dev/null; then \
- echo " $(TAG) is not a valid git reference"; \
+ echo " Fetching new commits from $(CONFIG_TIANOCORE_REPOSITORY)"; \
+ git fetch origin 2>/dev/null; \
+ if ! git rev-parse --verify -q $(CONFIG_TIANOCORE_TAG_OR_REV) >/dev/null; then \
+ echo " $(CONFIG_TIANOCORE_TAG_OR_REV) is not a valid git reference"; \
exit 1; \
fi; \
if git status --ignore-submodules=dirty | grep -qv clean; then \
- echo " Checking out $(project_name) revision $(TAG)"; \
- git checkout --detach $(TAG); \
+ echo " Checking out $(project_name) revision $(CONFIG_TIANOCORE_TAG_OR_REV)"; \
+ git checkout --detach $(CONFIG_TIANOCORE_TAG_OR_REV) -f; \
else \
echo " Working directory not clean; will not overwrite"; \
fi; \
- git submodule update --init
+ git submodule update --init --checkout
checktools:
echo "Checking uuid-dev..."
@@ -94,8 +94,8 @@ checktools:
( echo " Not found."; echo "Error: Please install nasm."; exit 1 )
build: update checktools
- unset CC; $(MAKE) -C $(project_dir)/BaseTools
- echo " build $(project_name) $(TAG)"
+ unset CC; $(MAKE) -C $(project_dir)/BaseTools 2>&1
+ echo " build $(project_name) $(CONFIG_TIANOCORE_TAG_OR_REV)"
if [ -n "$(CONFIG_TIANOCORE_BOOTSPLASH_FILE)" ]; then \
echo " Copying custom bootsplash image"; \
case "$(CONFIG_TIANOCORE_BOOTSPLASH_FILE)" in \
@@ -114,13 +114,14 @@ build: update checktools
cat ../tools_def.txt >> $(project_dir)/Conf/tools_def.txt; \
fi; \
build $(BUILD_STR); \
- mv $(project_dir)/Build/$(bootloader)*/*/FV/UEFIPAYLOAD.fd $(project_dir)/Build/UEFIPAYLOAD.fd; \
+ mkdir -p $(project_dir)/../output
+ mv $(project_dir)/Build/$(bootloader)*/*/FV/UEFIPAYLOAD.fd $(project_dir)/../output/UEFIPAYLOAD.fd; \
git checkout MdeModulePkg/Logo/Logo.bmp > /dev/null 2>&1 || true
clean:
test -d $(project_dir) && (cd $(project_dir); rm -rf Build; rm -f Conf/tools_def.txt) || exit 0
distclean:
- rm -rf $(project_dir)
+ rm -rf */
.PHONY: all update checktools config build clean distclean