我正在尝试制作一个最小的内核。我的目标是使这个尚未存在的内核与multiboot2兼容。因此,我首先在NASM-Assembly中创建了一个最小的multiboot2-header。
我正在使用grub-file来测试我的二进制文件是否兼容。
问题:当我将我的文件组装成一个elf32文件时,grub-file是令人满意的。但是,当我使用nasm将我的头文件组装成原始二进制文件时,结果文件是不兼容的。
为什么会这样呢?在multiboot2规范中,没有指定特定的可执行文件格式。
multiboot2header.asm:
section .multiboot
align 8,db 0
multibootheader_start:
dd 0xE85250D6
dd 0
dd (multibootheader_end - multibootheader_start)
dd -(0xE85250D6 + multibootheader_end - multibootheader_start)
multibootheader_end:NASM命令:
nasm -felf32 multiboot2header.asm -o multiboot2header.bin
nasm -fbin multiboot2header.asm -o multiboot2header.bin
grub-file命令:
grub-file --is-x86-multiboot2 multiboot2header.bin
发布于 2021-06-30 01:32:58
我怀疑这个问题是由于没有address tag结构(请参阅https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html#Address-header-tag )造成的。
这个标记对于Elf格式的文件是可选的(因为引导加载程序只能使用Elf的头文件);但在其他情况下是必需的(因为引导加载程序不知道从哪里加载文件)。
https://stackoverflow.com/questions/68182612
复制相似问题