[AM62A] Falcon Mode
TI/AM62A

[AM62A] Falcon Mode

728x90

본 글은 AM62A 보드의 부팅시간을 줄이기 위해 Falcon Mode의 사용법을 정리한 글이다.

테스트 환경

  • Ubuntu 22.04
  • SK-AM62A-LP
  • 09_01_00_07 Processor SDK

Falcon Mode는 SPL이 Linux 커널을 직접 시작하고 u-boot 로딩 및 초기화를 완전히 건너뛸 수 있도록 하여 빠른 부팅을 가능하게 하는 u-Boot의 기능입니다.

Falcon 모드의 작동 방식을 이해하기 위해 먼저 ARM 프로세서의 일반적인 Linux 부팅 시퀀스를 간략하게 살펴보면 아래와 같다.

표준 부팅 프로세스
AM62Ax 부팅 프로세스

위 프로세스를 토대로 AM62ax의 부팅 시간, 복잡성 및 저장 공간 요구 사항을 최적화하려면 AM62ax ROM -> R5 SPL -> A53 SPL -> A53 U-Boot -> Linux Kernel 의 부팅 흐름을 AM62ax ROM -> R5 SPL -> Linux Kernel 의 더 짧고 단순화된 흐름으로 변경한다. AM62ax Falcon Mode는 기본적으로 A53 SPL 및 A53 U-Boot 단계를 건너뜁니다. 

AM62Ax Falcon Mode 부팅 프로세스

R5 SPL을 통해 로드하기에 적합한 결합 이미지를 생성하고 바이너리 파일로 만들기 위해서 아래 이미지 트리 소스(.its) 파일과 bl31.bin 파일을 이용하여 바이너리 파일을 만든다.

its 파일 & bl31.bin :

tispl.its
0.00MB
bl31.bin
0.05MB

 

its 파일과 bl31.bin을 TI_SDK/board-support/prebuilt-images 위치로 이동 후 아래 명령어 실행

mkimage -E -f tispl.its tispl.bin

생성된 tispl.bin을 기존의 tispl.bin과 교체한 후 부팅 시 아래와 같이 부팅시간이 ~5초 가량 단축된 것을 확인할 수 있다.

 

Tiny rootfs기준

 ******************************************************************************************************************************

** Booting Message **

******************************************************************************************************************************

[0.000000 0.000000]

[0.000037 0.000037] U-Boot SPL 2023.04 (Mar 04 2024 - 10:24:24 +0900)

[0.000867 0.000830] SYSFW ABI: 3.1 (firmware rev 0x0009 '9.1.8--v09.01.08 (Kool Koala)')

[0.063946 0.063079] am62a_init: board_init_f done

[0.064317 0.000371] SPL initial stack usage: 17040 bytes

[0.065103 0.000786] am62a_init: spl_boot_device: devstat = 0x24b bootmedia = 0x9 bootindex = 0

[0.080183 0.015080] Trying to boot from MMC1

[0.479918 0.399735] Warning: Did not detect image signing certificate. Skipping authentication to prevent boot failure. This will fail on Security Enforcing(HS-SE) devices

[4.509521 4.029604] Warning: Did not detect image signing certificate. Skipping authentication to prevent boot failure. This will fail on Security Enforcing(HS-SE) devices

[4.685318 0.175796] Warning: Did not detect image signing certificate. Skipping authentication to prevent boot failure. This will fail on Security Enforcing(HS-SE) devices

[4.717236 0.031918] Warning: Did not detect image signing certificate. Skipping authentication to prevent boot failure. This will fail on Security Enforcing(HS-SE) devices

[4.734060 0.016824] Warning: Did not detect image signing certificate. Skipping authentication to prevent boot failure. This will fail on Security Enforcing(HS-SE) devices

[4.749546 0.015486] Starting ATF on ARM64 core...

[4.765466 0.015920]

[4.765495 0.000029] NOTICE:  BL31: v2.9(release):v2.9.0-614-gd7a7135d32-dirty

[4.766361 0.000867] NOTICE:  BL31: Built : 09:34:15, Aug 24 2023

[5.788799 1.022437] System time before build time, advancing clock.

[5.820729 0.031930] systemd 250.5+ running in system mode (+PAM -AUDIT -SELINUX -APPARMOR +IMA -SMACK +SECCOMP -GCRYPT -GNUTLS -OPENSSL +ACL +BLKID -CURL -ELFUTILS -FIDO2 -IDN2 -IDN -IPTC +KMOD -LIBCRYPTSETUP +LIBFDISK -PCRE2 -PWQUALITY -P11KIT -QRENCODE -BZIP2 -LZ4 -XZ -ZLIB +ZSTD -BPF_FRAMEWORK +XKBCOMMON +UTMP +SYSVINIT default-hierarchy=hybrid)

[5.852757 0.032028] Detected architecture arm64.

[5.996742 0.143985]

[5.996769 0.000027] Welcome to Arago 2023.10!

[5.997014 0.000244]

[5.997022 0.000009] Hostname set to <am62axx-evm>.

[6.364364 0.367342] /etc/systemd/system/sync-clocks.service:11: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consider removing the setting altogether.

[6.396475 0.032111] Queued start job for default target Multi-User System.

[6.460518 0.064043] [  OK  ] Created slice Slice /system/getty.

[6.461341 0.000822] [  OK  ] Created slice Slice /system/modprobe.

[6.462041 0.000701] [  OK  ] Created slice Slice /system/serial-getty.

[6.476773 0.014732] [  OK  ] Created slice User and Session Slice.

[6.478021 0.001248] [  OK  ] Started Dispatch Password ts to Console Directory Watch.

[6.492570 0.014549] [  OK  ] Started Forward Password Ruests to Wall Directory Watch.

[6.493597 0.001027] [  OK  ] Reached target Path Units.

[6.494548 0.000952] [  OK  ] Reached target Remote File Systems.

[6.509475 0.014926] [  OK  ] Reached target Slice Units.

[6.510223 0.000749] [  OK  ] Reached target Swaps.

[6.511294 0.001071] [  OK  ] Listening on Process Core Dump Socket.

[6.525029 0.013735] [  OK  ] Listening on initctl Compatibility Named Pipe.

[6.526173 0.001143] [  OK  ] Listening on Journal Socket (/dev/log).

[6.540686 0.014513] [  OK  ] Listening on Journal Socket.

[6.541323 0.000638] [  OK  ] Listening on udev Control Socket.

[6.541878 0.000554] [  OK  ] Listening on udev Kernel Socket.

[6.556961 0.015083]          Mounting Huge Pages File System...

[6.557513 0.000552]          Mounting POSIX Message Queue File System...

[6.558134 0.000621]          Mounting Kernel Debug File System...

[6.573310 0.015176]          Mounting Temporary Directory /tmp...

[6.574023 0.000713]          Starting Create List of Static Device Nodes...

[6.588488 0.014465]          Starting Load Kernel Module configfs...

[6.589559 0.001071]          Starting Load Kernel Module drm...

[6.590271 0.000712]          Starting Load Kernel Module fuse...

[6.591287 0.001015] systemd-journald.service: unit configures an IP firewall, but the local system does not support BPF/cgroup firewalling.

[6.606304 0.015018] (This warning is only shown for the first unit using IP firewalling.)

[6.620889 0.014585]          Starting Journal Service...

[6.621800 0.000911]          Starting Remount Root and Kernel File Systems...

[6.622725 0.000925]          Starting Apply Kernel Variables...

[6.636668 0.013943]          Starting Coldplug All udev Devices...

[6.637645 0.000977] [  OK  ] Mounted Huge Pages File System.

[6.638524 0.000879] [  OK  ] Mounted POSIX Message Queue File System.

[6.652924 0.014400] [  OK  ] Mounted Kernel Debug File System.

[6.653694 0.000770] [  OK  ] Mounted Temporary Directory /tmp.

[6.668308 0.014614] [  OK  ] Finished Create List of Static Device Nodes.

[6.669219 0.000911] modprobe@configfs.service: Deactivated successfully.

[6.669921 0.000702] [  OK  ] Finished Load Kernel Module configfs.

[6.684656 0.014735] modprobe@drm.service: Deactivated successfully.

[6.685113 0.000457] [  OK  ] Finished Load Kernel Module drm.

[6.685927 0.000813] modprobe@fuse.service: Deactivated successfully.

[6.700446 0.014519] [  OK  ] Finished Load Kernel Module fuse.

[6.701139 0.000693] [  OK  ] Finished Apply Kernel Variables.

[6.701649 0.000510] [  OK  ] Started Journal Service.

[6.732206 0.030558] [  OK  ] Finished Remount Root and Kernel File Systems.

[6.780244 0.048037]          Mounting FUSE Control File System...

[6.796138 0.015894]          Mounting Kernel Configuration File System...

[6.828037 0.031899]          Starting Flush Journal to Persistent Storage...

[6.844128 0.016091]          Starting Create Static Device Nodes in /dev...

[6.860182 0.016054] [  OK  ] Mounted FUSE Control File System.

[6.892009 0.031827] [  OK  ] Mounted Kernel Configuration File System.

[6.908147 0.016138] [  OK  ] Finished Flush Journal to Persistent Storage.

[6.924076 0.015929] [  OK  ] Finished Create Static Device Nodes in /dev.

[6.940009 0.015933] [  OK  ] Reached target Preparation for Local File Systems.

[6.988015 0.048006]          Starting Rule-based Managefor Device Events and Files...

[7.020154 0.032138] [  OK  ] Finished Coldplug All udev Devices.

[7.052258 0.032104] [  OK  ] Started Rule-based Manager for Device Events and Files.

[7.211822 0.159564] [  OK  ] Found device /dev/ttyS2.

[7.611826 0.400004]          Mounting /media/ram...

[7.627713 0.015887]          Mounting /var/volatile...

[7.643783 0.016070] [  OK  ] Mounted /media/ram.

[7.659491 0.015708] [  OK  ] Mounted /var/volatile.

[7.691633 0.032142]          Starting Load/Save Random Seed...

[7.707668 0.016035] [  OK  ] Reached target Local File Systems.

[7.739600 0.031933]          Starting Create Volatile Files and Directories...

[7.755610 0.016010] [  OK  ] Finished Load/Save Random Seed.

[7.803735 0.048125] [  OK  ] Finished Create Volatile Files and Directories.

[7.835738 0.032004]          Starting Network Name Resolution...

[7.867399 0.031661]          Starting Record System Boot/Shutdown in UTMP...

[7.899509 0.032110] [  OK  ] Finished Record System Boot/Shutdown in UTMP.

[7.915608 0.016098] [  OK  ] Reached target System Initialization.

[7.931432 0.015824] [  OK  ] Started Daily Cleanup of Temporary Directories.

[7.947496 0.016064] [  OK  ] Reached target Timer Units.

[7.963487 0.015991] [  OK  ] Listening on D-Bus System Message Bus Socket.

[7.979519 0.016032] [  OK  ] Reached target Socket Units.

[7.995448 0.015929] [  OK  ] Reached target Basic System.

[8.027581 0.032133]          Starting D-Bus System Message Bus...

[8.059326 0.031745]          Starting User Login Management...

[8.075556 0.016229]          Starting Permit User Sessions...

[8.091700 0.016145] [  OK  ] Started Network Name Resolution.

[8.107577 0.015876] [  OK  ] Started D-Bus System Message Bus.

[8.139593 0.032017] [  OK  ] Finished Permit User Sessions.

[8.155634 0.016041] [  OK  ] Reached target Host and Network Name Lookups.

[8.187338 0.031704] [  OK  ] Started Getty on tty1.

[8.219460 0.032123] [  OK  ] Started Serial Getty on ttyS2.

[8.235444 0.015984] [  OK  ] Reached target Login Prompts.

[8.251500 0.016056]          Starting Synchronize System and HW clocks...

[8.267203 0.015703] [  OK  ] Finished Synchronize System and HW clocks.

[8.299302 0.032099] [  OK  ] Started User Login Management.

[8.315389 0.016087] [  OK  ] Reached target Multi-User System.

[8.363447 0.048058]          Starting Record Runlevel Change in UTMP...

[8.395238 0.031791] [  OK  ] Finished Record Runlevel Change in UTMP.

[9.418980 1.023741]

[9.419023 0.000043]  _____                    _____           _         _

[9.419359 0.000335] |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_

[9.434910 0.015551] |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|

[9.435935 0.001025] |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|

[9.437443 0.001508]               |___|                    |___|

[9.450590 0.013147]

[9.450601 0.000010] Arago Project am62axx-evm -

[9.451056 0.000455]

[9.451072 0.000016] Arago 2023.10 am62axx-evm -

[9.451667 0.000595]

[9.451675 0.000009] am62axx-evm login:

 

Trouble Shooting

1. Booting Error

 Falcon Mode 사용 시 커널 명령줄이 구성되어 있지 않기 때문에, Linux는 기본적으로 /dev/mtdblock0에서 부팅을 시도함 그로 인해 위와같이 dtb 파일에 bootargs 옵션을 설정
*bootargs 옵션은 다른 방법으로 진행해도 무관

 

2. emmc DMA 이슈

Falcon Mode 적용 후 부팅시간이 변하지 않을 시 am62ax_evm_r5_defconfig 103줄에 CONFIG_SPL_MMC_SDHCI_ADMA=y 추가 

관련 글 : https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1358135/sk-am62a-lp-cryptodev-cannot-allocate-memory

 

SK-AM62A-LP: 'cryptodev': Cannot allocate memory - Processors forum - Processors - TI E2E support forums

 

e2e.ti.com

 

3. vmalloc 이슈

diff --git a/plat/ti/k3/common/k3_bl31_setup.c b/plat/ti/k3/common/k3_bl31_setup.c
index bbfb5bbfce1c..08fb296e7811 100644
--- a/plat/ti/k3/common/k3_bl31_setup.c
+++ b/plat/ti/k3/common/k3_bl31_setup.c
@@ -80,6 +80,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
        bl33_image_ep_info.pc = PRELOADED_BL33_BASE;
        bl33_image_ep_info.spsr = k3_get_spsr_for_bl33_entry();
        SET_SECURITY_STATE(bl33_image_ep_info.h.attr, NON_SECURE);
+       NOTICE("BL33 base: 0x%x\n", PRELOADED_BL33_BASE);
 
 #ifdef K3_HW_CONFIG_BASE
        /*
diff --git a/plat/ti/k3/platform.mk b/plat/ti/k3/platform.mk
index bce9ef176b3c..f1a008ed4251 100644
--- a/plat/ti/k3/platform.mk
+++ b/plat/ti/k3/platform.mk
@@ -13,7 +13,7 @@ include ${PLAT_PATH}/board/${TARGET_BOARD}/board.mk
 BL32_BASE ?= 0x9e800000
 $(eval $(call add_define,BL32_BASE))
 
-PRELOADED_BL33_BASE ?= 0x80080000
+PRELOADED_BL33_BASE ?= 0x80200000
 $(eval $(call add_define,PRELOADED_BL33_BASE))
 
 K3_HW_CONFIG_BASE ?= 0x82000000

부팅 시 vmalloc 에러로 인해 커널 모듈에 드라이버들이 제대로 올라가지 않는 증상임, 원인은 ARM64 커널은 2MB 정렬 주소에 로드되어야 한다. 일반적인 U-Boot 부팅 흐름에서 U-Boot는 커널 이미지를 $loadaddr에 로드하고 부팅한다. u-boot 상에 $loadaddr은 기본적으로 0x8200_0000이며 2MB로 정렬됩니다.

그러나 Falcon Mode 적용 시 ATF에서 커널 이미지를 기본적으로 0x8008_0000인 PRELOADED_BL33_BASE로 부팅하기 때문에 커널 이미지 로드 주소가 2MB로 정렬되지 않았던 문제이다. 위 수정사항을 적용 하고 ATF 소스 빌드한다. 빌드 후 생성 된 bl31.bin 파일을 변경해주고 tispl.bin 파일 재 생성 후 교체 해당 에러가 발생하지 않음

 

빌드 방법 : https://software-dl.ti.com/processor-sdk-linux/esd/AM62AX/09_01_00/exports/docs/linux/Foundational_Components_ATF.html

 

3.9. ARM Trusted Firmware-A — Processor SDK AM62Ax Documentation

Processor SDK Linux for AM62Ax 3.9. ARM Trusted Firmware-A Overview Trusted Firmware-A (TF-A) provides a reference implementation of secure world software for Armv7-A and Armv8-A, including a Secure Monitor executing at Exception Level 3 (EL3). ATF is used

software-dl.ti.com

 

4. Overlay 이슈

AM62A 보드에서 카메라를 활성화 시키기 위해서는 DTBO를 통햬 DTB에 Overlay 해야 한다. Overlay 방법은 u-boot 단에서 name_overlays 를 통해 진행하는데 현재 Falcon Mode를 통해 u-boot를 건너 뛴다.

 

그렇기 때문에 dtb에 직접 Overlay를 진행해줘야 한다. dtb와 dtbo 파일을 같은 폴더에 둔 뒤 아래 명령어를 실행한다.

fdtoverlay -i ./arch/arm64/boot/dts/ti/k3-am62a7-sk.dtb ./arch/arm64/boot/dts/ti/<name_of_overlay>.dtbo -o <destination_directory>/k3-am62a7-sk-new.dtb

이 후 생성된 dtb 파일을 확인 후 다시 Falcon Mode 적용시 Overlay가 적용된 것을 확인 할 수 있다.

 

관련 링크 : https://forum.digikey.com/t/beaglebone-black-u-boot-overlays-and-falcon-mode/3008

 

Beaglebone black u-boot overlays and falcon mode

Hi, with recent kernel I understand that cape management is moved from kernel to u-boot. I was using u-boot falcon mode to speed up the boot. Now I would use the recent Robert Nelson kernels (i.e. 4.14.87-bone-rt-r17) but I don’t understand how to load c

forum.digikey.com

참고 :

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1205638/faq-am625-how-to-boot-from-r5-u-boot-spl-directly-into-the-linux-kernel-skipping-a53-spl-and-a53-u-boot-falcon-mode?tisearch=e2e-sitesearch&keymatch=am62%25252525252520falcon#

 

[FAQ] AM625: How to boot from R5 U-Boot SPL directly into the Linux Kernel, skipping A53 SPL and A53 U-Boot (Falcon Mode) - Proc

 

e2e.ti.com

 

728x90

'TI > AM62A' 카테고리의 다른 글

[AM62A] GPIO 제어  (0) 2024.07.13
[09] AM62A-SK ROBOTICS SDK  (0) 2024.03.21
[09] AM62A - SDCard 이미지 만들기  (0) 2024.03.01
[09] AM62A-SK Processor SDK Build  (0) 2024.03.01
[08] AM62A - emmc  (0) 2024.02.22