Autor Thema: UOS Bootloader Grub Problem  (Gelesen 2787 mal)

najjannaj

  • Beiträge: 75
    • Profil anzeigen
Gespeichert
« am: 02. December 2005, 14:16 »
Hallo,
habe folgendes Problem:

Habe folgende link.ld:


/* UOS
 * link.ld - linker file
 */

/* let the linker use its 'native' format (ELF/COFF/PE)
OUTPUT_FORMAT("elf32-i386") */
/* no leading underscore for symbols handled in asm: */
ENTRY(start)
LS_Phys = 0x100000; /* 1 meg = load (physical) address */
LS_Virt = 0x100000; /* 1 meg = virtual address */
SECTIONS
{
    .text LS_Virt : AT(LS_Phys)
    {
LS_Code = .;
/* symbols to mark start of code segment */
code = .; _code = .;
/* kernel code */
*(.text)
/* .rodata is the ELF constant data section */
*(.rodata*)
. = ALIGN(4096);
    }
    .data : AT(LS_Phys + (LS_Data - LS_Code))
    {
LS_Data = .;
/* symbols to mark start of data segment */
data = .; _data = .;
/* kernel data */
*(.data)
. = ALIGN(4096);
    }
    .bss : AT(LS_Phys + (LS_Bss - LS_Code))
    {
LS_Bss = .;
/* symbols to mark start of BSS segment */
bss = .; _bss = .;
/* kernel BSS */
*(.bss)
*(COMMON) /* "common" variables */
. = ALIGN(4096);
    }
/* symbols to mark end of kernel */
    end = .; _end = .;
}



und folgende Makefile:


CFLAGS = -nostdlib -fomit-frame-pointer -fno-builtin -Wall -march=i386 -I./header -I./header/libc
OBJ = kernel.o processore/irq.o processore/idt.o processore/cpuid.o hw/8259.o hw/8253.o  \
      hw/keyboard.o hw/clock.o hw/dma.o hw/floppy.o mem/paging.o mem/fismem.o io/io.o libc/stdlib.o libc/bitops.o libc/stdio.o        \
      libc/string.o task/task.o task/scheduler.o task/tss.o task/semaphore.o task/ipc/signal.o            \
      video.o system/kprg.o system/shell.o

uos.img: bl.img kernel.bin

bl.img : boot/boot.asm
nasm -f bin ./boot/boot.asm -o bl.img

kernel.bin: $(OBJ)
ld -Tlink.ld -okernel.bin $(OBJ) -Ttext 0x10000 -Map kernel.map

kernel.o: kernel.c
video.o: video.c
processore/idt.o: processore/idt.c
processore/irq.o: processore/irq.c
processore/cpuid.o: processore/cpuid.c
io/io.o: io/io.c
libc/bitops.o: libc/bitops.c
libc/stdlib.o: libc/stdlib.c
libc/stdio.o: libc/stdio.c
libc/string.o: libc/string.c
hw/8259.o: hw/8259.c
hw/8253.o: hw/8253.c
hw/keyboard.o: hw/keyboard.c
hw/clock.o: hw/clock.c
hw/dma.o: hw/dma.c
hw/floppy.o: hw/floppy.c
mem/fismem.o: mem/fismem.c
mem/paging.o: mem/paging.c
task/task.o: task/task.c
task/scheduler.o: task/scheduler.c
task/tss.o: task/tss.c
task/semaphore.o: task/semaphore.c
task/ipc/signal.o: task/ipc/signal.c
system/kprg.o: system/kprg.c
system/shell.o: system/shell.c

.PHONY: clean install

clean:
del *.img
del *.bin
del *.map
del *.o
del boot\*.o
del header\*.o
del header\libc\*.o
del hw\*.o
del io\*.o
del libc\*.o
del mem\*.o
del PROCES~1\*.o
del system\*.o
del task\*.o
del task\ipc\*.o



Wenn ich dann die "kernel.bin" mit Grub starten möchte sagt Grub mir immer:
Error 13: Invailid or unsupported executable format

Was mach ich falsch??

Vielen Dank!
Greetz
najjannaj

DarkThing

  • Beiträge: 652
    • Profil anzeigen
Gespeichert
« Antwort #1 am: 02. December 2005, 16:59 »
Du solltest überprüfen, ob der Multiboot-Header auch wirklich in den ersten 8kB (bin mir nicht ganz sicher, aber auf jeden Fall am Anfang) steht. Du solltest den Object-File, in dem sich der Header befindet, als erste Datei dem Linker übergeben.
Ansonsten kannst du mit dem Tool mbchk das ganze nochmal untersuchen, in der Regel gibt das Recht brauchbare Ausgaben.

Legend

  • Beiträge: 635
    • Profil anzeigen
    • http://os.joachimnock.de
Gespeichert
« Antwort #2 am: 02. December 2005, 19:03 »
Ausserdem muss der Header noch auf ich glaub 4 Byte aligned sein.
*post*

 

Einloggen