Rohan Mahy
Rohan Mahy

Reputation: 105

Bitbake putting config files in wrong package. Ignoring FILES_ directives in my .bbappend. Next place to look/how to fix?

I created a bbappend to compile u-boot fw_printenv/setenv utilities from an existing (modified) u-boot and install them into ${D}. This is working fine. I added an additional package to the recipe and used FILES_ to tell bitbake which packages should have which files. Bitbake appears to be ignoring the FILES_ directives or something else is overriding it. I would like the contents of ${D}/boot to package into u-boot-imx, and ${D}/sbin and ${D}/etc to package into u-boot-fw-utils-imx. (I am running Yocto 2.2)

I tried FILES_u-boot-fw-utils-imx += "/sbin/* /etc/*". The files in /sbin make it into the u-boot-fw-utils-imx rpm, but the config file in /etc is still in the u-boot-imx rpm. I then tried setting FILES_u-boot-imx = "/boot /boot/*" and FILES_remove_u-boot-imx = "/etc/fw_env.config" but the configuration file stays in package u-boot-imx.

# bitbake -e | grep ^FILES_u-boot
FILES_u-boot-fw-utils-imx=" /sbin/* /etc /etc/fw_env.config"
FILES_u-boot-imx-bin="/usr/bin/* /usr/sbin/*"
FILES_u-boot-imx="/boot /etc"
...

It looks like something is setting FILES_u-boot-imx after me.

Most of my .bbappend file:

do_compile_append() {
    # compile fw_printenv/setenv. default oe_runmake options are broken and yield an x86_64 executable. the inline python strips off the leading space in UBOOT_MACHINE.
    make CROSS_COMPILE=arm-poky-linux-gnueabi- CC="arm-poky-linux-gnueabi-gcc  --sysroot=${STAGING_DIR_TARGET} -I${STAGING_DIR_TCBOOTSTRAP}/usr/include -mfloat-abi=hard" V=1 -C ${S} O=${B}/${@bb.data.getVar('UBOOT_MACHINE', d, 1).strip()} env
}

do_install_append() {
    install -d ${D}/sbin
    install -d ${D}/etc
    install -m 755 ${B}/${@bb.data.getVar('UBOOT_MACHINE', d, 1).strip()}/tools/env/fw_printenv ${D}/sbin/fw_printenv
    install -m 755 ${B}/${@bb.data.getVar('UBOOT_MACHINE', d, 1).strip()}/tools/env/fw_printenv ${D}/sbin/fw_setenv
    echo "/dev/mmcblk1boot0      0xe0000         0x2000" > ${B}/${@bb.data.getVar('UBOOT_MACHINE', d, 1).strip()}/tools/env/fw_env.custom
    install -m 0644 ${B}/${@bb.data.getVar('UBOOT_MACHINE', d, 1).strip()}/tools/env/fw_env.custom ${D}/etc/fw_env.config
}

PACKAGES += "u-boot-fw-utils-imx"
INSANE_SKIP_u-boot-imx = "already-stripped ldflags"
INSANE_SKIP_u-boot-fw-utils-imx = "already-stripped ldflags"
FILES_u-boot-imx = "/boot /boot/*"
FILES_u-boot-fw-utils-imx += "/sbin/* /etc /etc/fw_env.config"

Could someone please explain how to get my config file in the desired package or point me at the next place to look?

btw: I'm sure that someone will ask why I didn't use the existing u-boot-fw-utils recipe. The recipe I had was for an earlier version of u-boot. When I ran that recipe it did not compile. Once I fixed the obvious problems oe_runmake compiled for x86_64 instead of the target platform.

Upvotes: 0

Views: 580

Answers (2)

Rohan Mahy
Rohan Mahy

Reputation: 105

Got it! Two observations:

  1. _remove needs to be AFTER the package name.
  2. removing /etc did not work because ${sysconfdir} was not expanded yet

Final FILES_ directives:

FILES_u-boot-imx_remove = "${sysconfdir}"
FILES_u-boot-fw-utils-imx = "/sbin /etc"

Thanks Ross for the suggestion to pipe bitbake -e to less.

Upvotes: 0

Ross Burton
Ross Burton

Reputation: 4053

Don't use bitbake -e | grep but just pipe into less and then search for the FILES assignments you're after. Above the assignment will be the history of how the variable was set.

Upvotes: 1

Related Questions