Uboot & Firmware Update for GL-AR300M

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: