From 1723e9180a52e017229787ddeb9498452da3b046 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Thu, 22 Jul 2021 02:19:02 +0000 Subject: [PATCH 1/2] xtensa-build-zephyr: better help and error message when -p is required -p is required when the real (not symbolic) directories are not nested in one another. The documentation gap was clearly demonstrated by me getting confused even though _I_ implemented this logic some time back. Signed-off-by: Marc Herbert --- scripts/xtensa-build-zephyr.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/scripts/xtensa-build-zephyr.sh b/scripts/xtensa-build-zephyr.sh index ce27053d2873..1ed7e1e88af8 100755 --- a/scripts/xtensa-build-zephyr.sh +++ b/scripts/xtensa-build-zephyr.sh @@ -8,7 +8,7 @@ set -e SOF_TOP=$(cd "$(dirname "$0")" && cd .. && pwd) SUPPORTED_PLATFORMS=(apl cnl icl tgl-h) -# Default value, can be overridden on the command line +# Default value, can (and sometimes must) be overridden with -p WEST_TOP="${SOF_TOP}"/zephyrproject BUILD_JOBS=$(nproc --all) RIMAGE_KEY=modules/audio/sof/keys/otc_private_key.pem @@ -38,9 +38,13 @@ usage: $0 [options] platform(s) -k Path to a non-default rimage signing key. -c recursively clones Zephyr inside sof before building. Incompatible with -p. - -p Existing Zephyr project directory. Incompatible with -c. - If modules/audio/sof is missing there then a symbolic - link pointing to ${SOF_TOP} will be added. + -p Existing Zephyr project directory. Incompatible with -c. If + zephyr-project/modules/audio/sof is missing then a + symbolic link pointing to ${SOF_TOP} will automatically be + created and west will recognize it as a new sof module. + This -p option is always _required_ if the real (not symbolic) + sof/ and zephyr-project/ directories are not nested in one + another. Supported platforms ${SUPPORTED_PLATFORMS[*]} @@ -77,6 +81,12 @@ install_opts() build() { cd "$WEST_TOP" + west topdir || { + printf 'SOF_TOP=%s\nWEST_TOP=%s\n' "$SOF_TOP" "$WEST_TOP" + die 'try the -p option?' + # Also note west can get confused by symbolic links, see + # https://github.com/zephyrproject-rtos/west/issues/419 + } # Build rimage RIMAGE_DIR=build-rimage @@ -206,7 +216,7 @@ main() if [ "x$DO_CLONE" == "xyes" ]; then clone else - # Link to ourselves if no sof module yet + # Symlink zephyr-project to our SOF selves if no sof west module yet test -e "${WEST_TOP}"/modules/audio/sof || { mkdir -p "${WEST_TOP}"/modules/audio ln -s "$SOF_TOP" "${WEST_TOP}"/modules/audio/sof From edcd70b0b3074ed9e34f29ba9cdc0b0a4e7722f8 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Thu, 22 Jul 2021 02:29:52 +0000 Subject: [PATCH 2/2] xtensa-build-zephyr: add support for imx and RIMAGE_KEY=None MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Building imx is critical to test changes like #4524 Note not signing imx means sof-imx.ldc is staged for deployment but no imx firmware is, example: $ scripts/xtensa-build-zephyr.sh imx apl build-sof-staging ├── sof │   ├── community │   │   └── sof-apl.ri │   ├── sof-apl.ldc │   └── sof-imx.ldc └── tools └── sof-logger Signed-off-by: Marc Herbert --- scripts/xtensa-build-zephyr.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/xtensa-build-zephyr.sh b/scripts/xtensa-build-zephyr.sh index 1ed7e1e88af8..79de0005b634 100755 --- a/scripts/xtensa-build-zephyr.sh +++ b/scripts/xtensa-build-zephyr.sh @@ -7,7 +7,7 @@ set -e SOF_TOP=$(cd "$(dirname "$0")" && cd .. && pwd) -SUPPORTED_PLATFORMS=(apl cnl icl tgl-h) +SUPPORTED_PLATFORMS=(apl cnl icl tgl-h imx) # Default value, can (and sometimes must) be overridden with -p WEST_TOP="${SOF_TOP}"/zephyrproject BUILD_JOBS=$(nproc --all) @@ -99,11 +99,16 @@ build() local STAGING=build-sof-staging mkdir -p ${STAGING}/sof/ # smex does not use 'install -D' + # Default RIMAGE_KEY defined at the top of this file for platform in "${PLATFORMS[@]}"; do case "$platform" in apl) PLAT_CONFIG='intel_adsp_cavs15' ;; + imx) + PLAT_CONFIG='intel_adsp_cavs15' + RIMAGE_KEY='None' + ;; cnl) PLAT_CONFIG='intel_adsp_cavs18' ;; @@ -140,10 +145,12 @@ build() -l "$STAGING"/sof/sof-"$platform".ldc \ "$bdir"/zephyr/zephyr.elf + test "$RIMAGE_KEY" = 'None' || west sign --build-dir "$bdir" \ --tool rimage --tool-path "$RIMAGE_DIR"/rimage \ --tool-data modules/audio/sof/rimage/config -- -k "$RIMAGE_KEY" ) + test "$RIMAGE_KEY" = 'None' || install_opts -m 0644 "$bdir"/zephyr/zephyr.ri \ "$STAGING"/sof/community/sof-"$platform".ri done