How to flash uboot from the command line?

When resetting the device there’s an option to flash uboot via web interface but I’d like to be able to flash it from the command line, how can I do that?

on the bottom of this page, there is info about using command line.

One thing important, this is for GL.iNet6416 only!!!

For AR150, pls change the command to:

tftp 0x81000000 openwrt.bin
erase 0x9f050000 +0x7c0000
cp.b 0x81000000 0x9f050000 0x7c0000
reset

the 0x7c0000 is the size of your firmware, or it must be bigger than the size. You can use $filesize to replace this value, if you don’t see there is an error.

is it possible to do it when it’s not booted into console mode? I mean flashing uboot when the router is running normally. is there an ash command to do that?

Yes. It is using mtd tools.

https://wiki.openwrt.org/doc/techref/mtd

Not too much experience on this. But you can try it. uboot and art should be locked and it should be safe.