firmware-utils: bcm4908img: convert into a package
[openwrt/staging/hauke.git] / package / utils / bcm4908img / Makefile
1 # SPDX-License-Identifier: GPL-2.0-only
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=bcm4908img
6 PKG_RELEASE:=1
7
8 PKG_BUILD_DEPENDS := bcm4908img/host
9
10 include $(INCLUDE_DIR)/package.mk
11 include $(INCLUDE_DIR)/host-build.mk
12
13 define Package/bcm4908img
14 SECTION:=utils
15 CATEGORY:=Base system
16 TITLE:=Utility handling BCM4908 images
17 MAINTAINER:=Rafał Miłecki <rafal@milecki.pl>
18 DEPENDS:=@TARGET_bcm4908
19 endef
20
21 define Package/bcm4908img/description
22 CFE bootloader for BCM4908 uses custom image format. It consists of:
23 1. Optional cferom image
24 2. bootfs JFFS2 partition (cferam, kernel, DTB and optional helper files)
25 3. padding
26 4. rootfs simply appended to the bootfs + padding
27 5. tail with checksum and basic device info
28
29 This util allows creating, modifying and extracting from BCM4908 images.
30 endef
31
32 define Host/Prepare
33 $(CP) ./src/* $(HOST_BUILD_DIR)
34 endef
35
36 define Build/Compile
37 $(MAKE) -C $(PKG_BUILD_DIR) \
38 CC="$(TARGET_CC)" \
39 CFLAGS="$(TARGET_CFLAGS) -Wall"
40 endef
41
42 define Package/bcm4908img/install
43 $(INSTALL_DIR) $(1)/usr/bin
44 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bcm4908img $(1)/usr/bin/
45 endef
46
47 define Host/Install
48 $(INSTALL_BIN) $(HOST_BUILD_DIR)/bcm4908img $(STAGING_DIR_HOST)/bin/
49 endef
50
51 $(eval $(call BuildPackage,bcm4908img))
52 $(eval $(call HostBuild))