From c7e6ad7be2871b08644712506cc9869e398c95b4 Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Sun, 26 Mar 2017 18:23:51 -0600 Subject: [PATCH] util/abuild: Save checksums of build files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add --checksum command line parameter to specify a base path and filename for the checksums to be saved into. - Save checksums of each platform into the specified file appended with "_platform" - Save a sha256 checksum of the sorted config.h into the base file appended with "_config" Change-Id: Id24dc4b10afbd35cdb8750f75b934419e6e80290 Signed-off-by: Martin Roth Reviewed-on: https://review.coreboot.org/19033 Tested-by: build bot (Jenkins) Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Patrick Georgi --- util/abuild/abuild | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/util/abuild/abuild b/util/abuild/abuild index 95711a1b41..becf53846a 100755 --- a/util/abuild/abuild +++ b/util/abuild/abuild @@ -50,6 +50,9 @@ configureonly=0 # Did any board fail to build? failed=0 +# default: don't save checksums +checksum_file="" + # default: single CPU build cpus=1 @@ -366,6 +369,11 @@ function compile_target failed=1 fi cd "$CURR" || return $? + if [ -n "$checksum_file" ]; then + sha256sum "${build_dir}/coreboot.rom" >> "${checksum_file}_platform" + sort "${build_dir}/config.h" | grep CONFIG_ > "${build_dir}/config.h.sorted" + sha256sum "${build_dir}/config.h.sorted" >> "${checksum_file}_config" + fi if [ "$clean_work" = "true" ]; then rm -rf "${build_dir}" fi @@ -518,6 +526,7 @@ Usage: $0 [options] Options:\n" [-a|--all] Build previously succeeded ports as well [-B|--blobs] Allow using binary files + [--checksum ] Store checksums at path/basefile [-c|--cpus ] Build on at the same time [-C|--config] Configure-only mode [-d|--dir ] Directory containing config files @@ -590,7 +599,7 @@ getoptbrand="$(getopt -V)" # shellcheck disable=SC2086 if [ "${getoptbrand:0:6}" == "getopt" ]; then # Detected GNU getopt that supports long options. - args=$(getopt -l version,verbose,quiet,help,all,target:,payloads:,cpus:,silent,junit,config,loglevel:,remove,prefix:,update,scan-build,ccache,blobs,clang,clean,outdir:,chromeos,xmlfile:,kconfig:,dir:,root:,recursive -o Vvqhat:p:c:sJCl:rP:uyBLzo:xX:K:d:R:I -- "$@") || exit 1 + args=$(getopt -l version,verbose,quiet,help,all,target:,payloads:,cpus:,silent,junit,config,loglevel:,remove,prefix:,update,scan-build,ccache,blobs,clang,clean,outdir:,chromeos,xmlfile:,kconfig:,dir:,root:,recursive,checksum: -o Vvqhat:p:c:sJCl:rP:uyBLzo:xX:K:d:R:I -- "$@") || exit 1 eval set -- $args retval=$? else @@ -682,6 +691,7 @@ while true ; do customizing="${customizing}, $1 config" configoptions="$(cat "$1")${configoptions}\n" shift;; + --checksum) shift; checksum_file="$1"; shift;; --) shift; break;; -*) printf "Invalid option '%s'\n\n" "$1"; myhelp; exit 1;; *) break;;