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.