U-Boot bootcmd(自动与手动)

时间:2017-07-14 15:09:29

标签: embedded-linux u-boot

我遇到了一个问题,当我打开设备电源时,它会挂起

Starting kernel ...

或者用

循环
Starting kernel ...

resetting ...

但是,如果我中断启动过程并手动运行启动,即:

=> run bootcmd
or
=> boot

然后内核加载正常。

根据DENX(5.9.6.5),这相当于Uboot应该自动执行的操作。

有没有人知道让uboot自行运行和手动中断和运行启动之间是否存在差异?否则,我该如何开始调试呢?

环境

=> printenv
autoload=no
baudrate=115200
board_name=EVK
board_rev=pilot
boot_fdt=try
bootcmd=echo Booting from network ...; usb start; setenv ethact asx0; if dhcp && tftp $loadaddr $bootfile && tftp $f
dt_addr $fdt_file; then run nfsboot; else echo WARN: Issue with TFTP.; run sdboot; fi;
bootdelay=3
bootfile=zImage
bootscript=echo Running bootscript from mmc ...; source
console=ttymxc1
ethact=asx0
ethprime=FEC
fdt_addr=0x83000000
fdt_file=imx6ul-pilot-v1-evk.dtb
fdt_high=0xffffffff
image=zImage
initrd_high=0xffffffff
ip_dyn=yes
loadaddr=0x80800000
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot}
mmcautodetect=yes
mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
mmcdev=1
mmcpart=1
mmcroot=/dev/mmcblk1p2 rootwait rw
netargs=setenv bootargs console=${console},${baudrate} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
nfsboot=run netargs; bootz $loadaddr - $fdt_addr
nfsroot=/nfs/rootfs
script=boot.scr
sdboot=echo Booting from mmc ...; mmc dev ${mmcdev}; mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else echo ERROR: Cannot run loadimage; fi; fi; else run ERROR: Cannot run mmc rescan; fi;
serverip=192.168.0.219

Environment size: 1714/8188 bytes

1 个答案:

答案 0 :(得分:2)

此问题与SDBOOT env var:

有关
sdboot = echo Booting from mmc ...; mmc dev ${mmcdev}; mmc dev ${mmcdev}; 
         if mmc rescan; then 
             if run loadbootscript; then 
                 run bootscript; 
             else 
                 if run loadimage; then 
                     run mmcboot; 
                 else 
                     echo ERROR: Cannot run loadimage; 
                 fi; 
             fi; 
         else 
             echo ERROR: Cannot run mmc rescan; 
         fi;

加载bootscript一直失败" **无法读取文件boot.scr **"。我仍然不确定导致差异的是什么,但删除loadbootscript分支并直接进入loadimage解决了这个问题。