The script strace-kernel_build.sh runs a Linux kernel build with strace to track all files accessed during the build. These files provide an upper bound on what should be captured by the cmd graph.
-
Prepare a clean kernel source tree with a
.configin a dedicated object tree, for example:make tinyconfig O=kernel_build
Ensure all dependencies are installed so that
make O=kernel_buildsucceeds. -
Run the script, providing the source tree (relative to the script), the object tree (relative to the source tree) and the path to the
sbom.used-files.txtgenerated by the main script:./strace-kernel_build.sh "../../../linux" "kernel_build" "../../sbom.used-files.txt"
The script generates the following output files (always placed next to the script):
strace.log— full raw strace output of the buildfiles_touched.txt— all files the build attempted to opensource_files_touched.txt— subset of files inside the source treefiltered_source_files-_touched.txt— final source files, excluding files not tracked by the cmd graph (Makefile*,Kbuild*,Kconfig*,tools/*,scripts/*)strace_only.txt— list of files found with strace but not with the cmd graph. This list should be empty. If not it should be investigated if these files should be included in the cmd graph. For example try removing all these files in the source tree and check if the kernel can still be built successfully.sbom_used_files_only.txt— list of files found with the cmd graph but not with strace. This list should be empty. If it is not empty the files within should either be excluded from the cmd graph or it should be investigated why strace did not find them.