R7800 -> Flashing openwrt causes bootloop (bad block in kernel area)

Update: Replying to myself but maybe it helps others. I ended up going the "sysupgrade via uboot-initramfs" route and got OpenWRT to boot.

Here's an overview on how I did it. DISCLAIMER: Portions of this may be bad practice or even outright wrong. I assume no responsibility for you bricking your hardware, or any other damages, by following this.

Prerequisites:

  • You will need a way to get to the serial console (I'm using an FT232RL. A PL3203 did not work and even died on me while trying.)
  • A PC set to 192.168.1.10. (You may be able to change the IP in uBoot, or even specify which one to use to download, but I preferred not to mess with it and instead reconfigured my PC.)
  • A TFTP server running on that PC (I'm using atftpd on a Linux machine, but you may be able to use tftpd64 on Windows or others)
  • The initramFS uBoot image, as well as Internet access to get the sysupgrade image (https://downloads.openwrt.org/releases/19.07.2/targets/ipq806x/generic/openwrt-19.07.2-ipq806x-generic-netgear_r7800-initramfs-uImage at the time of writing this). Place this image into the root directory of your TFTP server.

Procedure:

  1. Get to the serial console. Make sure your serial client (PuTTY in my case) is configured with 1152008N1, and set 'Flow Control' to None (if this is set to Xon/Xoff, you won't be able to type into your console.
  2. While booting, you should see a prompt that says: Hit any key to stop autoboot Do that and you should end up in uBoot, with a prompt that looks like this:
(IPQ) #
  1. You can type 'printenv' to get some information on the uBoot settings. Mine look like this:
(IPQ) # printenv
baudrate=115200
bootargs=console=ttyHSL1,115200n8
bootcmd=sleep 2;   nmrp;  if loadn_dniimg 0 0x1480000 0x44000000 && chk_dniimg 0x44000000; then bootipq2; else fw_recovery; fi
bootdelay=2
eth1addr=bc:a5:11:3e:6f:b8
ethact=eth0
ethaddr=bc:a5:11:3e:6f:b9
ipaddr=192.168.1.1
loadaddr=0x42000000
machid=136c
modelid=R7800
serverip=192.168.1.10
stderr=serial
stdin=serial
stdout=serial
updateloader=ipq_nand linux && nand erase 0x01180000 0x00080000 && imgaddr=0x42000000 && source $imgaddr:script

(note the "serverip" indicating which tftp server uBoot will use by default)

  1. Now download the initramfs image to RAM using this command:
tftpboot openwrt-19.07.2-ipq806x-generic-netgear_r7800-initramfs-uImage

(You may be able to do a "tftpboot 192.168.1.10:openwrt-19.07.2-ipq806x-generic-netgear_r7800-initramfs-uImage" here to specify the IP. I never tested it with anything other than the default.)

  1. Finally, boot that image with this command:
bootm

After a while, OpenWRT should come up and be available at the default IP (192.168.1.1). From there, you can then issue a sysupgrade (without keeping settings).

I did it manually via SSH:

  1. Configured default gateway and /etc/resolv.conf so that I had internet.
  2. Downloaded the sysupgrade image with wget:
    cd /tmp ; wget http://downloads.openwrt.org/releases/19.07.2/targets/ip q806x/generic/openwrt-19.07.2-ipq806x-generic-netgear_r7800-squashfs-sysupgrade. bin
  3. Launched the sysupgrade:
    sysupgrade -n openwrt-19.07.2-ipq806x-generic-netgear_r7800-squashfs-sysupgrade.bin
3 Likes