MikroTik RouterBOARD 951Ui-2HnD

Hardware

CPU CPU Speed RAM (MB) NAND (MB) Serial Flash Ethernet Switch PoE port Wireless USB UART JTAG
AR9334 600 MHz 128 (2x W9751G6KB-25) 128 (1x TC58DVG02D5TA00-ND) MX25L512E AR7240 (10M/100M) 1-in 5-out (500mA) AR9344-DC3A 1x 2.0 1x onboard 1x onboard

Download bootp, kernel and filesystem files

Barrier Breaker 14.07 is stable and available in repository.

$ mkdir ~/mikrotik
$ cd ~/mikrotik
$ wget http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/mikrotik/openwrt-ar71xx-mikrotik-vmlinux-initramfs.elf
$ wget http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/mikrotik/openwrt-ar71xx-mikrotik-vmlinux-lzma.elf
$ wget http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/mikrotik/openwrt-ar71xx-mikrotik-DefaultNoWifi-rootfs.tar.gz

Go to "Run OpenWRT in RAM"

Create image (outdated, use trunk instead, for reference only)

$ mkdir ~/mikrotik/
$ cd ~/mikrotik/
$ svn co -r 39392 svn://svn.openwrt.org/openwrt/trunk/
$ cd ~/mikrotik/trunk
$ wget -c http://patchwork.openwrt.org/patch/4773/raw/ -O OpenWrt-Devel-ar71xx-Add-support-for-MikroTik-RB951Ui-2HnD.patch
$ patch -u -p0 < OpenWrt-Devel-ar71xx-Add-support-for-MikroTik-RB951Ui-2HnD.patch
Configure image for booting from RAM
$ make menuconfig
$ make kernel_menuconfig

Target = AR7XXX Subtarget = Mikrotik device with NAND flash Target Images = ramdisk

$ make V=s

Configure image for booting from NAND

$ make menuconfig

Target = AR7XXX Subtarget = Mikrotik device with NAND flash Target Images = tar.gz

$ make V=s

Prepare flashing

$ ln -s ~/mikrotik/trunk/bin/ar71xx/openwrt-ar71xx-mikrotik-vmlinux-initramfs.elf ~/mikrotik/openwrt-ar71xx-mikrotik-vmlinux-initramfs.elf
$ ln -s ~/mikrotik/trunk/bin/ar71xx/openwrt-ar71xx-mikrotik-vmlinux-lzma.elf ~/mikrotik/openwrt-ar71xx-mikrotik-vmlinux-lzma.elf
$ ln -s ~/mikrotik/trunk/bin/ar71xx/openwrt-ar71xx-mikrotik-DefaultNoWifi-rootfs.tar.gz ~/mikrotik/openwrt-ar71xx-mikrotik-DefaultNoWifi-rootfs.tar.gz

Run OpenWrt in RAM

Create script: ~/mikrotik/loader.sh

#/bin/sh
ifconfig eth0 192.168.1.10 up
dnsmasq -i eth0 --dhcp-range=192.168.1.100,192.168.1.200 \
--dhcp-boot=openwrt-ar71xx-mikrotik-vmlinux-initramfs.elf \
--enable-tftp --tftp-root=~/mikrotik/ -d -u test -p0 -K --log-dhcp --bootp-dynamic
  1. Run script loader.sh (you may need to sudo)
  2. Unplug power jack of the router
  3. Plug a network cable between your TFTP server and Port_1 (PoE in) of the router
  4. Hold reset button
  5. Plug power jack
  6. After beep, unhold reset button
  7. Unplug Port_1, replug to any other.

Remember this procedure, would be helpful if you lose access to your router in the future.

Flash OpenWRT to Mikrotik

You must run OpenWRT in RAM prior to flash.

Telnet to your router

$ telnet 192.168.1.1

Mount partitions

$ mkdir /mnt/kernel
$ mkdir /mnt/rootfs
$ mtd erase /dev/mtd1
$ mtd erase /dev/mtd2
$ mount /dev/mtdblock1 /mnt/kernel
$ mount /dev/mtdblock2 /mnt/rootfs

Set root password for SSH and disconnect

$ passwd
$ exit

Send kernel image to the router

$ scp ~/mikrotik/openwrt-ar71xx-mikrotik-vmlinux-lzma.elf root@192.168.1.1:/mnt/kernel/kernel

Untargz rootfs to the router

$ cat ~/mikrotik/openwrt-ar71xx-mikrotik-DefaultNoWifi-rootfs.tar.gz | ssh root@192.168.1.1 'cd /mnt/rootfs ; tar xvzf -'

Reboot and enjoy your OpenWRT device.

Make LEDs work

Had those lines to your /etc/config/system

config led 'act'
        option trigger 'netdev'
        option mode 'link tx rx'
        option sysfs 'rb:green:act'
        option name 'ACT'
        option dev 'eth1'
        option brightness '0'

config led 'p1'
        option trigger 'netdev'
        option name 'Port_1'
        option sysfs 'rb:green:port1'
        option dev 'eth0'
        option mode 'link tx rx'

config led 'p2'
        option trigger 'switch0'
        option name 'Port_2'
        option sysfs 'rb:green:port2'
        option port_mask '0x10'
        option mode 'link tx rx'

config led 'p3'
        option name 'Port_3'
        option sysfs 'rb:green:port3'
        option trigger 'switch0'
        option port_mask '0x8'
        option mode 'link tx rx'

config led 'p4'
        option name 'Port_4'
        option trigger 'switch0'
        option sysfs 'rb:green:port4'
        option port_mask '0x4'
        option mode 'link tx rx'

config led 'p5'
        option name 'Port_5'
        option sysfs 'rb:green:port5'
        option trigger 'switch0'
        option port_mask '0x2'
        option mode 'link tx rx'

config led 'wlan'
        option sysfs 'rb:green:wlan'
        option name 'WLAN'
        option trigger 'phy0tpt'

Disable PoE output permanently

Run this command to disable permanently PoE on Port_5, revert by echoing 1 or deleting the file in /lib/preinit
Port_5 red light will be turned off instantly

$ echo "echo 0 > /sys/class/gpio/gpio2/value" > /lib/preinit/99_PoE_Port5

Disable USB permanently

Back to top

toh/mikrotik/rb951ui.txt · Last modified: 2014/11/19 11:14 by databeille