Firmware build date is not the same on router

there seems to be a bug in openwrt version 21-20-rc1/2/3 on the firmware build date. here I made the firmware using imagebuilder after I flash it on the router the date does not match the date of manufacture and the date always shows "2021-06-13" even though I made it on the 15th today. is this a bug in openwrt 21-20? For example, I made the firmware on the 15th using imagebuilder, the firmware that I created on the date of manufacture should be the same on the router.

I am assuming you are looking at the build date which gets published to dmesg on kernel initialization.

Two possibilities:

  • You're looking at the kernel build date, which ought to be the date of the release of the kernel rather than the actual build date

  • you never ran make distclean, and you have some things cached.

1 Like

Likely the date get setup by the date/time of the last commit in OpenWrt. The design goal is to have reproducible builds (so that the date remains the same if rebuilt later from the same sources).

See include/version.mk and other things related to SOURCE_DATE_EPOCH

(I have overridden that in my own builds (with the full toolchain), so that builds show the real build date.)

1 Like

what should I do with "SOURCE_DATE_EPOCH"?. does in version 21-20 date and time no longer work in imagebuilder in 21-20?. do i have to regenerate the firmware using the standard openwrt build, maybe it takes a long time to make the full version build. I think and feel in OpenWrt 21-20 too many changes.

# Substituted by SDK, do not remove
REVISION:=r16172-2aba3e9784
SOURCE_DATE_EPOCH:=1623621739

only in openwrt version 21-20 like this. i tried on openwrt version 19.07.x no problem with build date

You should be able to remove that line (or comment it out with # ).

Or you could place the current timestamp value there..
(Output of date, as seconds: date +%s )

1 Like

OK I will try it

Can you specify which date you mean exactly?

I can‘t imagine that the date shown in dmesg was altered by the ImageBuilder in the past since the vmlinux image is a precompiled artifact.

hi jow. I set the current date and time "21-06-16" but the time and date show "2021-06-13" does not match the date when I made today's firmware and I have set the clock on my vps

So you refer to the system date and time? As in reported by the date command?

Date time vps

Wed Jun 16 13:28:34 WITA 2021

Date time openwrt

Sun Jun 13 22:14:16 UTC 2021

the firmware build date should be the same as on the vps amazon

No, the initial date and time is fixed to a release specific value to achieve reproducible builds, this is intentional and not a bug.

The running OpenWrt system is supposed to correct its local time on boot either by reading the local RTC if available, or through NTP.

I think you can influence the initial time value by shipping a newer file in /etc, like that:

mkdir -p files/etc
touch files/etc/.build-timestamp
make image … FILES=files/
2 Likes

I will try. for openwrt 19.07.x no problem the build date everything is the same on the date i set in my vps. maybe in openwrt 21-20 there is a change.

Which router you are talking about?
And does the router have internet connetivity (in order to fetch the current time with NTP)?

Most routers have no real-time clock and the "last /etc file" based date/time initialisation system during the boot process works ok. Some routers (like x86 based) do have a real battery-packed RTC and they also work ok.

But some routers falsely claim to have a RTC although they do not have battery, so the clock does not work. I wonder if you have one of these "fake RTC" routers?

Discussion in https://github.com/openwrt/openwrt/pull/3418

I'm using a router that doesn't have RTC. i have been using openwrt for a long time and made firmware and files using imagebuilder and sdk so i understand a little about openwrt, for comparison i made firmware using imagebuilder on my amazon vps and have set date and time on vps automatically when making firmware date and time will detect time on my amazon vps and i've proved this on openwrt 19.07.x 18.04.x 17.01.x year month and date is the same on my vps when i finished flashing on my router

Yes, there is a change.
Like jow said, the design goal is to create reproducible builds. In 2020 the bug in imagebuilder was corrected so that it now creates the images according to design goals (timestamp at the latest source code change date).

That is in master and 21.02.x, but naturally not yet in the year 2019 based 19.07 firmwares.

2 Likes

thank you jow, hnyman and hurricos. now can

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.