From d6aa9d9e071d9f23ed26f5142991bc66aefe20f5 Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Mon, 21 Feb 2022 18:55:15 +0100 Subject: [PATCH] u-boot.mk: add LOCALVERSION (explicitly specify OpenWrt build) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For debugging purposes, we need to know if users are using modified U-boot versions or not. Currently, the U-boot version is somehow stripped. This is a little bit problematic when there are backported/wip/to-upstream patches. To make it more confusing, there was (before this commit) two U-boot versioning. U-boot compiled by OpenWrt build bots are missing ``Build:`` This is also the case when the U-boot is compiled locally. Example: ``` U-Boot SPL 2022.01 (Jan 27 2022 - 00:24:34 +0000) U-Boot 2022.01 (Jan 27 2022 - 00:24:34 +0000) ``` On the other hand, if you run full build, you can at least see, where it was compiled. Notice added ``Build:``. Example: ``` U-Boot 2022.01 (Jan 27 2022 - 00:24:34 +0000), Build: jenkins-turris-os-packages-burstlab-omnia-216 ``` In both cases, it is not clear to U-boot developers if it is an unmodified build. This is also caused that there is a missing ``.git`` file from U-boot folder, and so there is no history. It leads to that it can not contain suffix ``-dirty`` (uncommitted modifications) or even something else like number of commits, etc. [1] When U-boot is compiled as it should be, the version should look like this: ``U-Boot 2022.04-rc1-01173-g278195ea1f (Feb 11 2022 - 14:46:50 +0100)`` The date is not changed daily when there are new OpenWrt builds. This commit adds OpenWrt specific version, which could be verified by using strings. ``` $ strings bin/targets/mvebu/cortexa9/u-boot-omnia/u-boot-spl.kwb | grep -E "OpenWrt*" U-Boot SPL 2022.01-OpenWrt-r18942+54-cbfce92367 (Feb 21 2022 - 13:17:34 +0000) arm-openwrt-linux-muslgnueabi-gcc (OpenWrt GCC 11.2.0 r18942+54-cbfce92367) 11.2.0 2022.01-OpenWrt-r18942+54-cbfce92367 U-Boot 2022.01-OpenWrt-r18942+54-cbfce92367 (Feb 21 2022 - 13:17:34 +0000) ``` [1] https://u-boot.readthedocs.io/en/latest/develop/version.html Reported-by: Pali Rohár Suggested-by: Karel Kočí Signed-off-by: Josef Schlehofer --- include/u-boot.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/include/u-boot.mk b/include/u-boot.mk index 509b3d76dc..8945e8e2b8 100644 --- a/include/u-boot.mk +++ b/include/u-boot.mk @@ -45,6 +45,7 @@ UBOOT_MAKE_FLAGS = \ HOSTCC="$(HOSTCC)" \ HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \ HOSTLDFLAGS="$(HOST_LDFLAGS)" \ + LOCALVERSION="-OpenWrt-$(REVISION)" \ STAGING_PREFIX="$(STAGING_DIR_HOST)" \ PKG_CONFIG_PATH="$(STAGING_DIR_HOST)/lib/pkgconfig" \ PKG_CONFIG_LIBDIR="$(STAGING_DIR_HOST)/lib/pkgconfig" \