我有一个带u-boot的MIPS系统(VSC7427(,我正试图引导一个比供应商在其GPL版本中提供的内核更新的内核(引导很好(。
内核FIT图像看起来是正常的,从输出来看,我认为它应该是可引导的:
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+
但是,当我尝试引导内核时,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
内核的大小远低于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
,这个错误似乎告诉我,我试图引导的内核和。。。什么,我不确定是什么。
以下是内核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映像的加载地址,不再接收到uncompress
错误,但系统似乎仍未启动。我已将此问题转移到后续问题。
您遇到的最后一个问题:
错误:新格式图像被覆盖-必须重置板才能恢复
是因为你已经将映像加载到了与入口点相同的位置,但你需要将其加载到其他地方的内存中,这样U-Boot就可以解压缩映像并将内容放在其加载地址设置的位置。由于你有128MB的内存,你应该可以从一开始就将其放在+32或+64MB的位置,然后一切都会正常。