KLone and OpenWRT

babongo edited this page Oct 8, 2012 · 1 revision

KLone and OpenWRT

This howto is intended for developers who want to integrate their own Klone web application into OpenWrt build environment.

All information applies to OpenWrt Kamikaze, newer version will probably work.

HelloWorld

Download the source and unpack the archive in the root directory of the OpenWrt SDK:

$ tar zxvf klone-wrt-1.0.0.tar.gz

The archive creates the directory package/klone that contains all KLone related files and folders.

Run make menuconfig and select the KLone package in the Network section.

Rebuild the firmware with make or just KLone with make package/klone-compile.

If OpenSSL is enabled Klone will try to build the HTTP/S server; in that case you need to patch package/openssl/Makefile to be sure that no-ripemd is NOT set in the OPENSSL_NO_CIPHERS variable.

Copy the KLone package in /bin/packages/klone* on your device and install it.

Now run the server running kloned.

Customization

The Makefile in package/klone is the glue with the buildroot environment. It contains the description of the webapp, dependencies and compilation instructions.

The webapp/ folder is the filesystem that will be embedded into kloned (the KLone daemon) and contains - in webapp/www - all static (.html, *.gif, etc.) and dynamic (.kl1) web pages.

The configuration file is also into the embedded filesystem: webapp/etc/kloned.conf.

Once compiled you can override embedded configuration parameters using -f command line option.

During compilation everything found in webapp will be compiled and linked to Klone’s internal HTTP[/S] server.

You can specify compilation flags and additional libraries in the Makefile.klone file. The variables are WEBAPP_CFLAGS, WEBAPP_LDADD (for static libraries) and WEBAPP_LDFLAGS (for shared libs).

The mymisc/ directory is a preconfigured directory where you can put your custom C code. The utility library will be linked automatically to the web server so you can call any function in mymisc library from dynamic pages in webdir/www/*.kl1.

So to customize the basic web application you have to create new pages in webapp/www/ and support code in mymisc/.

Run make klone-compile to rebuild the package.

More info on KoanLogic site: http://koanlogic.com/