How can I override another .bbappend

4.8k views Asked by At

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"

2

There are 2 answers

0
Anders On BEST ANSWER

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.

0
Jason Liu On

There is another solution that works for me is first disable the original bbappend and then add your own ones.

Put BBMASK = "meta-openembedded/meta-systemd/oe-core/recipes-connectivity/dhcp/original.bbappend" into your build/conf/layers.conf to disable the original upstream bbappend, then make a new bbappend into your own recipe. That way can "override" the bbappend.

This is more flexible and can be apply to more scenarios not limited by your case.