* [edk2-devel] [PATCH] EmbeddedPkg/VirtualRealTimeClockLib: Support SOURCE_DATE_EPOCH
@ 2024-04-12 7:25 Lee, Chun-Yi
2024-04-12 10:03 ` joeyli via groups.io
[not found] ` <17C5803AB4523E0C.19773@groups.io>
0 siblings, 2 replies; 3+ messages in thread
From: Lee, Chun-Yi @ 2024-04-12 7:25 UTC (permalink / raw)
To: devel; +Cc: Ard Biesheuvel, Pete Batard, Chun-Yi Lee
From: Chun-Yi Lee <jlee@suse.com>
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>
Signed-off-by: Chun-Yi Lee <jlee@suse.com>
---
.../Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf b/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
index 5d0f867..285e880 100644
--- a/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
+++ b/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
@@ -34,4 +34,4 @@
# Current usage of this library expects GCC in a UNIX-like shell environment with the date command
[BuildOptions]
- GCC:*_*_*_CC_FLAGS = -DBUILD_EPOCH=`date +%s`
+ GCC:*_*_*_CC_FLAGS = -DBUILD_EPOCH=`printenv SOURCE_DATE_EPOCH || date +%s`
--
2.35.3
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117664): https://edk2.groups.io/g/devel/message/117664
Mute This Topic: https://groups.io/mt/105479031/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [edk2-devel] [PATCH] EmbeddedPkg/VirtualRealTimeClockLib: Support SOURCE_DATE_EPOCH
2024-04-12 7:25 [edk2-devel] [PATCH] EmbeddedPkg/VirtualRealTimeClockLib: Support SOURCE_DATE_EPOCH Lee, Chun-Yi
@ 2024-04-12 10:03 ` joeyli via groups.io
[not found] ` <17C5803AB4523E0C.19773@groups.io>
1 sibling, 0 replies; 3+ messages in thread
From: joeyli via groups.io @ 2024-04-12 10:03 UTC (permalink / raw)
To: Lee, Chun-Yi; +Cc: devel, Ard Biesheuvel, Pete Batard
Hi experts,
On Fri, Apr 12, 2024 at 03:25:56PM +0800, Lee, Chun-Yi wrote:
> From: Chun-Yi Lee <jlee@suse.com>
>
> 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>
> Signed-off-by: Chun-Yi Lee <jlee@suse.com>
I have filed pull request:
https://github.com/tianocore/edk2/pull/5550
Thanks!
Joey Lee
> ---
> .../Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf b/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
> index 5d0f867..285e880 100644
> --- a/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
> +++ b/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
> @@ -34,4 +34,4 @@
>
> # Current usage of this library expects GCC in a UNIX-like shell environment with the date command
> [BuildOptions]
> - GCC:*_*_*_CC_FLAGS = -DBUILD_EPOCH=`date +%s`
> + GCC:*_*_*_CC_FLAGS = -DBUILD_EPOCH=`printenv SOURCE_DATE_EPOCH || date +%s`
> --
> 2.35.3
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117665): https://edk2.groups.io/g/devel/message/117665
Mute This Topic: https://groups.io/mt/105479031/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [edk2-devel] [PATCH] EmbeddedPkg/VirtualRealTimeClockLib: Support SOURCE_DATE_EPOCH
[not found] ` <17C5803AB4523E0C.19773@groups.io>
@ 2024-04-30 15:17 ` joeyli via groups.io
0 siblings, 0 replies; 3+ messages in thread
From: joeyli via groups.io @ 2024-04-30 15:17 UTC (permalink / raw)
To: devel; +Cc: Lee, Chun-Yi, Ard Biesheuvel, Pete Batard
Hi all,
On Fri, Apr 12, 2024 at 06:03:35PM +0800, joeyli via groups.io wrote:
> Hi experts,
>
> On Fri, Apr 12, 2024 at 03:25:56PM +0800, Lee, Chun-Yi wrote:
> > From: Chun-Yi Lee <jlee@suse.com>
> >
> > 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>
> > Signed-off-by: Chun-Yi Lee <jlee@suse.com>
>
> I have filed pull request:
>
> https://github.com/tianocore/edk2/pull/5550
>
Does anyone have suggestion against this patch. Or I missed anything for
the submit request?
Thanks!
Joey Lee
>
> > ---
> > .../Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf b/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
> > index 5d0f867..285e880 100644
> > --- a/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
> > +++ b/EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf
> > @@ -34,4 +34,4 @@
> >
> > # Current usage of this library expects GCC in a UNIX-like shell environment with the date command
> > [BuildOptions]
> > - GCC:*_*_*_CC_FLAGS = -DBUILD_EPOCH=`date +%s`
> > + GCC:*_*_*_CC_FLAGS = -DBUILD_EPOCH=`printenv SOURCE_DATE_EPOCH || date +%s`
> > --
> > 2.35.3
>
>
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118444): https://edk2.groups.io/g/devel/message/118444
Mute This Topic: https://groups.io/mt/105479031/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-30 15:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-12 7:25 [edk2-devel] [PATCH] EmbeddedPkg/VirtualRealTimeClockLib: Support SOURCE_DATE_EPOCH Lee, Chun-Yi
2024-04-12 10:03 ` joeyli via groups.io
[not found] ` <17C5803AB4523E0C.19773@groups.io>
2024-04-30 15:17 ` joeyli via groups.io
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox