Re: [RFC PATCH] kbuild: Make --build-id linker flag configurable

From: Naman Jain

Date: Tue Feb 03 2026 - 01:31:03 EST




On 2/3/2026 4:45 AM, Nathan Chancellor wrote:
On Mon, Feb 02, 2026 at 03:15:30PM +0100, Thomas Weißschuh wrote:
On Mon, Feb 02, 2026 at 11:06:31AM +0000, Naman Jain wrote:
I am trying to implement reproducible builds for one of my product
kernel. I referred https://reproducible-builds.org/docs/build-path/
and tried to use both -fdebug-prefix-map=OLD=NEW and
-fmacro-prefix-map=OLD=NEW, but still could not achieve bit by bit
binary reproducibility without overwriting build-id to none.
If I move the kernel to same path in other setup, I was able to create
same binary hash, however, without it, there is some difference in
build-id hash values.

Can you force the same build path during package building?
That should avoid this issue.

Yeah, I think that it would be better to document this in
Documentation/kbuild/reproducible-builds.rst, as opposed to adding a
hack to disable the build ID altogether. It seems easy enough to make
the paths consistent between machines and environments by using a
container or such. The new scripts/container in -next could help there.

Cheers,
Nathan

Thank you Nathan for your inputs.

I'll plan to ensure same path for my kernel build, and send a patch to add this in reproducible builds documentation.

--- a/Documentation/kbuild/reproducible-builds.rst
+++ b/Documentation/kbuild/reproducible-builds.rst
@@ -58,6 +58,9 @@ to an absolute filename in an out-of-tree build. Kbuild automatically
uses the ``-fmacro-prefix-map`` option to prevent this, if it is
supported.

+If it still does not work, ensure that the kernel is built in the same
+directory, using containers or such.
+
The Reproducible Builds web site has more information about these
`prefix-map options`_.



Regards,
Naman