Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiboot is broken on Fast and Small modes #7

Open
sagehane opened this issue May 11, 2021 · 0 comments
Open

Multiboot is broken on Fast and Small modes #7

sagehane opened this issue May 11, 2021 · 0 comments

Comments

@sagehane
Copy link

The OS currently fails to build with a proper multiboot section on ReleaseFast and Small builds.

For the header to be valid, the entire multiboot header must apparently be in the first 8KB of the OS image, and also be 32-bit aligned. (And ideally should be included as early as possible)

As of 0.8.0-dev.2193+fe14270f4, building in Debug and Safe seems to put the header in the 4096th byte. Building as Fast, Small, and Safe without the panic function seems to place the header at the 8192th byte.

It seems like removing the ALIGN(4K) for .text from the linker.ld makes the image valid on Fast, Small, and Safe + panic.

diff --git a/linker.ld b/linker.ld
index 035bae7..c203a5b 100644
--- a/linker.ld
+++ b/linker.ld
@@ -3,7 +3,7 @@ ENTRY(_start)
 SECTIONS {
        . = 1M;

-       .text : ALIGN(4K) {
+       .text : {
                KEEP(*(.multiboot))
                *(.text)
        }

This changes the location of the header for the following build modes:

  • Debug/Safe: No change, 0x1000 (or 4096)
  • Fast: 0x1030
  • Small: 0x1024
  • Safe without the panic function: 0x1030

Since I don't really get the reason behind this - and hence I'm not sure what the best way to deal with the problem - I'm not going to make a PR. Well, at least for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant