summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2020-05-13 10:24:35 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-06-05 21:36:31 +0100
commit6f19690b73ae803b3881e4dc1362864dd368448d (patch)
tree407034de8120ba7c42d912282137fc3bdeb22902 /meta
parent6777db7ae7d869d969f9a3984fb895e582c515a5 (diff)
downloadpoky-6f19690b73ae803b3881e4dc1362864dd368448d.tar.gz
kernel/reproducibility: kernel modules need SOURCE_DATE_EPOCH export
If CONFIG_IKHEADERS is set to =m, then reproducibility issues creep into the modules build, since the variables we are setting for the main kernel build are not present. Since the source code must be available for a possibly git query on the timestamp, there didn't seem to be an easy way to move the environment variable setting to a common routine. As such, we duplicate the block of code that exports the required variables for reproducible builds. There is a maintenance risk to this, but any issues should be easy enough to catch. (From OE-Core rev: f511d78164581f80e7b8c592fe88ffbf38738150) Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 82cdfcdccfedd320ebc0cdc778c7d4966198b96f) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/kernel.bbclass15
1 files changed, 15 insertions, 0 deletions
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index a724645466..a3990aaf59 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -331,6 +331,21 @@ kernel_do_compile() {
331 331
332do_compile_kernelmodules() { 332do_compile_kernelmodules() {
333 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE 333 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
334 if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then
335 # kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not
336 # be set....
337 if [ "${SOURCE_DATE_EPOCH}" = "" -o "${SOURCE_DATE_EPOCH}" = "0" ]; then
338 # The source directory is not necessarily a git repository, so we
339 # specify the git-dir to ensure that git does not query a
340 # repository in any parent directory.
341 SOURCE_DATE_EPOCH=`git --git-dir="${S}/.git" log -1 --pretty=%ct 2>/dev/null || echo "${REPRODUCIBLE_TIMESTAMP_ROOTFS}"`
342 fi
343
344 ts=`LC_ALL=C date -d @$SOURCE_DATE_EPOCH`
345 export KBUILD_BUILD_TIMESTAMP="$ts"
346 export KCONFIG_NOTIMESTAMP=1
347 bbnote "KBUILD_BUILD_TIMESTAMP: $ts"
348 fi
334 if (grep -q -i -e '^CONFIG_MODULES=y$' ${B}/.config); then 349 if (grep -q -i -e '^CONFIG_MODULES=y$' ${B}/.config); then
335 cc_extra=$(get_cc_option) 350 cc_extra=$(get_cc_option)
336 oe_runmake -C ${B} ${PARALLEL_MAKE} modules CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} 351 oe_runmake -C ${B} ${PARALLEL_MAKE} modules CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS}