Bug 12422

Summary: Support reproducible build for core-image-minimal images
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Juro Bystricky <juro.bystricky>
Component: coreAssignee: Juro Bystricky <juro.bystricky>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: Medium+ CC: meta.mr.watcher, meta.watcher, stephano
Version: 2.5   
Target Milestone: 2.5 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)
Bug Depends on: 1176, 1177, 1178, 1179    
Bug Blocks:    

Description Juro Bystricky 2017-12-13 22:23:53 UTC
This is an offshoot of
https://bugzilla.yoctoproject.org/show_bug.cgi?id=5866

providing a better specified deliverable.

The goal of this enhancement is to build reproducible images for:

$ MACHINE=qemux86 bitbake core-image-minimal


The resulting images of this build are placed in the folder <builddir>/tmp/deploy/images/qemux86

Repeating the build in a different folder will place the images in:
<builddir-different>/tmp/deploy/images/qemux86

The build is deemed reproducible if the following files in both build folders are binary identical:

bzImage-qemux86.bin
core-image-minimal-qemux86.tar.bz2
modules-qemux86.tgz
Comment 1 Juro Bystricky 2018-04-27 13:20:21 UTC
I built two different core-image-minimal images in two different folders and at two different times.

local conf:
INHERIT+="reproducible_build"
PACKAGE_CLASSES="package_deb package_rpm package_ipk"
MACHINE="qemux86-64"

Build Configuration:
BB_VERSION           = "1.37.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "ubuntu-16.04"
TARGET_SYS           = "x86_64-poky-linux"
MACHINE              = "qemux86-64"
DISTRO               = "poky"
DISTRO_VERSION       = "2.5"
TUNE_FEATURES        = "m64 core2"
TARGET_FPU           = ""
meta                 
meta-poky            
meta-yocto-bsp       = "HEAD:b6bc5b2840246ac0f0e5d8cebcdffc1a0ca2518f"

$ bitbake core-image-minimal

Then I ran binary comparisons:
SAME: /data/master1/poky/build2-minimal-qemux86-64-repro-2018-04-27-again/tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64-20180427193430.rootfs.manifest  /data/master1/poky/build2-minimal-qemux86-64-repro-2018-04-27/tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64-20180427193330.rootfs.manifest

SAME: /data/master1/poky/build2-minimal-qemux86-64-repro-2018-04-27-again/tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64-20180427193430.rootfs.tar.bz2  /data/master1/poky/build2-minimal-qemux86-64-repro-2018-04-27/tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64-20180427193330.rootfs.tar.bz2

SAME: /data/master1/poky/build2-minimal-qemux86-64-repro-2018-04-27-again/tmp/deploy/images/qemux86-64/bzImage--4.14.30+git0+ea9330894e_74f6cd2b69-r0-qemux86-64-20180427193430.bin  /data/master1/poky/build2-minimal-qemux86-64-repro-2018-04-27/tmp/deploy/images/qemux86-64/bzImage--4.14.30+git0+ea9330894e_74f6cd2b69-r0-qemux86-64-20180427193330.bin


Note modules-qemux86.tgz differed. This is rather easy to fix, providing the build host has "tar" that supports "--sort=name" and "--clamp-mtime" support.
Unfortunately, at this time it is not guaranteed.
Nevertheless, I will close this as resolve, as the both images and kernel are binary reproducible. (I will open a new bug dealing with modules.tgz)