Optee android manifest on hikey

Hello,

I am following this guide : https://github.com/linaro-swg/optee_android_manifest
While flashing, process waiting after following log
±---------------------+
Serial: /dev/ttyUSB0
Image1: l-loader.bin
Image2:
±---------------------+

Sending l-loader.bin …
Done

and waiting

thanks

Are you using the flash-all.sh script? If not, the board is in fastboot mode waiting for commands so you can now start flashing images using fastboot flash <partition> <image> commands.

Yes, I used flash-all.sh. After run script, I see logs which I said my previous post, then I am waiting. I can’t see new terminal line.

Some things to check.

  1. Check jumper settings are on recovery mode, i.e. 1-2 connected, 3-4 connected and 5-6 disconnected.

  2. Do you have both the micro usb and uart cable connected to your PC too? If so, then there are 2 /dev/ttyUSB#. Make sure you use the right one, i.e. the one for the micro usb.

@vchong
I have done everything that you said (manifest link and in this post). Then I used flash-all.sh script. But, same problem. Then I tried to not use flash-all.sh script. First of all I run sudo python hisi-idt.py --img1=l-loader.bin -d /dev/ttyUSB0. It is done, there is no problem. But, when I tried to run fastboot devices command in 90 seconds, there is nothing. I think, somethings are wrong. But, I couldn’t understand this.

What’s the output of lsusb and sudo dmesg | grep ttyUSB?

Are you using a virtual linux machine by any chance?

Can you try another USB cable and/or PC?

Please paste output from both PC and board.

Bus 002 Device 002: ID 8087:8000 Intel Corp. 
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 03f0:064a Hewlett-Packard 
Bus 003 Device 019: ID 12d1:3609 Huawei Technologies Co., Ltd. 
Bus 003 Device 003: ID 03f0:094a Hewlett-Packard Optical Mouse [672662-001]
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[ 6750.921933] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[ 6798.802875] usb 3-2: GSM modem (1-port) converter now attached to ttyUSB0

No.

@vchong I think, the board does not pass fastboot mode automatically. my l-loader.bin is 26kb. But, l-loader.bin is 46kb in https://github.com/96boards/documentation/wiki/Reference-Bootloader-Hikey. Something is missing? Maybe this can be good information for solving.

while using Reference-Bootloader-Hikey, fastboot devices command is ok. But, in optee-android-manifest after flashing l-loader.bin, fastboot devices command doesnt return any result.

Mine is 24kb. You can always try sudo python hisi-idt.py --img1=l-loader.bin -d /dev/ttyUSB0 using the one from https://github.com/96boards/documentation/wiki/Reference-Bootloader-Hikey and see if you can get to fastboot mode this way. At this point l-loader.bin shouldn’t affect anything you need to do so you can always try a prebuilt version.

Hi @vchong,

I changed l-loader.bin with https://github.com/96boards/documentation/wiki/Reference-Bootloader-Hikey. With l-loader.bin from reference-bootloader link, I can see fastboot mode for HiKey and flashed all images. But, Reboot is not working. Board is not working.

Secondly, I copied all bin and image files from reference-bootloader link then flashed images and bin. HiKey is working but if xtest is worked, there are errors.

I think, there are some errors last revision of l-loader.bin. I can not pass fastboot mode in HiKey. I double-checked everything. Please, control it.

You’re right. There might be a problem currently with l-loader.bin.

In .repo/local_manifest/linaro.xml, there’s a line that says:

<project path="device/linaro/bootloader/arm-trusted-firmware" name="device/linaro/bootloader/arm-trusted-firmware" revision="master"/>

Change revision="master" to revision="oreo-release" and rebuild.

if xtest is worked, there are errors

Probably because of mismatch in version of the op-tee components in the images from reference-bootloader and the android ones you built.

Reboot is not working. Board is not working.

Please don’t just say “not working”. Provide some logs, especially for the error messages.

Which branch of https://github.com/linaro-swg/optee_android_manifest are you using?

hikey-n-4.9-master

You are right bu there is no understandable log. Just BL1.bin successed and process is waiting. There is no error.
Because of that, I didnt provide some logs.

@vchong Thanks. Hikey is working. But there are some errors for xtest. Maybe, they can be effective for your working.

regression_1014.1 FAILED first error at external/optee_test/host/xtest/regression_1000.c:1202
regression_1014.2 FAILED first error at external/optee_test/host/xtest/regression_1000.c:1208
regression_1014.3 FAILED first error at external/optee_test/host/xtest/regression_1000.c:1214
regression_1014 FAILED

@vchong I want to connect 7inch LCD screen to Hikey board. Now, screen is not working. Can I do following solution in Screen monitor resolution this link : https://source.android.com/setup/devices

You’re welcome. For the errors, you can try deleting everything under /data/tee and run xtest again. You might have some corrupted files left over from previous failed tests. I ran all tests ~2 weeks ago without issues.

Sorry but I’ve not done any work with LCD screens so can’t really advise you on it. You can try searching the forum for related discussions. Some useful links might be http://www.lenovator.com/product/102.html and https://github.com/Tony-HIT/96Boards_Mezzanine_LCD_Kit. If your screen uses a MIPI connection like in these links then the screen monitor resolution you mentioned above might not work since it’s for HDMI.

Ok @vchong. Last question about importing TA. I think, I dont need to change anything in this android optee manifest folder for TA. Is it enough for importing TA as doing following link : Trusted Applications on OP-TEE - #7 by vchong?

Yes the link is fine. Probably easier to just adb push the files. You might have to run adb root; adb remount first before pushing.

on QEMU we need to update rootfs. For Hikey, I have to do following while building TA?

file /bin/hello_world ${TOP}/optee_hello_world/host/hello_world 755 0 0
file /lib/optee_armtz/8aaaf200-2450-11e4-abe20002a5d5c51b.ta ${TOP}/optee_hello_world/ta/8aaaf200-2450-11e4-abe20002a5d5c51b.ta 444 0 0

No. The QEMU build system used is different than the android one. To adb push your app/TA to the board you’ll have to build it separate from the main android build and maybe that might not be so straightforward either. I think the easiest for now is probably to look at external/optee_examples. Make a copy of hello_world and call it my_demo or whatever. Then make the appropriate changes (put your own code) to my_demo and rebuild. After that reflash system.img and you should see your app/TA in the file system.

[edited for typo/accuracy]

A thing that I understand from your last post, I have to build Trusted Application seperately from main android build. Then I have to put builded files to /system/bin and /system/lib/optee_armtz. And all is done for running TA.
But, I dont understand that easiest way you said

You can build TAs separately from the main android build if that’s what you prefer. There’s no guide for doing this atm, mainly because you’ve to use an android toolchain which can work differently than linux toolchain (not sure if just using the linux toolchain might work). If you can get it done, then it’s easier to put the TAs onto the board, i.e. using adb push.

The other way is to include your TA into the main android build, which is convenient for building, but you have to reflash system.img which is more troublesome than adb push.

If you use external/optee_examples/hello_world as a reference and create say external/optee_examples/my_demo, then your TA will be included into the main build. You also need to update the device/linaro/hikey/optee-packages.mk to get the demo files into system.img. See https://github.com/OP-TEE/optee_os/issues/1809 for reference.

I deleted everthing under /data/tee and run xtest again. I have done this three times and result of test:

Result of testsuite regression:
regression_1001 OK
regression_1002 OK
regression_1003 OK
regression_1004 OK
regression_1005 OK
regression_1006 OK
regression_1007 OK
regression_1008 OK
regression_1009 OK
regression_1010 OK
regression_1011 OK
regression_1012 OK
regression_1013 OK
regression_1014.1 FAILED first error at external/optee_test/host/xtest/regression_1000.c:1202
regression_1014.2 FAILED first error at external/optee_test/host/xtest/regression_1000.c:1208
regression_1014.3 FAILED first error at external/optee_test/host/xtest/regression_1000.c:1214
regression_1014 FAILED
regression_1015 OK
regression_1016 OK
regression_2001 OK
regression_2002 OK
regression_2003 OK
regression_2004 OK
regression_4001 OK
regression_4002 OK
regression_4003_NO_XTS OK
regression_4003_XTS OK
regression_4004 OK
regression_4005 OK
regression_4006 OK
regression_4007 OK
regression_4008 OK
regression_4009 OK
regression_4010 OK
regression_4011 OK
regression_5006 OK
regression_6001 OK
regression_6002 OK
regression_6003 OK
regression_6004 OK
regression_6005 OK
regression_6006 OK
regression_6007 OK
regression_6008 OK
regression_6009 OK
regression_6010 OK
regression_6012.1 FAILED first error at external/optee_test/host/xtest/regression_6000.c:1464
regression_6012 FAILED
regression_6013 OK
regression_6014 OK
regression_6015 OK
regression_6016 OK
regression_6017 OK
regression_6018 OK
regression_6019 OK
regression_7001 OK
regression_7002 OK
regression_7003 OK
regression_7004 OK
regression_7005 OK
regression_7006 OK
regression_7007 OK
regression_7008 OK
regression_7009 OK
regression_7010 OK
regression_7013 OK
regression_7016 OK
regression_7017 OK
regression_7018 OK
regression_7019 OK
regression_8001 OK
regression_8002 OK
+-----------------------------------------------------
15677 subtests of which 4 failed
68 test cases of which 2 failed
0 test case was skipped
TEE test application done!