[v2,1/2] image.bbclass: remove core files generated in rootfs

Message ID 20230809134703.8475-2-venkata.pyla@toshiba-tsip.com
State Accepted, archived
Headers show
Series Fix reproducible issues in armhf | expand

Commit Message

venkata.pyla@toshiba-tsip.com Aug. 9, 2023, 1:47 p.m. UTC
From: venkata pyla <venkata.pyla@toshiba-tsip.com>

Sometimes core dumps are created in rootfs and left in the final image,
and that causes non-reproducible images, so move those files to
${WORKDIR}/temp location and warn the user.

In armhf there is an issue with qemu-user-static that results in
creating core dumps which is reported in Debian upstream [1], meanwhile
move these core dumps outside the rootfs.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1040981

Signed-off-by: venkata pyla <venkata.pyla@toshiba-tsip.com>
---
 meta/classes/image.bbclass | 7 +++++++
 1 file changed, 7 insertions(+)

Patch

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 08b6d3d6..9aa6c856 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -461,6 +461,13 @@  do_rootfs_finalize() {
         fi
 EOSUDO
 
+    # Sometimes qemu-user-static generates coredumps in chroot, move them
+    # to work temporary directory and inform user about it.
+    for f in $(sudo find ${ROOTFSDIR} -name *.core); do
+        sudo mv "${f}" "${WORKDIR}/temp/"
+        bbwarn "found core dump in rootfs, check it in ${WORKDIR}/temp/${f##*/}"
+    done
+
     # Set same time-stamps to the newly generated file/folders in the
     # rootfs image for the purpose of reproducible builds.
     if [ -n "${SOURCE_DATE_EPOCH}" ]; then