Skip to contentSkip to conversation

kbuild: doc: improve KBUILD_BUILD_TIMESTAMP documentation

PATCH In review Gang Yan 2 participants 4 messages Oct 17, 2025 – Oct 22, 2025

Subsystems (2)
lore
Share & tools
lore

Gang Yan

author
#0 lore raw

PATCH v2 1/1 kbuild: doc: improve KBUILD_BUILD_TIMESTAMP documentation

From: Gang Yan <[email protected]>

This patch adds an example of how to set KBUILD_BUILD_TIMESTAMP to a specific date. Also, note that the provided timestamp is used for initramfs mtime fields, which are 32-bit and thus limited to dates between the Unix epoch and 2106-02-07 06:28:15 UTC. Dates outside this range will cause errors.

---
Changelog:
v2:
- Replace the invalid example with a valid one.
- Apply David's suggestions.

---
 Documentation/kbuild/kbuild.rst | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
Documentation/kbuild/kbuild.rst +8 -2
index 3388a10f2dcc..881189ecd0ca 100644
@@ -328,8 +328,14 @@ KBUILD_BUILD_TIMESTAMP
 ----------------------
 Setting this to a date string overrides the timestamp used in the
 UTS_VERSION definition (uname -v in the running kernel). The value has to
-be a string that can be passed to date -d. The default value
-is the output of the date command at one point during build.
+be a string that can be passed to date -d. E.g.::
+
+$ KBUILD_BUILD_TIMESTAMP="Mon Oct 13 00:00:00 UTC 2025" make
+
+The default value is the output of the date command at one point during
+build. If provided, this timestamp will also be used for mtime fields
+within any initramfs archive. Initramfs mtimes are 32-bit, so dates before
+the 1970 Unix epoch, or after 2106-02-07 06:28:15 UTC will fail.
 
 KBUILD_BUILD_USER, KBUILD_BUILD_HOST
 ------------------------------------
Signature · 1 line
2.43.0
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 11 lines · Gang Yan

From: Gang Yan <[email protected]>

This patch adds an example of how to set KBUILD_BUILD_TIMESTAMP to a specific date. Also, note that the provided timestamp is used for initramfs mtime fields, which are 32-bit and thus limited to dates between the Unix epoch and 2106-02-07 06:28:15 UTC. Dates outside this range will cause errors.

Quoted 9 lines

---
Changelog:
v2:
- Replace the invalid example with a valid one.
- Apply David's suggestions.

---
 Documentation/kbuild/kbuild.rst | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Thanks to both of you!

I have only found a tiny nit-pick, see below.

Documentation/kbuild/kbuild.rst KBUILD_BUILD_TIMESTAMP · line 333

Quoted 13 lines
Documentation/kbuild/kbuild.rst +3 -2
index 3388a10f2dcc..881189ecd0ca 100644
@@ -328,8 +328,14 @@ KBUILD_BUILD_TIMESTAMP
 ----------------------
 Setting this to a date string overrides the timestamp used in the
 UTS_VERSION definition (uname -v in the running kernel). The value has to
-be a string that can be passed to date -d. The default value
-is the output of the date command at one point during build.
+be a string that can be passed to date -d. E.g.::
+
+$ KBUILD_BUILD_TIMESTAMP="Mon Oct 13 00:00:00 UTC 2025" make

Other code blocks in kbuild.rst are indented by four spaces (and accidentally five in one line).

I can add these when applying the patch for kbuild-next, if that is ok for you.

Kind regards
Nicolas

author
#2 lore raw
Quoted 46 lines · Nicolas Schier
Quoted 11 lines · Gang Yan

From: Gang Yan <[email protected]>

This patch adds an example of how to set KBUILD_BUILD_TIMESTAMP to a specific date. Also, note that the provided timestamp is used for initramfs mtime fields, which are 32-bit and thus limited to dates between the Unix epoch and 2106-02-07 06:28:15 UTC. Dates outside this range will cause errors.

Quoted 9 lines

---
Changelog:
v2:
- Replace the invalid example with a valid one.
- Apply David's suggestions.

---
 Documentation/kbuild/kbuild.rst | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Thanks to both of you!

I have only found a tiny nit-pick, see below.

Documentation/kbuild/kbuild.rst KBUILD_BUILD_TIMESTAMP · line 333

Quoted 13 lines
Documentation/kbuild/kbuild.rst +3 -2
index 3388a10f2dcc..881189ecd0ca 100644
@@ -328,8 +328,14 @@ KBUILD_BUILD_TIMESTAMP
 ----------------------
 Setting this to a date string overrides the timestamp used in the
 UTS_VERSION definition (uname -v in the running kernel). The value has to
-be a string that can be passed to date -d. The default value
-is the output of the date command at one point during build.
+be a string that can be passed to date -d. E.g.::
+
+$ KBUILD_BUILD_TIMESTAMP="Mon Oct 13 00:00:00 UTC 2025" make

Other code blocks in kbuild.rst are indented by four spaces (and accidentally five in one line).

Quoted 2 lines

I can add these when applying the patch for kbuild-next, if that is ok for you.

Sure, Thanks alot.

Quoted 3 lines

Kind regards
Nicolas

Cherrs,
Gang

maintainer
#3 lore raw
In reply to Gang Yan
Quoted 8 lines · Gang Yan

This patch adds an example of how to set KBUILD_BUILD_TIMESTAMP to a specific date. Also, note that the provided timestamp is used for initramfs mtime fields, which are 32-bit and thus limited to dates between the Unix epoch and 2106-02-07 06:28:15 UTC. Dates outside this range will cause errors.

[...]

Applied to kbuild-next, thanks!

[1/1] kbuild: doc: improve KBUILD_BUILD_TIMESTAMP documentation
(indentation of code example adjusted)
commit: 5cbfb4da7e063cb82b1ab044465aeff4542a436d

Please note that commit hashes might change in case of issues with kbuild-next branch.

Best regards,

Signature · 1 line
Nicolas