diff --git a/config/linux-base.yaml b/config/linux-base.yaml index 94fb4b1e300d46d3131da733c0f67300158804e1..a0119904d5ce54e82f0aada23800f0811112dbd6 100644 --- a/config/linux-base.yaml +++ b/config/linux-base.yaml @@ -13,16 +13,22 @@ description: >- prebuild list to modify the config (e.g. `./scripts/config ...`) or even replace the .config, as required. + A higher level layer can optionally request kselftests to be built by + specifying `export BUILD_KSELFTESTS=true` in the prebuild section. If + specified, the kselftests package is exported in a tgz archive as the + KSELFTESTS artifact. + build: linux: repo: remote: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git revision: v6.1 - toolchain: aarch64-none-elf- + toolchain: aarch64-linux-gnu- prebuild: - export BUILD_KMODULES=false + - export BUILD_KSELFTESTS=false - export ARCH=arm64 - make -j${param:jobs} O=${param:builddir} defconfig @@ -46,6 +52,17 @@ build: - touch ${param:builddir}/modules.tgz - fi + - if [ "$$BUILD_KSELFTESTS" = "true" ]; then + # Make kselftests and package into tgz archive. + - make -j${param:jobs} O=${param:builddir} headers_install + - make -j${param:jobs} O=${param:builddir} -C tools/testing/selftests install INSTALL_PATH=${param:builddir}/kselftests + - tar -caf ${param:builddir}/kselftests.tgz -C ${param:builddir}/kselftests . + - rm -rf ${param:builddir}/kselftests + - else + # Dummy kselftests archive to keep artifacts happy. + - touch ${param:builddir}/kselftests.tgz + - fi + clean: - export ARCH=arm64 - make -j${param:jobs} O=${param:builddir} clean @@ -53,3 +70,4 @@ build: artifacts: KERNEL: ${param:builddir}/arch/arm64/boot/Image KMODULES: ${param:builddir}/modules.tgz + KSELFTESTS: ${param:builddir}/kselftests.tgz diff --git a/docker/Dockerfile.slim b/docker/Dockerfile.slim index 7898a7d5cebc6c41cb8ff0c16afb54a8fa477615..867bdd5debf25e3d8074340dac0aa61ec8c9d021 100644 --- a/docker/Dockerfile.slim +++ b/docker/Dockerfile.slim @@ -87,6 +87,12 @@ RUN apt-get install --assume-yes --no-install-recommends --option=debug::pkgProb build-essential \ pkg-config +# Install packages requried by Linux. +RUN apt-get install --assume-yes --no-install-recommends --option=debug::pkgProblemResolver=yes \ + build-essential \ + fakeroot \ + rsync + # TODO: Install any packages required by U-Boot, OP-TEE, Trusty, etc. # Install the aarch64-linux-gnu- toolchain. We use the stock Debian packages for diff --git a/shrinkwrap/utils/config.py b/shrinkwrap/utils/config.py index 53766a3872984ffe8479e9f2dc94f1a98654dc8f..6a67a8ec3e2f5ba50e03d72fb9d59c2d3c993fec 100644 --- a/shrinkwrap/utils/config.py +++ b/shrinkwrap/utils/config.py @@ -434,6 +434,18 @@ def resolveb(config, clivars={}): raise Exception(f"'{name}' uses unnamed 'artifact' macro. 'artifact' macros must be named.") artifacts.add(m['name']) + for scope in ['prebuild', 'build', 'postbuild', 'clean']: + for s in component[scope]: + for t in _string_tokenize(str(s)): + if t['type'] != 'macro': + continue + m = t['value'] + if m['type'] != 'artifact': + continue + if m['name'] is None: + raise Exception(f"'{name}' uses unnamed 'artifact' macro. 'artifact' macros must be named.") + artifacts.add(m['name']) + importers[name] = sorted(list(artifacts)) artifacts_exp = {} diff --git a/shrinkwrap/utils/process.py b/shrinkwrap/utils/process.py index 729bd9491e01cf14a0d76e44b9a674a92a6eed2f..d0d9d4f3da0ea9167b68270b81a881251770617e 100644 --- a/shrinkwrap/utils/process.py +++ b/shrinkwrap/utils/process.py @@ -121,7 +121,9 @@ class ProcessManager: # to correctly return the carriage for interactive # terminals. Telnet sometimes gives '\r\r\n' too, which # would be incorrectly translated to '\n\n'. - proc._stdout = io.TextIOWrapper(proc._stdout, newline='') + proc._stdout = io.TextIOWrapper(proc._stdout, + newline='', + errors='replace') # stdout and stderr get merged into pty, so can't tell # them apart. This isn't a problem for the emit build # warnings use case. @@ -132,7 +134,8 @@ class ProcessManager: stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - universal_newlines=True) + universal_newlines=True, + errors='replace') proc._stdin = None proc._stdout = proc._popen.stdout