目录
一、起始文件start.S
1.uboot编译完成后有一个uboot-boot.lds链接器文件
2.打开里面有一个ENYRY(_start),_start符号所在的文件就是整个程序的起始文件
3.位置在 u-boot-2022.01/arch/arm/cpu/armv8/start.S
4.异常向量表代码位置u-boot-2022.01\arch\arm\lib\vectors.S
二、_start和reset
- 进后有两种可配置情况,因为没有定义LINUX_KERNEL_IMAGE_HEADER 所以不需要看
- 直接跳转到 reset 继续执行启动流程
- save_boot_params 此处定义为了一个弱函数,为直接跳转回save_boot_params_ret继续往下执行
.globl _start
_start:
#if defined(CONFIG_LINUX_KERNEL_IMAGE_HEADER)
#include <asm/boot0-linux-kernel-header.h>
#elif defined(CONFIG_ENABLE_ARM_SOC_BOOT0_HOOK)
/*
* Various SoCs need something special and SoC-specific up front in
* order to boot, allow them to set that in their boot0.h file and then
* use it here.
*/
#include <asm/arch/boot0.h>
#else
b reset
#endif
.align 3
.globl _TEXT_BASE
_TEXT_BASE:
.quad CONFIG_SYS_TEXT_BASE
/*
* These are defined in the linker script.
*/
.globl _end_ofs
_end_ofs:
.quad _end - _start
.globl _bss_start_ofs
_bss_start_ofs:
.quad __bss_start - _start
.globl _bss_end_ofs
_bss_end_ofs:
.quad __bss_end - _start
reset:
/* Allow the board to save important registers */
b save_boot_params
.globl save_boot_params_ret
save_boot_params_ret:
三、save_boot_params_ret
进行地址无关的相对地址修复,以此保证后续在跳入c语言部分时可正常执行,一般不定义此配置则是继续往下执行boot流程。
四、_main之前系统寄存器初始化和从核的引导
对一些系统寄存器进行初始化
- 关闭data cache,关闭mmu
定义设置异常向量表的宏
系统的时钟频率,COUNTER_FREQUENCY频率值 - 勘误修正等