繁体   English   中英

u-boot 在“Uncompressing/Loading Kernel Image”处挂起

[英]u-boot hangs at “Uncompressing/Loading Kernel Image”

这是对上一个问题的跟进( u-boot: cannot boot linux kernel 尽管 kernel 小于最大 BOOTM_LEN )在同一平台上(BOOTM_LEN 74)。

我正在尝试启动 Linux 5.11 并且 u-boot 在“解压缩 Kernel 映像”(gzip 压缩)处挂起:

U-Boot 2019.10 (Mar 28 2021 - 20:41:55 +0000)

MSCC VCore-III MIPS 24Kec
Model: Cisco Meraki MS220-8P
DRAM:  128 MiB
Loading Environment from SPI Flash... SF: Detected mx25l12805d with page size 256 Bytes, erase size 64 KiB, total 16 MiB
OK
In:    serial@10100000
Out:   serial@10100000
Err:   serial@10100000
Net:   
Warning: switch@1010000 (eth0) using random MAC address - f6:22:ff:96:01:2d
eth0: switch@1010000
luton # setenv loadaddr 0x83000000
luton # dhcp
luton # tftp ${loadaddr} vmlinux.gz.itb
Using switch@1010000 device
TFTP from server 192.168.1.60; our IP address is 192.168.1.164
Filename 'vmlinux.gz.itb'.
Load address: 0x83000000
Loading: #################################################################
(snipped)
done
Bytes transferred = 5172240 (4eec10 hex)
luton # bootm 0x83000000
## Loading kernel from FIT Image at 83000000 ...
   Using 'conf@default' configuration
   Trying 'kernel@0' kernel subimage
     Description:  Linux 5.11.11
     Type:         Kernel Image
     Compression:  gzip compressed
     Data Start:   0x830000c0
     Data Size:    5167511 Bytes = 4.9 MiB
     Architecture: MIPS
     OS:           Linux
     Load Address: 0x80100000
     Entry Point:  0x809898f4
     Hash algo:    sha1
     Hash value:   b963ed48f45e332bd5df263dd69d69c3818e6586
   Verifying Hash Integrity ... sha1+ OK
   Uncompressing Kernel Image

尝试启动未压缩的 vmlinux 会导致 u-boot 挂在“正在加载 Kernel 映像”处:

luton # setenv loadaddr 0x83000000
luton # setenv fdtaddr 0x85000000
luton # dhcp
luton # tftp ${loadaddr} vmlinux.bin
luton # tftp ${fdtaddr} ms220.dtb
luton # bootm ${loadaddr} - ${fdtaddr}
## Booting kernel from Legacy Image at 83000000 ...
   Image Name:   Linux 5.11.11
   Image Type:   MIPS Linux Kernel Image (uncompressed)
   Data Size:    11531664 Bytes = 11 MiB
   Load Address: 80100000
   Entry Point:  809898f4
   Verifying Checksum ... OK
## Flattened Device Tree blob at 85000000
   Booting using the fdt blob at 0x85000000
   Loading Kernel Image

我已经查看了有关挂在“加载 Kernel 映像”的 u-boot 的其他问题,我不相信那里的建议(从不在 DRAM 中的地址读取)适用于我的情况。

Kernel 加载地址 0x80100000对应于 u-boot 中定义的CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_LOAD_ADDR ,所以我相当肯定我是从 RAM 中的地址加载的。


使用相同版本的 u-boot ( 2019.10 ) 我能够启动从供应商的 GPL 源构建的 3.18.123 kernel:

luton # tftpboot vmlinuz
Using switch@1010000 device
TFTP from server 192.168.1.60; our IP address is 192.168.1.157
Filename 'vmlinuz'.
Load address: 0x81000000
Loading: #################################################################
(snipped)
done
Bytes transferred = 1578176 (1814c0 hex)
luton # bootm ${load_addr}
## Booting kernel from Legacy Image at 81000000 ...
   Image Name:   Linux 3.18.123
   Image Type:   MIPS Linux Kernel Image (uncompressed)
   Data Size:    1578112 Bytes = 1.5 MiB
   Load Address: 81000000
   Entry Point:  81000000
   Verifying Checksum ... OK
   Loading Kernel Image
[    0.000000] Linux version 3.18.123-meraki-elemental (hmartin@alp) (gcc version 5.4.0 (GCC) ) #36 Tue Apr 14 20:11:18 UTC 2020

(我似乎记得需要将 Kernel 加载地址从0x80100000更改为0x81000000以使内核解压缩工作,但否则它启动就好了)


its文件用于为 kernel 5.11.11 生成 FIT 图像:

/* SPDX-License-Identifier: GPL-2.0 */
/dts-v1/;
/ {
 description = "Linux 5.11.11";
 #address-cells = <1>;
 images {
  kernel@0 {
   description = "Linux 5.11.11";
   data = /incbin/("vmlinux.bin.gz");
   type = "kernel";
   arch = "mips";
   os = "linux";
   compression = "gzip";
   load = /bits/ 32 <0xffffffff80100000>;
   entry = /bits/ 32 <0xffffffff809898f4>;
   hash@0 {
    algo = "sha1";
   };
  };
 };
 configurations {
  default = "conf@default";
  conf@default {
   description = "Generic Linux kernel";
   kernel = "kernel@0";
  };
 };
};
/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
/ {
 images {
  fdt@luton_pcb091 {
   description = "MSCC Luton PCB091 Device Tree";
   data = /incbin/("boot/dts/mscc/luton_pcb091.dtb");
   type = "flat_dt";
   arch = "mips";
   compression = "none";
   hash@0 {
    algo = "sha1";
   };
  };
 };
 configurations {
  pcb091 {
   description = "Luton Linux kernel";
   kernel = "kernel@0";
   fdt = "fdt@luton_pcb091";
  };
 };
};

尝试以下任一 earlycon 启动 arguments 的效果为零:

luton # setenv bootargs console=ttyS0,115200 earlycon=uart,mmio,0x10100000 mem=134152192
luton # setenv bootargs console=ttyS0,115200 earlycon=uart,mmio,0x70100000 mem=134152192

0x10100000kernel dts 的 ahb 部分中的 uart 偏移量, 在 u-boot中, 0x70100000供应商 kernel 中使用的 UART 基地址


用于生成未压缩的 5.11 kernel 映像的 mkimage 命令:

mkimage -A mips -O linux -T kernel -C none -a 0x80100000 -e $(readelf -h vmlinux | grep "Entry point address" | awk '{print $4}') -n "Linux 5.11.11" -d arch/mips/boot/vmlinux.bin /var/lib/tftpboot/vmlinux.bin

mkimage version 2020.01

我在使用 FIT 方面的经验有限,所以我在下面的观察可能是错误的。 无论如何,在我看来,您的 ftb 的第一个图像正在被使用,而该图像又具有不包含设备树的配置。 您基本上是在加载 kernel 而没有任何有关硬件的信息(例如在哪里以及如何访问串行控制台的 uart),对吧? 更具体地说,我认为 kernel 需要“选择”节点(例如标准输出路径),如此处所述https://www.kernel.org/doc.txt/Documentation

我处于类似情况(开发基于 Vitesse->Microsemi->Microchip,VSC7425 的类似“luton”SoC 的电路板)。 使用 u-boot 2021.07 引导 linux 5.9 没有任何问题。 再说一次,它不是完全相同的硬件或软件。

您可以尝试将设备树子图像移动到第一个图像中,并将第一个配置替换为第二个配置。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM