-
Matthias Schiffer authored
(cherry picked from commit 6412177a)
Matthias Schiffer authored(cherry picked from commit 6412177a)
0009-build-add-mkrasimage.patch 24.83 KiB
From: David Bauer <mail@david-bauer.net>
Date: Wed, 22 Aug 2018 17:30:44 +0200
Subject: build: add mkrasimage
The current make-ras.sh image generation script for the ZyXEL NBG6617
has portability issues with bash. Because of this, factory images are
currently not built correctly by the OpenWRT buildbots.
This commit replaces the make-ras.sh by C-written mkrasimage.
The new mkrasimage is also compatible with other ZyXEL devices using
the ras image-format.
This is not tested with the NBG6616 but it correctly builds the
header for ZyXEL factory image.
Signed-off-by: David Bauer <mail@david-bauer.net>
diff --git a/include/image-commands.mk b/include/image-commands.mk
index 28b39c310e499caea4fe8a6d9ad6dceb5d95363b..552d8db1cbacf533c12d0d8e2e5cffbe5591adb4 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -49,17 +49,17 @@ define Build/eva-image
mv $@.new $@
endef
-define Build/make-ras
+define Build/zyxel-ras-image
let \
newsize="$(subst k,* 1024,$(RAS_ROOTFS_SIZE))"; \
- $(TOPDIR)/scripts/make-ras.sh \
- --board $(RAS_BOARD) \
- --version $(RAS_VERSION) \
- --kernel $(call param_get_default,kernel,$(1),$(IMAGE_KERNEL)) \
- --rootfs $@ \
- --rootfssize $$newsize \
- $@.new
- @mv $@.new $@
+ $(STAGING_DIR_HOST)/bin/mkrasimage \
+ -b $(RAS_BOARD) \
+ -v $(RAS_VERSION) \
+ -r $@ \
+ -s $$newsize \
+ -o $@.new \
+ $(if $(findstring separate-kernel,$(word 1,$(1))),-k $(IMAGE_KERNEL)) \
+ && mv $@.new $@
endef
define Build/netgear-chk
diff --git a/scripts/make-ras.sh b/scripts/make-ras.sh
deleted file mode 100755
index ccddaa0016b0c926d4737abb5757e7212b0a1157..0000000000000000000000000000000000000000
--- a/scripts/make-ras.sh
+++ /dev/null
@@ -1,196 +0,0 @@
-#!/usr/bin/env bash
-#
-# --- ZyXEL header format ---
-# Original Version by Benjamin Berg <benjamin@sipsolutions.net>
-#
-# The firmware image prefixed with a header (which is written into the MTD device).
-# The header is one erase block (~64KiB) in size, but the checksum only convers the
-# first 2KiB. Padding is 0xff. All integers are in big-endian.
-#
-# The checksum is always a 16-Bit System V checksum (sum -s) stored in a 32-Bit integer.
-#
-# 4 bytes: checksum of the rootfs image
-# 4 bytes: length of the contained rootfs image file (big endian)
-# 32 bytes: Firmware Version string (NUL terminated, 0xff padded)
-# 4 bytes: checksum over the header partition (big endian - see below)
-# 32 bytes: Model (e.g. "NBG6617", NUL termiated, 0xff padded)