Search code examples
linuxyoctodhcpopenembedded

How can I override another .bbappend


I have built an image with systemd and dhcp-client. In the recipe dhcp in meta-openembedded/meta-systemd/oe-core/recipes-connectivity/dhcp there is a bbappend which creates a dhclient.service. I want to modify (or override) this file but when I launch bitbake, I have an error which tells me Applying patch 0001-dhclient-modify-interface.patch can't find file to patch at input line 5.

Here is my patch for dhclient.service :

Index: 4.3.3-r0/dhclient.service
===================================================================
--- 4.3.3-r0.orig/dhclient.service
+++ 4.3.3-r0/dhclient.service
@@ -6,7 +6,7 @@ After=syslog.target network.target
 Type=forking
 PIDFile=/var/run/dhclient.pid
 EnvironmentFile=-/etc/default/dhcp-client
-ExecStart=/sbin/dhclient -cf /etc/dhcp/dhclient.conf -q -lf /var/lib/dhcp/dhclient.leases $INTERFACES
+ExecStart=/sbin/dhclient -cf /etc/dhcp/dhclient.conf -q -lf /var/lib/dhcp/dhclient.leases eth0

 [Install]
 WantedBy=multi-user.target

And my dhcp_%.bbappend :

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://dhclient.service"

I also tried to override the file, but it seems to completly ignore my file...

I want to enable this by default but how can I override this ligne (present in the dhcp folder) to enable : SYSTEMD_AUTO_ENABLE_dhcp-client = "disable"


Solution

  • Well, you can't easily patch the file, as it's not part of the source.

    However, it should be enough to add a .bbappend with

    FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
    SYSTEMD_AUTO_ENABLE_dhcp-client = "enable"
    

    and the put dhclient.service in your layer at recipes-core/dhcp/dhcp/dhclient.service.

    This assumes that your layer has a higher priority as compared to meta-systemd.