How to do multi-o ption boot in imx8mplus platform ?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to do multi-o ption boot in imx8mplus platform ?

1,261 次查看
t2865k5
Contributor I

Dear NXP ,

HW platform : imx8mplus

u-boot version: 2021.04-r0

kernel version : 5.10.72

 

I want to some function as follows:

(1) Set the switch to 0x11 : It boot from SD card .

(2) Set the switch to 0x10 : It will check whether the SD card is inserted, 

                                             and  if the SD card is already inserted, it will boot from the SD card. If the

                                             SD card is not inserted, boot from emmc .

I think this part should modify u-boot code. Please tell me how to implement ?

 

 

0 项奖励
回复
2 回复数

1,137 次查看
Mestkim
Contributor III

(2) Set the switch to 0x10 : It will check whether the SD card is inserted, (who will check that? you have no bootloader running at that moment. It is at ROM code boot stage)

You could not achieve that. 

Because when you set the boot from sdcard . It will get boot fail if no sdcard with available image there.  And it will go to usb serial download mode. 

Then you don't have bootloader and uboot running and you do not have any chance. 

 

But if you boot from emmc fail, it has SD/MMC manufacture mode to boot from sdcard. 

2023-07-24_170154.png

 

ROM code will go to 1 sdcard or 2 MMC.

 

 

2023-07-24_170757.png

 

0 项奖励
回复

1,203 次查看
brian14
NXP TechSupport
NXP TechSupport

Hi @t2865k5

On iMX8MP you can achieve this process using Uboot configuring the variables environment provided by Uboot and edit some scripts.
First, you will need to use the command printenv, here you will see the variables environment.
Specifically, focus on these variables extracted from printenv on UBoot console:

bootcmd=run distro_bootcmd;run bsp_bootcmd
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
bootcmd_mmc2=devnum=2; run mmc_boot
mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fit} = yes || test ${boot_fit} = try; then bootm ${loadaddr}; else if run loadfdt; then booti ${loadaddr} - ${fdt_addr_r}; else echo WARN: Cannot load the DT; fi; fi;
bsp_bootcmd=echo Running BSP bootcmd ...; mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; fi;
mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fit} = yes || test ${boot_fit} = try; then bootm ${loadaddr}; else if run loadfdt; then booti ${loadaddr} - ${fdt_addr_r}; else echo WARN: Cannot load the DT; fi; fi;
mmcdev=1

As you can see, for the boot process on variable bsp_bootcmd, mmcdev corresponds to the sd or the emmc.

Also, bsp_bootcmd defines the decision process if emmc or sd is not available.

In conclusion, to choose the mmc device you will need to edit the mmcdev variable, and to define the process you are describing in your question you will need to edit bsp_bootcmd.

I hope this information will be helpful.

Best regards, Brian.

0 项奖励
回复