summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2026-10-01 13:47:12 +0100
committerMark Brown <broonie@kernel.org>2026-10-01 13:47:12 +0100
commit1bcb5e766af03c584ba673ef358862a95b1dc493 (patch)
tree327b19436db3f026adb01a34867b32667768162d /tools
parentb5abb5bb05ceeadc280bb1df3016ebc84a882613 (diff)
parent59ba9b8f8803c132f59db74bdd4b809c30dbe3c7 (diff)
downloadlinux-next-1bcb5e766af03c584ba673ef358862a95b1dc493.tar.gz
linux-next-1bcb5e766af03c584ba673ef358862a95b1dc493.zip
Merge branch 'kbuild-for-next' of https://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git
# Conflicts: # scripts/kallsyms.c
Diffstat (limited to 'tools')
-rwxr-xr-xtools/lib/python/jobserver.py13
-rwxr-xr-xtools/testing/selftests/kho/vmtest.sh2
-rwxr-xr-xtools/testing/selftests/liveupdate/vmtest.sh4
-rw-r--r--tools/testing/selftests/nolibc/Makefile.nolibc2
4 files changed, 17 insertions, 4 deletions
diff --git a/tools/lib/python/jobserver.py b/tools/lib/python/jobserver.py
index 0b1ffdf9f7a3..7e94635bf7d9 100755
--- a/tools/lib/python/jobserver.py
+++ b/tools/lib/python/jobserver.py
@@ -29,6 +29,10 @@ $claim child to do the actual work.
The end goal here is to keep the total number of build tasks under the
limit established by the initial ``make -j$n_proc`` call.
+A command that takes its thread count on the command line rather than from
+the environment can use the ``%PARALLELISM%`` token in its arguments, which
+is replaced by the count, or by 1 when there is no jobserver.
+
See:
https://www.gnu.org/software/make/manual/html_node/POSIX-Jobserver.html#POSIX-Jobserver
"""
@@ -38,6 +42,8 @@ import os
import subprocess
import sys
+PARALLELISM_TOKEN = "%PARALLELISM%"
+
def warn(text, *args):
print(f'WARNING: {text}', *args, file = sys.stderr)
@@ -182,6 +188,9 @@ class JobserverExec:
Run a command setting PARALLELISM env variable to the number of
available job slots (claim) + 1, e.g. it will reserve claim slots
to do the actual build work, plus one to monitor its children.
+
+ Any %PARALLELISM% in the command's arguments is replaced by the same
+ number, or by 1 when there is no jobserver.
"""
self.open() # Ensure that self.claim is set
@@ -192,4 +201,8 @@ class JobserverExec:
if self.claim:
os.environ["PARALLELISM"] = str(self.claim)
+ if not isinstance(cmd, str):
+ parallelism = str(self.claim or 1)
+ cmd = [arg.replace(PARALLELISM_TOKEN, parallelism) for arg in cmd]
+
return subprocess.call(cmd, *args, **pwargs)
diff --git a/tools/testing/selftests/kho/vmtest.sh b/tools/testing/selftests/kho/vmtest.sh
index 0014bd76e88d..1e86ffcc3a79 100755
--- a/tools/testing/selftests/kho/vmtest.sh
+++ b/tools/testing/selftests/kho/vmtest.sh
@@ -100,7 +100,7 @@ file /init $tmp_dir/init 0755 0 0
file /kernel $kernel 0644 0 0
EOF
- "$build_dir/usr/gen_init_cpio" "$tmp_dir/cpio_list" > "$initrd"
+ "$build_dir/scripts/gen_init_cpio" "$tmp_dir/cpio_list" > "$initrd"
}
function run_qemu() {
diff --git a/tools/testing/selftests/liveupdate/vmtest.sh b/tools/testing/selftests/liveupdate/vmtest.sh
index 64fd2ab55b76..672a9e9d685a 100755
--- a/tools/testing/selftests/liveupdate/vmtest.sh
+++ b/tools/testing/selftests/liveupdate/vmtest.sh
@@ -152,7 +152,7 @@ file /test_binary $workspace_dir/test_binary 0755 0 0
EOF
# Generate inner_initrd.cpio
- "$build_dir/usr/gen_init_cpio" "$workspace_dir/cpio_list_inner" > "$workspace_dir/inner_initrd.cpio"
+ "$build_dir/scripts/gen_init_cpio" "$workspace_dir/cpio_list_inner" > "$workspace_dir/inner_initrd.cpio"
cat > "$workspace_dir/cpio_list" <<EOF
dir /dev 0755 0 0
@@ -166,7 +166,7 @@ file /initrd.img $workspace_dir/inner_initrd.cpio 0644 0 0
EOF
# Generate the final initrd
- "$build_dir/usr/gen_init_cpio" "$workspace_dir/cpio_list" > "$initrd"
+ "$build_dir/scripts/gen_init_cpio" "$workspace_dir/cpio_list" > "$initrd"
}
function run_qemu() {
diff --git a/tools/testing/selftests/nolibc/Makefile.nolibc b/tools/testing/selftests/nolibc/Makefile.nolibc
index f70c8dfca018..380200b152e4 100644
--- a/tools/testing/selftests/nolibc/Makefile.nolibc
+++ b/tools/testing/selftests/nolibc/Makefile.nolibc
@@ -295,7 +295,7 @@ run-user: nolibc-test
$(Q)$(REPORT) $(CURDIR)/run.out
initramfs.cpio: kernel nolibc-test
- $(QUIET_GEN)echo 'file /init nolibc-test 755 0 0' | $(objtree)/usr/gen_init_cpio - > initramfs.cpio
+ $(QUIET_GEN)echo 'file /init nolibc-test 755 0 0' | $(objtree)/scripts/gen_init_cpio - > initramfs.cpio
initramfs: nolibc-test
$(QUIET_MKDIR)mkdir -p initramfs