How do I flash GL-AR300-LITE?

Thanks to all, got through the procedure and it is working.

I do have one more request about this router. Since the procedure involved flashing to OEM and saving settings to snapshot, it means there is plenty OEM "dirt" still in the settings. Trying to clean up and be sure it is all gone is next to impossible for me as a layman.

Building my own firmware as jeff suggests, while I understand it is the cleanest way, is also next to impossible for me as layman.

Is there any way to not have to save the gl.inet settings, flash snapshot from uboot, and still get access to the router for luci installation? I read somewhere on the site about using ipv6, but have no clue how to or if it is possible.

Thanks.

Not for a "layperson".

This is an issue in OpenWrt firmware build system, that creates a wrong default configuration for that particular device. You can open a bug report for this device here https://bugs.openwrt.org/index.php?do=toplevel&project=2
Mention that it is "ath79" in the title (it is the device family name) as that will help categorize it.

I can try fixing it on OpenWrt build system and contributing the change to the project, so that future firmware of this device will work correctly.

I'm not a core developer but I added some devices to OpenWrt in the past. I know more or less how it works.

I see something that I think is wrong in the build system here https://github.com/openwrt/openwrt/blob/master/target/linux/ath79/base-files/etc/board.d/02_network#L22
This is the file setting the default LAN ethernet port for your device (and many others).
Your device is "gl-ar300m-lite", but you see there there is only "ar300m-lite" (which is wrong as there is no device called like that).
This means the default config would not set up eth0 interface (the ethernet interface) as LAN, because there is no "gl-ar300m-lite" in that list.
I think that if I write the correct name there it should set the right default configuration, and fix the issue.
(EDIT: Hmmm.... seems that the guy adding support for the gl-ar300-lite made this mistake, see how in other files he used the right device name. https://github.com/openwrt/openwrt/commit/fefa34def84561688e6af2feeec2dbb390ba4486
)

Can you connect on ssh to your device and post here the result of
uci show network.lan.ifname
and
uci show network.wan.ifname

and also tell if the ethernet port is working in LAN or in WAN when you gathered the information?

It would confirm the interface name of your device's ethernet port.

If you want me to try this, tomorrow I will upload a firmware image you will test on your device, as I cannot test it.

If you confirm that the ethernet port is still working properly after you do a "factory reset" from Luci in the OpenWrt firmware (this erases everything and restores default configuration from read only partition), I will contribute it to the OpenWrt project.

Note that contributions to OpenWrt project wait for months before someone looks and approves them (if they like them), so you will have to wait for a while before you can use a clean firmware without having to keep some of the old GL Inet config like you are doing now.

1 Like

uci show network.lan.ifname
uci: Entry not found

uci show network.wan.ifname
network.wan.ifname='eth1'

and also tell if the ethernet port is working in LAN or in WAN when you gathered the information?
ethernet in WAN

It would confirm the interface name of your device's ethernet port.
I noticed in the LUCI settings inherited from gl.inet or from snapshot there are 2 internet interfaces in LAN: eth0 and eth1. I removed them from LAN and added eth1 to WAN. It worked so I didn't search further what eth0 is about.

I'm "the guy" and I apologize for the trouble that my error has caused you.

Are you taking over the troubleshooting and sending a PR to fix the issue? I don't have a device so I can't test, I would be very slow.

1 Like

Huh? This is open source where everyone tries to move things forward on their own level, no? Trouble yes, but learning plenty and moving forward thanks to you, mk24 and particularly bobafetthotmail. Not saying it wouldn't be very nice to have a working openwrt for this device :wink:
Hope to get there with the help of all of you here.
Next steps please?

1 Like

Not understanding much on that page, but I do see eth0 mentioned while on my device eth1 is used. Way over my head this stuff.

Next steps anyone, please?

Yeah it's strange. That device should have only 1 ethernet interface, not 2.

Can you try using eth0 instead of eth1 in the WAN? Please make sure your wifi is active. If you are changing the ethernet interface and it does not work, then you can't access it anymore through the cable.

If only eth1 works then we can set that as default LAN in the config, while also fixing the device name in the list.

Yes, getting a new builder running right now. I think I have the patch done, need to confirm the problem and then its resolution.

Edit: This is for the ath79 target, not the ar71xx target

Edit: Stranger than I thought -- I'm not seeing the pre-init packet now, will be a bit to diagnose.

The device exposes two Ethernet interfaces. However, only eth0 is connected to a physical port. On the build I happen to have on the device:

root@OpenWrt:~# cat /etc/config/network 

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd8d:36a6:670d::/48'

config interface 'lan'
	option type 'bridge'
	option ifname 'eth0'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

config interface 'wan'
	option ifname 'eth1'
	option proto 'dhcp'

config interface 'wan6'
	option ifname 'eth1'
	option proto 'dhcpv6'

root@OpenWrt:~# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br-lan state UP qlen 1000
    link/ether e4:95:6e:aa:aa:ac brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP qlen 1000
    link/ether e4:95:6e:aa:aa:ad brd ff:ff:ff:ff:ff:ff
4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether e4:95:6e:aa:aa:ac brd ff:ff:ff:ff:ff:ff
5: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether e4:95:6e:aa:aa:ac brd ff:ff:ff:ff:ff:ff

In my case eth1 only works as wan, but that may be due to:
keeping gl.inet settings (eth0=lan and eth1=wan perhaps?)
manually setting network after snapshot flash to install luci
or some other messing I did without realising.
In my case eth0 as wan does not work (no internet).

EDIT:
I have a choice of 10 interfaces to choose from as WAN in luci ...
of which 4 alias 2 wireless 2 ethernet and 2 bridge ... gl.inet stuff i guess

The chip is designed for regular home routers, so it has an eth1 port and a 4 port switch connected to eth1. But in the interest of making the AR300M-Lite small and cheap, those ports aren't wired to anything. The pins dead-end under the chip, and eth1 will never be able to connect to the real world. The kernel doesn't know that though.

1 Like

Well, I've got a puzzle on my hands. The build that happened to be resident on the device was using eth0. "Properly" selecting eth0 in 02_network for a new build resulted in no connectivity. Now I poked the source to select eth1 and it created

root@OpenWrt:~# cat /etc/config/network 

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd95:8434:2bc1::/48'

config interface 'lan'
	option type 'bridge'
	option ifname 'eth1'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

which is working.

I've got vague memories of work on master that swapped eth0 and eth1 (or responded to a swap elsewhere), so I'll have to dig into that before I'm confident that this is the "right" approach.

Edit: Perhaps related to https://github.com/openwrt/openwrt/pull/2066

Technically speaking, it's the reverse. By looking at the device tree files (see below) It's eth0 that is connected to a switch. And if in this device the switch is not connected, then it's eth0 that becomes a ghost.

That said, here the kernel thinks this device has 2 ports because its device tree file defines them both. It does so in a roundabout way, but it does.

The dts of this device https://github.com/openwrt/openwrt/blob/master/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts is just changing some led addresses, and it is otherwise importing whole the gl-ar300m-nor device dts file, https://github.com/openwrt/openwrt/blob/master/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-nor.dts which is again just renaming and importing the gl-ar300m file https://github.com/openwrt/openwrt/blob/master/target/linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi that is importing the generic SoC's dts file which defines 2 ethernet ports and overrides some settings about them.
Yes device trees are very cool but can get confusing as they keep importing and overriding each other many times.

Since both jeff and star agree that it's eth1 the "right" one, and also your "the port connected to the switch is not used in this device" statement, I think the real solution here is disable eth0 in the dts and then if needed "rename" eth1 into eth0, again in the dts, so for the Linux kernel everything will be ok.

@jeff Try adding this at the end of the gl-ar300m-lite.dts
This should disable the unused eth0 port and leave only the eth1 port enabled.
I also add the property to not increment the mac address of eth1 as that's the primary interface and eth0 is not enabled (this is overriding properties set by the gl-ar300m.dtsi that has 2 ports, and the "primary" port is eth0)

&eth0 {
	status = "disabled";
};

&eth1 {
	mtd-mac-address-increment = <0>;
};

The "&eth0" and "&eth1" you see in the dts are labels (see device tree specification https://github.com/devicetree-org/devicetree-specification/blob/master/source/source-language.rst#labels ).

The actual full interface name and label declaration is in the generic ath79.dtsi which is imported by the SoC dtsi. https://github.com/openwrt/openwrt/blob/master/target/linux/ath79/dts/ath79.dtsi#L66
eth1: eth@1a000000, where defines that this interface will be called "eth1" in the rest of the dts files importing this one.

Theoretically the kernel should not care about labels and should just call "eth0" the first ethernet interface it sees (and here we should have only one enabled) but I can't guarantee that here.

Try the above and if you still get an eth1 interface (now without an eth0) you can try using aliases or changing the label so you rename the interface.

This is an example to give an alias as "eth0" to the full interface name of what is called "eth1" in the dts.

	aliases {
		eth0 = "eth@1a000000";
};

For the sake of completeness, this is the specification about aliases https://github.com/devicetree-org/devicetree-specification/blob/master/source/devicenodes.rst#aliases-node

1 Like

Thanks for the insight. I'm doing a [A] build just prior to that set of changes to confirm[s] that it was "working as expected" and that I'm not chasing ghosts. OpenWrt SNAPSHOT, r10127-3209f5ae3d

I'll check the MAC addresses on the labels of the GL-AR300M and GL-AR300M-Lite and figure out what makes sense, especially in light of the label-mac-device alias that's been bouncing around on Patchwork and Github (and looks like has been or is in the way to be merged). My guess is that there is some strangeness with the GL-AR300M and port swap as well.

@star -- Yes, for current master snapshots, eth1 appears to be the interface to use. What next? After thanks to you and the others here for uncovering the unexpected change, I've got some digging and testing to do. Enjoy your GL-AR300M-Lite. They're great little devices.

All excited for when all this work translates in a snapshot (or full release) flashable from uboot. Thanks for caring for this great little device, pity gl.inet "enhances" openwrt with a load of stuff not needed, and does it without contributing to having real openwrt work on its devices... They take and don't give back, sort of.

Device has been around for a while, so why don't they have a vanilla openwrt for this one? Thei built their custom openwrt firmware, so they know what is needed for vanilla openwrt I guess?

Actually, they contribute quite a bit, and their repos around general OpenWrt code are public. Their firmware is basically 18.06 right now, with their own value-add, travel-router features. It's good enough that I run it on the GL-AR750S I travel with.

Added:

They’re waiting on 19.07 for their next major firmware release. It’s already on their git repo, though not in builds yet. Their firmware is pretty much “vanilla” OpenWrt 18.06 with an additional UI (LuCI is there in the Advanced section) and their selection of packages pre-installed, some excellent ones of their own authorship. There are some things like SPI-NAND drivers they they have, but that’s a very long story as to why they’re not in OpenWrt yet that involves Linux itself.

Quite frankly I think you are overreacting a little here, they add value to their devices.
They offered easy openVPN, shadowsocks (another light proxy/vpn thing, most used in asia/china), and Wireguard and encrypted DNS from Cloudflare setup integration in their own web interface ages before OpenWrt does (currently you can do some of these only with master snapshot, not even next release the 19.07 will have that), and even now it is more convenient.
Their web interface can also set up the actions for the hardware buttons and selectors/switches so you can enable/disable VPN or enable/disable wifi with a hardware button.

Their support team also answered me about hardware details to do hardware mods to some of their (older) devices (like what components to desolder and what pins to connect).

GL Inet is the most OpenWrt-friendly manufacturer and I also tend to like them.

1 Like

I hear the positive vibe about gl.inet and I would tend to go with that.
But then why add home phoning (to gl.inet) to the devices, and close source some of their code? Openwrt is there for anyone to see, audit, etc.
gl.inet some of it not, reason why I long for vanilla openwrt.
But going off-topic here, hoping Jeff can help get things corrected for the snapshot eth issue. How will one know when there is a snapshot that works?

Their supplying an optional cloud service and supplying additional packages that manage things like repeaters and VPN quite well are part of a value-add that is visible to consumers. That value-add "pays for" the high level of engineering design and associated cost in the units (take a look at the custom heatsink in the GL-AR750S as an example), quality control of fabrication (they were bringing up their own SMD line this year), and support, among other things. Otherwise, go ahead, buy a ChinaInc WyFy 1200 and have at it.

I'm not sure what you think is a "phone home" in their firmware. Afaik there is no "tracking" or "data collection" service in GL Inet devices. Their source of income is hardware sales, not data collection.