1

I am using Petalinux 2017.2 and the included tools to build a Linux image for a Zynq ZC702 board. I am trying to add a pre-compiled executable to my rootfs with a bitbake recipe.

SUMMARY = "Demo on ARM-Linux"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = " \
    file://Demo1.out \
        "

FILES_${PN} = " \
    /home/root/Demo/ \
    /home/root/Demo/Demo1.out \
        "

S = "${WORKDIR}"

do_install() {
    install -d ${D}/home/root/Demo
    install -m 0755 ${S}/Demo1.out ${D}/home/root/Demo
}

When I attempt to build the rootfs with my app included I get this error:

ERROR: demo-1.0-r0 do_package: objcopy failed with exit code 1 (cmd was 'arm-xilinx-linux-gnueabi-objcopy' --only-keep-debug '/home/common/peta_proj_2017.2_secure/build/tmp/work/cortexa9hf-neon-xilinx-linux-gnueabi/demo/1.0-r0/package/home/root/Demo/Demo1.out' '/home/common/peta_proj_2017.2_secure/build/tmp/work/cortexa9hf-neon-xilinx-linux-gnueabi/demo/1.0-r0/package/home/root/Demo/.debug/Demo1.out'):
arm-xilinx-linux-gnueabi-objcopy:/home/common/peta_proj_2017.2_secure/build/tmp/work/cortexa9hf-neon-xilinx-linux-gnueabi/demo/1.0-r0/package/home/root/Demo/Demo1.out: File format not recognized
ERROR: demo-1.0-r0 do_package: Function failed: split_and_strip_files

I assume objcopy has an issue with my file having been compiled for arm-linux-gnueabihf, but I already know it works since I've tried copying it to the rootfs manually after Linux is booted and tested it. I would try to recompile it with the arm-xilinx-linux-gnueabi toolchain but it's missing some of the libraries I need. I don't know why objcopy is being called for this operation anyway. All I want is for it to move the file to the rootfs, but for some reason it's doing all this extra work on it. Is there a way I can make bitbake ignore the file's format?

Brendan
  • 908
  • 2
  • 15
  • 30
superb owl
  • 185
  • 2
  • 13

1 Answers1

3

looks like the problem is that objcopy is trying to strip symbols, and as you said, the toolchain used is not the same as the one it was used to build it.

You can try to setting:

INHIBIT_PACKAGE_STRIP="1"

somewhere (perhaps in your local.conf).

It should skip the step on which the build system tries to strip debug symbols from binaries hence will probably not invoke objcopy.

1 [https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#var-INHIBIT_PACKAGE_STRIP]1

ah008a
  • 1,115
  • 6
  • 11
  • When I add this line to my local.conf and build, I get "[INFO] building project [INFO] sourcing bitbake ERROR: Failed to source bitbake ERROR: Failed to build project". Is there somewhere else I can add this, such as the specific bitbake file that I need stripping off for? – Eliezer Miron Mar 18 '19 at 20:14
  • Apparently I was just missing quotation marks around the 1. You might want to edit your answer to include them. The second part of my question still stands, though: is it possible to only turn this option on temporarily for specific bitbake files? – Eliezer Miron Mar 18 '19 at 20:15
  • You can use the setting in the recipe file, then it will only effect that recipe. – Erik Botö Jun 04 '19 at 04:51