额,OP 的大前提理解是错误的:
“bzImage 本来就是为了方便内核能存储在嵌入式系统很小的 SPI 上”
>> 并不是,bzImage ( big zImage 意为“大的”zImage ,和 bzip2 没有关系),怎么会“大的”反而是为了在嵌入式上呢,bzImage 是当初专门为 x86 架构搞出来的东西。
下面以最新的主线内核来举例吧:
① [第 335 行:define archhelp
echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
echo '* xipImage - XIP kernel image, if configured (arch/$(ARCH)/boot/xipImage)'
echo ' uImage - U-Boot wrapped zImage'
echo ' bootpImage - Combined zImage and initial RAM disk'
来源: [
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/Makefile?h=v5.18-rc7#n335]
>> 可以看到在 ARM 上内核支持 zImage 、Image 、xipImage 、uImage 、bootpImage ,不支持 bzImage ,→_→那我要是手动指定 bzImage 会怎样?
[第 306 行:# Convert bzImage to zImage
bzImage: zImage]
来源: [
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/Makefile?h=v5.18-rc7#n306]
>> →_→会自动变成 zImage
② [第 207 行:define archhelp
echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)']
来源: [
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/Makefile?h=v5.18-rc7#n207]
>> 可以看到在 ARM64 上内核支持 Image.gz 、Image ,是不支持 zImage 和 bzImage 的,至于为啥不支持,可能是开发者觉得没必要,也可能是觉得这活儿交给 boot loader 够了,也可能是纯粹优先级太低没动力(懒)
与 x64&x86 一脉相承不同,ARM64 跟 ARM 的关系就和雷锋和雷峰塔的关系似的,跟 MIPS64 血缘关系更近
③ [第 299 行:define archhelp
echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)']
来源: [
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/Makefile?h=v5.18-rc7#n299]
>> 可以看到在 x86 上只支持 bzImage
④ 另外在内核文档这里也写了建议在 ARM64 上如需要使用压缩请使用 bootloaders 实现:
[第 58 行:3. Decompress the kernel image
------------------------------
Requirement: OPTIONAL
The AArch64 kernel does not currently provide a decompressor and
therefore requires decompression (gzip etc.) to be performed by the boot
loader if a compressed Image target (e.g. Image.gz) is used. For
bootloaders that do not implement this requirement, the uncompressed
Image target is available instead.]
来源: [
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm64/booting.rst?h=v5.18-rc7#n58]