Hello all,

I 'm building a (non linux) kernel natively on i386 and on amd64. My linker script defines the first section to be one called 'boot'. This is where i put multiboot headers so that they are within the first 8 bytes of the kernel image. Grub2 succesfully retrieves the headers from the i386 build but not from the amd64 build. On amd64, i use the additional gcc flags '-mcmodel=kernel -mno-red-zone'.

Grub2 complaints that 'no multiboot headers found'. This is very interesting because they are found when booting an i386 image.

What can possibly confuse grub2 on amd64??

Thanks,
Constantine


This is the beginning of my boot.S:

.section .boot, "ax"

ENTRY(start)
 jmp realstart

 /*
  * Multiboot header.
  */
 .align 4
 .long MULTIBOOT_MAGIC_OS  /* 0x2badb002 */
 .long MULTIBOOT_FLAGS     /* 0x0 */
 .long -(MULTIBOOT_FLAGS + MULTIBOOT_MAGIC_OS)

realstart:
        ...

Here's my linker script for amd64. The same linker script is used on i386 with a different kernel_offset.

start_offset = 0x100000;
kernel_offset = 0xffffffff80000000;
real_start = start - kernel_offset;
boot_stack_size = 4096;

ENTRY(real_start)

SECTIONS
{
  . = (start_offset + kernel_offset);

  .boot ALIGN(4096) : AT(ADDR(.boot) - kernel_offset)
  {
    _boot = .;
    *(.boot)
    _eboot = .;
  }

  .bootdata ALIGN(4) : AT(ADDR(.bootdata) - kernel_offset)
  {
    _bootdata = .;
    *(.bootdata)
    _ebootdata = .;
  }

  .bootstack ALIGN(4096) : AT(ADDR(.bootstack) - kernel_offset)
  {
    _bootstack = .;
    . += boot_stack_size;
    _ebootstack = .;
  }

  .text ALIGN(4096) : AT(ADDR(.text) - kernel_offset)
  {
    _text = .;
    *(.text)
    _etext = .;
  }

  .rodata ALIGN(4) : AT(ADDR(.rodata) - kernel_offset)
  {
    _rodata = .;
    *(.rodata)
    _erodata = .;
  }

  .data ALIGN(4096) : AT(ADDR(.data) - kernel_offset)
  {
    _data = .;
    *(.data)
    _edata = .;
  }

  .bss ALIGN(4) : AT(ADDR(.bss) - kernel_offset)
  {
    _bss = .;
    *(.bss)
    _ebss = .;
  }

  _end = .;
}


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to