Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 1.88 KB

File metadata and controls

29 lines (23 loc) · 1.88 KB

Strace Kernel Build

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.

Usage

  1. Prepare a clean kernel source tree with a .config in a dedicated object tree, for example:

    make tinyconfig O=kernel_build

    Ensure all dependencies are installed so that make O=kernel_build succeeds.

  2. 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.txt generated 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 build
    • files_touched.txt — all files the build attempted to open
    • source_files_touched.txt — subset of files inside the source tree
    • filtered_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.