1. How to use linaro-build.sh to create a local build mkdir aosp cd aosp wget https://android-git.linaro.org/android-build-configs.git/tree/linaro-build.sh -O linaro-build.sh chmod +x linaro-build.sh ./linaro-build.sh ./linaro-build.sh -c # like lcr-reference-hikey-p or ./linaro-build.sh -m -c # like lcr-reference-hikey-p 2. Howto reproduce an exact build. ./linaro-build.sh -c -pm 3. OP-TEE related settings 1). the OP-TEE projects in the local_manifest. please check the optee.xml file of the lLOCAL_MANIFEST_BRANCH(e.g. linaro-p-preview) branch of repository LOCAL_MANIFEST(e.g. git://android-git.linaro.org/platform/manifest.git) Like the url for lcr-reference-hikey-p build is here: https://android-git.linaro.org/platform/manifest.git/tree/optee.xml?h=linaro-p-preview 2). the OP-TEE related patches: the patches listed in the patchset scripts which has optee in the file name the patchset scrips are stored in the android-patchsets repository: https://android-git.linaro.org/android-patchsets.git like the hikey-optee-p and hikey-optee-4.14 patchset scripts for lcr-reference-hikey-p build hikey-optee-p: patches for OP-TEE that applied on the device/linaro/hikey project. hikey-optee-4.14: patches to applied on 4.14 kernel for OP-TEE SDP feature. 3). firmware projects: different platforms have different firmwares. to have OP-TEE work, it needs to have firmware with OP-TEE enabled. Like for the lcr-reference-hikey-p build, the hikey firmware related projects are listed in the hikey.xml of local_manifest. You could check here for details: https://android-git.linaro.org/platform/manifest.git/tree/hikey.xml?h=linaro-p-preview The patches to build hikey firmwares are listed in the hikey-optee-p patchset script, which url is https://android-git.linaro.org/android-patchsets.git/tree/hikey-optee-p Such things need to enabled for your own build to have the OP-TEE feature work. 4. The Kernel and Kernel toolchain information if KERNEL_BUILD_WITH_CLANG is set to true in the build config file(e.g. lcr-reference-hikey-p), then the build will build the kernel with CLang, otherwise the kernel would be built with gcc. KERNEL_CLANG is used to specify the CLang path for kernel building, and KERNEL_TOOLS_PREFIX is used to specify the GCC path for kernel building. Otherwise, the default CLang version(GCC version) set for AOSP would be used to compile the kernel. 5. Android Userspace toolchain information: From Oreo CLang is used for the Android userspace building. Please check the LLVM_PREBUILTS_VERSION info defined in build/core/clang/versions.mk for Oreo build, and ClangDefaultVersion in build/soong/cc/config/global.go Like for Oreo android-8.1.0_r48 tag: $ ./prebuilts/clang/host/linux-x86/clang-4053586/bin/clang --version Android clang version 5.0.300080 (based on LLVM 5.0.300080) Target: x86_64-unknown-linux Thread model: posix InstalledDir: /data/android/aosp/test-build/../oreo/prebuilts/clang/host/linux-x86/clang-4053586/bin $ For Pie android-9.0.0_r34 tag: $ ./prebuilts/clang/host/linux-x86/clang-4691093/bin/clang --version Android (4691093 based on r316199) clang version 6.0.2 (https://android.googlesource.com/toolchain/clang 183abd29fc496f55536e7d904e0abae47888fc7f) (https://android.googlesource.com/toolchain/llvm 34361f192e41ed6e4e8f9aca80a4ea7e9856f327) (based on LLVM 6.0.2svn) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /data/android/aosp/test-build/./prebuilts/clang/host/linux-x86/clang-4691093/bin $