Hello forum,
I have tried to fight my way through this very long forum thread in order to install OpenWRT on my new RB5009UG+S+IN.
I ended up following the instruction given here .
I can boot OpenWRT initramfs fine using TFTP. But then after updating the bootloader and then starting the sysupgrade, the router keeps rebooting endlessly.
I have tried with the image linked in the instructions, but also with the latest one from the openwrt downloads .
Any help on what the latest instructions for installing OpenWRT on this device are is highly appreciated!
Cheers, Christoph
Arie
October 3, 2024, 7:50pm
2
It's unfortunate that thread got automatically closed by a moderator-bot, a lot of knowledgeable people frequented that thread.
That thread has some updated instructions around the Jun 9 2024 mark which might help.
It appears that my RB5009 has a different MTD layout:
root@OpenWrt:~# cat /proc/mtd
dev: size erasesize name
mtd0: 40000000 00020000 "ubi"
mtd1: 00095c04 00010000 "ATF"
mtd2: 000193fc 00010000 "backup_RouterBOOT"
mtd3: 00001000 00010000 "hard_config"
mtd4: 00010000 00010000 "RouterBOOT"
mtd5: 00010000 00010000 "soft_config"
mtd6: 00010000 00010000 "DTS"
mtd7: 00020000 00010000 "free_space"
mtd8: 00f00000 00010000 "kernel"
mtd9: 00100000 00010000 "first_1M"
It doesn't have a "YAFFS" device. So I am not sure where to install u-boot and which device to ubiformat..
I have reinstalled ROS in between tests in order to recreate the initial partioning.
johnth
October 6, 2024, 4:01am
4
Your MTD layout is mostly determined by the image you boot…: https://github.com/adron-s/openwrt-rb5009/blob/7c5826afd297d6a0bfbf6685c02a33f1e4f4a73a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-7040-rb5009.dts#L94
If you want to use the (upstream) OpenWrt image, follow the OpenWrt RB5009 commit message instructions (partitions: https://github.com/openwrt/openwrt/blob/ca325ee516e63ae138cbd5bbf20316139efe882f/target/linux/mvebu/files-6.6/arch/arm64/boot/dts/marvell/armada-7040-rb5009.dts#L128 ):
committed 07:46AM - 24 Jun 24 UTC
This patch adds support for Mikrotik RB5009UG+S+IN.
Specifications:
- SoC: Ma… rvell Armada 7040 (88F7040) - 4 cores, ARMv8 Cortex-A72, 1.4GHz, 64bit
- RAM: 1024MB DDR4
- Flash: 16MB SPI NOR flash, 1024MB NAND
- Ethernet:
* Marvell 88E6393X - Amethyst:
* one 2.5G RJ45 port via Qualcomm QCA8081 PHY
* seven 1G RJ45 ports via built-in PHY-s
* one 10G SFP+ cage
* All ports share the same 10G switch uplink to the CPU
- LED: User, SFP, Hdr1, Hdr2
- Buttons: Reset
- UART: 115200 8n1 on the MikroTik 16 pin header
- USB: One USB3 port
- Power: 24-57 V via
* DC jack
* 802.3af/at PoE on Ethernet 1
* 2-pin terminal on the side
16 Pin header pinout:
1 GND Vcc RX ? GND
#--------------------#
|.-. .-. .-. .-. .-. |
|'-' '-' '-' '-' '-' |
|.-. .-. .-. .-. .-. |
|'-' '-' '-' '-' '-' |
#--------------------#
2 CLK DO /CS TX DI
Do note that the default RouterBoot has disabled UART even when the
required hard-config bit is set to indicate UART support.
Patched RouterBoot must be used if UART is desired.
Also, since ARM64 Linux support does not support in any way appending the
DTB to the kernel image we use mainline U-Boot with added RB5009 support
in order to boot OpenWrt.
MikroTik uses YAFFS to store the boot kernel and we use YAFUT to put U-Boot
as the kernel which RouterBoot then simply boots as an ELF.
Install instructions:
NOTE: In case you are using an existing out of tree version of OpenWrt make
sure to reinstall RouterOS via Netinstall to return the expected partition
layout.
1. Prepare FAT or EXT4 formatted USB drive with OpenWrt initramfs:
* Copy bin/targets/mvebu/cortexa72/openwrt-mvebu-cortexa72-mikrotik_rb5009-initramfs-uImage.itb
to the root of FAT or EXT4 formatted USB drive.
* Plug in the drive to the RB5009 USB port
2. Boot the modified OpenWrt built U-Boot ELF:
u-boot.elf from bin/targets/mvebu/cortexa72/u-boot-rb5009/u-boot.elf
Consult OpenWrt wiki for common instructions on switching to boot from
Ethernet once as well as serving the file:
https://openwrt.org/toh/mikrotik/common
Once U-Boot is booted it will attempt to boot in the following order:
1. NAND
2. USB
3. Network
NAND is expected to fail but USB or Networking need to serve the OpenWrt
initramfs image and after booting it will be accessible from LAN ports
on the default 192.168.1.1 IP with default credentials.
3. Flash modified RouterBoot that enables UART (Optional but recommended):
https://public.robimarko.eu/RB5009/70x0-7.15-uart.fwf
* Copy the file over to the booted OpenWrt initramfs to /tmp
* Run: mtd erase RouterBOOT-primary
* Run: mtd write /tmp/70x0-7.15-uart.fwf RouterBOOT-primary
4. Install U-Boot to boot OpenWrt:
* Copy the u-boot.elf from bin/targets/mvebu/cortexa72/u-boot-rb5009/u-boot.elf
to OpenWrt initramfs to /tmp.
* Run: . /lib/functions.sh
* Run: yafut -d /dev/mtd$(find_mtd_index "YAFFS") -w -i /tmp/u-boot.elf -o kernel -T
This will use yafut to copy the U-Boot as kernel in YAFFS so that RouterBoot boots it.
5. Wipe the NAND UBI partition:
* Run: ubiformat /dev/mtd$(find_mtd_index "ubi") -y
This will prepare the existing RouterOS rootfs partition for OpenWrt.
6. Flash OpenWrt:
* Copy the bin/targets/mvebu/cortexa72/openwrt-mvebu-cortexa72-mikrotik_rb5009-squashfs-sysupgrade.bin
to OpenWrt initramfs to /tmp.
* Run: sysupgrade /tmp/openwrt-mvebu-cortexa72-mikrotik_rb5009-squashfs-sysupgrade.bin
Device will reboot, boot U-Boot and then OpenWrt.
Recovery:
In case you need to reinstall OpenWrt if it crashes after U-Boot, there is
a recovery mechanism in OpenWrt to boot the OpenWrt initramfs.
You need to hold the reset button while U-Boot is booting and then it will
boot the OpenWrt initramfs from:
1. USB
2. Networking
In recovery mode U-Boot will light all of the LED-s except for the switch
ones.
In case you want to return to RouterOS, you can simply do that via
Netinstall like on any other MikroTik board.
Credits also go to Serhii Serhieiev <adron@mstnt.com> who origininally
figured out the RouterBoot modification for UART, the missing 10G MVPP2
support in U-Boot as well as the custom aux loader to boot directly via
RouterBoot.
Link: https://github.com/openwrt/openwrt/pull/15765
Signed-off-by: Robert Marko <robimarko@gmail.com>
Thank you so much! I have managed to install and boot a working snapshot on my RB5009
In the end everything works as described in the pull request . You just have to follow everything exactly as written, using the images from the current snapshot folder . u-boot will only load the image from USB stick, booting from network didn't work for me.
Some details for the less knowledgeable people, like I am:
Plug you PC into Port 1. Boot the u-boot.elf via TFTP. I have used this script on linux:
#!/bin/bash
IFNAME=enp0s20f0u4u1u3
/sbin/ip addr replace 192.168.88.2/24 dev $IFNAME
/sbin/ip link set dev $IFNAME up
/usr/sbin/dnsmasq \
--no-daemon \
--listen-address 192.168.88.2 \
--bind-interfaces \
-p0 \
--dhcp-authoritative \
--dhcp-range=192.168.88.100,192.168.88.200 \
--bootp-dynamic \
--dhcp-boot=u-boot.elf \
--log-dhcp \
--enable-tftp \
--tftp-root=$(pwd)
Power up your router while pressing the reset button for 20(!) seconds, until the LED behind the reset button goes off. u-boot will be transferred and booted, which will load the initramfs from the plugged in USB stick.
Plug your PC into any other port than port 1. Follow all instructions from the pull request .
Connect via ssh and install the LuCI web interface
3 Likes