Grub and a kernel
Grub and a kernel
Hi, i have started to use grub, i have made myself a bootable disk that comes up with the menu to chose the os to load. I try and load my kernel "kernel.sys" that has been compiled with gxx from djgpp, and it says that it is an unsuported executable format. i need some help to get this working.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Grub and a kernel
grub requires ELF, Djgpp offers COFF ... hence the problem
check DF's posts for an ELF version of Djgpp
check DF's posts for an ELF version of Djgpp
Re:Grub and a kernel
ok, i have read his posts but on the thing saying how to make it compile things to elf files it says you need 4 files that are ment to be in the bin directory of the djgpp but i dont have them.
Re:Grub and a kernel
I have the same problem:
you need to insert the elf file definition:
MULTIBOOT_PAGE_ALIGN equ 1<<0
MULTIBOOT_MEMORY_INFO equ 1<<1
MULTIBOOT_HEADER_MAGIC equ 0x1BADB002
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO
CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
; The Multiboot header (in NASM syntax)
align 4
dd MULTIBOOT_HEADER_MAGIC
dd MULTIBOOT_HEADER_FLAGS
dd CHECKSUM
insert it into your code at start,and compile it,
I have tried with it but gcc shows error,but nasm compiles it but I don't know how to combine these files
you need to insert the elf file definition:
MULTIBOOT_PAGE_ALIGN equ 1<<0
MULTIBOOT_MEMORY_INFO equ 1<<1
MULTIBOOT_HEADER_MAGIC equ 0x1BADB002
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO
CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
; The Multiboot header (in NASM syntax)
align 4
dd MULTIBOOT_HEADER_MAGIC
dd MULTIBOOT_HEADER_FLAGS
dd CHECKSUM
insert it into your code at start,and compile it,
I have tried with it but gcc shows error,but nasm compiles it but I don't know how to combine these files
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Grub and a kernel
hmm, i think you missunderstood me. if you go to http://www.mega-tokyo.com/os/os-faq-elf.html#elf_files then it tells you that you need is a good installation of DJGPP, you will need sed, bison, flex, bash, etc. These files are ment to be in the bin directory of djgpp except i dont have them, where can i get a version that does.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Grub and a kernel
omegaice : that was a response to Thunder ... i've not been testing the ELF feature of DjGpp : when i need ELF i use linux ...
... BUT i have the power of g00gle with me
http://membres.lycos.fr/placr/binutils-2.9-elf.zip
... BUT i have the power of g00gle with me
http://membres.lycos.fr/placr/binutils-2.9-elf.zip
Re:Grub and a kernel
ok, that made an elf file when i linked it but grub still says that it is an invalid or unsupported executable format
Re:Grub and a kernel
for me it was the same, but in GRUB totorials it was shown that this source should help but GRUB again showed that was a failure ???
Re:Grub and a kernel
this would all work fine if someone would post a link to a bootloader that is written in assembler and works with c++ or c, i have been searching for 4 days now for a bootloader that works
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Grub and a kernel
GRUB works. Many people use it ... you're just using it .. wrong.
It seems that nobody that sees your thread knows how to help you, that's all ...
It seems that nobody that sees your thread knows how to help you, that's all ...
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:Grub and a kernel
and with your attitude you will search your whole long life after such a bootloader, Mr. Omegaice!
0. Every bootloader outta there has to be written in assembly. In 512 bytes is not that much space for blown high level language .. just place for nitty gritty!
1. The best bootloader cannot jump to any c-function or c-label, because it is not linked to this label. The bootloader just knows an ADRESS to jump to. conclusio: the bootloader cares crap about the language you use for kernel: It just cares about the adress to jump to finally.
2. At the adress the bootloader jumps to, SHALL be an assembly stub, that then jumps to the c or c++ code.
3. the assembly stub and the c or c++ kernel are linked together.
4. I miss the magic word in your request, Mr. Omegaice. Maybe you do not provide grub with it too. grub also likes to be asked politely.
stay safe
0. Every bootloader outta there has to be written in assembly. In 512 bytes is not that much space for blown high level language .. just place for nitty gritty!
1. The best bootloader cannot jump to any c-function or c-label, because it is not linked to this label. The bootloader just knows an ADRESS to jump to. conclusio: the bootloader cares crap about the language you use for kernel: It just cares about the adress to jump to finally.
2. At the adress the bootloader jumps to, SHALL be an assembly stub, that then jumps to the c or c++ code.
3. the assembly stub and the c or c++ kernel are linked together.
4. I miss the magic word in your request, Mr. Omegaice. Maybe you do not provide grub with it too. grub also likes to be asked politely.
stay safe
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
Re:Grub and a kernel
Thanks for all the help, the problem was that i needed a multi boot header, i have added that and now it works
Re:Grub and a kernel
ok, take that back, it now loads the kernel but it does nothing, i have a c routine to clear the screen, i call that and then i write hello on the screen, it clears the screen which is actualy grub clearing it but then it doesnt put any chars on the screen, this is in vmware by the way, then i changed it so that it just put something on the screen and it came up with an error saying tripple error- shutdown and shutsdown vmware
Re:Grub and a kernel
Well, that is most probably a bug in your code - give some more details (post some code)