Page 1 of 1

my problem with kernel and grub

Posted: Sun Sep 07, 2008 4:40 pm
by SAEED
hi this is my first topic in this forum
i wish you to help me
first : sorry about my english COZ im not english ok sorry again
second:im using microsoft windows as my os and DJGPP and nasmw.
but my problem is:
im using boot loader with name grub 0.97 on file-systemize floppy disc as my bootloader
but when i run flow command in grub command-line:

Code: Select all

root (fd0)

Code: Select all

kernel /kernel.elf
it return to me this error:

Code: Select all

Error13:Invalid or unsupported executable format
my kernel and other file are here
first question is:how can i make coff file (for using with objcopy-elf for converting it to elf file)?
i have kernel.cpp and video.h and video.cpp and link.ld
2nd question:how can i write ld-script for linking those files?
3rd question: What is elf files?how can i make them directly?
ill attach my codes for you
4th whats wrong with my codes? :-k
sorry about chattiness #-o :oops: :-" :-#
tnxxxxxxxxx [-o< [-o<

Re: my problem with kernel and grub

Posted: Sun Sep 07, 2008 10:32 pm
by VRassouli
hi saeed, why dont you take a look to http://wiki.osdev.org/Bare_bones?
it will tell you how to develope a minimal kernel and load it by grub :)
i wish its useful...

Re: my problem with kernel and grub

Posted: Mon Sep 08, 2008 2:11 pm
by SAEED
hi my friend
tnx man
i m looking for something like that
ill look at that and then ill ask my question (if i have :-D )
tnx again

Re: my problem with kernel and grub

Posted: Mon Sep 08, 2008 5:47 pm
by SAEED
sorry dude but i still have Error 13
i made loader.o
with command

Code: Select all

nasm -f elf -o loader.s
i made kernel.o
with command

Code: Select all

gcc -o kernel.o -c kernel.c -Wall -Wextra -Werror -nostdlib -nostartfiles -nodefaultlibs
but it return warning and pervent from compile that

Code: Select all

kernel.c:1: warning: unused parameter 'mbd'
kernel.c:1: warning: unused parameter 'magic'
and im had to delete mbd and magic from function main()
then i could compile that
i use ld for kernel.Bin it has no error
then i made txtfiles.txt and open it with notepad and write some 'a' in that and save that with PAD name(without any extension) and check size of that has 750 Byte
then i use copy command as:

Code: Select all

copy /b stage1+stage2+PAD+kernel.bin boot
my kernel.bin has 2.38 KB and 4.00 KB on disk
2.38KB => 2437.12 Byte / 512 Byte ==> 4.76 (should i use 5 as end of my kernel or 4?)
and stage1+stage2+PAD has 100 kb
then i use rawrite.exe as:

Code: Select all

rawrite boot a:
after that i put floppy in my fdd and start virtual machin when grub command line is runed
i use command:

Code: Select all

kernel 200+5
but still it return to me Error 13
what can i do?plz helllllp meeeee
tnx

Re: my problem with kernel and grub

Posted: Tue Sep 09, 2008 12:42 pm
by VRassouli
hi, you ma remove -Werror option from the option lists! it threads warnings as errors! the warnings about the magic number, is something not serious!