1. OPTEE Log

 

1) 5가지의 Log 가 존재

TEE Core (OPTEE OS) : CFG_TEE_CORE_LOG_LEVEL
TA(Trusted Application) : CFG_TEE_TA_LOG_LEVEL
Client : CFG_TEE_CLIENT_LOG_LEVEL
Supplicant : CFG_TEE_SUPP_LOG_LEVEL
ARM-TF(Trusted Firmware) :  LOG_LEVEL

 

2) 각 레벨은 다음과 같이 구분 (ARM-TF 제외)

0 : None
1 : Error
2 : Error + Warning
3 : Error + Warning + Debug
4 : Error + Warning + Debug + Flow

ARM-TF : 10 ~ 50(10 단위, ERROR, NOTICE, WARINING, INFO, VERBOSE)

 

 

2. 설정 우선 순위 (ARM-TF 제외)

 

1. Make arguments ('make CFG_FOO=bar...')
2. The file specified by $(CFG_OPTEE_CONFIG) (if defined)
3. The environment ('CFG_FOO=bar make...')
4. The platform-specific configuration file: core/arch/arm32/plat-*/conf.mk
5. <optee-project>/optee_os/mk/config.mk
6. Subsystem-specific makefiles (*/sub.mk)

 

 

3. Make argument 제외한 실제 수정 위치

 

1) CFG_TEE_CORE_LOG_LEVEL : <optee-project>/build/common.mk
  - Makefile에서 최초로 참조
2) CFG_TEE_TA_LOG_LEVEL : <optee-project>/optee_os/mk/config.mk
3) CFG_TEE_CLIENT_LOG_LEVEL, CFG_TEE_SUPP_LOG_LEVEL : <optee-project>/optee_client/config.mk
4) ARM-TF Log level :
   (1) <optee-project>/build/Makefile
   (2) <optee-project>/arm-trusted-firmware/plat/rpi3/platform.mk => RPI3_RUNTIME_UART를 -1이 아닌 값으로 변경.

  # UART to use at runtime. -1 means the runtime UART is disabled.
  # Any other value means the default UART will be used.
  RPI3_RUNTIME_UART := -1

 

 

'OPTEE with Rasberry Pi 3B' 카테고리의 다른 글

ARM Trusted Firmware-A  (0) 2019.10.10
SMC Call Sequence  (0) 2019.09.30
NFS boot  (0) 2019.09.17
Rasberry Pi 3B vs 3B+  (0) 2019.09.04
OP-TEE Build for Rasberry Pi 3B  (0) 2019.09.03

1. 공유기 or Hub 환경 필요

 

Rasberrypi와 PC가 통신하기 위해 공유기 혹은 Hub 환경 구축 필요.

같은 Local domain에 속해야 통신 가능

 

 

2. Virtual box 세팅

 

Rasberrypi <-> PC <-> Host OS on VirtualBox의 경우, Virtual Box에 Network 세팅 추가 필요.

 

NAT : Host OS <-> Internet

Host Only Adapter : PC <-> Host OS on Virtual Box

Bridged Adapter : Host OS <-> Rasberrypi

 

Bridged Adapter 설정시 Host OS에서 추가된 Ethernet interface에 공유기 Domain의 IP 주소가 할당되므로 해당 주소 이용 가능.

 

 

3. Host OS 설정

 

1) 고정 IP 할당을 위해 /etc/network/interface 설정에 아래 내용 필요. (enp0s8이 Bridged Adapter인 경우)

auto enp0s8 
iface enp0s8 inet static 
address 192.168.0.50 
netmask 255.255.255.0 
network 192.168.0.0 
broadcast 192.168.0.255 
gateway 192.168.0.1

 

2) NFS 서버 설정 (NFS 디렉토리가 /home/dark/nfs/rpi일 경우)

$ sudo apt-get install nfs-kernel-server 
$ sudo vi /etc/exports
 -> /home/dark/nfs/rpi 192.168.0.*(rw,sync,no_root_squash,no_subtree_check)

 

3) NFS 디렉토리 설정

원하는 디렉토리 경로 지정 후 Root FS 설치. 주의할 점은 반드시 디렉토리가 Root 권한이어야 함. 아닌 경우 Mount 실패

$ mkdir -p /home/dark/nfs/rpi
$ sudo chown root /home/dark/nfs/rpi

 

 

4. U-boot 세팅

 

U-boot에 환경 변수 주소를 세팅해줘야 함. U-boot console mode에서

setenv gateway '192.168.0.1'
setenv nfsserverip '192.168.0.50'
setenv nfspath '/home/dark/nfs/rpi'
saveenv
run nfsboot

자동으로 nfs booting을 시키고 싶으면 bootcmd를 mmcboot에서 nfsboot로 변경
setenv bootcmd 'run nfsboot'
saveenv

 

 

5. NFS 부팅시 OP-TEE Permission 이슈

 

SD card로 부팅시에는 문제없으나 NFS 부팅시에는 3.4.0에서는 오류 발생

Starting logging: OK 
Initializing random number generator... done. 
Setting permissions on /dev/tee*... OK 
Starting tee-supplicant... ERR [97] TSUP:main:684: error tee_supp_fs_init 
FAIL
Starting network: ip: RTNETLINK answers: File exists 
FAIL

Network는 이미 설정된거라 문제 없으나 tee_supp_fs_init이 실패하면 op-tee가 정상 동작되지 않음

이와 관련하여 패치가 진행되었음 - https://github.com/OP-TEE/build/pull/341/commits/345ea6b9980a04972f5f057d177d44331c3111d3

 

Rpi3 nfs fixes by jbech-linaro · Pull Request #341 · OP-TEE/build

Some general fixes and one of them: Fixes: OP-TEE/optee_os#2773

github.com

해당 Patch는 3.4.0에는 미반영되어 있으나, 3.6.0에는 반영되어 있는 것을 확인함.

따라서 최신 버전으로 개발 진행 예정.

 

 

6. U-boot env 수정

 

4번 항목의 U-boot 설정은 rootfs.cpio 를 이용해 boot 업데이트시 매번 파일이 갱신되므로 env 파일을 업데이트해야함.

u-boot.env는 mkenvimage를 통해 encoding되는데, 3.4.0에서는 env에 대한 dependency가 제대로 설정되어 있지 않아 make u-boot-env가 동작하지 않아 수동으로 빌드해줘야 함.

3.6.0에서 수행을 권장.

$ vi <optee-project>/build/rpi3/firmware/uboot.env.txt 

원하는 대로 수정한 후

$ cd <optee-project>/build
$ make u-boot-env-clean
$ make u-boot-env

'OPTEE with Rasberry Pi 3B' 카테고리의 다른 글

ARM Trusted Firmware-A  (0) 2019.10.10
SMC Call Sequence  (0) 2019.09.30
OPTEE Log Level  (0) 2019.09.18
Rasberry Pi 3B vs 3B+  (0) 2019.09.04
OP-TEE Build for Rasberry Pi 3B  (0) 2019.09.03

1. OP-TEE에서는 Rasberry Pi 3B만 Officially 지원

 

HardwareSupported - https://optee.readthedocs.io/building/devices/rpi3.html#what-versions-of-raspberry-pi-will-work

Raspberry Pi 1 Model A No
Raspberry Pi 1 Model B No
Raspberry Pi 1+ Model A No
Raspberry Pi 1+ Model B No
Raspberry Pi 2 Model B No
Raspberry Pi 2 Model B v1.2 No
Raspberry Pi 3+ Model A No
Raspberry Pi 3 Model B Yes
Raspberry Pi 3+ Model B No
Zero - all versions No
Compute module - all versions No

 

2. Rasberry Pi 3B vs 3B+ specfications

https://www.androidcentral.com/raspberry-pi-3-model-b-vs-3-b

 

Raspberry Pi 3 Model B vs. 3 B+: Which should you buy?

Changes to the network interface and a small processor revision sound minor but could make a difference for your project.

www.androidcentral.com

Ethernet과 Wi-Fi, PoE 이외에는 동일하나, OP-TEE Kernel에서는 WiFi 포팅은 해놓지 않았고, PoE는 전원 연결부를 무시하면 Ethernet과 같기 때문에 Core clock과 Ethernet speed 이외에는 동일.

 

3. OP-TEE 포팅 

OP-TEE에서는 Rasberrypi 3B만 지원하며 3B+는 지원하지 않음.

bootcode.bin, start.elf, fixup.dat는 Source가 오픈되어 있지 않으며 Broadcom에서 Binary Type으로 전달.

3B+는 2018년 이후 발행된 bootcode.bin과 Kernel을 써야 인식이 되는데, OP-TEE에서 포팅한 바이너리는 그 이전 버전으로 그냥 3B+에 얹으면 부팅되지 않음.

 

3B+용 dtb도 별도 제공되는데, Rasberrian에서 제공하는 bootcode.bin과 start.elf가 아닌 git 상의 최신 바이너리로 시도시에도 동작하지 않아, 3B+은 별도의 포팅이 필요하다는 결론에 도달.

 

3B+는 포기하고 3B로 개발 진행.

 

P.S : OPTEE 3.4.0 일때는 미동작하나, 3.6.0에서는 3B+ dtb가 들어와있는 것을 확인. 추후 동작 여부 확인 필요.

'OPTEE with Rasberry Pi 3B' 카테고리의 다른 글

ARM Trusted Firmware-A  (0) 2019.10.10
SMC Call Sequence  (0) 2019.09.30
OPTEE Log Level  (0) 2019.09.18
NFS boot  (0) 2019.09.17
OP-TEE Build for Rasberry Pi 3B  (0) 2019.09.03

+ Recent posts