aboutsummaryrefslogtreecommitdiffstats
path: root/include/image-commands.mk
diff options
context:
space:
mode:
authorWenli Looi <wlooi@ucalgary.ca>2022-07-02 20:16:21 +0000
committerChristian Marangi <ansuelsmth@gmail.com>2022-07-21 16:58:00 +0200
commitd5858c6d97366f545e4efc50c2656b0cd3ac2928 (patch)
tree03ca80b523f373a4308de3b90f1846ab9c2360bc /include/image-commands.mk
parenta1068f77c90244c38ff54e94a43837b4c65cbf72 (diff)
downloadupstream-d5858c6d97366f545e4efc50c2656b0cd3ac2928.tar.gz
upstream-d5858c6d97366f545e4efc50c2656b0cd3ac2928.tar.bz2
upstream-d5858c6d97366f545e4efc50c2656b0cd3ac2928.zip
image: add support for Netgear encrypted image
Netgear encrypted image is used in various devices including WAX202, WAX206, and EX6400v3. This image format also requires a dummy squashfs4 image which is added here as well. References in WAX202 GPL source: https://www.downloads.netgear.com/files/GPL/WAX202_V1.0.5.1_Source.rar * openwrt/bootloader/u-boot-mt7621-2018.09-gitb178829-20200526/board/ralink/common/dual_image.c Bootloader code that verifies the presence of a squashfs4 image, thus a dummy image is added here. * openwrt/tools/imgencoder/src/gj_enc.c Contains code that generates the encrypted image. There is support for adding an RSA signature, but it does not look like the signature is verified by the stock firmware or bootloader. * openwrt/tools/imgencoder/src/imagekey.h Contains the encryption key and IV. It appears the same key/IV is used for other Netgear devices including WAX206 and EX6400v3. Signed-off-by: Wenli Looi <wlooi@ucalgary.ca> (cherry picked from commit efca76ffce5cf464e82d8269d79877f442209a0a)
Diffstat (limited to 'include/image-commands.mk')
-rw-r--r--include/image-commands.mk22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/image-commands.mk b/include/image-commands.mk
index 376553b8d2..402e3d71ed 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -112,6 +112,15 @@ define Build/append-squashfs-fakeroot-be
cat $@.fakesquashfs >> $@
endef
+define Build/append-squashfs4-fakeroot
+ rm -rf $@.fakefs $@.fakesquashfs
+ mkdir $@.fakefs
+ $(STAGING_DIR_HOST)/bin/mksquashfs4 \
+ $@.fakefs $@.fakesquashfs \
+ -nopad -noappend -root-owned
+ cat $@.fakesquashfs >> $@
+endef
+
define Build/append-string
echo -n $(1) >> $@
endef
@@ -376,6 +385,19 @@ define Build/netgear-dni
mv $@.new $@
endef
+define Build/netgear-encrypted-factory
+ $(TOPDIR)/scripts/netgear-encrypted-factory.py \
+ --input-file $@ \
+ --output-file $@ \
+ --model $(NETGEAR_ENC_MODEL) \
+ --region $(NETGEAR_ENC_REGION) \
+ --version V1.0.0.0.$(VERSION_DIST).$(firstword $(subst -, ,$(REVISION))) \
+ --encryption-block-size 0x20000 \
+ --openssl-bin "$(STAGING_DIR_HOST)/bin/openssl" \
+ --key 6865392d342b4d212964363d6d7e7765312c7132613364316e26322a5a5e2538 \
+ --iv 4a253169516c38243d6c6d2d3b384145
+endef
+
define Build/openmesh-image
$(TOPDIR)/scripts/om-fwupgradecfg-gen.sh \
"$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" \