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 <liam.r.girdwood@linux.intel.com>
This commit is contained in:
Liam Girdwood 2018-11-02 16:36:25 +00:00
parent b15b9f350f
commit 08236fcb46
5 changed files with 43 additions and 25 deletions

View File

@ -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

View File

@ -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

View File

@ -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,
},

View File

@ -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,
},

View File

@ -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,
},