bug-grub
[Top][All Lists]
Advanced

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

loading a djgpp coff


From: osd4d
Subject: loading a djgpp coff
Date: Sun, 16 Sep 2001 00:07:01 -0400

If this is the wrong place to get this info please point me to the right
one.

Is there a special header for loading coff files made by djgpp?
(djgpp is the msdos port of gcc)
What do I need to do to make it work?
Or what did I miss understand in setting it up?

When loaded fully in mem a coff has no relocs, just jump to the
entry point and run. The a.out_kludge header seems to provide
for this.
My test file is simple. The whole test file is ~4K so I know the
header is in the first 8K. I compile both a start.asm and a kernel.c
as coff, then link it as a coff OUTPUT_FORMAT("coff-go32"),
and an elf OUTPUT_FORMAT("elf-i386"). The elf loads and runs,
the coff is reconized as a a.out_kludge but then errors:

GRUB version 0.5.96.1
Error 13: Invalid or unsuported executable format


Code follows:
; start.asm  NASM (intel syntax)

    global KernelEntry
    extern _KernelMain

    bits 32
    segment .text
TextStart:

F_PAGE_ALIGN equ 1<<0
F_MEM_FIELDS equ 1<<1
F_A_OUT_KLUD equ 1<<16

MAGIC        equ 0x1BADB002
FLAGS        equ F_PAGE_ALIGN | F_MEM_FIELDS | F_A_OUT_KLUD
CHECKSUM     equ -(MAGIC + FLAGS)

KernelEntry:
    mov esp, 0x00101000
    push ebx
    call _KernelMain

; The Multiboot header

    align 8
BootHdr:
    dd MAGIC
    dd FLAGS
    dd CHECKSUM
;--a.out kludge header
    dd BootHdr                ;header_addr
    dd TextStart                ;load_addr
    dd TextStart+0x1000  ;load_end_addr
    dd TextStart+0x1000  ;bss_end_addr
    dd KernelEntry            ;entry
;end


The header numbers is from objdump. There is nothing in the .data or
.bss section for now.


/* kerncof.ls */

OUTPUT_FORMAT("coff-go32")
physical_load_addr = 0x00101000;
ENTRY (KernelEntry)

SECTIONS
{ 
    . = physical_load_addr;
        
    .text :
    { 
        *(.text)
        *(.rodata)
    }   
        
    .data ALIGN (0x1000) :
    { 
        *(.data)
    }
    
    .bss :
    { 
        _sbss = .;
        *(COMMON)
        *(.bss)
      
  _ebss = .;
    }
}
/* end kerncof.ls */

Linker scripts for coff and elf are the same except for
OUTPUT_FORMAT(" ") being coff-go32 and elf-i386.


P.S. The ld I use is not the normal one that ships with djgpp, I am
using it only to till I can get grub to load coff. It is a pain to reconfig
tools under dos and I intend to use the standard shiping tools only.

Thank you.
OSD4D




reply via email to

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