Autor Thema: GRUB Error7  (Gelesen 2817 mal)

rizor

  • Beiträge: 521
    • Profil anzeigen
Gespeichert
« am: 22. February 2011, 00:16 »
Nabend zusammen,

ich habe ein Problem mit Grub. Qemu winkt den Code durch.
Ich habe meinen Kernel gebaut, der komplett oberhalb der 1MB Grenze liegt.
Leider ist Grub da anderer Meinung.

Hier mal mein Linker-Skript:
ENTRY(_start)
OUTPUT(elf32-i386)
OUTPUT_ARCH(i386:i386)

SECTIONS
{
. = 0x100000;

__kernel_entry = .;
__init_entry = .;
__init32_entry = .;
.init32 0x100000 : {
*(.multiboot)
*(.init32_text)
*(.init32_data)
}
__init32_end = .;
__init_end = .;

. = ALIGN(0x1000);

__ro_data_entry = .;
.text : {
*(.text)
*(.rodata)
}
__ro_data_end = .;

. = ALIGN(0x1000);

__rw_data_entry = .;
.data : {
*(.data)
}

.bss : {
*(COMMON)
*(.bss)
}
__rw_data_end = .;
__kernel_end = .;

/DISCARD/ : { *(.comment) }
}

Hier noch ein paar Ausgaben (readelf und objdump):

rizor-kernel/rizor-kernel.krn:     file format elf32-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .init32       00004c58  00100000  00100000  00001000  2**5
                  CONTENTS, ALLOC, LOAD, CODE
  1 .text         00009328  00105000  00105000  00006000  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .data         00000054  0010f000  0010f000  00010000  2**5
                  CONTENTS, ALLOC, LOAD, DATA
  3 .bss          00005c68  0010f060  0010f060  00010054  2**5
                  ALLOC
  4 .debug_abbrev 00002a7c  00000000  00000000  00010054  2**0
                  CONTENTS, READONLY, DEBUGGING
  5 .debug_info   0000c1ea  00000000  00000000  00012ad0  2**0
                  CONTENTS, READONLY, DEBUGGING
  6 .debug_line   000031d6  00000000  00000000  0001ecba  2**0
                  CONTENTS, READONLY, DEBUGGING
  7 .debug_loc    000027bb  00000000  00000000  00021e90  2**0
                  CONTENTS, READONLY, DEBUGGING
  8 .debug_pubnames 00001df3  00000000  00000000  0002464b  2**0
                  CONTENTS, READONLY, DEBUGGING
  9 .debug_pubtypes 00001ecd  00000000  00000000  0002643e  2**0
                  CONTENTS, READONLY, DEBUGGING
 10 .debug_aranges 00000588  00000000  00000000  00028310  2**3
                  CONTENTS, READONLY, DEBUGGING
 11 .debug_str    00003063  00000000  00000000  00028898  2**0
                  CONTENTS, READONLY, DEBUGGING
 12 .debug_frame  00001a04  00000000  00000000  0002b8fc  2**2
                  CONTENTS, READONLY, DEBUGGING
 13 .debug_ranges 00000298  00000000  00000000  0002d300  2**0
                  CONTENTS, READONLY, DEBUGGING

There are 18 section headers, starting at offset 0x2d654:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .init32           PROGBITS        00100000 001000 004c58 00 WAX  0   0 32
  [ 2] .text             PROGBITS        00105000 006000 009328 00  AX  0   0  4
  [ 3] .data             PROGBITS        0010f000 010000 000054 00  WA  0   0 32
  [ 4] .bss              NOBITS          0010f060 010054 005c68 00  WA  0   0 32
  [ 5] .debug_abbrev     PROGBITS        00000000 010054 002a7c 00      0   0  1
  [ 6] .debug_info       PROGBITS        00000000 012ad0 00c1ea 00      0   0  1
  [ 7] .debug_line       PROGBITS        00000000 01ecba 0031d6 00      0   0  1
  [ 8] .debug_loc        PROGBITS        00000000 021e90 0027bb 00      0   0  1
  [ 9] .debug_pubnames   PROGBITS        00000000 02464b 001df3 00      0   0  1
  [10] .debug_pubtypes   PROGBITS        00000000 02643e 001ecd 00      0   0  1
  [11] .debug_aranges    PROGBITS        00000000 028310 000588 00      0   0  8
  [12] .debug_str        PROGBITS        00000000 028898 003063 01  MS  0   0  1
  [13] .debug_frame      PROGBITS        00000000 02b8fc 001a04 00      0   0  4
  [14] .debug_ranges     PROGBITS        00000000 02d300 000298 00      0   0  1
  [15] .shstrtab         STRTAB          00000000 02d598 0000ba 00      0   0  1
  [16] .symtab           SYMTAB          00000000 02d924 001e40 10     17  71  4
  [17] .strtab           STRTAB          00000000 02f764 001a4f 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Was kann GRUB dazu bewegen mir diese Meldungen zu geben.
Kann es an den Debug-Sektionen liegen?

Danke.
Programmiertechnik:
Vermeide in Assembler zu programmieren wann immer es geht.

kevin

  • Administrator
  • Beiträge: 2 767
    • Profil anzeigen
Gespeichert
« Antwort #1 am: 22. February 2011, 09:38 »
Was sagt denn mbchk? Und readelf -l?

Auf den ersten Blick fällt mir nichts auf.
Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end.

rizor

  • Beiträge: 521
    • Profil anzeigen
Gespeichert
« Antwort #2 am: 22. February 2011, 10:06 »
mbchk sagt:

rizor-kernel.krn: The Multiboot header is found at the offset 4096.
rizor-kernel.krn: Page alignment is turned on.
rizor-kernel.krn: Memory information is turned on.
rizor-kernel.krn: Address fields is turned on.
rizor-kernel.krn: Cannot be loaded at less than 1MB by GRUB (0x0)

readelf -l:
Elf file type is EXEC (Executable file)
Entry point 0x103ba7
There are 3 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x001000 0x00100000 0x00100000 0x10054 0x15cc8 RWE 0x1000
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4
  PAX_FLAGS      0x000000 0x00000000 0x00000000 0x00000 0x00000     0x4

 Section to Segment mapping:
  Segment Sections...
   00     .init32 .text .data .bss
   01     
   02 
Programmiertechnik:
Vermeide in Assembler zu programmieren wann immer es geht.

erik.vikinger

  • Beiträge: 1 277
    • Profil anzeigen
Gespeichert
« Antwort #3 am: 22. February 2011, 10:08 »
Hallo,


ich weiß zwar nicht ob das Dein Problem ist aber ich finde es irgendwie komisch das der Programm-Code (.text) und die Konstanten (.rodata) in einem Abschnitt liegen:
__ro_data_entry = .;
.text : {
*(.text)
*(.rodata)
}
__ro_data_end = .;
Der Code muss ja ausführbar sein und die Konstanten nicht, vielleicht hat GRUB damit ein Problem beides in die selbe Page zu packen.


Grüße
Erik
Reality is that which, when you stop believing in it, doesn't go away.

kevin

  • Administrator
  • Beiträge: 2 767
    • Profil anzeigen
Gespeichert
« Antwort #4 am: 22. February 2011, 11:55 »
Dein Multiboot-Header ist kaputt.

Warum benutzt du überhaupt den a.out-Kludge, wenn du doch ELF benutzt? Ist doch völlig unnötig.
Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end.

rizor

  • Beiträge: 521
    • Profil anzeigen
Gespeichert
« Antwort #5 am: 22. February 2011, 16:50 »
Hallo,


ich weiß zwar nicht ob das Dein Problem ist aber ich finde es irgendwie komisch das der Programm-Code (.text) und die Konstanten (.rodata) in einem Abschnitt liegen:
__ro_data_entry = .;
.text : {
*(.text)
*(.rodata)
}
__ro_data_end = .;
Der Code muss ja ausführbar sein und die Konstanten nicht, vielleicht hat GRUB damit ein Problem beides in die selbe Page zu packen.


Grüße
Erik

Stimmt, das habe ich uebersehen, hat aber nicht bei dem Problem geholfen.

Dein Multiboot-Header ist kaputt.

Warum benutzt du überhaupt den a.out-Kludge, wenn du doch ELF benutzt? Ist doch völlig unnötig.

Stimmt, das ist nicht nur unnoetig, sondern auch falsch. Er versucht die nicht vorhandenen Informationen an den Anfang des RAMs zu legen. Jetzt geht es, danke.
Programmiertechnik:
Vermeide in Assembler zu programmieren wann immer es geht.

 

Einloggen