[LEDE-DEV] [PATCH] build: reintroduce md5 checksums for generated firmware images
Karl Palsson
karlp at tweak.net.au
Wed Aug 17 17:04:38 PDT 2016
Why not just add sha256 sum rather than going back to md5?
Cheers,
Karl P
Stefan Lippers-Hollmann <s.l-h at gmx.de> wrote:
> Commit 83175687c81bee594885d0738cfd488673f5a3fb "build: remove
> image specific checksum code" dropped the generation of md5
> checksums in favour of only shipping sha256 ones.
>
> A default Lede installation however doesn't enable busybox'
> sha256sum applet, which makes confirming the checksum on the
> device itself (e.g. for transmission errors to the device) more
> difficult than necessary, this patch reintroduces the
> generation of MD5 checksums for all firmware images.
>
> Signed-off-by: Stefan Lippers-Hollmann <s.l-h at gmx.de>
> ---
>
> It would be simpler to call md5sum rather than openssl to
> generate the MD5 checksums, but in order to keep the prereqs
> small, I re-used openssl for this task as well, given that it's
> needed for the SHA256 checksums already.
>
> Makefile | 1 +
> rules.mk | 7 +++++++
> target/imagebuilder/files/Makefile | 1 +
> 3 files changed, 9 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index 59320d4..51a2e38 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -84,6 +84,7 @@ prereq: $(target/stamp-prereq) tmp/.prereq_packages
> fi
>
> checksum: FORCE
> + $(call md5sums,$(BIN_DIR))
> $(call sha256sums,$(BIN_DIR))
>
> prepare: .config $(tools/stamp-install) $(toolchain/stamp-install)
> diff --git a/rules.mk b/rules.mk
> index de24778..92f7f52 100644
> --- a/rules.mk
> +++ b/rules.mk
> @@ -371,6 +371,13 @@ define file_copy
> $(CP) $(1) $(2)
> endef
>
> +# Calculate md5sum of any plain file within a given directory
> +# $(1) => Input directory
> +define md5sums
> + (cd $(1); find . -maxdepth 1 -type f -not -name 'md5sums' -printf "%P\n" | sort | \
> + xargs openssl dgst -md5 | sed -ne 's!^MD5(\(.*\))= \(.*\)$$!\2 *\1!p' > md5sums)
> +endef
> +
> # Calculate sha256sum of any plain file within a given directory
> # $(1) => Input directory
> define sha256sums
> diff --git a/target/imagebuilder/files/Makefile
> b/target/imagebuilder/files/Makefile index 493012f..15c34ed
> 100644
> --- a/target/imagebuilder/files/Makefile
> +++ b/target/imagebuilder/files/Makefile
> @@ -174,6 +174,7 @@ build_image: FORCE
> checksum: FORCE
> @echo
> @echo Calculating checksums...
> + @$(call md5sums,$(BIN_DIR))
> @$(call sha256sums,$(BIN_DIR))
>
> clean:
> --
> 2.9.3
>
>
> _______________________________________________
> Lede-dev mailing list
> Lede-dev at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP Digital Signature
URL: <http://lists.infradead.org/pipermail/lede-dev/attachments/20160818/0c53c99d/attachment.sig>
More information about the Lede-dev
mailing list