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

Does OP-TEE in ROCK Pi 4 supports Ethernet connectivity? #6621

Closed
guilhermeeec opened this issue Jan 17, 2024 · 6 comments
Closed

Does OP-TEE in ROCK Pi 4 supports Ethernet connectivity? #6621

guilhermeeec opened this issue Jan 17, 2024 · 6 comments
Labels

Comments

@guilhermeeec
Copy link

Hello,
After deploying OP-TEE in ROCK Pi 4, I noticed that the Ethernet network interface is not present.

# cat /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0

ip a command just presents loopback interface. There is no eth0 and the typical network service restart and ifdown/ifup do not work.

Could someone clarify me if OP-TEE implementation for ROCK Pi 4 really lacks some important component necessary for connectivity using the cabled network port? Am I missing something?

I am sending bellow the logs from the start-up.

U-Boot TPL 2022.10 (Jan 10 2024 - 10:45:51)
lpddr4_set_rate: change freq to 400MHz 0, 1
Channel 0: LPDDR4, 400MHz
BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
Channel 1: LPDDR4, 400MHz
BW=32 Col=10 Bk=8 CS0 Row=16/15 CS=1 Die BW=16 Size=2048MB
256B stride
lpddr4_set_rate: change freq to 800MHz 1, 0
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2022.10 (Jan 10 2024 - 10:45:51 -0300)
Trying to boot from MMC2


U-Boot 2022.10 (Jan 10 2024 - 10:45:51 -0300)

SoC: Rockchip rk3399
Reset cause: POR
Model: Radxa ROCK Pi 4B
DRAM:  3.9 GiB
PMIC:  RK808 
Core:  271 devices, 25 uclasses, devicetree: separate
MMC:   mmc@fe310000: 2, mmc@fe320000: 1, mmc@fe330000: 0
Loading Environment from nowhere... OK
In:    serial
Out:   serial
Err:   serial
Model: Radxa ROCK Pi 4B
Hit any key to stop autoboot:  0 
.. Looking for /boot/Image.gz in mmc 1:5
Card did not respond to voltage select! : -110
** Bad device specification mmc 1 **
Couldn't find partition mmc 1:5
.. Looking for /boot/Image.gz in mmc 0:5
.. Found
.. Loading kernel
13537725 bytes read in 1643 ms (7.9 MiB/s)
Uncompressed size: 41591296 = 0x27AA200
.. Loading DTB: mmc 0:5 /boot/rk3399-rock-pi-4b.dtb
61905 bytes read in 28 ms (2.1 MiB/s)
.. Booting kernel
Moving Image from 0x2080000 to 0x2200000, end=4a50000
## Flattened Device Tree blob at 01f00000
  Booting using the fdt blob at 0x1f00000
  Loading Device Tree to 00000000f1f44000, end 00000000f1f561d0 ... OK

Starting kernel ...

I/TC: Secondary CPU 1 initializing
I/TC: Secondary CPU 1 switching to normal world boot
I/TC: Secondary CPU 2 initializing
I/TC: Secondary CPU 2 switching to normal world boot
I/TC: Secondary CPU 3 initializing
I/TC: Secondary CPU 3 switching to normal world boot
I/TC: Secondary CPU 4 initializing
D/TC:4   select_vector_wa_spectre_v2:649 SMCCC_ARCH_WORKAROUND_1 (0x80008000) available
D/TC:4   select_vector_wa_spectre_v2:651 SMC Workaround for CVE-2017-5715 used
I/TC: Secondary CPU 4 switching to normal world boot
I/TC: Secondary CPU 5 initializing
D/TC:5   select_vector_wa_spectre_v2:649 SMCCC_ARCH_WORKAROUND_1 (0x80008000) available
D/TC:5   select_vector_wa_spectre_v2:651 SMC Workaround for CVE-2017-5715 used
I/TC: Secondary CPU 5 switching to normal world boot
[    0.000000] Linux version 6.6.0-ga24278ea74b2 (root@guapimirim) (aarch64-linux-gnu-gcc (Arm GNU Toolchain 11.3.Rel1) 11.3.1 20220712, GNU ld (Arm GNU Toolchain 11.3.Rel1) 2.38.20220708) #1 SMP PREEMPT Wed Jan 10 10:51:15 -03 2024
[    0.000000] KASLR disabled due to lack of seed
[    0.000000] Kernel command line: console=ttyS2,1500000 root=PARTUUID=17d61bff-8fdc-4089-b675-9be21b9f6ac7 loglevel=6 rootwait
[    0.007048] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    0.055946] audit: type=2000 audit(0.052:1): state=initialized audit_enabled=0 res=1
[    0.110621] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.111573] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.112270] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.112951] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.113646] gpio gpiochip4: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.131718] SCSI subsystem initialized
[    0.139395] VFS: Disk quotas dquot_6.6.0
[    0.162612] Initialise system trusted keyrings
[    0.163563] NFS: Registering the id_resolver key type
[    0.163589] Key type id_resolver registered
[    0.163595] Key type id_legacy registered
[    0.198504] Key type asymmetric registered
[    0.198510] Asymmetric key parser 'x509' registered
[    0.391099] dw_wdt ff848000.watchdog: No valid TOPs array specified
I/TC: Reserved shared memory is enabled
I/TC: Dynamic shared memory is disabled
I/TC: Normal World virtualization support is disabled
I/TC: Asynchronous notifications are disabled
D/TC:? 0 tee_ta_init_pseudo_ta_session:297 Lookup pseudo TA 7011a688-ddde-4053-a5a9-7b3c4ddf13b8
D/TC:? 0 tee_ta_init_pseudo_ta_session:310 Open device.pta
D/TC:? 0 tee_ta_init_pseudo_ta_session:327 device.pta : 7011a688-ddde-4053-a5a9-7b3c4ddf13b8
D/TC:? 0 tee_ta_close_session:463 csess 0x300a8050 id 1
D/TC:? 0 tee_ta_close_session:482 Destroy session
[    0.439462] Key type dns_resolver registered
[    0.452266] Loading compiled-in X.509 certificates
[    0.559746] GPT:Primary header thinks Alt. header is not at the end of the disk.
[    0.560435] GPT:255999 != 60620799
[    0.560760] GPT:Alternate GPT header not at the end of the disk.
[    0.561299] GPT:255999 != 60620799
[    0.561622] GPT: Use GNU Parted to correct GPT errors.
[    0.722871] dw-apb-uart ff1a0000.serial: forbid DMA for kernel console
[    0.856912] EXT4-fs (mmcblk0p5): warning: mounting unchecked fs, running e2fsck is recommended
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Initializing random number generator: OK
Saving random seed: [   11.515185] random: crng init done
OK
Set permissions on /dev/tee*: OK
Create/set permissions on /data/tee: OK
Starting tee-supplicant: Using device /dev/teepriv0.
D/TC:? 0 tee_ta_init_session_with_context:561 Re-open TA 7011a688-ddde-4053-a5a9-7b3c4ddf13b8
OK
D/TC:? 0 tee_ta_close_session:463 csess 0x300a7f30 id 1
D/TC:? 0 tee_ta_close_session:482 Destroy session
Starting network: OK

I have also searched if system logs could give me some insight and looks like there are drivers present.

# dmesg | grep -i eth
[    0.000000] psci: probing for conduit method from DT.
[    0.357075] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version
[    0.357248] igb: Intel(R) Gigabit Ethernet Network Driver
[    0.428392] optee: probing for conduit method.  

However, I could not find any other important logs concerning these drivers:

# dmesg | grep -i igb
[    0.357248] igb: Intel(R) Gigabit Ethernet Network Driver
[    0.357255] igb: Copyright (c) 2007-2014 Intel Corporation.
[    0.357287] igbvf: Intel(R) Gigabit Virtual Function Network Driver
[    0.357293] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.

Please feel free to ask me any other information about my deployment that could help with the analysis.

Copy link

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, otherwise this issue will automatically be closed in 5 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the Stale label Feb 17, 2024
@jforissier
Copy link
Contributor

Hi @guilhermeeec, sorry for the late reply. In case you did not find out, you need to build with LINUX_MODULES=y:

build$ make -j$(nproc) boot-img LINUX_MODULES=y BR2_TARGET_ROOTFS_EXT2_SIZE=640M
build$ sudo dd if=../out/rockpi4.img of=/dev/mmcblkX

The default build is quite minimal, it is just enough to boot and run the optee_test suite basically (xtest).
Note: I'll create a PR to adjust the root FS size which appears to be insufficient now.

@github-actions github-actions bot removed the Stale label Feb 20, 2024
Copy link

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, otherwise this issue will automatically be closed in 5 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the Stale label Mar 21, 2024
@guilhermeeec
Copy link
Author

Hi @jforissier. Thanks for the response. I'm uploading the system to the board using the mask ROM button and a USB 3 port. for this, I'm running:

make -j20 LINUX_MODULES=y BR2_TARGET_ROOTFS_EXT2_SIZE=640M BR2_PACKAGE_OPENSC=y BR2_PACKAGE_LIBOPENSSL=y BR2_PACKAGE_LIBOPENSSL_BIN=y BR2_PACKAGE_LIBP11=y
make flash

I do not use dd and it still do not work.

@github-actions github-actions bot removed the Stale label Mar 27, 2024
@jforissier
Copy link
Contributor

Hi @guilhermeeec, what do you mean it does not work? What kind of error do you get?
It does work for me. Here is the procedure I follow with make flash.

First, cloning and building:

mkdir optee
cd optee
repo init -u https://github.com/OP-TEE/manifest.git -m rockpi4.xml
repo sync -j20
cd build
make -j$(nproc) LINUX_MODULES=y BR2_TARGET_ROOTFS_EXT2_SIZE=640M BR2_PACKAGE_OPENSC=y BR2_PACKAGE_LIBOPENSSL=y BR2_PACKAGE_LIBOPENSSL_BIN=y BR2_PACKAGE_LIBP11=y

Connect the FTDI UART cable to the Rockpi header and to the build computer then run:

pyserial-miniterm --raw --eol CR /dev/ttyUSB0 1500000

That's the Rockpi console.

Connect a USB C to A cable, type C connector side is connected to the build computer, type A connector is connected to the top blue port on the Rockpi. Make sure no SD card is inserted. Press the leftmost button under the HDMI port. Keep this button depressed and connect the USB C power cable then release the button. On the build computer, do lsusb | grep ROM. You should see something similar to:

Bus 003 Device 038: ID 2207:330c Fuzhou Rockchip Electronics Company RK3399 in Mask ROM mode

At this point flashing should work. From the build directory run:

make flash

This will build the rkdevelop tool (if not already built) then send the image to the board with messages similar to:

Please connect the board to the computer via a USB cable.
The cable must be connected to the upper USB 3 (blue) port.
Then press and hold the mask ROM button (first one on the left
under the HDMI connector), apply power and release the button.
(More details at https://wiki.radxa.com/Rockpi4/dev/usb-install)

Press enter to continue, Ctrl-C to cancel:
/home/jerome/work/optee_repo_rockpi4_builder/build/../rkdeveloptool/rkdeveloptool db /home/jerome/work/optee_repo_rockpi4_builder/build/../out/rk3399_loader_v1.20.119.bin
Downloading bootloader succeeded.
sleep 1
/home/jerome/work/optee_repo_rockpi4_builder/build/../rkdeveloptool/rkdeveloptool wl 0 /home/jerome/work/optee_repo_rockpi4_builder/build/../out/rockpi4.img
Write LBA from file (100%)

Now the board is ready, pull the USB-C power cord and insert it back again. It should boot straight into linux:

U-Boot TPL 2022.10 (Apr 03 2024 - 16:08:15)
lpddr4_set_rate: change freq to 400MHz 0, 1
Channel 0: LPDDR4, 400MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
Channel 1: LPDDR4, 400MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
256B stride
lpddr4_set_rate: change freq to 800MHz 1, 0
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2022.10 (Apr 03 2024 - 16:08:15 +0200)
Trying to boot from MMC2


U-Boot 2022.10 (Apr 03 2024 - 16:08:15 +0200)

SoC: Rockchip rk3399
Reset cause: POR
Model: Radxa ROCK Pi 4B
DRAM:  3.9 GiB
PMIC:  RK808
Core:  271 devices, 25 uclasses, devicetree: separate
MMC:   mmc@fe310000: 2, mmc@fe320000: 1, mmc@fe330000: 0
Loading Environment from nowhere... OK
In:    serial
Out:   serial
Err:   serial
Model: Radxa ROCK Pi 4B
Hit any key to stop autoboot:  0
.. Looking for /boot/Image.gz in mmc 1:5
Card did not respond to voltage select! : -110
** Bad device specification mmc 1 **
Couldn't find partition mmc 1:5
.. Looking for /boot/Image.gz in mmc 0:5
.. Found
.. Loading kernel
13537717 bytes read in 1334 ms (9.7 MiB/s)
Uncompressed size: 41591296 = 0x27AA200
.. Loading DTB: mmc 0:5 /boot/rk3399-rock-pi-4b.dtb
61905 bytes read in 29 ms (2 MiB/s)
.. Booting kernel
Moving Image from 0x2080000 to 0x2200000, end=4a50000
## Flattened Device Tree blob at 01f00000
   Booting using the fdt blob at 0x1f00000
   Loading Device Tree to 00000000f1f44000, end 00000000f1f561d0 ... OK

Starting kernel ...

I/TC: Secondary CPU 1 initializing
I/TC: Secondary CPU 1 switching to normal world boot
I/TC: Secondary CPU 2 initializing
I/TC: Secondary CPU 2 switching to normal world boot
I/TC: Secondary CPU 3 initializing
I/TC: Secondary CPU 3 switching to normal world boot
I/TC: Secondary CPU 4 initializing
I/TC: Secondary CPU 4 switching to normal world boot
I/TC: Secondary CPU 5 initializing
I/TC: Secondary CPU 5 switching to normal world boot
[    0.000000] Linux version 6.6.0-ga24278ea74b2 (jerome@builder) (aarch64-linux-gnu-gcc (Arm GNU Toolchain 11.3.Rel1) 11.3.1 20220712, GNU ld (Arm GNU Toolchain 11.3.Rel1) 2.38.20220708) #1 SMP PREEMPT Wed Apr  3 15:09:02 CEST 2024
[    0.000000] KASLR disabled due to lack of seed
[    0.000000] Kernel command line: console=ttyS2,1500000 root=PARTUUID=17d61bff-8fdc-4089-b675-9be21b9f6ac7 loglevel=6 rootwait
[    0.007029] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    0.053109] audit: type=2000 audit(0.048:1): state=initialized audit_enabled=0 res=1
[    0.107803] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.108749] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.109444] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.110127] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.110806] gpio gpiochip4: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    0.128892] SCSI subsystem initialized
[    0.136509] VFS: Disk quotas dquot_6.6.0
[    0.159755] Initialise system trusted keyrings
[    0.160701] NFS: Registering the id_resolver key type
[    0.160736] Key type id_resolver registered
[    0.160742] Key type id_legacy registered
[    0.194402] Key type asymmetric registered
[    0.194409] Asymmetric key parser 'x509' registered
[    0.386905] dw_wdt ff848000.watchdog: No valid TOPs array specified
I/TC: Reserved shared memory is enabled
I/TC: Dynamic shared memory is disabled
I/TC: Normal World virtualization support is disabled
I/TC: Asynchronous notifications are disabled
[    0.433588] Key type dns_resolver registered
[    0.446649] Loading compiled-in X.509 certificates
[    0.583519] GPT:Primary header thinks Alt. header is not at the end of the disk.
[    0.584199] GPT:1337343 != 120831999
[    0.584570] GPT:Alternate GPT header not at the end of the disk.
[    0.585102] GPT:1337343 != 120831999
[    0.585424] GPT: Use GNU Parted to correct GPT errors.
[    0.717496] dw-apb-uart ff1a0000.serial: forbid DMA for kernel console
Saving 256 bits of non-creditable seed for next boot
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Populating /dev using udev: [    7.908462] random: crng init done
[    8.303297] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    8.478565] Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    8.479134] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    8.612730] dw-apb-uart ff180000.serial: failed to request DMA
[    8.780295] rockchip-pcie f8000000.pcie: PCIe link training gen1 timeout!
[    8.780963] rockchip-pcie: probe of f8000000.pcie failed with error -110
[    8.785647] brcmfmac mmc2:0001:1: Direct firmware load for brcm/brcmfmac43456-sdio.radxa,rockpi4b.bin failed with error -2
[    8.786678] brcmfmac mmc2:0001:1: Direct firmware load for brcm/brcmfmac43456-sdio.bin failed with error -2
[    8.860377] Bluetooth: hci0: BCM: firmware Patch file not found, tried:
[    8.860962] Bluetooth: hci0: BCM: 'brcm/BCM4345C5.radxa,rockpi4b.hcd'
[    8.861526] Bluetooth: hci0: BCM: 'brcm/BCM4345C5.hcd'
[    8.861977] Bluetooth: hci0: BCM: 'brcm/BCM.radxa,rockpi4b.hcd'
[    8.862495] Bluetooth: hci0: BCM: 'brcm/BCM.hcd'
done
Set permissions on /dev/tee*: [    8.888387] Bluetooth: hci0: Opcode 0x2031 failed: -22
OK
Create/set permissions on /data/tee: OK
Starting tee-supplicant: Using device /dev/teepriv0.
OK
Starting network: udhcpc: started, v1.36.1
udhcpc: broadcasting discover
[    9.800561] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50
udhcpc: no lease, forking to background
OK
ssh-keygen: generating new host keys: RSA ECDSA ED25519
Starting sshd: OK

Welcome to Buildroot, type root or test to login
buildroot login: test
$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=116 time=16.405 ms
64 bytes from 8.8.8.8: seq=1 ttl=116 time=16.653 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 16.405/16.529/16.653 ms
$ cat /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  eth0:   10516     152    0    0    0     0          0         0     1957      18    0    0    0     0       0          0
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq qlen 1000
    link/ether 9e:48:ac:74:19:91 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.44/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 2a01:e0a:3cb:7bb0:9c48:acff:fe74:1991/64 scope global dynamic flags 100
       valid_lft 86136sec preferred_lft 86136sec
    inet6 fe80::9c48:acff:fe74:1991/64 scope link
       valid_lft forever preferred_lft forever
$

Copy link

github-actions bot commented May 4, 2024

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, otherwise this issue will automatically be closed in 5 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the Stale label May 4, 2024
@github-actions github-actions bot closed this as completed May 9, 2024
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

2 participants