Another question: I assume it's Realtek specific, like the name suggests? So not usable for other OpenWrt supported platforms that come with PoE? Like some EdgeRouter models e.g.? Just out of curiosity.
I set the package here to depend on the Realtek target, locally.
I'm not convinced that it is a good idea. I believe most users will end up like you: Wondering where the management interface went.
I believe it is better to replicate stock firmware behaviour by default. Assuming users will flash from stock to OpenWrt without necessarily having console, it might even make sense to pick up both management VLAN and address from the stock config. Then you would just reach luci exactly where you just used the stock web gui.
The stock CLI config is available to OpenWrt by simply mounting the partition it is saved in:
root@gs1900-10hp:~# mount -o ro -t jffs2 /dev/mtdblock3 /mnt
[59617.370439] jffs2: notice: (3572) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
root@gs1900-10hp:~# ls -la /mnt/
drwxr-xr-x 4 root root 0 Jan 1 1970 .
drwxr-xr-x 1 root root 0 Dec 8 08:23 ..
-rw-r--r-- 1 root root 1052 Jan 1 2020 backup-config
drwxr-xr-x 2 root root 0 Jan 1 2019 ssh
-rw-r--r-- 1 root root 1985 Nov 14 21:17 startup-config
I don't think a full parser is worth it, but just fetching the management parts might be. This could be done in a uci-defaults script. If someone does the work..,..
The current PoE package only implements the Broadcom PoE control protocol. If this happens to be a Broadcom thing, it might be reusable on other devices, but there is currently no universal PoE interface (yet).
Some Realtek switches use different PoE platforms (Microsemi PD69xxx, TI platform on that one TP-Link switch), so these are currently not supported.
I first thought boota implied partition 0 but it's just the macro you mentioned, so there's no way to tell from this what partition is active I presume (this is from the OpenWrt ramdisk).
And similar with fw_setsys -c /etc/fw_sys.config of course
I was looking at how to set up this automatically in an elegant way. Generating the config and some symlinks for fw_printsys and fw_setsys is simple. But that would need to run on every boot, which means an additional init script. Or the symlinks would just have to be there on every device and do nothing unless you have that partition config. I don't know what's best?
EDIT: if you wonder about those dualfnameX variables: They are written when you flash from stock firmware. I do not know what they are used for. Maybe just a UI thing. It's the actual file name you flash, so it's pretty meaningless. The "x.bin" is the result of me creating a shorter filename for an OpenWrt initramfs image
Thanks. I rebooted into u-boot, and used the setsys/savesys commands you mentioned earlier. However, bootpartition=0 shows up when I issue printsys, not when I issue printenv. Similarly, with OpenWrt running from RAM fw_printenv doesn't show the bootpartition value either.
Either way, when I issue boot it's clearly booting OpenWrt from partition 0, so all looks well. However, I am missing an overlayfs. I'm seeing these messages:
logread -e jffs2
Wed Dec 9 12:43:44 2020 kern.info kernel: [ 0.166640] jffs2: version 2.2 (NAND) (SUMMARY) (ZLIB) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, In.
Wed Dec 9 12:43:44 2020 kern.notice kernel: [ 1.306851] 0x000000160000-0x000000260000 : "jffs2"
Wed Dec 9 12:43:44 2020 user.notice kernel: [ 12.393597] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
logread -e mount
Wed Dec 9 12:43:44 2020 user.notice kernel: [ 12.393597] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
Wed Dec 9 12:44:16 2020 user.notice ucitrack: Setting up non-init /etc/config/fstab reload handler: /sbin/block mount
Wed Dec 9 12:44:18 2020 daemon.err mount_root: failed - mount -t jffs2 /dev/mtdblock8 /rom/overlay: Not a tty
And this, but given it's 16 MB flash, it seems a bit strange?
Wed Dec 9 12:44:18 2020 kern.err kernel: [ 60.471289] Too few erase blocks (2)
df -h /rom
Filesystem Size Used Available Use% Mounted on
/dev/root 4.3M 4.3M 0 100% /rom
ROM size doesn't look outrageous to me, but it might be tight because of the dual partition setup maybe? If I'm not mistaken mtd8 is 131072 bytes (hex 00020000?) which translates to 128 kB? That does sound a bit small for rootfs_data?
I did yes. I'm sharing configurations (SSL etc.) between multiple devices so extra stuff gets pulled in. Looks like I'll be stripping. Thanks for confirming, and for all your help.
@anon13997276 Thanks a lot for your help as well, and my apologies for filling this thread with tons of questions.
Thanks for asking all those questions! I am sure the questions and bmork's answers will be very helpful for anyone who wants to set up a realtek-based switch. When I see the level of sophistication we already have in configuring these devices it is also amazing how far we all got in making OpenWRT run so well on these switches in such a short time.
@bmork For what it's worth I seem to be encountering duplicate ping messages (DUP!) as well when the switch comes online. No idea if this has been solved in kobi's tree by now?
I don't think it is. I also see those. Must be related to mac address learning. Will only happen for the very first packet for any device. So it's not a major problem.
I believe by default the hardware traps packets from new source address to the cpu-port. From @LGA1150 we learned that we need to make sure that the packet then is not forwarded twice by the bridge and the switch layer. Probably the reason code is a different one in the cpu-tag when this happens, so that skb->offload_fwd_mark is not set. This is hopefully easy to fix.
If I build from OpenWrt trunk does the D-Link DGS-1210-10P build also work for the DGS-1210-10? I don't see anything in the DTS file that appears to reference PoE related hardware.
I have an Zyxel GS1900-8HP, and I think it is also an RTL838x chipset. Is there already a snapshot to test? I only use vlans (tagged and untagged) and poe, and looking in the wiki that should work.
The snapshot builds are broken for the realtek target, so I did a self build. You can try that if you'd like - but are the internals the identical between the 8HP and the 10HP? At least when it comes to flash layout and whatnot? If not, that could brick your device.
I can link you to one of my builds, they're not compatible with the OpenWrt package repos though (and come with a limited package set - no dnsmasq etc.). So if you'd use it as a switch, no problem, but the builds aren't suited for use as a router.
I took the switch out of the network yesterday, will investigate today. At this point I can only say ath79 devices from the same buildrun flash fine. Gonna hook up serial again .