Skip to content

Commit 4540215

Browse files
aparcardangowrt
authored andcommitted
build: add buildinfo files for reproducibility
generate feeds.buildinfo and version.buildinfo in build dir after containing the feed revisions (via ./scripts/feeds list -sf) as well as the current revision of buildroot (via ./scripts/getver.sh). With this information it should be possible to reproduce any build, especially the release builds. Usage would be to move feeds.buildinfo to feeds.conf and git checkout the revision hash of version.buildinfo. Content of feeds.buildinfo would look similar to this: src-git routing https://git.openwrt.org/feed/routing.git^bf475d6 src-git telephony https://git.openwrt.org/feed/telephony.git^470eb8e ... Content of version.buildinfo would look similar to this: r10203+1-c12bd3a21b Without the exact feed revision it is not possible to determine installed package versions. Also rename config.seed to config.buildinfo to follow the recommended style of https://reproducible-builds.org/docs/recording/ Signed-off-by: Paul Spooren <mail@aparcar.org>
1 parent bcfd1d7 commit 4540215

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,18 @@ prereq: $(target/stamp-prereq) tmp/.prereq_packages
8989
checksum: FORCE
9090
$(call sha256sums,$(BIN_DIR),$(CONFIG_BUILDBOT))
9191

92+
buildversion: FORCE
93+
$(SCRIPT_DIR)/getver.sh > $(BIN_DIR)/version.buildinfo
94+
95+
feedsversion: FORCE
96+
$(SCRIPT_DIR)/feeds list -fs > $(BIN_DIR)/feeds.buildinfo
97+
9298
diffconfig: FORCE
9399
mkdir -p $(BIN_DIR)
94-
$(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.seed
100+
$(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.buildinfo
95101

96102
prepare: .config $(tools/stamp-compile) $(toolchain/stamp-compile)
97-
$(_SINGLE)$(SUBMAKE) -r diffconfig
103+
$(_SINGLE)$(SUBMAKE) -r diffconfig buildversion feedsversion
98104

99105
world: prepare $(target/stamp-compile) $(package/stamp-compile) $(package/stamp-install) $(target/stamp-install) FORCE
100106
$(_SINGLE)$(SUBMAKE) -r package/index

config/Config-build.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ menu "Global build settings"
9393
bool "Include build configuration in firmware" if DEVEL
9494
default n
9595
help
96-
If enabled, config.seed will be stored in /etc/build.config of firmware.
96+
If enabled, config.buildinfo will be stored in /etc/build.config of firmware.
9797

9898
config COLLECT_KERNEL_DEBUG
9999
bool

package/base-files/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ define Package/base-files/install
198198

199199
$(if $(CONFIG_INCLUDE_CONFIG), \
200200
echo -e "# Build configuration for board $(BOARD)/$(SUBTARGET)/$(PROFILE)\n" >$(1)/etc/build.config; \
201-
cat $(BIN_DIR)/config.seed >>$(1)/etc/build.config)
201+
cat $(BIN_DIR)/config.buildinfo >>$(1)/etc/build.config)
202202

203203
$(if $(CONFIG_CLEAN_IPKG),, \
204204
mkdir -p $(1)/etc/opkg; \

0 commit comments

Comments
 (0)