Hi Michael,

Am Dienstag, den 16.10.2018, 12:09 +0200 schrieb Michael Olbrich:
> On Thu, Oct 11, 2018 at 02:19:17PM +0000, Baeuerle, Florian wrote:
> > Inject fake timestamps into the build via faketime to produce the exact
> > same binaries.
> 
> I'd like to see this patch split in two.
> One to handle the KBUILD_BUILD_ stuff. That should be done like the kernel
> with the symlink magic, but otherwise unconditionally (for now).
> Use SOURCE_DATE_EPOCH for the timestamp. I want to change the kernel to use
> this too.

SOURCE_DATE_EPOCH uses the ptxdist release number for the timestamp, thus the
timestamp changes with every ptxdist release. I'd prefer to *really* get the
same binary when the source code was not changed at all. A ptxdist version bump
has a high potential of not touching anything barebox related.

I also do not like mangling the barebox version into a timestamp, but I couldn't
come up with any better idea.

> 
> Another patch for the rest. I'm not quite sure how I want to handle this.
> My current plan is to have a setup option: Developers can use it to disable
> reproducible builds to see stuff like the build timestamps etc.
> CI and release builds have it enabled by default. I currently don't have
> any reason do disable reproducibility for releases.
> 
> What do you think?

My main use case for reproducible builds is RAUC. Since bootloader updates are
especially hairy on some platforms, I'm happy about having the ability to spare
a few of them (while retaining an update mechanism that ensures a persistent
state of the system *and* without using prebuilt bootloaders).

However, I do not mind if ptxdist by default builds more packages reproducibly.



-Florian

> 
> Michael
> 
> > Signed-off-by: Florian Bäuerle <florian.baeue...@allegion.com>
> > ---
> >  platforms/barebox.in | 10 ++++++++++
> >  rules/barebox.make   | 16 +++++++++++++++-
> >  2 files changed, 25 insertions(+), 1 deletion(-)
> > 
> > diff --git a/platforms/barebox.in b/platforms/barebox.in
> > index 645366e93..5bc2f08b6 100644
> > --- a/platforms/barebox.in
> > +++ b/platforms/barebox.in
> > @@ -13,6 +13,7 @@ menuconfig BAREBOX
> >     select HOST_OPENSSL if BAREBOX_NEEDS_HOST_OPENSSL
> >     select HOST_IMX_CST if BAREBOX_NEEDS_HOST_IMX_CST
> >     select HOST_LZOP if BAREBOX_NEEDS_HOST_LZOP
> > +   select HOST_FAKETIME if BAREBOX_REPRODUCIBLE
> >     prompt "barebox                       "
> >     bool
> >     help
> > @@ -50,6 +51,15 @@ config BAREBOX_EXTRA_ENV_PATH
> >       Directories and files to add to the builtin barebox environment.
> >       Relative paths must be relative to the platformconfigdir.
> >  
> > +config BAREBOX_REPRODUCIBLE
> > +   prompt "build reproducibly"
> > +   bool
> > +   default n
> > +   help
> > +     With this, fake timestamps are injected to the barebox build, so the
> > +     resulting barebox images are identical when the sources haven't been
> > +     changed.
> > +
> >  config BAREBOX_BAREBOXENV
> >     prompt "install 'bareboxenv'"
> >     bool
> > diff --git a/rules/barebox.make b/rules/barebox.make
> > index a6ec3c394..ad160b3ba 100644
> > --- a/rules/barebox.make
> > +++ b/rules/barebox.make
> > @@ -45,6 +45,20 @@ BAREBOX_ENV := \
> >     KCONFIG_NOTIMESTAMP=1 \
> >     pkg_wrapper_blacklist="$(BAREBOX_WRAPPER_BLACKLIST)"
> >  
> > +ifdef PTXCONF_BAREBOX_REPRODUCIBLE
> > +BAREBOX_FAKE_TIMESTAMP := \
> > +   $(shell echo $(BAREBOX_VERSION) | \
> > +           sed -E "s/([0-9]{4})\.([0-9]{1,2}).*/\1-\2-01 00:00:00/")
> > +BAREBOX_FAKETIME := faketime -f "$(BAREBOX_FAKE_TIMESTAMP)"
> > +BAREBOX_ENV := $(BAREBOX_ENV) \
> > +   KBUILD_BUILD_TIMESTAMP="$(BAREBOX_FAKE_TIMESTAMP)" \
> > +   KBUILD_BUILD_VERSION="0" \
> > +   KBUILD_BUILD_USER="ptxdist" \
> > +   KBUILD_BUILD_HOST="ptxdist"
> > +else
> > +BAREBOX_FAKETIME :=
> > +endif
> > +
> >  BAREBOX_MAKEVARS := \
> >     V=$(PTXDIST_VERBOSE) \
> >     HOSTCC=$(HOSTCC) \
> > @@ -113,7 +127,7 @@ ifdef PTXCONF_BAREBOX_EXTRA_ENV
> >  endif
> >  
> >     @+cd $(BAREBOX_DIR) && $(BAREBOX_PATH) $(BAREBOX_ENV) \
> > -           $(MAKE) $(BAREBOX_MAKEVARS)
> > +           $(BAREBOX_FAKETIME) $(MAKE) $(BAREBOX_MAKEVARS)
> >     @$(call touch)
> >  
> >  # -----------------------------------------------------------------------
> > -----
> > -- 
> > 2.19.0
> > 
> > _______________________________________________
> > ptxdist mailing list
> > ptxdist@pengutronix.de
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

Reply via email to