Add support for MikroTik RB5009UG

Not being much of a router OS guy myself I also had to look that up. By default it is on 192.168.88.1 with user admin no password. Just SSH into it. And yeah, while you need the 2.5 GbE LAN1 for the later BOOTP, initially you need to use any of the other ports being LAN as that port 1 defaults to WAN.

Well, it does BOOTP so you do tell it what to further do.

No, it really just does BOOTP which is the ancient predecessor of DHCP. So whatever your BOOTP server configured for it.

2 Likes

Thanks - gonna look into BOOTP then.

2 Likes

In case it helps I ended up with the following, which will send the rb5009-jailbreak.elf file. The machine it runs on is 198.168.100.1 on the local interface. Replace "-u username" with your username, put the file in /tftpboot/.

dnsmasq --bind-interfaces -i eth1 \
        -a 192.168.100.1 --dhcp-range=192.168.100.100,192.168.100.200 \
        --dhcp-authoritative \
        --dhcp-boot=rb5009-jailbreak.elf \
        --enable-tftp --tftp-root=/tftpboot/ \
        -d -u username -p0 -K --log-dhcp --bootp-dynamic
2 Likes

I guess it goes to show I'm completely unfamiliar with RouterBOOT/OS :slight_smile: Thank you! Will give that a shot. From the look of it just my usual TFTP server won't cut it.

OK, so it looks like the ELF image gets uploaded, but after that it goes silent. I have no idea what's going on here.

  1. Set client IP to 192.168.88.10 so I can SSH into 192.168.88.1, and set boot from network. Tell RouterOS to reboot.
  2. Plug cable into the 2,5G port and switch IP to 192.68.1.1
  3. Activate DHCP server: sudo dnsmasq --bind-interfaces -i eth0 -a 192.168.1.1 --dhcp-range=192.168.1.100,192.168.1.200 --dhcp-authoritative --dhcp-boot=openwrt-mvebu-cortexa72-mikrotik_rb5009-initramfs-fit-uImage.elf --enable-tftp --tftp-root=/srv/tftp/ -d -u <user> -p0 -K --log-dhcp --bootp-dynamic

I see the ELF image gets uploaded, but after that the router goes silent.

dnsmasq: started, version 2.85 DNS disabled
dnsmasq: compile time options: IPv6 GNU-getopt DBus no-UBus i18n IDN2 DHCP DHCPv6 no-Lua TFTP conntrack ipset auth cryptohash DNSSEC loop-detect inotify dumpfile
dnsmasq-dhcp: DHCP, IP range 192.168.1.100 -- 192.168.1.200, lease time 1h
dnsmasq-dhcp: DHCP, sockets bound exclusively to interface eth0
dnsmasq-tftp: TFTP root is /srv/tftp/  
dnsmasq-dhcp: 508793544 available DHCP range: 192.168.1.100 -- 192.168.1.200
dnsmasq-dhcp: 508793544 vendor class: ARM64__boot
dnsmasq-dhcp: 508793544 tags: bootp, eth0
dnsmasq-dhcp: 508793544 BOOTP(eth0) 192.168.1.163 xx:xx:xx:xx:xx:xx 
dnsmasq-dhcp: 508793544 bootfile name: openwrt-mvebu-cortexa72-mikrotik_rb5009-initramfs-fit-uImage.elf
dnsmasq-dhcp: 508793544 next server: 192.168.1.1
dnsmasq-dhcp: 508793544 sent size:  4 option:  1 netmask  255.255.255.0
dnsmasq-dhcp: 508793544 sent size:  4 option: 28 broadcast  192.168.1.255
dnsmasq-dhcp: 508793544 sent size:  4 option:  3 router  192.168.1.1
dnsmasq-tftp: sent /srv/tftp/openwrt-mvebu-cortexa72-mikrotik_rb5009-initramfs-fit-uImage.elf to 192.168.1.163

After that switching to a 'LAN' port (port 2, port 8 e.g.) doesn't do anything, not a DHCP IP, static IP in the default OpenWrt range doesn't connect either.

I'm going to give the jailbreak a shot :slightly_smiling_face:.

For me that actually booted into OpenWrt and even showed boot messages via UART. It then defaults to regular 192.168.1.1 LAN on p2 to p8. But so far WAN did not come up. Will try to continue installation from a USB memory stick. Let's see...

1 Like

Might be my desktop playing up. Will give the laptop a shot tomorrow.

Yep, that worked:

mount /dev/sda1 /mnt
cat /mnt/rbt-with-aux-for-mtd5.bin | mtd write - RouterBOOT
echo cfg > /sys/firmware/mikrotik/soft_config/boot_device
echo 1 > /sys/firmware/mikrotik/soft_config/commit
cp /mnt/openwrt-mvebu-cortexa72-mikrotik_rb5009-squashfs-sysupgrade.bin /tmp/fw.bin
sysupgrade /tmp/fw.bin

However, still no reaction from WAN. While LAN on p2 works fine WAN on p1 (the 2.5 GbE one) seems dead:

root@OpenWrt:/# ethtool p1
Settings for p1:
        Supported ports: [ TP    MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
                                1000baseX/Full
        Supported pause frame use: Symmetric
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
                                1000baseX/Full
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: Unknown!
        Duplex: Unknown! (255)
        Auto-negotiation: on
        master-slave cfg: preferred slave
        master-slave status: unknown
        Port: MII
        PHYAD: 0
        Transceiver: external
        Supports Wake-on: d
        Wake-on: d
        Link detected: no
root@OpenWrt:/# ethtool p2
Settings for p2:
        Supported ports: [ TP    MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supported pause frame use: Symmetric
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Link partner advertised link modes:  10baseT/Half 10baseT/Full
                                             100baseT/Half 100baseT/Full
                                             1000baseT/Full
        Link partner advertised pause frame use: No
        Link partner advertised auto-negotiation: Yes
        Link partner advertised FEC modes: Not reported
        Speed: 1000Mb/s
        Duplex: Full
        Auto-negotiation: on
        Port: Twisted Pair
        PHYAD: 7
        Transceiver: external
        MDI-X: Unknown
        Supports Wake-on: d
        Wake-on: d
        Link detected: yes

So the 2.5 GbE port does not seem to advertise 2.5 GbE and also does not react on anything being plugged in.

Curious how the SFP+ behaves... There you go:

root@OpenWrt:/# ethtool -m sfp
        Identifier                                : 0x03 (SFP)
        Extended identifier                       : 0x04 (GBIC/SFP defined by 2-wire interface ID)
        Connector                                 : 0x21 (Copper pigtail)
        Transceiver codes                         : 0x10 0x00 0x00 0x00 0x40 0x40 0x04 0x00 0x00
        Transceiver type                          : 10G Ethernet: 10G Base-SR
        Transceiver type                          : FC: short distance (S)
        Transceiver type                          : FC: Shortwave laser w/o OFC (SN)
        Transceiver type                          : FC: Multimode, 50um (M5)
        Encoding                                  : 0x06 (64B/66B)
        BR, Nominal                               : 10300MBd
        Rate identifier                           : 0x00 (unspecified)
        Length (SMF,km)                           : 0km
        Length (SMF)                              : 0m
        Length (50um)                             : 300m
        Length (62.5um)                           : 300m
        Length (Copper)                           : 0m
        Length (OM3)                              : 300m
        Laser wavelength                          : 850nm
        Vendor name                               : OEM
        Vendor OUI                                : 00:1b:21
        Vendor PN                                 : SFP-10G-T
        Vendor rev                                : A0
        Option values                             : 0x00 0x1a
        Option                                    : RX_LOS implemented
        Option                                    : TX_FAULT implemented
        Option                                    : TX_DISABLE implemented
        BR margin, max                            : 0%
        BR margin, min                            : 0%
        Vendor SN                                 : 2104060324
        Date code                                 : 210331
root@OpenWrt:/# ethtool sfp
Settings for sfp:
        Supported ports: [ MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
                                10000baseT/Full
                                2500baseX/Full
                                10000baseKR/Full
                                1000baseX/Full
                                10000baseCR/Full
                                10000baseSR/Full
                                10000baseLR/Full
                                10000baseLRM/Full
                                10000baseER/Full
                                2500baseT/Full
                                5000baseT/Full
        Supported pause frame use: Symmetric
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
                                10000baseT/Full
                                2500baseX/Full
                                10000baseKR/Full
                                1000baseX/Full
                                10000baseCR/Full
                                10000baseSR/Full
                                10000baseLR/Full
                                10000baseLRM/Full
                                10000baseER/Full
                                2500baseT/Full
                                5000baseT/Full
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: Unknown!
        Duplex: Unknown! (255)
        Auto-negotiation: on
        Port: MII
        PHYAD: 0
        Transceiver: internal
        Supports Wake-on: d
        Wake-on: d
        Link detected: no

So while it recognizes my 10GBASE-T transceiver, which means I2C is working, no further reaction so far. Okay, after another re-boot with the SFP+ already plugged in it looks slightly different:

root@OpenWrt:/# ethtool sfp
Settings for sfp:
        Supported ports: [  ]
        Supported link modes:   10000baseSR/Full
        Supported pause frame use: Symmetric
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10000baseSR/Full
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: Unknown!
        Duplex: Unknown! (255)
        Auto-negotiation: on
        Port: Direct Attach Copper
        PHYAD: 0
        Transceiver: internal
        Supports Wake-on: d
        Wake-on: d
        Link detected: no

However, still no link or anything. But for a first try, quite amazing! Thanks, @adron!

1 Like

This is strange, because my WAN(p1) works fine on 1 gigabit. I don't have a 2.5 gigabit switch yet.

ethtool port1
Settings for port1:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Full 
                                1000baseX/Full 
        Supported pause frame use: Symmetric
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Full 
                                1000baseX/Full 
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Link partner advertised link modes:  10baseT/Half 10baseT/Full 
                                             100baseT/Half 100baseT/Full 
                                             1000baseT/Full 
        Link partner advertised pause frame use: Symmetric
        Link partner advertised auto-negotiation: Yes
        Link partner advertised FEC modes: Not reported
        Speed: 1000Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 0
        Transceiver: external
        Auto-negotiation: on
        Supports Wake-on: d
        Wake-on: d
        Link detected: yes

In general, its first port is strange, even in RouterOS it does not work with all the switches that I tried! - the link rises and immediately falls, and so on in a circle.

I remade my version of OpenWrt for RB5009 to use UBI (NAND):

# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 4.8M      4.8M         0 100% /rom
tmpfs                   496.6M     60.0K    496.5M   0% /tmp
/dev/ubi0_1             892.1M     36.0K    887.3M   0% /overlay
overlayfs:/overlay      892.1M     36.0K    887.3M   0% /
tmpfs                   512.0K         0    512.0K   0% /dev
3 Likes

For 2.5G to work or even be advertised you need the QCA8081 PHY driver, otherwise the generic one only knows 1G as 2.5G doesn't really have standard regs for advertising

4 Likes

Is someone backporting it to Openwrt while it is approved/merged in mainline?

1 Like

I backported it to 5.15 only, couldn't care less about 5.10 currently

2 Likes

Would you be willing to make a step by step guide on how to use the file. My eyes aren't really what they used to be or some written instructions would help tons.

1 Like

Fine to me, so if I have to build the image I have to specify the 5.15 kernel.
Any difference between the adron and your branch? (other than now adron one store the data in the nand?)

Having the exact same behavior here. Please post if you figure it out

I checked @robimarko's tree a few days ago, I pulled the 5.15/RB5009UG specific commits and was able to apply them trivially on top of recent master. It's like 25 patches tops with the IPQ80xx patches filtered out (two top commits are mine).

$ git log --oneline|head -27
2d786b8433 kernel: bump 5.15 to 5.15.23
b5fa42072b base-files: profile: personal enhancements
945b813646 mvebu: rb5009: fix hard config size
c6955143fc mvebu: rb5009: add QCA8081 PHY support
1cb85e3b42 mvebu: rb5009: store BBT on NAND
0243cfeeca mvebu: rb5009: generate FIT image
94af6955c3 mvebu: 5.15: add Amethyst specific SMI setup
eac9636fc8 kernel: 5.15: backport QCA8081 PHY support
8eccb2ddcc mvebu: A72: add MikroTik RB5009
cf696c333a generic: 5.15: fix new AQR PHY patches
27bbc4bfc4 mvebu: add 5.15 as testing kernel
5c2a50304d mvebu: 5.15: refresh patches
f79b1bf73a mvebu: 5.15: remove upstreamed patches
28639dc4a0 mvebu: copy 5.10 patches/kconfigs to 5.15
629e0edca5 kernel: get uImage.FIT partition parser ready for Linux 5.15
e09e5f8f80 generic: 5.15: fix AQR PHY patch
2c9c5e1f41 generic: backport mirror mode and LAG feature for qca8k
9061123167 kernel: add new module for 5.15
2fbacdfc43 generic: add support for 5.15
1fc327d505 generic: refresh config for kernel 5.15
5492a67108 generic: fix affinity warning for qcom target
4d1473efb9 generic: standardize tcp_no_window_check pending patch for 5.15
610faf1c66 generic: rework pending patch for 5.15
b15b3cb38f generic: rework hack patch for 5.15
8613760f9e generic: qca8k: refresh backport patches for 5.15 kernel
771e17d9c0 generic: drop upstream patch for 5.15
bdd443fb23 generic: copy config and patch from 5.10 to 5.15
$ git branch
  master
  master-prep
  master-xgs1250-prep
  rb5009ug-adron-nor
* rb5009ug-robimarko-nand-5.15

Adrons's instructions also apply to robimarko's tree AFAICT (concatenating the auxiliary loader and the FIT image) so you can just follow these, but then with the 5.15 NAND images.

@hibby50 Will do.

@LightArrow123 See @noodles's post for instructions on how to TFTP boot:

For the remainder of the instructions, follow the README:

I just finished fixing some bugs in the aux-loader. This bugs could lead to the impossibility of loading on some versions of RouterBOOT. The OpenWrt images for RB5009 is also been updated.

My new OpenWrt images are also ready to work with ubi(NAND).

2 Likes

Is only the jailbreak file needed? to be able to tftp boot?

I'm not sure what exactly you are talking about. I never jailbroke mine but was still able to install OpenWrt. So the former is not a prerequisite of the later.