Skip to content

Microsoft: build reproducible kernel in-place without a temp copy#152

Merged
namancse merged 1 commit into
product/hcl-main/6.18from
user/namjain/repro-build-no-tmp
Jul 8, 2026
Merged

Microsoft: build reproducible kernel in-place without a temp copy#152
namancse merged 1 commit into
product/hcl-main/6.18from
user/namjain/repro-build-no-tmp

Conversation

@namancse

@namancse namancse commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

With the necessary flags to be used to prevent different paths being embedded into the final kernel binary, there is no longer a need to copy the kernel source to same path for achieving bit by bit reproducibility. Add the necessary support and then remove the temporary copy logic.

@namancse namancse marked this pull request as ready for review July 6, 2026 10:05
@namancse namancse requested review from Copilot and hargar19 July 6, 2026 10:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Microsoft kernel build scripts to achieve bit-for-bit reproducible outputs without copying the source tree into a fixed temporary directory, relying instead on compiler path-remapping flags to eliminate absolute-path leakage into debug info and build IDs.

Changes:

  • Remove the “copy source to fixed path” workflow and build directly in the checked-out kernel repository.
  • Add -ffile-prefix-map mappings (source dir + build dir) via KCFLAGS/KAFLAGS to normalize embedded paths.
  • Centralize the version-string stabilization (LOCALVERSION=) while adjusting reproducibility verification output locations.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
Microsoft/nix-build.sh Switches to in-place builds and exports path-remapping flags for reproducibility instead of copying to a fixed temp path.
Microsoft/build-hcl-kernel.sh Stops injecting debug-path flags internally and relies more on caller-provided reproducibility environment.
Microsoft/build-hcl-kernel-pipeline.sh Removes fixed-path copy logic and adds source/build path remapping via KCFLAGS/KAFLAGS for reproducible pipeline builds.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Microsoft/nix-build.sh Outdated
Comment thread Microsoft/build-hcl-kernel.sh
Comment thread Microsoft/build-hcl-kernel-pipeline.sh Outdated
Build the kernel directly in its tree instead of copying the source to a
fixed /tmp path and rsync-ing artifacts back. Path independence is now
provided by -ffile-prefix-map, mapping the source and build directories to
'.' so absolute paths no longer leak into DWARF info or the link-time GNU
build-id. KAFLAGS carries the same map because assembly (.S) sources use
AFLAGS, not CFLAGS.

nix-build.sh exports KCFLAGS/KAFLAGS via the environment and
build-hcl-kernel.sh no longer hardcodes KCFLAGS on the make command line
(which would override the environment), so the normalization flags take
effect. build-hcl-kernel-pipeline.sh drops its /tmp fixed-path copy (and the
cleanup/copy-back) and applies the same -ffile-prefix-map in KCFLAGS and
KAFLAGS.

The result is an identical vmlinux regardless of the source location,
verified byte-for-byte across two build paths.

Signed-off-by: Naman Jain <namjain@linux.microsoft.com>
@namancse namancse force-pushed the user/namjain/repro-build-no-tmp branch from cf1ecc9 to 02b9ee9 Compare July 7, 2026 04:02
@namancse namancse merged commit 4bc1f9a into product/hcl-main/6.18 Jul 8, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants