ODROID UBOOT Uboot Compile Uboot Source Analysis Jeong
ODROID U-BOOT U-boot Compile & U-boot Source Analysis Jeong Joon Gyo Park Ho Tak Nam Jeong Hyeon Park Chan An Ji Su Lee Kun Neong
CONTENTS 1 U-boot Conception 2 U-boot Compile 3 U-boot Source Analysis 4 Conclusion & Direction - Bootloader - U-boot - toolchains - Compile process - Compile trial and error - Fusing & Exynos & Patch CPU Interrupts Secondary Program Loader
1 U-boot Conception
ODROITD U-BOOT – U-boot Compile & U-boot Source Analysis BOOTLOADER ?
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis U-BOOT armboot – Startup code for XScale CPU-core
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis U-BOOT armboot – Startup Code for ARM 920 CPU-core
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis U-BOOT armboot – Startup Code for OMP 2420/ARM 136 CPU-core
2 U-boot Compile process
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis U-boot Compile Sequence toolchains Download U-boot Compile toolchains Decompression U-boot Make config & Make toolchains setting toolchains install U-boot Source Download Decompression
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis COMPILE STEP - 1 toolchains Download toolchain to build U-boot $ sudo mkdir -p /opt/toolchains $ sudo tar jxf gcc-linaro-arm-linux -gnueabihf-4. 7 -2013. 0420130415_linux. tar. bz 2 -C /opt/toolchains/
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis COMPILE STEP - 2 toolchains Decompression /opt/toolchains/gcc-linaro-arm-linux-gnueabihf-4. 7 -2013. 04 -20130415_linux/bin
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis COMPILE STEP - 3 toolchains setting In order to add the toolchain path to PATH, paste below lines to vi $HOME/. bashrc export ARCH=arm export PATH=/opt/toolchains/gcc-linaro-arm-linux-gnueabihf-4. 7 -2013. 0420130415_linux/bin: $PATH export CROSS_COMPILE=arm-linux-gnueabihf. You can apply the change if you login again or import to apply this change login again or evaluate $HOME/. bashrc with source command $ source ~/. bashrc
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis COMPILE STEP - 4 toolchains install $ sudo arm-linux-gnueabihf-gcc -v
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis COMPILE STEP - 5 U-boot Source Download odroid U-boot source
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis COMPILE STEP - 6 U-boot Source make odroid_config $ make odroid_config
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis COMPILE STEP - 7 U-boot Source make $ make odroid_config
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis COMPILE STEP - 8 U-boot fusing /opt/toolchains/u-boot-odroidxu 4 -v 2017. 05/sd_fuse
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis COMPILE STEP - 9 U-boot fusing – Find device path (e. MMc) $cd sd_fuse $. /sd_fuse. sh <device/path/of/your/card> $ sudo fdisk –l Device path > /dev/mmcblk 0
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis COMPILE STEP - 9 U-boot fusing – Find device path (SD card) $cd sd_fuse $. /sd_fuse. sh <device/path/of/your/card> $ sudo fdisk –l Device path > /dev/mmcblk 1
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis COMPILE STEP - 10 U-boot fusing $cd sd_fuse $. /sd_fuse. sh <device/path/of/your/card> $ sudo fdisk –l Disk path > /dev/mmcblk 1 >> $. /sd_fuse. sh /dev/mmcblk 1
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis COMPILE U-boot fusing STEP - 10
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis COMPILE U-boot fusing STEP - 10
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis COMPILE U-boot fusing STEP - 10
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis COMPILE STEP - 11 U-booting for UART ODROID > SD card mode : e. MMC > u. SD Power On Booting for UART
2 U-boot Compile trial and error
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis COMPILE trial and error CROSS COMPILE Install SD Card Flashing SD Card Format SD Card unmount Disk List $ sudo e. MMc Impossible Partition Format Before flushing , Unmount then sync fdisk Command
3 U-boot Source Analysis Fusing & Exynos & Patch
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis Fusing sd_fusing. sh . /sd_fusing. sh 실행할 때 뒤에 입력된 인자가 SD Card 인지 e. MMC Card 인지 확인하는 부분
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis Fusing sd_fusing. sh e. MMC card의 경우와 SD card의 경우를 나눠 시작지점을 지정.
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis Fusing sd_fusing. sh u-boot. bin 파일의 우선 순위를 결정
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis Fusing sd_fusing. sh dd 명령어 >> bl 1. bin. hardkernel , bl 2. bin. hardkernel , u-boot, tzsw. bin. hardkernel $device 의 시작점(seek)부터 복사
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis Exynos U-boot Open source 의 exynos 5420 은 최적화가 되어있지 않다 Odroid용 Open source는 각 version exynos에 대해 최적화가 되어 있다 (ex) 메모리 설정, 레지스터 주소 설정, GPIO 설정 등
3 U-boot Source Analysis CPU
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis CPU Cache Memory CPU looks first for data in caches (e. g. , L 1, L 2 and L 3) then in main memory L 1 cache -> L 2 cache -> RAM CPU Cache Memory Main Memory Unit
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis CPU Cache Memory - Typical system structure -
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis cpu. c CPU
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis cpu. c CPU
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis cpu. c CPU
3 U-boot Source Analysis INTERRUPT
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis Interrupts. c Core 로 전달된 IRQ 전체를 한꺼번에 통제 Enable = 1로 설정하여 인터럽트를 forward 한다.
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis Interrupts. c b na IRQ_STACK 8 bit mem mapping le E Interrupt Occur Enable? Dis ab le Bad case Out Interrupt Execute
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis Interrupts. c MASTER Interrupt ODROID-XU 4 CONFIG_USE_IRQ가 사라진 것을 볼 수 있다 Driver에게 IRQ를 사용하지 못하게 한다 IRQ는 일부 인터럽트만을 지원하고 그 옵션이 문서화 되지 않았다 CONFIG_USE_IRQ는 사용 하기 애매하다
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis Interrupt enable / disable interrupt() • Interrupt 만을 enable , disable하는 함수이다 • Disable 하기 전의 enable_interrupt 가 enable되어있었다면 1로 return
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis Interrupt do_<exeption handler>() Master ODROID-XU 4 - 각 exception에 대한 C로 구현된 함수 - Console에 현재 발생한 exception 내용을 출력 - exception이 발생한 mode의 reg. 내용을 출력
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis Interrupt do_<exeption handler>() Efi_restore_gd() EFI (Extensible Firmware Interface) : 확장 펌웨어 인터페이스 부트 서비스 & 런타임 서비스 제공 Called from EFI_EXIT on callback exit to restore the gd register
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis Interrupt void show_reg() MASTER ODROID-XU 4
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis Interrupt void show_reg() Mem access 시간은 ROM보다 RAM이 더 빠름 타겟이 Instruction cache가 없는 경우 문제 RAM에서 실행하는 것은 early boot에서 실패를 야기
3 U-boot Source Analysis Secondary Program Loader
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis SPL Conception ROM SPL U-BOOT KERNEL SPL은 U-Boot의 첫 번째 단계, Boot 소스에서 RAM으로 읽히고 기본적인 환경설정이나 사용자 명령, U-Boot 실행
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis SPL USE CASE DIAGRAM U-Boot Size Set Boot execute Board Init SDRAM Serial UART Preparation U-Boot load or OS load
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis SPL USER SECTION SPL DIAGRAM SYSTEM SECTION START 200 kbyte . img파일 열 수 없을 경우 end SPL 개별 영역 설정 U-Boot Size 설정 Booting 최적화 (spl 환경값) SPL 초기화 및 관련 장치 선언 Stack SPL 시작 주소 설정 SPL 초기화 END Stack 재배치 u-art clk 활성화 SPL에서 U-Boot 부팅 보드 초기화 장치 목록에서 U-Boot로드 MMC사용 하기 위해 8 byte 정렬 . img 주소 설정 부팅 관련 디바이스 call Img /boot_list 저장 장소 할당
4 Conclusion & Direction
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis Conclusion Device 1 Device 2 Device 6 U-boot Device 5 Device 3 Device 4
ODROID U-BOOT – U-boot Compile & U-boot Source Analysis Direction U-BOOT DEVICE APPLY
Q&A
THANK YOU
- Slides: 64