From: Christian Lamparter <chunkeey@googlemail.com>
Date: Thu, 3 Nov 2016 20:47:06 +0000 (+0100)
Subject: apm821xx: add back end-of-UBI marker for the WNDR4700 and MR24
X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=8f2c2f94cf91476283ac2becb50f6d05482cd95f;p=openwrt%2Fstaging%2Fneocturne.git

apm821xx: add back end-of-UBI marker for the WNDR4700 and MR24

The patch "build: drop UBI EOF marker from images by default"
(commit d27bce8d28eb129af0abd9c80a7756301b7d588a) removed the
end-of-UBI marker. Without this marker, the boards will panic
during boot:

[    1.683458] ubi0: attaching mtd4
[    1.696181] ubi0 warning: scan_peb: valid VID header but corrupted EC header at PEB 31
[    1.704367] ubi0 error: scan_peb: bad image sequence number 549886691 in PEB 32, expected 184585623
[    1.713377] Erase counter header dump:
[    1.717110]  magic          0x55424923
[    1.720843]  version        1
[    1.723797]  ec             0
[    1.726752]  vid_hdr_offset 512
[    1.729880]  data_offset    2048
[    1.733094]  image_seq      549886691
[    1.736740]  hdr_crc        0x92ba8130
[    1.740472] erase counter header hexdump:
[    1.744493] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd4, error -22
[    1.751528] UBI error: cannot attach mtd4
[    1.755373] hctosys: unable to open rtc device (rtc0)
[    1.761130] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    1.768604] Please append a correct "root=" boot option; here are the available partitions:
[...]
[    1.856992] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    1.866519] Rebooting in 1 seconds..Auto calibration ---

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
---

diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile
index f8aecddc03..c032c54416 100644
--- a/target/linux/apm821xx/image/Makefile
+++ b/target/linux/apm821xx/image/Makefile
@@ -80,6 +80,7 @@ define Device/mr24
 		      MerakiAdd-dtb | pad-to 2047k | MerakiAdd-initramfs | \
 		      MerakiNAND
   IMAGE/sysupgrade.tar := sysupgrade-tar
+  UBINIZE_OPTS := -E 5
 endef
 TARGET_DEVICES += mr24
 
@@ -162,6 +163,7 @@ define Device/WNDR4700
   IMAGE/sysupgrade.tar := sysupgrade-tar
   NETGEAR_BOARD_ID := WNDR4700
   NETGEAR_HW_ID := 29763875+128+256
+  UBINIZE_OPTS := -E 5
 endef
 TARGET_DEVICES += WNDR4700