Uboot & Firmware Update for GL-AR300M

Hello,

My GL-AR300M has a very old Firmware on the NOR flash (2.7) and the latest on the NAND side. However, sometime it is booting the NOR flash.
Now I wanted to update the NOR flash. To do this, I first tried to update uboot with the bin file uboot-gl-ar300m-20220216-md5-97ff7bb80cbf129fa21f34ded1559ff8.bin from github. Unfortunately, I tried this on the normal update page (http://192.168.1.1/).
Nevertheless, I can still reach the uboot update page, even the http://192.168.1.1/uboot.html page. However, I I now try to update with the above named file (downloaded as raw) I get the message: " UPDATE FAILED
Something went wrong during updateProbably you have chosen wrong file (too big or too small) or you were trying to update ART on device with unknown FLASH type (and size) which is not allowed. Please, try again or contact with the author of this modification. You can also get more information during update in U-Boot console."

Please, what can I do to update uboot and get the device running with latest firmware on each flash memory?

PS: Device can still boot up, at least on NAND flash.

May I know where the source codes of the AR300M uboot get/clone?

The GL offical github codes is 2020, 3 years ago.

Hi,
Thank you for your attention!
I got the link to uboot from here:
https://forum.gl-inet.com/t/where-to-get-firmware-for-gl-ar300m/33537/3
This page is linking to the same, no?
https://docs.gl-inet.com/router/en/4/faq/debrick/
Should I be using a different version? Which?

It seems, here someone had the sam issue, but I don't understand the solution:
https://forum.gl-inet.com/t/uboot-update-for-ar300m16/36856/2

Could I update uboot from the GL-Inet Openwrt via SSH for example? Is there a tutorial for this?

Hi,

Please let me know the full model.

  1. Please try to upgrade to this uboot in the 192.168.1.1/uboot.html of AR300 series:
    uboot-for-qca95xx/bin/uboot-gl-ar300m-20220216-md5-97ff7bb80cbf129fa21f34ded1559ff8.bin at master · gl-inet/uboot-for-qca95xx · GitHub
    Upgrading process do not lose power!

  2. The switch button in disabled is NAND in the default, even you have not upgrade the uboot, the older uboot does not support the switch button, and it supposed to NAND boot in the default.

Hello,
Thank you for your support!
I have the GL-AR300M-ext. A pretty old (or early) version. I used exactly the uboot file, you propose. I downloaded it as raw, several times - no change. I use a windows 11 PC. Used both ethernet ports (a USB and an internal one). I also reduced MTU. No change.
Any other ideas, please?

May try to login the ssh and enter the following instructions, note your uboot is not the latest version, probably it does not take effect, but just try. If not take effect, it also will not have any impact.

##Enable
fw_printenv
fw_setenv boot_dev on
reboot

##Reset to default
fw_printenv
fw_setenv boot_dev
reboot

By default, uboot boot-up the firmware of the NAND first, and if it fails, then it boot-up the NOR.

Hi Bruce,

thanks for the hint. I believe that NAND has preference. What I encounter is, that maybe 1 out of three times it boots from NOR, using V2.7 which is really annoying. Why it is behaving like this, I don't know. I don't observe any crashes or instabilities on either system.
I would really prefer to update uboot, if I knew how? TFTP Server would be no problem. Would I need UART access? If I manage to open the case, I can do this, too.
However, simply using the uboot menu would be great, it just won't let me ...

Would booting from NOR, flashing openwrt, booting again from NOR and updating to latest gl-inet firmware with luci be a painless option?
I read it on the forum.
Direct update from gl-inet firmware to later gl-inet version does not seem possible, too

I tried to flash old versions of uboot from the github link you gave me.
Up to five years old, since this was slightly smaller. However, so success. The webGUI of uboot keeps complaining.

There is a tool in OpenWrt that used to be shipped with GL iNet firmware called mtd but was missing in 4.7.8 firmware. It can write data to the partitions on the mtd device. Looking at my ar300m, here is the layout of my mtd device:

cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00400000 00020000 "kernel"
mtd1: 07c00000 00020000 "ubi"
mtd2: 00040000 00010000 "u-boot"
mtd3: 00010000 00010000 "u-boot-env"
mtd4: 00fa0000 00010000 "nor_firmware"
mtd5: 00010000 00010000 "art"

By putting the uboot.bin file into /tmp on the router, it should be possible to write the uboot.bin file to the mtd device using something like:

insmod mtd-rw.ko i_want_a_brick=1
mtd -r write /tmp/uboot.bin u-boot

The -r in the mtd command reboots the router after the command is run successfully.
You may need to install the kmod-mtd-rw package if it is missing.

That said, this command can permanently brick your device, so it would be nice if someone in GL iNet support can verify this procedure.

The mtd command is available in OpenWrt 23.05.2 for the ar300m (I have it running on a AR300M as a VPN server).

See:

Hi Eric,

thank you very much, this sounds really promising!
Let's hope, someone from GL.inet can confirm the feasibility of the procedure!

Regards, Reiner

Could please sombody from GL.inet confirm, that this is the way to go? Which Version of the GL.inet firmware should I use to have the mtd tool?

Let me tag @alzhao - maybe he knows about this.

Try to upgrade uboot via the mtd,

  1. upload the uboot.bin and mtd.ipk of the AR300M to the router /tmp/
  2. login the SSH, and careful to do this:
opkg update
opkg install /tmp/kmod-mtd-rw_5.10.176+git-20160214-2_mips_24kc.ipk
insmod mtd-rw.ko i_want_a_brick=1
mtd erase u-boot
mtd -r write /tmp/uboot-gl-ar300m-20220216-md5-97ff7bb80cbf129fa21f34ded1559ff8.bin u-boot

Thank you Bruce.
Where do I get the right mtd.ipk?
I want to make no mistake.

The link Bruce give is for AR300M router. Pls just download to your router.

Thanks. On my mobile phone I did not see that it is a link!

Installing kmod-mtd-rw (5.10.176+git-20160214-2) to root...
Configuring kmod-mtd-rw.
Updating database.
Database update completed.
root@GL-AR300M:/tmp# insmod mtd-rw.ko i_want_a_brick=1
root@GL-AR300M:/tmp# mtd erase u-boot
Unlocking u-boot ...
Erasing u-boot ...
root@GL-AR300M:/tmp# mtd -r write /tmp/uboot.bin u-boot
Unlocking u-boot ...

Writing from /tmp/uboot.bin to u-boot ...  [e]Failed to erase block

I renamed uboot to uboot.bin. I have not rebootet yet, as I am afraid I have no uboot anymore
How to proceed now, please?