aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2021-04-01 17:06:47 +0200
committerRafał Miłecki <rafal@milecki.pl>2021-04-08 13:16:13 +0200
commit91e0865ff576cad261a9cabc6b0e7dc2c7ce7508 (patch)
treeec19db5cffba2203be9949b80fbc8e97c4942b4b
parent7b3bde801ba34c945465d6fbcebd56f14616ce0d (diff)
downloadupstream-91e0865ff576cad261a9cabc6b0e7dc2c7ce7508.tar.gz
upstream-91e0865ff576cad261a9cabc6b0e7dc2c7ce7508.tar.bz2
upstream-91e0865ff576cad261a9cabc6b0e7dc2c7ce7508.zip
firmware-utils: bcm4908img: convert into a package
bcm4908img is a tool managing BCM4908 platform images. It's used for creating them as well as checking, modifying and extracting data from. It's required by both: host (for building firmware images) and target (for sysupgrade purposes). Make it a host/target package. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit 9b4fc4cae9fa0cd0cd9060e1c9d33320c3249ced)
-rw-r--r--package/utils/bcm4908img/Makefile52
-rw-r--r--package/utils/bcm4908img/src/Makefile7
-rw-r--r--package/utils/bcm4908img/src/bcm4908img.c (renamed from tools/firmware-utils/src/bcm4908img.c)0
-rw-r--r--target/linux/bcm4908/Makefile4
-rw-r--r--tools/firmware-utils/Makefile1
5 files changed, 62 insertions, 2 deletions
diff --git a/package/utils/bcm4908img/Makefile b/package/utils/bcm4908img/Makefile
new file mode 100644
index 0000000000..108fe600e5
--- /dev/null
+++ b/package/utils/bcm4908img/Makefile
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=bcm4908img
+PKG_RELEASE:=1
+
+PKG_BUILD_DEPENDS := bcm4908img/host
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/host-build.mk
+
+define Package/bcm4908img
+ SECTION:=utils
+ CATEGORY:=Base system
+ TITLE:=Utility handling BCM4908 images
+ MAINTAINER:=Rafał Miłecki <rafal@milecki.pl>
+ DEPENDS:=@TARGET_bcm4908
+endef
+
+define Package/bcm4908img/description
+ CFE bootloader for BCM4908 uses custom image format. It consists of:
+ 1. Optional cferom image
+ 2. bootfs JFFS2 partition (cferam, kernel, DTB and optional helper files)
+ 3. padding
+ 4. rootfs simply appended to the bootfs + padding
+ 5. tail with checksum and basic device info
+
+ This util allows creating, modifying and extracting from BCM4908 images.
+endef
+
+define Host/Prepare
+ $(CP) ./src/* $(HOST_BUILD_DIR)
+endef
+
+define Build/Compile
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ CC="$(TARGET_CC)" \
+ CFLAGS="$(TARGET_CFLAGS) -Wall"
+endef
+
+define Package/bcm4908img/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/bcm4908img $(1)/usr/bin/
+endef
+
+define Host/Install
+ $(INSTALL_BIN) $(HOST_BUILD_DIR)/bcm4908img $(STAGING_DIR_HOST)/bin/
+endef
+
+$(eval $(call BuildPackage,bcm4908img))
+$(eval $(call HostBuild))
diff --git a/package/utils/bcm4908img/src/Makefile b/package/utils/bcm4908img/src/Makefile
new file mode 100644
index 0000000000..72f8e30d68
--- /dev/null
+++ b/package/utils/bcm4908img/src/Makefile
@@ -0,0 +1,7 @@
+all: bcm4908img
+
+bcm4908img:
+ $(CC) $(CFLAGS) -o $@ bcm4908img.c -Wall
+
+clean:
+ rm -f bcm4908img
diff --git a/tools/firmware-utils/src/bcm4908img.c b/package/utils/bcm4908img/src/bcm4908img.c
index 402d317190..402d317190 100644
--- a/tools/firmware-utils/src/bcm4908img.c
+++ b/package/utils/bcm4908img/src/bcm4908img.c
diff --git a/target/linux/bcm4908/Makefile b/target/linux/bcm4908/Makefile
index 5bee66fe2b..4edd0ccfa8 100644
--- a/target/linux/bcm4908/Makefile
+++ b/target/linux/bcm4908/Makefile
@@ -20,6 +20,8 @@ include $(INCLUDE_DIR)/target.mk
KERNELNAME:=Image dtbs
-DEFAULT_PACKAGES += kmod-usb-ohci kmod-usb2 kmod-usb3
+DEFAULT_PACKAGES += \
+ bcm4908img \
+ kmod-usb-ohci kmod-usb2 kmod-usb3
$(eval $(call BuildTarget))
diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index e4a31b6fd0..28f8f0555a 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -28,7 +28,6 @@ define Host/Compile
$(call cc,addpattern)
$(call cc,asustrx)
$(call cc,bcm4908asus,-Wall)
- $(call cc,bcm4908img,-Wall)
$(call cc,bcm4908kernel,-Wall)
$(call cc,buffalo-enc buffalo-lib,-Wall)
$(call cc,buffalo-tag buffalo-lib,-Wall)