[英]u-boot: cannot boot linux kernel despite kernel being less than maximum BOOTM_LEN
我有一個帶有 u-boot 的 MIPS 系統 (VSC7427),我正在嘗試引導比供應商在其 GPL 版本中提供的 kernel 更新的 kernel ( 啟動得很好)。
kernel FIT 圖像看起來很正常,從 output 來看,我認為它應該是可引導的:
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 - b2:6b:53:af:2d:a0
eth0: switch@1010000
luton # dhcp
(snipped)
luton # tftp vmlinux.gz.itb
Using switch@1010000 device
TFTP from server 192.168.1.60; our IP address is 192.168.1.154
Filename 'vmlinux.gz.itb'.
Load address: 0x80100000
Loading: #################################################################
(snipped)
done
Bytes transferred = 5172244 (4eec14 hex)
luton # iminfo 0x80100000
## Checking Image at 80100000 ...
FIT image found
FIT description: Linux 5.11.11
Image 0 (kernel@0)
Description: Linux 5.11.11
Type: Kernel Image
Compression: gzip compressed
Data Start: 0x801000c0
Data Size: 5167511 Bytes = 4.9 MiB
Architecture: MIPS
OS: Linux
Load Address: 0x80100000
Entry Point: 0x809898f4
Hash algo: sha1
Hash value: b963ed48f45e332bd5df263dd69d69c3818e6586
Image 1 (fdt@luton_pcb091)
Description: MSCC Luton PCB091 Device Tree
Type: Flat Device Tree
Compression: uncompressed
Data Start: 0x805edb60
Data Size: 2851 Bytes = 2.8 KiB
Architecture: MIPS
Hash algo: sha1
Hash value: 5283ae4322294e594a7be5e6de65e4f039ff36a5
Default Configuration: 'conf@default'
Configuration 0 (conf@default)
Description: Generic Linux kernel
Kernel: kernel@0
Configuration 1 (pcb091)
Description: Luton Linux kernel
Kernel: kernel@0
FDT: fdt@luton_pcb091
## Checking hash(es) for FIT Image at 80100000 ...
Hash(es) for Image 0 (kernel@0): sha1+
Hash(es) for Image 1 (fdt@luton_pcb091): sha1+
但是,當我嘗試啟動 kernel 時,u-boot 會出現以下錯誤:
luton # bootm 0x80100000
## Loading kernel from FIT Image at 80100000 ...
Using 'conf@default' configuration
Trying 'kernel@0' kernel subimage
Description: Linux 5.11.11
Type: Kernel Image
Compression: gzip compressed
Data Start: 0x801000c0
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
Error: inflate() returned -3
gzip compressed: uncompress error -1
Must RESET board to recover
kernel 的大小遠低於CONFIG_SYS_BOOTM_LEN (16MB) 定義的限制,因此我認為這不是此錯誤的根本原因。
用於生成itb
的vmlinux.bin.gz
是一個有效的 gzip 存檔,並且解壓后的大小也小於CONFIG_SYS_BOOTM_LEN
限制:
$ file vmlinux.bin.gz
vmlinux.bin.gz: gzip compressed data, max compression, from Unix, original size modulo 2^32 11494800
我嘗試使用未壓縮的vmlinux.bin
創建itb
文件(我只是將vmlinux.its
編輯為具有data = /incbin/("vmlinux.bin");
和compression = "none";
以及由readelf -h vmlinux
) 但我在嘗試啟動時收到以下錯誤:
luton # bootm ${loadaddr}
## Loading kernel from FIT Image at 80100000 ...
Using 'conf@luton_pcb091' configuration
Trying 'kernel@0' kernel subimage
Description: Linux 5.11.0
Type: Kernel Image
Compression: uncompressed
Data Start: 0x801000c0
Data Size: 11584912 Bytes = 11 MiB
Architecture: MIPS
OS: Linux
Load Address: 0x80100000
Entry Point: 0x809898f4
Hash algo: sha1
Hash value: d13175476fd38269a02a3e85bef53419092c01e1
Verifying Hash Integrity ... sha1+ OK
## Loading fdt from FIT Image at 80100000 ...
Using 'conf@luton_pcb091' configuration
Trying 'fdt@luton_pcb091' fdt subimage
Description: img,luton_pcb091 Device Tree
Type: Flat Device Tree
Compression: uncompressed
Data Start: 0x80c0c758
Data Size: 2303 Bytes = 2.2 KiB
Architecture: MIPS
Hash algo: sha1
Hash value: daa8a8147bbce692d81383af7b748a763212bb24
Verifying Hash Integrity ... sha1+ OK
Booting using the fdt blob at 0x80c0c758
Loading Kernel Image
ERROR: new format image overwritten - must RESET the board to recover
查看common/bootm.c
bootm_load_os
的 bootm_load_os 似乎這個錯誤告訴我,我正在嘗試引導的 kernel 之間存在一些重疊......有些東西,我不確定是什么。
這是由 kernel 5.11 生成的vmlinux.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";
};
};
};
binwalk
並不表示 ITB 中的gzip
數據無效:
$ binwalk vmlinux.gz.itb
DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------
0 0x0 device tree image (dtb)
192 0xC0 gzip compressed data, maximum compression, from Unix, last modified: 1970-01-01 00:00:00 (null date)
3960903 0x3C7047 MySQL ISAM compressed data file Version 10
5167968 0x4EDB60 device tree image (dtb)
mkimage version 2020.01
由 buildroot 作為host-uboot-tools-2020.01
一部分構建
根據 Tom Rini 的建議,我更改了 FIT 映像的 loadaddr 並且不再收到uncompress
錯誤,但是系統似乎仍然無法啟動。 我已將此移至后續問題。
您遇到的最后一個問題:
錯誤:新格式圖像被覆蓋 - 必須重置板才能恢復
是因為您已將映像加載到 memory 與入口點相同的位置,但您需要將其加載到 memory 其他地方,以便 U-Boot 可以解壓縮映像並將內容放入其加載地址設置為. 由於您有 128MB 的 memory,您應該能夠從一開始就將其設置為 +32 或 +64MB,然后一切正常。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.