Skip to content

2026-06-09 U-Boot Release Build Timestamp Note ​

Background ​

The board printed this U-Boot banner after boot:

text
U-Boot 2025.04-g99518e6b6f20-dirty (Jan 01 2021 - 00:00:00 +0000)

The U-Boot release artifact was built under:

text
out/release-latest/uboot

Root Cause ​

The release script set a fixed default timestamp:

bash
export SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH:-1609459200}

1609459200 is 2021-01-01 00:00:00 UTC.

U-Boot consumes SOURCE_DATE_EPOCH in its Makefile and generates:

text
out/release-latest/uboot/include/generated/timestamp_autogenerated.h

The generated file contained:

c
#define U_BOOT_DATE "Jan 01 2021"
#define U_BOOT_TIME "00:00:00"
#define U_BOOT_TZ "+0000"
#define U_BOOT_EPOCH 1609459200

That generated timestamp is included by include/timestamp.h, then composed into common/version.c:

c
#define U_BOOT_VERSION_STRING U_BOOT_VERSION " (" U_BOOT_DATE " - " \
	U_BOOT_TIME " " U_BOOT_TZ ")" CONFIG_IDENT_STRING

So the board banner was not reading a hardware RTC. It was reporting the timestamp embedded at U-Boot build time.

Fix ​

The release script now uses the current UTC build time by default:

bash
: "${SOURCE_DATE_EPOCH:=$(date -u +%s)}"
export SOURCE_DATE_EPOCH

This makes the U-Boot banner match the release artifact build time.

If a byte-for-byte reproducible build is needed, pass a fixed value explicitly:

bash
SOURCE_DATE_EPOCH=1740988800 ./scripts/build_helper/build-uboot.sh --release --release-version v0.1.0

Files Changed ​

  • scripts/lib/release.sh(release 编排下沉于此;U-Boot 分支默认当前时间戳)
  • scripts/build_helper/build-uboot.sh(--release 模式调用 release.sh)
  • document/notes/2026-06-09-uboot-release-build-timestamp.md

Verification ​

Before the fix, the generated artifact contained:

text
U-Boot 2025.04-g99518e6b6f20-dirty (Jan 01 2021 - 00:00:00 +0000)

After rebuilding U-Boot with the fixed script, check:

bash
sed -n '1,20p' out/release-latest/uboot/include/generated/timestamp_autogenerated.h
strings out/release-latest/uboot/u-boot-nodtb.bin | rg 'U-Boot 2025|Jan 01 2021'
sed -n '1,20p' out/release-latest/uboot/build_info.txt

Expected result:

  • U_BOOT_EPOCH is no longer 1609459200 unless explicitly requested.
  • The U-Boot banner no longer shows Jan 01 2021 by default.
  • build_info.txt records the actual build timestamp used for the artifact.

v1.0.4-37-gc79a127 · c79a127 · 2026-09-29