Autor Thema: GRUB/Multiboot.  (Gelesen 4329 mal)

clemensoft

  • Beiträge: 92
    • Profil anzeigen
    • http://www.clemensoft.de
Gespeichert
« am: 24. January 2005, 18:34 »
Hallo. Hat jemand von euch ein Multiboot-kompatibles Betriebssystem geschrieben? Ich hab versucht, Delta Multiboot-konform zu machen, ich kriege die GRUB-Meldung: 13: Unsupported executable format. Ich habs mit ELF, A.OUT, COFF, PE und sonstwas probiert. Müsste mit bin eigentlich gehen! Hier mal der Code von nc_init.asm:


;=======================================\
;   Delta Nanocore Project              |
;                                       |
;    Nanocore Main Core                 |
;=======================================/


%define dnc_version 'Delta Nanocore v0.0.0-14012005-deca1',dnc_arch,dnc_tag,' compiled with nasm-',__NASM_VER__  ;Nanocore version information
%define dnc_arch '-x86-32-grub'
%define dnc_tag '-epsilon15' ;Place your name here if you edited the file



;Functions in this file:

;IM, BF nanocore_entry:
;Start of Nanocore. Gets memory size and initializes the core

;IM, BF nanocore_hangup:
;Used to kill the computer by infinite loop

;IM, BF debug_print:
;Clears the first line of the screen and prints a 0-terminated String at DS:ESI

;IM, BF nanocore_getmemsize:
;BUG: This doesn't work uin VMware
;Counts the amount of memory installed in the computer





bits 32
org 0x100000
jmp nanocore_entry



;Multiboot Header
nmh_magic dd 0x1BADB002
nmh_flags dd 0x00000000
nmh_checksum dd 0xE4524FFE

nmh_header_addr dd nmh_magic
nmh_load_addr dd 0x100000
nmh_load_end_addr dd nanocore_end_kernel
nmh_bss_end_addr dd 0
entry_addr dd nanocore_entry



;Nanocore's Entry Point

nanocore_entry:
    mov esp,0x200000
    call nanocore_getmemsize
    cmp ax,0x10
   
    jl nanocore_entry.toolessmem ;comment this out if you build for VMWare
   
    jmp nanocore_entry.enoughmem ;enough...
   
    nanocore_entry.toolessmem:
    mov esi, msg_memtooless
    call debug_print ; And tell the user
    jmp nanocore_hangup ; And hang up ;)
       
    ;Here we go:
    nanocore_entry.enoughmem:
    mov esi, msg_memenough
    call debug_print
    mov esi, msg_version
    call debug_print
   
    ;call nanocore_init_mods

nanocore_hangup:
    jmp nanocore_hangup
   


debug_print:
mov edi, 0xB8000
mov ecx, 80*2*25
xor eax, eax
rep stosb
mov edi, 0xB8000
debug_print.1:
lodsb
or al, al
jz debug_print.2
stosb
mov al, 12
stosb
jmp debug_print.1
debug_print.2:
ret

nanocore_getmemsize:
    push ebp
    mov ebp, esp
    push edx
    mov eax, 0
    mov edx, 0x1EFFFC
    nanocore_getmemsize.1:
    inc eax
    mov DWORD [edx], 0xAAAAAAAA
    mov ebx, [edx]
    add edx, 0x100000
    cmp ebx, 0xAAAAAAAA
    je nanocore_getmemsize.1
    pop edx
    mov esp, ebp
    pop ebp
    ret



nanocore_data:
    msg_version db dnc_version,0
    msg_memenough db 'nanocore:You have enough RAM',0
    msg_memtooless db "nanocore:FATAL:You don't have enough RAM! Note: if you have more than 16 MB RAM, you are possibly running Delta Nanocore on VMWare. Either get the VMWare-compatible kernel or use Bochs as a virtual machine or use it on a real computer. If you still get this message, something is terribly wrong i.e., Nanocore doesn't fit your system.",0
   
   
   
   

nanocore_end_kernel:


clemensoft

  • Beiträge: 92
    • Profil anzeigen
    • http://www.clemensoft.de
Gespeichert
« Antwort #1 am: 24. January 2005, 20:21 »
:x  :x  Hört auf, meinen Thread nach hinten zu rücken!!!  :x  :x

Jidder

  • Administrator
  • Beiträge: 1 625
    • Profil anzeigen
Gespeichert
« Antwort #2 am: 24. January 2005, 21:09 »
lol

also es muss afaik das elf format sein. allerdings produziert nasm irgendwie eine elf-datei, die so noch nicht geht. (irgendwelche symbole sind nicht aufgelöst oder so.) auf jeden musst du das mit ld nochmal linken. wenn ich mal eine schätzung abgeben soll würde das so gehen: ld -Ttext=0x100000 --oformat=elf -o kernel.elf nc_init.o

nc_init.o ist das was nasm beim assemblieren ausgespuckt hat und kernel.elf soll dein fertiger kernel sein. vielleicht musst du dann das org 0x100000 in der asm-datei entfernen.

frei nach: http://www.openbg.net/sto/os/xml/grub.html#multiboot
Dieser Text wird unter jedem Beitrag angezeigt.

clemensoft

  • Beiträge: 92
    • Profil anzeigen
    • http://www.clemensoft.de
Gespeichert
« Antwort #3 am: 25. January 2005, 16:30 »
Ich habs mit ld-elf probiert, oformat=elf32-i386 Ttext=100000 und so weiter, dann noch mit a.out und objdump aber nichts hat wirklich funktioniert. Der Fehler war immer der selbe (#13)

clemensoft

  • Beiträge: 92
    • Profil anzeigen
    • http://www.clemensoft.de
Gespeichert
« Antwort #4 am: 05. February 2005, 13:41 »
HILFÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ!
 :(  :(  :(  :(  :(  :(  :(  :(  :(  :(  :(  :(  :(  :(  :(  :(  :(
 :x  :x  :x  :x  :x  :x  :x  :x  :x  :x  :x  :x  :x  :x  :x  :x

Lizer

  • Beiträge: 28
    • Profil anzeigen
Gespeichert
« Antwort #5 am: 07. February 2005, 11:15 »
Auf www.buha.info/projects/midgard findest du das OS an dem ich grad arbeite. Wird problemlos von GRUB gebootet. Interessant sind für die die Dateien init.c und entry.s sowie das Makefile, in dem die Compile- und Link-Anweisungen stehen.

Have fun!

Lizer

clemensoft

  • Beiträge: 92
    • Profil anzeigen
    • http://www.clemensoft.de
Gespeichert
« Antwort #6 am: 11. February 2005, 20:33 »
Die Datei mit der doppelten tar-endung lässt sich nicht mit tar extrahieren. Auch nicht nach Entfernen der zweiten Endung. Packs doch mal als gzip oder so, wär dir echt dankbar  :D

Lizer

  • Beiträge: 28
    • Profil anzeigen
Gespeichert
« Antwort #7 am: 15. February 2005, 10:27 »
Das Format ist tar.bz2 (sieht man auch in der Status-Leiste wenn der Cursor über'm Link ist). Windows vermurkst grundsätzlich alle doppelten Dateiendungen, also einfach in midgard.tar.bz2 umbenennen, falls die Datei nach dem Download nicht so heißt.

clemensoft

  • Beiträge: 92
    • Profil anzeigen
    • http://www.clemensoft.de
Gespeichert
« Antwort #8 am: 19. February 2005, 13:41 »
Und wieder einaml kann man Bill Gates beschuldigen... Das macht Spaß....

 

Einloggen