Commit Graph

383 Commits

Author SHA1 Message Date
Marc Herbert d09844ab98 zephyr/docker-build.sh: match UID with 'adduser' instead of 'chgrp -R'
This fixes SOF version.cmake which was just broken by a recent git
security update and started to fail like this:

```
  -- SOF version.cmake starting at 2022-04-25T18:14:56Z UTC
  -- /workdir/zephyr/.. is at git commit with parent(s):
  fatal: unsafe repository ('/workdir' is owned by someone else)
  To add an exception for this directory, call:

   git config --global --add safe.directory /workdir
```
(example at https://github.com/thesofproject/sof/runs/6162885265)

chgrp -R was always an ugly hack because it was messing with
(persistent) file permissions on the host, outside the container. This
new adduser solution is unfortunately much more code but it does not
leak any side effect outside the container.

Do not fix scripts/docker-run.sh yet because there is still no UID
mismatch between Github Actions and the SOF container (they're both
1001) but add a warning + TODO.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-26 22:08:53 +01:00
Marc Herbert 0c5dcaca04 xtensa-build-all.sh: actually implement CONFIG_IPC_MAJOR_3=y
There was no actual "IPC3" value, it was ignored. The platform default
was used instead.

Stop ignoring invalid arguments, fail and report them.

Allow empty string as a no-op for scripting convenience.

Don't restrict IPC4 to tigerlake, it's not the job of
xtensa-build-all.sh to filter what's supported versus not.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-25 16:39:50 +01:00
Marc Herbert 236de3f142 xtensa-build-zephyr.py: drop check=True, now the default
Commit 475e09f17d ("xtensa-build-zephyr.py: default to
subprocess.run(check=True)") switched the default value of the
execute_command() function to "True". Remove all the "check=True"
arguments that are now redundant.

Zero functional change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-21 11:30:09 +01:00
Fred Oh af1e38a995 docker_build: add bison and flex to apt install list
There are warnings about bison and flex not available.
Interestingly these were not fatal errors but time to fix them.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2022-04-20 17:13:42 +01:00
Xiaoyun Wu(Iris) 62ead96614 xtensa-build-all.sh: add ipc4 build support for tgl
Add ipc4 build support for tgl with IPC4_CONFIG_OVERLAY.

If IPC_VERSION is chosen as IPC4, then overlay configuration file
for different platforms will be used automatically without assigning
the configuration file with options.

Different configuration files will be used according to what platform
is building firmware for.

Signed-off-by: Xiaoyun Wu(Iris) <xiaoyun.wu@intel.com>
2022-04-20 16:36:43 +01:00
Marc Herbert 475e09f17d xtensa-build-zephyr.py: default to subprocess.run(check=True)
The default value is wrong, change it. See pylint warning W1510

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-19 10:52:20 +01:00
Marc Herbert 35e588080d xtensa-build-zephyr.py: add #pylint:disable=W0312,C0103,C0116
This reduces the number of warnings from about 600 to a more manageable
350.

Disable W0312 because the entire file uses tabs.
Disable C0103 because we have higher priority than naming conventions.
Disable C0116 because the script is small enough, shouldn't require
              pydoc everywhere.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-19 10:52:20 +01:00
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