Support for RTL838x based managed switches

Is there someone who can delive me the Zyxel GS1900-10HP image 21.02rc4 with the poe package build in?

regards Richard

I suggest using https://openwrt.org/docs/guide-developer/using_the_sdk to build the package for 21.02rc4.

IMHO it's very unfortunate that this feature is missing in 21.02. I've been planning to look at it and see if there is anything I can do to make the code match the requested design, but realistically that won't happen.... So let's hope someone does it.

Hi,

I installed the required packages on my debian 11 bullseye.

I took the https://downloads.openwrt.org/snapshots/targets/realtek/generic/openwrt-sdk-realtek-generic_gcc-10.3.0_musl.Linux-x86_64.tar.xz and extract it.

Now how do I submit the patch? And after patching it, just run make? in the root of the extracted sdk?

regards Richard

Hi everyone,

I've been searching for some larger (24/48 port) 10Gb capable switches and I just got a GPL drop for the XGS1930-28 (u-boot only unfortunately). How would one go about adding this to https://biot.com/switches/gpl_source_drops?

GPL sources: https://dxld.at/upload/D56euKalO2vgaxcYa5BT7Y0OEq46KoFq/XGS1930_28_uboot-20210819T102710Z-001.zip

I also have a request for the TL-SG3428X in flight still. Here's to hoping these are actually RTLxxx based since I figured I'll request the source and worry about that later >;)

That should work fine since the patch just creates a completely new package. Assuming you have patch saved as /tmp/realtek-poe.patch, you can cd into the SDK root dir and run

patch --p1 </tmp/realtek-poe.patch,
make

and you'll be presented with a menu configuration. You don't need to do anything there. The realtek-poe package will already be selected. You can find it under "Network". Just exit the menu, saving the config to .config, and the make process will continue building the package.

But... I just tried that now since I don't like to give advice I haven't tested. And it failed.... But that's another great opportunity to learn more :slight_smile:

I got

 make[1] world
 make[2] package/compile
 make[3] -C package/kernel/linux clean-build
 make[3] -C package/kernel/linux compile
 make[3] -C package/toolchain clean-build
 make[3] -C package/toolchain compile
 make[3] -C package/network/config/realtek-poe clean-build
 make[3] -C package/network/config/realtek-poe compile
    ERROR: package/network/config/realtek-poe failed to build.
make -r world: build failed. Please re-run make with -j1 V=s or V=sc for a higher verbosity level to see what's going on
make: *** [/tmp/openwrt-sdk-21.02.0-rc4-realtek-generic_gcc-8.4.0_musl.Linux-x86_64/include/toplevel.mk:223: world] Error 1

So then I do that: run make -j1 V=s, which produces lots of verbose output showing the problem near the end:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
ubox
    linked by target "realtek-poe" in directory /tmp/openwrt-sdk-21.02.0-rc4-realtek-generic_gcc-8.4.0_musl.Linux-x86_64/build_dir/target-mips_4kec_musl/realtek-poe
ubox_include_dir
   used as include directory in directory /tmp/openwrt-sdk-21.02.0-rc4-realtek-generic_gcc-8.4.0_musl.Linux-x86_64/build_dir/target-mips_4kec_musl/realtek-poe

Which looks like it doesn't find the required include files for linking with ubox. And similar for the uci and ubus dependencies. So now I realize that I have no idea how this is intended to work. Sorry. Anyone knowing how dependencies on these system libraries are supposed to be handled in the SDK?

Sorry about sending you on this path without knowing that it would work. I though it should be an easy way to add a package. But right now it looks easier to build from scratch. It will just take some more time to finish.

ok, I try to find the patch, I only found a diff.

realtek-poe-add-support-for-PoE-on-Realtek-switches.diff

that I can't patch

/Downloads/openwrt-sdk-realtek-generic_gcc-10.3.0_musl.Linux-x86_64$ patch --p1 <realtek-poe-add-support-for-PoE-on-Realtek-switches.diff 
patch: unrecognized option '--p1'
patch: Try 'patch --help' for more information.

Ouch, another error on my side. The --p1 is a typo. Should be -p1. Meaming: Strip the first directory component of the filename in the patch (which usually is a placeholder "b", diffed against "a").

Good news: It just occurred to me what I was missing - you need to pull from the feeds in the SDK too, just like in a normal build. So something like this works (importing only a limited number of standard packages - feel free to build more):

scripts/feeds update base
scripts/feeds install -p base libubox libubus libuci
patch -p1 </tmp/realtek-poe.patch,
make

It still ended with an error for me, failing to find some key required for signing the packages index:

Cannot open file '/tmp/openwrt-sdk-21.02.0-rc4-realtek-generic_gcc-8.4.0_musl.Linux-x86_64/key-build' for reading

I'm sure that's easily fixable. Or I did something wrong. But it doesn't matter. The package you want is built in bin/packages/mips_4kec/base/realtek-poe_1_mips_4kec.ipk. Just scp it to the target and install directly with opkg /tmp/realtek-poe_1_mips_4kec.ipk

The patching works, and getting the same errors you have, but the package is there, thnx for that.

I copied it to the router and installed it, got 2 errors, see below.

How can I enable the ports for poe? I also don't get reports of the poe ports enable of disabled, see below)

root@GS1900-10HP:/tmp# opkg install realtek-poe_1_mips_4kec.ipk 
Installing realtek-poe (1) to root...
Configuring realtek-poe.
//usr/lib/opkg/info/realtek-poe.postinst: line 284: /etc/init.d/poe.rej: Permission denied
//usr/lib/opkg/info/realtek-poe.postinst: line 286: /etc/init.d/poe.rej: Permission denied
root@GS1900-10HP:/tmp# ubus call poe info
{
	"firmware": "v22.4",
	"mcu": "ST Micro ST32F100 Microcontroller",
	"budget": 65.000000,
	"consumption": 0.000000,
	"ports": {
		
	}
}

This is a reject file from patch. It shouldn't have been included in the package. Not sure why it was created. Did you patch several times without deleting package/network/config/realtek-poe/ ? That wil probably mess up things somewhat.

You'll need to create a /etc/config/poe similar to this:

config global
        option budget   '77'

config port
        option enable   '1'
        option id       '1'
        option name     'lan1'
        option poe_plus '1'

config port
        option enable   '1'
        option id       '2'
        option name     'lan2'
        option poe_plus '1'

config port
        option enable   '1'
        option id       '3'
        option name     'lan3'
        option poe_plus '1'

config port
        option enable   '1'
        option id       '4'
        option name     'lan4'
        option poe_plus '1'

config port
        option enable   '1'
        option id       '5'
        option name     'lan5'
        option poe_plus '1'

config port
        option enable   '1'
        option id       '6'
        option name     'lan6'
        option poe_plus '1'

config port
        option enable   '1'
        option id       '7'
        option name     'lan7'
        option poe_plus '1'

config port
        option enable   '1'
        option id       '8'
        option name     'lan8'
        option poe_plus '1'
1 Like

Yes I did run the patch twice, and than it mess up. I did everything again, and now it works fine, yj first accesspoint with 3 tagged vlans and 1 native vlan, it works. Is the RTL838x with openwrt already stable to run 24/7?

root@GS1900-10HP:~# ubus call poe info


{
	"firmware": "v22.4",
	"mcu": "ST Micro ST32F100 Microcontroller",
	"budget": 77.000000,
	"consumption": 4.200000,
	"ports": {
		"lan1": {
			"priority": 0,
			"mode": "PoE+",
			"status": "Delivering power",
			"consumption": 4.300000
		},
		"lan2": {
			"priority": 0,
			"mode": "PoE+",
			"status": "Searching"
		},

Sure. Been running it in "production" since beginning of January. Haven't had a problem I didn't create myself :slight_smile:

I used it with OEM firmware a couple of months before that, and it was less stable in my experiennce.Not unacceptable - I could have lived with it if I had to. But luckily I don't.

2 Likes

What were the problems? The GS1900-16 seems stable on stock firmware, but I don't really fiddle with it and only use basic VLAN settings, just reboot after config changes and it seems fine. I haven't run into unstable switches, even cheap crappy "managed" switches.

Minor issues. At least one unexpected reboot, but not so frequent that it bothered me. Might have been just once. Don't remember exactly.

The real show stopper for me was that I had to help the fibre link up after every boot, including the unexpected one. It would come up if I toggled the link from the other side so I didn't need local access to fix it. But still annoying in my book. I assume this issue might be related to my somewhat unique environment, using a dual-rate SR/SX SFP+ in the other end of that link. Which probably means that the SX SFP in the GS1900-10HP has to transmit something before we have proper clock syncing.

But note that I am using exactly the same hardware with OpenWrt, and the fibre link comes up just fine every time.

2 Likes

OKk, the old zyxel 1900-8HP was running already 178 days with the stock firmware , zo now I swtiched to the 1900-10HP with openwrt, and I got try it. I have 4 Aruba AP's in cluster on it with 50 concurrent clients (much Iot).
Lets hope that it will be as stable as the stock firmware.

Hey guys,

I want to make the default network configuration to be just all LAN ports and for the switch to obtain an IP via DHCP.

Is the following patch correct / sufficient?

diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network
index 6568017..b84c985 100644
--- a/target/linux/realtek/base-files/etc/board.d/02_network
+++ b/target/linux/realtek/base-files/etc/board.d/02_network
@@ -22,8 +22,7 @@ for lan in /sys/class/net/lan*; do
 	lan_list="$lan_list $(basename $lan)"
 done
 ucidef_set_bridge_device switch
-ucidef_set_interface_wan "$lan_list"
-ucidef_set_interface "lan" device "lan1:t" protocol "static" vlan 100
+ucidef_set_interface_lan "$lan_list" dhcp
 
 lan_mac=""
 wan_mac=""

I have no previous experience with OpenWrt, so it would be better if someone could confirm that I'm doing this right (which I very easily might not be) before I actually use the patch.

Edit: I found Support for RTL838x based managed switches - #369 by bmork

Do you really need/want the switch (brand/series/ports?) to behave just after OpenWrt flash (or factory reset from OpenWrt) with your prefered DHCP client on LAN setting?

Or is it possible to login via WebGUI/SSH with a default OpenWrt image (if available for your switch) and login on 192.168.1.1 and disable DHCP server on LAN and set LAN to aquire ip address as a DHCP client?

If you have no previous experience with OpenWrt I suggest to first setup the switch with a default image via ssh&uci to figure out the right commands to make the LAN interface behave as you wish so disable DHCP server and change the interface ip from static to DHCP client.

If all is well than manually compile your own image and make sure you have serial/TTY access to the bootloader in case you cannot access the switch via ethernet anymore.

EDIT just noticed you PR for ZyXEL GS1900-24HPv2:

Hey all. I have a question about Poe timing, can using openwrt allow me to activate Poe earlier in the boot process? I would like to get a couple of the devices connected to my switch up and running more quickly (as I often power on and off the whole system). It seems as though openwrt boots substantially quicker than stock fw, does anyone know how quickly Poe activates after boot?

Hey all,

I added support for the ZyXEL GS1900-24HPv2 (ABTP).
I submitted a PR.
I also created a Wikidev page, with some photos of the internals.
(Someone with access to biot.com could add this model there as well?)

There are a number of internal and external changes compared to the v1.
All the port LEDs were moved to the connectors themselves. The SFP LEDs moved to between the 2 SFP ports. There are 2 buttons on the front panel, one labeled RESET, the other one RESTORE. The Zyxel logo on the front panel was updated to the newer, all-caps style logo.
The PCBs are quite a bit different as well. The v2 has an UART header that is populated, and on the edge of the board. The casing has a cutout that allows easy access, without the need to disassemble, much like on the GS1900-10HP. The PoE microcontroller is a Nuvoton NUC029 (STM 32F100 on the v1), and the PSEs are 3 x BCM59011 (6 x BCM59111 on the v1). The v2 also has 128MB of DDR3 RAM (64MB, DDR2 on the v1).
Probably because of all of these differences, contrary to the GS1900-8HP, the GS1900-24HP's revisions actually have different firmware (ABTP vs AAHM), and on ZyXEL's website they are shown as separate models.

I have a branch with a couple more patches for this model:

(My commits in this branch)

It includes a couple patches from @bmork to make images uploadable via the OEM interface, and to change the default network configuration (gets rid of the VLAN 100 thing, all ports are LAN now, the switch obtains an IP via DHCP).
The branch also includes @blogic's realtek-poe package, but with a number of modifications to make it work with 24 ports.

@walterav Although the internals seem to differ quite a bit from your v1, I think my patches for the v2 should all work on the v1 as well. You just need to copy my modifications, change the ZYXEL_VERS variable to AAHM, and make sure that you set the RAM size to 64MB in the v1's device tree, as the v2 has 128MB. (you just need to revert this commit. I initially set up the v2 with 64MB based on your posts about the v1, and only later realized from looking up the RAM and from U-Boot output that it has 128)

5 Likes

I've looked at your commit and if I get time I may use it as a base for adding support for the GS1900-24 v1, GS1900-24HP v1 and GS1900-24E I have after I finish testing support for the GS1900-16. I bought my GS1900-24 v1 new from Amazon recently and was surprised that it had only 64MB RAM!

4 Likes

Yes, the gs1900-24 with one winbond W9751G8KB-25 module is certainly the odd one out, quite surprising, considering that the gs1900-24e without SFP slots comes with 128 MB RAM.