mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2024-12-12 01:44:54 +00:00
929641fa1f
This will be used to append extra information to images which allows the system to verify if an image is compatible with the system. The extra data is appended to the end of the image, where it will be ignored when upgrading from systems that do not process this data yet: If the image is a squashfs or jffs2 image, the extra data will land after the end-of-filesystem marker, where it will be overwritten once the system boots for the first timee. If the image is a sysupgrade tar file, tar will simply ignore the extra data when unpacking. The layout of the metadata/signature chunks is constructed in a way that the last part contains just a magic and size information, so that the tool can quickly check if any valid data is present without having to do a pattern search throughout the full image. Chunks also contain CRC32 information to detect file corruption, even when the image is not signed. Signed-off-by: Felix Fietkau <nbd@nbd.name>
48 lines
1.1 KiB
Makefile
48 lines
1.1 KiB
Makefile
#
|
|
# Copyright (C) Felix Fietkau <nbd@nbd.name>
|
|
#
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
# See /LICENSE for more information.
|
|
#
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
PKG_NAME:=fwtool
|
|
PKG_RELEASE:=1
|
|
|
|
PKG_FLAGS:=nonshared
|
|
|
|
PKG_MAINTAINER := Felix Fietkau <nbd@nbd.name>
|
|
PKG_BUILD_DEPENDS := fwtool/host
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
include $(INCLUDE_DIR)/host-build.mk
|
|
|
|
HOST_BUILD_PREFIX:=$(STAGING_DIR_HOST)
|
|
|
|
define Package/fwtool
|
|
SECTION:=utils
|
|
CATEGORY:=Base system
|
|
TITLE:=Utility for appending and extracting firmware metadata and signatures
|
|
endef
|
|
|
|
define Host/Compile
|
|
$(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $(HOST_BUILD_DIR)/fwtool ./src/fwtool.c
|
|
endef
|
|
|
|
define Host/Install
|
|
$(INSTALL_BIN) $(HOST_BUILD_DIR)/fwtool $(1)/bin/
|
|
endef
|
|
|
|
define Build/Compile
|
|
$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) -o $(PKG_BUILD_DIR)/fwtool ./src/fwtool.c
|
|
endef
|
|
|
|
define Package/fwtool/install
|
|
$(INSTALL_DIR) $(1)/usr/bin
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/fwtool $(1)/usr/bin/
|
|
endef
|
|
|
|
$(eval $(call HostBuild))
|
|
$(eval $(call BuildPackage,fwtool))
|