[OpenWrt-Devel] [PATCH v2] build: add mkrasimage

Stefan Lippers-Hollmann s.l-h at gmx.de
Mon Aug 20 23:47:55 EDT 2018


Hi

On 2018-08-20, David Bauer wrote:
> 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 old
> script is still kept but can be deleted in the future.
> 
> The new mkrasimage is also compatible with other ZyXEL devices using
> the ras image-format. This is not tested with a OpenWRT build but
> it correctly builds the header for ZyXEL factory images for all devices
> it is added to.
> 
> Signed-off-by: David Bauer <mail at david-bauer.net>

with the caveat explained below:
Tested-by: Stefan Lippers-Hollmann <s.l-h at gmx.de>

> v2 changes:
>  - Rework image-generation code
>  - Add factory image for NBG6616
>  - Add factory image for NBG6817

Thanks a lot for looking into this!
I've given this a test on my ZyXEL NBG6817 and it's basically working, 
ZyXEL just decided to prevent downgrades from the firmware upgrade
functionality of their webinterface, which means it parses the 
RAS_VERSION and rejects the currently chosen version number.
Flashing this image from a tftpd avoids the strict version 
requirements and can flash the image as-is (press WPS key while 
power-on, have the factory image renamed to "ras.bin" available from a 
tftpd at 192.168.1.99).

[...]
> diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile
> index 2902af3231..cbb03272fb 100644
> --- a/target/linux/ipq806x/image/Makefile
> +++ b/target/linux/ipq806x/image/Makefile
[...]
> @@ -245,6 +246,9 @@ define Device/zyxel_nbg6817
>  	KERNEL_SIZE := 4096k
>  	BLOCKSIZE := 64k
>  	BOARD_NAME := nbg6817
> +	RAS_BOARD := NBG6817
> +	RAS_ROOTFS_SIZE := 20934k
> +	RAS_VERSION := "$(VERSION_DIST) $(REVISION)"
[...]

For now, I've supplied a valid/ future firmware version for testing

RAS_VERSION := "V1.00(ABCS.9)C0"

and it flashes nicely from the webinterface (until ZyXEL actually 
releases this version, which is next in line). I'll have a look if I
can track down the version check and supply something that's both a
bit closer to OpenWrt and more future safe, but I'd suggest to go 
with "V1.00(ABCS.9)C0" for now, as that has been confirmed to work
for the next couple of weeks.

Flashed OpenWrt master image via web-interface, with a fake ZyXEL version
number:

# hexdump -C /dev/mmcblk0p6 | head -n6
00000000  00 00 7a 9f 01 47 18 00  56 31 2e 30 30 28 41 42  |..z..G..V1.00(AB|
00000010  43 53 2e 39 29 43 30 00  ff ff ff ff ff ff ff ff  |CS.9)C0.........|
00000020  ff ff ff ff ff ff ff ff  00 00 d5 73 4e 42 47 36  |...........sNBG6|
00000030  38 31 37 00 ff ff ff ff  ff ff ff ff ff ff ff ff  |817.............|
00000040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*

Flashed via tftpd, using OpenWrt's preliminary version info:

# hexdump -C /dev/mmcblk0p3 | head -n6
00000000  00 00 7a 9f 01 47 18 00  4f 70 65 6e 57 72 74 20  |..z..G..OpenWrt |
00000010  72 37 38 38 33 2d 66 63  39 63 62 66 33 62 63 30  |r7883-fc9cbf3bc0|
00000020  00 ff ff ff ff ff ff ff  00 00 d0 e0 4e 42 47 36  |............NBG6|
00000030  38 31 37 00 ff ff ff ff  ff ff ff ff ff ff ff ff  |817.............|
00000040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*

Regards, thank you very much!
	Stefan Lippers-Hollmann
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: Digitale Signatur von OpenPGP
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20180821/c3a737c1/attachment.sig>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list