Android + OP-TEE compile error

Hi ,
I am compiling AOSP 7 with OPTEE but encountered compilation error.

My target is to run sample TA in OPTEE, and eventually, build TA for my device.

I am following the steps from
Kernel, bootloader and ptable compile is successful, but met with error during android build

below is error :

BCXX -std=gnu++14 -Wsign-promo -Wno-inconsistent-missing-override -Wno-null-dereference -fno-rtti -fvisibility-inlines-hidden -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=address-of-temporary -Werror=return-type -MD -MF ‘out/soong/.intermediates/device/linaro/hikey/bluetooth/android.hardware.bluetooth@1.0-service.hikey/android_arm64_armv8-a/obj/device/linaro/hikey/bluetooth/bluetooth_hci.o’.d -o ‘out/soong/.intermediates/device/linaro/hikey/bluetooth/android.hardware.bluetooth@1.0-service.hikey/android_arm64_armv8-a/obj/device/linaro/hikey/bluetooth/bluetooth_hci.o’ device/linaro/hikey/bluetooth/
device/linaro/hikey/bluetooth/ error: no member named ‘GetPacketType’ in ‘android::hardware::bluetooth::V1_0::hikey::HciPacketizerHikey’
HciPacketType hci_packet_type = hci_packetizer_.GetPacketType();
~~~~~~~~~~~~~~~ ^
1 error generated.
[ 64% 30878/48011] target C++: libwpa_hidl <= external/wpa_supplicant_8/wpa_supplicant/hidl/hidl.cpp
ninja: build stopped: subcommand failed.
12:08:00 ninja failed with: exit status 1
make: *** [run_soong_ui] Error 1

make failed to build some targets (01:14:38 (hh:mm:ss))

I was hoping if anybody could help me with this error


Hi Deepak,

Are all of your repositories recent? Have you tried starting from scratch? As mentioned before (don’t remember where however), this is a somewhat unstable personal WIP branch so errors aren’t really unexpected. We’re in the process of creating an updated build/instructions (hopefully soon) so please bear with us atm. I’ll provide an update once available.


Hi vchong ,
thanks for your reply.

I am actually new to android scene, so, am struggling with this assignment.

Anyways ,
Is there any compiling/working AOSP 7 stream that I can use ?
Or AOSP 6 will also do.

Once my AOSP compilation is successful, I will compile OPTEE separately as given in .

Please correct me if my understanding is wrong ?


You’re welcome, and sorry yes, I should’ve provided an alternative. You can try Even use the prebuilt images if you don’t have to build from source. OP-TEE is included in the images. Let us know if it works.

Once my AOSP compilation is successful, I will compile OPTEE separately as given in .

This will not work unless you have a way to integrate the OP-TEE build files into the Android images.

I am checking for prebuilt images of AndroidTV at

It seems there’s no bootloader files in there. So, I think, pushing these on my linux-based hikey board will brick it, right ?


Does it mean steps 3.2 and 3.4 from here ?


You’re right! I’ve reported the issue and hopefully the link to a compatible fip.bin will be added. In the meantime, please try In any case, if any images cause the board to not boot properly, you can always just flash working images back to the board again.

Does it mean steps 3.2 and 3.4 from here ?

Sort of. 3.2 adds op-tee related repositories to the source tree so they can be built as part of the android build. The bootloader part still has to be built separately though… ah, if this was what you meant previously, sorry to have confused you.

3.4 has nothing to do with op-tee. I think that’s just the binary blob for graphics, so you can ignore if if you want.

@deepakmnvl Did you manage to get the build to work. If not, would you like to give a try?

hey @vchong ,
I was tinkering with some builds yesterday but nothing working out.

I compiled pure AOSP code from branch android-7.0.0_r30 ( which was successful )
Then , I added OPTEE to the source code ( steps 3.2 to 3.4 referred above ).
Tried compiling, but got build errors again.

Thanks for getting back with new info. Will try this branch today and let you know my results.

Also , does this build have any UI , and do I need some specific HDMI display ?
I have DELL 24" and Samsung 22". Hope one of them will work out of the box !!!

Hi @vchong ,
A quick update.

I am getting build error at step 3.8
My command : make -j12 TARGET_BUILD_KERNEL=true

including ./tools/test/connectivity/ …
Starting build with ninja
ninja: Entering directory `.’
ninja: error: ‘out/target/product/hikey/kernel’, needed by ‘out/target/product/hikey/boot.img’, missing and no known rule to make it
make: *** [ninja_wrapper] Error 1

make failed to build some targets (01:15 (mm:ss))

Am thinking to copy and from another OPTEE source code, to the present one and execute them. By this , kernel should be compiled, but am skeptical about this approach :slight_frown:

Pls let me know if its correct or any other way to solve the error

EDIT : tried this approach , and it didnt work

Lemme take a look and get back to you.

Sorry, there was a missing line in one of the manifests. Please try again. Should be ok now.

Hi ,
Now , I see kernel being compiled.
But now , I am stuck with jack server issues ( java related ).
I am trying many different solutions provided online, but nothing’s worked yet.

Will reply once I get some break through

Jack server should be automatically started and you shouldn’t have to mess with it.
Are you using a shared server where there are multiple other users/accounts trying to build aosp at the same time? If so, try changing the port number to avoid conflicts.

In ~/.jack-server/, change
jack.server.service.port=<some port other than 8076>
jack.server.admin.port=<some port other than 8077>

In ~/.jack-settings, change
SERVER_PORT_SERVICE=<some port other than 8076>
SERVER_PORT_ADMIN=<some port other than 8077>

[some text edited for clarity]

Finally , Compilation success.
(Had to use PC with 16GB RAM. Previously, I was trying on PC with 8GB RAM and I am facing jack server issues)

Now , except boot_fat.uefi.img, remaining all files were generated
(l-loader.bin , ptable-linux-8g.img, fip.bin, nvme.img , system.img, cache.img , userdata.img)

I flashed above files and board booted successfully.
There is another file , boot.img , I left that alone .

Now , tried xtest and output as follows :

hikey:/system/bin # xtest
Run test suite with level=0

TEE test application started with device [(null)]



  • XTEST_TEE_1001 Core self tests
    ERR [12408] TEEC:TEEC_OpenSession:502: TEE_IOC_OPEN_SESSION failed
    XTEST_TEE_1001 OK

  • XTEST_TEE_1004 Test User Crypt TA
    ERR [12408] TEEC:TEEC_OpenSession:502: TEE_IOC_OPEN_SESSION failed
    external/optee_test/host/xtest/xtest_1000.c:286: xtest_teec_open_session( &session, &crypt_user_ta_uuid, ((void*)0), &ret_orig) has an unexpected value: 0xffff0000 = TEEC_ERROR_GEN
    ERIC, expected 0x0 = TEEC_SUCCESS

  • XTEST_TEE_1005 Many sessions
    ERR [12408] TEEC:TEEC_OpenSession:502: TEE_IOC_OPEN_SESSION failed
    external/optee_test/host/xtest/xtest_1000.c:341: xtest_teec_open_session(&sessions[i], &concurrent_ta_uuid, ((void*)0), &ret_orig) has an unexpected value: 0xffff0000 = TEEC_ERROR_
    GENERIC, expected 0x0 = TEEC_SUCCESS

lot many lines like the above !!! and at the end , summary is as below -

350 subtests of which 177 failed
70 test cases of which 65 failed
0 test case was skipped
TEE test application done!

key:/system # tee-supplicant &
tee-supplicant &
[1] 9186
hikey:/system # ERR [9186] TEES:main:397: failed to find an OP-TEE supplicant device

So , after all these errors , I flashed boot.img , now , I am not getting adb shell . I guess I can sort this out.

But , how can I solve tee-supplicant error above .
Am I missing anything ?

Thanks for the tip on RAM size!

You can build boot_fat.uefi.img by adding TARGET_BOOTIMAGE_USE_FAT=true when you run make. Both boot_fat.uefi.img and boot.img work. Only difference is the fat (not literally) one gives you a grub menu. If you don’t need grub the boot.img is just as well.

tee-supplicant is loaded automatically as a service so you don’t have to do it manually. If you try to load is a 2nd time you’ll see the error you’re seeing. Only one instance is supported.

Please repo sync to the latest and try again. Would be interested in your xtest results. There should only be errors in the 20k series tests.

Hi ,
with TARGET_BOOTIMAGE_USE_FAT=true parameter as above , boot_fat_uefi.img is generated.
But , when I flash that , hikey board is not getting detected on my PC ( which is a Native Linux PC )

So, I am using boot_fat_uefi.img from

As you said, xtest runs directly, no need to invoke tee-supplicant.

And its result is pretty huge , so , pasted full log in pastebin

→ Are the results good. How do I infer OPTEE is working correctly.

→ Now , I did repo sync and compiling. Will test xtest again and post my results

→ If OPTEE is running fine, I will check hello world program next, and subsequently build TA for my device
Hope am on right track ?

→ my boot.img is not working ( board is not getting detected ). What can be the problem, any way to debug it ?
Also , since my main intention is build my own TA. So , should I have my own kernel on the board for my TA to work ?
If not required, I need not worry about this and can use pre-built boot image which I have downloaded from internet !!!

I updated board after syncing to latest code today morning and ran xtest.
And the results are same

350 subtests of which 177 failed
70 test cases of which 65 failed
0 test case was skipped
TEE test application done!

Also , am trying to run hello_world from
Is secure world 32 bit or 64 bit ?
How to verify that ?

Another update.
I was trying to run hello_world program now.

  1. I prepared stack from ( steps 7.3 to 7.5 )
  2. Then , prepared hello_world stack from from step 1 to 4, 4th step being “make all”

Now , I got hello_world binary and its TA .
I verified with file command. hello_world binary is a 64bit one as well as xtest binary too

I copied them to /system/bin and /system/lib/optee_armtz respectively.

Now , when I run hello_world, I am getting error like below:
hikey:/system/lib/optee_armtz # hello_world
/system/bin/sh: /system/bin/hello_world: No such file or directory
1|hikey:/system/lib/optee_armtz #

I suspect

  1. My boot.img is not working, so I used a prebuilt one
  2. Some dependencies are missing
    Any pointer in this regard ?

Hi ,
From other threads, I made 2 changes as below :
In device/linaro/hikey/, add:
PRODUCT_PACKAGES += tee_helloworld
PRODUCT_PACKAGES += 8aaaf200-2450-11e4-abe2-0002a5d5c51b.ta

In device/linaro/hikey/init.common.usb.rc ,
did setprop sys.usb.configfs 1

Now , I can have adb shell using my boot image file

Also , ran tee_helloworld and xtest with below results

hikey:/system/bin # tee_helloworld
Invoking TA to increment 42
TA incremented value to 43

hikey:/system/bin # xtest
22504 subtests of which 170 failed
70 test cases of which 30 failed
0 test case was skipped
TEE test application done!

@vchong , what do you think about results now ?? :slight_smile:

Another issue am facing now is , my monitor doesnt show any UI ? Its blank.
Its samsung monitor and connected to hikey board via HDMI to DVI cable ?
Do you think , any fault with my setup ?

EDIT : yes, indeed issue with my setup :frowning: .
I replaced with LG monitor having HDMI jack , and UI showed up :thumbsup:

Hi, sorry I just noticed your posts.

You don’t need your own kernel to build your own TA. Use the hello_world TA as a reference or basis for your own. Later, for more advanced TAs, you can refer to the ones in optee_test.

Few questions.

  1. Are you still having problems with your boot.img?
    The boot.img is built as part of the aosp build so you should be able to just use the one in out/target/product/hikey/. Please don’t use binaries built or downloaded from other non-aosp systems as they don’t use the android toolchain and most probably will not work.

  2. Did you run xtest as root or non-root?

  3. Can you list the test numbers that failed?

In any case, since you got hello_world to work, you can start working on your own TA at this point.

For the monitor, the Android build is more fickle than the Debian one. See for notes on supported resolutions.

Finally, please remember this very important point. If you run repo sync again at any time in the future to update all the repos, by default all the patches above would be discarded, so you’ll have reapply them again before rebuilding!