OK6410A Development Board (3) 9 u-boot-2021.01 boot Analyze U-boot image and run part of bootcmd

url 		: git@github.com:lisider/u-boot.git
branch 		: ok6410a
commit id 	: e63a4077ad3aea53107495b0b68b95e720fe6033
config 		: ok6410a_mini_defconfig
// 涉及的 .S .s .c 文件 有 223个
reset														arch/arm/cpu/arm1176/start.S 39
	lowlevel_init(108)										board/samsung/ok6410a/lowlevel_init.S 72
	_main(110) 												arch/arm/lib/crt0.S 91
		board_init_f(117)									common/board_f.c 954
			initcall_run_list(init_sequence_f)(959) 		include/initcall.h 21
				init_sequence_f								common/board_f.c 818
		board_init_r(177) 									common/board_r.c 901
			initcall_run_list(init_sequence_r)(927) 		include/initcall.h 21
				init_sequence_r 							common/board_f.c 695
					run_main_loop(898)						common/board_r.c 678
						main_loop(685) 						common/main.c 39
							autoboot_command(60) 			common/autoboot.c 362
								run_command_list(376) 		common/cli.c 84
									cli_simple_run_command_list(118) 	common/cli_simple.c 311
										cli_simple_run_command(338)  	common/cli_simple.c 177
											cmd_process(251) 		 	common/command.c 587
												cmd_call(636) 		 	common/command.c 576
													cmdtp->cmd_rep(cmdtp, flag, argc, argv, repeatable)(581)
bootargs=root=/dev/mmcblk0p2 rw rootfstype=ext3 init=/linuxrc console=ttySAC0,115200 rootwait 123
bootcmd=fatload mmc 0:1 0x50008000 uImage;bootm 0x50008000;

U-boot load the kernel into ddr

fatload mmc 0:1 0x50008000 uImage;
SUDEBUG : ../common/command.c,cmd_call,line = 581
1828792 bytes read in 205 ms (8.5 MiB/s)
SUDEBUG : ../common/command.c,cmd_call,line = 584 // cmd_call 返回

U-boot parses and executes the kernel

bootm 0x50008000;
SUDEBUG : ../common/command.c,cmd_call,line = 581 // cmd_call 没有返回
## Booting kernel from Legacy Image at 50008000 ...
   Image Name:   Linux-5.11.0-00001-gd64fe683e8d-
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1828728 Bytes = 1.7 MiB
   Load Address: 50008000
   Entry Point:  50008000
   Verifying Checksum ... OK
   Loading Kernel Image

Starting kernel ...

SUDEBUG : ../arch/arm/lib/bootm.c,boot_jump_linux,line = 416
  • The establishment of atags
在 bootm命令执行过程中建立,搜索 setup_start_tag
  • bootm command to load uImage
do_bootm 												cmd/bootm.c 93
	do_bootm_subcommand(124) 							cmd/bootm.c 59
		do_bootm_states(84) 							common/bootm.c 553
			boot_selected_os(657)						common/bootm_os.c 610
				boot_fn/do_bootm_linux(615) 			arch/arm/lib/bootm.c 427
					boot_prep_linux(444)				arch/arm/lib/bootm.c 240
						setup_start_tag(gd->bd)(254) 	arch/arm/lib/bootm.c 127
						setup_commandline_tag(258)   	arch/arm/lib/bootm.c 156
						setup_end_tag(gd->bd)(280) 		arch/arm/lib/bootm.c 221
					boot_jump_linux(445) 				arch/arm/lib/bootm.c 337
						unsigned long machid = gd->bd->bi_arch_number;(378)
						kernel_entry = (void (*)(int, int, uint))images->ep;(384)
						r2 = gd->bd->bi_boot_params;(406)
						kernel_entry(0, machid, r2);(416)

Kernel requirements for U-boot


//虽然uImage被加载后 执行的第一条 linux命令  在 arch/arm/boot/compressed/head.S 中, 
//但是 arch/arm/boot/compressed/head.S 把 linux对u-boot的要求透传给了 arch/arm/kernel/head.S

linux-5.11  arch/arm/kernel/head.S 中
/*
 * Kernel startup entry point.
 * ---------------------------
 *
 * This is normally called from the decompressor code.  The requirements
 * are: MMU = off, D-cache = off, I-cache = dont care, r0 = 0,
 * r1 = machine nr, r2 = atags or dtb pointer.
 *
 * This code is mostly position independent, so if you link the kernel at
 * 0xc0008000, you call this at __pa(0xc0008000).
 *
 * See linux/arch/arm/tools/mach-types for the complete list of machine
 * numbers for r1.
 *
 * We're trying to keep crap to a minimum; DO NOT add any machine specific
 * crap here - that's what the boot loader (or in extreme, well justified
 * circumstances, zImage) is for.
 */

Guess you like

Origin blog.csdn.net/u011011827/article/details/115074461