rust-osdev/multiboot2

multiboot2_header: README.md

hwoy opened this issue · 2 comments

hwoy commented

MULTIBOOT2_HDR is an address of array, not an array.

#[used]
#[no_mangle]
#[link_section = ".text.multiboot2_header"]
static MULTIBOOT2_HDR: &[u8; 64] = include_bytes!("mb2_hdr_dump.bin");

It should be below.

macrorules! mb2_hdr_bytes
{
  ()=>
  {
    include_bytes!("mb2_hdr_dump.bin")
  };
}

#[used]
#[no_mangle]
#[link_section = ".text.multiboot2_header"]
static MULTIBOOT2_HDR: [u8; 64] = *include_bytes!("mb2_hdr_dump.bin");
// or static MULTIBOOT2_HDR: [u8; mb2_hdr_bytes!().len()] = *mb2_hdr_bytes!();

Yes, looks sensible! Thanks!

hwoy commented

I think this part of document is important,
multiboot2_header was designed to generate multiboot2 header at run time not compile time.