Support for RTL838x based managed switches

hi @anon13997276
Thank you for your work
i realy look for this in hope to replace some crapy factory FW which does not allow to disable Vlan1 on ports, or to make MGMN interface on another Vlan...etc
Before i start to experiment with your releases, i like to ask, what is the status of DSA?
I see on your picture that you using kernel v5.x so i assume it is new DSA approach


Yes, the network driver uses DSA with the features provided in the 5.x kernels and thus is based on switchdev for switch handling. It does not support the swconfig interface. You will need to use the brctrl, bridge, tc and ip command line utilities to configure the interfaces, vlans and mirroring. The code has seen very little testing in this area, so "experimenting" with it is the right thing to do.

1 Like

Hopefully not a totally dweeb question.
Reading through this - - - - - am I understanding correctly that I could run a L3 level managed switch using OpenWRT?

(Corollary question - - - - is all the other software there so this is like a complete managed switch software package?)

That isn't a dweeb question at all, but a very good one! The answer is: in principle yes.

The RTL838x and 839x based switches are marketed as L2+ switches and have some L3 routing functionality, the 9x based ones a bit more than the 8x ones (whatever L3 VPN MPLS is, while the 8x can do PTP in hardware it seems). But: Even the L2 kernel code hasn't seen any serious testing and the L3 kernel code hasn't been started. On the plus side: there is sufficient documentation in GPL dumps to get this done. Finally, there is also the issue with userspace tools, namely there's no fancy GUI.

So this is the time to give the code a good shakedown. There's a bunch of very determined people who would like to get all the features supported and push this up into Linux mainline.


This is wonderful news!!!!!!!!!!!!!!!!!
I have been looking at a number of purportedly Open Source switch environments and the fees for any that I've looked at are, in my books at least, serious money. My hope was/is to run software where I'm not locked out from my information and/or work by the choices of others.

Wondering - - - - does this work mean that there is going to be say two branches of OpenWRT - - - - one for routers and one for switches - - - - or is the hope that OpenWRT is going to be at the switch and then there is no need for a router or something else (my knowledge base in networking is severely limited so the last is all too likely!!).

Thank you for your response!

Kudos to the crew!!!!!!!!!!!!!!!!!!!!!

Ive got a t1500G-8T im willing to help and try to get support for, ive desoldered and dumped the flash and have a bin file if thats helpful. Could i try flashing the ALLNET ALL-SG8208M firmware image since i see thats supported?
This seems to be an older version of SG2008 but very similar hardware.

This seems to be a dual firmware device?

It looks indeed like an rtl838x based board based on the GPL source.
But please don't just flash the allnet image, it might brick the device.
You will need to open the device and identify a serial connection header. That's usually 4 pads or pins. Normally the square pin is 3.3V on these devices, GND is the opposite pin. Then you need to connect the board to your pc with a usb-uart cable. Using a terminal program you can interrupt the boot process and then safely run an image from a ram-disk without any risk to brick your device.

1 Like

Thanks for the help! Sadly the serial port seems completely silent. Im not too worried about bricking it since i can always rewrite the flash with the backup and spi programmer i have. I have a bin image of the raw flash chip, is that any help to you?

This being a TP-Link device, it wouldn't surprise me if they left out some components to disable the UART pins. Maybe check if the pins from the header actually lead to the UART pins on the SoC (pins 124 and 125)

1 Like

You are absolutely right!. a quick continuity test between the header and all pins on the SoC gave no beeps, unless they use some high value series resistor i would have expected a beep from my multimeter. I have found the pins, and i see data there but its garbage, any idea on the baud? Ill try to solder on some tiny wires so i can talk to this thing. Thank you!

Only settings I've seen from other switches is 115200 baud, 8n1.

I thought so too. Im only seeing garbage data with every baud ive tried, im pretty sure ive got the right pins. Maybe this data has to do with that POE managment mcu that was mentioned that other switches had? (this one does not have poe)

grepping in the flash image for rtl gives


This is a standard rtl838x board.

Are you sure about the pins? On the pinout of the RTL8380 the uart pins are not close to the crystal pins. And on you photo the cryptal seems to be connected to where r100 is.
I would say the pins are on the lower left side of the chip in your photo.

I think you've connected to one of the SGMII ports.

Like @anon13997276 noted, you'll need to connect to two pins in the bottom left of your picture (rightmost is pin 109)


1 Like

Totally right! I was looking at it sideways. Well guys i have this now:

                *         TP-LINK  BOOTUTIL(v1.0.0)         *
                Copyright (c) 2016 TP-LINK Tech. Co., Ltd
                Create Date: Sep 22 2016 - 15:19:03

   Boot Menu
0  - Print this boot menu
1  - Reboot
2  - Reset
3  - Start
4  - Activate Backup Image
5  - Display image(s) info
6  - Password recovery

Enter your choice(0-6)


The baud rate is 38400. What can i do now? This was some tough soldering haha

Or if i let it boot:

 broadcast            - Write message to all users logged in,at most 256
 configure            - Enter Global Configuration Mode
 copy                 - Config file commands
 debug                - Debugging commands
 enable-admin         - Achieve the admin privilege
 firmware             - Firmware commands
 logout               - Logout the system
 ping                 - Ping command
 reboot               - Reboot the system
 remove               - Config file commands
 reset                - Reset the system
 tracert              - Tracet route to destination
 clear                - Reset functions
 exit                 - Exit current mode
 history              - Display command history
 show                 - Display system information

1 Like

OK, the 38400 baud seems to be TP-Link specific. On the T2500G-10ts this was also the case, but I thought it had to do with the UART-RS232 converter. There is a CISCO style RS232 plug.
Now you need to flash a new u-boot.
I assume you have a way of not only reading the flash but also writing it with some external flash programmer.

  • Download both the T2500G-10TS GPL source code as well as the one for the T1500G-8T.
  • save ldk_realtek/realtek_v2.1.4/u-boot-2011.12/common/bootapp.c of the T1500
  • cp ldk_realtek/realtek_v2.1.4/u-boot-2011.12/common/bootapp.c from the T2500 over to the
  • make e.g. do the reboot command in bootapp.c do what the exit bootapp command does in the T2500
  • alternatively copy also the flash* utilities over from the same directory as the bootapp.c and make sure they get built
  • go to t1500g-8t_gpl/tplink/buildroot-realtek
  • make O=build/t1500g-8t tplink-t1500g-8t_defconfig
  • make O=build/t1500g-8t
  • If something fails in the build, restart with: make O=build/t1500g-8t clean
  • The build will fail at some point but should produce ./tplink/buildroot-realtek/build/t1500g-8t/images/u-boot.bin
  • Verify there is the string Tftp in the u-boot image.
  • Flash the new u-boot to the flash
    You should get more commands in the Boot Menu including one to go to the realtek OEM boot menu.
    There do the usual "rtk network on", tftpload etc.
1 Like

I tried building the 2500 to see if i could i even get it to build, but i seem to have failed. Im not very experienced in building from source, I am using WSL 2 since i dont have access to a full linux machine at the moment which may be the issue.

The error i ran into i was unsure how to solve is:

/bin/bash: -c: line 0: syntax error near unexpected token `('
 /bin/bash: -c: line 0: `(cd /home/ivo/tplink-t2500g-10ts-master/tplink/buildroot-realtek/build/t2500g-10ts/build/host-ccache-3.1.7/ && rm -rf config.cache; PATH=/hom........

which seems likely to be caused by WSL. Even if i were able to get a successful build, would the u boot image just go at beginning of the flash chip? or where does its address start? Is there anywhere i can grab a compiled uboot to try flashing?

Looking at the 2500 bootapp.c, it seems to me like we could use #define UBOOT_DEBUG to get a boot menu with flashing and other debug options.

Thanks so much for your help, its great to see openwrt expand to new hardware!

That error should not happen. I actually managed to make a u-boot for the T1500. I just needed to copy all of


to the respective directory for the t1500. Then in that directory edit bootapp.c and remove the define of UBOOT_DEBUG. Build and check that symbols like "Exit menu" or "Tftp" are in the resulting binary.

A WSL installation defaults to having a bunch of Windows directories in the PATH; remove them so PATH is only Linux directories.

After doing that I've had no problems building on WSL2 with Ubuntu 20.04.