Page MenuHomeFreeBSD

sys/conf: Remap paths for reproducibility
ClosedPublic

Authored by markj on Jun 20 2025, 5:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 9, 2:50 AM
Unknown Object (File)
Wed, Oct 8, 6:16 AM
Unknown Object (File)
Thu, Oct 2, 5:56 PM
Unknown Object (File)
Thu, Oct 2, 12:21 AM
Unknown Object (File)
Tue, Sep 30, 8:04 PM
Unknown Object (File)
Tue, Sep 30, 8:38 AM
Unknown Object (File)
Sep 15 2025, 11:23 AM
Unknown Object (File)
Sep 2 2025, 5:25 PM
Subscribers
None

Details

Summary

As in bsd.lib.mk and bsd.prog.mk, we need to remap paths in the kernel
and in kernel modules when reproducible builds are configured. Add
directives to kern.post.mk and kmod.mk to remap the src, obj and sysroot
dirs.

For the sysroot, we need to pass the value of the SYSROOT variable to
the kernel makefiles, which involves changing Makefile.inc1. In so
doing I reverted a portion of commit 35fb812adfc21; I can't see any harm
in passing the SYSROOT variable down.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Jun 20 2025, 5:13 PM
markj created this revision.

I think this is directionally the right way to do but haven't had a chance to take a detailed look. I don't like that we have duplicated logic in several places and have been pondering whether there's a way to avoid it, but don't have a good idea off hand.

I think this is directionally the right way to do but haven't had a chance to take a detailed look. I don't like that we have duplicated logic in several places and have been pondering whether there's a way to avoid it, but don't have a good idea off hand.

To be clear, this logic isn't totally duplicated. The handling of KERNBUILDDIR is specific to kmod.mk, and the canonical objdir is different between the kernel and kernel modules. If anything, it makes some sense to have separate blocks for handling the kernel vs. kernel modules since the two are built quite differently.

The distinction in the bsd.prog.mk/bsd.lib.mk is less useful, I agree. There I'll see if I can factor the duplication into a bsd.debug.mk or so.

This revision was not accepted when it landed; it landed in state Needs Review.Aug 21 2025, 3:58 PM
This revision was automatically updated to reflect the committed changes.