xAptive
xAptive

Reputation: 36

How can I override a statement in a BSP layer yocto recipe?

I'm building yocto for a Variscite board, using their BSP. I'm building core-image-minimal. The system is not building with systemd-networkd, and I am trying to add it.

The Variscite layer has the recipe meta-variscite-bsp/recipes-core/systemd/systemd_%.bbappend with the following contents:

FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"

SRC_URI:append:imx-generic-bsp = " file://imx.conf \
            file://0001-units-add-dependencies-to-avoid-conflict-between-con.patch \
            file://0002-units-disable-systemd-networkd-wait-online-if-Networ.patch \
"

PACKAGECONFIG:remove = "networkd"

do_install:append:imx-generic-bsp() {
    install -Dm 0644 ${WORKDIR}/imx.conf ${D}${sysconfdir}/systemd/logind.conf.d/imx.conf
}

I can see that they are specifically disabling networkd.

I know if I comment out the PACKAGECONFIG:remove = "networkd" line, and rebuild, that I get systemd-networkd as expected. But that doesn't seem to be the correct way to go about what I'm trying to do. If I ever update the BSP layers I'll lose my change. The correct way seems to be to add my own layer, which I've done. I've added meta-csi/recipes-core/systemd/systemd_%.bbappend with the following contents:

PACKAGECONFIG:append = "networkd"

However, when I run the build, systemd-networkd is not added.

I've never had to try and undo something another layer was doing before, and I have a poor understanding of how layer priority works in a situation like this. If I add a systemd recipe like this, do both recipes run, and if so, in what order do they run? Or does only one of them run? If that's the case, would I have to duplicate everything the BSP recipe is doing, but just take out the line I don't want?

What is the most correct way to go about trying to add back systemd-networkd when the BSP layer recipe is removing it?

Upvotes: 1

Views: 747

Answers (1)

kristianr
kristianr

Reputation: 21

I ran into the same problem as you describe.

I added PACKAGECONFIG_append = " networkd" to a layer with higher priority than the meta-variscite-fslc layer. But for some reason networkd is not listed in PACKAGECONFIG

$ bitbake systemd -e | grep ^PACKAGECONFIG
PACKAGECONFIG="    ldconfig pam               kmod     lz4          resolved     sysusers     logind"

I managed to workaround the issue by adding the below contents to a systemd_%.bbappend. It will cleanup the configuration parameters and add networkd as a new flag.

PACKAGECONFIG_CONFARGS_remove = "-Dnetworkd=false"
PACKAGECONFIG[networkd-workaround] = "-Dnetworkd=true,-Dnetworkd=false"
PACKAGECONFIG_append = " networkd-workaround"

There might be better ways to handle this, but this gets the job done without having to modify BSP layers.

Upvotes: 2

Related Questions