Skip to content

Commit dafa0a5

Browse files
committed
updated Readme
Signed-off-by: Luis Augenstein <luis.augenstein@tngtech.com>
1 parent 7f9af6c commit dafa0a5

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ SPDX-FileCopyrightText: 2025 TNG Technology Consulting GmbH
66
# KernelSbom
77

88
A script to generate an SPDX-format Software Bill of Materials (SBOM) for the linux kernel build.
9-
The eventual goal is to integrate the `sbom/` directory into the `linux/scripts/` directory in the official [linux](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git) source tree.
9+
The eventual goal is to integrate the `sbom/` directory into the `linux/tools/` directory in the official [linux](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git) source tree.
1010

1111
## How to use
1212
1. Provide a linux source and object tree, e.g., by downloading precompiled test data from [KernelSbom-TestData](https://fileshare.tngtech.com/d/e69946da808b41f88047/files)
@@ -36,7 +36,8 @@ The eventual goal is to integrate the `sbom/` directory into the `linux/scripts/
3636
--roots arch/x86/boot/bzImage \
3737
--generate-spdx \
3838
--generate-used-files \
39-
--prettify-json
39+
--prettify-json \
40+
--debug
4041
```
4142

4243
Starting from the provided root artifact (`bzImage`), the script constructs a **cmd graph**: a directed acyclic graph whose nodes are filenames and whose edges represent build dependencies extracted from the corresponding `.<filename>.cmd` files.
@@ -70,6 +71,22 @@ python3 sbom/sbom.py \
7071
--prettify-json
7172
```
7273

74+
### Reproducibility
75+
By default, SPDX documents are non-deterministic. The spdxIds are generated using random UUIDs, and the `CreationInfo.created` field is set to the current datetime. To produce deterministic outputs, the options `--spdxId-uuid` and `--created` must be provided:
76+
```bash
77+
export SRCARCH=x86
78+
python3 sbom/sbom.py \
79+
--src-tree ../linux \
80+
--obj-tree ../linux/kernel_build \
81+
--roots arch/x86/boot/bzImage \
82+
--generate-spdx \
83+
--generate-used-files \
84+
--prettify-json \
85+
--spdxId-uuid bd3ab149-b4a7-4993-8fb4-5c99093c4f28 \
86+
--created "2025-12-03 11:30:00" \
87+
--debug
88+
```
89+
7390
## SPDX Graph Visualization
7491

7592
The following diagrams illustrate the structure of the generated SPDX documents: `sbom-source.spdx.json`, `sbom-build.spdx.json`, and `sbom-output.spdx.json`.
@@ -225,7 +242,7 @@ flowchart TD
225242
VMLINUX_BIN -.->|Build| LOW_LEVEL_BUILD
226243
LOW_LEVEL_BUILD -->|hasInput| VMLINUX_BIN
227244
LOW_LEVEL_BUILD -->|hasOutput| BZIMAGE
228-
LOW_LEVEL_BUILD -.->|BUILD| BZIMAGE
245+
LOW_LEVEL_BUILD -.->|Build| BZIMAGE
229246
MAINC -->|hasDeclaredLicense| GPL2ONLY_LICENSEEXPRESSION
230247
end
231248
@@ -276,7 +293,7 @@ flowchart TD
276293
- [sbom_analysis/cmd_graph_visualization/](sbom_analysis/cmd_graph_visualization/README.md) - Interactive visualization of the cmd graph
277294
- `testdata_generation/` - Describes how the precompiled kernel builds in [KernelSbom-TestData](https://fileshare.tngtech.com/library/98e7e6f8-bffe-4a55-a8d2-817d4f3e51e8/KernelSbom-TestData/) were generated.
278295

279-
The main contribution of this repository is the content of the `sbom` directory which eventually should be moved into the `linux/scripts/` directory in the official [linux](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git) source tree.
296+
The main contribution of this repository is the content of the `sbom` directory which eventually should be moved into the `linux/tools/` directory in the official [linux](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git) source tree.
280297

281298
## Development
282299

sbom/sbom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def main():
5757
logging.debug(f"Found {len(used_files)} source files in cmd graph")
5858
with open(os.path.join(config.output_directory, config.used_files_file_name), "w", encoding="utf-8") as f:
5959
f.write("\n".join(str(file_path) for file_path in used_files))
60-
logging.debug(f"Successfully saved {config.used_files_file_name}")
60+
logging.debug(f"Successfully saved {os.path.join(config.output_directory, config.used_files_file_name)}")
6161

6262
if config.generate_spdx is False:
6363
return

0 commit comments

Comments
 (0)