[OpenWrt-Devel] [PATCH] Unable to get any OpenWrt version working on Asus WL-300g

Ondrej Zary linux at rainbow-software.org
Wed Nov 2 10:14:35 EDT 2016

On Thursday 27 October 2016, Ondrej Zary wrote:
> Forced failsafe mode by building an image with modified
> /lib/preinit/30_failsafe_wait (added "FAILSAFE=true" line) and successfully
> sshd into the router.
> Problems I see:
> 1. The machine type is misidentified as WL500G so the overrides in
> /lib/preinit/05_init_interfaces_brcm and /etc/board.d/01_detect expecting
> "WL300G" do not work.
> [    0.000000] MIPS: machine is Asus WL500G

At least my AP does not have "productid" NVRAM variable so this needs a
kernel patch:

--- a/arch/mips/bcm47xx/board.c
+++ b/arch/mips/bcm47xx/board.c
@@ -51,6 +51,7 @@ struct bcm47xx_board_type_list1 bcm47xx_
 	{{BCM47XX_BOARD_ASUS_RTN12D1, "Asus RT-N12D1"}, "RTN12D1"},
 	{{BCM47XX_BOARD_ASUS_RTN12HP, "Asus RT-N12HP"}, "RTN12HP"},
 	{{BCM47XX_BOARD_ASUS_RTN16, "Asus RT-N16"}, "RT-N16-"},
+	{{BCM47XX_BOARD_ASUS_WL300G, "Asus WL300G"}, "WL300-"},
 	{{BCM47XX_BOARD_ASUS_WL320GE, "Asus WL320GE"}, "WL320G-"},
 	{{BCM47XX_BOARD_ASUS_WL330GE, "Asus WL330GE"}, "WL330GE-"},
 	{{BCM47XX_BOARD_ASUS_WL500GD, "Asus WL500GD"}, "WL500gd-"},

Also there's another bug that causes the misidentification:
(because my device has "boardnum" set to "asusX" too)
--- a/arch/mips/bcm47xx/board.c
+++ b/arch/mips/bcm47xx/board.c
@@ -238,7 +244,7 @@ static __init const struct bcm47xx_board
 	if (bcm47xx_nvram_getenv("hardware_version", buf1, sizeof(buf1)) >= 0 &&
 	    bcm47xx_nvram_getenv("boardnum", buf2, sizeof(buf2)) >= 0) {
 		for (e2 = bcm47xx_board_list_hw_version_num; e2->value1; e2++) {
-			if (!strstarts(buf1, e2->value1) &&
+			if (strstarts(buf1, e2->value1) &&
 			    !strcmp(buf2, e2->value2))
 				return &e2->board;

> 2. The overrides are probably wrong as there's no eth1 interface. If I
> change them to "WL500G" so they get activated, I don't get even the preinit
> UDP packets.

The lib/preinit/05_init_interfaces_brcm file is wrong, at least WL300G should
be deleted from there.
But the problem still persists. I can boot into failsafe mode (if forced in
/lib/preinit/30_failsafe_wait). But after rm /tmp/.failsafe, the ethernet link
goes down so I can't do any debugging.

Ondrej Zary
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list