Re: [OpenWrt-Devel] [PATCH] x86: generate reproducible UUID
On November 4, 2019 4:02:07 AM UTC, Yousong Zhou wrote: >On Mon, 4 Nov 2019 at 07:47, Paul Spooren wrote: >> >> -SIGNATURE:=$(shell perl -e 'printf("%08x", rand(0x))') >> +SIGNATURE:=$(shell echo "$(SOURCE_DATE_EPOCH)" | sha256sum | cut -c >1-8 -z) > >Maybe just unify with other targets should be enough. Or even better, provide reusable variable in some included makefile and use that instead? >target/linux/tegra/image/Makefile >10:SIGNATURE:=$(shell printf "%.8s" $(SOURCE_DATE_EPOCH)) > >target/linux/x86/image/Makefile >43:SIGNATURE:=$(shell perl -e 'printf("%08x", rand(0x))') > >target/linux/mvebu/image/Makefile >16:SIGNATURE:=$(shell printf "%.8s" $(SOURCE_DATE_EPOCH)) ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] x86: generate reproducible UUID
On Mon, 4 Nov 2019 at 07:47, Paul Spooren wrote: > > This commit changes the behaviour of UUID generation. Instead of using > the rand module of perl, generating a random UUID per compile, it now > hashes the SOURCE_DATE_EPOCH, resulting in a reproducible UUID. > > Signed-off-by: Paul Spooren > --- > target/linux/x86/image/Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile > index ac70e771c8..68c2bee9d4 100644 > --- a/target/linux/x86/image/Makefile > +++ b/target/linux/x86/image/Makefile > @@ -40,7 +40,7 @@ ifneq ($(GRUB_TERMINALS),) >GRUB_TERMINAL_CONFIG := terminal_input $(GRUB_TERMINALS); terminal_output > $(GRUB_TERMINALS) > endif > > -SIGNATURE:=$(shell perl -e 'printf("%08x", rand(0x))') > +SIGNATURE:=$(shell echo "$(SOURCE_DATE_EPOCH)" | sha256sum | cut -c 1-8 -z) Maybe just unify with other targets should be enough. Note that "-z" is not supported by coreutils-8.22 cut on CentOS 7 target/linux/tegra/image/Makefile 10:SIGNATURE:=$(shell printf "%.8s" $(SOURCE_DATE_EPOCH)) target/linux/x86/image/Makefile 43:SIGNATURE:=$(shell perl -e 'printf("%08x", rand(0x))') target/linux/mvebu/image/Makefile 16:SIGNATURE:=$(shell printf "%.8s" $(SOURCE_DATE_EPOCH)) Regards, yousong ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] x86: generate reproducible UUID
This commit changes the behaviour of UUID generation. Instead of using the rand module of perl, generating a random UUID per compile, it now hashes the SOURCE_DATE_EPOCH, resulting in a reproducible UUID. Signed-off-by: Paul Spooren --- target/linux/x86/image/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile index ac70e771c8..68c2bee9d4 100644 --- a/target/linux/x86/image/Makefile +++ b/target/linux/x86/image/Makefile @@ -40,7 +40,7 @@ ifneq ($(GRUB_TERMINALS),) GRUB_TERMINAL_CONFIG := terminal_input $(GRUB_TERMINALS); terminal_output $(GRUB_TERMINALS) endif -SIGNATURE:=$(shell perl -e 'printf("%08x", rand(0x))') +SIGNATURE:=$(shell echo "$(SOURCE_DATE_EPOCH)" | sha256sum | cut -c 1-8 -z) ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME)) ROOTPART:=$(if $(ROOTPART),$(ROOTPART),PARTUUID=$(SIGNATURE)-02) -- 2.24.0.rc1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel