* [PATCH 2/2 v2] reproducible: Drop BUILD_REPRODUCIBLE_BINARIES variable
2021-10-14 13:40 [PATCH 1/2 v2] kernel: Add KERNEL_DEBUG_TIMESTAMPS variable Richard Purdie
@ 2021-10-14 13:40 ` Richard Purdie
2021-10-14 13:46 ` [OE-core] [PATCH 1/2 v2] kernel: Add KERNEL_DEBUG_TIMESTAMPS variable Bruce Ashfield
1 sibling, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2021-10-14 13:40 UTC (permalink / raw)
To: openembedded-core
We want things to be reproduicble and the variable doesn't really change
much any more. Drop the remaining uses and make those code paths always
active.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
meta/classes/image-prelink.bbclass | 13 ++++---------
meta/classes/image.bbclass | 14 ++++++--------
meta/conf/bitbake.conf | 1 -
meta/lib/oe/sstatesig.py | 2 +-
meta/recipes-core/busybox/busybox.inc | 10 ++++------
5 files changed, 15 insertions(+), 25 deletions(-)
diff --git a/meta/classes/image-prelink.bbclass b/meta/classes/image-prelink.bbclass
index 0da094a5518..8158eeaf4ca 100644
--- a/meta/classes/image-prelink.bbclass
+++ b/meta/classes/image-prelink.bbclass
@@ -46,17 +46,12 @@ prelink_image () {
dynamic_loader=${@get_linuxloader(d)}
# prelink!
- if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then
- bbnote " prelink: BUILD_REPRODUCIBLE_BINARIES..."
- if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
- export PRELINK_TIMESTAMP=`git log -1 --pretty=%ct `
- else
- export PRELINK_TIMESTAMP=$REPRODUCIBLE_TIMESTAMP_ROOTFS
- fi
- ${STAGING_SBINDIR_NATIVE}/prelink --root ${IMAGE_ROOTFS} -am -N -c ${sysconfdir}/prelink.conf --dynamic-linker $dynamic_loader
+ if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
+ export PRELINK_TIMESTAMP=`git log -1 --pretty=%ct `
else
- ${STAGING_SBINDIR_NATIVE}/prelink --root ${IMAGE_ROOTFS} -amR -N -c ${sysconfdir}/prelink.conf --dynamic-linker $dynamic_loader
+ export PRELINK_TIMESTAMP=$REPRODUCIBLE_TIMESTAMP_ROOTFS
fi
+ ${STAGING_SBINDIR_NATIVE}/prelink --root ${IMAGE_ROOTFS} -am -N -c ${sysconfdir}/prelink.conf --dynamic-linker $dynamic_loader
# Remove the prelink.conf if we had to add it.
if [ "$dummy_prelink_conf" = "true" ]; then
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index c2f32320278..2fa69a40d10 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -651,17 +651,15 @@ ROOTFS_PREPROCESS_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge'
POPULATE_SDK_PRE_TARGET_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'create_merged_usr_symlinks_sdk; ', '',d)}"
reproducible_final_image_task () {
- if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then
+ if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
+ REPRODUCIBLE_TIMESTAMP_ROOTFS=`git -C "${COREBASE}" log -1 --pretty=%ct 2>/dev/null` || true
if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
- REPRODUCIBLE_TIMESTAMP_ROOTFS=`git -C "${COREBASE}" log -1 --pretty=%ct 2>/dev/null` || true
- if [ "$REPRODUCIBLE_TIMESTAMP_ROOTFS" = "" ]; then
- REPRODUCIBLE_TIMESTAMP_ROOTFS=`stat -c%Y ${@bb.utils.which(d.getVar("BBPATH"), "conf/bitbake.conf")}`
- fi
+ REPRODUCIBLE_TIMESTAMP_ROOTFS=`stat -c%Y ${@bb.utils.which(d.getVar("BBPATH"), "conf/bitbake.conf")}`
fi
- # Set mtime of all files to a reproducible value
- bbnote "reproducible_final_image_task: mtime set to $REPRODUCIBLE_TIMESTAMP_ROOTFS"
- find ${IMAGE_ROOTFS} -print0 | xargs -0 touch -h --date=@$REPRODUCIBLE_TIMESTAMP_ROOTFS
fi
+ # Set mtime of all files to a reproducible value
+ bbnote "reproducible_final_image_task: mtime set to $REPRODUCIBLE_TIMESTAMP_ROOTFS"
+ find ${IMAGE_ROOTFS} -print0 | xargs -0 touch -h --date=@$REPRODUCIBLE_TIMESTAMP_ROOTFS
}
systemd_preset_all () {
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 1db9b3fc051..790f2f7a8c4 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -636,7 +636,6 @@ SDE_DIR = "${WORKDIR}/source-date-epoch"
SDE_FILE = "${SDE_DIR}/__source_date_epoch.txt"
SDE_DEPLOYDIR = "${WORKDIR}/deploy-source-date-epoch"
-BUILD_REPRODUCIBLE_BINARIES = "1"
export PYTHONHASHSEED = "0"
export PERL_HASH_SEED = "0"
export SOURCE_DATE_EPOCH ?= "${@get_source_date_epoch_value(d)}"
diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index c2e3e2f4f58..038404e377a 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -489,7 +489,7 @@ def OEOuthashBasic(path, sigfile, task, d):
include_timestamps = False
include_root = True
if task == "package":
- include_timestamps = d.getVar('BUILD_REPRODUCIBLE_BINARIES') == '1'
+ include_timestamps = True
include_root = False
extra_content = d.getVar('HASHEQUIV_HASH_VERSION')
diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index 808c3dc7009..622325aabb3 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -110,9 +110,8 @@ python () {
}
do_prepare_config () {
- if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then
- export KCONFIG_NOTIMESTAMP=1
- fi
+ export KCONFIG_NOTIMESTAMP=1
+
sed -e '/CONFIG_STATIC/d' \
< ${WORKDIR}/defconfig > ${S}/.config
echo "# CONFIG_STATIC is not set" >> .config
@@ -143,9 +142,8 @@ do_configure () {
do_compile() {
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
- if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then
- export KCONFIG_NOTIMESTAMP=1
- fi
+ export KCONFIG_NOTIMESTAMP=1
+
if [ "${BUSYBOX_SPLIT_SUID}" = "1" -a x`grep "CONFIG_FEATURE_INDIVIDUAL=y" .config` = x ]; then
# split the .config into two parts, and make two busybox binaries
if [ -e .config.orig ]; then
--
2.32.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [OE-core] [PATCH 1/2 v2] kernel: Add KERNEL_DEBUG_TIMESTAMPS variable
2021-10-14 13:40 [PATCH 1/2 v2] kernel: Add KERNEL_DEBUG_TIMESTAMPS variable Richard Purdie
2021-10-14 13:40 ` [PATCH 2/2 v2] reproducible: Drop BUILD_REPRODUCIBLE_BINARIES variable Richard Purdie
@ 2021-10-14 13:46 ` Bruce Ashfield
1 sibling, 0 replies; 3+ messages in thread
From: Bruce Ashfield @ 2021-10-14 13:46 UTC (permalink / raw)
To: Richard Purdie; +Cc: Patches and discussions about the oe-core layer
On Thu, Oct 14, 2021 at 9:40 AM Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> Change the "binary reproducibility" configuration within the kernel to
> work off a separate variable, defaulting to reproducible builds.
>
> This allows kernel developers wanting timestamps in their images to enable
> it easily and clearly without changing the rest of the reproduciblity
> code which they likely don't need to change anyway.
Looks good to me! Thanks for the tweak.
Bruce
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
> meta/classes/kernel.bbclass | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index 4acec1877e0..c1cea177b62 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -322,9 +322,11 @@ python do_devshell:prepend () {
>
> addtask bundle_initramfs after do_install before do_deploy
>
> +KERNEL_DEBUG_TIMESTAMPS ??= "0"
> +
> kernel_do_compile() {
> unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
> - if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then
> + if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then
> # kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not
> # be set....
> if [ "${SOURCE_DATE_EPOCH}" = "" -o "${SOURCE_DATE_EPOCH}" = "0" ]; then
> @@ -364,7 +366,7 @@ kernel_do_compile() {
>
> do_compile_kernelmodules() {
> unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
> - if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then
> + if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "0" ]; then
> # kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not
> # be set....
> if [ "${SOURCE_DATE_EPOCH}" = "" -o "${SOURCE_DATE_EPOCH}" = "0" ]; then
> --
> 2.32.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#156955): https://lists.openembedded.org/g/openembedded-core/message/156955
> Mute This Topic: https://lists.openembedded.org/mt/86312624/1050810
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [bruce.ashfield@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
^ permalink raw reply [flat|nested] 3+ messages in thread