U-Boot在解压缩/加载内核映像时挂起 [英] u-boot hangs at "Uncompressing/Loading Kernel Image"

查看:17
本文介绍了U-Boot在解压缩/加载内核映像时挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是上一个问题(u-boot: cannot boot linux kernel despite kernel being less than maximum BOOTM_LEN)在同一平台(MIPS VSC7427)上的后续问题。

我正在尝试引导Linux 5.11,而u-boot在";解压缩内核映像时挂起(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在";加载内核映像时挂起:

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

我已经查看了other questions关于u-boot在";加载内核映像";处挂起的信息,我不相信那里的建议(从不在DRAM中的地址读取)适用于我的情况。

Kernel Load Address of 0x80100000对应于CONFIG_SYS_SDRAM_BASE+CONFIG_SYS_LOAD_ADDRdefined in u-boot,因此我相当确定我是从RAM中的地址加载的。


使用相同版本的u-boot(2019.10)我可以引导从供应商的GPL源代码构建的3.18.123内核:

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

(我记得似乎需要将内核加载地址从0x80100000更改为0x81000000,内核内解压缩才能正常工作,否则就可以正常引导)


用于为内核5.11.11生成FIT图像的its文件:

/* 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";
  };
 };
};

尝试以下任何一个早期启动参数都不会产生任何效果:

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

(0x10100000ahb section of the kernel dtsin u-boot中的UART偏移量,0x70100000UART base address used in the vendor kernel)


用于生成未压缩的5.11内核镜像的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的第一个映像正在使用,而该FTB的配置不包括设备树。您基本上是在加载内核,而没有任何关于硬件的信息(例如在哪里以及如何访问串行控制台的UART),对吗?更具体地说,我认为内核需要此处https://www.kernel.org/doc/Documentation/devicetree/bindings/chosen.txt

所述的";选定";节点(例如,stdout-path

我也遇到了类似的情况(基于Vitesse->;MicroSemi&>MicroChip,VSC7425的类似&Luton&SoC开发电路板)。我用u-Boot 2021.07引导Linux5.9没有任何问题。话又说回来,它既不是完全相同的硬件,也不是完全相同的软件。

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

这篇关于U-Boot在解压缩/加载内核映像时挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆