From 08236fcb460f7a040101642a51153178f5860d84 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Fri, 2 Nov 2018 16:36:25 +0000 Subject: [PATCH] build: make builds reproducible. Add a debug option to include build number, date and time into build. This will be disabled b default so that all builds are reproducible. Signed-off-by: Liam Girdwood --- configure.ac | 6 ++++ scripts/xtensa-build-all.sh | 47 ++++++++++++++++-------------- src/platform/baytrail/platform.c | 5 +++- src/platform/haswell/platform.c | 5 +++- src/platform/intel/cavs/platform.c | 5 +++- 5 files changed, 43 insertions(+), 25 deletions(-) diff --git a/configure.ac b/configure.ac index 1815e967a..3291896d0 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,12 @@ if test "x$with_meu" != "xno"; then fi fi +#check if we should enable debug build +AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],[enable debug, default: no])], enable_debug=$enableval, enable_debug=no) +if test "$enable_debug" = "yes"; then + AC_DEFINE([DEBUG_BUILD], [1], [Configure to build debug version]) +fi + # check if we are building FW image or library AC_ARG_ENABLE(library, [AS_HELP_STRING([--enable-library],[build library])], have_library=$enableval, have_library=no) if test "$have_library" = "yes"; then diff --git a/scripts/xtensa-build-all.sh b/scripts/xtensa-build-all.sh index 2f561ab5c..ac84feb4f 100755 --- a/scripts/xtensa-build-all.sh +++ b/scripts/xtensa-build-all.sh @@ -1,13 +1,18 @@ #!/bin/bash SUPPORTED_PLATFORMS=(byt cht bdw hsw apl cnl sue icl skl kbl) -BUILD_RIMAGE=1 +BUILD_RIMAGE=0 +BUILD_DEBUG=no pwd=`pwd` if [ "$#" -eq 0 ] then - PLATFORMS=${SUPPORTED_PLATFORMS[@]} + echo "usage: xtensa-build.sh [options] platform(s)" + echo " [-l] Build rimage locally" + echo " [-a] Build all platforms" + echo " [-d] Enable debug build" + echo " Supported platforms ${SUPPORTED_PLATFORMS[@]}" else # parse the args for args in $@ @@ -15,26 +20,18 @@ else if [[ "$args" == "-l" ]] then BUILD_LOCAL=1 - - # build all images for chosen targets - if [ "$#" -eq 1 ] - then - PLATFORMS=${SUPPORTED_PLATFORMS[@]} - break - fi - elif [[ "$args" == "-lr" ]] - then - BUILD_LOCAL=1 - BUILD_RIMAGE=0 + BUILD_RIMAGE=1 PATH=$pwd/local/bin:$PATH - # build all images for chosen targets - if [ "$#" -eq 1 ] + elif [[ "$args" == "-d" ]] then - PLATFORMS=${SUPPORTED_PLATFORMS[@]} - break - fi + BUILD_DEBUG=yes + + # Build all platforms + elif [[ "$args" == "-a" ]] + then + PLATFORMS=${SUPPORTED_PLATFORMS[@]} else for i in ${SUPPORTED_PLATFORMS[@]} do @@ -47,8 +44,12 @@ else done fi - -# now build the firmware (depends on rimage) +# check target platform(s) have been passed in +if [ ${#PLATFORMS[@]} -eq 0 ]; +then + echo "Error: No platforms specified. Supported are: ${SUPPORTED_PLATFORMS[@]}" + exit 1 +fi # fail on any errors set -e @@ -213,8 +214,10 @@ do # only delete binary related to this build rm -fr src/arch/xtensa/sof-$j.* - ./configure --with-arch=xtensa --with-platform=$PLATFORM --with-root-dir=$ROOT --host=$HOST \ - CC=$XCC OBJCOPY=$XTOBJCOPY OBJDUMP=$XTOBJDUMP --with-dsp-core=$XTENSA_CORE + ./configure --with-arch=xtensa --with-platform=$PLATFORM \ + --with-root-dir=$ROOT --host=$HOST --enable-debug=$BUILD_DEBUG \ + CC=$XCC OBJCOPY=$XTOBJCOPY OBJDUMP=$XTOBJDUMP \ + --with-dsp-core=$XTENSA_CORE make clean make diff --git a/src/platform/baytrail/platform.c b/src/platform/baytrail/platform.c index 66b542d43..7d5b4ce02 100644 --- a/src/platform/baytrail/platform.c +++ b/src/platform/baytrail/platform.c @@ -65,11 +65,14 @@ static const struct sof_ipc_fw_ready ready }, /* dspbox is for DSP initiated IPC, hostbox is for host initiated IPC */ .version = { - .build = SOF_BUILD, .minor = SOF_MINOR, .major = SOF_MAJOR, +#ifdef DEBUG_BUILD + /* only added in debug for reproducability in releases */ + .build = SOF_BUILD, .date = __DATE__, .time = __TIME__, +#endif .tag = SOF_TAG, .abi_version = SOF_ABI_VERSION, }, diff --git a/src/platform/haswell/platform.c b/src/platform/haswell/platform.c index f4c029192..a3d3057fd 100644 --- a/src/platform/haswell/platform.c +++ b/src/platform/haswell/platform.c @@ -64,11 +64,14 @@ static const struct sof_ipc_fw_ready ready }, /* dspbox is for DSP initiated IPC, hostbox is for host initiated IPC */ .version = { - .build = SOF_BUILD, .minor = SOF_MINOR, .major = SOF_MAJOR, +#ifdef DEBUG_BUILD + /* only added in debug for reproducability in releases */ + .build = SOF_BUILD, .date = __DATE__, .time = __TIME__, +#endif .tag = SOF_TAG, .abi_version = SOF_ABI_VERSION, }, diff --git a/src/platform/intel/cavs/platform.c b/src/platform/intel/cavs/platform.c index 5cec87ca1..498d1d953 100644 --- a/src/platform/intel/cavs/platform.c +++ b/src/platform/intel/cavs/platform.c @@ -65,11 +65,14 @@ static const struct sof_ipc_fw_ready ready .size = sizeof(struct sof_ipc_fw_ready), }, .version = { - .build = SOF_BUILD, .minor = SOF_MINOR, .major = SOF_MAJOR, +#ifdef DEBUG_BUILD + /* only added in debug for reproducability in releases */ + .build = SOF_BUILD, .date = __DATE__, .time = __TIME__, +#endif .tag = SOF_TAG, .abi_version = SOF_ABI_VERSION, },