Page tree
Skip to end of metadata
Go to start of metadata

Documentation

https://www.op-tee.org/

https://www.op-tee.org/documentation/

Image building needs the host to be ready with all necessary tools: refer here

Booting Optee from U-Boot

#Here example board is rockchip rk3288
# Add following configs to u-boot vyasa-rk3288_defconfig file

CONFIG_OPTEE=y
CONFIG_OPTEE_LOAD_ADDR=0x68410917
CONFIG_OPTEE_TZDRAM_SIZE=0x00800000
CONFIG_OPTEE_TZDRAM_BASE=0x68400000
CONFIG_BOOTM_OPTEE=y


# After adding optee support for rk3288 board.
$ git clone https://github.com/OP-TEE/optee_os.git
$ cd optee_os

# our boot scenario is: 
# BOOTR => U-Boot => Optee-os => linux
# So we need to provide linux kernel entry point(CFG_NS_ENTRY_ADDR) to optee.

# This will generate "out" directory for rk3288 board.
$ make CFG_TEE_CORE_LOG_LEVEL=4 DEBUG=y CFG_NS_ENTRY_ADDR=0x02000000 CFG_PAGEABLE_ADDR=0 CFD_DT=y CFG_DT_ADDR=0x01f00000 PLATFORM=rockchip PLATFORM_FLAVOR=rk3288

#make sure to not use tee.elf
$ /path to u-boot/tools/mkimage -A arm -T kernel -O tee -C none -d out/arm-plat-rockchip/core/tee.bin uTee.optee
# Just to make sure everything is fine
$ /path to uboot/tools/mkimage -l uTee.optee 
Image Name:   
Created:      Fri Oct 12 14:25:22 2018
Image Type:   ARM Trusted Execution Environment Kernel Image (uncompressed)
Data Size:    233756 Bytes = 228.28 KiB = 0.22 MiB
Load Address: 683fffe4
Entry Point:  68400000

$ mount /dev/sdb1 /mnt
$ cp -vf uTee.optee /mnt

#insert sdcard and power on the board. 
# Executing following comamnds 
=> ext4load mmc 1:1 $kernel_addr_r uImage
8311360 bytes read in 368 ms (21.5 MiB/s)
=> ext4load mmc 1:1 $fdt_addr_r rk3288-vyasa.dtb
37893 bytes read in 6 ms (6 MiB/s)
=> setenv bootargs 'console=ttyS2,115200n8 root=/dev/mmcblk0p1 rootwait' 
=> ext4ls mmc 1:1                                                       
<DIR>       4096 .
<DIR>       4096 ..
<DIR>      16384 lost+found
<DIR>       4096 bin
<DIR>       4096 boot
<DIR>       4096 dev
<DIR>       4096 etc
<DIR>       4096 home
<DIR>       4096 lib
<DIR>       4096 media
<DIR>       4096 mnt
          241920 optee.bin
<DIR>       4096 proc
           37893 rk3288-vyasa.dtb
<DIR>       4096 run
<DIR>       4096 sbin
<DIR>       4096 sys
         2992492 tee.elf
<SYM>          8 tmp
         8311360 uImage
<DIR>       4096 usr
          233792 uTee.optee
<DIR>       4096 var
          233820 myTee
=> ext4load mmc 1:1 0x04000000 uTee.optee
233820 bytes read in 14 ms (15.9 MiB/s)
=> iminfo 0x04000000

## Checking Image at 04000000 ...
   Legacy image found
   Image Name:   
   Image Type:   ARM Trusted Execution Environment Kernel Image (uncompressed)
   Data Size:    233756 Bytes = 228.3 KiB
   Load Address: 683fffe4
   Entry Point:  68400000
   Verifying Checksum ... OK
=> bootm 0x04000000 - $fdt_addr_r   
## Booting kernel from Legacy Image at 04000000 ...
   Image Name:   
   Image Type:   ARM Trusted Execution Environment Kernel Image (uncompressed)
   Data Size:    233756 Bytes = 228.3 KiB
   Load Address: 683fffe4
   Entry Point:  68400000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
## Flattened Device Tree blob at 01f00000
   Booting using the fdt blob at 0x1f00000
   Loading Device Tree to 0fff3000, end 0ffff404 ... OK
hdr->magic = 1163153487 and OPTEE_MAGIC 1163153487
hdr->version = 1 and OPTEE_VERSION 1
tee_file_size = 233756 and tzdram_len = 2097152 image_len = 233756init_load_addr_hi = 0 and init_load_addr_lo = 54 tzdram_
end = 1 tzdram_start = 67108928## Flattened Device Tree blob at 01f00000
   Booting using the fdt blob at 0x1f00000

Starting kernel ...

D/TC:0 0 add_phys_mem:539 TEE_SHMEM_START type NSEC_SHM 0x68600000 size 0x00100000
D/TC:0 0 add_phys_mem:539 TA_RAM_START type TA_RAM 0x68500000 size 0x00100000
D/TC:0 0 add_phys_mem:539 VCORE_UNPG_RW_PA type TEE_RAM_RW 0x68431000 size 0x000cf000
D/TC:0 0 add_phys_mem:539 VCORE_UNPG_RX_PA type TEE_RAM_RX 0x68400000 size 0x00031000
D/TC:0 0 add_phys_mem:539 ISRAM_BASE type IO_NSEC 0xff700000 size 0x00100000
D/TC:0 0 add_phys_mem:539 PERIPH_BASE type IO_SEC 0x10100000 size 0x22000000
D/TC:0 0 verify_special_mem_areas:477 No NSEC DDR memory area defined
D/TC:0 0 add_va_space:578 type RES_VASPACE size 0x00a00000
D/TC:0 0 add_va_space:578 type SHM_VASPACE size 0x02000000
D/TC:0 0 dump_mmap_table:711 type TEE_RAM_RX   va 0x68400000..0x68430fff pa 0x68400000..0x68430fff size 0x00031000 (smallp
g)
D/TC:0 0 dump_mmap_table:711 type TEE_RAM_RW   va 0x68431000..0x684fffff pa 0x68431000..0x684fffff size 0x000cf000 (smallp
g)
D/TC:0 0 dump_mmap_table:711 type SHM_VASPACE  va 0x68500000..0x6a4fffff pa 0x00000000..0x01ffffff size 0x02000000 (pgdir)
D/TC:0 0 dump_mmap_table:711 type IO_SEC       va 0x6a500000..0x8c4fffff pa 0x10100000..0x320fffff size 0x22000000 (pgdir)
D/TC:0 0 dump_mmap_table:711 type RES_VASPACE  va 0x8c500000..0x8cefffff pa 0x00000000..0x009fffff size 0x00a00000 (pgdir)
D/TC:0 0 dump_mmap_table:711 type TA_RAM       va 0x8cf00000..0x8cffffff pa 0x68500000..0x685fffff size 0x00100000 (pgdir)
D/TC:0 0 dump_mmap_table:711 type NSEC_SHM     va 0x8d000000..0x8d0fffff pa 0x68600000..0x686fffff size 0x00100000 (pgdir)
D/TC:0 0 dump_mmap_table:711 type IO_NSEC      va 0x8d100000..0x8d1fffff pa 0xff700000..0xff7fffff size 0x00100000 (pgdir)
D/TC:0 0 core_mmu_alloc_l2:238 L2 table used: 1/4


QEMUv8

$ git clone https://github.com/ARM-software/arm-trusted-firmware.git
$ cd arm-trusted-firmware
$ make PLAT=qemu

RK3399

$ git clone https://github.com/ARM-software/arm-trusted-firmware.git
$ cd arm-trusted-firmware
$ make PLAT=rk3399
  • No labels