summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2022-09-14 15:53:02 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-09-14 15:53:02 +0200
commit18fb27c921a5b8d4894df4e2f3db808c79253b1a (patch)
treed64905b9006b507c32e33c25e6bb9887a4bf4540 /scripts
parent56eaef9c36c0181fdf322cca755192b40b120c64 (diff)
parent7deef2fa981b81426443281f84b142080f46cf74 (diff)
downloadbarebox-18fb27c921a5b8d4894df4e2f3db808c79253b1a.tar.gz
barebox-18fb27c921a5b8d4894df4e2f3db808c79253b1a.tar.xz
Merge branch 'for-next/sha256'
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.lib11
1 files changed, 11 insertions, 0 deletions
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
# ---------------------------------------------------------------------------