From f1e1daa6e8c71c2185aa37e737f968e9ad838c50 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čí [rebased for OpenWrt 21.02] Signed-off-by: Josef Schlehofer (cherry picked from commit d6aa9d9e071d9f23ed26f5142991bc66aefe20f5) --- include/u-boot.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/include/u-boot.mk b/include/u-boot.mk index ec9fb15b6c..a3dc540ebe 100644 --- a/include/u-boot.mk +++ b/include/u-boot.mk @@ -44,6 +44,7 @@ TARGET_DEP = TARGET_$(BUILD_TARGET)$(if $(BUILD_SUBTARGET),_$(BUILD_SUBTARGET)) UBOOT_MAKE_FLAGS = \ HOSTCC="$(HOSTCC)" \ HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \ + LOCALVERSION="-OpenWrt-$(REVISION)" \ HOSTLDFLAGS="$(HOST_LDFLAGS)" define Build/U-Boot/Target