Search code examples
yoctobitbake

Wrong file installed when building a machine


I have 3 layers:

meta-a:

meta-a
└── recipes-my
    └── mypgk
        ├── mypgk_1.0.bb
        └── mypkg_rel
            ├── config.conf
            └── mypkg.service
  • mypgk_1.0.bb:
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}_rel:"  
SRC_URI = "file://config.conf mypkg.service"

meta-b:

meta-b
└── recipes-my
    └── mypgk
        ├── mypgk_1.0.bbappend
        └── mypkg
            └── config.conf
  • mypgk_1.0.bbappend:
FILESEXTRAPATHS_prepend_${MACHINE} := "${YOCTOROOT}/meta-a/recipes-my/${PN}/${PN}_rel:"  
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"  
SRC_URI += "file://config.conf "

I also have a meta-c layer.

  • meta-c depends on meta-b,
  • meta-b depends on meta-a.

Layers priority:

  • meta-a = 14
  • meta-b = 15
  • meta-c = 16

Every layer defines a machine (machinea, machineb, machinec)

When I build machinea, the config.conf file from meta-a is installed.

When I build machineb, the config.conf file from meta-b is installed.

When I build machinec, the config.conf file from meta-a is installed instead the one in meta-b which have a higher priority.

When I build machinec I want mypkg from meta-b as-is, why bitbake use the other config.conf file?

If I rename config.conf to config_b.conf (changing .bbappend accordingly) in meta-b everything works as axpected.

EDIT:

meta-c content regarding mypgk is empty, i want it to inherit from meta-b.
in meta-c layer.conf i have this:

LAYERDEPENDS_c = "b"

mypgk_1.0.bb defined in meta-a is:

FILESEXTRAPATHS_prepend_$(MACHINE) := "${THISDIR}/${PN}_rel:"

SRC_URI = "file://config.conf "

SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE_${PN} = " mypkg.service"

do_install() {
         install -m 755 -d ${D}${bindir}
         install -m 755 -d ${D}${sysconfdir}
         install -m 644 ${WORKDIR}/config.conf ${D}${sysconfdir}/config.conf

         install -d ${D}${systemd_system_unitdir}
         install -m 644 ${WORKDIR}/mypkg.service ${D}${systemd_system_unitdir}/mypkg.service
}

EDIT 2:
also copying recipes-my/* from meta-b to meta-c/ doesn't work and config.conf from meta-a is installed


Solution

  • the issue was the order of direictories added to FILESEXTRAPATHS.
    modifing mypgk_1.0.bbappend in meta-b to:

    FILESEXTRAPATHS_append_${MACHINE} := "${YOCTOROOT}/meta-a/recipes-my/${PN}/${PN}_rel:"  
    FILESEXTRAPATHS_prepend_${MACHINE} := "${THISDIR}/${PN}:" 
    

    solved the issue