mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-18 21:28:02 +00:00
d6aa9d9e07
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 <pali@kernel.org> Suggested-by: Karel Kočí <karel.koci@nic.cz> Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
112 lines
2.9 KiB
Makefile
112 lines
2.9 KiB
Makefile
PKG_NAME ?= u-boot
|
|
|
|
ifndef PKG_SOURCE_PROTO
|
|
PKG_SOURCE = $(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
|
PKG_SOURCE_URL = \
|
|
https://mirror.cyberbits.eu/u-boot \
|
|
https://ftp.denx.de/pub/u-boot \
|
|
ftp://ftp.denx.de/pub/u-boot
|
|
endif
|
|
|
|
PKG_BUILD_DIR = $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
|
|
|
|
PKG_TARGETS := bin
|
|
PKG_FLAGS:=nonshared
|
|
|
|
PKG_LICENSE:=GPL-2.0 GPL-2.0+
|
|
PKG_LICENSE_FILES:=Licenses/README
|
|
|
|
PKG_BUILD_PARALLEL:=1
|
|
|
|
export GCC_HONOUR_COPTS=s
|
|
|
|
define Package/u-boot/install/default
|
|
$(CP) $(patsubst %,$(PKG_BUILD_DIR)/%,$(UBOOT_IMAGE)) $(1)/
|
|
endef
|
|
|
|
Package/u-boot/install = $(Package/u-boot/install/default)
|
|
|
|
define U-Boot/Init
|
|
BUILD_TARGET:=
|
|
BUILD_SUBTARGET:=
|
|
BUILD_DEVICES:=
|
|
NAME:=
|
|
DEPENDS:=
|
|
HIDDEN:=
|
|
DEFAULT:=
|
|
VARIANT:=$(1)
|
|
UBOOT_CONFIG:=$(1)
|
|
UBOOT_IMAGE:=u-boot.bin
|
|
endef
|
|
|
|
TARGET_DEP = TARGET_$(BUILD_TARGET)$(if $(BUILD_SUBTARGET),_$(BUILD_SUBTARGET))
|
|
|
|
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" \
|
|
PKG_CONFIG_EXTRAARGS="--static" \
|
|
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='')
|
|
|
|
define Build/U-Boot/Target
|
|
$(eval $(call U-Boot/Init,$(1)))
|
|
$(eval $(call U-Boot/Default,$(1)))
|
|
$(eval $(call U-Boot/$(1),$(1)))
|
|
|
|
define Package/u-boot-$(1)
|
|
SECTION:=boot
|
|
CATEGORY:=Boot Loaders
|
|
TITLE:=U-Boot for $(NAME)
|
|
VARIANT:=$(VARIANT)
|
|
DEPENDS:=@!IN_SDK $(DEPENDS)
|
|
HIDDEN:=$(HIDDEN)
|
|
ifneq ($(BUILD_TARGET),)
|
|
DEPENDS += @$(TARGET_DEP)
|
|
ifneq ($(BUILD_DEVICES),)
|
|
DEFAULT := y if ($(TARGET_DEP)_Default \
|
|
$(patsubst %,|| $(TARGET_DEP)_DEVICE_%,$(BUILD_DEVICES)) \
|
|
$(patsubst %,|| $(patsubst TARGET_%,TARGET_DEVICE_%,$(TARGET_DEP))_DEVICE_%,$(BUILD_DEVICES)))
|
|
endif
|
|
endif
|
|
$(if $(DEFAULT),DEFAULT:=$(DEFAULT))
|
|
URL:=http://www.denx.de/wiki/U-Boot
|
|
endef
|
|
|
|
define Package/u-boot-$(1)/install
|
|
$$(Package/u-boot/install)
|
|
endef
|
|
endef
|
|
|
|
define Build/Configure/U-Boot
|
|
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(UBOOT_CONFIGURE_VARS) $(UBOOT_CONFIG)_config
|
|
endef
|
|
|
|
DTC=$(wildcard $(LINUX_DIR)/scripts/dtc/dtc)
|
|
|
|
define Build/Compile/U-Boot
|
|
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
|
CROSS_COMPILE=$(TARGET_CROSS) \
|
|
$(if $(DTC),DTC="$(DTC)") \
|
|
$(UBOOT_MAKE_FLAGS)
|
|
endef
|
|
|
|
define BuildPackage/U-Boot/Defaults
|
|
Build/Configure/Default = $$$$(Build/Configure/U-Boot)
|
|
Build/Compile/Default = $$$$(Build/Compile/U-Boot)
|
|
endef
|
|
|
|
define BuildPackage/U-Boot
|
|
$(eval $(call BuildPackage/U-Boot/Defaults))
|
|
$(foreach type,$(if $(DUMP),$(UBOOT_TARGETS),$(BUILD_VARIANT)), \
|
|
$(eval $(call Build/U-Boot/Target,$(type)))
|
|
)
|
|
$(eval $(call Build/DefaultTargets))
|
|
$(foreach type,$(if $(DUMP),$(UBOOT_TARGETS),$(BUILD_VARIANT)), \
|
|
$(call BuildPackage,u-boot-$(type))
|
|
)
|
|
endef
|