3

I am trying to build a ROM from AOSP 5.1.1 specifically (Nexus 7 - grouper). However, a while ago I got stuck at this part while building the kernel.

The following command works fine: make tegra3_android_defconfig The problem starts when I write: make -j4

It crashes and says:

Fahads-MBP:tegra Fahad$ make -j4
/volumes/untitled/tegra/../WORKING_DIRECTORY/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-gcc: /volumes/untitled/tegra/../WORKING_DIRECTORY/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-gcc: cannot execute binary file
      CHK     include/linux/version.h
      CHK     include/generated/utsrelease.h
      UPD     include/generated/utsrelease.h
      HOSTCC  scripts/basic/fixdep
      Generating include/generated/mach-types.h
      CC      kernel/bounds.s
    /bin/sh: /volumes/untitled/tegra/../WORKING_DIRECTORY/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-gcc: cannot execute binary file
    make[1]: *** [kernel/bounds.s] Error 126
    make: *** [prepare0] Error 2

    #### make failed to build some targets (2 seconds) ####

I ran the command

chmod 777 arm-eabi-gcc

and

chmod +x arm-eabi-gcc

but still no use. It gives the same cannot execute the binary file error. Any suggestions?

  • could you paste the output of running the command file on that file? – Rui F Ribeiro Nov 15 '15 at 22:33
  • there is no specific output when i run that command Fahads-MBP:bin Fahad$ chmod +x arm-eabi-gcc Fahads-MBP:bin Fahad$ – fahad Nov 16 '15 at 5:55
  • I was not clear. Please run $file arm-eabi-gcc – Rui F Ribeiro Nov 16 '15 at 6:39
  • arm-eabi-gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped – fahad Nov 16 '15 at 8:03
1

“Cannot execute binary file” isn't about permissions, so chmod won't help you.

(Oh, and never use chmod 777. It's never the solution. If you try to execute something and the error is “permission denied”, then add execute permissions: chmod a+x.)

This message means that you have a binary file (not a script) that the kernel doesn't recognize as a valid program format. Given the name of the directory linux-x86, this is an x86 executable.

Given the prompt, it appears that you're trying to build the kernel on the ARM tablet itself. You can't run an x86 executable on an ARM processor. You'll need compiler binaries for ARM, which are not present in the Android tree. The simplest solution would be to do the build on a PC. If you really want to do the build on the tablet, get appropriate compiler binaries (for the right libc; there are many different ABIs on ARM platforms and identifying the right one can be a bit difficult).

  • See developer.android.com/ndk/guides/standalone_toolchain.html and google for cross compile android on linux – cas Nov 15 '15 at 22:59
  • @cas And the only supported host platforms are {Linux,Windows,OSX}-{x86,amd64}. ARM host platforms aren't officially supported, and I don't think it would be easy to set up. – Gilles 'SO- stop being evil' Nov 15 '15 at 23:02
  • @Gilles I am building the kernel on Darwin, on a Mac 2015 machine. therefore it seems improbably that running an x86 executable on an ARM processor could be the issue. Any other suggestions or routes that you think I should explore? – fahad Nov 16 '15 at 5:59
  • @fahad Ah, ok. Same difference: you're attempting to run a Linux binary on OSX. I don't know why the build scripts are picking that up. Try following the guide mentioned by cas. You might need to call make-standalone-toolchain.sh. – Gilles 'SO- stop being evil' Nov 16 '15 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.