From 2c10dfd52dcc14a796900d5a46636a5e5555dfd5 Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Fri, 10 Jul 2020 18:54:34 -0700 Subject: [PATCH 1/4] scripts: xtensa-build-all: print usage when no args passed Print usage when no arguments are passed to the script. Signed-off-by: Ranjani Sridharan --- scripts/xtensa-build-all.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/xtensa-build-all.sh b/scripts/xtensa-build-all.sh index bbdea6328faf..1a04f66555af 100755 --- a/scripts/xtensa-build-all.sh +++ b/scripts/xtensa-build-all.sh @@ -77,6 +77,7 @@ if [ ${#PLATFORMS[@]} -eq 0 ]; then echo "Error: No platforms specified. Supported are: " \ "${SUPPORTED_PLATFORMS[*]}" + print_usage exit 1 fi From d66d2f3a9b6315b52924196615b8bd7465c73a59 Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Fri, 10 Jul 2020 19:00:10 -0700 Subject: [PATCH 2/4] scripts: xtensa-build-all: add support for override config files Some platforms needs platform-specific configuration that override the default config. For example, chrome platforms need the LPS to be enabled by default for maximizing the power savings for the WoV feature. Add a -o switch to allow specifying the override config file. Signed-off-by: Ranjani Sridharan --- scripts/xtensa-build-all.sh | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/scripts/xtensa-build-all.sh b/scripts/xtensa-build-all.sh index 1a04f66555af..f8f71e522cdc 100755 --- a/scripts/xtensa-build-all.sh +++ b/scripts/xtensa-build-all.sh @@ -18,6 +18,15 @@ PATH=$pwd/local/bin:$PATH pwd=$(pwd) +die() +{ + >&2 printf '%s ERROR: ' "$0" + # We want die() to be usable exactly like printf + # shellcheck disable=SC2059 + >&2 printf "$@" + exit 1 +} + print_usage() { cat <> override.config From 503ff069ce5575f5fcac1e322e3017dac998decc Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Thu, 17 Sep 2020 19:40:32 +0000 Subject: [PATCH 3/4] cmake: empty MEU_OPENSSL param is now the same as not defined For convenience, let users pass the location of their MEU_OPENSSL tool even when they don't use it. Silence the corresponding warning. See https://cmake.org/pipermail/cmake/2011-February/042933.html for the rationale. Note this may fail if you install openssl in a relative directory called "FALSE". Don't do that. Signed-off-by: Marc Herbert --- src/arch/xtensa/CMakeLists.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/arch/xtensa/CMakeLists.txt b/src/arch/xtensa/CMakeLists.txt index 2f08553ac8fc..d664ed5f0592 100644 --- a/src/arch/xtensa/CMakeLists.txt +++ b/src/arch/xtensa/CMakeLists.txt @@ -368,6 +368,13 @@ if(NOT DEFINED RIMAGE_IMR_TYPE) set(RIMAGE_IMR_TYPE 3) endif() +if(NOT MEU_OPENSSL) + set(MEU_OPENSSL "/usr/bin/openssl") +endif() +# Don't ask users to keep secret their openssl location depending on +# what they build in the moment. +set(silenceUnusedWarning "${MEU_OPENSSL}") + if(MEU_PATH OR DEFINED MEU_NO_SIGN) if(NOT DEFINED MEU_OFFSET) execute_process( @@ -410,10 +417,6 @@ if(MEU_PATH OR DEFINED MEU_NO_SIGN) add_dependencies(run_rimage run_smex) endif() - if(NOT DEFINED MEU_OPENSSL) - set(MEU_OPENSSL "/usr/bin/openssl") - endif() - if(NOT DEFINED MEU_FLAGS) set(MEU_FLAGS -f ${MEU_PATH}/generic_meu_conf.xml From e2a355a7a4970787bef1447141d65e325956d21e Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Fri, 10 Jul 2020 19:46:13 -0700 Subject: [PATCH 4/4] scripts: xtensa-build-all: Add support for building TGL and signing with MEU Add support for building TGL FW and signing with MEU tool. Signing with rimage is not supported atm. Signed-off-by: Ranjani Sridharan --- scripts/xtensa-build-all.sh | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/scripts/xtensa-build-all.sh b/scripts/xtensa-build-all.sh index f8f71e522cdc..c74a97c8d22c 100755 --- a/scripts/xtensa-build-all.sh +++ b/scripts/xtensa-build-all.sh @@ -45,12 +45,13 @@ usage: xtensa-build.sh [options] platform(s) -v Verbose Makefile log -j n Set number of make build jobs. Jobs=#cores when no flag. \ Infinte when not specified. + -m path to MEU tool. Switches signing step to use MEU instead of rimage. Supported platforms ${SUPPORTED_PLATFORMS[*]} EOF } # parse the args -while getopts "rudj:ckvo:a" OPTION; do +while getopts "rudj:ckvao:m:" OPTION; do case "$OPTION" in r) BUILD_ROM=yes ;; u) BUILD_FORCE_UP=yes ;; @@ -61,17 +62,28 @@ while getopts "rudj:ckvo:a" OPTION; do o) OVERRIDE_CONFIG=$OPTARG ;; v) BUILD_VERBOSE='VERBOSE=1' ;; a) PLATFORMS=("${SUPPORTED_PLATFORMS[@]}") ;; + m) MEU_TOOL_PATH=$OPTARG ;; *) print_usage; exit 1 ;; esac done shift $((OPTIND-1)) +#default signing tool +SIGNING_TOOL=RIMAGE + if [ -n "${OVERRIDE_CONFIG}" ] then OVERRIDE_CONFIG="src/arch/xtensa/configs/override/$OVERRIDE_CONFIG.config" [ -f "${OVERRIDE_CONFIG}" ] || die 'Invalid override config file %s\n' "${OVERRIDE_CONFIG}" fi +if [ -n "${MEU_TOOL_PATH}" ] +then + [ -d "${MEU_TOOL_PATH}" ] || die 'Invalid MEU TOOL PATH %s\n' "${MEU_TOOL_PATH}" + MEU_PATH_OPTION=-DMEU_PATH="${MEU_TOOL_PATH}" + SIGNING_TOOL=MEU +fi + # parse platform args for arg in "$@"; do platform=none @@ -219,10 +231,15 @@ do tgl) PLATFORM="tigerlake" ARCH="xtensa-smp" - XTENSA_CORE="X6H3CNL_2017_8" + XTENSA_CORE="cavs2x_LX6HiFi3_2017_8" HOST="xtensa-cnl-elf" XTENSA_TOOLS_VERSION="RG-2017.8-linux" HAVE_ROM='yes' + # default key for TGL + if [ -z "$PRIVATE_KEY_OPTION" ] + then + PRIVATE_KEY_OPTION="-D${SIGNING_TOOL}_PRIVATE_KEY=$pwd/keys/otc_private_key_3k.pem" + fi ;; jsl) PLATFORM="jasperlake" @@ -306,6 +323,8 @@ do ( set -x # log the main commands and their parameters cmake -DTOOLCHAIN="$TOOLCHAIN" \ -DROOT_DIR="$ROOT" \ + -DMEU_OPENSSL="${MEU_OPENSSL}" \ + "${MEU_PATH_OPTION}" \ "${PRIVATE_KEY_OPTION}" \ .. @@ -344,13 +363,15 @@ do make overrideconfig fi - if [ 'tgl' != "${platform}" ]; then - make bin -j "${BUILD_JOBS}" ${BUILD_VERBOSE} - else # FIXME: finish gcc support for tgl + # TGL needs MEU tool for signing + if [ 'tgl' = "${platform}" ] && [ "${SIGNING_TOOL}" = "RIMAGE" ] + then # build unsigned FW binary make sof -j "${BUILD_JOBS}" ${BUILD_VERBOSE} if [ "$BUILD_ROM" = "yes" ]; then make rom_dump ${BUILD_VERBOSE} fi + else # build signed FW binary + make bin -j "${BUILD_JOBS}" ${BUILD_VERBOSE} fi cd "$WORKDIR"