From 81a7f18b8635c16247731265032257820fdcd635 Mon Sep 17 00:00:00 2001 From: Trammell hudson Date: Wed, 20 Sep 2017 14:26:38 -0400 Subject: [PATCH] build edk2 as a module for the r630 NERF firmware --- config/edk2.config | 72 ++++++++++++++++++++++++++++++++++++++++++++ config/edk2.makefile | 32 ++++++++++++++++++++ config/r630.config | 4 ++- modules/edk2 | 31 +++++++++++++++++++ 4 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 config/edk2.config create mode 100644 config/edk2.makefile create mode 100644 modules/edk2 diff --git a/config/edk2.config b/config/edk2.config new file mode 100644 index 00000000..1d4d8495 --- /dev/null +++ b/config/edk2.config @@ -0,0 +1,72 @@ +# +# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php + +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# +# ALL Paths are Relative to WORKSPACE + +# Separate multiple LIST entries with a SINGLE SPACE character, do not use comma characters. +# Un-set an option by either commenting out the line, or not setting a value. + +# +# PROPERTY Type Use Description +# ---------------- -------- -------- ----------------------------------------------------------- +# ACTIVE_PLATFORM Filename Recommended Specify the WORKSPACE relative Path and Filename +# of the platform description file that will be used for the +# build. This line is required if and only if the current +# working directory does not contain one or more description +# files. +ACTIVE_PLATFORM = MdeModulePkg/MdeModulePkg.dsc + +# TARGET List Optional Zero or more of the following: DEBUG, RELEASE, NOOPT +# UserDefined; separated by a space character. +# If the line is missing or no value is specified, all +# valid targets specified in the platform description file +# will attempt to be built. The following line will build +# DEBUG platform target. +TARGET = DEBUG + +# TARGET_ARCH List Optional What kind of architecture is the binary being target for. +# One, or more, of the following, IA32, IPF, X64, EBC, ARM +# or AArch64. +# Multiple values can be specified on a single line, using +# space charaters to separate the values. These are used +# during the parsing of a platform description file, +# restricting the build output target(s.) +# The Build Target ARCH is determined by (precedence high to low): +# Command-line: -a ARCH option +# target.txt: TARGET_ARCH values +# DSC file: [Defines] SUPPORTED_ARCHITECTURES tag +# If not specified, then all valid architectures specified +# in the platform file, for which tools are available, will be +# built. +TARGET_ARCH = X64 + +# TOOL_DEFINITION_FILE Filename Optional Specify the name of the filename to use for specifying +# the tools to use for the build. If not specified, +# WORKSPACE/Conf/tools_def.txt will be used for the build. +TOOL_CHAIN_CONF = Conf/tools_def.txt + +# TAGNAME List Optional Specify the name(s) of the tools_def.txt TagName to use. +# If not specified, all applicable TagName tools will be +# used for the build. The list uses space character separation. +TOOL_CHAIN_TAG = GCC5 + +# MAX_CONCURRENT_THREAD_NUMBER NUMBER Optional The number of concurrent threads. Recommend to set this +# value to one more than the number of your compurter +# cores or CPUs. Less than 2 means disable multithread build. +MAX_CONCURRENT_THREAD_NUMBER = 10 + + +# BUILD_RULE_CONF Filename Optional Specify the file name to use for the build rules that are followed +# when generating Makefiles. If not specified, the file: +# WORKSPACE/Conf/build_rule.txt will be used +BUILD_RULE_CONF = Conf/build_rule.txt + diff --git a/config/edk2.makefile b/config/edk2.makefile new file mode 100644 index 00000000..54b0491c --- /dev/null +++ b/config/edk2.makefile @@ -0,0 +1,32 @@ +# Wrapper around the edk2 "build" script to generate +# the few files that we actually want and avoid rebuilding +# if we don't have to. + +PWD := $(shell pwd) +EDK2_OUTPUT_DIR := $(PWD)/Build/MdeModule/DEBUG_GCC5/X64/MdeModulePkg/Core +EDK2_BIN_DIR := $(PWD)/BaseTools/BinWrappers/PosixLike + +export PATH := $(EDK2_BIN_DIR):$(PATH) +export CONFIG_PATH := $(PWD)/Conf +export EDK_TOOLS_PATH := $(PWD)/BaseTools +export WORKSPACE := $(PWD) + +EDK2_BINS += Dxe/DxeMain/DEBUG/DxeCore.efi +EDK2_BINS += RuntimeDxe/RuntimeDxe/DEBUG/RuntimeDxe.efi + +EDK2_OUTPUTS = $(addprefix $(EDK2_OUTPUT_DIR)/,$(EDK2_BINS)) + +# build takes too long, so we check to see if our executables exist +# before we start a build. run the clean target if they must be rebuilt +all: $(EDK2_OUTPUTS) + ls -Fla $(EDK2_OUTPUTS) + cp -a $(EDK2_OUTPUTS) . + +$(EDK2_OUTPUTS): + build + +clean: + $(RM) $(EDK2_OUTPUTS) + +real-clean: clean + build clean diff --git a/config/r630.config b/config/r630.config index 106df613..bc9af44e 100644 --- a/config/r630.config +++ b/config/r630.config @@ -1,7 +1,9 @@ # Configuration for a Dell R630 # flashrom doesn't work on this mainboard # and it is NERF, not coreboot. -BOARD=x230 +BOARD=r630 + +CONFIG_EDK2=y #CONFIG_CRYPTSETUP=y #CONFIG_FLASHROM=y diff --git a/modules/edk2 b/modules/edk2 new file mode 100644 index 00000000..54c64d56 --- /dev/null +++ b/modules/edk2 @@ -0,0 +1,31 @@ +# This is only needed for building NERF firmware +# coreboot systems do not require this tree +modules-$(CONFIG_EDK2) += edk2 + +edk2_branch := UDK2017 +edk2_version := git +edk2_repo := --branch $(edk2_branch) --depth 1 https://github.com/tianocore/edk2 +edk2_dir := edk2-$(edk2_branch) + +# we don't build with our cross compiler since there isn't a host versus +# target difference in their makefiles. +#edk2_depends := musl-cross + +edk2_configure := \ + $(MAKE) \ + -C BaseTools \ + && pwd \ + && cp ../../config/edk2.config ./Conf/target.txt \ + && cp ../../config/edk2.makefile ./Makefile \ + && . ./edksetup.sh + +edk2_target := \ + all + +NO:=\ + obj=./$(BOARD) \ + DOTCONFIG=../../config/edk2-$(BOARD).config \ + BUILD_TIMELESS=1 \ + CFLAGS_x86_32="$(EXTRA_FLAGS)" \ + CFLAGS_x86_64="$(EXTRA_FLAGS)" \ + $(MAKE_JOBS)