Just to add some notes:
The 2017 brick reports occured because the bootloader does not read the full kernel/initramfs partition when booting (last argument)
loadr=nand read.e 0x62000000 240000 280000
load=nand read.e 0x60500000 840000 300000
Whereas the partitions are sized differently (first number):
mtd3: 00600000 00020000 "INITRD"
mtd4: 007c0000 00020000 "Kernel"
Instead of slimming down the (oversized) OpenWRT installation image, I patched u-boot to load the full partition size. This mitigates the risk of running into the same issue during an upgrade in the future.
Instructions provided as a reference for anyone looking to improve future robustness. Using the workaround by @daniel is the recommended way of installation. Do not attempt to reproduce unless you exactly know what you're doing.
If your loaders (stage1, u-boot) match SHA256
25ceb3f2f0f1b1e4f25c81bb7a85d19d8a7e5f3ca8b1e1d1d755db6fb2806131 mtdblock1.bin
9e7073ad846c715cc84bd8b0d3a09c809f1ecae8581a553aca3b676681f065a7 mtdblock2.bin
Applying this script should output two patched u-boot images matching.
e69da743f69f8ce08c8f37362896ddb95bd9de015db78bfeb6515570a101f9a3 uboot_patched.bin
b01411a337b7ec3fd2ae7bb6fb752e55dc12f3e6166edad453bb861ad0cbfe65 uboot_patched_padded.bin
Erase the u-boot partition and write uboot_patched.bin
(without oob). The second checksum is provided for convenience (should match /dev/mtdblock2 on the vendor firmware after flashing).
Note: mtd numbering differs between stock firmware and WRT - WRT splits u-boot in mtdblock{1,2}.
My current stage1 & (patched) u-boot, as seen from OpenWRT:
# cat /dev/mtdblock0 | sha256sum
25ceb3f2f0f1b1e4f25c81bb7a85d19d8a7e5f3ca8b1e1d1d755db6fb2806131 -
# cat /dev/mtdblock1 /dev/mtdblock2 | sha256sum
b01411a337b7ec3fd2ae7bb6fb752e55dc12f3e6166edad453bb861ad0cbfe65 -
I cannot remember whether NAND oob data is used/relevant for the loaders. I think it's all 0xff for the original loaders. but by all means do verify..
Additional notes:
- OX820 can boot from SATA. See: [MedionNAS] installation and recovery - creating a SATA bootable OpenWRT image might be useful.
- I suppose adding the patched u-boot (and stage1) to the factory upgrade image would work.
- The stage1/u-boot contained in the 'factory image' which used to be available on the net differ from whats shipped on the machine out of the box (slightly older - the ones I patched).
I don't have physical access to the machine I'm running OpenWRT on, nor any interest to work on any of the above. Just dropping my notes in case they end up being useful to anyone else.