UbootUniversal Bootloader Uboot CPU Uboot download compile site




















![U-boot 명령 n tftpboot(혹은 tftp) n n bootm [옵션들. . ] n n n U-boot 명령 n tftpboot(혹은 tftp) n n bootm [옵션들. . ] n n n](https://slidetodoc.com/presentation_image_h/7c3af08ca2b1b98c704bae83cb9ede17/image-21.jpg)






- Slides: 27

U-boot(Universal Bootloader) U-boot의 구조와 새로운 CPU로 의 포팅방법





U-boot download & compile • site: http: //sourceforge. net/projects/u-boot • Compile Target: cpu - 삼성 S 3 C 2410, evboard – smdk 2410 • Compile 순서 1. Makefile 에서 crosscompiler prefix지정 1. Ex> CROSS_COMPILE = arm_920 TDI 2. make clobber 3. make smdk 2410_config 4. make • U-boot 1. 0. 0을 기준으로 설명

Custom Board용 u-boot설정 1) copy: board/smdk 2410 => board/new 2410 2) copy: include/configs/smdk 2410. h => include/configs/new 2410. h로 복사 3) vi Makefile smdk 2410_config : unconfig @. /mkconfig $(@: _config=) arm 920 t smdk 2410 => 밑에 두줄 추가 new 2410_config : unconfig @. /mkconfig $(@: _config=) arm 920 t new 2410 4) vi board/new 2410/Makefile change: smdk 2410 => new 2410 5) compile make clobber make new 2410_config make

Source tree 구조 /board ---/smdk 2410. . . : cpu 디렉토리에 있는 cpu들로 만들어진 보드에 대한코드 보드에 밀접한 코드들로 보드 초기화 코드, memory bank 설정코드 flash코드, 부트로더가 dram에 위치해야하는 relocation address를 기록한 config. mk, 전체코드의 배치를 지정하는 u-boot. lds라는 링커 스크립트 파일 /common : 각종 명령어, user interface main routine /cpu ---/cpu/arm 920 t : cpu에 대한 startup코드(cpu초기화)와 serial, . . . clock, timer등의 cpu specific한 코드 /doc : 각종 readme file /drivers : 각종 network과 같은 driver /examples /fs ---/jffs 2 : 부트로더상에서 실행시키는 standalone app example : OS(특히 linux)지원 file system /include ---/include/asm-arm : 해당 platform에 대한 코드는 include/asm-arm같은식으로 존재. 중요한 파일로 u-boot. h에 board description structure가 존재함. (ppc에서 매우 중요함, arm에서는 덜 중요). . . /include/configs : 각 보드에 대한 설정파일들이 있습니다, [보드이름]. h의 형태. . /lib_arm : u-boot의 arm쪽 C 메인코드들이 있습니다. /net : tftp등의 네트워크 코드 /rtc : Real Time Clock driver /tools : mkimage등의 툴


smdk 2410 보드 구성 n 메모리와 주변 회로 구성 (회로도 참조) n n CS 0: Amd 29 LV 800 BB, 1 MB, 16 bit모드 - boot flash CS 1: Intel strata flash E 28 F 128 J 3 A x 2, 32비트 모드 - data저장 용 flash CS 3: cs 8900 ethernet driver CS 6: 삼성 K 4 S 561632 C-TC 75 32 MB x 2, 32비트 - SDRAM n cs 0 와 cs 1의 설정: 점퍼로 조정, boot flash 선택가능 nandboot: OM[1: 0]핀 설정 n u-boot설정 및 코드: 부트플래쉬 -> amd 16 bit flash n LCD, 등등. . n

S 3 C 2410 X Memory Map

SMDK 2410 board configuration & Startup Code(1) n n Configuration: 별첨 1 참조 Startup Code n 참고자료 n n ARM Assembly Guide GNU ld manual S 3 C 2410 manual DRAM manual

Startup Code(2) n 관련 파일 n n n board/smdk 2410/u-boot. lds board/smdk 2410/config. mk board/smdk 2410/memsetup. S cpu/arm 920 t/start. S Start. S의 흐름 n n n n cpu초기화(interrupt mask, Clock setting) dram초기화 flash에 있는 코드를 작업공간인(relocation area) dram으로 relocate stack setup malloc area setup BSS clear C쪽 코드의 메인인 board/lib_arm/board. c의 start_armboot()로 점프

config. mk # # # # # SMDK 2410 has 1 bank of 64 MB DRAM 3000'0000 to 3400'0000 Linux-Kernel is expected to be at 3000'8000, entry 3000'8000 optionally with a ramdisk at 3080'0000 we load ourself to 33 F 8'0000 download area is 3300'0000 TEXT_BASE = 0 x 33 F 80000

Start. S설명(1) n n 자세한 코드는 kelp강좌란 파일참조 간단한 설명(u-boot 1. 1. 1 버전) _start: . . . b reset // exception의 처음인 0 x 0000번지이다. reset 함수로 분기 _TEXT_BASE: // TEXT_BASE = 0 x 33 F 80000(board/smdk 2410/config. mk). word TEXT_BASE. . . /* * the actual reset code */ reset: . . . /* * mask all */ mov r 1, ldr r 0, str r 1, IRQs by setting all bits in the INTMR - default #0 xffff =INTMSK // INTMSK가 있는 녀석의 번지로딩 [r 0]

Start. S설명(2) /* * FCLK: HCLK: PCLK = 1: 2: 4 bit 1: 0이면 hclk는 fclk랑 같고, 아님 hclk = fclk/2 bit 0: 0이면 pclk는 hclk랑 같고, 아님 pclk = hclk/2 여기서 집어넣는 값이 0 x 00000003이니 당근 1: 2: 4가 되겠지? */ ldr r 0, =CLKDIVN mov r 1, #3 str r 1, [r 0] #ifdef CONFIG_INIT_CRITICAL // smdk 2410. h에 정의되어 있음 bl cpu_init_crit // 요 밑에 있는 녀석으로 jump, sdram세팅(dram초기화) #endif relocate: adr ldr cmp beq. . . /* relocate U-Boot to RAM r 0, _start /* r 0 <- current position of code */ r 1, _TEXT_BASE /* test if we run from flash or RAM */ r 0, r 1 /* don't reloc during debug */ stack_setup // no relocation code(for nandboot) */

Start. S설명(3) … copy_loop: ldmia stmia cmp ble r 0!, {r 3 -r 10} r 1!, {r 3 -r 10} r 0, r 2 copy_loop /* copy from source address [r 0] */ /* copy to target address [r 1] */ /* until source end addreee [r 2] */ . . . /* Set up the stack_setup: ldr r 0, _TEXT_BASE /* upper 128 Ki. B: relocated uboot */ sub r 0, #CFG_MALLOC_LEN /* malloc area */ sub r 0, #CFG_GBL_DATA_SIZE /* bdinfo */. . . clear_bss: ldr. . . ldr r 0, _bss_start /* find start of bss segment pc, _start_armboot // ==> lib_arm/board. c의 start_armboot()로 jump _start_armboot: . word start_armboot */ */

lib_arm/board. c의 start_armboot() • 중요한 변수: global data 스트럭쳐중 bd_info(include/asm-arm/u-boot. h) bi_arch_number bi_boot_params • start_armboot()함수 시작 - cpu_init( => cpu/arm 920 t/cpu. c ): stack setup. u-boot 1. 1. 1에서는 변경 - board_init(=> board/smdk 2410. c) clock과 gpio등의 설정을 합니다. cpu가 같지만 board설계에 따라 틀려지는 부분설정 gd->bi_arch_number = 193; gd->bi_boot_params = 0 x 30000100; arch number(인식번호): arch number of SMDK 2410 -Board(kernel/arch/arm/tools/mach-types) kernel/arch/arm/mach-s 3 c 2410/smdk. c(mizi kernel) MACHINE_START(SMDK 2410, "Samsung-SMDK 2410") BOOT_MEM(0 x 30000000, 0 x 48000000, 0 xe 8000000) BOOT_PARAMS(0 x 30000100) FIXUP(fixup_smdk) MAPIO(smdk_map_io) INITIRQ(s 3 c 2410_init_irq) MACHINE_END

Start_armboot() - 계속 - interrupt_init(=> cpu/arm 920 t/interrupts. c ): 타이머 설정. udelay함수 관련 설정으로 아주 중요함. - env_init(=> common/env_*. c이나 flash의 경우는 common/env_flash. c) ipaddr, serverip, etheraddr, bootarg. . . 등등 - init_baudrate(board. c): baudrate설정(global structure로) - serial_init(==> cpu/arm 920 t/serial. c ): serial설정 - console_init_f(==> common/console. c): 특별히 하는 일 없음 - display_banner(board. c): 설정정보 화면에 표시 - dram_init(==> board/smdk 2410. c ): dram configuration setting(size, start addr) - display_dram_config: 디램 세팅 화면에 표시 - flash_init(==>board/smdk 2410/flash. c): user coding부분 샘플은 u-boot/board/*

Start_armboot() - 계속 - display_flash_config(): flash정보 display - mem_malloc_init (_armboot_real_end): malloc영역설정. u-boot 1. 1. 1에서는 변경됨 - env_relocate(common/env_common. c): env_init에서 설정된 default_environment[]를 env영역의 데이터가 들어가는데로 복사. - devices_init(common/devices. c): device driver 리스트초기화 - console_init_r(common/console. c): stdout, stdin, stderr를 out, in device로 세팅 devices_init()에서는 초기화 여기서는 세팅. - enable_interrupts(cpu/arm 920 t/interrupts. c ): 그냥 return됨. - main_loop() autoboot -1초가 아닐경우 딜레이만큼 기다리고 부트코맨드를 실행하고 -1이면 무조건 프롬프트 띄우고 그냥 스톱
![Uboot 명령 n tftpboot혹은 tftp n n bootm 옵션들 n n n U-boot 명령 n tftpboot(혹은 tftp) n n bootm [옵션들. . ] n n n](https://slidetodoc.com/presentation_image_h/7c3af08ca2b1b98c704bae83cb9ede17/image-21.jpg)
U-boot 명령 n tftpboot(혹은 tftp) n n bootm [옵션들. . ] n n n setenv ipaddr 192. 168. 1. 3 Nor Flash관련명령 n n bootm 33000000, bootm 33000000 30800000 printenv setenv n n tftp 33000000 u. Image protect off 1: 0 -2, erase 1: 0 -2 cp. b 33000000 $(filesize), protect on 1: 0 -2 erase bank 1 Nand Flash관련 명령 n n nand erase 0000 4000 tftp 33000000 nandboot. bin nand write 33000000 $(filesize) nand read 33000000 1000

U-boot용 image making. . boot: vmlinux @$(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" -C arch/$(ARCH)/boot u. Image: vmlinux $(OBJCOPY) -S -O binary vmlinux. bin gzip -vf 9 vmlinux. bin mkimage -A arm -O linux -T kernel -C gzip -a 0 x 30008000 -e 0 x 30008000 -n 'ARM Linux-$(VERSION). $(PATCHLEVEL). $(SUBLEVEL)' -d. /vmlinux. bin. gz [email protected] cp [email protected] /tftpboot n. Image: vmlinux $(OBJCOPY) -S -O binary vmlinux. bin mkimage -A arm -O linux -T kernel -C none -a 0 x 30008000 -e 0 x 30008000 -n 'ARM Linux-$(VERSION). $(PATCHLEVEL). $(SUBLEVEL)' -d. /vmlinux. bin [email protected] cp [email protected] /tftpboot

bootm 명령의 흐름 및 새명령어작성 n bootm 명령의 흐름 n n n 별첨 2: common/cmd_bootm. c 별첨 3: lib_arm/armlinux. c 새로운 명령의 작성 n 별첨 4: common/cmd_blw. c


새로운 CPU로의 U-boot porting(1) n n n 포팅하고자하는 cpu와 가장 유사한 platform선정 Configuration 파일 설정 Startup code를 target에 알맞게 수정 n n Board initialize routine설정 n n n Clock, ram setup Device관련 레지스터, pin등의 in/out setup UART clock source등의 설정, GPIO설정 등등 UART setup n n 처음엔 clock을 계산하여 baudrate등을 수동으로 설정 어느정도의 코드 완성후엔 함수등을 이용한 설정


U-boot download
Ntldr grub
Cvicats
Android emulator bootloader
Jtag bootloader
Intel slim bootloader
Oc 32
Advantages and disadvantages of relocating loader
Absolute loader advantages and disadvantages
Difference between compile time and runtime
Lambda variant
What is constructor in java
Compile time polymorphism in c++
Contoh soal ekspresi reguler automata
Compile code meaning
Compile time vs run time
크로스 컴파일이란
Build linux kernel with clang
Hot site cold site warm site disaster recovery
Modular architecture
Site inventory architecture
Untangle vpn setup
Alu uc
Datapath
Cpu input output burst cycle
Partes de la computadora externas
아날로그 디지털
John cuda