realtek: take the Belkin header time from SOURCE_DATE_EPOCH

The factory images of the Linksys LGS3xxC switches differ between
builds in the Belkin header:

  -00000000: 0780 0001 7917 f807 6ab3 0fe3 0058 2000  ....y...j....X .
  +00000000: 0780 0001 2a5a 3f79 6ab3 d0c7 0058 2000  ....*Z?yj....X .

belkin-header.py stores time.time() as the image time, which also
changes the header checksum. Use SOURCE_DATE_EPOCH when it is set, like
linksys-image.sh does for the tarball inside.

Link: https://github.com/openwrt/openwrt/pull/25355
Signed-off-by: Paul Spooren <mail@aparcar.org>
This commit is contained in:
Paul Spooren committed 2026-09-24 13:36:49 +02:00
1 parent 18304dd747
commit 98bc30d154
1 file changed
+1 -1
+1 -1
View File
@@ -62,7 +62,7 @@ def create_header(buf, belkin_header, belkin_model):
head = bytearray(32)
head[0:4] = int(belkin_header, 0).to_bytes(4, 'big')
head[8:12] = int(time.time()).to_bytes(4, 'big')
head[8:12] = int(os.environ.get('SOURCE_DATE_EPOCH') or time.time()).to_bytes(4, 'big')
head[12:16] = len(buf).to_bytes(4, byteorder='big')
head[24:28] = xcrc32(buf)
head[28:29] = VERSION1.to_bytes(1, byteorder='big')