aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
authorMark Brown <broonie@kernel.org>2026-05-29 17:41:20 +0100
committerMark Brown <broonie@kernel.org>2026-05-29 17:41:20 +0100
commitc8741d22c4136a6b19b2055af33bf83cce617eb6 (patch)
tree700a7a0f16a7e21b78e9255610722fedc94876e2 /Makefile
parentb7fcd17dd291cd1917f81718e89d1c0fd97c3baf (diff)
parent880bae5f1269b4d81bb2a254963e84377cd37bc1 (diff)
downloadlinux-next-history-c8741d22c4136a6b19b2055af33bf83cce617eb6.tar.gz
Merge branch 'spdx-linus' of https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx.git
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 26 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index f056c921ea9cd..8ef23640218d7 100644
--- a/Makefile
+++ b/Makefile
@@ -787,7 +787,7 @@ endif
# in addition to whatever we do anyway.
# Just "make" or "make all" shall build modules as well
-ifneq ($(filter all modules nsdeps compile_commands.json clang-%,$(MAKECMDGOALS)),)
+ifneq ($(filter all modules nsdeps compile_commands.json clang-% sbom,$(MAKECMDGOALS)),)
KBUILD_MODULES := y
endif
@@ -1692,7 +1692,7 @@ CLEAN_FILES += vmlinux.symvers modules-only.symvers \
modules.builtin.ranges vmlinux.o.map vmlinux.unstripped \
compile_commands.json rust/test \
rust-project.json .vmlinux.objs .vmlinux.export.c \
- .builtin-dtbs-list .builtin-dtbs.S
+ .builtin-dtbs-list .builtin-dtbs.S sbom-*.spdx.json
# Directories & files removed with 'make mrproper'
MRPROPER_FILES += include/config include/generated \
@@ -1811,6 +1811,7 @@ help:
@echo ''
@echo 'Tools:'
@echo ' nsdeps - Generate missing symbol namespace dependencies'
+ @echo ' sbom - Generate Software Bill of Materials'
@echo ''
@echo 'Kernel selftest:'
@echo ' kselftest - Build and run kernel selftest'
@@ -2197,6 +2198,29 @@ nsdeps: export KBUILD_NSDEPS=1
nsdeps: modules
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/nsdeps
+# Script to generate .spdx.json SBOM documents describing the build
+# ---------------------------------------------------------------------------
+
+ifdef building_out_of_srctree
+sbom_targets := sbom-source.spdx.json
+endif
+sbom_targets += sbom-build.spdx.json sbom-output.spdx.json
+quiet_cmd_sbom = GEN $(sbom_targets)
+ cmd_sbom = printf "%s\n" "$(KBUILD_IMAGE)" >"$(tmp-target)"; \
+ $(if $(CONFIG_MODULES),sed 's/\.o$$/.ko/' $(objtree)/modules.order >> "$(tmp-target)";) \
+ $(PYTHON3) $(srctree)/scripts/sbom/sbom.py \
+ --src-tree $(abspath $(srctree)) \
+ --obj-tree $(abspath $(objtree)) \
+ --roots-file "$(tmp-target)" \
+ --output-directory $(abspath $(objtree)) \
+ --generate-spdx \
+ --package-license "GPL-2.0 WITH Linux-syscall-note" \
+ --package-version "$(KERNELVERSION)" \
+ --write-output-on-error;
+PHONY += sbom
+sbom: $(notdir $(KBUILD_IMAGE)) include/generated/autoconf.h $(if $(CONFIG_MODULES),modules modules.order)
+ $(call cmd,sbom)
+
# Clang Tooling
# ---------------------------------------------------------------------------