Android build issue. HELP!

Building Android for Zero, based on doc here.

Installed fresh Ubuntu 16 on laptop:
$ dmesg
[ 0.000000] microcode: microcode updated early to revision 0x28, date = 2019-11-12
[ 0.000000] Linux version 4.15.0-142-generic (buildd@lgw01-amd64-039) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)) #146~16.04.1-Ubuntu SMP Tue Apr 13 09:27:15 UTC 2021 (Ubuntu 4.15.0-142.146~16.04.1-generic 4.15.18)
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.15.0-142-generic root=UUID=712d11a4-5379-45c5-9559-98079be9f1d0 ro quiet splash vt.handoff=7
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Centaur CentaurHauls
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x001: ‘x87 floating point registers’
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x002: ‘SSE registers’
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x004: ‘AVX registers’
[ 0.000000] x86/fpu: xstate_offset[2]: 576, xstate_sizes[2]: 256
[ 0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using ‘standard’ format.
[ 0.000000] e820: BIOS-provided physical RAM map:

Building with command:
./device/amlogic/common/quick_compile.sh 14 1

Error:
/home/zero/common/scripts/gcc-version.sh: line 25: /opt/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc: No such file or directory
/home/zero/common/scripts/gcc-version.sh: line 26: /opt/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc: No such file or directory
make[2]: /opt/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc: Command not found
make[2]: /opt/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc: Command not found
make[2]: /opt/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc: Command not found
make[2]: /opt/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc: Command not found
make[2]: /opt/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc: Command not found
/bin/sh: 1: /opt/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc: not found
make[3]: *** [/home/zero/out/target/product/faraday/obj/optee_modules/tee_shm.o] Error 127
make[3]: *** Waiting for unfinished jobs…
/bin/sh: 1: /opt/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc: not found
make[3]: *** [/home/zero/out/target/product/faraday/obj/optee_modules/tee_core.o] Error 127
make[2]: *** [module/home/zero/out/target/product/faraday/obj/optee_modules] Error 2
make[1]: *** [sub-make] Error 2
make: *** [__sub-make] Error 2

Please!
Anyone can help?
Does some one tried to build Android?
What I’m doing wrong? Or maybe this is setup issue(but this is clean Ubuntu 16)?

Solution:

The Amlogic Platform requires extra toolchains for cross-compiling, you will need to follow these steps to setup:

Install Cross Compiler for U-Boot BL:

$ sudo apt-get install gcc-arm-none-eabi
$ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.bz2
$ wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2
$ sudo mkdir /opt/
$ sudo tar -xjf gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.bz2 -C /opt/
$ sudo tar -xjf gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2 -C /opt/

Install Cross-Compiler for Linux Kernel:

$ wget https://releases.linaro.org/components/toolchain/binaries/6.3-2017.02/arm-linux-gnueabihf/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf.tar.xz
$ wget https://releases.linaro.org/components/toolchain/binaries/6.3-2017.02/aarch64-linux-gnu/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz
$ sudo mkdir /opt/
$ sudo tar xvJf gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf.tar.xz -C /opt/
$ sudo tar xvJf gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz -C /opt/

  • set PATH to bin folder of extracted toolchains
  • reboot/relogout
  • check:
  • which arm-linux-gnueabihf-gcc
1 Like