Archive of December 2010

Sun 12 Dec

On making a minified Click Modular Router driver for OpenWRT

My group is using the Click Modular Router for a project we're doing. We've written several custom elements for our configuration, and we're attempting to run it on space-constrained devices, Ubiquiti NanoStation M5's that have only 4MB of ROM. Thus, we need to build a minified version of Click that includes only the elements we actually use. You can do this by specifying a series of elements to to the click-mkminidriver in the form "-E -E ... ". To extract the elements we're actually using in our Click configuration files, we can use this bash script from our configurations directory:

cat *.click | tr ' ' '\n' | tr '(' '\n' | egrep "^[A-Z]" | grep "[a-z]$" | sort | uniq | sed "s/^/ -E /g "

Note that this assumes that all your Click elements begin with an upper-case letter. Fortunately, it's simple to remove false positives.

· Tags: , ,