tianocore / edk2

EDK II
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II
Other
4.38k stars 2.4k forks source link

EmbeddedPkg/VirtualRealTimeClockLib: Support SOURCE_DATE_EPOCH #5845

Closed joeyli closed 4 days ago

joeyli commented 6 days ago

RISC-V ovmf used VirtualRealTimeClockLib but the default epoch is a compilation time. It causes that the RISC-V ovmf binary image is NOT reproducible.

This patch added the support of SOURCE_DATE_EPOCH by printenv command. If SOURCE_DATE_EPOCH be found then we use it as BUILD_EPOCH. Otherwise we run date command for setting BUILD_EPOCH.

For distributions want a reproducible RISC-V ovmf image, they should export SOURCE_DATE_EPOCH environment variable before building ovmf.

References: https://reproducible-builds.org/docs/source-date-epoch/ Cc: Pete Batard pete@akeo.ie Cc: Ard Biesheuvel ard.biesheuvel@linaro.org