Source: u-boot
Followup-For: Bug #990202

Hello.
You are right that the UBOOTVERSION stuff is unrelated with this bug.
Actually, it is not even specific to Debian.
Instead of doing anything at the Debian level for now, I suggest to
forward the attached second patch to upstream maintainers and see what
happens.
>From b46f4e7e399b3eceb823db6ef75af132fe516ef6 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <nico...@debian.org>
Date: Thu, 8 Jul 2021 12:36:14 +0200
Subject: [PATCH] debian/rules: Replace exports with assignments visible in
 build logs

Set build parameters via the Make command line instead of the
environment.

Improve separation of concerns in debian/rules with a common_make_args
variable.
---
 debian/rules | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/debian/rules b/debian/rules
index 244956f6cc..7b012abbf9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,7 +2,9 @@
 
 include /usr/share/dpkg/architecture.mk
 include /usr/share/dpkg/pkg-info.mk
-export DEBIAN_REVISION ?= $(shell echo $(DEB_VERSION) | sed -e 's,.*+dfsg,+dfsg,')
+
+DEBIAN_REVISION ?= $(shell echo $(DEB_VERSION) | sed -e 's,.*+dfsg,+dfsg,')
+common_make_args += DEBIAN_REVISION='$(DEBIAN_REVISION)'
 
 include debian/targets.mk
 
@@ -17,6 +19,7 @@ VERBOSE=0
 else
 VERBOSE=1
 endif
+common_make_args += V=$(VERBOSE)
 
 # the upstream build passes LDFLAGS directly to ld instead of calling gcc for
 # linking; so instead of passing -Wl,foo in LDFLAGS as in automake builds, one
@@ -50,7 +53,8 @@ ifneq (,$(only_platforms))
 endif
 
 # Enable debugging symbols and remove build paths
-export HOSTCFLAGS = -g -ffile-prefix-map=$(CURDIR)=.
+HOSTCFLAGS = -g -ffile-prefix-map=$(CURDIR)=.
+common_make_args += HOSTCFLAGS='$(HOSTCFLAGS)'
 
 %:
 	dh $@
@@ -76,12 +80,14 @@ define build_template
 	# debian/rules: building platform: $(platform)
 	mkdir -p debian/build/$(platform)
 
-	dh_auto_build -- V=$(VERBOSE) O=debian/build/$(platform) \
+	dh_auto_build -- $(common_make_args) \
+	  O=debian/build/$(platform) \
 	  CROSS_COMPILE=$(or $($(platform)_CROSS_COMPILE),$(CROSS_COMPILE)) \
 	  $($(package)_assigns) $($(platform)_assigns) \
 	  $(platform)_defconfig
 	sed -i 's,CONFIG_FIT_SIGNATURE=y,# CONFIG_FIT_SIGNATURE is not set,' debian/build/$(platform)/.config
-	dh_auto_build -- V=$(VERBOSE) O=debian/build/$(platform) \
+	dh_auto_build -- $(common_make_args) \
+	  O=debian/build/$(platform) \
 	  CROSS_COMPILE=$(or $($(platform)_CROSS_COMPILE),$(CROSS_COMPILE)) \
 	  $($(package)_assigns) $($(platform)_assigns)
 
@@ -106,10 +112,14 @@ $(foreach package, u-boot-qemu $(subarchs),\
 
 TOOLSDIR := debian/build/tools
 build-tools:
-	dh_auto_build -- V=$(VERBOSE) O=$(TOOLSDIR) CROSS_COMPILE=$(CROSS_COMPILE) tools-only_defconfig
+	dh_auto_build -- $(common_make_args) \
+	  O=$(TOOLSDIR) \
+	  CROSS_COMPILE=$(CROSS_COMPILE) \
+	  tools-only_defconfig
 	cp $(TOOLSDIR)/.config $(TOOLSDIR)/config
 	# board-independent tools
-	dh_auto_build -- V=$(VERBOSE) O=$(TOOLSDIR) \
+	dh_auto_build -- $(common_make_args) \
+		O=$(TOOLSDIR) \
 		CROSS_COMPILE=$(CROSS_COMPILE) \
 		CROSS_BUILD_TOOLS=$(cross_build_tools) \
 		NO_SDL=1 \
-- 
2.30.2

Description: allow a downstream suffix in the version show during boot
  It may be convenient for redistributors or people compiling locally
  to add a revision number to the U-boot version, which is displayed
  at boot and can be helpful to determine which specific version is
  used.
Author: Vagrant Cascadian <vagr...@debian.org>
Author: Nicolas Boulenguez <nico...@debian.org>

Signed-By: Nicolas Boulenguez <nico...@debian.org>

--- a/Makefile
+++ b/Makefile
@@ -447,7 +447,7 @@
 
 # Read UBOOTRELEASE from include/config/uboot.release (if it exists)
 UBOOTRELEASE = $(shell cat include/config/uboot.release 2> /dev/null)
-UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if 
$(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
+UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if 
$(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)$(BUILD_VERSION)
 
 export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION
 export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR
--- a/doc/build/gcc.rst
+++ b/doc/build/gcc.rst
@@ -118,6 +118,11 @@
 * O=<dir> - generate all output files in directory <dir>, including .config
 * V=1 - verbose build
 
+If you are modifying the upstream sources, please make this visible
+at boot time by defining the BUILD_VERSION version suffix.
+
+* BUILD_VERSION=+<vendor><build number><...>
+
 Other build targets
 ~~~~~~~~~~~~~~~~~~~
 

Reply via email to