Bitbake custom layer adding binaries

Recently I have been trying to add a custom binary, compiled using the :
aarch64-linux-gnu-gcc
crosscompiler, to mij custom rootfs built using bitbake. I’m trying to install the executable binary in the {bindir}. I get following error:
ERROR: meta-aedin-1.0-r0 do_package_qa: QA Issue: No GNU_HASH in the ELF binary

Online I’ve looked for two solutions either try to add the GNU hash to the compiler using -Wl,–hash-style=gnu or to add the INSANE_SKIP_${PN} += “ldflags” tot he bitbake layer file.

Both options remove the initial error however now the entire rootfs built fails to add any library. Does anybody have a simular issue/solution to this issue? Or how to add a prebuilt binary to bitbake ?

Greetings @davygillebert!

Both options remove the initial error however now the entire rootfs built fails to add any library.

Can you please share more details about this failure? Does it output any logs?

@gustavo.tx it does output a log :

ERROR: core-image-minimal-1.0-r0 do_rootfs: Unable to install packages. Command ‘/home/gillebert/develop/30012600/src/usbboot/build/tmp/work/colibri_imx8x-tdx-linux/core-image-minimal/1.0-r0/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f /home/gillebert/develop/30012600/src/usbboot/build/tmp/work/colibri_imx8x-tdx-linux/core-image-minimal/1.0-r0/opkg.conf -t /home/gillebert/develop/30012600/src/usbboot/build/tmp/work/colibri_imx8x-tdx-linux/core-image-minimal/1.0-r0/temp/ipktemp/ -o /home/gillebert/develop/30012600/src/usbboot/build/tmp/work/colibri_imx8x-tdx-linux/core-image-minimal/1.0-r0/rootfs --force_postinstall --prefer-arch-to-version install dosfstools e2fsprogs meta-aedin opkg packagegroup-core-boot packagegroup-core-ssh-openssh run-postinsts’ returned 255:

after which an entire list of all packages it tries to install is printed. Configured etc…

and it ends with:

*Collected errors:

  • check_data_file_clashes: Package meta-aedin wants to install file /home/gillebert/develop/30012600/src/usbboot/build/tmp/work/colibri_imx8x-tdx-linux/core-image-minimal/1.0-r0/rootfs/etc/hostname
    But that file is already provided by package * base-files
    un-postinsts.
    ERROR: core-image-minimal-1.0-r0 do_rootfs: Function failed: do_rootfs
    ERROR: Logfile of failure stored in: /home/gillebert/develop/30012600/src/usbboot/build/tmp/work/colibri_imx8x-tdx-linux/core-image-minimal/1.0-r0/temp/log.do_rootfs.2148
    ERROR: Task (/home/gillebert/develop/30012600/src/usbboot/build/…/layers/openembedded-core/meta/recipes-core/images/core-image-minimal.bb:do_rootfs) failed with exit code ‘1’*

When I do not add the precompiled binary

DESCRIPTION = “autorun” SECTION =
“aedin” LICENSE = “CLOSED”

FILESEXTRAPATHS_prepend :=
“${THISDIR}/src:” SRC_URI =
"file://autoBackup.service
file://autorun.sh
file://partition.sh
file://blink.sh
file://hostname
file://dspprog \ " BBFILE_PRIORITY_${PN} = “31”

INHIBIT_PACKAGE_STRIP = “1”
INHIBIT_SYSROOT_STRIP = “1”

tried these options INSANE_SKIP_${PN} += “ldflags”
FILES_${PN}-dev += “${bindir}/dspprog”
FILES_${PN} += “${bindir}/dspprog”

inherit systemd

do_configure(){ : }

do_compile() { : }

do_install() { install -d
${D}/${systemd_unitdir}/system/
install -m 0644 ${WORKDIR}/autoBackup.service
${D}/${systemd_unitdir}/system/autoBackup.service
install -d ${D}/${bindir}/
install -m 0755 ${WORKDIR}/autorun.sh
${D}/${bindir}/autorun.sh
install -m 0755 ${WORKDIR}/partition.sh
${D}/${bindir}/partition.sh
install -m 0755 ${WORKDIR}/blink.sh
${D}/${bindir}/blink.sh install -d
${D}/${sysconfdir}/
install -m 0755 ${WORKDIR}/hostname
${D}/${sysconfdir}/hostname
install -m 0755 ${WORKDIR}/hostname
${D}/${sysconfdir}/hostname-opkg #
install -d ${D}/home/root/ install -m
0755 ${WORKDIR}/dspprog
${D}/${bindir}/dspprog }

so it only goes wrong when I try to add dspprog (the precompiled binary) this binary does work on the Toradex module when copied on it with a usb stick.

@davygillebert,

Can you share your meta layer so I can try your recipe on my side?

I see Yocto complained about a hostname file that’s being installed. Does this error still happen when you don’t try to install your binary?