bootcmd=
run findfdt; (1)
mmc dev ${mmcdev}; (mmc dev 2) (2)
if mmc rescan; then (3)
if run loadbootscript; then
run bootscript;
else
if run loadimage; then (4)
run mmcboot; (13)
else
run netboot;
fi;
fi;
else
run netboot;
fi
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image} (fatload mmc 2:1 0x12000000 zImage 从第2块mmc设备的1分区 装载zImage到内存的0x12000000位置) (5)
mmcboot=
echo Booting from mmc ...; (6)
run mmcargs; (7)
if test ${boot_fdt} = yes || test ${boot_fdt} = try; then (9)
if run loadfdt; then (10)
bootz ${loadaddr} - ${fdt_addr}; (12)
else
if test ${boot_fdt} = try; then
bootz;
else
echo WARN: Cannot load the DT;
fi;
fi;
else
bootz;
fi;
mmcargs=setenv bootargs console=${console},${baudrate} ${smp} root=${mmcroot} (setenv bootargs console=ttymxc0,115200 root=/dev/mmcblk3p2 rootwait rw) (8)
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file} (fatload mmc 2:1 0x18000000 imx6q-sabresd.dtb) (11)
findfdt=
if test $fdt_file = undefined; then
if test $board_name = SABREAUTO && test $board_rev = MX6QP; then
setenv fdt_file imx6qp-sabreauto.dtb;
fi;
if test $board_name = SABREAUTO && test $board_rev = MX6Q; then
setenv fdt_file imx6q-sabreauto.dtb;
fi;
if test $board_name = SABREAUTO && test $board_rev = MX6DL; then
setenv fdt_file imx6dl-sabreauto.dtb;
fi;
if test $board_name = SABRESD && test $board_rev = MX6QP; then
setenv fdt_file imx6qp-sabresd.dtb;
fi;
if test $board_name = SABRESD && test $board_rev = MX6Q; then
setenv fdt_file imx6q-sabresd.dtb;
fi;
if test $board_name = SABRESD && test $board_rev = MX6DL; then
setenv fdt_file imx6dl-sabresd.dtb;
fi;
if test $fdt_file = undefined; then
echo WARNING: Could not determine dtb to use;
fi;
fi;
![imx6q u-boot 启动脚本分析_第1张图片](http://img.e-com-net.com/image/info8/0ed13e9aae4c473fa7ddfd5357c5361b.jpg)
![imx6q u-boot 启动脚本分析_第2张图片](http://img.e-com-net.com/image/info8/09fc5f1e442e4c66acd4075a2c44f1cf.jpg)