Packages from DEVICE_PACKAGES are missing from master build

picking up from comments on commit

Building for WR710N, USB is dead...but the public image works fine...

First I thought something is wrong with DTS or GPIOs but rather it is packages related...

makefile has
DEVICE_PACKAGES := kmod-usb-chipidea2 kmod-usb-ledtrig-usbport

After build, IPKs are in packages folder

pi@SDDesk:~/builds/github-openwrt/wr710-stable-clean2/packages $ ls | grep usb
kmod-usb-chipidea2_4.14.180-1_mips_24kc.ipk
kmod-usb-chipidea_4.14.180-1_mips_24kc.ipk
kmod-usb-core_4.14.180-1_mips_24kc.ipk
kmod-usb-ehci_4.14.180-1_mips_24kc.ipk
kmod-usb-ledtrig-usbport_4.14.180-1_mips_24kc.ipk
kmod-usb-phy-nop_4.14.180-1_mips_24kc.ipk

But nothing in config.buildinfo...
pi@SDDesk:~/builds/github-openwrt/wr710-stable-clean2 $ cat config.buildinfo | grep usb

I do not mess with build config very much, my build process is pretty simple...

EDIT: I built in master first and there is the problem. I thought it was happening in stable too because it is not in config.buildinfo, but the packages are there when building stable...

git checkout -b wr710
git reset --hard v19.07.3
scripts/feeds update -a
scripts/feeds install -a
git status
make clean
rm .config
make defconfig
make menuconfig # do profile, add some other packages, save
cp .config ../backup-xyz.config
scripts/diffconfig.sh > ../backup-xyz.diffconfig
nohup time make &

Adrian mentioned the config value CONFIG_TARGET_PER_DEVICE_ROOTFS
this does not exist in .config at all, not even commented...

Actually even though it is never in config.buildinfo, it is still in the image when I build in stable...

When I built on master is when I saw the issue first...

There is differences between the configs between stable and master

pi@SDDesk:~/builds/github-openwrt $ cat wr710-master-clean.config | grep kmod-usb-chipidea2
CONFIG_DEFAULT_kmod-usb-chipidea2=y
# CONFIG_PACKAGE_kmod-usb-chipidea2 is not set
pi@SDDesk:~/builds/github-openwrt $ cat wr710-stable-clean.config | grep kmod-usb-chipidea2
CONFIG_DEFAULT_kmod-usb-chipidea2=y
CONFIG_PACKAGE_kmod-usb-chipidea2=y

CONFIG_TARGET_PER_DEVICE_ROOTFS=y

is in config.buildinfo for buildbots

It's selected by CONFIG_BUILDBOT=y for most targets (i.e. all targets that that use CONFIG_TARGET_MULTI_PROFILE=y for the buildbots).

I didn't look into your particular configuration, I just remembered you posting that packages aren't selected for your build, while they were for snapshots.

Building with CONFIG_TARGET_MULTI_PROFILE=y but without CONFIG_TARGET_PER_DEVICE_ROOTFS is a common "mistake" where this will be the case, as without rootfs assembled per target there is no way to account for per-device DEVICE_PACKAGES.

If that doesn't apply to you, just ignore my comment.

Ok so I can confirm that:

public stable images have the packages
public snapshot images have the packages
building on stable: image has the packages
building on master: image does not

I only build for 1 device profile at a time...and made sure I had a clean config

CONFIG_TARGET_PER_DEVICE_ROOTFS is not in either .config nor config.buildinfo

The other two are commented out in .config and not found in config.buildinfo

I can also confirm that the IPKs are not in the package folder after building on master

here is my .config with comments removed

CONFIG_TARGET_PER_DEVICE_ROOTFS
is set for the buildbots:
https://downloads.openwrt.org/snapshots/targets/ath79/generic/config.buildinfo

If you build locally, of course you will have to select it there (if CONFIG_TARGET_MULTI_PROFILE=y).

I never built just for one device only without setting CONFIG_TARGET_MULTI_PROFILE=y, so I cannot tell how DEVICE_PACKAGES are handled there.

fgrep -r CONFIG_USB_ROLE_SWITCH target/linux #@refresh kernel config ath79

Can you explain please?

CONFIG_USB_ROLE_SWITCH does not seem to be in ath79 at all for anything

Differences between .config on master vs .config on stable

pi@SDDesk:~/builds/github-openwrt/openwrt $ cat .config | grep = | grep usb
CONFIG_DEFAULT_kmod-usb-chipidea2=y
CONFIG_DEFAULT_kmod-usb-ledtrig-usbport=y

pi@SDDesk:~/builds/github-openwrt $ cat wr710-stable-clean.config | grep = | grep usb
CONFIG_DEFAULT_kmod-usb-chipidea2=y
CONFIG_DEFAULT_kmod-usb-core=y
CONFIG_DEFAULT_kmod-usb-ledtrig-usbport=y
CONFIG_PACKAGE_kmod-usb-chipidea=y
CONFIG_PACKAGE_kmod-usb-chipidea2=y
CONFIG_PACKAGE_kmod-usb-core=y
CONFIG_PACKAGE_kmod-usb-ehci=y
CONFIG_PACKAGE_kmod-usb-ledtrig-usbport=y
CONFIG_PACKAGE_kmod-usb-phy-nop=y

So how does CONFIG_DEFAULT... translate to CONFIG_PACKAGE...?

The DEFAULT configs mean that, if you don't make a selection to the contrary, the PACKAGE config will be selected. So it sounds like somehow you're deselecting the packages. Or possibly some dependency is not being selected properly, such that the DEFAULT can't be satisfied.

I just tried a clean config (rm .config, make menuconfig) on master, selecting ath79 and TP-Link WR710N, and I come up with this:

$ grep = .config | grep usb
CONFIG_DEFAULT_kmod-usb-chipidea2=y
CONFIG_DEFAULT_kmod-usb-ledtrig-usbport=y
CONFIG_PACKAGE_kmod-usb-chipidea=y
CONFIG_PACKAGE_kmod-usb-chipidea2=y
CONFIG_PACKAGE_kmod-usb-core=y
CONFIG_PACKAGE_kmod-usb-ehci=y
CONFIG_PACKAGE_kmod-usb-ledtrig-usbport=y
CONFIG_PACKAGE_kmod-usb-phy-nop=y
1 Like

@bnorris yes that works. It seems the problem is with make defconfig on master, at least if it is done before make menuconfig

without make defconfig

pi@SDDesk:~/builds/github-openwrt/openwrt $ rm .config
pi@SDDesk:~/builds/github-openwrt/openwrt $ make clean
make[1]: Entering directory '/media/SDStorage/builds/github-openwrt/openwrt'
make[2]: Entering directory '/media/SDStorage/builds/github-openwrt/openwrt'
make[2]: Leaving directory '/media/SDStorage/builds/github-openwrt/openwrt'
configuration written to .config

*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

make[1]: Leaving directory '/media/SDStorage/builds/github-openwrt/openwrt'
 make[1] clean
 make[1] clean
pi@SDDesk:~/builds/github-openwrt/openwrt $ cat .config | grep usb | grep =
CONFIG_DEFAULT_kmod-usb-chipidea2=y
CONFIG_DEFAULT_kmod-usb-ledtrig-usbport=y
CONFIG_PACKAGE_kmod-usb-chipidea=y
CONFIG_PACKAGE_kmod-usb-chipidea2=y
CONFIG_PACKAGE_kmod-usb-core=y
CONFIG_PACKAGE_kmod-usb-ehci=y
CONFIG_PACKAGE_kmod-usb-ledtrig-usbport=y
CONFIG_PACKAGE_kmod-usb-phy-nop=y

with make defconfig

pi@SDDesk:~/builds/github-openwrt/openwrt $ rm .config
pi@SDDesk:~/builds/github-openwrt/openwrt $ make defconfig
#
# configuration written to .config
#
pi@SDDesk:~/builds/github-openwrt/openwrt $ make menuconfig
configuration written to .config

*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

pi@SDDesk:~/builds/github-openwrt/openwrt $ cat .config | grep usb | grep =
CONFIG_DEFAULT_kmod-usb-chipidea2=y
CONFIG_DEFAULT_kmod-usb-ledtrig-usbport=y
pi@SDDesk:~/builds/github-openwrt/openwrt $ make defconfig
#
# No change to .config
#
pi@SDDesk:~/builds/github-openwrt/openwrt $ cat .config | grep usb | grep =
CONFIG_DEFAULT_kmod-usb-chipidea2=y
CONFIG_DEFAULT_kmod-usb-ledtrig-usbport=y

If make defconfig is done before make menuconfig the configuration is broken. make menuconfig is not fully correcting the configuration. Furthermore, another make defconfig after that does not "expand" the incomplete config, there is no change....

Also, there is no difference between the configs other than this problem, see the diff

pi@SDDesk:~/builds/github-openwrt/openwrt $ diff ../wr710-broken.config ../wr710-good.config
2257c2257
< # CONFIG_PACKAGE_kmod-nls-base is not set
---
> CONFIG_PACKAGE_kmod-nls-base=y
2604,2605c2604,2605
< # CONFIG_PACKAGE_kmod-usb-chipidea is not set
< # CONFIG_PACKAGE_kmod-usb-chipidea2 is not set
---
> CONFIG_PACKAGE_kmod-usb-chipidea=y
> CONFIG_PACKAGE_kmod-usb-chipidea2=y
2607c2607
< # CONFIG_PACKAGE_kmod-usb-core is not set
---
> CONFIG_PACKAGE_kmod-usb-core=y
2609a2610
> CONFIG_PACKAGE_kmod-usb-ehci=y
2611c2612
< # CONFIG_PACKAGE_kmod-usb-ledtrig-usbport is not set
---
> CONFIG_PACKAGE_kmod-usb-ledtrig-usbport=y
2614a2616
> CONFIG_PACKAGE_kmod-usb-phy-nop=y
pi@SDDesk:~/builds/github-openwrt/openwrt $

I'm still a little new to the OpenWRT configuration system, but I think that makes sense to some extent. make defconfig chooses all the defaults, and it happens to choose the ath79 target, but in doing that, those defaults also make a selection for you -- they choose to disable various USB configs and save that to .config:

$ rm .config
$ make defconfig
...
$ grep -e 'usb-chipidea' .config
# CONFIG_PACKAGE_kmod-usb-chipidea is not set
# CONFIG_PACKAGE_kmod-usb-chipidea2 is not set

So, once you change your target profile from CONFIG_TARGET_PROFILE="Default" to CONFIG_TARGET_PROFILE="DEVICE_tplink_tl-wr710n-v1", you're still inheriting the "choices" made by defconfig -- that USB is not enabled.

I believe that, as currently implemented, the DEFAULTs only work if the corresponding PACKAGE is not yet selected in .config -- i.e., you need to start from a "clean slate."

But why doesn't this happen in stable branch?

Not sure for you. I can't reproduce it working as you expect on stable -- USB is disabled there too:

$ git checkout v19.07.3
$ make clean
$ rm .config
$ make defconfig
$ make menuconfig
...
$ grep -e 'usb-chipidea' .config
CONFIG_DEFAULT_kmod-usb-chipidea2=y
# CONFIG_PACKAGE_kmod-usb-chipidea is not set
# CONFIG_PACKAGE_kmod-usb-chipidea2 is not set

Working on the ath79 mr12 port: same issue. I boot the MR12 from the initramfs, and it doesn't contain the kmod-owl-loader. I used the / search in make menuconfig to find out why MODULE_DEFAULT_kmod-owl-loader wasn't being selected, and found this TARGET_PER_DEVICE_ROOTFS flag was not being set to allow it to be triggered into the initramfs.

The needed TARGET_PER_DEVICE_ROOTFS requires TARGET_MULTI_PROFILE.

So if you want these modules added by default, one way to do it would be to select Multiple Devices in the target menu and then hit just the target you want.

This is quite annoying.

1 Like

I have learned the hard way that whenever a makefile is changed, you must make clean

try from a fresh config after rm .config and make clean without any options like TARGET_PER_DEVICE_ROOTFS

or maybe select kmod-owl-loader as a full package install instead of module