All of lore.kernel.org
 help / color / mirror / Atom feed
* boot on amd64
@ 2007-06-07 17:27 Constantine Kousoulos
  0 siblings, 0 replies; only message in thread
From: Constantine Kousoulos @ 2007-06-07 17:27 UTC (permalink / raw)
  To: grub-devel

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 = .;
}



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-06-07 17:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-07 17:27 boot on amd64 Constantine Kousoulos

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.