summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeif Lindholm <leif.lindholm@linaro.org>2016-09-27 02:22:02 +0100
committerLeif Lindholm <leif.lindholm@linaro.org>2016-09-27 02:30:24 +0100
commitea156387e47a960a8d659f05f2efeda859c388d9 (patch)
tree62a8cdb7d9a789d5cc9f43626b5c5c6249f258ea
parent284f1722cdb81f0d3fca99592d37d635c0c8b29f (diff)
uefi-build.sh: enable building standalone drivers/applications
New option -A specifies which architecture to build for, if no architecture is specified in platforms.config. New optional config option INF specifies which component of a specific platform should be built. Also add a stanza for 'hello', building the MdeModulePkg HelloWorld app for the architecture specified with -A. Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
-rw-r--r--platforms.config7
-rwxr-xr-xuefi-build.sh39
2 files changed, 37 insertions, 9 deletions
diff --git a/platforms.config b/platforms.config
index 2bed04b..ece954f 100644
--- a/platforms.config
+++ b/platforms.config
@@ -57,6 +57,8 @@
# - PREBUILD_CMDS Any commands you want to execute before the build step.
# - POSTBUILD_CMDS Any commands you want to execute after the build step.
# - PACKAGES_PATH Additional directories to search for packages under.
+# - INF Point to a .inf (in addition to a .dsc) in order to
+# build a single component (standalone driver/app).
#
[juno]
@@ -233,3 +235,8 @@ ARCH=AARCH64
LONGNAME=OVMF Qemu X64
DSC=OvmfPkg/OvmfPkgX64.dsc
ARCH=X64
+
+[hello]
+LONGNAME=EDK2 Hello World Example
+DSC=MdeModulePkg/MdeModulePkg.dsc
+INF=MdeModulePkg/Application/HelloWorld/HelloWorld.inf
diff --git a/uefi-build.sh b/uefi-build.sh
index e57c78c..d8ad81a 100755
--- a/uefi-build.sh
+++ b/uefi-build.sh
@@ -23,7 +23,7 @@ OPENSSL_CONFIGURED=FALSE
# Number of threads to use for build
export NUM_THREADS=$((`getconf _NPROCESSORS_ONLN` + 1))
-function build_platform
+function do_build
{
PLATFORM_NAME="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $board get -o longname`"
PLATFORM_PREBUILD_CMDS="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $board get -o prebuild_cmds`"
@@ -31,9 +31,23 @@ function build_platform
PLATFORM_BUILDFLAGS="$PLATFORM_BUILDFLAGS ${EXTRA_OPTIONS[@]}"
PLATFORM_BUILDCMD="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $board get -o buildcmd`"
PLATFORM_DSC="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $board get -o dsc`"
- PLATFORM_ARCH="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $board get -o arch`"
PLATFORM_PACKAGES_PATH="$PWD"
+ COMPONENT_INF="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $board get -o inf`"
+ PLATFORM_ARCH="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $board get -o arch`"
+ if [ -n "$PLATFORM_ARCH" ]; then
+ if [ -n "$DEFAULT_PLATFORM_ARCH" -a "$DEFAULT_PLATFORM_ARCH" != "$PLATFORM_ARCH" ]; then
+ echo "Command line specified architecture '$DEFAULT_PLATFORM_ARCH'" >&2
+ echo "differs from config file specified '$PLATFORM_ARCH'" >&2
+ return 1
+ fi
+ else
+ if [ ! -n "$DEFAULT_PLATFORM_ARCH" ]; then
+ echo "Unknown target architecture - aborting!" >&2
+ return 1
+ fi
+ PLATFORM_ARCH="$DEFAULT_PLATFORM_ARCH"
+ fi
TEMP_PACKAGES_PATH="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $board get -o packages_path`"
if [ -n "$TEMP_PACKAGES_PATH" ]; then
IFS=:
@@ -94,14 +108,17 @@ function build_platform
echo "Run pre build commands"
eval ${PLATFORM_PREBUILD_CMDS}
fi
- if [ X"$PLATFORM_BUILDCMD" == X"" ]; then
- echo ${TOOLCHAIN}_${PLATFORM_ARCH}_PREFIX=$CROSS_COMPILE build -n $NUM_THREADS -a "$PLATFORM_ARCH" -t ${TOOLCHAIN} -p "$PLATFORM_DSC" -b "$target" \
- ${PLATFORM_BUILDFLAGS}
- build -n $NUM_THREADS -a "$PLATFORM_ARCH" -t ${TOOLCHAIN} -p "$PLATFORM_DSC" -b "$target" \
- ${PLATFORM_BUILDFLAGS}
+
+ if [ -n "$COMPONENT_INF" ]; then
+ # Build a standalone component
+ build -n $NUM_THREADS -a "$PLATFORM_ARCH" -t ${TOOLCHAIN} -p "$PLATFORM_DSC" \
+ -m "$COMPONENT_INF" -b "$target" ${PLATFORM_BUILDFLAGS}
else
- ${PLATFORM_BUILDCMD} -b "$target" ${PLATFORM_BUILDFLAGS}
+ # Build a platform
+ build -n $NUM_THREADS -a "$PLATFORM_ARCH" -t ${TOOLCHAIN} -p "$PLATFORM_DSC" \
+ -b "$target" ${PLATFORM_BUILDFLAGS}
fi
+
RESULT=$?
if [ $RESULT -eq 0 ]; then
if [ X"$TOS_DIR" != X"" ]; then
@@ -229,6 +246,10 @@ while [ "$1" != "" ]; do
shift
ATF_DIR="$1"
;;
+ "-A" )
+ shift
+ DEFAULT_PLATFORM_ARCH="$1"
+ ;;
"-c" )
# Already parsed above - skip this + option
shift
@@ -329,7 +350,7 @@ if [ X"$TOOLCHAIN" = X"" ]; then
fi
for board in "${builds[@]}" ; do
- build_platform
+ do_build
done
result_print