【问题标题】:Why does the linux kernel raw binary Image has the Windows executable format?为什么linux内核原始二进制映像具有Windows可执行格式?
【发布时间】:2021-10-03 13:17:32
【问题描述】:

根据https://ineclabs.com/image-zimage-uimage-vmlinuz-linux-kernel/

Image: The generic Linux kernel binary image file.

我有一个使用make Image 编译的ARM64 内核,它被Linux 识别为Windows 可执行文件。至少它得到了窗口图标。

在 Cutter 上,我打开并得到了 pe64 的认可

根据Documentation/arm64/booting.rst,这是解压时的内核头

======aarch64 kernel header========
u32 code0;          /* Executable code */
u32 code1;          /* Executable code */
u64 text_offset;        /* Image load offset, little endian */
u64 image_size;     /* Effective Image size, little endian */
u64 flags;          /* kernel flags, little endian */
u64 res2    = 0;        /* reserved */
u64 res3    = 0;        /* reserved */
u64 res4    = 0;        /* reserved */
u32 magic   = 0x644d5241;   /* Magic number, little endian, "ARM\x64" */
u32 res5;           /* reserved (used for PE COFF offset) */
====================================

为了让它被识别为 PE64,前 2 个字节应该是 4D 5A,但我没有在这个内核头文件中看到这种情况

【问题讨论】:

    标签: linux windows kernel portable-executable


    【解决方案1】:

    不是PE64;这是COFF。由于某种原因,您的工具将任何 COFF 识别为 Windows 可执行文件。 COFF 非常罕见,但 ARM 仍然在启动固件中使用它,所以这就是你得到的。

    【讨论】:

    • COFF 其实很常见。这是 MSVC 用于目标文件的文件格式。
    猜你喜欢
    • 1970-01-01
    • 2010-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-25
    • 2020-01-06
    • 2010-09-08
    相关资源
    最近更新 更多