Title: Bootloader Porting
1Bootloader Porting
2? ?
- ???? ??
- u-boot ????? ?? ??
- u-boot ?? ??
- u-boot ??
- ???? fusing??
- u-boot ???
3???? ?? (1)
- ??
- ???? ????? ????? ????? ??? ???? ????? ??? ????
- ????? ??? ??
- ????? ??? ???? ?? ?? 0??? ??
- 0x0000_0000 Reset exception
- ????? ?? ?? Startup, Monitoring mode, OS Boot
- ???? ???
- Clock ??, memory(SDRAM) ??, ???? disable
- ????? ???
- ???? ???
- ??? root filesystem ??
- ??? root file system? ???? ???? Linux ??
4???? ?? (2)
- u-boot ??
- Universal Bootloader
- ppcboot armboot
- PPC? ARM? ??? ? ????? Bootloader
- ??? cpu ?? (PPC, ARM, MIPS, SH, x86)
- Open Source
5u-boot ????? ?? ?? (1)
???? ??
board ?? evaluation ??? ??? ??
board/pro3 pro3??? ??? ??
common architecture ???? ??
cpu architecture? ???? ?? ??? cpu? ?? startup ??, serial, clock ? cpu specific? ???? ??
cpu/pxa pro3?? ???? XScale?? ?? ??
disk ??? ????? ??? ?? ??
doc u-boot ??? ??
drivers ????? ???? ??
examples u-boot? ?? test ?? ??
include header file
include/config ?? ??? ?? header file
net Network ?? ??
post Power On Self Test
rtc Real Time Clock driver ??
tools U-boot ???? S-Record ???? ???? ?? tool (mkimage)
6u-boot ????? ?? ?? (2)
???? ???? ???? ??
include asm/arch-pxa/ asm/arch-pxa/ pxa2xx? ?? ????
include configs pro3.h ??? ???? ??? ??, ??? ???? ? ????? ??, ?? ?? ?? ??
cpu pxa start.S u-boot?? ?? ?? ???? ???? exception table? ???.
cpu pxa interrupt.c ????? ?????? ?? ??
cpu pxa serial.c ??? ??(uart)? ???? ????? ??? ?? ??
cpu pxa cpu.c ?? ??, ????? ?? ? cpu? ??
board pro3 config.mk u-boot? ??? ??? ??? ?? ??? ????
board pro3 u-boot.lds u-boot? ??? ??? ?? ?? ????
board pro3 pro3.c pro3 ?? ??
board pro3 flash.c ??? ???? ??
drivers smc91111.c smc91111.h smc91111.c smc91111.h smc91111 Ethernet driver
7u-boot? ?? ?? (1)
8u-boot ?? ?? (2)
9u-boot ?? ?? (3)
0x0200_0000
u-boot
0xA7F8_0000
root f/s
0x0030_0000
uImage
0x0008_0000
Bootloader parameters
0x0004_0000
u-boot
0x0000_0000
FLASH
0xA000_0000
Memory
10u-boot ?? ?? (4)
ASM startup?? (cpu/pxa/start.S)
cpu ???, sdram???, sdram?? relocation,
start_armboot()??
C?? start_armboot() (lib_arm/board.c)
flash_init, eth_init console ???
main_loop() (common/main.c)
??? ?? ?? autoboot
Linux booting (lib_arm/armlinux.c)
Linux booting (??? ??? ??? ?? ?? ???? ???? ??)
11Linux? ?? boot ?? (1)
- Linux booting? ??? ??? ???
- Linux Kernel image
- FLASH/ROM?? ???? ?? Kernel? ??
- Root File System(RFS) image
- Jffs2 image, RAMdisk
- ???? boot-loaders? ??? ? ?? ????? ??
- Bootloading Local Booting
- ????? Kernel? RFS? ?? device(Flash)???
load??(autoboot). - Downloading Remote Booting
- Kernel? RFS? ?? device(Host PC)??? download
- ???? Kernel? RFS? install?? ?? ? ??? ??
- ?? ??? updates? ?? ??
12Linux? ?? boot ?? (2)
- Linux kernel? ???? ??? ?? bootloader?? ?? ? ? (1)
- Initialize base hardware
- CPU speed
- memory timings
- Detect machine type (passed to Kernel by r1)
- Initialize device
- Init UART to be Kernel console
- (passed to Kernel by tagged list, kernel boot
option) - Copy Kernel and RFS image to RAM
- Kernel? ?? ??? physical memory? ??? ????. ?? RFS?
?? memory? ???? (??? ??? ??). - Copy (?? download) ? ?? Kernel? RFS? ??? ??? ???
??? ??. - Setup the Kernel Tagged List (?? ??)
- ppc structure
- arm physical ram ???? 0x100 (0xA000_0100)
13Linux? ?? boot ?? (3)
- Linux kernel? ???? ??? ?? bootloader?? ?? ? ? (2)
- Calling the Linux Kernel with following settings
- CPU register settings
- R0 0,
- R1 machine architecture number (the
MACH_TYPE_XXX in kernel) (linux/include/asm/ma
ch-types.h) - Linux/arch/arm/tools/mach-types? ?? ???? ??.
- R2 base address of ATAG list
- (system RAM?? ?? tagged list? physical address)
- CPU mode
- All forms of interrupts must be disabled (IRQs,
FIQs) - CPU must be in SVC mode
- Cache, MMU
- MMU mustbe off
- D-cache must be off and no any stale data
(I-Cache can be on/off)
14Linux? ?? boot ?? (4)
- R0, R1, R2 ????? ???? ??? ???? ??
- void do_bootm_linux()
-
- void (theKernel)(int zero, int arch, uint
params) - ..
- theKernel (void ()(int, int,
uint))ntohl(hdr-gtih_ep) - ..
- theKernel (0, bd-gtbi_arch_number,
bd-gtbi_boot_params) -
- u-boot/board/pro3/pro3.c
- gd-gtbd-gtbi_arch_number 8894
- linux/arch/arm/tools/mach-types
- pro3 ARCH_PRO3 PRO3 8894
- u-boot/board/pro3/pro3.c
- gd-gtbd-gtbi_boot_params 0xa0000100 // address
of boot parameters
u-boot/lib-arm/armlinux.c
15u-boot ??
- ???? ??? ?? ??
- cd /root/pro3/Bootloader
- ls
- tar xfz ./u-boot-1.2.0-pro3-YYYYMMDD.tar.gz
- ???? ??? ??
- cd ./u-boot-1.2.0-pro3
- make pro3_config
- make
- ls ./u-boot.bin
- cp ./u-boot.bin /tftpboot
16???? fusing??
- ?????? Host PC? Targetboard IP? ??? ?? tftp? ??
???? ???? ? ? ??. - // Host PC? Targetboard? IP? ????
- PRO3gt set serverip 192.168.1.10
? host pc ip - PRO3gt set ipaddr 192.168.1.20 ?
targetboard ip - // u-boot image ?? ?? ? fusing
- PRO3gt set boot_file ./pxa255_pro3/u-boot.bin
- PRO3gt run bootf
17u-boot ???
- cmp ??? ??
- cp ??? ??
- erase flash ??? ??
- flinfo flash ??? ?? ??
- go addr ???? ??
- help ??? ??
- md ??? ??
- mm ??? ??
- mtest ?? RAM ???
- mw ??? ??
- printenv ?? ?? ??
- run ?? ??? ???? ???
- saveenv ????? ?? ?? ??
- setenv ?? ?? ??