【OP-TEE 3.8.0学习】001_运行环境的搭建及编译

 

一、OP-TEE开发环境搭建(Ubuntu-20.04 & op-tee 3.8.0)

1. OP-TEE开发环境需要使用各种依赖库

sudo apt-get install android-tools-adb android-tools-fastboot autoconf automake bc \
bison build-essential cscope curl device-tree-compiler expect flex ftp-upload gdisk \
iasl libattr1-dev libc6:i386 libcap-dev libfdt-dev libftdi-dev libglib2.0-dev \
libhidapi-dev libncurses5-dev libpixman-1-dev libssl-dev libstdc++6 libtool \
zlib1g zlib1g:i386 libtool-doc gfortran make mtools netcat python-crypto nzip \
uuid-dev xdg-utils xterm xz-utils python3-pip python3-pyelftools texinfo texlive \

2. git配置

git config --global user.email "[email protected]"
git config --global user.name "Your Name"

3. 安装repo

$ wget https://mirrors.tuna.tsinghua.edu.cn/git/git-repo
$ sudo chmod 777 git-repo
$ sudo mv git-repo /usr/bin/repo

4. 获取OP-TEE源代码

repo init -u https://github.com/OP-TEE/manifest.git -m qemu_v8.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -b 3.8.0

获取op-tee源代码时出现如下异常:

 /usr/bin/env: ‘python’: No such file or directory

针对上述异常的解决办法:

【OP-TEE 3.8.0学习】001_运行环境的搭建及编译_第1张图片

5. sync OP-TEE源代码

repo sync -c -j16

sync后op-tee工程目录如下:

【OP-TEE 3.8.0学习】001_运行环境的搭建及编译_第2张图片

如果在执行repo sync时出现“remote:Repository not found”的报错提示,则需要修改open-tee/.repo目录中的manifest.xml文件,将该文件中所有project域中的“.git”删除,也可以通过如下指令进行修改:

sed -i "s/\.git//g" .repo/manifest.xml

修改完成之后,重新执行repo sync来获取OP-TEE的代码。

6. 获取编译OP-TEE的toolchain

$ cd build
$ make -f toolchain.mk toolchains

查看toolchain.mk文件可知,执行make指令之后,系统会去下载toolchains的tar包,包括32位和64位的编译链接工具,下载完成后会进行解压操作。

define dltc
        @if [ ! -d "$(1)" ]; then \
                mkdir -p $(1); \
                echo "Downloading $(3) ..."; \
                # 下载
                curl -s -L $(2) -o $(TOOLCHAIN_ROOT)/$(3).tar.xz; \
                # 解压
                tar xf $(TOOLCHAIN_ROOT)/$(3).tar.xz -C $(1) --strip-components=1; \
        fi
endef

如果执行“make -f toolchain.mk toolchains”命令后,一直卡在“Downloading xxx ...”那。

手动到https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads下载指定toolchain(toolchain.mk指定了AARCH32_GCC_VERSION和AARCH64_GCC_VERSION)。

这里下载的是gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz和gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz

将下载的toolchain的tar包放到op-tee源代码的根目录下的toolchains目录,并进行解压

$ tar xf gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz -C aarch32 --strip-components=1
$ tar xf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz -C aarch64 --strip-components=1

7. 编译QEMU

$ cd build
$ make -f qemu_v8.mk all

编译时报出来的问题1:

Traceback (most recent call last):
  File "scripts/pem_to_pub_c.py", line 61, in 
    main()
  File "scripts/pem_to_pub_c.py", line 24, in main
    from Crypto.PublicKey import RSA
ModuleNotFoundError: No module named 'Crypto'
make[1]: *** [mk/subdir.mk:162: out/arm/core/ta_pub_key.c] Error 1
make[1]: Leaving directory '/home/xiaolinwu/xiaolin/op-tee/optee_os'
make: *** [common.mk:396: optee-os-common] Error 2
Traceback (most recent call last):
  File "out/arm/export-ta_arm32/scripts/sign_encrypt.py", line 258, in 
    main()
  File "out/arm/export-ta_arm32/scripts/sign_encrypt.py", line 131, in main
    from Cryptodome.Signature import pss
ModuleNotFoundError: No module named 'Cryptodome'
make[1]: *** [ta/arch/arm/link.mk:101: out/arm/ta/avb/023f8f1a-292a-432b-8fc4-de8471358067.ta] Error 1
make[1]: Leaving directory '/home/xiaolinwu/xiaolin/op-tee/optee_os'
make: *** [common.mk:396: optee-os-common] Error 2

安装pycrypto、pycryptodomex

$ sudo pip3 install pycrypto
$ sudo pip3 install pycryptodomex

编译时报出来的问题2:卡住此处

install libcrypto.pc -> /home/xiaolinwu/xiaolin/op-tee/out-br/target/usr/lib/pkgconfig/libcrypto.pc
install libssl.pc -> /home/xiaolinwu/xiaolin/op-tee/out-br/target/usr/lib/pkgconfig/libssl.pc
install openssl.pc -> /home/xiaolinwu/xiaolin/op-tee/out-br/target/usr/lib/pkgconfig/openssl.pc
rm -rf /home/xiaolinwu/xiaolin/op-tee/out-br/target/usr/lib/ssl
rm -f /home/xiaolinwu/xiaolin/op-tee/out-br/target/usr/bin/c_rehash
rm -f -f /home/xiaolinwu/xiaolin/op-tee/out-br/target/etc/ssl/misc/{CA.pl,tsget}
rm -f -f /home/xiaolinwu/xiaolin/op-tee/out-br/target/usr/bin/openssl
rm -f -f /home/xiaolinwu/xiaolin/op-tee/out-br/target/etc/ssl/misc/{CA.*,c_*}
rm -rf /home/xiaolinwu/xiaolin/op-tee/out-br/target/usr/lib/engines-1.1
>>> mmc-utils 37c86e60c0442fef570b75cd81aeb1db4d0cbafd Downloading
Reinitialized existing Git repository in /home/xiaolinwu/xiaolin/op-tee/buildroot/dl/mmc-utils/git/.git/
Fetching all references

该问题属于网络问题,修改如下:

【OP-TEE 3.8.0学习】001_运行环境的搭建及编译_第3张图片

编译成功后末尾log如下:

  AS      optionrom/kvmvapic.o
  BUILD   optionrom/kvmvapic.img
  BUILD   optionrom/kvmvapic.raw
  SIGN    optionrom/kvmvapic.bin
make[1]: Leaving directory '/home/xiaolinwu/xiaolin/op-tee/qemu'
make -C /home/xiaolinwu/xiaolin/op-tee/build/../soc_term
make[1]: Entering directory '/home/xiaolinwu/xiaolin/op-tee/soc_term'
cc -g -O0   -c -o soc_term.o soc_term.c
gcc -o soc_term soc_term.o
make[1]: Leaving directory '/home/xiaolinwu/xiaolin/op-tee/soc_term'

8. 运行OP-TEE

$ cd build
$ make -f qemu_v8 run-only

运行上述命令后将会启动两个分别属于安全世界状态和正常世界状态的terminal,用于显示OP-TEE和Linux内核的日志数据,然后加载OP-TEE镜像与Linux的镜像以及文件系统。

【OP-TEE 3.8.0学习】001_运行环境的搭建及编译_第4张图片

二、测试环境

1. 启动模拟器

运行OP-TEE之后,在qemu窗口输入c或者cont启动模拟器,此时会在安全世界终端显示OP-TEE日志数据,在正常世界状态终端显示Linux内核日志数据。

【OP-TEE 3.8.0学习】001_运行环境的搭建及编译_第5张图片

OP-TEE窗口日志数据(TEE)

D/TC:0 0 get_aslr_seed:1300 Cannot find valid kaslr-seed
D/TC:0 0 add_phys_mem:581 TEE_SHMEM_START type NSEC_SHM 0x42000000 size 0x00200000
D/TC:0 0 add_phys_mem:581 TA_RAM_START type TA_RAM 0x0e300000 size 0x00d00000
D/TC:0 0 add_phys_mem:581 VCORE_UNPG_RW_PA type TEE_RAM_RW 0x0e15d000 size 0x001a3000
D/TC:0 0 add_phys_mem:581 VCORE_UNPG_RX_PA type TEE_RAM_RX 0x0e100000 size 0x0005d000
D/TC:0 0 add_phys_mem:581 ROUNDDOWN(0x09040000, CORE_MMU_PGDIR_SIZE) type IO_SEC 0x09000000 size 0x00200000
D/TC:0 0 verify_special_mem_areas:519 No NSEC DDR memory area defined
D/TC:0 0 add_va_space:620 type RES_VASPACE size 0x00a00000
D/TC:0 0 add_va_space:620 type SHM_VASPACE size 0x02000000
D/TC:0 0 dump_mmap_table:732 type TEE_RAM_RX   va 0x0e100000..0x0e15cfff pa 0x0e100000..0x0e15cfff size 0x0005d000 (smallpg)
D/TC:0 0 dump_mmap_table:732 type TEE_RAM_RW   va 0x0e15d000..0x0e2fffff pa 0x0e15d000..0x0e2fffff size 0x001a3000 (smallpg)
D/TC:0 0 dump_mmap_table:732 type TA_RAM       va 0x0e300000..0x0effffff pa 0x0e300000..0x0effffff size 0x00d00000 (smallpg)
D/TC:0 0 dump_mmap_table:732 type RES_VASPACE  va 0x0f000000..0x0f9fffff pa 0x00000000..0x009fffff size 0x00a00000 (pgdir)
D/TC:0 0 dump_mmap_table:732 type SHM_VASPACE  va 0x0fa00000..0x119fffff pa 0x00000000..0x01ffffff size 0x02000000 (pgdir)
D/TC:0 0 dump_mmap_table:732 type IO_SEC       va 0x11a00000..0x11bfffff pa 0x09000000..0x091fffff size 0x00200000 (pgdir)
D/TC:0 0 dump_mmap_table:732 type NSEC_SHM     va 0x11c00000..0x11dfffff pa 0x42000000..0x421fffff size 0x00200000 (pgdir)
D/TC:0 0 core_mmu_entry_to_finer_grained:763 xlat tables used 1 / 7
D/TC:0 0 core_mmu_entry_to_finer_grained:763 xlat tables used 2 / 7
D/TC:0 0 core_mmu_entry_to_finer_grained:763 xlat tables used 3 / 7
I/TC: 
D/TC:0 0 init_canaries:164 #Stack canaries for stack_tmp[0] with top at 0xe191ab8
D/TC:0 0 init_canaries:164 watch *0xe191abc
D/TC:0 0 init_canaries:164 #Stack canaries for stack_tmp[1] with top at 0xe1922f8
D/TC:0 0 init_canaries:164 watch *0xe1922fc
D/TC:0 0 init_canaries:164 #Stack canaries for stack_tmp[2] with top at 0xe192b38
D/TC:0 0 init_canaries:164 watch *0xe192b3c
D/TC:0 0 init_canaries:164 #Stack canaries for stack_tmp[3] with top at 0xe193378
D/TC:0 0 init_canaries:164 watch *0xe19337c
D/TC:0 0 init_canaries:165 #Stack canaries for stack_abt[0] with top at 0xe18ad38
D/TC:0 0 init_canaries:165 watch *0xe18ad3c
D/TC:0 0 init_canaries:165 #Stack canaries for stack_abt[1] with top at 0xe18b978
D/TC:0 0 init_canaries:165 watch *0xe18b97c
D/TC:0 0 init_canaries:165 #Stack canaries for stack_abt[2] with top at 0xe18c5b8
D/TC:0 0 init_canaries:165 watch *0xe18c5bc
D/TC:0 0 init_canaries:165 #Stack canaries for stack_abt[3] with top at 0xe18d1f8
D/TC:0 0 init_canaries:165 watch *0xe18d1fc
D/TC:0 0 init_canaries:167 #Stack canaries for stack_thread[0] with top at 0xe18f238
D/TC:0 0 init_canaries:167 watch *0xe18f23c
D/TC:0 0 init_canaries:167 #Stack canaries for stack_thread[1] with top at 0xe191278
D/TC:0 0 init_canaries:167 watch *0xe19127c
D/TC:0 0 select_vector:956 SMCCC_ARCH_WORKAROUND_1 (0x80008000) available
D/TC:0 0 select_vector:957 SMC Workaround for CVE-2017-5715 used
I/TC: Non-secure external DT found
I/TC: Switching console to device: /pl011@9040000
I/TC: OP-TEE version: 3.8.0 (gcc version 8.3.0 (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36))) #1 2020年 10月 10日 星期六 06:00:24 UTC aarch64
D/TC:0 0 init_primary_helper:1169 Executing at offset 0 with virtual load address 0xe100000
D/TC:0 0 check_ta_store:636 TA store: "Secure Storage TA"
D/TC:0 0 check_ta_store:636 TA store: "REE"
D/TC:0 0 mobj_mapped_shm_init:450 Shared memory address range: fa00000, 11a00000
I/TC: Initialized
D/TC:0 0 init_primary_helper:1182 Primary CPU switching to normal world boot
D/TC:1   generic_boot_cpu_on_handler:1221 cpu 1: a0 0x0
D/TC:1   select_vector:956 SMCCC_ARCH_WORKAROUND_1 (0x80008000) available
D/TC:1   select_vector:957 SMC Workaround for CVE-2017-5715 used
D/TC:1   init_secondary_helper:1206 Secondary CPU Switching to normal world boot
D/TC:0   tee_entry_exchange_capabilities:101 Dynamic shared memory is enabled
D/TC:0 0 core_mmu_entry_to_finer_grained:763 xlat tables used 4 / 7
D/TC:? 0 tee_ta_init_pseudo_ta_session:280 Lookup pseudo TA 7011a688-ddde-4053-a5a9-7b3c4ddf13b8
D/TC:? 0 tee_ta_init_pseudo_ta_session:293 Open device.pta
D/TC:? 0 tee_ta_init_pseudo_ta_session:307 device.pta : 7011a688-ddde-4053-a5a9-7b3c4ddf13b8
D/TC:? 0 tee_ta_close_session:499 csess 0xe1799e0 id 1
D/TC:? 0 tee_ta_close_session:518 Destroy session

Linux窗口日志数据和并以root用户登录文件系统(REE)

EFI stub: Booting Linux Kernel...
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services and installing virtual address map...
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x411fd070]
[    0.000000] Linux version 5.1.0-00022-g9823b258b332 (xiaolinwu@xiaolinwu) (gcc version 8.3.0 (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36))) #1 SMP PREEMPT Sat Oct 10 18:04:55 CST 2020
[    0.000000] Machine model: linux,dummy-virt
[    0.000000] printk: debug: skip boot console de-registration.
[    0.000000] efi: Getting EFI parameters from FDT:
[    0.000000] efi: EFI v2.70 by EDK II
[    0.000000] efi:  SMBIOS=0x81610000  SMBIOS 3.0=0x815f0000  MEMATTR=0x80698018  RNG=0x816cd318  MEMRESERVE=0x7e233018 
[    0.000000] efi: seeding entropy pool
[    0.000000] cma: Reserved 32 MiB at 0x000000007bc00000
[    0.000000] NUMA: No NUMA configuration found
[    0.000000] NUMA: Faking a node at [mem 0x0000000040000000-0x00000000820fffff]
[    0.000000] NUMA: NODE_DATA [mem 0x81ee1840-0x81ee2fff]
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000040000000-0x00000000820fffff]
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x0000000041ffffff]
[    0.000000]   node   0: [mem 0x0000000042200000-0x000000007df2ffff]
[    0.000000]   node   0: [mem 0x000000007df30000-0x000000007e22ffff]
[    0.000000]   node   0: [mem 0x000000007e230000-0x000000008150ffff]
[    0.000000]   node   0: [mem 0x0000000081510000-0x000000008159ffff]
[    0.000000]   node   0: [mem 0x00000000815a0000-0x00000000815bffff]
[    0.000000]   node   0: [mem 0x00000000815c0000-0x00000000816cffff]
[    0.000000]   node   0: [mem 0x00000000816d0000-0x00000000820fffff]
[    0.000000] Zeroed struct page in unavailable ranges: 416 pages
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x00000000820fffff]
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: Trusted OS migration not required
[    0.000000] psci: SMC Calling Convention v1.1
[    0.000000] random: get_random_bytes called from start_kernel+0x9c/0x460 with crng_init=0
[    0.000000] percpu: Embedded 23 pages/cpu s56664 r8192 d29352 u94208
[    0.000000] Detected PIPT I-cache on CPU0
[    0.000000] CPU features: detected: ARM erratum 832075
[    0.000000] CPU features: detected: ARM erratum 834220
[    0.000000] CPU features: detected: EL2 vector hardening
[    0.000000] Speculative Store Bypass Disable mitigation not required
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 265852
[    0.000000] Policy zone: DMA32
[    0.000000] Kernel command line: console=ttyAMA0,38400 keep_bootcon root=/dev/vda2 initrd=initrd
[    0.000000] Memory: 981944K/1080320K available (11068K kernel code, 1710K rwdata, 5576K rodata, 1408K init, 444K bss, 65608K reserved, 32768K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=2.
[    0.000000]  Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GICv2m: range[mem 0x08020000-0x08020fff], SPI[80:143]
[    0.000000] arch_timer: cp15 timer(s) running at 62.50MHz (virt).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1cd42e208c, max_idle_ns: 881590405314 ns
[    0.000064] sched_clock: 56 bits at 62MHz, resolution 16ns, wraps every 4398046511096ns
[    0.002783] Console: colour dummy device 80x25
[    0.006323] Calibrating delay loop (skipped), value calculated using timer frequency.. 125.00 BogoMIPS (lpj=250000)
[    0.006428] pid_max: default: 32768 minimum: 301
[    0.007266] LSM: Security Framework initializing
[    0.092499] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes)
[    0.093482] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes)
[    0.093708] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes)
[    0.093763] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes)
[    0.102154] *** VALIDATE proc ***
[    0.105124] *** VALIDATE cgroup1 ***
[    0.105157] *** VALIDATE cgroup2 ***
[    0.147672] ASID allocator initialised with 32768 entries
[    0.157180] rcu: Hierarchical SRCU implementation.
[    0.169967] Remapping and enabling EFI services.
[    0.180968] smp: Bringing up secondary CPUs ...
[    0.223024] Detected PIPT I-cache on CPU1
[    0.223540] CPU1: Booted secondary processor 0x0000000001 [0x411fd070]
[    0.226037] smp: Brought up 1 node, 2 CPUs
[    0.226084] SMP: Total of 2 processors activated.
[    0.226130] CPU features: detected: 32-bit EL0 Support
[    0.226196] CPU features: detected: CRC32 instructions
[    0.231011] CPU: All CPU(s) started at EL1
[    0.231229] alternatives: patching kernel code
[    0.246188] devtmpfs: initialized
[    0.259886] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.260043] futex hash table entries: 512 (order: 3, 32768 bytes)
[    0.263626] pinctrl core: initialized pinctrl subsystem
[    0.276499] SMBIOS 3.0.0 present.
[    0.276643] DMI: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015
[    0.280910] NET: Registered protocol family 16
[    0.282955] audit: initializing netlink subsys (disabled)
[    0.290158] audit: type=2000 audit(0.228:1): state=initialized audit_enabled=0 res=1
[    0.292277] cpuidle: using governor menu
[    0.293657] vdso: 2 pages (1 code @ (____ptrval____), 1 data @ (____ptrval____))
[    0.293753] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.299383] DMA: preallocated 256 KiB pool for atomic allocations
[    0.303362] Serial: AMBA PL011 UART driver
[    0.345621] 9000000.pl011: ttyAMA0 at MMIO 0x9000000 (irq = 38, base_baud = 0) is a PL011 rev1
[    0.357233] printk: console [ttyAMA0] enabled
[    0.485990] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[    0.488068] HugeTLB registered 32.0 MiB page size, pre-allocated 0 pages
[    0.491567] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.493630] HugeTLB registered 64.0 KiB page size, pre-allocated 0 pages
[    0.500063] cryptd: max_cpu_qlen set to 1000
[    0.504732] ACPI: Interpreter disabled.
[    0.516576] vgaarb: loaded
[    0.519089] SCSI subsystem initialized
[    0.523924] usbcore: registered new interface driver usbfs
[    0.525610] usbcore: registered new interface driver hub
[    0.529582] usbcore: registered new device driver usb
[    0.534718] pps_core: LinuxPPS API ver. 1 registered
[    0.536898] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti 
[    0.541522] PTP clock support registered
[    0.543989] EDAC MC: Ver: 3.0.0
[    0.552514] Registered efivars operations
[    0.566373] Advanced Linux Sound Architecture Driver Initialized.
[    0.577724] clocksource: Switched to clocksource arch_sys_counter
[    0.579768] VFS: Disk quotas dquot_6.6.0
[    0.580060] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.580548] *** VALIDATE hugetlbfs ***
[    0.581518] pnp: PnP ACPI: disabled
[    0.619735] NET: Registered protocol family 2
[    0.653239] tcp_listen_portaddr_hash hash table entries: 1024 (order: 2, 16384 bytes)
[    0.654817] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
[    0.656067] TCP bind hash table entries: 16384 (order: 6, 262144 bytes)
[    0.657137] TCP: Hash tables configured (established 16384 bind 16384)
[    0.681468] UDP hash table entries: 1024 (order: 3, 32768 bytes)
[    0.683112] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes)
[    0.686253] NET: Registered protocol family 1
[    0.703122] RPC: Registered named UNIX socket transport module.
[    0.703424] RPC: Registered udp transport module.
[    0.703571] RPC: Registered tcp transport module.
[    0.703694] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.707746] Unpacking initramfs...
[    0.973153] Freeing initrd memory: 5428K
[    0.986243] hw perfevents: enabled with armv8_pmuv3 PMU driver, 1 counters available
[    0.986921] kvm [1]: HYP mode not available
[    1.651000] Initialise system trusted keyrings
[    1.654136] workingset: timestamp_bits=44 max_order=18 bucket_order=0
[    1.687630] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    1.695474] NFS: Registering the id_resolver key type
[    1.695871] Key type id_resolver registered
[    1.695993] Key type id_legacy registered
[    1.696207] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    1.697393] 9p: Installing v9fs 9p2000 file system support
[    3.028931] Key type asymmetric registered
[    3.029207] Asymmetric key parser 'x509' registered
[    3.029613] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 245)
[    3.029876] io scheduler mq-deadline registered
[    3.030061] io scheduler kyber registered
[    3.058622] pl061_gpio 9030000.pl061: PL061 GPIO chip @0x0000000009030000 registered
[    3.065162] pci-host-generic 4010000000.pcie: host bridge /pcie@10000000 ranges:
[    3.066131] pci-host-generic 4010000000.pcie:    IO 0x3eff0000..0x3effffff -> 0x00000000
[    3.066615] pci-host-generic 4010000000.pcie:   MEM 0x10000000..0x3efeffff -> 0x10000000
[    3.066843] pci-host-generic 4010000000.pcie:   MEM 0x8000000000..0xffffffffff -> 0x8000000000
[    3.067655] pci-host-generic 4010000000.pcie: ECAM at [mem 0x4010000000-0x401fffffff] for [bus 00-ff]
[    3.068991] pci-host-generic 4010000000.pcie: PCI host bridge to bus 0000:00
[    3.069318] pci_bus 0000:00: root bus resource [bus 00-ff]
[    3.069504] pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
[    3.069957] pci_bus 0000:00: root bus resource [mem 0x10000000-0x3efeffff]
[    3.070129] pci_bus 0000:00: root bus resource [mem 0x8000000000-0xffffffffff]
[    3.083250] pci 0000:00:01.0: BAR 4: assigned [mem 0x8000000000-0x8000003fff 64bit pref]
[    3.083641] pci 0000:00:01.0: BAR 0: assigned [io  0x1000-0x101f]
[    3.094733] EINJ: ACPI disabled.
[    3.127404] virtio-pci 0000:00:01.0: enabling device (0005 -> 0007)
[    3.155517] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    3.168253] SuperH (H)SCI(F) driver initialized
[    3.175499] msm_serial: driver initialized
[    3.187277] random: fast init done
[    3.191672] random: crng init done
[    3.204034] cacheinfo: Unable to detect cache hierarchy for CPU 0
[    3.228549] loop: module loaded
[    3.246000] libphy: Fixed MDIO Bus: probed
[    3.247213] tun: Universal TUN/TAP device driver, 1.6
[    3.258366] thunder_xcv, ver 1.0
[    3.259039] thunder_bgx, ver 1.0
[    3.259326] nicpf, ver 1.0
[    3.261176] hclge is initializing
[    3.261350] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version
[    3.261526] hns3: Copyright (c) 2017 Huawei Corporation.
[    3.263095] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[    3.263248] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    3.263567] igb: Intel(R) Gigabit Ethernet Network Driver - version 5.6.0-k
[    3.263734] igb: Copyright (c) 2007-2014 Intel Corporation.
[    3.264048] igbvf: Intel(R) Gigabit Virtual Function Network Driver - version 2.4.0-k
[    3.264228] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.
[    3.265436] sky2: driver version 1.30
[    3.268511] VFIO - User Level meta-driver version: 0.3
[    3.273398] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    3.273664] ehci-pci: EHCI PCI platform driver
[    3.273970] ehci-platform: EHCI generic platform driver
[    3.275019] ehci-orion: EHCI orion driver
[    3.275747] ehci-exynos: EHCI EXYNOS driver
[    3.276139] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    3.276325] ohci-pci: OHCI PCI platform driver
[    3.276674] ohci-platform: OHCI generic platform driver
[    3.277081] ohci-exynos: OHCI EXYNOS driver
[    3.278618] usbcore: registered new interface driver usb-storage
[    3.296621] rtc-efi rtc-efi: registered as rtc0
[    3.299629] i2c /dev entries driver
[    3.319856] sdhci: Secure Digital Host Controller Interface driver
[    3.320123] sdhci: Copyright(c) Pierre Ossman
[    3.321781] Synopsys Designware Multimedia Card Interface Driver
[    3.325693] sdhci-pltfm: SDHCI platform and OF driver helper
[    3.331886] ledtrig-cpu: registered to indicate activity on CPUs
[    3.337372] usbcore: registered new interface driver usbhid
[    3.337961] usbhid: USB HID core driver
[    3.349401] optee: probing for conduit method from DT.
[    3.351012] optee: revision 3.8 (023e3365)
[    3.355257] optee: dynamic shared memory is enabled
[    3.492050] optee: initialized driver
[    3.508163] NET: Registered protocol family 17
[    3.509455] 9pnet: Installing 9P2000 support
[    3.510211] Key type dns_resolver registered
[    3.512699] registered taskstats version 1
[    3.512884] Loading compiled-in X.509 certificates
[    3.521149] input: gpio-keys as /devices/platform/gpio-keys/input/input0
[    3.534084] rtc-efi rtc-efi: setting system clock to 2020-10-12T10:55:30 UTC (1602500130)
[    3.535461] ALSA device list:
[    3.535583]   No soundcards found.
[    3.538414] uart-pl011 9000000.pl011: no DMA platform data
[    3.779425] Freeing unused kernel memory: 1408K
[    3.780604] Run /init as init process
Starting syslogd: OK
Starting klogd: OK
Initializing random number generator... done.
Set permissions on /dev/tee*: OK
Set permissions on /dev/ion: OK
Create/set permissions on /data/tee: OK
Starting tee-supplicant: OK
Starting network: OK
Starting network (udhcpc): OK

Welcome to Buildroot, type root or test to login
buildroot login: root
#

2. 运行xtest

在启动后的正常世界状态对应的terminal中运行xtest,在安全世界状态和正常世界状态的terminal分别输出相应的日志信息,最终正常世界状态显示如下:

+-----------------------------------------------------
24537 subtests of which 0 failed
96 test cases of which 0 failed
0 test cases were skipped
TEE test application done!

通过以上测试后,说明OP-TEE环境搭建好了。

你可能感兴趣的:(OP-TEE)