Android + OP-TEE compile error

Fixed. Please repo sync, reapply patches and try building again.

still same error even after i do sync.

can you please support.

Sorry, I forgot to mention, you also have to cd to .repo/local_manifests and run git pull. So

cd .repo/local_manifests
git pull
cd ../../
repo sync
# apply patches

If you’re still getting errors, it might help to delete the out folder before rebuilding.

Hello @vchong

Thanks for immediate update…my code compilation is ok now.

I have flashed the images on hikey board as mentioned in http://www.96boards.org/documentation/ConsumerEdition/HiKey/Installation/LinuxFastboot.md/ link.

After flashing these images i was unable to see my device with adb devices command(this is neither cable nor any other hardware problem because on same hardware i have tested with @deepakmnvl images and it is fine with those images).

It might be images problem which i was understood after cross checking @deepakmnvl images (boot_fat.uefi image is may be problem in my images).

can you please help me for this.

Thanks,
Raj.

Not sure. Maybe adb is on tcp. Can you connect from you pc using command below?

adb tcpip 5555 adb connect <hikey's ip address>:5555

You can try setting it back to usb from the hikey serial console using command below.
adb usb

hi @vchong,
I got the cable now ( 1.8v supported ) , and now I can see the OPTEE logs .
But , seems , not all logs are not appearing

I did below changes as per your previous suggestion

1. In device/linaro/hikey/uefi-tools/platforms.config, under the [hikey] node, uncomment the 3 lines required to use UART0. Then rebuild fip.bin.
2. In device/linaro/hikey/bootloader/EFI/BOOT/grub.cfg, line 6, change both ttyFIQ0 to ttyAMA0 and rebuild the image.
and 3. My build command has CFG_CONSOLE_UART=0

This is the only log appearing from boot :

debug EMMC boot: print init OK
debug EMMC boot: send RST_N .
debug EMMC boot: start eMMC boot......
load fastboot1!
NOTICE: acpu_dvfs_set_freq: set acpu freq success!NOTICE: BL2: v1.1(release):36aa82d
NOTICE: BL2: Built : 18:02:35, May 9 2017
NOTICE: BL3-1: v1.1(release):36aa82d
NOTICE: BL3-1: Built : 18:02:35, May 9 20INFO: TEE-CORE: Initializing (2.3.0-dev #46 Tue May 9 12:32:25 UTC 2017 aarch64)
INFO: TEE-CORE: Initialized
UEFI firmware (version Alpha built at 10:33:12 on Apr 4 2017)
EFI stub: Booting Linux Kernel...
EFI stub: EFI_RNG_PROTOCOL unavailable, no randomness supplied
EFI stub: Using DTB from configuration table
Failed to handle fs_proto
EFI stub: ERROR: Failed initrd from command line!
EFI stub: Exiting boot services and installing virtual address map...

Is this right ?

an update regarding logs :
When I build with TARGET_BOOTIMAGE_USE_FAT=true and flash boot_fat.uefi.img , I get some more logs .

Still , it seems I am not able to see all kernel logs , as seen in some posts in optee_os github :rolling_eyes:

EDIT :
Also , after boot-up , I am direclty getting the hikey promp with below msg.

[ 22.393142] healthd: battery l=100 v=0 t=42.4 h=2 st=2 chg=a
[ 22.900320] init: write_file: Unable to open ‘/proc/sys/vm/extra_free_kbytes’: No such file or directory
[ 24.123564] acc_open
[ 24.126026] acc_release
[ 28.517927] init: Service ‘bootanim’ (pid 1919) exited with status 0
[ 37.113208] EXT4-fs (mmcblk0p9): re-mounted. Opts: (null)
[ 84.640223] ttyAMA ttyAMA0: 1 input overrun(s)

hikey:/ $

Is this fine ?

After making the code changes and rebuilding android images, you did also rebuild and reflash fip.bin as well, right? fip.bin has to built and flashed separately of the regular build images.

INFO: TEE-CORE: Initialized means OP-TEE is loaded and initialized so it should be ok. Probably this is not a debug build so there are not many logs. Regarding kernel logs, have you tried comparing logs from a normal boot to see what’s missing? Not sure why there’s an overrun either. As mentioned before, I’ve not tried this and can only give suggestions, so maybe try:

  1. In device/linaro/hikey/bootloader/EFI/BOOT/grub.cfg, copy line 11 to line 6, change both ttyFIQ0 to ttyAMA0, and change 0xf7113000 to 0xf8015000.

  2. For the overrun, perhaps you can try this: http://www.linuxquestions.org/questions/linux-kernel-70/tty-usb-input-overruns-4175512707/

hi @vchong ,
I am trying to create a fresh AOSP stack.

When I am applying 1st patch , I am getting below error :

[10:06:28]svaddi@[~/Downloads/deepak/aosp2]$ ./android-patchsets/hikey-n-workarounds
=== Applying 17707/1 ===
From git://android-review.linaro.org/device/linaro/hikey

  • branch refs/changes/07/17707/1 → FETCH_HEAD
    error: could not apply 6e4ca3f… init rc files: enabled adb over tcpip by default
    hint: after resolving the conflicts, mark the corrected paths
    hint: with 'git add ’ or 'git rm ’
    hint: and commit the result with ‘git commit’
    17707/1 failed to apply, please fix
    HEAD is now at 1b597d4 hikey: remove redundant CONFIG_DRIVER_NL80211 :=y

Can you pls have a look at it ? and also other patchsets too ?

Thanks

Which branch are you using? Did you repo sync first? Anyway, in case you’re not aware, https://github.com/linaro-swg/optee_android_manifest/tree/hikey-n-4.9 is now obsolete. We’ve moved to an OP-TEE 2.4.0 build so please use https://github.com/linaro-swg/optee_android_manifest/tree/hikey-n-4.9-240. The 2.3.0 build has been ‘archived’ at https://github.com/linaro-swg/optee_android_manifest/tree/hikey-n-4.9-230 with slightly different build instructions, but I haven’t really tested it.

oohoo… didnt know about that.
Thanks for info

Hello vchong,

I have tried to compile hello world ta using above links with not including whole source code of AOSP.

I have maintained build,device,kernal,optee_os,out and prebuilt folders and in extrenal folder just optee_hello_world and optee_client only and tried to compile but got below errors.

main.c:28:17: fatal error: err.h: No such file or directory
#include <err.h>

even if i comment err.h in main.c to check it is giving same for stdio.h and string.h.

so could please let me know how these files are getting included in complete AOSP stack and how we can avoid that while building for specific helloworld ta.

PS : i have used below toolchains in AOSP stack.

prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-

Thanks,
Raj

I’m not sure since I’ve not tried building like this.
Searching through my source tree I see stdio.h in below additional directories that you didn’t maintain, so maybe try adding them.

bionic
ndk
development