new file mode 100644
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=bcm63xximg
+PKG_RELEASE:=1
+
+PKG_BUILD_DEPENDS := bcm63xximg/host
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/host-build.mk
+
+define Package/bcm63xximg
+ SECTION:=utils
+ CATEGORY:=Base system
+ TITLE:=Utility handling bcm63xx firmware images
+ MAINTAINER:=Rafał Miłecki <rafal@milecki.pl>
+ DEPENDS:=@TARGET_bcm4908
+endef
+
+define Package/bcm63xximg/description
+ CFE bootloader for bcm63xx uses custom firmware format. It consists of:
+ 1. Optional cferom image
+ 2. bootfs JFFS2 partition with cferam, kernel and optional helper files
+ 3. rootfs simply appended to the bootfs
+ 4. tail with checksum and basic device info
+
+ BCM4908 platform also uses this format. Additionaly it requires device
+ specific 94908.dtb in the bootfs partition.
+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/bcm63xximg/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/bcm63xximg $(1)/usr/bin/
+endef
+
+define Host/Install
+ $(INSTALL_BIN) $(HOST_BUILD_DIR)/bcm63xximg $(STAGING_DIR_HOST)/bin/
+endef
+
+$(eval $(call BuildPackage,bcm63xximg))
+$(eval $(call HostBuild))
new file mode 100644
@@ -0,0 +1,7 @@
+all: bcm63xximg
+
+bcm63xximg:
+ $(CC) $(CFLAGS) -o $@ bcm63xximg.c -Wall
+
+clean:
+ rm -f bcm63xximg
similarity index 100%
rename from tools/firmware-utils/src/bcm4908img.c
rename to package/utils/bcm63xximg/src/bcm63xximg.c
@@ -20,6 +20,8 @@ include $(INCLUDE_DIR)/target.mk
KERNELNAME:=Image dtbs
-DEFAULT_PACKAGES += kmod-usb-ohci kmod-usb2 kmod-usb3
+DEFAULT_PACKAGES += \
+ bcm63xximg \
+ kmod-usb-ohci kmod-usb2 kmod-usb3
$(eval $(call BuildTarget))
@@ -22,7 +22,7 @@ define Build/bcm4908img
$(STAGING_DIR_HOST)/bin/mkfs.jffs2 --pad --little-endian --squash-uids \
-v -e 128KiB -o $@-bootfs.jffs2 -d $@-bootfs -m none -n
- $(STAGING_DIR_HOST)/bin/bcm4908img create $@.new -f $@-bootfs.jffs2 \
+ $(STAGING_DIR_HOST)/bin/bcm63xximg create $@.new -f $@-bootfs.jffs2 \
-a 0x20000 -f $@
mv $@.new $@
endef
@@ -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)