Few issues encountered trying to build L5.1.1_2.1.0 Android for i.MX6:
(some of them can apply to Android M6 build also)
Issue-1: OpenJDK-7 required to build L5.1.1_2.1.0 but not able to download/install in Ubuntu 16.04:
solution: Ubuntu 16.04 and openjdk 7 - Ask Ubuntu
===============================
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-7-jdk
===============================
Issue-2: without any modification, got error message like: "You have tried to change the API from what has been previously approved." during compilation.
solution: follow the suggestion in the error message, do "make update-api"
Issue-3: error messages like
=========================================
external/libcxx/include/thread:149: error: unsupported reloc 43
clang: error: linker command failed with exit code 1 (use -v to see invocation)
build/core/host_shared_library_internal.mk:44: recipe for target 'out/host/linux-x86/obj32/lib/libc++.so' failed
make: *** [out/host/linux-x86/obj32/lib/libc++.so] Error 1
=========================================
related post on Internet:
http://stackoverflow.com/questions/36048358/building-android-from-sources-unsupported-reloc-43
https://bbs.archlinux.org/viewtopic.php?id=209698
solution:(as mentioned in the link above)
replaced "prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.6/x86_64-linux/bin/ld" with the symlink to "/usr/bin/ld.gold"
so this should look like:
=========================================
~/myandroid/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin$ ls -l ld*
lrwxrwxrwx 1 jimlin jimlin 16 May 6 14:48 ld -> /usr/bin/ld.gold
-rwxrwxr-x 1 jimlin jimlin 1645584 May 6 11:24 ld.bfd
-rwxrwxr-x 1 jimlin jimlin 3497448 May 6 11:24 ld.gold
-rwxrwxr-x 1 jimlin jimlin 3497448 May 6 11:24 ld.org
=========================================
to this point I can build L5.1.1_2.1.0 successfully.(on 2016, May, 12.)
Issue-4: can't run the SD tool "fsl-sdcard-partition.sh" used to partition/format SD card in "~/myandroid/device/fsl/common/tools"
root-cause: in Ubuntu 16.04, "sfdisk" tool doesn't support "-u" parameter:
==================================
sfdisk from util-linux 2.27.1
-u, --unit S deprecated, only sector unit is supported
==================================
error message encountered when running the script:
==================================
~/myandroid/device/fsl/common/tools$ sudo ./fsl-sdcard-partition.sh /dev/sdc
sfdisk: unsupported unit 'M'
sfdisk: unsupported unit 'M'
==================================
I've modified the script a bit to adapt the changes, as attached.