summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--images/Makefile7
-rw-r--r--scripts/Makefile.lib11
2 files changed, 11 insertions, 7 deletions
diff --git a/images/Makefile b/images/Makefile
index 7a8bb94fe0..218a24ff1d 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -112,13 +112,6 @@ $(obj)/piggy.o: $(obj)/barebox.z FORCE
$(obj)/sha_sum.o: $(obj)/barebox.sha.bin FORCE
-quiet_cmd_sha256bin ?= SHA-BIN $@
- cmd_sha256bin = printf "$(shell sed 's/ .*$$//;s/../0x&\n/g;s/\n$$//' $(obj)/barebox.sum | \
- while read -r byte; do printf '\%o' $$byte; done)" > $@
-
-quiet_cmd_sha256sum ?= SHA $@
- cmd_sha256sum ?= sha256sum $(obj)/barebox.z > $@
-
$(obj)/barebox.sha.bin: $(obj)/barebox.sum FORCE
$(call if_changed,sha256bin)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 46042dab3c..16308497b8 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -272,6 +272,17 @@ cmd_ld = $(LD) $(KBUILD_LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) \
quiet_cmd_objcopy = OBJCOPY $@
cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
+# Hashing
+# ---------------------------------------------------------------------------
+# POSIX printf (e.g. dash's) doesn't support \xHH, but octal sequences are fine
+
+quiet_cmd_sha256bin ?= SHA-BIN $@
+ cmd_sha256bin = printf "$(shell sed 's/ .*$$//;s/../0x&\n/g;s/\n$$//' $< | \
+ while read -r byte; do printf '\%o' $$byte; done)" > $@
+
+quiet_cmd_sha256sum ?= SHA $@
+ cmd_sha256sum ?= sha256sum $< > $@
+
# Decompressor for barebox proper binary when using PBL
# ---------------------------------------------------------------------------