Broadband-Hamnet™ Forum :: General
Welcome Guest   [Register]  [Login]
 Subject :so you want to be a firmware developer?.. 2010-10-13- 01:54:27 
k5osx
Member
Joined: 2010-09-18- 23:38:56
Posts: 16
Location

Someone asked, on a mail list I'm on, how to get started doing firmware development for hsmm-mesh. I thought I'd post my reply here.

It is probably easiest to approach firmware development for your linksys routers using the hsmm-mesh software. One problem that I've experienced with openWRT is that the latest software available in any particular release (either backfire or kamikaze) isn't guaranteed to work on the routers that I'm using. In contrast, the hsmm-mesh software will work with your linksys routers. So, using the hsmm-mesh source development environment, you won't get a headache finding a tree that will both build and work.

There is some developer documentation for hsmm-mesh available here: http://hsmm-mesh.org/developer-documentation.html. One of the first things that you'll need is access to the svn repository for hsmm-mesh, which is described here: http://hsmm-mesh.org/developer-documentation/86-svnrepos.html. You should probably request both an account/password and a branch. That way, once you get the hang of things, you can submit modifications to the svn repository. ad5oo reviews changes on developer branches before merging them into the main trunk.

Besides working with a code tree that is known to work on the linksys routers, the svn repository also includes a binary cross compiler toolchain (eg, gcc, linker, librariest, etc). When you work with the openWRT svn repository, the cross compiler environment is built entirely from source. In a sense, openWRT is a linux distribution for which you build everything; in contrast, when you installed debian on your computer, the distribution included all the binaries required for the install.

(As an aside, if you are interested in tutorial on building linux, rather than openWRT, from scratch, I'd encourage you to look at http://www.linuxfromscratch.org. There are several different subprojects on this website ranging from the most basic (LFS) to a cross compiler environment (CLFS) which you could use, say, to build linux on an intel system for installation on MIPS processor. But, linuxfromscratch is not openWRT. It can be a good introduction to building software and describes many things that are handled automatically by the openWRT build environment such as:

  • why a cross compiler build environment is necessary
  • introduction to utilities that openWRT uses, such as busybox
  • what needs to change in the build process for an embedded environment as opposed to on a desktop system

Again, linuxfromscratch isn't openWRT and can't be installed on your routers.)

After you download hsmm-mesh from the svn repository, you can build your own hsmm-mesh firmware. With all the pre-compiled tools, software packages, and kernel, the build takes little time. http://hsmm-mesh.org/developer-documentation/87-using-the-imagebuilder.html describes how to do this. (Note that the hsmm-mesh development environment comes with a 'make' perl script, and must be invoked using "./make". Without that '.' you will invoke your system's 'make' binary, and you will not end up with firmware that you can install on your router.

Once you've built your own hsmm-mesh software, and have become familiar with the configuration environment on the router (say, to cause your routers to provide a smaller number of dhcp addresses on the LAN ports where the default is 190), you could modify the hsmm-mesh build environment on your debian system to limit the number of allocated IP addresses to 10 say. In my local tree, the dhcp limit is specified in a number of files:

myhost:etc k5osx$ pwd
/Users/k5osx/HSMM/trunk/files/etc
myhost:etc k5osx$ grep dhcp_limit config*/_setup{,.default}
config.ap/_setup:dhcp_limit = 190
config.client/_setup:dhcp_limit = 190
config.mesh/_setup:dhcp_limit = 190
config.mesh_ap/_setup:dhcp_limit = 190
config.router/_setup:dhcp_limit = 190
config.ap/_setup.default:dhcp_limit = 190
config.client/_setup.default:dhcp_limit = 190
config.mesh/_setup.default:dhcp_limit = 190
config.mesh_ap/_setup.default:dhcp_limit = 190
config.router/_setup.default:dhcp_limit = 190
myhost:etc k5osx$

So, to implement this change, I'd modify the above files and set the limit to 10, and then rebuild the software, and then if my router was ever used at an MRC POD, I might cause some consternation if a switch was ever connected to my router's LAN port, because a max of 10 IP addresses would be allocated by the DHCP daemon. (There are multiple config directories because the routers can be used in different modes, such as an AP, or a mesh node, etc.)

Once you've played with modifying the hsmm-mesh configuration somewhat, you might consider adding your own binaries to the files directory. For example, on a unix system, I often use the 'view' command to give me read-only access to text files. I've been using the vi editor for a long time, and i prefer to look at some files using vi rather than the 'more' or 'less' commands. The 'view' command is simply an invocation of vi with the -R option. So, I created a little script files/bin/view:

myhost:~ k5osx$ cat view
#!/bin/ash
exec /usr/bin/vi -R  $@
myhost:~ k5osx$

Now, when I build hsmm-mesh firmware, my routers always have a 'view' command that does what I expect, rather than a busybox shell that goes "hunh unh." (Now, if I could just get ash to understand what !$ means when used on a command line.)

From there, you might want to install some additional openWRT packages in your default hsmm-mesh build, or perhaps modify the existing packages in some way. To do that, you'll need to build openWRT from source, but i'll leave that tale for another time.

robert

IP Logged
Page # 


Powered by ccBoard


SPONSORED AD: