All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/2] make barebox build reproducible
@ 2023-01-19 12:10 Casey Reeves
  2023-01-19 12:10 ` [Buildroot] [PATCH 1/2] package/lzop: provide a patch to allow overriding of modification time Casey Reeves
  2023-01-19 12:10 ` [Buildroot] [PATCH 2/2] boot/barebox: pass required environment variables for reproducible build Casey Reeves
  0 siblings, 2 replies; 6+ messages in thread
From: Casey Reeves @ 2023-01-19 12:10 UTC (permalink / raw)
  To: buildroot

These patches are needed to make the barebox build reproducible when 
BR2_REPRODUCIBLE is enabled. To do this, there are two requirements:

- provide a patch for the lzop package so it can override the 
modification time with $SOURCE_DATE_EPOCH
- set the appropriate environment variables in barebox.mk, and pass them 
to the make invocation when building

Barebox makes use of lzop to compress the device tree included in its 
binary, hence the reason for the lzop patch. Also, barebox uses the very 
same variables as the kernel for making the build reproducible 
(KBUILD_BUILD_HOST, KBUILD_BUILD_TIMESTAMP, KBUILD_BUILD_USER).

Casey Reeves (2):
  package/lzop: provide a patch to allow overriding of modification time
  boot/barebox: pass required environment variables for reproducible
    build

 boot/barebox/barebox.mk                       |  9 +++-
 ...3-allow-overriding-modification-time.patch | 46 +++++++++++++++++++
 2 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 package/lzop/0003-allow-overriding-modification-time.patch

-- 
2.39.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/2] package/lzop: provide a patch to allow overriding of modification time
  2023-01-19 12:10 [Buildroot] [PATCH 0/2] make barebox build reproducible Casey Reeves
@ 2023-01-19 12:10 ` Casey Reeves
  2023-02-05 14:17   ` Thomas Petazzoni via buildroot
  2023-01-19 12:10 ` [Buildroot] [PATCH 2/2] boot/barebox: pass required environment variables for reproducible build Casey Reeves
  1 sibling, 1 reply; 6+ messages in thread
From: Casey Reeves @ 2023-01-19 12:10 UTC (permalink / raw)
  To: buildroot

This patch allows lzop to override the modification time using
$SOURCE_DATE_EPOCH.
The original patch written by Florian Bäuerle is for lzop 1.04, and
hence needed to be backported to the 1.03 release buildroot is making
use of.

It is necessary to carry this patch in buildroot, as it appears that
lzop software has stagnated since the last release.

https://git.pengutronix.de/cgit/ptxdist/tree/patches/lzop-1.04/0002-allow-overriding-modification-time.patch

Signed-off-by: Casey Reeves <casey@xogium.me>
---
 ...3-allow-overriding-modification-time.patch | 46 +++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 package/lzop/0003-allow-overriding-modification-time.patch

diff --git a/package/lzop/0003-allow-overriding-modification-time.patch b/package/lzop/0003-allow-overriding-modification-time.patch
new file mode 100644
index 0000000000..17ad42da04
--- /dev/null
+++ b/package/lzop/0003-allow-overriding-modification-time.patch
@@ -0,0 +1,46 @@
+From d3717065d4b4dd7dfa88ebc154185ce752127e93 Mon Sep 17 00:00:00 2001
+From: Casey Reeves <casey@xogium.me>
+Date: Thu, 19 Jan 2023 10:06:31 +0100
+Subject: [PATCH] allow overriding modification time
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This patch is based on the work from Florian Bäuerle at Allegion and
+enables lzop to allow overriding modification time.
+
+Signed-off-by: Casey Reeves <casey@xogium.me>
+---
+ src/lzop.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/src/lzop.c b/src/lzop.c
+index 5571e89..94eec99 100644
+--- a/src/lzop.c
++++ b/src/lzop.c
+@@ -706,6 +706,7 @@ void init_compress_header(header_t *h, const file_t *fip, const file_t *fop)
+     assert(opt_method > 0);
+     assert(opt_level > 0);
+     assert(fip->st.st_mode == 0 || S_ISREG(fip->st.st_mode));
++    const char *source_date_epoch = getenv("SOURCE_DATE_EPOCH");
+ 
+     memset(h,0,sizeof(header_t));
+ 
+@@ -742,7 +743,13 @@ void init_compress_header(header_t *h, const file_t *fip, const file_t *fop)
+ 
+     h->mode = fix_mode_for_header(fip->st.st_mode);
+ 
+-    if (fip->st.st_mtime)
++    if (source_date_epoch)
++    {
++        time_t mtime = strtoul(source_date_epoch, NULL, 0);
++        h->mtime_low  = (lzo_uint32) (mtime);
++        h->mtime_high = (lzo_uint32) ((mtime >> 16) >> 16);
++    }
++    else if (fip->st.st_mtime)
+     {
+         h->mtime_low = (lzo_uint32) (fip->st.st_mtime);
+         h->mtime_high = (lzo_uint32) (fip->st.st_mtime >> 16 >> 16);
+-- 
+2.39.0
+
-- 
2.39.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 2/2] boot/barebox: pass required environment variables for reproducible build
  2023-01-19 12:10 [Buildroot] [PATCH 0/2] make barebox build reproducible Casey Reeves
  2023-01-19 12:10 ` [Buildroot] [PATCH 1/2] package/lzop: provide a patch to allow overriding of modification time Casey Reeves
@ 2023-01-19 12:10 ` Casey Reeves
  2023-02-06  8:54   ` Thomas Petazzoni via buildroot
  2023-02-21 20:50   ` Peter Korsgaard
  1 sibling, 2 replies; 6+ messages in thread
From: Casey Reeves @ 2023-01-19 12:10 UTC (permalink / raw)
  To: buildroot

Barebox makes use of the same variables as the linux kernel does for
handling reproducible build -- KBUILD_BUILD_HOST,
KBUILD_BUILD_TIMESTAMP, KBUILD_BUILD_USER. This patch sets the proper
variables based on linux/linux.mk, and passes them to the make
invocation when building, to ensure a reproducible build is possible
when BR2_REPRODUCIBLE is enabled.

Signed-off-by: Casey Reeves <casey@xogium.me>
---
 boot/barebox/barebox.mk | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/boot/barebox/barebox.mk b/boot/barebox/barebox.mk
index da151d3c25..90be8c1ecc 100644
--- a/boot/barebox/barebox.mk
+++ b/boot/barebox/barebox.mk
@@ -74,6 +74,13 @@ endif
 $(1)_MAKE_FLAGS = ARCH=$$($(1)_ARCH) CROSS_COMPILE="$$(TARGET_CROSS)"
 $(1)_MAKE_ENV = $$(TARGET_MAKE_ENV)
 
+ifeq ($(BR2_REPRODUCIBLE),y)
+$(1)_MAKE_ENV += \
+	KBUILD_BUILD_USER=buildroot \
+	KBUILD_BUILD_HOST=buildroot \
+	KBUILD_BUILD_TIMESTAMP="$(shell LC_ALL=C date -d @$(SOURCE_DATE_EPOCH))"
+endif
+
 ifeq ($$(BR2_TARGET_$(1)_USE_DEFCONFIG),y)
 $(1)_KCONFIG_DEFCONFIG = $$(call qstrip,$$(BR2_TARGET_$(1)_BOARD_DEFCONFIG))_defconfig
 else ifeq ($$(BR2_TARGET_$(1)_USE_CUSTOM_CONFIG),y)
@@ -121,7 +128,7 @@ endef
 
 define $(1)_BUILD_CMDS
 	$$($(1)_BUILD_BAREBOXENV_CMDS)
-	$$(TARGET_MAKE_ENV) $$(MAKE) $$($(1)_MAKE_FLAGS) -C $$(@D)
+	$$($(1)_MAKE_ENV) $$(MAKE) $$($(1)_MAKE_FLAGS) -C $$(@D)
 	$$($(1)_BUILD_CUSTOM_ENV)
 endef
 
-- 
2.39.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH 1/2] package/lzop: provide a patch to allow overriding of modification time
  2023-01-19 12:10 ` [Buildroot] [PATCH 1/2] package/lzop: provide a patch to allow overriding of modification time Casey Reeves
@ 2023-02-05 14:17   ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-02-05 14:17 UTC (permalink / raw)
  To: Casey Reeves; +Cc: buildroot

Hello,

On Thu, 19 Jan 2023 13:10:03 +0100
Casey Reeves <casey@xogium.me> wrote:

> This patch allows lzop to override the modification time using
> $SOURCE_DATE_EPOCH.
> The original patch written by Florian Bäuerle is for lzop 1.04, and
> hence needed to be backported to the 1.03 release buildroot is making
> use of.

Any reason why we're not using lzop 1.04 ? Maybe we should bump lzop
1.04 first ?

> --- /dev/null
> +++ b/package/lzop/0003-allow-overriding-modification-time.patch
> @@ -0,0 +1,46 @@
> +From d3717065d4b4dd7dfa88ebc154185ce752127e93 Mon Sep 17 00:00:00 2001
> +From: Casey Reeves <casey@xogium.me>
> +Date: Thu, 19 Jan 2023 10:06:31 +0100
> +Subject: [PATCH] allow overriding modification time

Could you preserve the authorship of the original patch at
https://git.pengutronix.de/cgit/ptxdist/tree/patches/lzop-1.04/0002-allow-overriding-modification-time.patch
?

Your patch is pretty much exactly the same, so we really want to keep
the original authorship. The patch should still carry your
Signed-off-by and a reference to where the original patch was found.

Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH 2/2] boot/barebox: pass required environment variables for reproducible build
  2023-01-19 12:10 ` [Buildroot] [PATCH 2/2] boot/barebox: pass required environment variables for reproducible build Casey Reeves
@ 2023-02-06  8:54   ` Thomas Petazzoni via buildroot
  2023-02-21 20:50   ` Peter Korsgaard
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-02-06  8:54 UTC (permalink / raw)
  To: Casey Reeves; +Cc: buildroot

On Thu, 19 Jan 2023 13:10:04 +0100
Casey Reeves <casey@xogium.me> wrote:

> Barebox makes use of the same variables as the linux kernel does for
> handling reproducible build -- KBUILD_BUILD_HOST,
> KBUILD_BUILD_TIMESTAMP, KBUILD_BUILD_USER. This patch sets the proper
> variables based on linux/linux.mk, and passes them to the make
> invocation when building, to ensure a reproducible build is possible
> when BR2_REPRODUCIBLE is enabled.
> 
> Signed-off-by: Casey Reeves <casey@xogium.me>
> ---
>  boot/barebox/barebox.mk | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH 2/2] boot/barebox: pass required environment variables for reproducible build
  2023-01-19 12:10 ` [Buildroot] [PATCH 2/2] boot/barebox: pass required environment variables for reproducible build Casey Reeves
  2023-02-06  8:54   ` Thomas Petazzoni via buildroot
@ 2023-02-21 20:50   ` Peter Korsgaard
  1 sibling, 0 replies; 6+ messages in thread
From: Peter Korsgaard @ 2023-02-21 20:50 UTC (permalink / raw)
  To: Casey Reeves; +Cc: buildroot

>>>>> "Casey" == Casey Reeves <casey@xogium.me> writes:

 > Barebox makes use of the same variables as the linux kernel does for
 > handling reproducible build -- KBUILD_BUILD_HOST,
 > KBUILD_BUILD_TIMESTAMP, KBUILD_BUILD_USER. This patch sets the proper
 > variables based on linux/linux.mk, and passes them to the make
 > invocation when building, to ensure a reproducible build is possible
 > when BR2_REPRODUCIBLE is enabled.

 > Signed-off-by: Casey Reeves <casey@xogium.me>

Committed to 2022.11.x and 2022.02.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-02-21 20:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-19 12:10 [Buildroot] [PATCH 0/2] make barebox build reproducible Casey Reeves
2023-01-19 12:10 ` [Buildroot] [PATCH 1/2] package/lzop: provide a patch to allow overriding of modification time Casey Reeves
2023-02-05 14:17   ` Thomas Petazzoni via buildroot
2023-01-19 12:10 ` [Buildroot] [PATCH 2/2] boot/barebox: pass required environment variables for reproducible build Casey Reeves
2023-02-06  8:54   ` Thomas Petazzoni via buildroot
2023-02-21 20:50   ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.