Commit Graph

309 Commits

Author SHA1 Message Date
Fred Oh 5083b2b73a docker: upgrade base ubuntu image to 20.04
Catching up latest LTS Ubuntu image, 20.04. It is supposed to be minor
upgrade but alsa-lib need to be set default library path,
/usr/lib/x86_64-linux-gnu/. Otherwise topology library loading error
is found for SOF tool build. This is typical error message,

alsatplg: error while loading shared libraries: libatopology.so.2:
cannot open shared object file: No such file or directory.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2021-05-12 20:29:37 +01:00
Fred Oh c7a527e4bd Dockerfile: remove apt.conf dependency
There was a assumption /etc/apt/apt.conf has apt proxy settings for
the system. This workaround is not required.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2021-05-12 20:29:37 +01:00
Fred Oh cbef494ee6 Dockerfile: add vim and jed to apt install list
Can't imagine editing files without vim or jed.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2021-05-12 20:29:37 +01:00
Fred Oh 4b9fbaf24b docker-run.sh: minor alignment fix
Removed extra spaces.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2021-05-12 20:29:37 +01:00
Fred Oh 77ef08a951 docker-run.sh: set http/https proxy when docker run
Use http/https proxys setting from the host.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2021-05-12 20:29:37 +01:00
Marc Herbert 55e292ee85 xtensa-build-zephyr: add mkdir -p modules/audio
More robust support for "manual" installations.

Also rephrase usage string to remove a single quote breaking
the shell parser in one editor I use (sorry).

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-06 14:36:25 +01:00
Marc Herbert 0f989b10e9 xtensa-build-zephyr.sh: show zephyr short git log / version after clone
By default, the Zephyr build does not log its version. The fix has
already been submitted at
https://github.com/zephyrproject-rtos/zephyr/pull/34842 however:

- 34842 may take some time. Zephyr reviewers are even busier than the
  SOF reviewer.
- 34842 could even be rejected
- 34842 will at best log the SHA1 and no context. This is more verbose
  and future-proof because it supports more complex situations like
  testing a pull/12345/merge

As seen in (unrelated) PR #4123, we need Zephyr git versions NOW.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-05 09:45:55 +01:00
Marc Herbert 61f286c8a9 build-zephyr.sh: don't update rimage every time we run
Fixes 33c5f5d38e ("xtensa-build-zephyr: do not clone a second version of
sof.git")

The very first version of this test was checking whether the rimage/
directory exists, which proves nothing. So I switched to
rimage/CMakelists.txt but forgot change the `test` flag.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-05 09:43:54 +01:00
Marc Herbert 33c5f5d38e xtensa-build-zephyr: do not clone a second version of sof.git
This script lives in a sof.git/ clone yet it was systematically cloning
a second sof.git/. Besides the obvious confusion and risk of editing the
wrong files, this meant it was not possible to build code that has not
been merged yet! This was a problem for both CI and developers. Fixed by
using symbolic links to ourselves instead.

Note it is _still_ possible to build from another sof.git clone if
desired, however this script will never git re-clone a second sof.git
itself, that second clone has to be created (e.g.: by west) before this
script runs.

When cloning a brand new zephyrproject, use a shallow zephyr clone and
download only the two zephyr modules we actually use. This speeds up
automation considerably and makes it much faster for non-Zephyr
developers to reproduce Zephyr issues. Developers can always git
unshallow and west update once if they want to.

Rename the default west top to "zephyrproject" to not just match the
zephyr documentation but to also avoid creating a double zephyr/zephyr/
directory.

See the new print_usage() for a few more implementation details.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-30 11:12:29 +01:00
Marc Herbert 831bb3755b xtensa-build-zephyr: fix "die()" function
It still looks smart but the \n addition compared to the original
version in xtensa-build-all.sh broke it for more advanced cases:

die '%s %d' str 5
-bash ERROR: -bash: printf: 5\n: invalid number

As reported by shellcheck. shellcheck saves lives.

In scripts/xtensa-build-zephyr.sh line 22:
	>&2 printf "$@\n"
                       ^-- SC2145: Argument mixes string and array.
                        Use * or separate argument.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-30 11:12:29 +01:00
Marc Herbert 80c482815b xtensa-build-all.sh: replace "type xtensa-bxt-elf-gcc" with "command -v"
... because the latter does not print on stderr when not found; so IDEs
and CIs don't display this as a warning.

Also remove the "... and ignore set -e" comment that made sense at the
time of commit cad86dc340 ("scripts: xtensa-build: fix alias detection
for bxt/apl gcc") but not anymore.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-30 11:11:22 +01:00
Guennadi Liakhovetski c73ec9f981 zephyr: add a build script
Add a script to build Zephyr with the SOF main branch.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-04-22 12:18:38 +01:00
Liam Girdwood 4d6da60931 cmocka: add support to run mocks on host architecture
Allows the mocks to be quickly run on the host with full access to host
debug and development tooling.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-20 15:35:18 +01:00
Marc Herbert a5899812b7 version.cmake: don't trust CI to record time and versions and log ourselves
In an ideal world, every CI engine records and shares the most important
CI information:
- current date and time in a well identified timezone
- git version of the pull request
- git version of the moving branch the PR is being merged with

In the real world we have multiple CI solutions and they unfortunately
cannot not all be trusted to perform their most basic job
correctly. Fortunately, they all make at least build logs available so
these very few lines of code adding very few lines of output cost near
zero extra build time and solve the problem once for all. I feel stupid
I didn't do this sooner, this would have saved me hours and hours in
vain requests and discussions and in trying to puzzle that information
together.

Sample output:

-- Preparing Xtensa toolchain
version.cmake starting SOF build at 2021-03-31T18:09:46Z UTC
Building git commit with parent(s):
150fd1e4c968 4249bdb1b305 [other parent if merge] (HEAD -> main) cmake: ...
-- GIT_TAG / GIT_LOG_HASH : v1.7-rc1-174-g150fd1e4c968-dirty / 150fd1e4c968

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-01 16:39:20 +01:00
Marc Herbert b5219d844c version.cmake: do not discard stderr from git commands
Never discard stderr.

Also fix my older, misleading comment and add a warning.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-01 16:39:20 +01:00
Marc Herbert eb459078f3 checkpatch: --ignore C99_COMMENT_TOLERANCE
Let's not waste considerable time in code reviews with silly problems
computers can solve.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-31 16:26:03 +01:00
Marc Herbert fa38c34a7a docker: apt-get install python3-elftools
Required by #3459 / #3975 "elfsize" proof of concept and probably by
other things too in the future - we use both ELF and Python
everywhere; it's surprising they haven't met each other yet.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-31 15:19:14 +01:00
Marc Herbert 7c08aabbe7 topology/cmake: add missing .m4 dependency, fixes incremental build
There was no [MAIN_]DEPENDS on the .m4 source file, so changes were not
triggering any rebuild.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-26 14:51:33 +00:00
Marc Herbert 041c2ef6de version.cmake: add --dirty to git describe command
For at least two reasons:
  - exposes sneaky change(s) performed by automation if/when any
  - solves the mystery of the Source content hash (printed on the next
    line) changing while the git version does not.

Example, at https://sof-ci.01.org/sofpr/PR3941/build8429/build/bdw_gcc.txt

 -- Found Git: /usr/bin/git (found version "2.17.1")
 -- GIT_TAG / GIT_LOG_HASH : v1.7-rc1-151-g023c4abacde1 / 023c4abac
 -- Source content hash: 91f261ea

whereas at https://github.com/thesofproject/sof/runs/2166298087,
  xtensa-build-all:

 -- Found Git: /usr/bin/git (found version "2.17.1")
 -- GIT_TAG / GIT_LOG_HASH : v1.7-rc1-151-g023c4abacde1 / 023c4abac
 -- Source content hash: 67f31697

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-23 12:17:22 +00:00
Paul Olaru 5ed64a7fe4 scripts: xtensa_build_all: Fix configuration names for i.MX
The configuration names with _2017 are a consequence of the way I did
the internal configuration update. To keep it simple I update these
build scripts.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2021-03-22 20:24:49 +02:00
Marc Herbert e995bbb575 Dockerfile: apt-get install tree
Required to remove the copy hack introduced in
commit eb4373cb61 (".github: new installer.yml")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-15 21:23:32 +00:00
Marc Herbert 732c75259d scripts: remove XTOBJDUMP and XTOBJCOPY unused since CMake / Jan 2019
XTOBJCOPY and XTOBJDUMP were added in June 2018 by
commit 27795ece0f ("scripts: fix xt-xcc build with wrong config") for
`./configure CC=$XCC OBJCOPY=$XTOBJCOPY OBJDUMP=$XTOBJDUMP ...` that was
used at the time.

The build system was switched to CMake in January 2019, notably with
commit 9840ecbbfe ("cmake: update xtensa-build-all.sh") and
commit 0fd97adfb0 ("cmake: add utility scripts") that defined
CMAKE_OBJCOPY and CMAKE_OBJDUMP)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-11 13:15:31 +02:00
Marc Herbert e6c3dda61a xtensa-build-all.sh: remove $ARCH unused since CMake / January 2019
$ARCH was introduced in 2018 by commit b5af84deaa ("scripts: add smp
builds to xtensa-build-all.sh"). At the time used autotools and
`./configure --with-arch=$ARCH` were used.

In January 2019 the build system was migrated to CMake over several
commits, notably commit 9840ecbbfe ("cmake: update
xtensa-build-all.sh") that switched xtensa-build-all.sh to CMake and
removed its only use of ARCH. Also note commit 82b4da291b ("cmake:
defconfigs support") which added a few CONFIG_SMP defconfigs and
commit 905bad4252 ("scripts: xtensa-build-all: Add support to force
build UP Arch") using override.config.

Much more recently in June 2020: commit fd506970cc ("zephyr: kconfig:
rename CONFIG_SMP -> CONFIG_MULTICORE")

Zawinski's Law of Software Envelopment: adding lines of code is much
easier than removing the same amount and would be very impractical
without git. This one was easy enough.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-11 13:15:31 +02:00
Marc Herbert 716efc00bc xtensa-build-all.sh: 3 times more xcc threads than gcc threads
As CMake forks one compiler process for each source file, the XTensa
compiler spends much more time idle waiting for the license server over
the network than actually using CPU or disk.

On my VM with 16 virtual cores, rebuilding one platform from scratch
with this commit goes down from 12s to less than 9s: more than 25%
faster. With Ninja it goes down from 11s to less than 8s. My license
server is 25ms away: a closer server does not need as many threads while
a more distant server would obviously benefit for even more
threads... while already getting an even better improvement than 25%
from just 3 times more threads! It's complicated and we probably don't
want to start the build by measuring latency to the license server.

The entire, purely local _gcc_ build is so fast (~ 1s) that observing any
the difference between -j nproc and -j nproc*N is practically impossible
so let's not waste RAM when building with gcc.

Also: log the $XTENSA_SYSTEM variable as it is required for incremental
builds; remove one apostrophe in the here-doc usage as it breaks the
parser of some editor (jed).

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-11 10:24:09 +02:00
Marc Herbert 4c1f41a91b cmake: add some MEU-related comments
Notably:
- Log error and default MEU_OFFSET when meu -ver is not found.
- Explain rimage -s option

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-09 20:14:09 +00:00
Marc Herbert f57de5957c cmake: print some error messages when XTENSA_TOOLS_ROOT is wrong
Notably: xt-xcc --show-config failed with: No such file or directory

... when the directory exists but is wrong.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-08 12:05:08 +00:00
Marc Herbert 6468490d8d xtensa-build-all.sh: show supported XtensaTools installation in usage
Add this to the -h usage message:

This script supports XtensaTools but only when installed in a specific
directory structure, example:

myXtensa/
└── install/
    ├── builds/
    │   ├── RD-2012.5-linux/
    │   │   └── Intel_HiFiEP/
    │   └── RG-2017.8-linux/
    │       ├── LX4_langwell_audio_17_8/
    │       └── X4H3I16w2D48w3a_2017_8/
    └── tools/
        ├── RD-2012.5-linux/
        │   └── XtensaTools/
        └── RG-2017.8-linux/
            └── XtensaTools/

$ XTENSA_TOOLS_ROOT=/path/to/myXtensa ./scripts/xtensa-build-all.sh ...

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-05 11:41:35 +00:00
Marc Herbert 5b34b81cb1 xtensa-buid-all.sh: prepends $OVERRIDE_CONFIG with $SOF_TOP
commit e31afb3651 ("xtensa-build-all.sh: make it runnable from
anywhere") missed this.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-05 11:37:11 +00:00
Paul Olaru cc5e1d0468 scripts: xtensa-build-all: imx: Fixup Xtensa compiler
There is no such compiler as RF-2017.8 that is in use. The correct
compiler is RG-2017.8 for all i.MX platforms.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2021-03-04 19:04:05 +02:00
Marc Herbert 288e228c67 cmake: generate the complete .config at configuration time.
Add cmake -DINIT_CONFIG= option that can point at any initial file.

"make clean" does not delete .config any more.

Note reconfiguration does NOT causes recompilation because -imacros
hides the generated .h from CMake's dependency scan. This is not a
regression, that problems exists since -imacros was introduced. At least
it's now possible to "make clean" and rebuild without losing the .config
file.

Fix for #3617

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-03 22:33:53 +00:00
Marc Herbert ffaeaaafdd build-tools.sh: build in any directory
Take $BUILD_TOOLS_DIR from the environment if present.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-02-26 16:17:41 +00:00
Marc Herbert e31afb3651 xtensa-build-all.sh: make it runnable from anywhere
Fix $pwd confusion and remove bogus ../local/bin PATH that does not
exist.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-02-26 16:17:41 +00:00
Daniel Baluta bd604d06e3 xtensa-build-all.sh: Bump IMX xtensa toolchain version
Lets use the same version of Xtensa toolchain as Intel in order
to avoid compilation problems.

It is difficult to support multiple toolchain versions because specific
headers needs to be updated, so lets have the same version supported
between IMX and Intel.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-02-26 16:14:28 +02:00
Liam Girdwood e28b6a7cf6 docker: toolchain: update docker to GCC 10.2 and GDB 9.2
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-02-18 13:59:26 +00:00
Marc Herbert 419806fb1c xtensa-build-all.sh: add PATH to build log
The script already logs the full CMake command that is re-usable outside
this script... except for the PATH change. Expose that sneaky PATH
change.

Debugging every build issue starts with peeling the too many layers of
indirection.

Also fix some minor issue in the help message.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-02-09 13:43:54 +00:00
Marc Herbert 9938a66db4 docker-run.sh: use --tty only when we have one
--tty is not compatible with github actions, fails with "the input
device is not a TTY"

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-01-22 13:42:03 +00:00
Marc Herbert e17b90d9b2 scripts: replace "make" with "cmake --build"
This makes it possible to switch to Ninja with a single line change
which can be useful to test build changes and issues.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-01-18 16:11:46 +00:00
Pan Xiuli c46ed5df30 scripts: add tgl-h support
Add tgl-h build support.
It will generate sof-tgl-h.ri

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2020-12-09 11:06:31 +00:00
Jaska Uimonen 6f0829b2a6 scripts: remove restriction for tgl rimage signing
Currently xtensa-build-all.sh has restriction to use rimage for tgl
signing, because rimage didn't support tgl. As rimage now has support
for tgl signing let's remove this limitation.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2020-11-18 12:07:23 +00:00
Keyon Jie b20d86f2ce host-testbench.sh: update comment for testbench building
The host-build-all.sh is deprecated, update to the recommended
'rebuild-testbench.sh'.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-11-09 22:08:30 +00:00
Marc Herbert 2aa62e1e65 rebuild-testbench.sh: don't build twice with combined "make install"
"make + make install" duplicates many steps, probably because of the
fatal combination of build timestamps + source hash, see PR #3353 for a
similar example.

A single, combined "make install" generates the exact same binary
outputs 30% faster and prints 30% shorter build logs.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-11-03 16:48:02 +00:00
Marc Herbert ec3ccab1b0 xtensa-build-all: document PRIVATE_KEY_OPTION and deprecate -k
Following commit 88b69cc2e5 ("scripts: xtensa-build-all: Add support
for building TGL and signing with MEU") we now have an unified and
flexible PRIVATE_KEY_OPTION that can do anything with very little code.

The -k option was never a good idea in the first place because it
already required an environment variable anyway (RIMAGE_PRIVATE_KEY)
instead of a command line argument so the code should have just checked
whether RIMAGE_PRIVATE_KEY was defined, that would have been
enough. Requiring the user to "double-confirm" with -k has been adding
extra complication for both the user interface and the implementation.

xtensa-build-all is effectively a "CMake configuration convenience"
script, however it shouldn't become an additional layer of indirection
and complexity and its interface should expose CMake (which is already a
layer of indirection!) as directly as possible.

See longer discussion in PR #3187

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-10-19 15:15:52 +01:00
Janusz Jankowski 15e03fd297 config: intel: use PCH name for tigerlake
We switch to PCH-based names instead of CPU config names for tigerlake+
platforms, because we need to support multiple variants of PCHs based
on one CPU famile - for example TGL-H & TGL-LP.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2020-09-30 12:03:54 +01:00
Marc Herbert d9eb16aa66 cmake: add warning when git submodule changes are found
As incredible as it sounds, some people run neither "git status" nor
"git diff" every few minutes and not even when their build fails. There
has been reports that they're puzzled when they miss a required
submodule update. This is an attempt to draw their attention based on
the assumption that they pay more attention to the CMake logs.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-09-29 11:19:25 +01:00
Jaska Uimonen 89acc5e4f0 docker-run.sh: pass-through PRIVATE_KEY_OPTION
Pass PRIVATE_KEY_OPTION environment variable to docker to be able to
define external key for signing.

Suggested-by: Marc Herbert <marc.herbert@intel.com>
Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2020-09-25 13:41:33 +01:00
Ranjani Sridharan 88b69cc2e5 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 <ranjani.sridharan@linux.intel.com>
2020-09-18 10:45:28 +01:00
Ranjani Sridharan 9956f6bb55 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 <ranjani.sridharan@linux.intel.com>
2020-09-18 10:45:28 +01:00
Ranjani Sridharan 26ca41b55e 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 <ranjani.sridharan@linux.intel.com>
2020-09-18 10:45:28 +01:00
Marc Herbert 0f4a0e2907 build-tools.sh: remove all the "Entering directory..." noise
This gets rid of about 600 lines of noisy "Entering directory..."
messages which cuts the size of the output of the script in half leaving
only useful stuff on the screen. This (and other changes before it) may
finally avoid bugs like 'commit f430addec7 ("Tools: Fuzzer: Do not use
illegal BUILD_COMMAND in CMakeLists.txt") evading scrutiny for months.

After so many years enjoying the convenience of make's '-C' option, I
finally did some research and realized it is the cause of this very
serious noise issue with no other easy way out :-(

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-09-17 09:56:19 +01:00
Marc Herbert 2b9206231c docker-run.sh: pass-through CMAKE_BUILD_TYPE
... thanks to the docker --env option which is smart enough not to pass
anything when there is nothing to pass.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-09-16 15:21:18 +01:00
Marc Herbert 1c6930e29f docker-run.sh: fix quoting issues
As reported by shellcheck

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-09-16 15:21:18 +01:00
Marc Herbert f7f9d5f42e tools: support standard CMAKE_BUILD_TYPE and default to Debug
To produce the exact same binaries than before this commit:

  CMAKE_BUILD_TYPE='  ' ./scripts/build-tools.sh

To observe which CFLAGS are being used:

   CMAKE_BUILD_TYPE=Release VERBOSE=1 ./scripts/build-tools.sh

Off topic: the logger fails to build with: -O3 -DNDEBUG -Wall -Werror
(all other tools build fine with these flags)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-09-14 10:41:14 +01:00
Marc Herbert 6be9315596 rebuild-testbench.sh: remove CMAKE_VERBOSE_MAKEFILE
Default is verbose enough. VERBOSE=1 can still be used later at make
time.

Also change nproc to nproc --all because we don't care about offline
processors.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-09-01 16:26:15 +01:00
Marc Herbert 37b5893ee6 host-testbench.sh: clean up output files when tests are successful
Make git status great again.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-09-01 16:26:15 +01:00
Marc Herbert 55eecdd1d4 host-build-all.sh: print deprecation warning
Use newer rebuild-testbench.sh instead, added by
commit 46578cb103 ("scripts: Add a new script to rebuild testbench")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-09-01 10:42:56 +01:00
Karol Trzcinski b2a325a3b7 cmake: Handle empty SOF_SRC_HASH_LONG
SOF_SRC_HASH always must have integer value, because of usage
them to initialize global variable in source code.
Variables, which may be empty should be used inside quotation
to prevent cmake incorect number of arguments error.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-09-01 10:01:08 +01:00
Karol Trzcinski 67e41d21c3 cmake: Keep temporary files used to compute source hash
Temporary files are useful to understand and debug the build.
Moving output to another directory, keeps binary directory clean.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-09-01 10:01:08 +01:00
Karol Trzcinski 97e2a3c583 cmake: Look for .git folder in SOF_ROOT_SOURCE_DIRECTORY directory
This is possible location of .git folder, instead of CMAKE_SOURCE_DIR.
Without this patch, checked condition always return false and
GIT_LOG_HASH is used instead source code hash.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-09-01 10:01:08 +01:00
Karol Trzcinski 3a21088444 cmake: Rephrase message about git absence during source hash computing
This message shoulddn't be in imperative mode, to follow rules.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-09-01 10:01:08 +01:00
Marc Herbert 35d9034090 build-tools.sh: fix misnamed locals DO_BUILD_topology and _test
Easier to spot once all other shellcheck warnings have been fixed.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-08-31 14:43:11 +01:00
Marc Herbert f30d11072a build-tools.sh: fix minor shellcheck warnings
Missing quotes mostly, also some disable=SC2034 because "eval".

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-08-31 14:43:11 +01:00
Mohana Datta Yelugoti 46578cb103 scripts: Add a new script to rebuild testbench
Currently, the testbench is built using the script named
'host-build-all.sh' under scripts directory. But the name of
the script, it's git history doesn't refer to what the script
is currently doing now.

The newly written script adds option to build the testbench.
This script was written in mind to remove the old script
used to build the testbench (i.e host-build-all.sh).

The script also adds an option to build the testbench with
AFL instrumentation. AFL fuzzer works well when the code
it's trying to fuzz is instrumented properly. The instrumentation
helps the fuzzer in generating unique inputs which cover
different paths in the code graph. When the option is set,
testbench is built using a compiler AFL provides, which does
the instrumentation work.

Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
2020-08-28 13:38:04 +01:00
Liam Girdwood 7a10da097c cmake: set git hash to 8 digit
GIT_LOG_HASH can be more than 8 digits. Limit hash value up to
first 8 digits.

fixes: #3322

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2020-08-24 09:37:46 +01:00
Karol Trzcinski 2263a8bc62 cmake: Include GIT_TAG in generated version.h file
GIT_TAG is user readable form of used source code version with
commit identifier, what is important for bugs reproducibility,
so it will be convenient to have this information in output logs.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-18 10:35:29 +01:00
Karol Trzcinski 60b737a7a1 sof: Calculate source code hash
It may be used to check FW compatibility with ldc file.
It's much better than comparing DBG_ABI because logs content
may be updated without any DBG_ABI change in opposite to source
code hash value.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-18 10:35:29 +01:00
Liam Girdwood b521bb1256 docker: alsa: allow alsa development in container
Build ALSA locally under /home/sof/work and don't delete it. This will
allow ALSA development within the container.
Change the folder owner to sof to avoid permission issue.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2020-08-10 13:51:40 +01:00
Liam Girdwood f52350ef3a docker: update toolchains to GCC 9.3 and GDB 8.3
Use the later toolchains for docker.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2020-08-10 13:51:40 +01:00
Andy Ross fd506970cc zephyr: kconfig: rename CONFIG_SMP -> CONFIG_MULTICORE
This kconfig collides with one of the same name in Zephyr.  Rename it
for clarity ("MULTICORE" was picked for symmetry with the existing
"CORE_COUNT", though it's admittedly a little long...).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-07-24 19:55:05 +01:00
Shreeya Patel d434dbc8e1 xtensa-build-all: fix gcc _defconfig for byt|cht|cnl|sue
In renaming of $j -> $platform one instance of variable was missed which
has led to wrong configs being used.

Fixes: 941dfcccb0 ("use switch case")

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
2020-07-14 12:12:15 +01:00
Marc Herbert 5564a9029a xtensa-build-all.sh: add missing double quotes
Fixes most shellcheck warnings, now down to just 4.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-07-13 17:35:50 +03:00
Marc Herbert 318dc9f7e1 check patch: ABI warning only once per file, not once per line
Stop drowning and missing other warnings.

Example:

 ./scripts/checkpatch.pl -g eaf49e26b4bb~0

- 40 "Please update ABI..." warnings
- 2 other warnings including a spelling mistake that were missed.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-07-10 15:48:57 +01:00
Marc Herbert b70b13cc1a dist.cmake: add 'rebuild_cache' warning.
dist.cmake is (for now) the only .cmake file that uses GIT_TAG at _cmake
configure time_. This means even "make clean" is not enough for
dist.cmake to take into account some git tag or version change. It's
very confusing because on the other hand "make check_version_h" and
everything else always shows up-to-date git information.

"make rebuild_cache" addresses this situation so mention it in a
warning.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-07-10 15:41:18 +01:00
Marc Herbert e9c83cf009 version.cmake: add "--match v*" to fix git describe
Before this fix, any random, later git tag like for instance
"releases/jsl/v3.0-rc1" would be picked up and then immediately
discarded and replaced with v0000 because it didn't start with 'v*'

Also log all the versions always and not just when there is already a
.tarball-version file.

Increase --abbrev=12 because --abbrev=4 doesn't seem to make sense.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-07-09 10:45:13 +01:00
Marc Herbert 123081c34f xtensa-build-all.sh: log the main cmake and defconfig commands
The main build script has a fairly verbose output by default but not the
most important things it does yet. These commands are useful to "peel"
the layer of indirection and debug cmake issues; either locally or when
wondering what CI does.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-07-08 13:44:27 +01:00
Marc Herbert a107cfabab dist.cmake: add --prefix to git archive to stop creating a "tarbomb"
A "tarbomb" is an archive file that has more than one directory at the
top level, which is (fortunately) unusual for .tar files. By default,
tar extracts archive members "as is" in the current directory. If the
archive has many top level members then it becomes very hard to make the
difference between what was just extracted versus what was already
there. As extraction is recursive this gets much worse because the
problem can repeat itself in subdirectories. As the last but not least
nail in the coffin, tar silently overwrites existing files by default.

This commit is admittedly an "incompatible build API change" meaning any
higher level build or packaging script that was consuming source release
tarballs (as opposed to git cloning the source) will require a small
change. Consumers of release tarballs must be rare though because the
output of "make dist" has already been broken by commit
c00d39c71b ("Add rimage as a git submodule") anyway yet no one noticed
yet.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-07-08 13:40:36 +01:00
Shreeya Patel 8a90be118c scripts: build-tools.sh: Make tools individually buildable
More control over which tools should be built, instead of building
everything every time.

Note: All the build files will be removed every time this script is ran
since tools are not independent of each other.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
2020-07-06 17:19:04 +01:00
Marc Herbert 1c4d14a5fb qemu-check.sh: restore error messages when test fails
Fixes 428804e1c ("scripts/qemu-check.sh: add set -e") which failed to
consider the case of an empty $IPC_REG or $IPC_MSG.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-30 11:30:19 +01:00
Marc Herbert 8ceef9d460 qemu-check.sh: make $ROM a quoted bash array "${ROM[@]}"
Removes shellcheck warning and could allow directory names with
whitespace in a very distant future.

Silence printf "$@" shellcheck warning in die() function.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-30 11:30:19 +01:00
Daniel Baluta 259a98ed4c scripts: checkpatch: deprecate 80-column warning
Yes, staying withing 80 columns is certainly still _preferred_.  But
it's not the hard limit that the checkpatch warnings imply, and other
concerns can most certainly dominate.

Increase the default limit to 100 characters.  Not because 100
characters is some hard limit either, but that's certainly a "what are
you doing" kind of value and less likely to be about the occasional
slightly longer lines.

Miscellanea:

 - to avoid unnecessary whitespace changes in files, checkpatch will no
   longer emit a warning about line length when scanning files unless
   --strict is also used

 - Add a bit to coding-style about alignment to open parenthesis

dbaluta: This patch is taken and manually applied from Linux kernel
tree. See commit, in Linux kernel tree:

bdc48fa11e46 ("checkpatch/coding-style: deprecate 80-column warning")

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2020-06-29 20:57:55 +01:00
Marc Herbert 4a87d8c967 xtensa-build-all.sh: add tgl with xtensa-cnl-elf. No rimage yet.
Copy the icl and cnl configurations.

This build with the gcc toolchain has NOT been tested on tgl. The
purpose is purely to add the gcc build to CI, avoid future gcc bitrot
and catch more warnings and bugs.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-22 13:00:56 +01:00
Marc Herbert e76ccbad59 scripts/xtensa-build-all.sh: clarify help of -c option
"Configure defconfig" misses the most important, interactive difference.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-16 09:04:05 +01:00
Marc Herbert 2afbbd0ef1 cmake/git-submodules: don't throw away work in progress at build time
- Add a simple test in cmake to download submodules only when rimage is
  missing. This stops randomly changing the source code from one build
  to the next and overwriting any submodule work in progress.

- Remove the GIT_SUBMODULE option which is now useless because rimage is
  not optional for sof

- Add a --merge option for safety. It makes zero difference right now
  but could save work in progress if we ever add more
  submodules (hopefully not) and someone struggles with submodules and
  ends up in a partially initialized state.

Git submodules are rarely ever the answer; these few changes make them a
bit more usable.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-15 21:23:30 +01:00
Marc Herbert 428804e1cb scripts/qemu-check.sh: add set -e
qemu always times out and fails, ignore that.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-05 15:38:55 +01:00
Marc Herbert 454b2b1f43 scripts/qemu-check.sh: add find_qemu_extensa()
qemu-check.sh can now be invoked from more places: not just the qemu
directory but also from sof/ and from their parent.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-05 15:38:55 +01:00
Marc Herbert de8b043371 scripts/qemu-check.sh: unhardcode ../sof.git/
Find it with dirname "$0" instead. Can also be overridden with
SOF_BUILDS from now on.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-05 15:38:55 +01:00
Marc Herbert 7c0ab36ac3 scripts/qemu-check.sh: double-quote "$vars" expansion. Zero-change.
As reported by shellcheck SC2086.

Minor usage() fix.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-06-05 15:38:55 +01:00
Pan Xiuli 4ce5ed477a cmake: use SOF_ROOT_SOURCE_DIRECTORY for git submodule
In SOF, there is another project in tools folder. It also need riamge
submodule support.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2020-05-18 14:39:40 +01:00
Marc Herbert 3606629f7e scripts/build-tools.sh: let user override NO_PROCESSORS
When there's a failure like for instance SOF issue #2543, fixed in
alsa-utils commit caf77a93cef5 ("topology: add back asrc to widget_map
in dapm.c"), it's finally possible to remove all the noise around the
failure and see the failed command:

   NO_PROCESSORS=1 VEBOSE=1 ./scripts/build-tools.sh

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-18 13:43:29 +01:00
Marc Herbert 19745de6e3 scripts/testbench: add set -e
Let's stop ignoring build and test failures. Start gradually with the
scripts involved in testbench, more files later.

Follow-up to to bug #2752 "host-testbench.sh ignores errors" and commit
ab421466af ("CI: Travis: enable host testbnech again") and
ab421466aff826~1

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-18 13:41:01 +01:00
Pan Xiuli 1fbdc7f788 scripts: fix testbench with more check
add status check for the host testbench
also fix file size check

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2020-05-13 10:38:12 +01:00
Daniel Leung d53778f372 cmake: update git submodules when cmake is run
This adds the necessary bits to update git submodules when
cmake is run, with the option to turn this behavior off if
needed. This is in preparation to use fw.h and manifest.h
from the rimage repo to prevent having two copies of each
file in two different repos. Obviously, the files in
the submodules must exist before building the firmware,
so run git submodule update to checkout the files.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-13 10:16:04 +01:00
Shreeya Patel 782066e0aa docker_build: Use shallow clones
We don't need history for building qemu or sof. Using shallow clones
will save time spent on downloading unnecessary history which is
significant for bigger repos like qemu.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
2020-05-08 11:39:48 +01:00
Shreeya Patel 0f4141a367 scripts: qemu-check.sh: Exit if unknown platform specified
Exits if an unknown platform is specified. Currently, there are no
warnings or errors.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
2020-04-21 14:59:27 +01:00
Shreeya Patel 5f640a4d3f scripts: qemu-check.sh: Use switch case
Use switch case for testing strings instead of if statements for each
case.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
2020-04-21 14:59:27 +01:00
Shreeya Patel 729ab7e5f6 scripts: qemu-check.sh: Use getopts
Use getopts to parse the arguments instead of manual parsing to leave no
room for errors, bugs, and inconsistent conventions introduced by custom
implementation.

The script uses no options as of now, so current implementation just
exits if any option is provided.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
2020-04-21 14:59:27 +01:00
Shreeya Patel 4f288b2c4d scripts: qemu-check.sh: Make PLATFORMS a proper array
"PLATFORMS" variable was used as an array while it is actually a string
used incorrectly making it work accidentally.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
2020-04-21 14:59:27 +01:00
Shreeya Patel 6925c940ba scripts: xtensa-build-all.sh: Derive $ROOT from $HOST
Derive $ROOT from $HOST instead of explicit assignments.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
2020-04-21 14:55:53 +01:00
Shreeya Patel 941dfcccb0 scripts: xtensa-build-all.sh: Use switch case
Use switch case for testing strings instead of if statements for each
case.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
2020-04-21 14:55:53 +01:00
Shreeya Patel d0cd2e0eac scripts: xtensa-build-all.sh: Ignore set -e the right way
Currently, "set -e" is being ignored for type command using redirections
and "A && true". "A && true" is a no-op and a peculiar case where
"set -e" ignores the exit code of A.

Exit code of the "type" command is used in an if statement which is
exactly what the function of "if" command is. Also, "set -e" ignores
exit codes of commands used in if statements.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
2020-04-21 14:55:53 +01:00
Shreeya Patel 50d8646a64 scripts: xtensa-build-all.sh: Exit if unknown platform specified
Exits if an unknown platform is specified. Currently, there are no
warnings or errors.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
2020-04-21 14:55:53 +01:00