wiki:OpenWrt/Packages

Version 8 (modified by Cale Collins, 5 years ago) ( diff )

fixed grammar

OpenWrt Package Management

OpenWrt uses a package management system for installing/removing/updating packages. The application used is 'opkg' and the package files have a '.ipk' extension.

OpenWrt Package Recommendations

IMPORTANT - Please Read

  • Gateworks OpenWrt by default comes with a select number of packages that are commonly used. It is expected that customers may need more packages than what are already installed by default.
  • Gateworks recommends their customers to build the Gateworks OpenWrt BSP and compile the packages they need using the 'make menuconfig' command discussed in these customizing instructions.
  • A less involved alternative could be to compile individual packages discussed here
  • Using the opkg command to install new packages from a repository is the most common method, however, there are a few caveats:
    • The Gateworks OpenWrt package repository has a limited number of packages available
    • Using packages from downloads.openwrt.org is not recommended. It may contain packages that were built for a version of OpenWrt other than the one installed, some packages may have missing dependencies.

OpenWrt Package feeds

The opkg application has a configuration file on the target at /etc/opkg.conf (this is the only configuration file) 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.

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:

alias.url += (
  "/openwrt" => "/home/openwrt/gateworks/trunk/bin",
)

Your target board could have an opkg.conf file that looked like (for the laguna family which uses the cns3xxx architecture):

src/gz local http://192.168.1.10/openwrt/cns3xxx/packages
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay

Another example:


src/gz snapshots http://dev.gateworks.com/openwrt/16.02/imx6/packages/packages/
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay

Now on your target board you could do things like:

opkg update
opkg install <mypackage>

For further reference:

Troubleshooting

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.

root@OpenWrt:~# opkg update
Downloading http://downloads.openwrt.org/snapshots/trunk/cns3xxx/packages/Packages.gz.
wget: server returned error: HTTP/1.1 404 Not Found
Collected errors:
 * opkg_download: Failed to download http://downloads.openwrt.org/snapshots/trunk/cns3xxx/packages/Packages.gz, wget returned 1.

Building OpenWrt packages

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:

src-link local /home/openwrt/mypackages

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:

./scripts/feeds update local  ;# update the package feed named 'local' from its source
./scripts/feeds install <mypackage>  ;# install 'mypackage' into OpenWrt package directory (/packages/feeds/local)

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

For more reference:

Compiling IPK Files

See link here

Note: See TracWiki for help on using the wiki.