From 635be2a3293f00e41186934cc721b78b1f0712d4 Mon Sep 17 00:00:00 2001 From: Scott Mercer Date: Sun, 16 Mar 2025 23:57:29 -0400 Subject: [PATCH] uboot-tools: create dumpimage package Ddd dumpimage package to uboot-tools. Add patches to fix compile for uboot versions >= 2024.01 Signed-off-by: Scott Mercer --- package/boot/uboot-tools/Makefile | 24 ++++++ ...001-tools-dumpimage-disable-kwbimage.patch | 32 +++++++ ...02-tools-dumpimage-fix-tools-compile.patch | 84 +++++++++++++++++++ 3 files changed, 140 insertions(+) create mode 100644 package/boot/uboot-tools/patches/0001-tools-dumpimage-disable-kwbimage.patch create mode 100644 package/boot/uboot-tools/patches/0002-tools-dumpimage-fix-tools-compile.patch diff --git a/package/boot/uboot-tools/Makefile b/package/boot/uboot-tools/Makefile index de738725f26..dd47d84a598 100644 --- a/package/boot/uboot-tools/Makefile +++ b/package/boot/uboot-tools/Makefile @@ -35,6 +35,22 @@ define Package/uboot-tools/description to work with the U-Boot bootloader, endef +define Package/dumpimage + SECTION:=utils + CATEGORY:=Utilities + SUBMENU:=Boot Loaders + DEPENDS := +libopenssl + TITLE:=dumpimage lists and extracts data from U-Boot images. + URL:=http://www.denx.de/wiki/U-Boot +endef + +define Package/dumpimage/description + dumpimage lists and extracts data from U-Boot images. + If -l is specified, dumpimage lists the components in + image.Otherwise, dumpimage extracts the component at + position to outfile. +endef + define Package/uboot-envtools SECTION:=utils CATEGORY:=Utilities @@ -58,6 +74,7 @@ endef define Build/Configure $(MAKE) -C $(PKG_BUILD_DIR) tools-only_defconfig $(MAKE) -C $(PKG_BUILD_DIR) syncconfig + $(SED) 's/CONFIG_TOOLS_LIBCRYPTO=y/# CONFIG_TOOLS_LIBCRYPTO is not set/' $(PKG_BUILD_DIR)/.config endef MAKE_FLAGS += \ @@ -67,6 +84,12 @@ MAKE_FLAGS += \ define Build/Compile $(call Build/Compile/Default,envtools) + $(call Build/Compile/Default,cross_tools) +endef + +define Package/dumpimage/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/dumpimage $(1)/usr/bin endef define Package/uboot-envtools/install @@ -91,4 +114,5 @@ define Package/uboot-envtools/install ) endef +$(eval $(call BuildPackage,dumpimage)) $(eval $(call BuildPackage,uboot-envtools)) diff --git a/package/boot/uboot-tools/patches/0001-tools-dumpimage-disable-kwbimage.patch b/package/boot/uboot-tools/patches/0001-tools-dumpimage-disable-kwbimage.patch new file mode 100644 index 00000000000..4af6510c44b --- /dev/null +++ b/package/boot/uboot-tools/patches/0001-tools-dumpimage-disable-kwbimage.patch @@ -0,0 +1,32 @@ +diff --git a/package/boot/u-boot-tools/patches/0001-tools-disable-kwbimage.patch b/package/boot/u-boot-tools/patches/0001-tools-disable-kwbimage.patch +new file mode 100644 +index 0000000000..69a42ec383 +--- /dev/null ++++ b/package/boot/u-boot-tools/patches/0001-tools-disable-kwbimage.patch +@@ -0,0 +1,25 @@ ++From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= ++Date: Tue, 30 Nov 2021 11:29:19 +0100 ++Subject: [PATCH] tools: disable kwbimage ++MIME-Version: 1.0 ++Content-Type: text/plain; charset=UTF-8 ++Content-Transfer-Encoding: 8bit ++ ++Without CONFIG_TOOLS_LIBCRYPTO kwbimage doesn't compile because of ++multiple "undefined reference"s to SSL functions. ++ ++Signed-off-by: Rafał Miłecki ++--- ++ tools/Makefile | 1 - ++ 1 file changed, 1 deletion(-) ++ ++--- a/tools/Makefile +++++ b/tools/Makefile ++@@ -117,7 +117,6 @@ dumpimage-mkimage-objs := aisimage.o \ ++ imximage.o \ ++ imx8image.o \ ++ imx8mimage.o \ ++- kwbimage.o \ ++ lib/md5.o \ ++ lpc32xximage.o \ ++ mxsimage.o \ + diff --git a/package/boot/uboot-tools/patches/0002-tools-dumpimage-fix-tools-compile.patch b/package/boot/uboot-tools/patches/0002-tools-dumpimage-fix-tools-compile.patch new file mode 100644 index 00000000000..ab2e817b57c --- /dev/null +++ b/package/boot/uboot-tools/patches/0002-tools-dumpimage-fix-tools-compile.patch @@ -0,0 +1,84 @@ +From 1ceffec2523888b4701405b7cf1710489e17011a Mon Sep 17 00:00:00 2001 +From: Scott Mercer +Date: Wed, 19 Mar 2025 06:31:44 -0400 +Subject: [PATCH] ipq50xx: packages: dumpimage: fix compile patch + +This patch is to fix compilation for uboot-tool V2025.01 in openwrt. + +* same "compile for enviroment patch" to makefile, that is used + in uboot-envtools. + +* remove mkeficapsule from build to avoid gnulib dependencies + +* disable bmp_logo from build to allow compilation + +Signed-off-by: Scott Mercer +--- + tools/Makefile | 38 ++++++++++++++++++++++++++------------ + 1 file changed, 26 insertions(+), 12 deletions(-) + +diff --git a/tools/Makefile b/tools/Makefile +index ee08a9675df8..a72b7909a066 100644 +--- a/tools/Makefile ++++ b/tools/Makefile +@@ -22,6 +22,26 @@ + # That's as long as the features of those tools aren't modified. + # + ++override HOSTCC = $(CC) ++ ++ifneq ($(TARGET_CFLAGS),) ++KBUILD_HOSTCFLAGS = $(TARGET_CFLAGS) ++endif ++ifneq ($(TARGET_LDFLAGS),) ++KBUILD_HOSTLDFLAGS = $(TARGET_LDFLAGS) ++endif ++ ++# Compile for a hosted environment on the target ++HOST_EXTRACFLAGS = -I$(srctree)/tools \ ++ $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \ ++ -idirafter $(srctree)/tools/env \ ++ -DUSE_HOSTCC \ ++ -DTEXT_BASE=$(TEXT_BASE) ++ ++ifeq ($(MTD_VERSION),old) ++HOST_EXTRACFLAGS += -DMTD_OLD ++endif ++ + # Enable all the config-independent tools + ifneq ($(HOST_TOOLS_ALL),) + CONFIG_ARCH_KIRKWOOD = y +@@ -244,15 +264,10 @@ hostprogs-$(CONFIG_MIPS) += mips-relocs + hostprogs-$(CONFIG_ASN1_COMPILER) += asn1_compiler + HOSTCFLAGS_asn1_compiler.o = -idirafter $(srctree)/include + +-HOSTCFLAGS_mkeficapsule.o += \ +- $(shell pkg-config --cflags gnutls 2> /dev/null || echo "") +-HOSTLDLIBS_mkeficapsule += \ +- $(shell pkg-config --libs gnutls 2> /dev/null || echo "-lgnutls") +-mkeficapsule-objs := generated/lib/uuid.o \ +- generated/lib/sha1.o \ +- $(LIBFDT_OBJS) \ +- mkeficapsule.o +-hostprogs-$(CONFIG_TOOLS_MKEFICAPSULE) += mkeficapsule ++HOSTCFLAGS_mkeficapsule.o += ++HOSTLDLIBS_mkeficapsule += ++mkeficapsule-objs := ++hostprogs-$(CONFIG_TOOLS_MKEFICAPSULE) += + + mkfwumdata-objs := mkfwumdata.o generated/lib/crc32.o + HOSTLDLIBS_mkfwumdata += -luuid +@@ -313,10 +328,9 @@ HOST_EXTRACFLAGS += -include $(srctree)/include/compiler.h \ + -I$(srctree)/scripts/dtc/libfdt \ + -I$(srctree)/tools \ + -DUSE_HOSTCC \ +- -D__KERNEL_STRICT_NAMES \ +- -D_GNU_SOURCE ++ -D__KERNEL_STRICT_NAMES + +-__build: $(LOGO-y) ++__build: $(LOGO-n) + + $(LOGO_H): $(obj)/bmp_logo $(LOGO_BMP) + $(obj)/bmp_logo --gen-info $(LOGO_BMP) > $@ + -- 2.47.2