Building AOSP + OPTEE for Hikey 960

Hello

I am looking at the instructions on https://github.com/linaro-swg/optee_android_manifest. Given that OPTEE now has support for Hikey 960, I wanted to ask if the following steps would work for building Android + OPTEE for Hikey 960:

  1. Repo init:
    repo init -u https://android-git.linaro.org/git/platform/manifest.git -b android-8.1.0_r7 -g “default,-non-default,-device,hikey”

  2. Overlay:
    cd .repo
    git clone https://android-git.linaro.org/git/platform/manifest.git -b linaro-oreo local_manifests
    cd local_manifests
    rm -f swg.xml
    wget https://raw.githubusercontent.com/linaro-swg/optee_android_manifest/lcr-ref-hikey-o/swg.xml
    cd …/…/

  3. Sync: repo sync -j24

  4. repo manifest -r -o pinned-manifest.xml

  5. AOSP Patches:
    wget https://dl.google.com/dl/android/aosp/arm-hikey960-OPR-cf4e0c80.tgz
    tar xzf arm-hikey960-OPR-cf4e0c80.tgz
    ./extract-arm-hikey960.sh

  6. OPTEE patches:
    ./android-patchsets/hikey-o-workarounds
    ./android-patchsets/get-hikey-blobs
    ./android-patchsets/O-RLCR-PATCHSET
    ./android-patchsets/hikey-optee-o
    ./android-patchsets/hikey-optee-4.9
    ./android-patchsets/OREO-BOOTTIME-OPTIMIZATIONS-HIKEY
    ./android-patchsets/optee-master-workarounds
    ./android-patchsets/swg-mods-o

  7. source ./build/envsetup.sh

  8. lunch hikey960-userdebug

  9. Run AOSP Build:

    setprop sys.usb.configfs 1

    make TARGET_BUILD_KERNEL=true TARGET_BOOTIMAGE_USE_FAT=true
    CFG_SECURE_DATA_PATH=y CFG_SECSTOR_TA_MGMT_PTA=y TARGET_TEE_IS_OPTEE=true
    TARGET_BUILD_UEFI=true

Thanks

No, the steps are for hikey620 and so will not work for hikey960.
Op-tee hasn’t been properly integrated into hikey960 aosp yet.
There are temporary instructions @ https://github.com/vchong/optee_android_manifest/blob/wip/tmp.txt but the last time I tried, even though I was able to boot and run xtest to completion, there were constant errors scrolling on the console output similar to those in http://discuss.96boards.org/t/transaction-failed. Don’t think those are op-tee related errors though.

I will try your suggested list of steps and let you know how it goes.

Thank you !

You’re welcome. Just a note of caution that even the regular (non-optee) hikey960 aosp components are still under constant development/improvement so please don’t expect this to have any semblance of a working condition similar to that of the hikey620 which is more mature.

I ran the following steps:

repo init -u https://android-git.linaro.org/git/platform/manifest.git -b master
cd .repo
git clone https://github.com/vchong/optee_android_manifest.git -b wip local_manifests
cd …
repo sync
wget https://dl.google.com/dl/android/aosp/arm-hikey960-NOU-7ad3cccc.tgz
tar xzf arm-hikey960-NOU-7ad3cccc.tgz
./extract-arm-hikey960.sh

I use the following build script:

I am getting the compilation errors for fip.bin. The error began as shown below:

The compilation stopped showing the error below:

Screenshot from 2018-01-31 23:48:05

@vchong can you please check if you are also getting this error ? Do you know how to fix this build error ?

Thank you.

@vchong I tried to sync the branch again and tried a compilation using the steps mentioned above. I get the following error:

I wanted to ask if you have seen this error before and if you know how to fix it ?

Thank you

@a2t2 Yes sorry looks like the build is broken atm. I’ll try to get to it when possible but the priority is not high.

@vchong Okay. Let me know once its working. Thank you.

@at2t As a workaround, make below change and rebuild:

In external/optee_test/Android.mk,
change LOCAL_CFLAGS += -g3
to LOCAL_CFLAGS += -g3 -Wno-error.

@at2t Even with above workaround there’s still another error so please wait for update.

@vchong Would it more stable to build if a particular branch number (like android 8.1) is used, instead of using the master branch ?

@at2t No. Not all 8.* branches/trees support hikey960. Even if some do, they’re not so ‘stable’ either. See https://discuss.96boards.org/t/aosp-8-1-stable for example.

@vchong Okay. I will wait till you get the build working. Thanks.

@a2t2 Sorry for the wait and thanks for your patience. Try adding below line to the bottom of the device/linaro/hikey/sepolicy/tee.te file and rebuild.

typeattribute tee_data_file core_data_file_type;

@a2t2 @vchong I’m wondering if this works now. I’d also like to build aosp and op-tee together for hikey960.

@steveyko tbh i haven’t tried the build since so i don’t really know, but my best guess is it’s too old to work now.

@vchong ok, thanks for your reply! How about the other post (OpTEE + Android in Hikey960)? Does that work? More specifically, what @rabindranath-derebac did (OpTEE + Android in Hikey960 - #120 by rabindranath-derebac).

Hi@vchong, thanks for your work. Currently we are doing project that need build optee with Android. Hikey board is no longer available for purchasing and we had to choose Hikey960. But I tried every thread that tells how to port optee to Android but they all failed, either because code changed since the thread was posted and/or not correct branch/version that is not compatible. Can you post some instructions on how to port the optee to Android on Hikey960 with specific branch and version that works? Thank you very much!

@cheney One of our community users, @bensup, has kindly shared his implementations here: https://github.com/bsupiot/hikey960-aosp-optee/wiki. For those who are interested, please give it a try. There are some known issues so please contribute back patches if possible. A big thank you to @bensup! Thanks!

Thank you for your reply @vchong . I have tried his implementation and it works! Thank you @vchong @bensup .