See Also
Ejscript for the OpenWrt Platform
This document describes the process to
build Ejscript for the OpenWrt platform. For other platforms and generic build instructions, please read
Building from Source Code.
Background
OpenWrt is a Linux project to create downloadable replacement firmware for consumer communications and storage devices. It supports devices such as the Linksys WRT54G router and the Linksys NSLU2 storage device.
The OpenWrt project provides a highly configurable environment with an active development forum. Most code in OpenWrt is based on a GPL license. For more information about OpenWrt, please consult: Wikipedia OpenWrt, and NSLU2-Linux Home Page.
Prerequisites
You will need the following components:
- Linux development system
- OpenWrt
- Ejscript source package (this will be automatically downloaded by OpenWrt)
Steps
- Download OpenWrt.
svn checkout svn://svn.openwrt.org/openwrt/trunk kamikaze
Please read OpenWrt Documentation and Getting Source for full details.
-
Check out the package/ejs/Makefile.
cd packages svn co svn://svn.openwrt.org/openwrt/packages/ejs cd ..
- Configure the OpenWrt Linux kernel.
make menuconfig
- Select Languages and enable Ejscript. You can either build Ejscript into the base system or build it
as a loadable and installable package. Select "*" to integrate into the base system or "M" to build a
package.
You also have options to install various components of Ejscript. These options are:
- ejs — The Ejscript command shell program (ejs)
- ejsc — The Ejscript compiler. You can choose to not enable this and do all your compilation on the build development system (cross-compilation)
- ejstools — Ejscript includes a documentation generator and disassembler tool as well as a SQLite command line too. These are normally not installed on the target host.
- ejsweb — The Ejscript Web Framework and ejsweb application generator and manager program.
- ejscgi — Select if you want to run Ejscript via CGI from a web server.
- ejswebserver — Select if you want to install the Ejscript embedded Appweb web server.
Select your desired options and then exit and save your configuration. You are given the option to save on exit.
- Build the OpenWrt Linux kernel.
make
- Flash the OpenWrt firmware to your device. This is highly device specific and you need to consult the OpenWrt and your device documentation. The new firmware can be found under the bin directory.
- If you build Ejscript as a package, it will be built as bin/packages/*/ejs*.ipk. You wll
need to install on your target by logging onto your device using ssh and then typing:
opkg install http://url_to_ejs_package"
Configuration
The ejs source tree is built under the build_dir/*/ejs* directory. Ejscript saves the OpenWrt configuration so that you can use make at any time inside the Ejscript source tree. WARNING: If you modify the OpenWrt package/ejs/Makefile, OpenWrt will remove the Ejscript source and re-download and extract the source code. So save any changes you make!
The Ejscript configuration for OpenWrt includes: Ejscript, Sqlite, Regular Expressions, Authentication, Directory Listings, HTTP client, ranged and chunked transfers, error logging and file upload. You can modify this configuration by editing the configure command in OpenWrt packages/ejs/Makefile and the run make or make package/ejs/compile if you are selected to build Ejscript as a package.