Technical Data

  • 1.2Ghz Marvell Armada CPU ARMADA 370 ARM v7 compliant
  • 802.11b/g/n Wifi with Marvell 88W8787 and Bluetooth 3.0
  • 1GB DDR3
  • 1 GB NAND Flash
  • 2 each 10/100/1000 Ethernet Ports
  • 2 each USB 3.0 host
  • 1 microsd card slot/reader, 1 additional Mini PCIe slot for expansion (internal)
  • For additional 2x2, 3x3, 4x4 WiFi Radios, or 3G modules
  • 3 LED controlled by GPIO, reset button
  • external power supply
  • Port for JTAG and Debugging options

Intro

With a small form factor, low power usage (5 watts), and dual gigabit ethernet ports, 802.11n Wifi, the Mirabox is the perfect platform to put IPFire on to make a home firewall/router.

Installing

I installed IPFire 2.17 RC1 for ARM boards with serial console, http://downloads.ipfire.org/releases/ipfire-2.x/2.17-core87-rc1/ipfire-2.17.1gb-ext4-scon.armv5tel-full-core87-rc1.img.gz

You can get the latest version by going to http://downloads.ipfire.org clicking on the link for the latest version, scrolling down to the arm section and downloading thearmv5tel image for boards with serial console.

Follow the instructions for the GuruPlug, dreamplug to program the SD card, and to connect to the Mirabox's serial console.

I had installed ArchLinux on my Mirabox sometime last year. I can't really remember if I had installed a different version of u-boot then or not, but, whatever version was on it worked fine for IPFire.

You will need a micro SD card (referred to as just SD card in the rest of the document) at least 2 GB in size.

Mirabox Kernel uImage

The uImage file on the SD card image as downloaded from ipfire.org will not boot on the Mirabox. ARM systems require a "Device Tree Blob" or DTB specific the particular CPU and board hardware.

For more info on DTB, see, http://en.wikipedia.org/wiki/Device_tree, and http://events.linuxfoundation.org/sites/events/files/slides/petazzoni-device-tree-dummies.pdf.

You'll need a linux machine for the this step. I used kubuntu 14.04 LTS.

First, if you don't already have the u-boot-tools package installed, install it:
sudo apt-get install u-boot-tools

Next, mount the first partition of SD card on your linux system. Usually, the desktop environment will assist you, but, you can do it manually as follows:

sudo mkdir -p /mnt/sd
mount /dev/sdb1 /mnt/sd

/dev/sdb1 may be different, depending on the number hard drives. Take a look at /proc/partitions to see which device is about the correct size. To be safest, look at /proc/partitions before and after connectioning the SD card to your system.

Once mounted cd to /mnt/sd to run the following commands:

cat zImage-ipfire-multi dtb-3.14.30-ipfire-multi/armada-370-mirabox.dtb  >zImage
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n "Linux kernel" -d zImage uImage

Now, unmount the SD card before removing it from your system.

umount /mnt/sd

Insert the SD card into the micro SD card slot of your Mirabox. As outlined in the installation link, above, connect a mini-B USB cable from mini-B connector on your Mirabox to a USB connector on your PC. You'll need a terminal program of some sort (minicom on Linux to /dev/ttyUSB0) set for 115k,8,n,1 with flow control turned off.

UBoot Configuration

(under construction -- I gotta run, but, will continue writing this soon, next step will be detailed uBoot configuration, for now, I'll just list the important settings)

These are the commands you need to enter. It may be worth it to run printenv before you do this to see what things like bootcmd are set to before you start.

setenv bootcmd "run bootcmd_mmc"
setenv bootargs_mmc "setenv bootargs console=ttyS0,115200 root=/dev/sdb2 rw rootwait"
setenv setmac "mw.l 0xD0072414 0xa513; mw.l 0xD0072418 0xF0AD4E01; mw.l 0xD0076414 0xa514; mw.l 0xD0076418 0xF0AD4E01"
setenv bootcmd_mmc "run setmac;usb start; fatload usb 1 0x6400000 uImage; run bootargs_mmc; bootm 0x6400000"

Use saveenv to make this config. permanent. Use printenv to see your current config.

Once you've set everything up you should be able to run boot to boot using this configuration. If you do this without running saveenv your settings will be lost the next time you boot the mirabox.

Note!
I changed the partition table on my SD card to make the 2nd partition #2, so that I could use the same boot parameters as for my ArchLinux SD card. If you use the SD card as created, you'll want to use root=/dev/sdb3 in the boot_mmc variable.

MAC (Ethernet Hardware) Address Configuration

IPFire doesn't get a permanent hardware address for the ethernet ports w/o some help.

I found a fix here: 196688.html

The setmac environment variable in the previous section fixes that, and is called (run setmac) in the bootcmd environment variable.

The MAC address is set with two "mw.l" commands for each Ethernet NIC. The first argument to the mw.l command is a memory address, the second is the data. These first two commands set the MAC for eth0 to F0:AD:4E:01:a5:13,

mw.l 0xD0072418 0xF0AD4E01;
mw.l 0xD0072414 0xa513;

The next two commands set the MAC for eth0 to F0:AD:4E:01:a5:14

mw.l 0xD0076418 0xF0AD4E01
mw.l 0xD0076414 0xa514;

Caveats

My 2014 Macbook Pro (running 10.9.5) using the Thunderbolt Ethernet interface won't pick up an IP address from DHCP my IPFire/Mirabox, even though my Linux VM on the same computer will, and my 2011 Macbook Air (running 10.10.x) will as well.

Oddly, if I I configure it (the Macbook Pro) for DHCP with Manual address, it DOES pick up the gateway and DNS information from the DHCP server.

EDIT: This is likely a Mavericks (OSX) / Thunderbolt Ethernet problem (and not IPFire). A possible solution: http://pankajmalhotra.com/ARP-and-ethernet-issues-with-osx-mavericks/

I'll update this document as I find out more.

I haven't tried WiFi out on the Mirabox yet. I've got other, dedicated wiresless access points on my network, and am planning on using this as firewall only. There are no external antennae on the Mirabox, so, I don't have high hopes for good range with it anyway. After I get the DHCP problem resolved, I'll try out the WiFi.

Future Enhancements

  • Resolve the DHCP problem that happens with some Mac OS X computers
  • WiFi -- try it, get it working.

Summary

Once I resolve the DHCP issue, I will put this IPFire Mirabox into service to replace my 9 year old Linksys WRT54GL w/ DD-WRT.

Supplement

---macxcool 2017/04/05 23:29

I had to set the root partition to /dev/mmcblk0p3 to get things to work, so:

setenv bootargs_mmc "setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p3 rw rootwait"

If you have the boot files on /dev/mmcblk0p1 and the ipfire filesystem on /dev/mmcblk0p3 then you need to use mmc with the fatload command and you don't really need usb start, so:

setenv bootcmd_mmc "run setmac; fatload mmc 0:1 0x6400000 uImage; run bootargs_mmc; bootm 0x6400000"

I'm having an interesting problem, though. If I run the above commands manually, everything works fine and IPFire boots and works beautifully. If the system runs the fatload and bootm commands as part of the boot process, I get errors and the sequence fails. I also sometimes have to run mmcinfo before the fatload command, I think to initialize the mmc subsystem. I've included that command in my boot sequence.

The solution to that problem, which I just discovered (April 10, 2017) is to load the image and boot from it directly instead of calling those commands from an environment variable. Here's my final, working list of commands.

setenv bootargs_mmc "setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p3 rw rootwait"
setenv setmac "mw.l 0xD0072414 0x24A5;mw.l 0xD0072418 0xF0AD4E03;mw.l 0xD0076414 0x24A6;mw.l 0xD0076418 0xF0AD4E03"
setenv bootcmd_mmc "mmcinfo;run setmac;run bootargs_mmc"
setenv bootcmd "run bootcmd_mmc;fatload mmc 0:1 0x6400000 uImage;bootm 0x6400000"