OpenWrt Forum Archive

Topic: Help! How to include a custom ipk in OpenWrt build

The content of this topic has been archived on 26 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I'm working with a customized openwrt buildroot to build firmware images for a custom router that my company is helping to develop. I've been able to get the whole buildroot working and flashed on our hardware. Additionally, we developed a custom .ipk (without using any openwrt tools) for some additional software, and have had no trouble installing it using opkg. However, now I need to have the .ipk included in the OpenWrt build, so that our software is built into the image that I flash to our router. We do have internal development reasons for wanting to have the package built separately instead of having OpenWrt build it from source.

Is there any easy way to include a prepackaged ipk into the build, perhaps using the feeds framework?

I've been able to find several examples of how to add a package feed, but it seems that the instructions are always in the context of downloading source to be built by the openwrt system into an .ipk and then installed. Perhaps I could make an OpenWrt makefile for our package that essentially skips the compile and packaging steps and just installs the package to the filesystem? I'm sorry if these questions are ill formed; I'm still trying to grasp exactly how OpenWrt goes about the process of making and installing packages. My current understanding is:
Install packages (openwrt makefile andpatches) in feeds --> magic --> package source downloaded according to openwrt makefile--> more magic --> package source compiled --> ??? --> package made into .ipk --> ??? --> .ipk installed onto filesystem --> filesystem image built --> Profit.

I'd really love to have a better understanding of this process (which makefiles control the process?), but I can't find it well documented anywhere, and have had a bit of trouble finding my way through the maze of makefiles and includes.

Easiest might be to just the include the files to be installed.

You can place anything you like in <buildroot>/files, and those files will override any existing files in the final firmware.
See http://wiki.openwrt.org/doc/howto/build#custom.files

That approach would be possible if you just want to place a few binary executables or settings files.

Awesome, thanks for the reply and tip, hnyman. I can use that as a fallback if I don't figure out how to install the .ipk directly. But there is a fairly large number of files that are installed by the package, and the package is being actively developed, so it would be much easier for me to have the package installed by the build process.

It seems like the build process builds all the packages into .ipk's at some point, and then at some other point installs them onto the filesystem. Since I already have an .ipk for my package, it seems like it should be possible to put it with all the other ones, and have it installed along with them. But that doesn't seem to work, so there is probably a autogenerated list of packages to be installed somewhere.

Do you know anything about the ipk installation process? Or have any other ideas?

For now, I'm trying to write an Openwrt makefile that has custom compile instructions that don't do anything except move the files into the correct place. But, I don't really know exactly where that is yet.

(Last edited by newton on 4 Sep 2014, 17:46)

The installation steps done by the normal package installation into firmware image are here:
https://dev.openwrt.org/browser/trunk/p … kefile#L93

In essence, the package-specific steps are usually defined in the Makefile and are (to my knowledge) included in the .ipk. If you create your package outside Openwrt buildroot, I am not sure how that works out.

EDIT:
Regarding the Makefile just copying files, you could probably use this as an example:
https://dev.openwrt.org/browser/branche … a/Makefile

In practice, you need just to define an empty /compile section and a custom /install section, where you do the copying actions.

Also base-files has probably lots of examples of more exotic install actions.
https://dev.openwrt.org/browser/trunk/p … kefile#L85

EDIT2:
Practically everything gets copied to <buildroot>/staging_dir/target-mips_34kc_uClibc-0.9.33.2/root-ar71xx before the final firmware image gets built (example for trunk ar71xx routers).

(Last edited by hnyman on 4 Sep 2014, 18:09)

The discussion might have continued from here.