util/abuild: Save checksums of build files

- 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 <gaumless@gmail.com>
Reviewed-on: https://review.coreboot.org/19033
Tested-by: build bot (Jenkins)
Reviewed-by: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Martin Roth 2017-03-26 18:23:51 -06:00 committed by Martin Roth
parent 0090192ddd
commit c7e6ad7be2
1 changed files with 11 additions and 1 deletions

View File

@ -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 <path/basefile>] Store checksums at path/basefile
[-c|--cpus <numcpus>] Build on <numcpus> at the same time
[-C|--config] Configure-only mode
[-d|--dir <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;;