Hi all,
i want to get my kernel loaded by grub. its real mode kernel and flat binary (.bin) when i tried to load it using a pre-installed image it told me that the format was not recognisable. so my questions
1) do i have to switch to elf/a.out to use grub? if yes how can i compile to these binary formats? Don't forget that im programming a real mode kernel and i write the hole code in assembly.
2)Where can i find some reliable info on how to install grub on a floppy or at least find some good pre-installed images?
Thank you
GRUB
-
- Member
- Posts: 134
- Joined: Sun Oct 24, 2004 11:00 pm
- Location: North Dakota, where the buffalo roam
Re: GRUB
For a real mode kernel, I don't think it makes much sense to use GRUB. GRUB starts kernels in protected mode, to avoid the need for each kernel to do the switch itself. In order to use GRUB, you'd have to switch back to real mode after it loads your kernel. The only alternative is to use the "chainloader" feature, which basically does what the bios does.joke wrote:Hi all,
i want to get my kernel loaded by grub. its real mode kernel and flat binary (.bin) when i tried to load it using a pre-installed image it told me that the format was not recognisable. so my questions
1) do i have to switch to elf/a.out to use grub? if yes how can i compile to these binary formats? Don't forget that im programming a real mode kernel and i write the hole code in assembly.
2)Where can i find some reliable info on how to install grub on a floppy or at least find some good pre-installed images?
Thank you
For more info on GRUB, try the documentation here.
It is not necessary that ur kernel should be in ELF/a.out format...
Even if your kernel is a flat bin, to boot from Grub, u need a aout kludge...
e.i, a Multiboot header... iat the begining of ur flat binary kernel (something like withn 1 KB / x KB of your flat binary). if u do "info grub" u'll get full explanation...
Try upgrading to "Protected" mode to enjoy "Freedom"
Even if your kernel is a flat bin, to boot from Grub, u need a aout kludge...
e.i, a Multiboot header... iat the begining of ur flat binary kernel (something like withn 1 KB / x KB of your flat binary). if u do "info grub" u'll get full explanation...
Try upgrading to "Protected" mode to enjoy "Freedom"
i wrote a simple asm prog to test if i can go out of pmode back to real mode.
i added
MODULEALIGN equ 1<<0
MEMINFO equ 1<<1
FLAGS equ MODULEALIGN | MEMINFO
MAGIC equ 0x1BADB002
CHECKSUM equ -(MAGIC + FLAGS)
and
AOUT_KLUDGE equ 1<<16
but GRUB still says Unrecognized format
help!
i added
MODULEALIGN equ 1<<0
MEMINFO equ 1<<1
FLAGS equ MODULEALIGN | MEMINFO
MAGIC equ 0x1BADB002
CHECKSUM equ -(MAGIC + FLAGS)
and
AOUT_KLUDGE equ 1<<16
but GRUB still says Unrecognized format
help!
I need someone to show me the things in life that I cant find
I cant see the things that make true happiness, I must be blind
I cant see the things that make true happiness, I must be blind
IIRC, equ doesn't save values on the output. You need (after the equ) something like:
etc (following the format and sequence of the header)
Also, make sure to make the endianess compatible, for example a double-word 0xAABBCCDD is stored as the sequence of bytes: DD CC BB AA.
Somebody please correct me if I'm wrong. Hope this helps,
JVFF
Code: Select all
header:
dd MAGIC
dd FLAGS
...
Also, make sure to make the endianess compatible, for example a double-word 0xAABBCCDD is stored as the sequence of bytes: DD CC BB AA.
Somebody please correct me if I'm wrong. Hope this helps,
JVFF
-
- Member
- Posts: 134
- Joined: Sun Oct 24, 2004 11:00 pm
- Location: North Dakota, where the buffalo roam
Another problem you may encounter if you insist on using GRUB to load a real mode kernel is the fact that (last I knew) GRUB cannot load kernels below the 1MB address mark, which means that you will need to start the kernel above 1MB, then move it, before disabling real mode.
But, as I said before, I still don't think it makes sense to use GRUB to load a real mode kernel. It really isn't intended for it.
But, as I said before, I still don't think it makes sense to use GRUB to load a real mode kernel. It really isn't intended for it.