HLK-7628N bricked / which firmware for uboot?

Hi,

I was trying to enable I2C and PWM on the module, so I did some make's and sysupgrade's. During one, a kernel panic occured and the module rebooted.

...
mount: mounting /dev/mtdblock6 on /overlay failed: Resource busy
...
[ 1473.563318] VFS: Busy inodes after unmount of jffs2 (jffs2)
...

the probably corrupted root filesystem resulted in a reboot loop.
The device doesn't have any ethernet hardware, so in uboot only a serial recovery is possible

This is what I tried:
uboot -> 4: Entr boot command line interface.

MT7628 # loadb 0x80000000
## Ready for binary (kermit) download to 0x80000000 at 57600 bps...
send ...squashfs-sysupgrade.bin or -initramfs-kernel.bin (via kermit command)
## Total Size      = 0x005b011c = 5964060 Bytes
## Start Addr      = 0x80000000

MT7628 # erase linux
Erase linux kernel block !!
From 0x50000 length 0x1FB0000
raspi_erase: offs:50000 len:1fb0000
......................

MT7628 # help cp
cp 
cp.uboot
    - copy uboot block
cp.linux
    - copy linux kernel block

MT7628 # cp.linux 0x80000000
 Copy linux image[-8589383 byte] to SPI Flash[0x00050000].... 
                  ^^^^^^^^

so, the linux partition is gone and cp.linux seems to not work. There is no cp.b command.

trying bootm:

MT7628 # bootm 0x80000000
## Booting image at 80000000 ...
   Image Name:   MIPS OpenWrt Linux-6.12.85
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    2120595 Bytes =  2 MB
   Load Address: 80000000
   Entry Point:  80000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... LZMA ERROR 1 - must RESET board to recover
(and reset)

adding KERNEL := kernel-bin | append-dtb | lzma -d22 | uImage lzma in target/linux/ramips/image/mt76x8.mk seemed to give some progress:

MT7628 # setenv bootargs "console=ttyS0,57600"
MT7628 # bootm 0x80000000
## Booting image at 80000000 ...
   Image Name:   MIPS OpenWrt Linux-6.12.85
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    5993835 Bytes =  5.7 MB
   Load Address: 80000000
   Entry Point:  80000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 128

Starting kernel ...

however that's it, no more logs, nothing.
the question is: Which firmware image is necessary for a successful mt7628 boot with uboot? Do I need a factory image? I'm using openwrt 25.12. Are there better chances with an older openwrt version?
I guess that trying to solder an usb port and load an image from an usb stick would result in the same errors. Are there better chances with JTAG?

Thanks!

I managed to recover the module:

  • saved the /dev/mtd4 from a healthy module
  • save existing partitions spi read <startaddr> <len>
    uboot: 0 0x10000, 0x10000 0x10000, 0x20000 0x10000,
    config: 0x30000 0x10000
    factory: (most important) 0x40000 0x10000
  • convert hex dump to binary and backup it
  • erase linux to erase flash
  • write python3 script to send spi write <addr> <hexstring> with original mtd4 data
  • original openwrt 14 is booting again

fixing initramfs:

target/linux/ramips/image/mt76x8.mk:

define Device/hilink_hlk-7628n
  IMAGE_SIZE := 32448k
  DEVICE_VENDOR := HILINK
  DEVICE_MODEL := HLK-7628N
  KERNEL := $(KERNEL_DTB) | uImage lzma -d22
                                         ^^^
check-size
endef
TARGET_DEVICES += hilink_hlk-7628n

... then you can upload an initramfs.bin via kermit and uboot 1.1.3 is able to start it

kermit: a lot of init stuff
kermit: connect
MT7628 # loadb 0x81000000
\ + C
kermit: send initramfs.bin
connect
MT7628 # setenv bootargs "console=ttyS0,57600 root=/dev/ram0 rw init=/etc/preinit"
MT7628 # bootm 0x81000000

somehow it didn't like to build the mt7603.ko kernel module
fix:
package/kernel/mt76/Makefile

define KernelPackage/mt7603
  $(KernelPackage/mt76-default)
  TITLE:=MediaTek MT7603 wireless driver
  DEPENDS+=@(PCI_SUPPORT||TARGET_ramips_mt76x8) +kmod-mt76-core
            ^           ^^^^^^^^^^^^^^^^^^^^^^^
  FILES:=\
    $(PKG_BUILD_DIR)/mt7603/mt7603e.ko
  AUTOLOAD:=$(call AutoProbe,mt7603e)
endef