Meraki - OpenWRT/Kamikaze - Cross-Compiling


The first half of this page will describe how to cross-compile a C program for the Meraki Mini. The second half will describe how to build your own OpenWRT/Kamikaze SDK. This shortcut is based on this website with the following license.

Cross-Compiling a C Program for the Meraki

First download and unpack our local copy of the OpenWRT/Kamikaze SDK tarball.
	% tar zxvf OpenWrt-SDK-atheros-2.6-for-Linux-i686-UCB.tar.gz2
	% cd OpenWrt-SDK-atheros-2.6-for-Linux-i686
	% ls
	Makefile  README.SDK  bin  build_mips  dl  docs  include
	package  scripts  staging_dir_mips  tmp
The subdirectory package is where you will place your C program. The subdirectoy build_mips is where you will find a binary after a sucessful cross-compile. The directory structure of package is displayed below. You will have to create everything in YourProgDir.
        package ---+
	         Makefile (OpenWRT's)
		 YourProgDir ---+
			      Makefile (1)
			       src ---+
				    Makefile (2)
I borrowed the Makefile (1) necessary to create your package. Place it in the root directory for your program. Using an editor, issue a global change of YourProgName with the name of your program/package.

The Makefile (2) for the src directory looks like a standard Makefile, but I have included a copy to make it a little easier ... I hope. Just as you did for the first Makefile, change all references of YourProgName to your program/package name.

Next, issue a make V=99. If it is successful, you will find the binary in the build_mips subdirectory. You can now copy this binary to your Meraki.

        build_mips ---+
		    YourProgName ---+
				 YourProgName (binary)
ipk files are also created and can be found in the bin/packages subdirectory.

Creating a SDK

The kamikaze SDK created by OpenWRT was made for 64-bit systems. If you don't have a 64-bit system/OS, you will need to rebuild the SDK. These instructions are more or less borrowed from the same source as above.

First, download the kamikaze tarball and unpack it. Next, cd into it and issue a make menuconfig. Select all the modules and options you need and exit. Finally, issue a make ... this may take a long time so you should go read the Iliad ... twice ... and by the time you are done, the compile should be done too. The SDK should be in the bin directory. Copy it to where you want to use it and follow the directions above for cross-compiling a C program.

NOTE: If you are not using the SDK tarball we have provided in the first half of this page and have decided to create your own, you will need to update the main Makefile before you can use the SDK.

Unfortunately, the kamikaze tarball creates a Makefile that doesn't quite work properly in the SDK. Simply replace the Makefile in the root directory of the SDK with this Makefile.

        % tar zxvf kamikaze_7.09_UCB.tar.gz
	% cd kamikaze_7.09
	% make menuconfig

	<do some stuff>

	% make

	<wait a loooong time>

	% cp bin/OpenWrt-SDK-atheros-2.6-for-Linux-i686.tar.bz2 ~/
	% cd ~
	% tar zxvf OpenWrt-SDK-atheros-2.6-for-Linux-i686.tar.bz2
	% cd OpenWrt-SDK-atheros-2.6-for-Linux-i686
	% cp TheNewMakefile Makefile

	<Follow directions above to cross-compile>

  This material is based upon work supported by the National Science Foundation under grants #0435454 and #0454432, and the NSF Graduate Research Fellowship Program. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.