uboot 手动与自动启动的不同行为

问题描述 投票:0回答:1

我设置了以下内容:

setenv mtdparts spi0.0:512k@0(uboot)ro,3M@0x200000(Kernel),11M@0x500000(RootFS1),2M@0x200000(Kernel_legacy),256k@0x80000(U-Boot_Config),1280k@0xc0000(NAS_Config),16M@0(all)ro
setenv fbootcmd cp.l 0xf8200000 0x800000 0xc0000\;cp.l 0xf8500000 0xb00000 0x2C0000\;bootm 0x800000

setenv bootargs console=ttyS0,115200 root=/dev/ram initrd=0xb00000,0xB00000 ramdisk=34816 cmdlinepart.mtdparts=${mtdparts} mtdparts=${mtdparts}
setenv nbootcmd dhcp\;tftpboot 0x800000 dl-\${bootfile}\;bootm 0x800000
setenv wlanaddr 00:08:9b:cc:cb:cb
setenv ethaddr  00:08:9b:cc:cb:ca

setenv bootcmd   uart1 0x68\;printenv nbootcmd fbootcmd bootargs\;run nbootcmd\;echo fallback to flash boot\;run run fbootcmd


因此启动命令会运行一两个其他脚本。

如果我使用 bootbootdrun bootcmd“手动”运行此命令....

  1. 我看到 DHCP 请求到达我的服务器
  2. 我通过wireshark看到TFTP流量
  3. 系统启动正常。

但是,如果我移除魔术跳线(JP1)并让它自动启动,我看到的是:

=dhcp;tftpboot 0x800000 dl-${bootfile};bootm 0x800000
=cp.l 0xf8200000 0x800000 0xc0000;cp.l 0xf8500000 0xb00000 0x2C0000;bootm 0x800000
=console=ttyS0,115200 root=/dev/ram initrd=0xb00000,0xB00000 ramdisk=34816 cmdlinepart.mtdparts=spi0.0:512k@0(uboot)ro,3M@0x200000(Kernel),11M@0x500000(RootFS1),2M@0x200000(Kernel_legacy),256k@0x80000(U-Boot_Config),1280k@0xc0000(No

long delay here, with lots of ARP ...

fallback to flash boot

我没有看到任何 DHCP 或其他网络流量,但几秒钟后(根据上面的评论)我看到 ARP 流量使用 192.168.0.1 和 192.168.0.50(注意 uboot ipaddr=192.168.0.50) serverip=192.168.0.1,都不存在)

盯着输出几个小时后,我觉得“好像”它在 bootcmd 中运行所有内容,但只是跳过了两个“运行命令”,所以我看到了 printenv 和 echo 的输出,但没有其他内容......但 printenv 的输出看起来不太正确?

我可以在 bootcmd 中使用“运行”吗? (合法吗)...我可以尝试简单地说:

setenv bootcmd   uart1 0x68\;${nbootcmd}\;echo fallback to flash boot\;${fbootcmd}

我想,这一切都在扩大。但我正在努力避免投机性的闪光。

顺便说一句,我看到我有“run run”,这是一个拼写错误,但我也没有收到任何错误消息。 (再次限制闪光)

我认为 boot/bootd 的行为应该与“autotboot”完全相同。

u-boot qnap
1个回答
0
投票

那真的很烦人。我会把它写下来,因为我不是唯一一个 击中它。有一些与硬件相关的方面,所以我会标注出来(用于搜索) [威联通、ts412、ts419、ts219]

首先,我发现了 U-Boot“重置”命令,这对调试有很大帮助。

所以之前,为了使用自动启动,我必须删除 JP1,从而丢失我的控制台。 现在我可以将 JP1 保留在适当的位置并发出“重置”命令,它的行为与您完全相同 刚刚通电(碰巧这包括外围设备,这对于这种情况至关重要)

所以现在我能够“看到控制台”我可以比较“坏启动”(重置/开机后) 并通过输入“boot/bootd”来获得“良好的启动”。

首先我剥离了 bootcmd:

bootcmd=uart1 0x68;echo net;dhcp;tftpboot 0x800000 dl-${bootfile};bootm 0x800000;echo flash;cp.l 0xf8200000 0x800000 0xc0000;cp.l 0xf8500000 0xb00000 0x2C0000;bootm 0x800000

(我删除了所有间接[运行]用途...这[可能]不必要...尝试网络启动回退到闪存启动)

----- reset---- (fails) ---
DHCPDISCOVER(enp4s0) 00:08:9b:cc:cb:ca 
CPU : Marvell Feroceon (Rev 1)


USB 0: host mode
PCI 0: PCI Express Root Complex Interface
PEX interface detected Link X1
Net:   egiga0 [PRIME], egiga1
Hit any key to stop autoboot:  0 
Unknown command 'uart1' - try 'help'
net
egiga0 no link
egiga1 no link
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5

Retry count exceeded; starting again
Using egiga0 device
TFTP from server 192.168.0.1; our IP address is 192.168.0.50
Filename 'dl-'.
Load address: 0x800000

Loading: T T T T T T T T T T 
Retry count exceeded; starting again
## Booting image at 00800000 ...
Bad Magic Number
flash
## Booting image at 00800000 ...
   Image Name:   kernel 6.1.0-13-marvell
   Created:      2023-11-27  17:15:24 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2634850 Bytes =  2.5 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
OK
----- reset----

------ boot cmd (works) -------
Marvell>> boot
Unknown command 'uart1' - try 'help'
net
BOOTP broadcast 1
Bootfile Prefix: F_TS-412
*** Unhandled DHCP Option in OFFER/ACK: 28
*** Unhandled DHCP Option in OFFER/ACK: 28
DHCP client bound to address 10.117.1.232
Using egiga0 device
TFTP from server 10.117.0.152; our IP address is 10.117.1.232

---------------------------

线索是

egiga0 no link
egiga1 no link
BOOTP broadcast 1
BOOTP broadcast 2

我认为这是由 DHCP 命令引起的,它没有工作网络接口,所以失败了。

我的猜测是网络硬件已重置并且仍在初始化。制造商使用了闪光靴 或(在开发过程中)串行控制台+PiXE,因此从未测试过此用例。

所以“修复”需要导致延迟(bootdelay = 5没有帮助顺便说一句)所以一个命令 在启动顺序中需要“延迟”......我们有一个命令需要相当长的时间 很长一段时间,“dhcp”失败,所以我们简单地添加另一个 dhcp 命令,它失败了, 然后第二个就可以立即工作了。

bootcmd=uart1 0x68;echo net;dhcp;dhcp;tftpboot 0x800000 dl-${bootfile};bootm 0x800000;echo flash;cp.l 0xf8200000 0x800000 0xc0000;cp.l 0xf8500000 0xb00000 0x2C0000;bootm 0x800000

打开 JP1 电源,是的,它从网络启动。

© www.soinside.com 2019 - 2024. All rights reserved.