compiled kernel image: cannot execute binary file

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

compiled kernel image: cannot execute binary file

1,449 Views
maxruttenberg
Contributor I

I'm working with T10 series, specifically the T1023RDB. 

Here's my problem:

  1. I compile a linux image, a root file system, and device tree for the target board
    • bitbake fsl-image-core
  2. I boot from these binaries following the directions in the SDK manual. 
    • tftp 1000000 uImage
    • tftp 4000000 fsl-image-core-t1023rdb.ext2.gz.u-boot
    • tftp 9000000 uImage-t1023rdb.dtb
    • bootm 1000000 4000000 9000000
  3. I build the toolchain and source the environment file (same board support package as the kernel image)
    • bitbake fsl-toolchain
    • bash tmp/deploy/sdk/(install-file-name).sh
    • source /opt/fsl-qoriq/2.0/(environment-setup-name).sh
  4. I compile a simple C program with this environment  
    • $CC hello.c -o hello.x
  5. I try to run it on the board and I get this message : "cannot execute binary file"
    • (configure the ethernet ports, acquire hello.x)
    • . ./hello.x
    • -sh: .: ./hello.x: cannot execute binary file

Frankly, I'm stumped. The interpreter is /lib/ld.so.1 which seems to be present on the board. Oddly enough, if I just let the board boot without using my images, the executable can run just fine. 

Labels (1)
Tags (1)
0 Kudos
4 Replies

1,014 Views
maxruttenberg
Contributor I

Well... I figured it out. I've been using TFTP to get executables onto my development board. It turns that the tftp executable provided in fsl-image-core has been corrupting the binary files. That's why readelf and file have both been failing to read the binary files that have been moved using TFTP. I wasn't using the "binary" command in the tftp prompt.

Thank you for your help!

0 Kudos

1,014 Views
maxruttenberg
Contributor I

I have new information. If I do:

file hello.x

I get:

hello.x: ERROR: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), statically linked, interpreter ib/ld.so.1 error reading (Invalid argument)

Performing a readelf on my machine, I can see that the interpreter is supposed to be /lib/ld.so.1.

Furthermore, if I take a working binary from the board (/bin/cat) and do a readelf on my personal machine I get a litany errors suggesting that the format of these executables is not what's expected.

There appears be a mismatch of some sort between the compiler for the operating system images and the compiler for the toolchain.

0 Kudos

1,014 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Max Ruttenberg,

As you mentioned, there is no problem with the default pre-built image.

What have you modified for building fsl-image-core?

Would you please provide the recipe file which you modified?


Have a great day,
Yiping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,014 Views
maxruttenberg
Contributor I

Hi Sylvia

What have you modified for building fsl-image-core?

I've added a tiny kernel module. It's pretty much just a pci device driver that does nothing except enable a device. The module initializes and runs fine.

Would you please provide the recipe file which you modified?

To the best of my knowledge I haven't modified any recipe file, at least not deliberately. 

Thanks,

Max

0 Kudos