OP-TEE / optee_os

Trusted side of the TEE
Other
1.58k stars 1.07k forks source link

Juno: failed to find an OP-TEE supplicant device #735

Closed Miraje closed 8 years ago

Miraje commented 8 years ago

Hi, I am testing OP-TEE on ARM Juno board (more specifically r2 version) and I had a error while starting tee-suplicant: TEES:main:376: failed to find an OP-TEE supplicant device I'm guessing it is because it can't find the two drivers,/dev/tee0 and /dev/teepriv0. I looked for it in the filelist.txt and didn't found them. There is only two nodes in there (should be there nod optee ?):

nod /dev/console 644 0 0 c 5 1
nod /dev/null 644 0 0 c 1 3

I was hopping that someone knew how to fix this (the make allprocess succeed without any errors ).

When I was looking into the makefile (in build directory) I saw:

BUSYBOX_COMMON_TARGET = fvp
BUSYBOX_CLEAN_COMMON_TARGET = fvp clean

Shouldn't be vexpress instead of fvp ?

If someone could help me I would be very grateful. Thanks.

jenswi-linaro commented 8 years ago

Hi,

Most likely you're missing:

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

in the dts file.

Miraje commented 8 years ago

Thank you for your response @jenswi-linaro , but I checked the juno.dts file and it includes the file juno-base.dtsi (#include "juno-base.dtsi") which already has that definition. Could have anything to do with the model of the board? I'm currently using juno-r2

jenswi-linaro commented 8 years ago

We haven't tried OP-TEE on juno-r2 before, but since it boots it seems to be at least somewhat OK. The /dev/tee0 and /dev/teepriv0` are created automatically when the driver is initialized, so something is preventing the driver to initialized. Can you see something in the kernel log or on the "secure" uart?

Miraje commented 8 years ago

@jenswi-linaro-adm I'm sorry for the late response but I don't see any errors on the log and on the secure UART. Here is the output of the secure UART: http://pastebin.com/wYzsbrqn

I really wanted to work with the OP-TEE on the juno-r2 board.

Thanks.

jenswi-linaro commented 8 years ago

Do you see anything like this in the kernel log:

[    3.448367] usbcore: registered new interface driver usbhid
[    3.448426] usbhid: USB HID core driver
[    3.450445] optee firmware:optee: probing for conduit method from DT.
[    3.451493] optee firmware:optee: initialized driver
[    3.455273] NET: Registered protocol family 17
[    3.455731] 9pnet: Installing 9P2000 support

It's the optee lines that I'm looking for.

Miraje commented 8 years ago

No, those lines doesn't appear on the log. But now that I looked more carefully I found this line: [ 0.765380] dmi: Firmware registration failed.

jenswi-linaro commented 8 years ago

I have that line also on my Juno r1.

Since you have the optee entries in device tree, I guess that means that the driver isn't compiled into the kernel.

Miraje commented 8 years ago

I just noticed before starting the kernel appears this warning: *** Warning - bad CRC, using default environment

jenswi-linaro commented 8 years ago

I have that too... :-)

jenswi-linaro commented 8 years ago

Does ls /sys/firmware/devicetree/base/firmware/optee list any files?

Miraje commented 8 years ago

Unfortunately no: ls: /sys/firmware/devicetree/base/firmware/optee: No such file or directory

jenswi-linaro commented 8 years ago

That indicates that the optee node in device tree is missing.

Miraje commented 8 years ago

@jenswi-linaro I just made it, thank you so much for your help.

I added:

juno-r2.zip

In the directory:/devel/optee/linux/arch/arm64/boot/dts/arm/

And now every thing works just fine. I don't know if this was the problem but worked. I really I appreciate your help, once again thank you very very much.

I just have one more question. Should I change the makefile (in build directory) from:

BUSYBOX_COMMON_TARGET = fvp
BUSYBOX_CLEAN_COMMON_TARGET = fvp clean

to:

BUSYBOX_COMMON_TARGET = vexpress
BUSYBOX_CLEAN_COMMON_TARGET = vexpress clean

?

Miraje commented 8 years ago

@jenswi-linaro As this issue is already solved I'm closing this. Thank you for your help.

invhchan commented 8 years ago

I am having the same issue even though I made changes as suggested: adding:

juno-r2.dts juno-r2.dtb

And modified the 2nd line in the makefile to : dtb-$(CONFIG_ARCH_VEXPRESS) += juno.dtb juno-r1.dtb juno-r2.dtb In the directory:/devel/optee/linux/arch/arm64/boot/dts

The steps I did were:

  1. checkout source code $ mkdir -p $HOME/devel/optee $ cd $HOME/devel/optee $ repo init -u https://github.com/OP-TEE/manifest.git -m juno_stable.xml $ repo sync

Should I use juno_stable.xml or juno.xml? I tried both but the ramdisk.img generated with juno.xml is 29.15MB while that generated with juno_stable.xml is 7.17MB. I don't know how to modify the images.txt file.

  1. build toolchain $ cd build $ make toolchains
  2. make make all
  3. flash make JUNO_IP=ip address flash

Am I missing anything?

Miraje commented 8 years ago

Hi @invhchan , Currently, using the juno.xmlmanifest the size of ramdisk.imggoes to 29.15 MB because the use of gcc5. Those steps of copying the files aren't needed anymore if using juno.xml but if I'm not mistaken when the juno_stable.xml you still need to do them.
So I think there two possible ways:

1) Use the juno_stable version and copy those files and change the makefile and compile it 2) Use the juno version which is the more recent one and change the revision of the build repository to a previous version. In my case I used the one with the following hash: cfb99cf0a614204afcbf282bc8375183b895c3bf

Note: This is the way I proceeded to get it to work and may this may be a temporary problem. I already opened an issue #822 indicating the problem of the ramdisk.img size.