Commit Graph

337 Commits

Author SHA1 Message Date
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
Marc Herbert f45f5dffec xtensa-build-zephyr.sh: remove x-prefix in comparisons
Fixes new shellcheck 0.8.0 warning:

SC2268 (style): Avoid x-prefix in comparisons as it no longer serves a
purpose.

This script requires bash anyway.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-04 11:55:21 +02:00
Marc Herbert 0d39ff6b91 xtensa-build-zephyr.sh: add missing "${SOF_TOP}" quotes
Fixes commit a8c333b606 ("xtensa-build-zephyr: add deterministic
sha256sum of final .ri file")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-01-04 11:55:21 +02:00
Marc Herbert 5d66f1dac4 cmake: fix .ldc chksum fallback when no SOURCE_DIRECTORY/.git
Fixes old (Aug 2020) and untested commit b2a325a3b7 ("cmake: Handle
empty SOF_SRC_HASH_LONG") which tried to use GIT_LOG_HASH as a fallback
for the SOF_SRC_HASH .ldc checksum but always fell back on "0" instead
because of a misunderstanding of cmake's surprisingly complex "if"
operator.

Before Zephyr this was not an issue in practice because GIT_LOG_HASH was
empty anyway when SOURCE_DIRECTORY/.git was missing, so there was
nothing to lose.

For the Zephyr builds this will now use the SOF SHA1 as the .ldc checksum
for now. Probably not ideal yet but far better than the current constant
"0" which means no check at all.

Also log the SOF_SRC_HASH fallback value now and change the second
fallback (when GIT_LOG_HASH is also missing) from "0" to the
searchable hexspeak "baadf00d".

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-12-24 22:15:13 +00:00
Marc Herbert a8c333b606 xtensa-build-zephyr: add deterministic sha256sum of final .ri file
Checksumming the final binary is useful to compare before/after some
configuration change or to compare builds across different people /
systems.

Because rimage is not deterministic, ask sof_ri_info to do this.

Sample output:

Firmware file size 0x55000 page count 79
 pkcs_v1_5_sign_man_v1_8: signing with key
               'modules/audio/sof/keys/otc_private_key.pem'
 pkcs: RSA private key is valid.
 pkcs: digest for manifest is 5b52ac0b8809503c817a96dac7c5124dba5a90d...
Firmware manifest and signing completed !
Extended manifest found module, type: 0x0001 size: 0x01A0 ( 416) offset:
Extended manifest found module, type: 0x0005 size: 0x0020 (  32) offset:
Extended manifest found module, type: 0x0004 size: 0x0020 (  32) offset:
Extended manifest found module, type: 0x0003 size: 0x0030 (  48) offset:
Extended manifest found module, type: 0x0002 size: 0x0070 ( 112) offset:
Extended manifest found module, type: 0x0000 size: 0x0050 (  80) offset:
Extended manifest saved zephyr/zephyr.ri.xman size 0x02E0 (736) bytes

SOF Binary build-apl/zephyr/zephyr.ri size 0x4f2e0

  Extended Manifest ver 1.0.0 length 736

  cavs0015 (ADSP Manifest) file offset 0x22e0 name ADSPFW build ver
             0.0.0.0 feature mask 0xffff image flags 0x0
    HW buffers base address 0x0 length 0x0
    Load offset 0x2000

sha256sum build-apl/zephyr/reproducible.ri
46f3404e3b674ed....120c2173d6050bde35b build-apl/zephyr/reproducible.ri

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-12-20 22:35:09 +00:00
Marc Herbert 60be65b567 check patch: allow C99 comments
This is a logical revert of eb45907

Based on recently merged #4941, C99 comments are now OK. I never found
any rationale or even written down coding style for excluding them in
the first place.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-12-06 09:58:32 +00:00
Marc Herbert ae36fa5c91 xtensa-build-zephyr: build ICL by default again
ICL linking overlap issue has been fixed by
https://github.com/zephyrproject-rtos/zephyr/pull/39603

This is a logical revert of commit d4b8a01f20 ("xtensa-build-zephyr:
temporarily exclude ICL")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-25 09:59:56 +00:00
Marc Herbert 9f13849fa3 xtensa-build-zephyr: fix error message "not a zephyr project"
Echo the user argument instead of $WEST_TOP which is typically empty at
this point.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-25 09:59:56 +00:00
Marc Herbert 4c6ecb2172 xtensa-build-zephyr: guess CMake successes and failures better
Recent commit b9fcc4156e ("xtensa-build-zephyr: fix incremental build,
pass CMAKE_ARGS only once") fixed incremental builds. For this it first
needs to guess whether the most recent CMake configuration step failed
or succeeded so it knows what is the current "checkpoint" and what is
the next west command to run. Merely testing whether the build directory
already exists is a very bad guess because that directory could have
been created by some other person or script, or - much worse - it could
have been created by a failed CMake configuration step!

The latter situation makes debugging CMake failures very tedious because
it requires manually deleting the build directory after each CMake
configuration failure.

Fix this by not merely looking for a build directory but by looking
whether there is either a build.ninja or a Makefile is found in that
directory. This is a much better indication that the CMake configuration
succeeded.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-21 22:35:22 +00:00
Marc Herbert b9fcc4156e xtensa-build-zephyr: fix incremental build, pass CMAKE_ARGS only once
As documented in
https://docs.zephyrproject.org/latest/guides/west/build-flash-debug.html#one-time-cmake-arguments
and accidentally found when testing rimage cleanup
https://github.com/zephyrproject-rtos/zephyr/pull/40431

Fixes commit 88327f618c ("xtensa-build-zephyr: support passing through
CMake arguments"); ccache is too good and hid this regression from me.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-18 14:29:16 +00:00
Marc Herbert d4b8a01f20 xtensa-build-zephyr: temporarily exclude ICL
Because ICL fails to build, .noinit/.cached section overlap since
revert https://github.com/zephyrproject-rtos/zephyr/pull/40319

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-18 14:27:46 +00:00
Marc Herbert bccbfcc404 xtensa-build-zephyr: add new DEFAULT_PLATFORMS variable for -a
Sometimes we don't want to build all SUPPORTED_PLATFORMS by default.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-18 14:27:46 +00:00
Peter Ujfalusi 81c8279590 checkpatch: get default codespell dictionary path from package location
The standard location of dictionary.txt is under codespell's package, on
my machine atm (codespell 2.1, Artix Linux):

  /usr/lib/python3.9/site-packages/codespell_lib/data/dictionary.txt

Since we enable the codespell by default for SOF I have constant:

  No codespell typos will be found - file '/usr/share/codespell/dictionary.txt': No such file or directory

The patch proposes to try to fix up the path following the
recommendation found here:

  https://github.com/codespell-project/codespell/issues/1540

Mainline commit:
0ee3e7b8893e ("checkpatch: get default codespell dictionary path from package location")

Link: https://lkml.kernel.org/r/29e25d1364c8ad7f7657cc0660f60c568074d438.camel@perches.com
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Acked-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-11-11 17:09:30 +00:00
Marc Herbert d1b264c3f0 xtensa-build-zephyr: add new -z option to clone any Zephyr version
Default behavior is still to clone the default Zephyr branch (main) but
this could be changed with just one line.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-11 10:33:18 +00:00
Marc Herbert fa0888991c xtensa-build-zephyr: cosmetic rename of two functions
Zero functional change.

Rename clone() to west_init_update() and build_all() to
build_platforms(). Also expand description of the west_init_update()
feature in the usage message and add a direct SHA1 fetch example.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-11 10:33:18 +00:00
Iuliana Prodan 71e4500349 xtensa-build-zephyr: add imx8m as supported platform
Add imx8m platform to be tested with Zephyr.
imx8m refers to i.MX8MP target.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-11-02 22:34:21 +00:00
Marc Herbert 6254ff5b08 version.cmake: fix message to show why source hash fails with Zephyr
When compiling with Zephyr, SOF_ROOT_SOURCE_DIRECTORY is changed to
sof/zephyr/ and sof/zephyr/.git does not exist. Change error message to
show SOF_ROOT_SOURCE_DIRECTORY/.git

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-02 22:33:15 +00:00
Marc Herbert 9818410347 cmake: use new --erase_vars feature and test new 'reproducible.ri'
Update the scripts/test-repro-build.sh test accordingly.

Finally, different people and CI systems can make sure they're building
the same firmware.

reproducible.ri is sof.ri with variable parts removed.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-10-21 13:59:46 +01:00
Marc Herbert a780519e3f test-repro-build.sh: exclude two more .ninja_ files
Also convert 'differ' to all caps 'DIFFER' to highlight different files.
No other functional change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-10-21 13:59:46 +01:00
Marc Herbert 33c13e8c17 xtensa-build-zephyr: download rimage later, just before needed
This helps catch hidden rimage dependencies.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-10-15 12:22:00 +01:00
Marc Herbert 7c0f032266 xtensa-build-zephyr: extract new download_missing_submodules() function
This makes testing submodule issues easier.

Absolutely zero functional change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-10-15 12:22:00 +01:00
Guennadi Liakhovetski 6ce3237509 zephyr: apl: re-enable building with XCC
Zephyr XCC builds for Apollolake can be re-enabled now after the RAM
footprint has been reduced.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-10-14 14:01:57 +01:00
Marc Herbert 5e17731290 .github: run new test-repro-build.sh
... in Github Actions.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-30 15:56:44 +01:00
Marc Herbert 41d244c48c Add new scripts/test-repro-build.sh
See https://reproducible-builds.org/

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-30 15:56:44 +01:00
Marc Herbert 45a6d1fb87 Fix docker-run.sh so it can be invoked from anywhere
$(pwd) was not a very good idea.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-30 15:56:44 +01:00
Marc Herbert 9b03553d1d docker-run.sh: log the docker image version
Especially useful when forgetting to update the 'sof' tag

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-30 15:56:44 +01:00
Marc Herbert 83c10268f1 cmake: add EXTRA_CFLAGS support
Example:

  EXTRA_CFLAGS="-Werror -g0" ./scripts/xtensa-build-all.sh

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-30 15:56:44 +01:00
Marc Herbert 868e00bdd0 xtensa-build-zephyr: download rimage whether we clone zephyr or not
... because there's no reason to make one depend on the other.

Same for the opportunistic creation of the sof symbolic link.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-29 17:00:49 +01:00
Marc Herbert d80d70bf47 xtensa-build-zephyr: fix submodules download hack when starting from west
By adding the missing remote to thesofproject

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-29 17:00:49 +01:00
Marc Herbert a0793de4be xtensa-build-zephry: add more WEST_TOP asserts and heuristics
Do not define a default WEST_TOP at the very start because we may not
have one. Define WEST_TOP only when the user gives one or when we
actually find one. And search harder.

Do not trust optional WEST_TOP user input blindly either. This was
leading mkdir -p to create a bogus modules/audio/ directory.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-29 17:00:49 +01:00
Iuliana Prodan 4b80be18e5 xtensa-build-zephyr: add imx8x as supported platform
Add imx8x platform to be tested with Zephyr.
imx8x refers to i.MX8QXP target.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-09-29 17:50:15 +03:00
Marc Herbert df376963df cmake/github: do not download rimage when CONFIG_LIBRARY/testbench
Faster CI and will catch any accidental dependency sneaking in.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-17 17:15:50 +01:00
Marc Herbert fd1f631352 cmake: do not download submodules when BUILD_UNIT_TESTS
Faster CI.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-17 17:15:50 +01:00
Curtis Malainey 66234f02c3 docker: add renoir to docker build
In order to support AMD as part of the docker image and CI we need to
include it in the build list as the overlays are already added to the
overlay repo.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-09-14 11:03:43 +01:00
Marc Herbert e3494f5662 xtensa-build-zephyr: make "tree" optional
"tree" is very useful but it's not critical, not worth failing the build
for.

Also remove a single quote from the help message as it breaks parsing
in one simple editor I use (jed) and possibly others.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-13 22:28:09 +01:00
Curtis Malainey a0acad3414 CMake: require version 3.13
Without CMP0079 we cannot conditionally include libraries against SOF in
sub directories without seriously restructuring the project. This is
because the old policy requires the link target must be created in the
same folder. This does not work well from a configuration standpoint for
3P audio libraries trying to keep their config in src/audio/*. Rather
than enable the policy, lets simply upgrade since 3.13 is widely
available.

With this upgrade we can also remove the two version dependent checks at
the top of our scripts.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-09-10 17:19:29 +01:00
Allen-KH Cheng 9a09b97c28 scripts: Add mt8195 to build script
Add mt8195 to build script.

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
2021-09-10 17:13:06 +01:00
Marc Herbert 9452af0a5e xtensa-build-zephyr: add zephyr_fetch_and_switch() example
Add example that shows how to submit any Zephyr commit to SOF PR
testing.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-10 13:35:36 +01:00
Marc Herbert 4d3192c266 xtensa-build-zephyr: add option to stop after cloning Zephyr
This is needed by CI to clone only once and then take control of the
iteration over platform builds. CI already does all that but by
copy/paste/diverge of this clone() function.

Once cloning Zephyr in CI code is de-duplicated and uses this new
clone-only feature instead, it will be possible to submit any Zephyr
commit to SOF testing.  In other words it will make failed attempt
https://github.com/thesofproject/sof/pull/4728 possible

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-10 13:35:36 +01:00
Marc Herbert 88327f618c xtensa-build-zephyr: support passing through CMake arguments
Like this:

  xtensa-build-zephyr.sh -a -- -DEXTRA_CFLAGS='-Werror -Wextra'

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-09 15:48:18 +01:00