Optional packages and feeds

I am looking for a way to install an optional package via opkg command on OpenWRT. My questions are:

  1. What do I need to do so that the router's feeds (/etc/opkg/distfeeds.conf and /etc/opkg/customfeeds.conf) contains the correct URL to my package ?
  • In case my package is stored somewhere on the router's disk (e.g. /usr/bin/backup/helloworld folder) ?
  • In case my package is stored on the Internet (e.g. http://www.abc.com/helloworld).
  1. What exactly should be stored in the locations that the feed points to, and how do I generate it ?

As a background:

I have created my own "helloworld" package, and when I "make menuconfig" with my package selected then “make”, I could see my application included in the firmware.

However, after doing a: "opkg remove helloworld" on the target device (i.e. Virtual Box VDI on x86), my helloworld package got removed from the disk. I tried later to "opkg install helloworld" but it doesn't come back.

After some research on opkg, I noticed that it stores the feeds for optional package in /etc/opkg/distfeeds.conf and /etc/opkg/customfeeds.conf. And in this file, it has the feed to my package as: https://download.openwrt.org/snapshots/packages/x86_64/helloworld which does not have my package.

Note that to be able to make my helloworld package, I've manually edited feeds.conf.default in the openWrt development environment to add a line to my package as follows (for ./scripts/feeds update -a and ./scripts/feeds install -a to work):

src-link mypackages /home/xyz/coding/buildbot/helloworld

but this line doesn't show up anywhere in the feeds files of the router (i.e. /etc/opkg/distfeeds.conf and /etc/opkg/customfeeds.conf).

Thanks a lot for your help.

find /rom -name helloworld

If I am not mistaken, that command is just to find the program "helloworld". I don't see how it's related to my questions.

Why do you need opkg to re-install your helloworld program?

Helloworld exists in your firmware. Just copy the package components from /rom to /. No need to use opkg.

Or if you really want to use opkg, scp your helloworld.ipk from your <buildroot>/bin/packages/<target> folder to your router tmp folder and opkg install it from there.

Thanks RuralRoots.

I asked the question from a theoretical perspective: What to do if I want to be able to install my program as an Optional package. In "make menuconfig", if you select the "M" option, I think it will not include my HelloWorld in the firmware. So in such a case, how can I install it later.

check my repo for a reference:

In the Makefile, the define Package/serial2mqtt/install tells the files location when you install it.

For most packages and features, you have three options: y, m, n which are represented as follows:

  • pressing y sets the <*> built-in label
    This package will be compiled and included in the firmware image file.

  • pressing m sets the <M> package label
    This package will be compiled, but not included in the firmware image file, e.g. to be installed with opkg after flashing the firmware image file to the device.

  • pressing n sets the < > excluded label
    The source code will not be processed.