| 1 | [[PageOutline]] |
| 2 | |
| 3 | = OpenWrt Package management = |
| 4 | OpenWrt uses a package management system for installing/removing/updating packages. The application used is 'opkg' and the package files have a '.ipk' extension. |
| 5 | |
| 6 | = OpenWrt Package feeds = |
| 7 | The opkg application has a configuration file on the target at /etc/opkg.conf which is used to point to and describe various package feeds. Often it is useful to add a package feed that points to your development host's OpenWrt bin directory with an HTTP server behind it. |
| 8 | |
| 9 | For example, if your OpenWrt development host is at 192.168.1.10 and on the same IP network as your target board you can install something like the 'lightthpd' HTTP server with the following at the end of its config file in /etc/lighttpd/lighttpd.conf: |
| 10 | {{{ |
| 11 | |
| 12 | alias.url += ( |
| 13 | "/openwrt" => "/home/openwrt/gateworks/trunk/bin", |
| 14 | ) |
| 15 | }}} |
| 16 | |
| 17 | Your target board could have an opkg.conf file that looked like (for the laguna family which uses the cns3xxx architecture): |
| 18 | {{{ |
| 19 | src/gz local http://192.168.1.10/openwrt/cns3xxx/packages |
| 20 | dest root / |
| 21 | dest ram /tmp |
| 22 | lists_dir ext /var/opkg-lists |
| 23 | option overlay_root /overlay |
| 24 | }}} |
| 25 | |
| 26 | Now on your target board you could do things like: |
| 27 | {{{ |
| 28 | opkg update |
| 29 | opkg install <mypackage> |
| 30 | }}} |
| 31 | |
| 32 | For further reference: |
| 33 | * http://wiki.openwrt.org/doc/devel/feeds |
| 34 | * http://wiki.openwrt.org/doc/techref/opkg |
| 35 | |
| 36 | == Troubleshooting == |
| 37 | |
| 38 | A common error to see is the following when doing opkg update. The solution is to modify the opkg.conf file to point to the IP of your OpenWrt development host PC as described above. |
| 39 | {{{ |
| 40 | root@OpenWrt:~# opkg update |
| 41 | Downloading http://downloads.openwrt.org/snapshots/trunk/cns3xxx/packages/Packages.gz. |
| 42 | wget: server returned error: HTTP/1.1 404 Not Found |
| 43 | Collected errors: |
| 44 | * opkg_download: Failed to download http://downloads.openwrt.org/snapshots/trunk/cns3xxx/packages/Packages.gz, wget returned 1. |
| 45 | }}} |
| 46 | |
| 47 | = Building OpenWrt packages = |
| 48 | For custom software applications you can create OpenWrt package feeds (which are directories of packages) by adding them to the feed config file in the OpenWrt 'trunk' directory feeds.conf.default. The following would add a local package feed pointing to a directory on the same development host: |
| 49 | {{{ |
| 50 | src-link local /home/openwrt/mypackages |
| 51 | }}} |
| 52 | |
| 53 | Within the /home/openwrt/mypackages directory, you can have directories of packages, each having a Makefile describing the package (see http://wiki.openwrt.org/doc/devel/packages). Now you can use the following to 'install' a package into the OpenWrt build system: |
| 54 | {{{ |
| 55 | ./scripts/feeds update local ;# update the package feed named 'local' from its source |
| 56 | ./scripts/feeds install <mypackage> ;# install 'mypackage' into OpenWrt package directory (/packages/feeds/local) |
| 57 | }}} |
| 58 | |
| 59 | Once your package has been 'installed' in the OpenWrt package directory (packages) you can use 'make menuconfig' to enable/disable the package to be built and/or installed on the root filesystem |
| 60 | |
| 61 | For more reference: |
| 62 | * http://wiki.openwrt.org/doc/devel/packages |
| 63 | * http://wiki.openwrt.org/doc/devel/feeds |
| 64 | |
| 65 | = Compiling IPK Files = |
| 66 | [wiki:ipkupload See link here] |