Commit Graph

376 Commits

Author SHA1 Message Date
Marc Herbert c9ee109296 xtensa-build-zephyr.py: add cavstool.py to staging directory
This is required to read Zephyr logs.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-08 13:15:38 +01:00
Marc Herbert f9c461009a xtensa-build-zephyr.py: add for loop to install files into staging
Preparation to copy multiple files. Zero functional change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-08 13:15:38 +01:00
Marc Herbert bde4858625 topologies: docker --env USE_XARGS, NO_PROCESSORS and VERBOSE
Building in parallel is much faster but it makes logs unreadable and
build failures impossible to understand. This is especially true when
building with recent ALSA that produces of deprecation warnings, see
examples below. For test topologies the problem is even worse: its
XARGS parallel build provides no log at all.

To find what actually fails, it is required to fall back on a single
threaded and verbose build and this is achieved with the variables
USE_XARGS, NO_PROCESSORS and VERBOSE. Pass these through docker-run.sh
and CMake.

Examples from #5608
https://github.com/thesofproject/sof/runs/5717553555?check_suite_focus=true
https://sof-ci.01.org/sofpr/PR5608/build12556/build/tools.txt

ALSA pcm.c:1523:(parse_hw_config) deprecated fsync value 'codec_slave',...
ALSA pcm.c:1471:(parse_hw_config) deprecated bclk value 'codec_slave',...
ALSA pcm.c:1523:(parse_hw_config) deprecated fsync value 'codec_slave',...
ALSA pcm.c:1471:(parse_hw_config) deprecated bclk value 'codec_slave',...
ALSA pcm.c:1523:(parse_hw_config) deprecated fsync value 'codec_slave',...

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-05 14:37:28 +01:00
Marc Herbert 93f20d577c xtensa-build-zephyr.py: forbid shell=True
The entire purpose of replacing the older shell script with Python was
to achieve cross platform compatibility. shell=True would lose that.

See also
https://docs.python.org/3/library/subprocess.html#security-considerations

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-04 16:24:43 +01:00
Marc Herbert 0bbdbb111f test/topology: make tplg-build.sh callable from anywhere
This removes two layers of indirection when trying to find what fails.
The lack of this proved especially painful when working on #5632 and
similar backports.

Also move outputs to a subdirectory by default. No change when invoked
from CMake which does not use the default output directory.

Also show the exact m4 and alsatplg commands run when not using XARGS
parallelization. Again this is critical when something fails.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-02 17:51:04 +01:00
Andrey Borisovich ce3264a507 platform: Move configuration from Zephyr to SOF
Move software configuration from Zephyr samples directory
to SOF platforms directory using Zephyr overlay mechanism.
How it works:
1. Gets zephyr board defconfig values
2. Applies Zephyr samples prj.conf values on top of it
3. Then applies our new overlay.conf on top of it
4. Final "summary" of Kconfig settings is written to autoconf.h header

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-03-18 16:14:19 +00:00
Marc Herbert a62fc4b9af xtensa-build-zephyr.py: restore ability to override CI
This has been useful to test Zephyr work in progress.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-15 13:39:12 +00:00
Marc Herbert ffdf001eee xtensa-build-zephyr.py: clone zephyr with --depth 5
This restores the performance of the original shell script and makes a
big difference in CI. CI clones over and over again whereas developers
clone rarely and can run a simple git fetch --unshallow.

Don't use --depth 0 to provide more context in the logs and also make it
more obvious that this is a shallow clone and not just git log -n 1.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-15 13:39:12 +00:00
Marc Herbert 5a80db78af xtensa-build-zephyr.py: give -z option a long form --zephyr-ref
This makes the code more readable and other scripts possibly too.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-15 13:39:12 +00:00
Marc Herbert df6b48c889 xtensa-build-zephyr.py: make "unsupported OS" actually a warning
Running on a mac crashed with "undefined xtensa_tools_version_postfix",
that should not be fatal (there are other toolchains).

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-15 13:39:12 +00:00
Marc Herbert d8572420d0 xtensa-build-zephyr.py: un-hardcode execute_command() wrapper
Duplicating all parameters of subprocess.run() is not just tedious and
error-prone, it makes the script compatible only with a range of
specific Python versions.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-14 15:04:45 +00:00
Kai Vehmanen 8f3a78dc6a xtensa-build-zephyr.sh: fix shellsheck warning
In scripts/xtensa-build-zephyr.sh line 199:

  if test $platform = tgl-h ; then
           ^-------^ SC2086: Double quote to prevent globbing
			     and word splitting.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-03-14 11:43:32 +00:00
Kai Vehmanen 6d0ecc37cc xtensa-build-all: add a separate target for JSL
Use intel_adsp_cavs20_jsl Zephyr board when building for
Intel Jasper Lake.

BugLink: https://github.com/thesofproject/sof/issues/4539
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-03-14 11:35:35 +00:00
Marc Herbert 177e18f701 xtensa-build-zephyr.sh: add new -u zephyr_remote option
Same -u option as the new Python script.

We need this for the new sof/stable-v2.1 branch on
https://github.com/thesofproject/zephyr while our CI has not entirely
switched to the python script yet.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-14 11:32:59 +00:00
Marc Herbert 0ee59c317e xtensa-build-zephyr.py: do not update SOF submodules after west init
This script is run from an existing SOF repo that is assumed to be fully
initialized. Updating existing submodules is a potentially destructive
operation.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-11 12:52:41 +00:00
Marc Herbert 78667c028d xtensa-build-zephyr.py: do not modify submodules after building!
The older shell script had a deprecated convenience hack to clone
submodules before building rimage but _only if submodules were missing_!

While trying to preserve that, the new script changed that to an
unconditional git submodule update that can be destructive when
submodules are already present.

Generally speaking, using git and building must always be two very
distinct activities. No one wants the source code to change quietly from
one build to the next.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-11 12:52:41 +00:00
Marc Herbert 7a847a5bd8 xtensa-build-zephyr.py: de-duplicate common code
De-duplicate this code:

	if args.platforms:
		build_platforms()
		show_installed_files()

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-10 13:15:11 +00:00
Marc Herbert fc3bc3c805 xtensa-build-zephyr.py: don't git_submodules_update() twice
A second git_submodules_update() immediately after the first one does
not make sense. This looks like something leftover from a past
experiment.

Fixes initial commit 1de3ef3675 ("Rewritten xtensa-build-zephyr.sh to
python")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-10 13:15:11 +00:00
Adrian Warecki b9d971920e xtensa-build-all.sh: Use appropriate defconfig for tgl-h platform
Recent combination of tgl and tgl-h building resulted in use of an invalid
defconfig file for tgl-h platform. This commit reverts that change.

Fixes: f1e6e1fdd3

Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
2022-03-09 11:38:29 -08:00
Marc Herbert 2ac78a0603 version.cmake: make XTOS and Zephyr .ldc file different from each other
This is especially important considering some sof-bin releases are now
"hybrid": with a mix of XTOS and Zephyr.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-08 22:02:36 +00:00
Marc Herbert f052cbffaa zephyr/cmake: fix SOF_ROOT_SOURCE_DIR to fix the .ldc checksum
Fixes copy/paste of commit de41202f8f ("zephyr: build: Add initial
build support for SOF application.")

This fixes the dictionary hash when using Zephyr; no more fallback on
the git SHA1.

When using Zephyr, SOF_ROOT_SOURCE_DIR (and SOF_ROOT_BINARY_DIR) are used
only by version.cmake

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-08 22:02:36 +00:00
Marc Herbert 302ebe3b03 version.cmake: fix git -C sof/ log command when building Zephyr
When building Zephyr, CMAKE_CURRENT_SOURCE_DIR does not point at
SOF. Use SOF_ROOT_SOURCE_DIRECTORY instead.

No impact besides the logs.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-08 22:02:36 +00:00
Marc Herbert d722ee15b1 version.cmake: --no-abbrev-commit cause github has allowAnySHA1InWant
Some git servers like Github allow fetching by full length SHA so this
useful information to share.

(Others forbid this entirely, see last page of `git help fetch-pack`)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-08 22:02:36 +00:00
Marc Herbert 23d2a01777 version.cmake: add comments and fix logs to clarify recursive invocation
version.cmake has a not very intuitive logic to make sure sof_versions.h
is always up to date without triggering a full rebuild. Add comments and
rephrase some logs to make it less hard to follow.

Absolutely zero functional change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-03-08 22:02:36 +00:00
Adrian Warecki f1e6e1fdd3 xtensa-build-all.sh: Code style correction
Combined case label tgl and tgl-h similarly as in xtensa-build-zephyr.sh
Corrected code formatting.

Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
2022-03-08 09:25:28 +00:00
Adrian Warecki 95d887251e xtensa-build-all.sh: Don't override user private key path
If the user doesn't set the path to own private key, the default path is
placed in the variable containing the user's key. This causes a leak of the
default key of one platform to the others platforms, which will treat it as
a key supplied from the user.

Signed-off-by: Adrian Warecki <adrianx.warecki@intel.com>
2022-03-08 09:25:28 +00:00
Chao Song f645b36cc8 xtensa-build-zephyr.py: use string path for rimage_desc
PosixPath doesn't convert to string automatically, and
it is not acceptable in sign_cmd, convert it to string
explicitly.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-03-07 12:02:33 +00:00
Chao Song de7016edd4 platforms: tgl: renamme tgl_ipc4_overlay.conf
Rename tgl_ipc4_overlay.conf to ipc4_overlay.conf,
because it is under tgl folder.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-03-07 12:02:33 +00:00
Kai Vehmanen 26e08d4d55 xtensa-build-zephyr: use separate Zephyr config for TGPH builds
Zephyr recently added support for separate configs for 2-core and 4-core
variants of cAVS2.5. Use the new "tgph" configuration for when building
SOF for TigerLake-H variant.

BugLink: https://github.com/thesofproject/sof/issues/5018
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-03-01 22:49:36 +00:00
Chao Song 6f71808e3e xtensa-build-zephyr.py: add ipc4 build support for tgl
Add ipc4 build support for tgl with OVERLAY_CONFIG.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-02-26 11:06:59 +00:00
Marc Herbert ce8bc4a394 xtensa-build-zephyr.py: important -v verbosity fixes
The most important fix is the addition of the "flush" argument which
means are commands are now printed when they are run and not all at the
end when everything is done.

Commands run by this script are very few so they are always shown.  This
makes it possible to debug just this script without being completely
drown in build noise. All '-v's are passed to west.

Pass -v to `west sign`, not just to `west build`.

Drop the manual "-DCMAKE_VERBOSE_MAKEFILE=ON", west knows how to do that.

Print directories first so commands are aligned, more visible and can be
copied. Use shlex to quote whitespace.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-02-24 14:46:17 +00:00
Marc Herbert 9fb7a607eb xtensa-build-zephyr.py: fix -C option so it can support whitespace
Make it possible to invoke -C multiple times which is required to
support whitespace as in:

  -C=--warn-uninitialized  -C '-DEXTRA_FLAGS=-Werror -g0'

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-02-21 09:23:40 +00:00
Marc Herbert 7d9aa8e04b xtensa-build-zephyr.py: switch to RawTextHelpFormatter and """
We need control to format add_argument(help=...) strings manually too.

Zero functional change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-02-21 09:23:40 +00:00
Andrey Borisovich bb314fca61 Fix for xtensa-build-zephyr.py. This fixes 1de3ef3
Existing xtensa-build-zephyr.py failed to copy sof logger
executable to staging directory due to missing '.exe' file extension.
This fixes the script.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-02-18 11:25:47 +00:00
Andrey Borisovich 1de3ef3675 Rewritten xtensa-build-zephyr.sh to python
Created new script with similar functionality to allow SOF + Zephyr
builds on both Windows and Linux operating systems.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-02-16 12:02:40 +00:00
Marc Herbert 0bf7b73dc8 cmake: move ALSA_CONFIG_DIR from .sh file to topology/CMakeLists.txt
Fixes incremental builds of topology2 that were missing ALSA_CONFIG_DIR.

This was making it impossible to troubleshoot alsatplg issues like #5249.
Now incremental builds fail or pass the same as builds from scratch.

Fixes commit 308a24a92b ("topology2: Add build support")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-26 10:14:15 -08:00
Tinghan Shen 59a32d5bbe platform: Add mt8186 to Kconfig
Add mt8186 to Kconfig

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2022-01-26 12:24:24 +00:00
Marc Herbert 0031664403 xtensa-build-all.sh: distinguish default/working platform and WIP
The -a option was recently broken by the addition of platform(s) that
don't have a toolchain available in the Docker image. Every platform can
be built by someone but no one can built -a(ll) platforms right now.

Add a new platform array to make the distinction between default
platforms built by the -a option versus work in progress.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-21 17:17:09 +00:00
Marc Herbert da1d1b041e xtensa-build-all.sh: rn: remove odd ARCH=xtensa definition
No one else has it.

Gets rid of the only shellcheck warning.

Fixes commit 7453e3d571 ("scripts: add renoir support")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-21 17:17:09 +00:00
Marc Herbert 5de4a09756 version.cmake: include scripts/ and zephyr/ in the .ldc dictionary hash
scripts/ has kconfig defaults and CMake code that can affect the
dictionary. Note this does not fix #3890 because .config (and maybe
others) are still not hashed but it helps a bit.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-14 16:59:01 +00:00
Marc Herbert 58d3551960 version.cmake: more robust logging of the current git commit and parents
execute_process() runs in the current directory of the process invoking
cmake. This can be completely outside the git repo.

Fixes commit a5899812b7 ("version.cmake: don't trust CI to record time
and versions and log ourselves")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-14 16:59:01 +00:00
Marc Herbert 805e57b28f xtensa-build-zephyr: include DEFAULT_PLATFORMS in SUPPORTED_PLATFORMS
Include DEFAULT_PLATFORMS in SUPPORTED_PLATFORMS instead of the other
way round. SUPPORTED_PLATFORMS will always be bigger than
DEFAULT_PLATFORMS and it's easier to add a platform than remove one.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-14 16:57:35 +00:00
Marc Herbert ac1a09afdb xtensa-build-zephyr: de-dup. first vs incremental west invocation
Passing spurious --board and source directory arguments to an already
build directory does not help but it does not hurt either and it
simplifies the code. It also provides a more consistent west command in
the set -x "logs", one that can be re-used in any circumstance.

The only restriction is to make sure CMAKE_ARGS is empty on all but the
first invocation but that's not new and unchanged here.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-14 16:57:35 +00:00
Marc Herbert deb0e7340e Rename generated version.h to sof_versions.h
Zephyr also a version.h too so the situation was a buggy #include mess
that (among others) dropped the SOF git version from the SOF banner when
using Zephyr. It's absolutely impossible to fix this mess while keeping
two .h files both named exactly the same and even included with the
exact same '#include version.h' line, I mean no sof/version.h or other
prefix.

As a bonus, this rename also reduces the XTOS-only confusion between
"version.h" and cavs/version.h".

Generating a file in the source tree is a serious bug (to be fixed
later), it means this file is never cleaned. Do not hide this bug with a
.gitignore rule.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-14 16:56:29 +00:00
Marc Herbert 950728c095 Docker: sof: add ninja-build
We should gradually switch to ninja as a default.

ninja-build is apparently missing from build-essential

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-10 11:52:04 +00:00
Marc Herbert b339ca95e9 Remove scripts/host-build-all.sh
scripts/host-build-all.sh has been replaced and deprecated for more
than a year.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-07 15:29:14 +00:00
Marc Herbert 55e862c92e docker-run.sh: switch from "sof" shortcut to full "thesoftproject/sof"
It's super annoying and time-consuming to update the image and wonder
why the previous one is still used. Shortcuts are nice in interactive
use but pointless in scripts.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-07 15:25:53 +00:00
Marc Herbert f79d2341af docker-run.sh: log command run and image digests
There's frequent confusion between image ID and image digest: display
both.

Show both sof and thesofproject/sof.

Use set -x to display the full command that is run.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-07 15:25:53 +00:00
Ranjani Sridharan 308a24a92b topology2: Add build support
Add build support for topology2. Topology2 will be built only if the
alsatplg version if 1.2.6 or greater.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-01-06 21:38:43 +00:00
Kai Vehmanen b95d995bd2 xtensa-build-zephyr: add -v option for verbose build
Align with xtensa-build-all.sh and add a "-v" option to toggle
verbose build log ("west -v build").

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-01-05 13:23:00 +00:00