Just leaving this here for others:
I did a sysupgrade from v21.02.3 and the LAN is dead. I then tried a factory v22.03.0 image through the built-in D-Link recovery to eliminate a sysupgrade issue and the LAN is still dead.
I went back to v21.02.3 through recovery and the router is back up.
I opened an issue here: https://github.com/openwrt/openwrt/issues/10634 and left a note on the DIR-645 wiki
Might be the kernel has grown too big, but one would need serial output to determine what goes wrong exactly.
Thanks.. I thought that too so flashed a smaller image using the firmware selector. Both sysupgrade and factory. I again had to go back to 21.02.3 to regain control. An 8/64 device shouldn't be quite obsolete yet especially if there aren't any additional packages and really light routing.
You're confusing image and kernel size. It wouldn't be the first device exceeding the hardcoded kernel size the manufacturer set - which is what would make hardware obsolete, not the fact a modern Linux kernel exceeds that arbitrary limit. But until you get serial going, it's all conjecture.
Thank you for the clarification. I will investigate the serial connection on this device.
I was able to connect via serial and here is the output. The following just repeats over and over:
U-Boot 1.1.3 (Apr 15 2011 - 10:39:36) (ALPHA)
SVN revision: 516
Target board: WRG-N39
Board: Ralink APSoC DRAM: 64 MB
spi_wait_nsec: 30
spi device id: c2 20 17 c2 20 (2017c220)
find flash: MX25L6405D
raspi_read: from:30000 len:1000
.raspi_read: from:30000 len:1000
.============================================
Ralink UBoot Version: 3.3
--------------------------------------------
ASIC 3883_MP (MAC to REALTEK Mode)
DRAM component: 512 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 64 MBytes
Flash component: SPI Flash
Date:Apr 15 2011 Time:10:39:36
============================================
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768
gpio_init: write 0x00001801
gpio_init: write 0x0000185d to GPIOMODE(0xb0000060)
Initializing RTL8367 GbE switch ...
Setting RTL8367RB RGMII Delay time tx:1,rx0
Please choose the operation:
1: Load system code to SDRAM via TFTP.
2: Load system code then write to Flash via TFTP.
3: Boot system code via Flash (default).
4: Entr boot command line interface.
7: Load Boot Loader code then write to Flash via Serial.
9: Load Boot Loader code then write to Flash via TFTP. 0
3: System Boot system code via Flash.
## Booting image at bc050000 ...
raspi_read: from:50000 len:40
.raspi_read: from:50000 len:c
.raspi_read: from:50000 len:5738a6
........................................................................................We have SEAMA, Image Size = 5716070
Verifying Checksum ...
Uncompressing SEAMA linux.lzma ... LZMA ERROR 1 - must RESET board to recover
I flashed back to 21.02.3 and the only difference I see is:
3: System Boot system code via Flash.
## Booting image at bc050000 ...
raspi_read: from:50000 len:40
.raspi_read: from:50000 len:c
.raspi_read: from:50000 len:4ea004
...............................................................................We have SEAMA, Image Size = 5152708
Verifying Checksum ...
Uncompressing SEAMA linux.lzma ... OK
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 64
Starting kernel ...
That error really hints at the kernel being too big. That's often worked around by using an LZMA loader to relocate the kernel. See e.g.
committed 10:22AM - 27 Apr 20 UTC
This device has trouble extracting big kernel from flash,
and supports LZMA comp… ressed kernels only.
Using OpenWrt kernel loader saves us 64 KB compared to the dictionary
size limiting workaround.
Factory image sizes (commit: 5f126c541a74) with "CONFIG_ALL_KMODS=y":
- original ("-d23", default): 4784188 bytes, LZMA ERROR 1
- with "-d19": 4915260, LZMA ERROR 1
- with "-d18": 4915260, diff to original: +128 KB
- with "-d17": 4980796, diff to original: +192 KB
- with this patch: 4849724, diff to original: +64 KB
To save some CPU cycle, use minimal compression ("-a0") for the LZMA
compressed uImage.
The most robust solution would use a different loader,
which reads the compressed kernel directly from the flash.
See the thread at [0] for more details!
[0] http://lists.infradead.org/pipermail/openwrt-devel/2020-April/022926.html
Signed-off-by: Szabolcs Hubai <szab.hu@gmail.com>
Tested-by: Stijn Segers <foss@volatilesystems.org>
[fixed identation]
Signed-off-by: David Bauer <mail@david-bauer.net>
Thanks @Borromini for your expertise.
I also found that LZMA ERROR 1 for others were due to just a wrong header version or loading at the wrong address: [Solved] Uboot - Not enough buffer for decompression LZMA ERROR 1 - #29 by numero53
Well, I'd reckon that memory addres hasn't changed between 21.02 and 22.03. Same about the header. Lots of stuff have changed and kernel size is (unfortunately) always a big one - from 5.4 to 5.10 in this case.
I have no experience with migrating devices to the LZMA loader, but it's certainly worth a try. That seems more likely to be the issue to me in this case.
@xabolcs Would you mind taking a peek?
xabolcs
September 14, 2022, 2:24pm
10
Just did it today, but I don't have good news.
The dlink_dir-645 recipe has $(Device/uimage-lzma-loader)
long ago:
committed 10:25PM - 27 Aug 20 UTC
The DIR-645 fails to boot if the kernel is large.
Enabling lzma-loader resolves … the issue.
Run-tested on D-Link DIR-645.
Signed-off-by: Perry Melange <isprotejesvalkata@gmail.com>
It has a lzma -d10
too but that is now a dead code because of and that negates (?!) the commit above.
EDIT:
This is the first time when I see that uimage-lzma-loader
is unable to fix the LZMA ERROR 1 problem.
1 Like
xabolcs
September 14, 2022, 2:38pm
11
I could cook a few firmware with updated recipes, if you are willing to flash random community builds found on the internet to your router!
Should I give it a spin?
1 Like
Absolutely... I'll be glad to dedicate a device for testing to help
xabolcs
September 14, 2022, 3:06pm
13
I wrote a few patch, but I wasn't able to use ImageBuilder as a shortcut: need to build the whole stuff.
Will post the binaries a few hours later ...
./dir-645-patch-dir-860l-style-uimage-none.patch
:
--- target/linux/ramips/image/rt3883.mk.bak 2022-09-14 16:48:00.997749977 +0200
+++ target/linux/ramips/image/rt3883.mk 2022-09-14 16:54:16.656954661 +0200
@@ -28,21 +28,22 @@
KERNEL := kernel-bin | append-dtb | lzma -d16 | uImage lzma
# Stock firmware checks for this uImage image name during upload.
UIMAGE_NAME := N750F9K1103VB
endef
TARGET_DEVICES += belkin_f9k1109v1
define Device/dlink_dir-645
$(Device/seama)
- $(Device/uimage-lzma-loader)
SOC := rt3662
BLOCKSIZE := 4k
IMAGE_SIZE := 7872k
- KERNEL := kernel-bin | append-dtb | lzma -d10
+ LOADER_TYPE := bin
+ KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | relocate-kernel | \
+ uImage none
SEAMA_SIGNATURE := wrgn39_dlob.hans_dir645
DEVICE_VENDOR := D-Link
DEVICE_MODEL := DIR-645
DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2
SUPPORTED_DEVICES += dir-645
endef
TARGET_DEVICES += dlink_dir-645
./dir-645-patch-dir-860l-style.patch
:
--- target/linux/ramips/image/rt3883.mk.bak 2022-09-14 16:48:00.997749977 +0200
+++ target/linux/ramips/image/rt3883.mk 2022-09-14 16:49:26.050475557 +0200
@@ -28,21 +28,22 @@
KERNEL := kernel-bin | append-dtb | lzma -d16 | uImage lzma
# Stock firmware checks for this uImage image name during upload.
UIMAGE_NAME := N750F9K1103VB
endef
TARGET_DEVICES += belkin_f9k1109v1
define Device/dlink_dir-645
$(Device/seama)
- $(Device/uimage-lzma-loader)
SOC := rt3662
BLOCKSIZE := 4k
IMAGE_SIZE := 7872k
- KERNEL := kernel-bin | append-dtb | lzma -d10
+ LOADER_TYPE := bin
+ KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | relocate-kernel | \
+ lzma -a0 | uImage lzma
SEAMA_SIGNATURE := wrgn39_dlob.hans_dir645
DEVICE_VENDOR := D-Link
DEVICE_MODEL := DIR-645
DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2
SUPPORTED_DEVICES += dir-645
endef
TARGET_DEVICES += dlink_dir-645
./dir-645-patch-dir-860l-style-lzma-d10-no-relocate.patch
:
--- target/linux/ramips/image/rt3883.mk.bak 2022-09-14 16:48:00.997749977 +0200
+++ target/linux/ramips/image/rt3883.mk 2022-09-14 16:58:58.883421251 +0200
@@ -28,21 +28,22 @@
KERNEL := kernel-bin | append-dtb | lzma -d16 | uImage lzma
# Stock firmware checks for this uImage image name during upload.
UIMAGE_NAME := N750F9K1103VB
endef
TARGET_DEVICES += belkin_f9k1109v1
define Device/dlink_dir-645
$(Device/seama)
- $(Device/uimage-lzma-loader)
SOC := rt3662
BLOCKSIZE := 4k
IMAGE_SIZE := 7872k
- KERNEL := kernel-bin | append-dtb | lzma -d10
+ LOADER_TYPE := bin
+ KERNEL := kernel-bin | append-dtb | lzma -d10 | loader-kernel | \
+ lzma -a0 | uImage lzma
SEAMA_SIGNATURE := wrgn39_dlob.hans_dir645
DEVICE_VENDOR := D-Link
DEVICE_MODEL := DIR-645
DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2
SUPPORTED_DEVICES += dir-645
endef
TARGET_DEVICES += dlink_dir-645
./dir-645-patch-uimage-lzma-loader-style-lzma-d10.patch
:
--- target/linux/ramips/image/rt3883.mk.bak 2022-09-14 16:48:00.997749977 +0200
+++ target/linux/ramips/image/rt3883.mk 2022-09-14 16:59:51.491881690 +0200
@@ -28,21 +28,21 @@
KERNEL := kernel-bin | append-dtb | lzma -d16 | uImage lzma
# Stock firmware checks for this uImage image name during upload.
UIMAGE_NAME := N750F9K1103VB
endef
TARGET_DEVICES += belkin_f9k1109v1
define Device/dlink_dir-645
$(Device/seama)
- $(Device/uimage-lzma-loader)
SOC := rt3662
BLOCKSIZE := 4k
IMAGE_SIZE := 7872k
- KERNEL := kernel-bin | append-dtb | lzma -d10
+ LOADER_TYPE := bin
+ KERNEL := kernel-bin | append-dtb | lzma -d10 | loader-kernel | uImage none
SEAMA_SIGNATURE := wrgn39_dlob.hans_dir645
DEVICE_VENDOR := D-Link
DEVICE_MODEL := DIR-645
DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2
SUPPORTED_DEVICES += dir-645
endef
TARGET_DEVICES += dlink_dir-645
./dir-645-patch-dir-860l-style-no-relocate.patch
:
--- target/linux/ramips/image/rt3883.mk.bak 2022-09-14 16:48:00.997749977 +0200
+++ target/linux/ramips/image/rt3883.mk 2022-09-14 16:58:12.659016687 +0200
@@ -28,21 +28,22 @@
KERNEL := kernel-bin | append-dtb | lzma -d16 | uImage lzma
# Stock firmware checks for this uImage image name during upload.
UIMAGE_NAME := N750F9K1103VB
endef
TARGET_DEVICES += belkin_f9k1109v1
define Device/dlink_dir-645
$(Device/seama)
- $(Device/uimage-lzma-loader)
SOC := rt3662
BLOCKSIZE := 4k
IMAGE_SIZE := 7872k
- KERNEL := kernel-bin | append-dtb | lzma -d10
+ LOADER_TYPE := bin
+ KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | \
+ lzma -a0 | uImage lzma
SEAMA_SIGNATURE := wrgn39_dlob.hans_dir645
DEVICE_VENDOR := D-Link
DEVICE_MODEL := DIR-645
DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2
SUPPORTED_DEVICES += dir-645
endef
TARGET_DEVICES += dlink_dir-645
xabolcs
September 14, 2022, 8:05pm
14
account4538:
Absolutely...
dir-645-22.03-lzma-error-01.tar.xz
Please flash the factory.bin
first! And if it boots, then reflash it with sysupgrade.bin
!
I don't think either will work!
Thank you, unfortunately same error:
factory.bin flash:
mpfd_decode: UPLOADED, upsize = 5009460
SEAMA ==========================================
magic : 5ea3a417
meta size : 36 bytes
meta data : signature=wrgn39_dlob.hans_dir645
meta data :
meta data :
image size : 0 bytes
================================================
SEAMA ==========================================
magic : 5ea3a417
meta size : 36 bytes
meta data : dev=/dev/mtdblock/2
meta data : type=firmware
meta data :
meta data :
image size : 5009348 bytes
checksum : 81DB8C5E1FA97DE569606C9F35D2250E
digest : 81DB8C5E1FA97DE569606C9F35D2250E
Selected !!!
================================================
Copy SEAMA with header (from 0x80100030).
raspi_erase_write: offs:50000, count:4c7004
raspi_erase: offs:50000 len:4c0000
............................................................................
raspi_write: to:50000 len:4c0000
............................................................................
raspi_read: from:510000 len:10000
.raspi_erase: offs:510000 len:10000
.
raspi_write: to:510000 len:10000
.
Done!
Boot:
U-Boot 1.1.3 (Apr 15 2011 - 10:39:36) (ALPHA)
SVN revision: 516
Target board: WRG-N39
Board: Ralink APSoC DRAM: 64 MB
spi_wait_nsec: 30
spi device id: c2 20 17 c2 20 (2017c220)
find flash: MX25L6405D
raspi_read: from:30000 len:1000
.raspi_read: from:30000 len:1000
.============================================
Ralink UBoot Version: 3.3
--------------------------------------------
ASIC 3883_MP (MAC to REALTEK Mode)
DRAM component: 512 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 64 MBytes
Flash component: SPI Flash
Date:Apr 15 2011 Time:10:39:36
============================================
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768
gpio_init: write 0x00001801
gpio_init: write 0x0000185d to GPIOMODE(0xb0000060)
Initializing RTL8367 GbE switch ...
Setting RTL8367RB RGMII Delay time tx:1,rx0
Please choose the operation:
1: Load system code to SDRAM via TFTP.
2: Load system code then write to Flash via TFTP.
3: Boot system code via Flash (default).
4: Entr boot command line interface.
7: Load Boot Loader code then write to Flash via Serial.
9: Load Boot Loader code then write to Flash via TFTP. 0
3: System Boot system code via Flash.
## Booting image at bc050000 ...
raspi_read: from:50000 len:40
.raspi_read: from:50000 len:c
.raspi_read: from:50000 len:4c7004
.............................................................................We have SEAMA, Image Size = 5009348
Verifying Checksum ...
Uncompressing SEAMA linux.lzma ... LZMA ERROR 1 - must RESET board to recover
Do you want me to try the sysupgrade from 21.02.3?
Standby I didn't try the other 3...
@xabolcs Unfortunately all 5 stopped at the same error:
Verifying Checksum ...
Uncompressing SEAMA linux.lzma ... LZMA ERROR 1 - must RESET board to recover
Was hoping one would have been the patch needed
1 Like
xabolcs
September 15, 2022, 10:30am
18
One thing I could try is the OKLI Loader, e.g.:
committed 06:36PM - 13 Dec 21 UTC
Jboot devices have problem with >2MB kernelsize. The only way to avoid
this prob… lem is use small loader.
This patch switch all mt7620 Jboot devices to lzma OKLI loader.
Suggested-by: Szabolcs Hubai <szab.hu@gmail.com>
Co-authored-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
It does work for mt7620
and mt7621
, but not for rt305x
. Hope it works for rt3883
.
No problem I'll try that one as well when ready
robho
September 19, 2022, 7:16pm
20
I noticed that for 21.02 release the LZMA dictionary size was reduced (https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=6fba88de1913301f11163aa05298e4fb488b3640 ).
Could it help to reduce it further?