OpenWRT: Flash Mikrotik RB450

From mUTU
Jump to: navigation, search

Mikrotik RouterBoard 450G (RB-450G)

The good news: Attitude Adjustment 12.09-rc1 works very well on the RB-450G. The device is built with good hardware, almost all of which is fully supported. With a fast processor, gigabit ethernet, and relatively huge amounts of RAM and flash, this is a very capable device once OpenWRT is installed.

The bad news: getting OpenWRT installed in the first place is not straightforward. Installing a New Firmware Image

OpenWRT doesn't provide a firmware image that can be written directly to the flash memory via the firmware update system in Mikrotik's RouterOS. So installing OpenWRT is a two step process that requires two separate kernel images.

You're going to need a computer that can build OpenWRT from source. You're also going to need a desktop computer that has a working serial port and an ethernet interface. This computer will also need to have:

   some kind of serial terminal software
   a DHCP server; this documentation will use dnsmasq
   a TFTP server; also dnsmasq

The following instructions illustrate installing Attitude Adjustment 12.09-rc1, but should be easily adaptable to other versions. Create a netboot image for the RB450G

   Get the OpenWRT source code
   You could configure the system entirely by hand, but it's easier to just start with an existing configuration that works for the RB450G.
       here is a smaller configuration made for Backfire (r24027). It will not take as long to compile as the default OpenWRT configuration, and works fine for Attitude Adjustment 12.09-rc1.
   Configure the system to use a ramdisk:
   Target Images  --->
       [*] ramdisk
   Build OpenWRT from source
   The build will create the file bin/ar71xx/openwrt-ar71xx-nand-vmlinux-initramfs-lzma.elf. This is the kernel+ramdisk that the RB450G will use to boot.

TODO: is it possible to directly combine a kernel and the rootfs provided by OpenWRT? This would get around needing to build an image from source. Boot the RB450G from the network

   Connect the ethernet adapter of your desktop computer to Eth1 of the RB450G using either a straight or crossover cable. The RB450G will figure out the crossover on its own.
   Manually assign an IPv4 address (anything other than, or anything in the range of IPs used in your local LAN) to the ethernet adapter on your desktop computer. Here I'll use
   Set up dnsmasq on the desktop computer.
       The RB450G's bootloader apparently ignores all DHCP options, such as tftp-server or bootp-filename, normally used to instruct a netboot device how to find its image. So you need to set up dnsmasq with specific options to work around this quirk.
       Copy the file openwrt-ar71xx-nand-vmlinux-initramfs-lzma.elf from your OpenWRT build tree to a clean directory like ~/tftproot/. Rename the file to vmlinux. The RB450B
       Run sudo dnsmasq -a -z -d -p 0 -F –enable-tftp –tftp-root=~/tftproot/.
       dnsmasq should start in the foreground writing all its output to the terminal; you're only going to run it temporarily, and having the debugging information may come in handy.
   Connect the serial port of your desktop computer to the serial port of your RB450G using a null modem cable. Start your terminal server program. The RB450G serial interface uses 8N1 with hardware flow control at 115200 bps.
   Power up the RB450G. Immediately hit any key to go to the bootloader menu:
   What do you want to configure?
     d - boot delay
     k - boot key
     s - serial console
     o - boot device
     u - cpu mode
     f - cpu frequency
     r - reset booter configuration
     e - format nand
     g - upgrade firmware
     i - board info
     p - boot protocol
     t - do memory testing
     x - exit setup
   Select o - boot device and then select 1 to boot once from the network, and then boot from the nand after that. Hit x to exit setup.
   The RB450G will reboot. Let the bootloader menu time out, and it should get an address via DHCP and then load the netboot image from your desktop computer. After a minute or so, you should be able to hit <enter> and get to the OpenWRT prompt.

Install the OpenWRT distribution

   Don't bother configuring anything while in netboot. Any changes you make won't be written back to the original image, so they'll all be lost when you reboot anyway.
   You can disconnect the ethernet connection between your RB450G and your desktop system. Do not disconnect the serial connection.
   Wipe out any network self-configuration that the RB450 has done: ifconfig eth0 down and ifconfig br-lan down. While not absolutely necessary, I suggest doing this so that anything that the RB450G has done on its own doesn't conflict with your existing LAN setup.
   Now you'll need to establish a connection between the RB450G and the internet so that it can download the OpenWRT packages it needs for installation. Since personal LANs vary so much, I will leave this as an exercise to the reader.
       Don't use Eth1 to connect the RB450G to your local LAN; use Eth2 instead. Any firewall rules that the OpenWRT netboot image may have set up by default are likely to be less restrictive on the internal LAN switch (Eth2–5) than on the external WAN interface (Eth1).
       The linux interface device name for Eth2–5 is most likely br-lan, though it may be eth1 instead.
   Once the internet connection is established, use the wget2nand script to install OpenWRT into the flash of the RB450G: wget2nand
       The wget2nand script in Attitude Adjustment 12.09-rc1 tries to download a nonexistent kernel file. Change line 30 of the script from
       and it should work fine.
   Once wget2nand finishes, you can reboot the router. This time, the router should boot from flash and give you a working OpenWRT installation that you can configure as you like.


Pranala Menarik

Build Firmware



Flash Firmware