{"id":1536,"date":"2011-11-23T22:28:59","date_gmt":"2011-11-24T02:28:59","guid":{"rendered":"http:\/\/www.braindeadprojects.com\/blog\/?p=1536"},"modified":"2011-11-23T22:28:59","modified_gmt":"2011-11-24T02:28:59","slug":"openwrt-on-the-mikrotik-routerboard-493ah","status":"publish","type":"post","link":"http:\/\/www.braindeadprojects.com\/blog\/what\/openwrt-on-the-mikrotik-routerboard-493ah\/","title":{"rendered":"OpenWRT on the MikroTik RouterBoard 493AH"},"content":{"rendered":"<p>I recently came across a <a title=\"RouterBoard 493AH\" href=\"http:\/\/routerboard.com\/RB493AH\" target=\"_blank\">MikroTik RouterBoard 493AH<\/a> at work. We&#8217;d acquired the device among numerous other pieces of equipment from a now defunct wireless ISP.<\/p>\n<figure id=\"attachment_1545\" aria-describedby=\"caption-attachment-1545\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/IMAG0694.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1545\" title=\"RouterBoard 493AH\" src=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/IMAG0694-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/IMAG0694-300x225.jpg 300w, http:\/\/www.braindeadprojects.com\/blog\/wp-content\/IMAG0694-1024x768.jpg 1024w, http:\/\/www.braindeadprojects.com\/blog\/wp-content\/IMAG0694.jpg 2048w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1545\" class=\"wp-caption-text\">It smells of Goo-Gone and looks to have dandruff.<\/figcaption><\/figure>\n<p>The 493AH features 9 ethernet ports, can accept POE on its WAN interface, has 64M NAND,\u00a0 128M RAM, and can support 3 mini-PCI cards. Configuration can be performed via a serial interface and there is an external power connector available if POE isn&#8217;t used.<\/p>\n<p>The device itself wouldn&#8217;t boot, only hang at the RouterBoot bootloader. Attempts to boot the NAND image failed, but the bootloader gives an easy option for downloading an image to it via <a title=\"TFTP\" href=\"http:\/\/en.wikipedia.org\/wiki\/Trivial_File_Transfer_Protocol\" target=\"_blank\">TFTP<\/a>.<\/p>\n<figure id=\"attachment_1571\" aria-describedby=\"caption-attachment-1571\" style=\"width: 216px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/logo_mikrotik.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1571  \" title=\"MikroTik Logo\" src=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/logo_mikrotik.jpg\" alt=\"MikroTik Logo\" width=\"216\" height=\"216\" srcset=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/logo_mikrotik.jpg 300w, http:\/\/www.braindeadprojects.com\/blog\/wp-content\/logo_mikrotik-150x150.jpg 150w\" sizes=\"(max-width: 216px) 100vw, 216px\" \/><\/a><figcaption id=\"caption-attachment-1571\" class=\"wp-caption-text\">A brand that&#39;s loved by WISPs<\/figcaption><\/figure>\n<p>Looking around, it appears the 493AH is an <a title=\"Atheros7161\" href=\"http:\/\/www.qca.qualcomm.com\/networking\/brand.php?brand=4&amp;product=68\" target=\"_blank\">Atheros AR7161<\/a> .. an architecture readily supported under <a title=\"OpenWRT\" href=\"https:\/\/openwrt.org\/\" target=\"_blank\">OpenWRT<\/a>. Sure, I could just re-install <a title=\"RouterOS\" href=\"http:\/\/www.qca.qualcomm.com\/networking\/brand.php?brand=4&amp;product=68\" target=\"_blank\">RouterOS<\/a>&#8230; but let&#8217;s do that later.<\/p>\n<p>To install OpenWRT to the 493AH, first format the NAND. This can easily be done via the bootloader (option e):<\/p>\n<figure id=\"attachment_1580\" aria-describedby=\"caption-attachment-1580\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/formatNAND.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1580\" title=\"FormatNAND\" src=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/formatNAND-300x189.png\" alt=\"FormatNAND\" width=\"300\" height=\"189\" srcset=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/formatNAND-300x189.png 300w, http:\/\/www.braindeadprojects.com\/blog\/wp-content\/formatNAND.png 806w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1580\" class=\"wp-caption-text\">Waxing the memory<\/figcaption><\/figure>\n<p>Next, use subversion to check out the Backfire version of OpenWRT:<\/p>\n<blockquote><p>mkdir ~\/svn\/<\/p>\n<p>cd ~\/svn\/<\/p>\n<p>svn co svn:\/\/svn.openwrt.org\/openwrt\/branches\/backfire backfire<\/p><\/blockquote>\n<p>Building the image is fairly easy, all configuration is done via a &#8220;<em>make menuconfig<\/em>&#8220;. First, we&#8217;ll build a small <a title=\"InitRAMFS\" href=\"http:\/\/www.linuxfordevices.com\/c\/a\/Linux-For-Devices-Articles\/Introducing-initramfs-a-new-model-for-initial-RAM-disks\/\" target=\"_blank\">initramfs<\/a>. This will give us a tiny environment to boot into the device and later install our kernel with.<\/p>\n<p>Ensure that you&#8217;ve selected the AR71xx target architecture&#8230;<\/p>\n<figure id=\"attachment_1548\" aria-describedby=\"caption-attachment-1548\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/platformtarget.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1548\" title=\"PlatformTarget\" src=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/platformtarget-300x189.png\" alt=\"\" width=\"300\" height=\"189\" srcset=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/platformtarget-300x189.png 300w, http:\/\/www.braindeadprojects.com\/blog\/wp-content\/platformtarget.png 806w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1548\" class=\"wp-caption-text\">Building an AR71XX System<\/figcaption><\/figure>\n<p>Next, I opt for the default profile (to give me all the modules I should need)<\/p>\n<figure id=\"attachment_1549\" aria-describedby=\"caption-attachment-1549\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/targetprofile.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1549\" title=\"TargetProfileSelection\" src=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/targetprofile-300x189.png\" alt=\"TargetProfileSelection\" width=\"300\" height=\"189\" srcset=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/targetprofile-300x189.png 300w, http:\/\/www.braindeadprojects.com\/blog\/wp-content\/targetprofile.png 806w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1549\" class=\"wp-caption-text\">I demand everything!<\/figcaption><\/figure>\n<p>And finally, select the build of a ramdisk image:<\/p>\n<figure id=\"attachment_1550\" aria-describedby=\"caption-attachment-1550\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/ramdiskbuild.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1550\" title=\"BuildRamDisk\" src=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/ramdiskbuild-300x189.png\" alt=\"BuildRamDisk\" width=\"300\" height=\"189\" srcset=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/ramdiskbuild-300x189.png 300w, http:\/\/www.braindeadprojects.com\/blog\/wp-content\/ramdiskbuild.png 806w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1550\" class=\"wp-caption-text\">Fun with arrow keys and a spacebar.<\/figcaption><\/figure>\n<p>After you&#8217;ve made your selections, exit saving your changes, and run <em>make<\/em>. The build itself will take some time, but when you&#8217;re finished you&#8217;ll have the first key ingredient &#8211; a basic root filesystem embedded into the kernel. This image is essentially a &#8220;Live CD&#8221; that we&#8217;ll use to install our real kernel.<\/p>\n<p>As with all of the images you create, you&#8217;ll find them under ~\/svn\/backfire\/bin\/ar71xx\/ Our newly created image is <strong>openwrt-ar71xx-vmlinux-initramfs.elf<\/strong><\/p>\n<p>Next, we&#8217;ll want to build our actual system. To do this, re-run <em>make menuconfig<\/em> and select the packages that you wish to compile and include in your firmware image. After you&#8217;ve made all of your selections, change your Target Image to squashfs and exit saving your changes.<\/p>\n<figure id=\"attachment_1552\" aria-describedby=\"caption-attachment-1552\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/squashfsbuild.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1552\" title=\"SquashFSBuild\" src=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/squashfsbuild-300x189.png\" alt=\"SquashFSBuild\" width=\"300\" height=\"189\" srcset=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/squashfsbuild-300x189.png 300w, http:\/\/www.braindeadprojects.com\/blog\/wp-content\/squashfsbuild.png 806w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1552\" class=\"wp-caption-text\">Planting a SquashFS Garden<\/figcaption><\/figure>\n<p>A quick <em>make<\/em> later, and we now have a working rootfs and kernel &#8211; in addition to our initramfs to install the system with:<\/p>\n<p><strong><strong>openwrt-ar71xx-vmlinux-initramfs.elf <\/strong><\/strong>(Our temporary kernel)<br \/>\n<strong>openwrt-ar71xx-vmlinux.elf<\/strong> (The kernel)<br \/>\n<strong><\/strong><strong>openwrt-ar71xx-root.squashfs<\/strong> (Our Root Filesystem)<\/p>\n<p>We now have <em>almost<\/em> everything we need.<\/p>\n<figure id=\"attachment_1543\" aria-describedby=\"caption-attachment-1543\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/IMAG0702.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1543\" title=\"InsideTheRouterBoard\" src=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/IMAG0702-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/IMAG0702-300x225.jpg 300w, http:\/\/www.braindeadprojects.com\/blog\/wp-content\/IMAG0702-1024x768.jpg 1024w, http:\/\/www.braindeadprojects.com\/blog\/wp-content\/IMAG0702.jpg 2048w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1543\" class=\"wp-caption-text\">Oh, the sticker says &quot;Warranty Void if Removed&quot;...<\/figcaption><\/figure>\n<p>To install our kernel, we need a few additional tools. First off, we need to configure a <a title=\"ISC DHCP\" href=\"http:\/\/www.isc.org\/software\/dhcp\" target=\"_blank\">DHCP<\/a> server (I&#8217;m using ISC&#8217;s). Here&#8217;s an example from my dhcpd.conf file:<\/p>\n<blockquote><p>authoritative;<br \/>\nddns-update-style interim;<br \/>\nsubnet 192.168.1.0 netmask 255.255.255.0 {<br \/>\nrange 192.168.1.20 192.168.1.40;<br \/>\noption subnet-mask 255.255.255.0;<br \/>\noption routers 192.168.1.1;<br \/>\n}<\/p>\n<p>host routerboard<br \/>\n{<br \/>\nhardware ethernet 00:0c:xx:xx:xx:xx;<br \/>\nfixed-address 192.168.1.17;<br \/>\n}<\/p>\n<p>&nbsp;<\/p><\/blockquote>\n<p>Next, we&#8217;ll need a TFTP server. I prefer <a title=\"ATFTPD\" href=\"http:\/\/freecode.com\/projects\/atftp\" target=\"_blank\">atftpd<\/a>. No configuration is necessary, simply create a directory to serve files from and start the server:<\/p>\n<blockquote><p>mkdir \/tftpboot\/<\/p>\n<p>chmod 777 \/tftpboot\/<\/p>\n<p>atftpd \u2013\u2013daemon \/tftpboot\/<\/p><\/blockquote>\n<p>The only file that has to be loaded via TFTP is the initramfs kernel. Copy it to \/tftpboot with the filename vmlinux and we&#8217;re ready to start.<\/p>\n<blockquote><p>cp ~\/svn\/backfire\/bin\/ar71xx\/openwrt-ar71xx-vmlinux-initramfs.elf\u00a0 \/tftpboot\/vmlinux<\/p><\/blockquote>\n<p>Power up the RouterBoard and quickly press the space bar. Select &#8220;<em>boot over Ethernet<\/em>&#8221; and it will download and boot the linux kernel.<\/p>\n<figure id=\"attachment_1582\" aria-describedby=\"caption-attachment-1582\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/BootEthernet.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1582\" title=\"BootEthernet\" src=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/BootEthernet-300x189.png\" alt=\"BootEthernet\" width=\"300\" height=\"189\" srcset=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/BootEthernet-300x189.png 300w, http:\/\/www.braindeadprojects.com\/blog\/wp-content\/BootEthernet.png 806w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1582\" class=\"wp-caption-text\">Opting to boot via TFTP<\/figcaption><\/figure>\n<p>Next ,we need to install the kernel and root filesystem. Here&#8217;s where I ran into my first problem &#8211; the kernel has no init variable specified so it panics. Thankfully it clearly states this: &#8220;<strong>Kernel panic &#8211; not syncing: No init found.\u00a0 Try passing init= option to kernel.<\/strong>&#8221;<\/p>\n<figure id=\"attachment_1606\" aria-describedby=\"caption-attachment-1606\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/KernelPanic.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1606\" title=\"KernelPanic\" src=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/KernelPanic-300x189.png\" alt=\"KernelPanic\" width=\"300\" height=\"189\" srcset=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/KernelPanic-300x189.png 300w, http:\/\/www.braindeadprojects.com\/blog\/wp-content\/KernelPanic.png 806w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1606\" class=\"wp-caption-text\">Gratitous Image of a Kernel Panic<\/figcaption><\/figure>\n<p>Unfortunately the boot loader doesn&#8217;t appear to allow one to specify command line options for the kernel and I was unable to find a way to set this when configuring the kernel. (I vaguely recall seeing it when compiling for x86, but may be mistaken). Either way, the solution is simple:<\/p>\n<p>Add your kernel parameters to a file (kernel-params in my instance) and use objcopy to insert it into the ELF file:<\/p>\n<p>The options I used are:<\/p>\n<blockquote><p>root=\/dev\/mtdblock2 rootfstype=squashfs,yaffs,jffs2 noinitrd console=ttyS0,115200 init=\/etc\/preinit<\/p><\/blockquote>\n<p>The toolchain supplied with OpenWRT contains a MIPs compatible version of objcopy that will allow you to add a kernel parameters section to the ELF file:<\/p>\n<blockquote><p>cd ~\/svn\/bin\/ar71xx\/<\/p>\n<p>~\/svn\/backfire\/build_dir\/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1\/binutils-2.19.1\/binutils\/objcopy \u2013\u2013add-section kernparm=kernel-params\u00a0openwrt-ar71xx-vmlinux.elf<\/p><\/blockquote>\n<p>To install the kernel, configure an IP on your ethernet\u00a0 (or bridge) interface, mount \/dev\/mtdblock1 and use scp to copy your kernel to the device (as &#8220;kernel&#8221;).<\/p>\n<blockquote><p>ifconfig br-lan 192.168.1.10<\/p>\n<p>mkdir \/mnt\/boot<\/p>\n<p>mount \/dev\/mtdblock1 \/mnt\/boot<\/p>\n<p>cd \/mnt\/boot\/<\/p>\n<p>scp 192.168.1.1:~\/svn\/backfire\/bin\/ar71xx\/openwrt-ar71xx-vmlinux.elf kernel<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>Next, install your squashfs root filesystem to \/dev\/mtdblock2. Unlike the kernel, This shouldn&#8217;t be mounted when installed.<\/p>\n<blockquote><p>cd \/tmp\/<\/p>\n<p>scp 192.168.1.1:~\/svn\/backfire\/bin\/ar71xx\/openwrt-ar71xx-root.squashfs .<\/p>\n<p>cat openwrt-ar71xx-root.squashfs &gt; \/dev\/mtdblock2<\/p><\/blockquote>\n<p>After the root filesystem is installed, reboot the device and welcome to OpenWRT on the RouterBoard 493AH<\/p>\n<figure id=\"attachment_1616\" aria-describedby=\"caption-attachment-1616\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/ItBoots.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1616\" title=\"ItBoots\" src=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/ItBoots-300x189.png\" alt=\"ItBoots\" width=\"300\" height=\"189\" srcset=\"http:\/\/www.braindeadprojects.com\/blog\/wp-content\/ItBoots-300x189.png 300w, http:\/\/www.braindeadprojects.com\/blog\/wp-content\/ItBoots.png 806w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1616\" class=\"wp-caption-text\">It&#39;s Alive!<\/figcaption><\/figure>\n<p>I&#8217;m not quite sure what I&#8217;ll end up doing with the 493AH just yet. The neighborhood wireless system now consists of 2 Engenius EOC2610 units running firmware images based off OpenWRT&#8230; so there may be the potential to add it to the fray.\u00a0 The 9 ethernet ports would make it ideal for a Quagga router (although I already have one). Installing the MikroTik RouterOS and working with MPLS is another options. Right now it sits on my desk at work as a &#8220;pretty cool paperweight with a lot of potential&#8221;.<\/p>\n<p>If you have any suggestions &#8211; please let me know.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently came across a MikroTik RouterBoard 493AH at work. We&#8217;d acquired the device among numerous other pieces of equipment from a now defunct wireless ISP. The 493AH features 9 ethernet ports, can accept POE on its WAN interface, has 64M NAND,\u00a0 128M RAM, and can support 3 mini-PCI cards. Configuration can be performed via &hellip; <a href=\"http:\/\/www.braindeadprojects.com\/blog\/what\/openwrt-on-the-mikrotik-routerboard-493ah\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">OpenWRT on the MikroTik RouterBoard 493AH<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37,38,1,18],"tags":[],"class_list":["post-1536","post","type-post","status-publish","format-standard","hentry","category-mikrotik","category-openwrt","category-what","category-wireless"],"_links":{"self":[{"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/posts\/1536"}],"collection":[{"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/comments?post=1536"}],"version-history":[{"count":89,"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/posts\/1536\/revisions"}],"predecessor-version":[{"id":2099,"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/posts\/1536\/revisions\/2099"}],"wp:attachment":[{"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/media?parent=1536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/categories?post=1536"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.braindeadprojects.com\/blog\/wp-json\/wp\/v2\/tags?post=1536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}