Sunday, December 3, 2017

Installing and using opkg on recent DD-WRT routers

Sometimes you need to extend your dd-wrt router's functionality. As of current Kong builds  (at least 29000 to 34000), this is easy to do using optware and the opkg tool to install packages originally created for Open-Wrt.

But finding instructions to do so is hard. The best that can usually be found are something like this guide, which is largely out of date, and makes it sound much harder than it is. Or this which is likely also out of date and if it were to work would install a bunch of stuff you may not want or need.

All that is necessary in most cases** is:
  1. Enable JFFS under Administration->Management of the web control panel. After rebooting a nonvolatile /jffs partition will be created from flash memory.
  2. Telnet or ssh into your router (log in as root, with your admin user's password)
  3. Now, from the command prompt: make a directory to be used as /opt (where newly installed packages will be stored): mkdir /jffs/opt; mount --bind /jffs/opt
  4. Run bootstrap and say yes to install opkg. This is the well concealed secret. Bootstrap is included on Kong builds in order to install opkg for those who want it.
  5. Run opkg update to update the repository of available packages
  6. To be able to use opkg and installed packages after reboot, you need to add the line mount --bind /jffs/opt /opt to the startup script (under Administration->Management in the web control panel).
Now you have opkg installed and updated and can install packages. You can see the list of available packages by running opkg list and install them by running opkg install pkgname.

Happy opkging! Now you can do fancy stuff like install SSL certificates for your lighttpd web server.

---

Alternatively, rather than using the standard opkg, there's a new project called entware-ng which has more, and more updated applications to run on embedded devices.

To install this (which is in place of the normal opkg), skip step 4. Then follow the instructions here to install on DD-WRT (you could also install /opt on a USB device as explained there, but this is not necessary unless you want many apps or your router has little flash memory). I had luck finding some packages here that weren't available or working in the opkg repository.


* - Kong builds are for routers with ARM/Broadcom chipsets. I don't know about other chipsets or builds, but I wouldn't be surprised if brainslayer or others are building boostrap into their builds as well, so this approach may work for them too.
** - If your router does not have much or any available flash memory to create a jffs partition with, or you want to install many or very large packages, you will need to create a partition for use via USB, and mount it as /opt. Kong's own howto covers this (as well as some more tips on using opkg). The key is that you need a nonvolatile, writable subdirectory /opt, big enough to store what you want to install.

1 comment:

  1. I've read that it isn't good to put that kind of wear and tear on a routers flash chips. This tutorial covers the basics: https://wiki.terrabase.info/index.php?title=Entware_Installation_on_DD-WRT#Hardware

    ReplyDelete