x86: stop relying on hexdump for image build signature

Fixes #811
This commit is contained in:
Matthias Schiffer 2016-07-03 19:16:30 +02:00
parent b4829fad6b
commit 0676f5f394
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
1 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,24 @@
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sun, 3 Jul 2016 19:15:49 +0200
Subject: x86: stop relying on hexdump for image build signature
Use perl to generate random number instead.
See https://github.com/freifunk-gluon/gluon/issues/811
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Backport of LEDE d5ee23ee275fcd6550b0051de59706cc928cdac8
diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile
index e7e02f1..6f64eba 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 dd if=/dev/urandom bs=4 count=1 2>/dev/null | hexdump -v -e '"%08x"')
+SIGNATURE:=$(shell perl -e 'printf("%08x", rand(0xFFFFFFFF))')
ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME))
ROOTPART:=$(if $(ROOTPART),$(ROOTPART),PARTUUID=$(SIGNATURE)-02)