尝试在 BeagleBone Black 上启用 Falcon 模式时出现 U-Boot 错误

尝试在 BeagleBone Black 上启用 Falcon 模式时出现 U-Boot 错误

我在 BeagleBone Black 上启用 Falcon 模式时遇到问题。我有一个可用的 U-Boot (v2019.04) 和 Linux(Debian 11.5,内核 v5.15.65-bone-rt-r30),但到目前为止我未能成功启用 Falcon 模式。我遇到过几个错误。第一个是当我尝试拯救环境时:

=> saveenv
Saving Environment to EXT4...
** Unable to use mmc 0:1 for saveenv **
Failed (1)

第二个是当我尝试导出 SPL 时。它正确读取 uImage 标头:

=> spl export fdt ${loadaddr} - ${fdtaddr}
## Booting kernel from Legacy Image at 82000000 ...
   Image Name:   Linux kernel
   Created:      2022-10-26  17:38:41 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    9880064 Bytes = 9.4 MiB
   Load Address: 80008000
   Entry Point:  80008000

但随后它出现校验和错误并且无法完成该过程:

   Verifying Checksum ... Bad Data CRC
ERROR: can't get kernel image!
   XIP Invalid Image ... OK
data abort

这是我的完整 U-Boot 控制台日志:

CPU  : AM335X-GP rev 2.1
I2C:   ready
DRAM:  512 MiB
No match for driver 'omap_hsmmc'
No match for driver 'omap_hsmmc'
Some drivers were not found
Reset Source: Global external warm reset has occurred.
Reset Source: Global warm SW reset has occurred.
Reset Source: Power-on reset has occurred.
RTC 32KCLK Source: External.
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from EXT4...
** Unable to use mmc 0:1 for loading the env **
Board: BeagleBone Black
<ethaddr> not set. Validating first E-fuse MAC
BeagleBone Black:
Model: BeagleBone Black Industrial:
BeagleBone Cape EEPROM: no EEPROM at address: 0x54
BeagleBone Cape EEPROM: no EEPROM at address: 0x55
BeagleBone Cape EEPROM: no EEPROM at address: 0x56
BeagleBone Cape EEPROM: no EEPROM at address: 0x57
Net:   eth0: MII MODE
cpsw, usb_ether
Press SPACE to abort autoboot in 2 seconds
=>
=> setenv args_mmc 'setenv bootargs console=${console} ${optargs} root=/dev/mmcblk0p1 ro rootfstype=${mmcrootfstype}'
=> setenv loadfdt 'mmc read ${fdtaddr} 80 180'
=> setenv loadimage 'mmc read ${loadaddr} 900 2000'
=> setenv bootcmd 'run args_mmc; run loadfdt; run loadimage; bootm ${loadaddr} - ${fdtaddr}'
=> saveenv
Saving Environment to EXT4...
** Unable to use mmc 0:1 for saveenv **
Failed (1)
=> run args_mmc
=> run loadimage

MMC read: dev # 0, block # 2304, count 8192 ... 8192 blocks read: OK
=> run loadfdt

MMC read: dev # 0, block # 128, count 384 ... 384 blocks read: OK
=> spl export fdt ${loadaddr} - ${fdtaddr}
## Booting kernel from Legacy Image at 82000000 ...
   Image Name:   Linux kernel
   Created:      2022-10-26  17:38:41 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    9880064 Bytes = 9.4 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... Bad Data CRC
ERROR: can't get kernel image!
   XIP Invalid Image ... OK
data abort
pc : [<9ff91558>]          lr : [<9ff6d2fd>]
reloc pc : [<80838558>]    lr : [<808142fd>]
sp : 9df38b88  ip : 00000000     fp : 00000006
r10: 00000003  r9 : 9df38eb8     r8 : 9df38c6c
r7 : 00000000  r6 : 9ffc0238     r5 : 00000000  r4 : 00000000
r3 : 00000020  r2 : 00000000     r1 : 00000000  r0 : 00000000
Flags: Nzcv  IRQs off  FIQs on  Mode SVC_32
Code: f7fe2000 2800fc91 e7f4d0ed 9ff9f6a8 (4a106803)
Resetting CPU ...

resetting ...

我正在按照教程进行操作https://embetrix.com/2017/05/07/fast-boot-linux-with-u-boot-falcon-mode/(除了我在 Ubuntu 服务器上编译所有内容并直接从 Debian 中的 BeagleBone Black 写入 SD 卡之外,因此我跳过了 Yocto 中包含五个“部分”命令的部分——希望这不是问题),所以有可能在教程或我的环境中以某种方式存在错误。也许读取内核时出现超时问题,或者我的设备树文件错误?我从工作 zImage 创建了 uImage,并且 uImage 标头正在被正确读取,所以我不确定问题是什么。任何帮助将不胜感激。

编辑:根据下面的建议,我更改了配置以不再使用 EXT4 文件系统。我的环境变量现在保存了,这太棒了!不幸的是,内核校验和问题仍然存在。我当前的 U-Boot 日志如下:

U-Boot SPL 2022.04 (Nov 03 2022 - 11:40:28 -0400)
Trying to boot from MMC2


U-Boot 2022.04 (Nov 03 2022 - 11:40:28 -0400)

CPU : AM335X-GP rev 2.1
Model: TI AM335x BeagleBone Black
DRAM: 512 MiB
Reset Source: Power-on reset has occurred.
RTC 32KCLK Source: External.
Core: 150 devices, 14 uclasses, devicetree: separate
WDT: Started wdt@44e35000 with servicing (60s timeout)
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from MMC... *** Warning - bad CRC, using default environment

Board: BeagleBone Black
<ethaddr> not set. Validating first E-fuse MAC
BeagleBone Black:
Model: BeagleBone Black Industrial:
BeagleBone Cape EEPROM: no EEPROM at address: 0x54
BeagleBone Cape EEPROM: no EEPROM at address: 0x55
BeagleBone Cape EEPROM: no EEPROM at address: 0x56
BeagleBone Cape EEPROM: no EEPROM at address: 0x57
Net: Could not get PHY for ethernet@4a100000: addr 0
eth2: ethernet@4a100000, eth3: usb_ether
Press SPACE to abort autoboot in 0 seconds
=> setenv args_mmc 'setenv bootargs console=${console} ${optargs} root=/dev/mmcblk0p1 ro rootfstype=${mmcrootfstype}'
=> setenv loadfdt 'mmc read ${fdtaddr} 80 180'
=> setenv loadimage 'mmc read ${loadaddr} 900 2000'
=> setenv bootcmd 'run args_mmc; run loadfdt; run loadimage; bootm ${loadaddr} - ${fdtaddr}'
=> saveenv
Saving Environment to MMC... Writing to redundant MMC(0)... OK
=> run args_mmc
=> run loadimage

MMC read: dev # 0, block # 2304, count 8192 ... 8192 blocks read: OK
=> run loadfdt

MMC read: dev # 0, block # 128, count 384 ... 384 blocks read: OK
=> spl export fdt ${loadaddr} - ${fdtaddr}
## Booting kernel from Legacy Image at 82000000 ...
Image Name: Linux kernel
Created: 2022-10-26 17:38:41 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 9880064 Bytes = 9.4 MiB
Load Address: 80008000
Entry Point: 80008000
Verifying Checksum ... Bad Data CRC
ERROR: can't get kernel image!
XIP Invalid Image
data abort
pc : [<9ffa9fe8>] lr : [<9ff6bfa9>]
reloc pc : [<80843fe8>] lr : [<80805fa9>]
sp : 9df30e08 ip : 00000000 fp : 00000020
r10: 00000003 r9 : 9df45eb0 r8 : 9df30f04
r7 : 00000000 r6 : 9ffe3b1c r5 : 00000000 r4 : 00000000
r3 : edfe0dd0 r2 : 00000003 r1 : 00000000 r0 : 00000000
Flags: nzCv IRQs off FIQs on Mode SVC_32 (T)
Code: bfef 0000 b510 4b24 (6801) 4602
Resetting CPU ...

resetting ...

答案1

  1. 您的 SD 卡的块大小是多少? 512 字节显然太小了。即使是 1kByte,您加载的 8192 个块也不足以容纳您的 9.4 MiB 内核映像,因此部分加载的映像将具有错误的 CRC。例如,对于 512 字节的块大小,您需要 around setenv loadimage 'mmc read ${loadaddr} 900 4C00'
  2. root=/dev/mmcblk0p1如果您修复了该问题,则使用没有文件系统的分区作为根文件系统的命令行将遇到下一个问题。

如果 ext4 适合您的教程,也许您最好坚持使用 ext4。使用原始分区速度更快,但会带来许多额外的陷阱。

答案2

结果发现我在这个 U-Boot 命令中出现了错误,该命令读取了 4.19MB:

setenv loadimage 'mmc read ${loadaddr} 900 2000'

因为我的图像有 9.65MB(因此比教程中使用的图像大得多),所以它应该是:

setenv loadimage 'mmc read ${loadaddr} 900 8000'

它读取 16.8MB,对于内核来说有足够的空间。猎鹰模式现已启用。感谢您的帮助!

相关内容