Downloading and Compiling Android8.0.0-1.0.0 BSP  on Ubuntu16.04.2 LTS(For Chinese customers)

Document created by Wigros Sun Employee on Jun 1, 2018Last modified by Wigros Sun Employee on Jun 1, 2018
Version 2Show Document
  • View in full screen mode

   Some of Chinese customer couldn’t normally download android source code from google site, here give a way to download android source from Mirror site of University of Science and Technology of China.

Preparations

  1. Installing Ubuntu16.04.2 LTS

Customer can download ubuntu-16.04.2-desktop-amd64.iso from

https://www.ubuntu.com/download/desktop

       Then install it to VMware workstation player v12 or PC, after finishing installation, use “Software Update” to update system.

In order to compile android8.0.0-1.0.0 BSP, necessary packages should also be installed on Ubuntu 16.04.

$ sudo apt-get install gnupg

$ sudo apt-get install flex

$ sudo apt-get install bison

$ sudo apt-get install gperf

$ sudo apt-get install build-essential

$ sudo apt-get install zip

$ sudo apt-get install zlib1g-dev

$ sudo apt-get install libc6-dev

$ sudo apt-get install lib32ncurses5-dev

 

$ sudo apt-get install x11proto-core-dev

$ sudo apt-get install libx11-dev

$ sudo apt-get install lib32z1-dev

 

$ sudo apt-get install libgl1-mesa-dev

$ sudo apt-get install tofrodos

$ sudo apt-get install python-markdown

$ sudo apt-get install libxml2-utils

$ sudo apt-get install xsltproc

$ sudo apt-get install uuid-dev:i386 liblzo2-dev:i386

 

$ sudo apt-get install gcc-multilib g++-multilib

$ sudo apt-get install subversion

$ sudo apt-get install openssh-server openssh-client

$ sudo apt-get install uuid uuid-dev

$ sudo apt-get install zlib1g-dev liblz-dev

$ sudo apt-get install liblzo2-2 liblzo2-dev

$ sudo apt-get install lzop

$ sudo apt-get install git-core curl

$ sudo apt-get install u-boot-tools

$ sudo apt-get install mtd-utils

$ sudo apt-get install android-tools-fsutils

$ sudo apt-get install openjdk-8-jdk

 

More detail, see Android_User’s_Guide.pdf ( android 8.0.0-1.0.0 BSP documents)

 

  1. Downloading and unpacking Android release package

https://www.nxp.com/products/processors-and-microcontrollers/applications-processors/i.mx-applications-processors/android-os-for-i.mx-applications-processors:IMXANDROID?tab=Design_Tools_Tab

--IMX_O8.0.0_1.0.0_ANDROID_SOURCE

File name is mx-o8.0.0_1.0.0_ga.tar.gz

# cd ~

# tar xzvf mx-o8.0.0_1.0.0_ga.tar

 

Downloading Android 8.0.0-1.0.0 source code

 

  1. Getting repo

# cd ~

# mkdir bin

# cd bin

# curl https://storage-googleapis.proxy.ustclug.org/git-repo-downloads/repo > ~/bin/repo

# chmod a+x ~/bin/repo

# export PATH=${PATH}:~/bin

  1. Modifying repo File
    Open ~/bin/repo file with 'gedit' and Change google address
    From

           REPO_URL = 'https://gerrit.googlesource.com/git-repo' To REPO_URL ='git-repo - Git at Google '

3Setting email address

# git config --global user.email "xxx@nxp.com"

# git config --global user.name "xxxx"

 [ Email & Name should be yours]

 

4Modifying android setup script and Running it

         Open ~/imx-o8.0.0_1.0.0_ga/imx_android_setup.sh and add a line like below:

......

      if [ "$rc" != 0 ]; then

         echo "---------------------------------------------------"

         echo "-----Repo Init failure"

         echo "---------------------------------------------------"

         return 1

      fi

find -name 'aosp-O8.0.0-1.0.0.xml'| xargs perl -pi -e 's|https://android.googlesource.com/|git://mirrors.ustc.edu.cn/aosp/|g'

 

fi

 

# Don't Delete .repo directory and hidden files

#rm -rf $android_builddir/.??*

   Then save it and exit.

# cd ~/

# source ~/imx-o8.0.0_1.0.0_ga/imx_android_setup.sh

Then android_build directory is created at ~/

# export MY_ANDROID=~/android_build

 

[Note] imx_android_setup.sh will be in charge of downloading all android source code.

5.Begin to compile android 8.0.0 BSP

$ export ARCH=arm

$ export CROSS_COMPILE=${MY_ANDROID}/prebuilts/gcc/linux-x86/arm/arm-linuxandroideabi-4.9/bin/arm-linux-androideabi-

$ cd ~/android_build

$ source build/envsetup.sh

$ lunch sabreauto_6q-userdebug

$ make –j4

 

Errors:

......

“Try increasing heap size with java option '-Xmx<size>'.”

......

Logs for compiling

 

 

weidong@ubuntu:~/android_build$ lunch sabreauto_6q-userdebug

 

============================================

PLATFORM_VERSION_CODENAME=REL

PLATFORM_VERSION=8.0.0

TARGET_PRODUCT=sabreauto_6q

TARGET_BUILD_VARIANT=userdebug

TARGET_BUILD_TYPE=release

TARGET_PLATFORM_VERSION=OPD1

TARGET_BUILD_APPS=

TARGET_ARCH=arm

TARGET_ARCH_VARIANT=armv7-a-neon

TARGET_CPU_VARIANT=cortex-a9

TARGET_2ND_ARCH=

TARGET_2ND_ARCH_VARIANT=

TARGET_2ND_CPU_VARIANT=

HOST_ARCH=x86_64

HOST_2ND_ARCH=x86

HOST_OS=linux

HOST_OS_EXTRA=Linux-4.4.0-116-generic-x86_64-with-Ubuntu-16.04-xenial

HOST_CROSS_OS=windows

HOST_CROSS_ARCH=x86

HOST_CROSS_2ND_ARCH=x86_64

HOST_BUILD_TYPE=release

BUILD_ID=1.0.0-rfp-rc4

OUT_DIR=out

AUX_OS_VARIANT_LIST=

============================================

weidong@ubuntu:~/android_build$ make -j4

============================================

 

 

============================================

PLATFORM_VERSION_CODENAME=REL

PLATFORM_VERSION=8.0.0

TARGET_PRODUCT=sabreauto_6q

TARGET_BUILD_VARIANT=userdebug

TARGET_BUILD_TYPE=release

TARGET_ARCH=arm

TARGET_ARCH_VARIANT=armv7-a-neon

TARGET_CPU_VARIANT=cortex-a9

HOST_ARCH=x86_64

HOST_2ND_ARCH=x86

HOST_OS=linux

HOST_OS_EXTRA=Linux-4.4.0-116-generic-x86_64-with-Ubuntu-16.04-xenial

HOST_CROSS_OS=windows

HOST_CROSS_ARCH=x86

HOST_CROSS_2ND_ARCH=x86_64

HOST_BUILD_TYPE=release

BUILD_ID=1.0.0-rfp-rc4

OUT_DIR=out

============================================

[38/38] bootstrap out/soong/.minibootstrap/build.ninja.in

[1/2] out/soong/.bootstrap/bin/minibp out/soong/.minibootstrap/build.ninja.in

[4/4] out/soong/.bootstrap/bin/minibp out/soong/.bootstrap/build.ninja

[791/792] glob vendor/*/*/Android.bp

[47/47] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja

out/build-sabreauto_6q.ninja is missing, regenerating...

[9/1005] including ./cts/Android.mk ...

cts/hostsidetests/os/test-apps/StaticSharedNativeLibProvider/Android.mk:23: warning: FindEmulator: find: `cts/hostsidetests/os/test-apps/StaticSharedNativeLibProvider/src': No such file or directory

cts/hostsidetests/os/test-apps/StaticSharedNativeLibProvider1/Android.mk:23: warning: FindEmulator: find: `cts/hostsidetests/os/test-apps/StaticSharedNativeLibProvider1/src': No such file or directory

[690/1005] including ./system/sepolicy/Android.mk ...

./system/sepolicy/Android.mk:107: warning: BOARD_SEPOLICY_VERS not specified, assuming current platform version

[1005/1005] including ./vendor/nxp/linux-firmware-imx/firmware/Android.mk ...

No private recovery resources for TARGET_DEVICE sabreauto_6q

platform_testing/build/tasks/tests/instrumentation_metric_test_list.mk: warning: continuous_instrumentation_metric_tests: Unknown installed file for module perf-setup.sh

platform_testing/build/tasks/tests/instrumentation_test_list.mk: warning: continuous_instrumentation_tests: Unknown installed file for module RecyclerViewTests

platform_testing/build/tasks/tests/instrumentation_test_list.mk: warning: continuous_instrumentation_tests: Unknown installed file for module SettingsFunctionalTests

platform_testing/build/tasks/tests/instrumentation_test_list.mk: warning: continuous_instrumentation_tests: Unknown installed file for module LauncherFunctionalTests

platform_testing/build/tasks/tests/instrumentation_test_list.mk: warning: continuous_instrumentation_tests: Unknown installed file for module EmergencyInfoTests

platform_testing/build/tasks/tests/native_metric_test_list.mk: warning: continuous_native_metric_tests: Unknown installed file for module perf-setup.sh

test/vts/tools/build/tasks/vts_package.mk:222: warning: FindEmulator: cd: vendor/google_vts/testcases: No such file or directory

test/vts/tools/build/tasks/vts_package.mk:222: warning: FindEmulator: cd: vendor/google_vts/testcases: No such file or directory

test/vts/tools/build/tasks/vts_package.mk:222: warning: FindEmulator: cd: vendor/google_vts/testcases: No such file or directory

./test/vts/utils/python/archive/Android.mk:28: warning: overriding commands for target `default'

./test/vts/runners/host/tcp_server/Android.mk:19: warning: ignoring old commands for target `default'

build/core/Makefile:34: warning: overriding commands for target `out/target/product/sabreauto_6q/root/init.rc'

build/core/base_rules.mk:378: warning: ignoring old commands for target `out/target/product/sabreauto_6q/root/init.rc'

......

......

 CC      lib/vsprintf.o

  CC      lib/panic.o

  CC      lib/strto.o

  CC      lib/strmhz.o

  LD      lib/built-in.o

  CC      examples/standalone/hello_world.o

  CC      examples/standalone/stubs.o

  LD      examples/standalone/libstubs.o

  LD      examples/standalone/hello_world

  OBJCOPY examples/standalone/hello_world.bin

  OBJCOPY examples/standalone/hello_world.srec

  LD      u-boot

  OBJCOPY u-boot-nodtb.bin

  OBJCOPY u-boot.srec

  SHIPPED dts/dt.dtb

  SYM     u-boot.sym

  COPY    u-boot.dtb

  CAT     u-boot-dtb.bin

  COPY    u-boot.bin

  CFGS    board/freescale/mx6qsabreauto/mx6qp.cfg.cfgtmp

  MKIMAGE u-boot-dtb.imx

  CFGCHK  u-boot.cfg

make[1]: Leaving directory '/home/weidong/android_build/out/target/product/sabreauto_6q/obj/BOOTLOADER_OBJ'

make: Leaving directory '/home/weidong/android_build/vendor/nxp-opensource/uboot-imx'

/bin/bash: line 0: [: =: unary operator expected

[  3% 2129/63758] Check module type: out/target/common/obj/APPS/Browser2_intermediates/link_type

packages/apps/Browser2/Android.mk: warning: Browser2 (java:sdk) should not link to legacy-android-test (java:platform)

[  3% 2171/63758] Ensuring Jack server is installed and started

Jack server already installed in "/home/weidong/.jack-server"

Launching Jack server java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -cp /home/weidong/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher

Server updated, waiting for restart

......

......

D [M]  drivers/rpmsg/imx_rpmsg_tty.ko

  LD [M]  drivers/video/backlight/l4f00242t03.ko

  CC      arch/arm/boot/compressed/misc.o

  LD [M]  drivers/video/backlight/platform_lcd.ko

  LD [M]  drivers/video/backlight/lcd.ko

  CC      arch/arm/boot/compressed/decompress.o

  CC      arch/arm/boot/compressed/string.o

  SHIPPED arch/arm/boot/compressed/hyp-stub.S

  SHIPPED arch/arm/boot/compressed/lib1funcs.S

  SHIPPED arch/arm/boot/compressed/ashldi3.S

  SHIPPED arch/arm/boot/compressed/bswapsdi2.S

  AS      arch/arm/boot/compressed/hyp-stub.o

  AS      arch/arm/boot/compressed/lib1funcs.o

  AS      arch/arm/boot/compressed/ashldi3.o

  AS      arch/arm/boot/compressed/bswapsdi2.o

  AS      arch/arm/boot/compressed/piggy.o

  LD      arch/arm/boot/compressed/vmlinux

  OBJCOPY arch/arm/boot/zImage

  Kernel: arch/arm/boot/zImage is ready

make[1]: Leaving directory '/home/weidong/android_build/out/target/product/sabreauto_6q/obj/KERNEL_OBJ'

make: Leaving directory '/home/weidong/android_build/vendor/nxp-opensource/kernel_imx'

make: Entering directory '/home/weidong/android_build/vendor/nxp-opensource/kernel_imx'

make[1]: Entering directory '/home/weidong/android_build/out/target/product/sabreauto_6q/obj/KERNEL_OBJ'

  CHK     include/config/kernel.release

  GEN     ./Makefile

  CHK     include/generated/uapi/linux/version.h

  Using /home/weidong/android_build/vendor/nxp-opensource/kernel_imx as source for kernel

  CHK     include/generated/utsrelease.h

  CHK     include/generated/timeconst.h

  CHK     include/generated/bounds.h

  CHK     include/generated/asm-offsets.h

  CALL    /home/weidong/android_build/vendor/nxp-opensource/kernel_imx/scripts/checksyscalls.sh

make[1]: Leaving directory '/home/weidong/android_build/out/target/product/sabreauto_6q/obj/KERNEL_OBJ'

make: Leaving directory '/home/weidong/android_build/vendor/nxp-opensource/kernel_imx'

 

......

......

[ 83% 53244/63758] Building with Jack: out/target/co...ARIES/framework_intermediates/with-local/classes.dex

FAILED: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex

/bin/bash out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex.rsp

Out of memory error (version 1.3-rc7 'Douarn' (445000 d7be3910514558d6715ce455ce0861ae2f56925a by android-jack-team@google.com)).

GC overhead limit exceeded.

Try increasing heap size with java option '-Xmx<size>'.

Warning: This may have produced partial or corrupted output.

[ 83% 53247/63758] //external/llvm/lib/CodeGen/SelectionDAG:libLLVMSelectionDAG clang++ DAGCombiner.cpp

ninja: build stopped: subcommand failed.

19:17:25 ninja failed with: exit status 1

build/core/main.mk:21: recipe for target 'run_soong_ui' failed

make: *** [run_soong_ui] Error 1

 

*******************************************************

solve the issue: Try increasing heap size with java option '-Xmx<size>'.

-- run commands below on command line

#export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g"

#./prebuilts/sdk/tools/jack-admin kill-server

#./prebuilts/sdk/tools/jack-admin start-server

*******************************************************

#make -j4   //continue compiling

 

......

......

[ 50% 1/2] glob vendor/*/*/Android.bp

[  0% 1/10515] Ensuring Jack server is installed and started

Jack server already installed in "/home/weidong/.jack-server"

Server is already running

......

......

Creating filesystem with parameters:

    Size: 1585446912

    Block size: 4096

    Blocks per group: 32768

    Inodes per group: 8064

    Inode size: 256

    Journal blocks: 6048

    Label: system

    Blocks: 387072

    Block groups: 12

    Reserved block group size: 95

Created filesystem with 2216/96768 inodes and 171147/387072 blocks

Running:  build_verity_tree -A aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7 out/target/product/sabreauto_6q/obj/PACKAGING/systemimage_intermediates/system.img /tmp/tmpPnRk1H_verity_images/verity.img

f26a84a2c66d866f5322986e7a093812329d87579e5859aa32a2cf4c21f69661 aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7

Running:  system/extras/verity/build_verity_metadata.py build 1585446912 /tmp/tmpPnRk1H_verity_images/verity_metadata.img f26a84a2c66d866f5322986e7a093812329d87579e5859aa32a2cf4c21f69661 aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7 /dev/block/by-name/system verity_signer build/target/product/security/verity.pk8

['verity_signer', '/tmp/tmpvXftO2.table', 'build/target/product/security/verity.pk8', '/tmp/tmpbfl4fq.sig']

appending /tmp/tmpPnRk1H_verity_images/verity_metadata.img to /tmp/tmpPnRk1H_verity_images/verity.img

Running:  fec -e -p 0 out/target/product/sabreauto_6q/obj/PACKAGING/systemimage_intermediates/system.img /tmp/tmpPnRk1H_verity_images/verity.img /tmp/tmpPnRk1H_verity_images/verity_fec.img

encoding RS(255, 253) to '/tmp/tmpPnRk1H_verity_images/verity_fec.img' for input files:

       1: 'out/target/product/sabreauto_6q/obj/PACKAGING/systemimage_intermediates/system.img'

       2: '/tmp/tmpPnRk1H_verity_images/verity.img'

appending /tmp/tmpPnRk1H_verity_images/verity_fec.img to /tmp/tmpPnRk1H_verity_images/verity.img

Running:  append2simg out/target/product/sabreauto_6q/obj/PACKAGING/systemimage_intermediates/system.img /tmp/tmpPnRk1H_verity_images/verity.img

 

[100% 10515/10515] Install system fs image: out/target/product/sabreauto_6q/system.img

out/target/product/sabreauto_6q/system.img+out/target/product/sabreauto_6q/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p maxsize=1644331392 blocksize=4224 total=704129669 reserve=16612992

 

#### make completed successfully (01:21:12 (hh:mm:ss)) ####

 

NXP TIC team

Weidong sun

2018-06-01

1 person found this helpful

Attachments

    Outcomes