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

Running OPTEE on Raspberry Pi 3 with other root-fs #1398

Closed
utkarshagrawalwsu opened this issue Mar 9, 2017 · 20 comments
Closed

Running OPTEE on Raspberry Pi 3 with other root-fs #1398

utkarshagrawalwsu opened this issue Mar 9, 2017 · 20 comments
Labels

Comments

@utkarshagrawalwsu
Copy link

utkarshagrawalwsu commented Mar 9, 2017

Hello,

I am trying to run OPTEE on Raspberry Pi 3.. I am able to run it with the simple CPIO archive. But it limits me for developing further with that system as a base.

I tried following the instructions under 5.7 at
https://github.com/OP-TEE/build/blob/master/docs/rpi3.md

I am trying to accomplish that without NFS Boot, and would just like to do it through SD card.

I downloaded the Ubuntu based root-fs (linaro-vivid). Extracted it. Copied all the folders from linaro-vivid-developer-20151215-114.tar.gz (except boot folder) to SD Card/rootfs, and the boot folder from .../gen_rootfs/filesystem.cpio.gz to SD Card/BOOT

Also, I copied the necessary files as mentioned at 5.7:
Then you need to copy xtest and tee-supplicant to <NFS>/bin/, copy libtee.so* to <NFS>/lib/ and copy all *.ta files to <NFS>/lib/optee_armtz/

As I was afraid, it does not boot up the Pi3.

I know that I could be doing some steps totally wrong, as I am not experienced with booting custom file systems etc at all.

Any help with this would be appreciated.

Thanks!

@utkarshagrawalwsu
Copy link
Author

utkarshagrawalwsu commented Mar 9, 2017

As it turns out, there was some problem with the file system. So, it is working for now. I will try to flash it again to make sure that I get this step working properly.

But now, I am not able to load tee-supplicant. It says ERR [546] TEES:main:397: failed to find an OP-TEE supplicant device

Also, I do not see any eth0 interface. I tried ifconfig eth0 up, but it didn't work.

@jbech-linaro
Copy link
Contributor

To me this sounds like the kernel hasn't loaded OP-TEE, what does this say?

$ dmesg | grep optee

@utkarshagrawalwsu
Copy link
Author

utkarshagrawalwsu commented Mar 9, 2017

@jbech-linaro
It says as follows:

optee firmware:optee: probing for conduit method from DT
optee firmware:optee: initialized driver

I had to type out the result. Is there a better way to log the messages? I am using HDMI display to access the system. Also, I am not able to create any file. I tried sudo touch <filename>, but it didn't work either.

Based on the steps I mentioned earlier, have I setup the system correctly?

@jbech-linaro
Copy link
Contributor

jbech-linaro commented Mar 9, 2017

Alright, the driver seems OK, so then we can rule out that. I'm on a business trip, I'll see if I can have a closer look at it next week when I'm back home.

I had to type out the result. Is there a better way to log the messages?

I use the UART, but something like

$ dmesg | grep optee 2>&1 | tee /tmp/foo.log

should work I think.

@utkarshagrawalwsu
Copy link
Author

@jbech-linaro
Thank you for the reply.
Also, I am trying to run the QEMU build for OP-TEE as well. The TA's work fine on it. Can you point me in some direction to how to setup apt-get etc on it?

@jbech-linaro
Copy link
Contributor

@utkarshagrawalwsu , I'm sorry to say, but I haven't had time to follow up this. We're about to do a new OP-TEE release (scheduled for April 7th). Even though we use the CPIO archive for testing. I'm pretty sure we will try NFS also. I'll keep you posted.

@utkarshagrawalwsu
Copy link
Author

@jbech-linaro
Thank you for the follow up.

I managed to use QEMU to meet my requirements. Though, next I will be trying to run everything on the Raspberry Pi 3 again. It would be great if I can get the Ubuntu version to work on the Pi.

Also, can you help me to resolve the eth0 issue?

@igoropaniuk
Copy link
Contributor

Hi @utkarshagrawalwsu,

Regarding your ethernet issue, do you have eth0 device in your ifconfig output?

# ifconfig -a

if not, could you please provide output of this command also:

# dmesg | grep smsc95

@utkarshagrawalwsu
Copy link
Author

Hey @igoropaniuk !

Apologies for the late reply.

Output of dmesg | grep smsc95 :

[    0.000000] Kernel command line: console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootfs=ext4 ignore_loglevel dma.dmachans=0x7f35 rootwait 8250.nr_uarts=1 elevator=deadline fsck.repair=yes smsc95xx.macaddr=b8:27:eb:e4:a5:45 bcm2708_fb.fbwidth=1920 bcm2708_fb.fbheight=1080 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000
[    1.975617] usbcore: registered new interface driver smsc95xx
[    3.659121] smsc95xx v1.0.4
[    3.712965] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:e4:a5:45

Output of ifconfig -a :

eth0      Link encap:Ethernet  HWaddr B8:27:EB:E4:A5:45  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1%5174864/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Output of ifconfig -a, after I run ifconfig eth0 up :

eth0      Link encap:Ethernet  HWaddr B8:27:EB:E4:A5:45  
          inet6 addr: fe80::ba27:ebff:fee4:a545%5175248/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:138 (138.0 B)  TX bytes:634 (634.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1%5174864/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

@igoropaniuk
Copy link
Contributor

Hi @utkarshagrawalwsu ,

Seems that everything is fine. So you just need to run udhcpc init script with start param:

/etc/init.d/udhcpc start`

Example:

root@RPi3:/etc/init.d /etc/init.d/udhcpc start
udhcpc (v1.25.0.git) started
Setting IP address 0.0.0.0 on eth0
Sending discover...
Sending select for 192.168.1.153...
Lease of 192.168.1.153 obtained, lease time 7200
Setting IP address 192.168.1.153 on eth0
Deleting routers
route: SIOCDELRT: No such process
Adding router 192.168.1.1
Recreating /etc/resolv.conf
 Adding DNS server 194.50.85.5
 Adding DNS server 194.50.85.7

root@RPi3:/etc/init.d ifconfig
eth0      Link encap:Ethernet  HWaddr B8:27:EB:7C:97:F6  
          inet addr:192.168.1.153  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::ba27:ebff:fe7c:97f6%5174208/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2858 (2.7 KiB)  TX bytes:2112 (2.0 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1%5173824/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

@utkarshagrawalwsu
Copy link
Author

Hello @igoropaniuk

The command worked! Thank you so much for the help. Is it normal to not to have it already initialized when booting the system?

Also, I tried running telnet www.google.com 80, and I do not see any output. The networking works fine though, as I can now successfully ping the Pi from another computer on the network. The Ctrl + C interrupt doesn't work either. Any ideas what could be wrong? I am more concerned about the interrupt not working, than the telnet.

@igoropaniuk
Copy link
Contributor

Also, I tried running telnet www.google.com 80, and I do not see any output

it shouldn't, until you write correct GET request (as you are opening a TCP connection to the HTTP server)
http://stackoverflow.com/questions/15772355/how-to-send-an-http-request-using-telnet
I suggest to use more specialized tools for checking connectivity, like ping/traceroute/nslookup, they are all available in RPi3 rootfs.

The Ctrl + C interrupt doesn't work either

Try Ctrl + D, it should work

BTW, there are new updates for RPi3 setup (linaro-swg/gen_rootfs#21, OP-TEE/build@48ade15), maybe it will help to avoid additional keyboard and display issues in the future.

@igoropaniuk
Copy link
Contributor

Is it normal to not to have it already initialized when booting the system?

When nfsboot target is chosen in U-boot, linux kernel internal dhcp client is used (it's configurion is set in kernel bootargs ip=dhcp, for details see https://github.com/OP-TEE/build/blob/master/rpi3/firmware/uboot.env.txt#L41).

/etc/init.d/udhcpc script is a basic wrapper over BusyBox DHCP client udhcpc, which should be used only in mmcboot mode.

So in different boot modes we use different ways of bringing up networking, so it was one of the reasons to avoid autostarting this script by default.

@utkarshagrawalwsu
Copy link
Author

Hello @igoropaniuk

I have been going back and forth between QEMU and Pi, and because ping doesn't work in QEMU, I think I made an assumption in my mind that ping wont work in Pi.

I used the updated setup. Ctrl + D doesn't work, and neither does Ctrl + C. I can try to post the required debug messages you need.

Thank you for the explanation about the script.

@igoropaniuk
Copy link
Contributor

hi @utkarshagrawalwsu ,
In QEMU we are using SLiRP user networking mode by default (if you set QEMU_USERNET_ENABLE ), and it doesn't support ICMP traffic at all (for additional details check [http://wiki.qemu.org/Documentation/Networking#User_Networking_.28SLIRP.29])

I used the updated setup. Ctrl + D doesn't work, and neither does Ctrl + C. I can try to post the required debug messages you need.

Could you please also share your current /etc/inittab stored on your mmc card?
I'm also curios about that fact, that before my changes([https://github.com/linaro-swg/gen_rootfs/pull/21]) no shell was assigned to tty0 terminal (so you even shouldn't be able to see any prompt to enter shell cmds ).

BTW, I was wrong about /etc/init.d/udhcp, I've checked it once more, it's starting automatically by default in any case. And, sometimes, smsc95xx is enumerated too late, so when /etc/init.d/udhcp starts it just can't find eth0 (so you can find such error message ip: SIOCGIFFLAGS: No such device). I'll create an issue ticket for this.

ip: SIOCGIFFLAGS: No such device
.....
[    3.396486] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
Please press Enter to activate this console. [    3.503083] NET: Registered protocol family 10
[    3.508133] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[    3.515176] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    3.527654] smsc95xx v1.0.4
[    3.584004] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:7c:97:f6

@utkarshagrawalwsu
Copy link
Author

@igoropaniuk

I did read the networking documentation, and that's why somehow I made the silly assumption in my head.

Well, I followed the norm to search before creating an issue, and I found your answer to get the tty0 terminal working. I am glad that it is pushed in the repository now.

Is there any other debug information I can provide so solve the keyboard interrupt issue?

Thank you for clarifying the udhcp. I do see the ip: SIOCGIFFLAGS: No such device message. I am still learning how OP-TEE works, and I am curious as to where did you find that information in the code?

Thank You

@igoropaniuk
Copy link
Contributor

Hi @utkarshagrawalwsu,

Sorry for the late answer.

I am still learning how OP-TEE works, and I am curious as to where did you find that information in the code?

To my mind, previous questions aren't somehow related specifically to OP-TEE, it's more generic linux knowledge. Or I didn't get what you meant about the information in the code

Best regards,
Igor

@utkarshagrawalwsu
Copy link
Author

Hey @igoropaniuk

It might be Linux knowledge. I am not so well versed with Linux internals. I just didn't understand where did you exactly "check" about the udhcpc starting automatically.

Also, I am still unable to use the keyboard interrupt. Any suggestions on it?

@geetayadav
Copy link

@utkarshagrawalwsu Were you able to setup apt-get?

@github-actions
Copy link

github-actions bot commented Feb 5, 2020

This issue has been marked as a stale issue because it has been open (more than) 30 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 5 days. Note, that you can always re-open a closed issue at any time.

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

No branches or pull requests

4 participants