How to Build PyCI and PyCI Firmware Images

PyCI Build Notes

PyCI comes with a build script (build.sh) that compresses and minimizes the PyCI code for use on OpenWRT. To build this embedded/compressed version of PyCI using the build.sh script you have to change some variables in the script (right at the top) to point to the correct file paths on your system. It also requires the following be installed somewhere:

Note: The build.sh script will automatically build the PyCI ipk using your openwrt trunk directory. It also updates the trunk/bin/packages/ar71xx*/Packages.gz file with the latest md5sums.

Once the file paths are configured properly in build.sh it can be executed like so:

riskable@target:~/workspace/routerstation/PyCI $ ./build.sh
YUI Compressing: uncombined/js/1MochiKit.js
YUI Compressing: uncombined/js/2jquery.js
YUI Compressing: uncombined/js/3jquery-ui.js
YUI Compressing: uncombined/js/4jquery.gettext.js
YUI Compressing: uncombined/js/autoresize.jquery.js
YUI Compressing: uncombined/js/eftw.js
YUI Compressing: uncombined/js/fg.menu.js
YUI Compressing: uncombined/js/jquery.asmselect.js
YUI Compressing: uncombined/js/jquery.center.js
YUI Compressing: uncombined/js/jquery.contextmenu.js
YUI Compressing: uncombined/js/jquery.flot.js
YUI Compressing: uncombined/js/jquery.form.js
YUI Compressing: uncombined/js/jquery.scrollTo.js
YUI Compressing: uncombined/js/jquery.selectboxes.js
YUI Compressing: uncombined/js/jquery.tablednd.js
YUI Compressing: uncombined/js/jquery.validate.js
YUI Compressing: uncombined/js/jtip.js
YUI Compressing: uncombined/js/pyci.js
YUI Compressing: uncombined/js/ui.selectmenu.js
YUI Compressing: uncombined/css/fg.menu.css
YUI Compressing: uncombined/css/jquery.asmselect.css
YUI Compressing: uncombined/css/jquery.contextmenu.css
YUI Compressing: uncombined/css/pyci.css
YUI Compressing: uncombined/css/ui.jqgrid.css
YUI Compressing: uncombined/css/ui.selectmenu.css
YUI Compressing: plugins_disabled/preferences/static/js/language.js
YUI Compressing: plugins_enabled/status/static/js/monitors.js
YUI Compressing: plugins_enabled/status/static/js/firewall.js
YUI Compressing: plugins_enabled/system/static/js/hosts.js
YUI Compressing: plugins_enabled/system/static/js/hostname.js
YUI Compressing: plugins_enabled/system/static/js/system_logs.js
YUI Compressing: plugins_enabled/system/static/js/reboot.js
YUI Compressing: plugins_enabled/system/static/js/backup_and_restore.js
YUI Compressing: plugins_enabled/system/static/js/initscripts.js
YUI Compressing: plugins_enabled/system/static/js/users_and_groups.js
YUI Compressing: plugins_enabled/system/static/js/timezone.js
YUI Compressing: plugins_enabled/services/static/js/cron.js
YUI Compressing: plugins_enabled/services/static/js/coova_chilli_status.js
YUI Compressing: plugins_enabled/services/static/js/ntpclient.js
YUI Compressing: plugins_enabled/services/static/js/dropbear.js
YUI Compressing: plugins_enabled/services/static/js/snmp_agent.js
YUI Compressing: plugins_enabled/utilities/static/js/network_tools.js
YUI Compressing: plugins_enabled/utilities/static/js/speed_test.js
YUI Compressing: plugins_enabled/network/static/js/wireless.js
YUI Compressing: plugins_enabled/network/static/js/interfaces.js
YUI Compressing: plugins_enabled/network/static/js/dhcp.js
YUI Compressing: plugins_enabled/network/static/js/firewall.js
YUI Compressing: plugins_enabled/example/static/js/hosts.js
YUI Compressing: plugins_enabled/pyci_settings/static/js/permissions.js
YUI Compressing: plugins_enabled/pyci_settings/static/js/pyci_settings.js
YUI Compressing: plugins_enabled/pyci_settings/static/js/language.js
YUI Compressing: plugins_enabled/pyci_settings/static/js/manage_plugins.js
Creating zip archive for: example
Creating zip archive for: network
Creating zip archive for: pyci_settings
Creating zip archive for: services
Creating zip archive for: status
Creating zip archive for: system
Creating zip archive for: utilities
Creating zip archive for: preferences
YUI Compressing: themes/routerstation/static/css/main.css
YUI Compressing: themes/routerstation/static/css/ie6_or_less.css
YUI Compressing: themes/routerstation/static/css/jquery-ui-1.7.1.danblue.css
YUI Compressing: themes/routerstation/static/js/common.js
Compressing (gzip) static files for theme: routerstation
find: `/home/riskable/workspace/routerstation/PyCI/build/i18n/.svn': No such file or directory
find: `/home/riskable/workspace/routerstation/PyCI/build/i18n/fr_FR/.svn': No such file or directory
Building ipk using: /storage/openwrt-routerstation/openwrt
make[1] package/PyCI/clean
make[2] -C /home/riskable/workspace/routerstation/PyCI/opkg clean
make[1] package/PyCI/compile
make[2] -C package/zlib compile
make[2] -C package/ocf-crypto-headers compile
make[2] -C package/openssl compile
make[2] -C package/libtool host-compile
make[2] -C package/libtool compile
make[2] -C feeds/packages/libs/expat compile
make[2] -C package/libreadline compile
make[2] -C package/ncurses compile
make[2] -C feeds/packages/libs/sqlite3 compile
make[2] -C feeds/packages/libs/libffi compile
make[2] -C feeds/packages/lang/python compile
make[2] -C /home/riskable/workspace/routerstation/pyOpenSSL-0.9-opkg compile
make[2] -C /home/riskable/workspace/routerstation/PyCI/opkg compile
make[1] package/PyCI/install
make[2] -C /home/riskable/workspace/routerstation/PyCI/opkg install
Generating index for package ./base-files_32-r18014_ar71xx.ipk
Generating index for package ./busybox_1.14.4-1_ar71xx.ipk
Generating index for package ./CherryPy_3.1.2-1_ar71xx.ipk
Generating index for package ./ddns-scripts_1.0.0-4_all.ipk
Generating index for package ./dnsmasq_2.50-2_ar71xx.ipk
Generating index for package ./dropbear_0.52-3_ar71xx.ipk
Generating index for package ./firewall_1-8_all.ipk
Generating index for package ./hotplug2_1.0-beta-1_ar71xx.ipk
Generating index for package ./ip_2.6.29-1-1_ar71xx.ipk
Generating index for package ./iptables_1.4.4-2_ar71xx.ipk
Generating index for package ./iptables-mod-conntrack_1.4.4-2_ar71xx.ipk
Generating index for package ./iptables-mod-conntrack-extra_1.4.4-2_ar71xx.ipk
Generating index for package ./iptables-mod-filter_1.4.4-2_ar71xx.ipk
Generating index for package ./iptables-mod-imq_1.4.4-2_ar71xx.ipk
Generating index for package ./iptables-mod-ipopt_1.4.4-2_ar71xx.ipk
Generating index for package ./iptables-mod-nat_1.4.4-2_ar71xx.ipk
Generating index for package ./kernel_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-button-hotplug_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-crc-ccitt_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-input-core_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-input-gpio-buttons_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-input-polldev_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-ipt-conntrack_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-ipt-conntrack-extra_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-ipt-core_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-ipt-filter_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-ipt-imq_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-ipt-ipopt_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-ipt-nat_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-ipt-nathelper_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-leds-gpio_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-ppp_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-pppoe_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-sched_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-textsearch_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-usb2_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-usb-core_2.6.30.8-1_ar71xx.ipk
Generating index for package ./kmod-usb-ohci_2.6.30.8-1_ar71xx.ipk
Generating index for package ./l2sh_0.4-1_ar71xx.ipk
Generating index for package ./l7-protocols_2009-05-28-1_ar71xx.ipk
Generating index for package ./libc_0.9.30.1-32_ar71xx.ipk
Generating index for package ./libcurl_7.19.6-1_ar71xx.ipk
Generating index for package ./libffi_3.0.8-2_ar71xx.ipk
Generating index for package ./libgcc_4.1.2-32_ar71xx.ipk
Generating index for package ./libiptc_1.4.4-2_ar71xx.ipk
Generating index for package ./liblua_5.1.4-5_ar71xx.ipk
Generating index for package ./libopenssl_0.9.8k-2_ar71xx.ipk
Generating index for package ./libpthread_0.9.30.1-32_ar71xx.ipk
Generating index for package ./librt_0.9.30.1-32_ar71xx.ipk
Generating index for package ./libsqlite3_3.6.18-1_ar71xx.ipk
Generating index for package ./libuci_0.7.5-1_ar71xx.ipk
Generating index for package ./libuci-lua_0.7.5-1_ar71xx.ipk
Generating index for package ./libxtables_1.4.4-2_ar71xx.ipk
Generating index for package ./lua_5.1.4-5_ar71xx.ipk
Generating index for package ./miniupnpd_1.3-4_ar71xx.ipk
Generating index for package ./mtd_10_ar71xx.ipk
Generating index for package ./ntpclient_2007_365-2_ar71xx.ipk
Generating index for package ./opkg_215-2_ar71xx.ipk
Generating index for package ./ppp_2.4.4-4_ar71xx.ipk
Generating index for package ./ppp-mod-pppoe_2.4.4-4_ar71xx.ipk
Generating index for package ./PyCI_0.5-1_ar71xx.ipk
Generating index for package ./pycurl_7.19.0-1_ar71xx.ipk
Generating index for package ./pyOpenSSL_0.9-1_ar71xx.ipk
Generating index for package ./python_2.6.1-2_ar71xx.ipk
Generating index for package ./python-mini_2.6.1-2_ar71xx.ipk
Generating index for package ./python-openssl_2.6.1-2_ar71xx.ipk
Generating index for package ./python-sqlite3_2.6.1-2_ar71xx.ipk
Generating index for package ./qos-scripts_1.2.1-2_all.ipk
Generating index for package ./quagga_0.98.6-3_ar71xx.ipk
Generating index for package ./quagga-bgpd_0.98.6-3_ar71xx.ipk
Generating index for package ./quagga-libospf_0.98.6-3_ar71xx.ipk
Generating index for package ./quagga-libzebra_0.98.6-3_ar71xx.ipk
Generating index for package ./quagga-ospfd_0.98.6-3_ar71xx.ipk
Generating index for package ./quagga-ripd_0.98.6-3_ar71xx.ipk
Generating index for package ./tc_2.6.29-1-1_ar71xx.ipk
Generating index for package ./tornado_0.2-1_ar71xx.ipk
Generating index for package ./uci_0.7.5-1_ar71xx.ipk
Generating index for package ./ucitrigger_0.7.5-1_ar71xx.ipk
Generating index for package ./udevtrigger_106-1_ar71xx.ipk
Generating index for package ./wireless-tools_29-4_ar71xx.ipk
Generating index for package ./zlib_1.2.3-5_ar71xx.ipk
SPACE BEFORE: 16M       .
SPACE AFTER: 1.3M       build
IPK SIZE: 793K

The script will place the embedded/compressed version of PyCI in the “build” directory. This directory is used when the ipk file is built.

Firmware Build Notes

To build an OpenWRT firmware image with PyCI you need to perform the following:

  • Checkout OpenWRT trunk: Run this command somewhere there’s at least 9GB of free space (if you haven’t already): svn co svn://svn.openwrt.org/openwrt/trunk/ That will create a directory named, “trunk” that the proceeding instructions refer to.

  • Link the pyOpenSSL opkg: Required if you want to run PyCI in SSL mode. Note: This is not the same as the ‘python-openssl’ package. I’ve included a ‘pyOpenSSL-0.9-opkg’ directory in the source dir but to use it you’ll have to make a link from the openwrt trunk/package directory to that directory. It will auto-download the source just like any other OpenWRT package. Here’s the commands: cd trunk; ln -s /path/to/pyOpenSSL-0.9-opkg package/pyOpenSSL

  • Link l2sh: In the source dir there’s an l2sh directory. In that directory is l2sh itself and an opkg directory containing a Makefile and a hard-link to l2sh.py. Just like pyOpenSSL you’ll need to put a symbolic link in the OpenWRT trunk/package directory to that ‘opkg’ dir. ln -s /path/to/PyCI/l2sh/opkg package/l2sh

  • Link PyCI: Just like the others, in the PyCI source directory there’s an opkg directory. Just put a link to it in the OpenWRT trunk/package directory: ln -s /path/to/PyCI/opkg package/PyCI

  • Setup your .config: If you want a pre-configured .config file there’s one in the PyCI directory named, “pyci_firmware.config” that you can overwrite “trunk/.config” with. This config file has just about everything PyCI supports set to compile into the firmware image itself so it is recommended that you create your own from scratch. Here’s a few tips when you run “make menuconfig”:
    • PyCI is in the Administration section.
    • l2sh is in the Networking section.
    • When you enable PyCI it should auto-enable python, python-openssl, python-sqlite3, and pyOpenSSL but it is a good idea to check in the Languages->Python section to make sure they’re enabled.
    • Since you’re using PyCI you don’t need the busybox httpd server. It is under Base system->Busybox->Configuration->Networking Utilities.