为什么 grub-file 说 NASM 原始二进制文件不符合 multiboot2?

问题描述

我正在尝试制作一个最小的内核。我的目标是使这个尚不存在的内核与 multiboot2 兼容。所以我首先在 NASM-Assembly 中创建了一个最小的 multiboot2-header。

我正在使用 grub-file 来测试我的二进制文件是否合规。

问题:当我将文件组装到 elf32 时,grub-file 很高兴。 但是,当我使用 nasm 将我的标头组装成原始二进制文件时,生成的文件不符合要求。

这是为什么?在 multiboot2 规范中没有指定特定的可执行文件格式。

multiboot2header.asm:

superview

NASM 命令:

server { server_name myhost.com; listen [::]:443 ssl http2; listen 443 ssl http2; # Nginx Proxy location / { proxy_pass http://0.0.0.0:8080; # port of your vue app } } server { listen 80; listen [::]:80; server_name myhost.com; return 301 https://www.myhost.com$request_uri; }

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:

grub-file 命令:

nasm -felf32 multiboot2header.asm -o multiboot2header.bin

解决方法

我怀疑问题是由于没有 address tag 结构引起的(请参阅 https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html#Address-header-tag )。

这个标签对于 Elf 格式的文件是可选的(因为引导加载程序只能使用 Elf 的头文件);但在其他情况下是必需的(因为引导加载程序不知道在哪里加载文件)。

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...