TI中文支持网
TI专业的中文技术问题搜集分享网站

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一样,但我运行的结果不是这样。



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

Steven Liu1:

* store the boot params passed from rom code or saved* and passed by SPL

这里的注释不是说从ROM code来的么。rom code又是通过系统的SYSBOOT管脚采样得到的。

“认为应该是下图相关的配置决定的,和MLO一样,但我运行的结果不是这样”,没懂这一句,你在看的不就是MLO部分的代码吗?带有SPL字样的都是。

运行结果不是这样,不一致的地方在哪里?

user3988512:

回复 Steven Liu1:

我们现在的板卡,mmc1连接的EMMC,mmc0连接的SD卡;

当将SYSBOOT管脚调到MMC1启动时,MLO是从EMMC读取的,而u-boot.img是从SD卡读取的;

若boot params是通过系统的SYSBOOT管脚采样得到的,那如上述代码所示,u-boot.img应该也是从EMMC中读取的,我的疑问在这里。

yunbo zhang:

回复 user3988512:

是否是因为你的mmc1里面没有uboot的镜像文件,依次扫描到mmc0,去读镜像文件!

user3988512:

回复 yunbo zhang:

当我把SD卡(mmc0)拔掉再上电,是可以正常从mmc1启动的。

Jian Zhou:

回复 user3988512:

MLO选择boot image的时候,实际上是由bootrom来决定的,如果bootrom从mmc1引导,MLO也会从MMC1引导。

赞(0)
未经允许不得转载:TI中文支持网 » am335x的MLO读取u-boot.img时的boot_params是在哪设置的?
分享到: 更多 (0)