grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multiboot header error


From: Constantine Kousoulos
Subject: Re: multiboot header error
Date: Wed, 30 May 2007 18:51:37 +0300
User-agent: Icedove 1.5.0.10 (X11/20070329)

Here is a sample kernel, built as elf64, that simply refuses to boot. It consists of only two files: boot.S and multiboot.h. It does absolutely nothing and it is a cut-down version of the kernel found at http://www.gnu.org/software/grub/manual/multiboot/multiboot.html#Example-OS-code or in grub-0.97/docs.

boot.S:
#include "multiboot.h"
        .text
        .globl  start, _start
start:
_start:
        jmp     multiboot_entry

        /* Align 64 bits boundary.  */
        .align  8
        
multiboot_header:
        .long   MULTIBOOT_HEADER_MAGIC
        .long   MULTIBOOT_HEADER_FLAGS
/*      .long   -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)*/

multiboot_entry:
        /* Initialize the stack pointer.  */
        movq    $(stack + STACK_SIZE), %rsp

        /* Reset EFLAGS.  */
        pushq   $0
        popf

        /* Push the pointer to the Multiboot information structure.  */
        pushq   %rbx
        /* Push the magic value.  */
        pushq   %rax

loop:   hlt
        jmp     loop

        /* Our stack area.  */
        .comm   stack, STACK_SIZE
        
multiboot.h:
#define MULTIBOOT_HEADER_MAGIC          0xe85250d6
#define MULTIBOOT_HEADER_FLAGS          0x00000000
#define STACK_SIZE                      0x4000

Makefile.am:
noinst_PROGRAMS = kernel
kernel_SOURCES = boot.S multiboot.h
kernel_CFLAGS = -fno-builtin -nostdinc -O -g -Wall
kernel_LDFLAGS = -nostdlib


All i get from GRUB2 is "error: No multiboot header found". I have tried changing the magic number to 0xd65052e8 to make sure i got it ok, but it still doesn't boot. The flags are all zero according to the next version of the Multiboot Spec. The same document doesn't say anything about a checksum in the multiboot header, so i commented it out.

What do you think is to blame for this behaviour?

Thanks,
Constantine




reply via email to

[Prev in Thread] Current Thread [Next in Thread]