This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

am335x的MLO读取u-boot.img时的boot_params是在哪设置的?

现在我们的板子,mmc0接的SD卡、mmc1接的是emmc;当调到mmc1启动,并插上sd卡时,MLO是从mmc1中读取的,而u-boot.img是从sd卡中读取的。

spl在决定从哪读取u-boot.img时,由spl_boot_device()决定;

u32 spl_boot_device(void)
{
return (u32) (boot_params.omap_bootdevice);
}

int board_mmc_init(bd_t *bis)
{
switch (spl_boot_device()) {
case BOOT_DEVICE_MMC1:
omap_mmc_init(0, 0, 0);
break;
case BOOT_DEVICE_MMC2:
case BOOT_DEVICE_MMC2_2:
omap_mmc_init(1, 0, 0);
break;
}
return 0;
}

而boot_params应该是从下面这儿来的:

ENTRY(save_boot_params)
/*
* See if the rom code passed pointer is valid:
* It is not valid if it is not in non-secure SRAM
* This may happen if you are booting with the help of
* debugger
*/
ldr r2, =NON_SECURE_SRAM_START
cmp r2, r0
bgt 1f
ldr r2, =NON_SECURE_SRAM_END
cmp r2, r0
blt 1f

/*
* store the boot params passed from rom code or saved
* and passed by SPL
*/
cmp r0, #0
beq 1f
ldr r1, =boot_params
str r0, [r1]
#ifdef CONFIG_SPL_BUILD
/* Store the boot device in spl_boot_device */
ldrb r2, [r0, #BOOT_DEVICE_OFFSET] @ r1 <- value of boot device
and r2, #BOOT_DEVICE_MASK
ldr r3, =boot_params
strb r2, [r3, #BOOT_DEVICE_OFFSET] @ spl_boot_device <- r1

/* boot mode is passed only for devices that can raw/fat mode */
cmp r2, #BOOT_DEVICE_XIP
blt 2f
cmp r2, #BOOT_DEVICE_MMC2
bgt 2f
/* Store the boot mode (raw/FAT) in omap_bootmode */
ldr r2, [r0, #DEV_DESC_PTR_OFFSET] @ get the device descriptor ptr
ldr r2, [r2, #DEV_DATA_PTR_OFFSET] @ get the pDeviceData ptr
ldr r2, [r2, #BOOT_MODE_OFFSET] @ get the boot mode
ldr r3, =omap_bootmode
str r2, [r3]
#endif
2:
ldrb r2, [r0, #CH_FLAGS_OFFSET]
ldr r3, =boot_params
strb r2, [r3, #CH_FLAGS_OFFSET]
1:
bx lr
ENDPROC(save_boot_params)

那存储在NON_SECURE_SRAM_START的,又是从哪来的呢?

认为应该是下图相关的配置决定的,和MLO一样,但我运行的结果不是这样。



帮忙看看,解答一下,谢谢!

x 出现错误。请重试或与管理员联系。