Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

porting optee to alwinner h5 #65

Open
Avani8 opened this issue Aug 21, 2018 · 23 comments
Open

porting optee to alwinner h5 #65

Avani8 opened this issue Aug 21, 2018 · 23 comments

Comments

@Avani8
Copy link

Avani8 commented Aug 21, 2018

I'm trying to port optee to allwinner h5 board and for that I've created nano.xml here, and makefile based on juno.mk called nano.mk

I am able to compile the framwork and create bootable sd card but when I boot up I am getting following screenshot result :
screenshot from 2018-08-21 11-59-11

some notes:
art-tf : I've ported support for allwinner h5 board called sun50iw2p1 here
optee_os: I've made changes for h5 board support here
linux: I'm using frendlyarm core linux as seen here

I'm thinking do I have to use linaro-swg/linux ?
if so I don't see support for all winner h5 board

appreciate any advice

Thanks

Avani

@jforissier
Copy link

Hi @Avani8,

Is tee-supplicant running?

@Avani8
Copy link
Author

Avani8 commented Aug 21, 2018

how go I check that ?

@jforissier
Copy link

ps -ef | grep supplicant

@Avani8
Copy link
Author

Avani8 commented Aug 21, 2018

TEE test application started with device [(null)]
Failed to open TEE context: 0xffff0008
# tee-supplicant &
# ERR [633] TSUP:main:663: failed to find an OP-TEE supplicant device

I think yes :

C
# ^C
# ps -ef | grep supplicant
  644 root     grep supplicant
[1]+  Done(1)                    tee-supplicant
# 

@jforissier
Copy link

jforissier commented Aug 21, 2018

OK, so the TEE device is missing in /dev. tee-supplicant fails to start. What does dmesg | grep optee say?

@Avani8
Copy link
Author

Avani8 commented Aug 21, 2018

[1]+ Done(1) tee-supplicant

dmesg | grep optee

nothing

@jforissier
Copy link

Your kernel is lacking the OP-TEE driver. You need to enable CONFIG_TEE=y and CONFIG_OPTEE=y in the kernel config (and re-build the kernel).

@Avani8
Copy link
Author

Avani8 commented Aug 21, 2018

sure ...doing it now..thanks ..will post the results

@Avani8
Copy link
Author

Avani8 commented Aug 21, 2018

screenshot from 2018-08-21 14-43-54
after adding CONFIG_TEE=y and CONFIG_OPTEE=y in config file and recompiling

@jenswi-linaro
Copy link

What about the DTB, does it contain an optee node?

@Avani8
Copy link
Author

Avani8 commented Aug 21, 2018

So I used sudo dtc -I dtb -O dts sun50i-h5-nanopi-neo-plus2.dtb > a.txt
and attache dis the result of it. not seeing optee in it
a.txt

@jenswi-linaro
Copy link

That's needed too:

        firmware {
                optee {
                        compatible = "linaro,optee-tz";
                        method = "smc";
                };
        };

@Avani8
Copy link
Author

Avani8 commented Aug 21, 2018

ohh I see... how hard is to add support for h5 board on swg-linux ?
I mean i have dts info and Friendly source code

@jenswi-linaro
Copy link

That's easy just add something like 14e21cb ("arm64: dt: hikey: Add optee node") for the dts in question

@Avani8
Copy link
Author

Avani8 commented Aug 23, 2018

So I've added code as 14e21cb in dts but getting the same result.

can some one please look at the buildroot part of the code here and suggest am I doing something wrong in building the image ?

steps I followed are as follow
1)after sudo make all I take rootfs.cpio.gz from out-br/images and copy to rootfs of sd card
2) copy u-boot.itb and u-boot-spl.bin into sdcard
3) copy all the files which are commented in flash code in nano.mk to boot partition on sd card
#$(FTP-UPLOAD) $(ARM_TF_PATH)/build/sun50i_h5/release/bl31.bin
#$(FTP-UPLOAD) $(ARM_TF_PATH)/build/sun50i_h5/release/fip.bin
#$(FTP-UPLOAD) $(ROOT)/linux/arch/arm64/boot/Image
#$(FTP-UPLOAD) $(ROOT)/linux/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi*.dtb
#$(FTP-UPLOAD) $(ROOT)/out-br/images/rootfs.cpio.gz
and lastly sunxi boards are required boot.scr to load the files from sc card which I generate from boot.cmd as shown here.

then plug the card into device and getting attached screenshot result.

screenshot from 2018-08-21 11-59-11
screenshot from 2018-08-21 14-43-54

@Avani8
Copy link
Author

Avani8 commented Aug 23, 2018

screenshot from 2018-08-23 08-39-26
screenshot from 2018-08-23 08-40-02

sorry I attached old screen captures attached here are new snippets

@jbech-linaro
Copy link

jbech-linaro commented Aug 23, 2018

I sitll believe that the kernel driver(s) for TEE isn't included. It's not that your .config gets overwritten? We're enabling the flags @jforissier mentioned in our top-level makefiles and extra kconfig files.

[jbech@guppy ~/devel/optee_projects/qemu/build] [(HEAD detached at 129d3df) !?]
$ rg CONFIG_TEE
kconfigs/rpi3.conf
1:CONFIG_TEE=y

kconfigs/fvp.conf
1:CONFIG_TEE=y

kconfigs/hikey960.conf
1:CONFIG_TEE=y

kconfigs/qemu.conf
1:CONFIG_TEE=y

kconfigs/hikey.conf
1:CONFIG_TEE=y

kconfigs/hikey_debian.conf
1:CONFIG_TEE=y

kconfigs/juno.conf
1:CONFIG_TEE=y

kconfigs/poplar.conf
1:CONFIG_TEE=y

kconfigs/mediatek.conf
1:CONFIG_TEE=y

@Avani8
Copy link
Author

Avani8 commented Aug 23, 2018

This points me the board I've is not on the list. I am using sunxi-h5 -- nanopi-neo plus 2 ..and in my local I've /build/kconfigs/nano_conf , which has CONFIG_TEE=y
CONFIG_OPTEE=y

@jbech-linaro
Copy link

After you've built everything, what do you get if you cd into linux and run:

$ grep -e "CONFIG_TEE\|CONFIG_OPTEE" .config

I get:

$ grep -e "CONFIG_TEE\|CONFIG_OPTEE" .config
CONFIG_TEE=y
CONFIG_OPTEE=y
# CONFIG_OPTEE_BENCHMARK is not set

@Avani8
Copy link
Author

Avani8 commented Aug 23, 2018

screenshot from 2018-08-23 13-38-02
I also got the same

@jenswi-linaro
Copy link

What's the output from:

ls /proc/device-tree/firmware/optee

on the target system?

@Avani8
Copy link
Author

Avani8 commented Aug 24, 2018

screenshot from 2018-08-24 14-48-30

@jenswi-linaro
Copy link

That means that the node in the DTB is there. The OP-TEE driver should be probed etc then. I don't know why it silently fails to initialize. I guess it's time for some debug prints here and there in optee_driver_init() and optee_probe().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants