Fail to install OpenWrt into NEC Aterm WG2600HP3

Something seems wrong with the environment bootcmd. It loaded a kernel out of flash but did not boot it.
If at this point you execute bootm 0x42208000, will it boot?

I'm not that familiar with bootcmds though executing help bootcmd may have some help.

bootm 0x42208000 won't boot into normal.
bootm 0x44000000 will boot into normal. But if I press the power button to reboot again, it boots back to U-Boot mode again, of course.

That sounds like you need to look in the printenv for the bootcmd variable, check, which Offset (0x42208000 vs. 0x44000000) is used there, and correct it, if necessary,

Show your current printenv, if you cannot set the variable yourself to a working value.

After running sysupgrade, below is the log of console:

......
Writing from <stdin> to firmware ...
Appending jffs2 data from /tmp/sysupgrade.tgz to firmware..
.File /tmp/sysupgrade.tgz does not exist
Wed Feb 16 20:32:53 UTC 2022 upgrade: Upgrade completed
Wed Feb 16 20:32:54 UTC 2022 upgrade: Rebooting system...
umount: can't unmount /dev: Resource busy
umount: can't unmount /tmp: Resource busy
[  234.073292] reboot: Restarting system


U-Boot 2012.07 [Standard IPQ806X.LN,local] (Jul 24 2018 - 10:51:56)

smem ram ptable found: ver: 0 len: 5
DRAM:  491 MiB
NAND:  SF: Detected S25FL256S with page size 64 KiB, total 32 MiB
ipq_spi: page_size: 0x100, sector_size: 0x10000, size: 0x2000000
32 MiB
MMC:
PCI0 Link Intialized
PCI1 Link Intialized
In:    serial
Out:   serial
Err:   serial
PRODUCTDATA CRC Verify OK.
Net:   MAC1 addr:xx:xx:xx:xx:xx:xx
athrs17_reg_init: complete
athrs17_vlan_config ...done
S17c init  done
MAC2 addr:yy:yy:yy:yy:yy:yy
eth0, eth1
post start
SF: Detected S25FL256S with page size 64 KiB, total 32 MiB
DRAM Test ..... PASS
Timer test .... PASS
FLASH CHKSUM .. PASS
LAN Test ......
LoopBack count 0 ..
PASS
Package TYPE = 0x01
post success
now booting auto ...

Loading from nand1, offset 0x860000
   Image Name:   ARM OpenWrt Linux-5.4.179
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2751434 Bytes = 2.6 MiB
   Load Address: 42208000
   Entry Point:  42208000
boot> 

Then running printenv,

boot> printenv
baudrate=115200
bootargs=console=ttyHSL1,115200n8
bootcmd=nboot 0x44000000 1 0x860000
bootdelay=2
eth1addr=yy:yy:yy:yy:yy:yy
ethact=eth1
ethaddr=xx:xx:xx:xx:xx:xx
ethrotate=no
ipaddr=192.168.1.1
machid=12ca
serverip=192.168.1.2
stderr=serial
stdin=serial
stdout=serial

Environment size: 298/65532 bytes
boot>

On NOR flash the bootcmd would point directly at the kernel in flash-- bootm 0x00860000. Try running that manually. The developer's notes say it is NOR flash.

I'm not sure what nboot does. Is there anything from help nboot?

Sorry, I need instruction in detail. Do you want me to modify the offset in somewhere? If just runninf bootm 0x00860000, I think it won't really make modification and solve the problem.

So, currently, what you have in stored in flash boots successfully, when running bootm 0x00860000 ?

You could try setting bootcmd variable to that command. Or append that command to the existing bootcmd by separating with a ';'

No, bootm 0x00860000 doesn't even boot, but cause error:

Wrong Image Format for bootm command
ERROR: can't get kernel image!

Just bootm 0x44000000 can boot into normal.

With reference to your idea, I set bootcmd like this:
# setenv bootcmd "nboot 0x44000000 1 0x860000;bootm 0x44000000"

I don't really understand the theory and reason, but it works!
Not sure if it will cause stability problem in future.

I read the command like "Load from 0x860000 of Flash into 0x44000000 RAM. Then please execute that."

There is probably a command, that can do the above in one step.

As long as the 0x860000 corresponds to the partition the sysupgrade writes to when upgrading, you should be fine.

Thanks all for your help. Here I summarize a complete procedure, so it may help others in future.

< Open Router's case >
You may need this kind of tools:
Tools

< Prepare Console by USB2TTL >
USB-TTL Adapter

  1. Connect wire between router and adapter as: GND <-> GND, but Tx <-> Rx and Rx <-> Tx.
  2. Power-On the router
  3. In this moment, the light of PWR is ON, and light of TXD & RXD is off since there isn't communication.
  4. Connect Adapter's USB port to my computer.
  5. Goto Windows' Device Manager. An additional COM port (mine is COM5) should be added!!
    If not, please install the additional and newest driver.
  6. Configure Putty as indication:
    Serial line: COM5
    Speed: 115200
    Connection Type: Serial
    Saved Sessions: "USB2TTL" (e.g.)
    OPEN !!
  7. Console should now show the operation of Router, if there is any action (e.g. reboot).

< Prepare Connections >

  1. Disconnect all wired and wireless connection from my PC to old & operating router.
  2. Manually set my PC to static IP as 192.168.1.2 / 255.255.255.0, with Gateway 192.168.1.1
  3. I can double check it by command: # ipconfig
  4. Turn off or Allow UDP 69 port in Firewall (both 3rd party & Windows's) of my PC.
  5. Connect my PC's LAN port (don't via USB2LAN adapter) to one of the LAN ports on new router by ethernet.

< Prepare TFTP Server >

  1. Put initramfs image (renamed to "wg2600hp3-initramfs-uImage") into TFTP server directory (For SolarWinds TFTP, it is C:\TFTP-Root)
  2. Configure SolarWinds TFTP Server on my PC as the same IP as my PC (e.g. 192.168.1.2, or simply set it to Universal Default), to reduce unnecessary problem. (NOT the default IP of router 192.168.10.1)
  3. Stop and Re-start SolarWinds TFTP Server.

< Virtually FLASH OpenWrt >

  1. Make the Console (Putty) in Active, for input via keyboard in below step.
  2. Keep connecting the USB & LAN ports between the new router and PC.
  3. Power Off and On the router
  4. Interrupt the boot process of Console by pressing and holding "ESC" key (password: chiron)
  5. Entered U-Boot mode (boot>), Execute the following commands via Console:
    # setenv bootcmd "nboot 0x44000000 1 0x860000"
    # saveenv
    # setenv ipaddr 192.168.1.1 (DEFAULT value for new router)
    # setenv serverip 192.168.1.2   (TFTP Server. NOT router's default IP)
    # tftpboot 0x44000000 wg2600hp3-initramfs-uImage (Copy image)
    # bootm  OR   bootm 0x44000000 (Booting image)
  1. Browser: 192.168.1.1 (Default root password is blank)
  2. Backup SPI-NOR flash memory: Do it via Luci GUI, OR by commandline ...

< Really FLASH OpenWrt >

  1. Rename C:\Users[User].ssh\known_hosts to known_hosts.old [if any]
  2. Open 1st command prompt:
    # ssh root@192.168.1.1
  3. Open 2nd command prompt:
    # scp wg2600hp3-squashfs-sysupgrade.bin root@192.168.1.1:/tmp
  4. Open 1st command prompt:
    Do sysupgrade via Luci GUI, OR by ...
    # sysupgrade -v /tmp/wg2600hp3-squashfs-sysupgrade.bin

< Adjust Boot Point >

  1. If successful, router will boot into normal mode, and I can browse 192.168.1.1
    If failure and boot back to U-Boot mode, then:
	# setenv bootcmd "nboot 0x44000000 1 0x860000;bootm 0x44000000"   
	# saveenv
  1. Press button to reboot, and router should work properly!

< Restore PC Setting >

  1. UNDO this previous step: "Manually set my PC to static IP as 192.168.1.2"
1 Like