title: GRUB says Error 13: Invalid or unsupported executable format
body: <p>I wrote a kernel. Here is my kernel start up file:</p>
  
  <pre><code>.text
      .globl start
  start:
  jmp main
  
  mboot:
   .set ALIGN,    1&lt;&lt;0
  .set MEMINFO,  1&lt;&lt;1
  .set FLAGS,    ALIGN | MEMINFO
  .set MAGIC,    0x1BADB002
  .set CHECKSUM, -(MAGIC + FLAGS)
  
  .section multiboot
  .align 4
  .long MAGIC
  .long FLAGS 
  .long CHECKSUM
  main:
  call kernel_main
      cli
      hlt
  </code></pre>
  
  <p>Here is my first C file:</p>
  
  <pre><code>void print(char *message, int line,int ch){
       char *vm=(char *)0xb8000;
       int i=(line*80*2);
       i=i+(ch*2);
       while(*message!=0){
       if (*message=='\n'){line++;
       i=(line*80*2);}
       else {vm[i]=*message;
       i++;
       vm[i]=0x07;
       i++;} *message++;}}
  </code></pre>
  
  <p>Based on that I wrote a second C file:</p>
  
  <pre><code>#include "ESfunctions.c" //this is the previous C file 
  kernel_main(){
  print("Hi!\nHow do you like my OS?",0,0);}
  </code></pre>
  
  <p>Edit: Here is my linker script:</p>
  
  <pre><code>OUTPUT_FORMAT("binary")
  ENTRY(start)
  SECTIONS
  {
    .text  0x100000 : {
      code = .; _code = .; __code = .;
      *(.text)
      . = ALIGN(4096);
    }
    .data  : {
      data = .; _data = .; __data = .;
      *(.data)
      . = ALIGN(4096);
    }
    .bss  :
    {
      bss = .; _bss = .; __bss = .;
      *(.bss)
      . = ALIGN(4096);
    }
    end = .; _end = .; __end = .;
  }
  </code></pre>
  
  <p>Edit: I am not using a cross-compiler. I am using gcc on Ubuntu.</p>
  
  <p>I compiled the C code and assembled the assembly code and linked them together. Then I turned it into a bootable image and together with grub I burned it all onto a disc. After grub started I entered the command "kernel KERNEL.BIN" (KERNEL.BIN is my kernel) and grub said "Error 13: Invalid or unsupported executable format. What is wrong? Can anybody help me?</p>