will 0xb8000 work with the bare GRUB loader?
will 0xb8000 work with the bare GRUB loader?
while I am reading the tutorial at http://www.osdever.net/bkerndev/index.php?the_id=90
in the chapter Printing onscreen,
the last sentence,
Copy your 'kernel.bin' to your GRUB floppy disk, and if all went well, you should now have a kernel that prints 'Hello World!' on a black screen in white text!
I wonder whether the GRUB has set all the needed( such as entering into PMMode, load gdt, enable paging etc.) for us before it can access 0xb8000.
another question how to build the dev_kernel_grub.img
the author doesn't mention it.
thanks.
in the chapter Printing onscreen,
the last sentence,
Copy your 'kernel.bin' to your GRUB floppy disk, and if all went well, you should now have a kernel that prints 'Hello World!' on a black screen in white text!
I wonder whether the GRUB has set all the needed( such as entering into PMMode, load gdt, enable paging etc.) for us before it can access 0xb8000.
another question how to build the dev_kernel_grub.img
the author doesn't mention it.
thanks.
Re:will 0xb8000 work with the bare GRUB loader?
The basic answers are that GRUB sets up protected mode and everything as needed, and the image should be an ELF/COFF/PE or whatever image with a valid multiboot header (ELF is easiest), usually linked with ld from GNU Binutils using a custom linker script.
Check the FAQ, read the GRUB and multiboot docs and look at a few kernel sources, its all very well explained.
Check the FAQ, read the GRUB and multiboot docs and look at a few kernel sources, its all very well explained.
Re:will 0xb8000 work with the bare GRUB loader?
The exact information is at http://www.gnu.org/software/grub/manual/multiboot/html_node/Machine-state.html. It should be in 32-bit protected mode. From what it says about CR0, paging will be disabled, and from what it says about EFLAGS, interrupts will be disabled.
Re:will 0xb8000 work with the bare GRUB loader?
Hmm so many GRUB'ers and other utils that flock the forums. I've never personally touched GRUB or binutils and never really cared for them. I may stand alone in this point but I wonder if making a OS for one means just puting blocks together and claiming that you've made an OS. Or getting your hands dirty and learning the internals.
I have no idea what your talking about, you dont need to enter protected mode, or enable paging when in PM to access B8000h.I wonder whether the GRUB has set all the needed( such as entering into PMMode, load gdt, enable paging etc.) for us before it can access 0xb8000.
Re:will 0xb8000 work with the bare GRUB loader?
You know the term "not-invented-here-syndrome"?Ryu wrote: Hmm so many GRUB'ers and other utils that flock the forums. I've never personally touched GRUB or binutils and never really cared for them. I may stand alone in this point but I wonder if making a OS for one means just puting blocks together and claiming that you've made an OS. Or getting your hands dirty and learning the internals.
Of course you can start by writing your own assembler in order to write your own bootsector, design your own executable / object file format, write your own compiler, probably inventing a new programming language while you're at it.
Or you might have some nice design ideas and want to get past the booting stage into C/C++ space without having to implement the umpteenth boot sector.
Every good solution is obvious once you've found it.
Re:will 0xb8000 work with the bare GRUB loader?
Hi,
It seems easy to begin with GRUB and code obtained from a tutorial and then find yourself building a kernel without much idea of the fundamentals you've skipped or which choices you didn't make.
For someone who already knows these fundamentals, who has made their own choices and who has evaluated GRUB and found it suitable, using GRUB can save a lot of time, headaches, etc.
People who want to design their own OS should begin with lots of research, then determine what steps their OS needs to take during boot, then decide if GRUB is suitable or not, and only then begin writing their code. The tutorials don't advocate this approach and people tend to want to write code, so they start by writing code without doing any research or design. IMHO this is the main problem (not whether GRUB is used or not).
Of course people who are only doing an OS for fun and don't care much what the OS ends up like should ignore what I've said above, and do whatever seems like the most fun to them at the time.
People who are doing an OS for educational purposes are also a little different - what they do should be determined by what they wish to learn. For e.g. if they only want to learn how to write a memory manager or scheduler then skipping as much as possible up to that point makes sense.
Cheers,
Brendan
Even though you both (Ryu and Solar) have opposite opinions, I agree with both of you...Solar wrote:You know the term "not-invented-here-syndrome"?Ryu wrote:Hmm so many GRUB'ers and other utils that flock the forums. I've never personally touched GRUB or binutils and never really cared for them. I may stand alone in this point but I wonder if making a OS for one means just puting blocks together and claiming that you've made an OS. Or getting your hands dirty and learning the internals.
Of course you can start by writing your own assembler in order to write your own bootsector, design your own executable / object file format, write your own compiler, probably inventing a new programming language while you're at it.
Or you might have some nice design ideas and want to get past the booting stage into C/C++ space without having to implement the umpteenth boot sector.
It seems easy to begin with GRUB and code obtained from a tutorial and then find yourself building a kernel without much idea of the fundamentals you've skipped or which choices you didn't make.
For someone who already knows these fundamentals, who has made their own choices and who has evaluated GRUB and found it suitable, using GRUB can save a lot of time, headaches, etc.
People who want to design their own OS should begin with lots of research, then determine what steps their OS needs to take during boot, then decide if GRUB is suitable or not, and only then begin writing their code. The tutorials don't advocate this approach and people tend to want to write code, so they start by writing code without doing any research or design. IMHO this is the main problem (not whether GRUB is used or not).
Of course people who are only doing an OS for fun and don't care much what the OS ends up like should ignore what I've said above, and do whatever seems like the most fun to them at the time.
People who are doing an OS for educational purposes are also a little different - what they do should be determined by what they wish to learn. For e.g. if they only want to learn how to write a memory manager or scheduler then skipping as much as possible up to that point makes sense.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re:will 0xb8000 work with the bare GRUB loader?
Note that
1) I did not say you cannot, or should not, do your own language / compiler / executable format / bootsector. If that is what you're after, fine. But that's not writing your own OS, that's writing your own language / compiler / executable format / bootsector, which is probably why the OS FAQ doesn't really advocate it.
2) The knowledge you gain in 1) is knowledge you need for doing the things mentioned in 1), which do not (necessarily) coincide with the things you have to know to do OS design. You can learn Assembly in other ways than writing a bootsector, and many of the things you do in early startup code you never need again, anywhere.
3) I completely agree there's lots of interesting things to learn by doing early startup code, no matter whether it's actually useful to know or not.
Can we try and cut the discussion short this time?
1) I did not say you cannot, or should not, do your own language / compiler / executable format / bootsector. If that is what you're after, fine. But that's not writing your own OS, that's writing your own language / compiler / executable format / bootsector, which is probably why the OS FAQ doesn't really advocate it.
2) The knowledge you gain in 1) is knowledge you need for doing the things mentioned in 1), which do not (necessarily) coincide with the things you have to know to do OS design. You can learn Assembly in other ways than writing a bootsector, and many of the things you do in early startup code you never need again, anywhere.
3) I completely agree there's lots of interesting things to learn by doing early startup code, no matter whether it's actually useful to know or not.
Can we try and cut the discussion short this time?
Every good solution is obvious once you've found it.
Re:will 0xb8000 work with the bare GRUB loader?
Have a look at this:asmboozer wrote: another question how to build the dev_kernel_grub.img
http://www.osdev.org/osfaq2/index.php/Working%20with%20Disk%20Images
Re:will 0xb8000 work with the bare GRUB loader?
Hi,
An example would be an OS that loads a boot image containing seperate "boot modules" that need to run in real mode (e.g. for a "default video mode" menu or hardware detection using real mode BIOS functions), or an OS that auto-detects what code should be booted (e.g. a "live CD" that auto-selects boot code that uses the serial port on headless systems instead of trying to use a keyboard and video that doesn't exist).
There are also other reasons for not relying on GRUB, like allowing your OS to be booted easily from other boot loaders (like LILO, NTLDR, etc) or where you can't justify consuming about 120 KB of a boot floppy just for the boot loader when 1 KB is enough.
All I'm saying is that people should design their OS and then decide if GRUB is suitable, rather than deciding to use GRUB and then making their OS suit it....
Cheers,
Brendan
I still say that for some OSs designs, GRUB is either not appropriate, not useful or needs to be coerced.Solar wrote:Can we try and cut the discussion short this time?
An example would be an OS that loads a boot image containing seperate "boot modules" that need to run in real mode (e.g. for a "default video mode" menu or hardware detection using real mode BIOS functions), or an OS that auto-detects what code should be booted (e.g. a "live CD" that auto-selects boot code that uses the serial port on headless systems instead of trying to use a keyboard and video that doesn't exist).
There are also other reasons for not relying on GRUB, like allowing your OS to be booted easily from other boot loaders (like LILO, NTLDR, etc) or where you can't justify consuming about 120 KB of a boot floppy just for the boot loader when 1 KB is enough.
All I'm saying is that people should design their OS and then decide if GRUB is suitable, rather than deciding to use GRUB and then making their OS suit it....
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re:will 0xb8000 work with the bare GRUB loader?
My views on GRUB are well known, but its taken me basically 3 years to build a OS, that is basically GRUB.Ryu wrote: Hmm so many GRUB'ers and other utils that flock the forums. I've never personally touched GRUB or binutils and never really cared for them. I may stand alone in this point but I wonder if making a OS for one means just puting blocks together and claiming that you've made an OS. Or getting your hands dirty and learning the internals.
But i understand every bit of my OS, i think it would of taken me 4 years to fully understand GRUB, so that a saving of a year .
Re:will 0xb8000 work with the bare GRUB loader?
hi, can i simply add the kernel.bin into /boot folder?XenOS wrote:Have a look at this:asmboozer wrote: another question how to build the dev_kernel_grub.img
http://www.osdev.org/osfaq2/index.php/Working%20with%20Disk%20Images
I am using vmware, in which fedora 5 (2.6.16.1) installed,
i have put the kernel.bin file accompanied with that tutorial into fedora /boot folder, but it doesn't work.
i think it should work. even the kernel.bin made by myself didn't work either.
Re:will 0xb8000 work with the bare GRUB loader?
Hi,
For example, edit the file "/boot/grub/grub.conf" and then do "grub-install [options] <install_device>", where file names may be different for Fedora (these are correct for Gentoo), and options and install_device depend on what you want - just type "grub-install" for help (but you could probably use "grub-install /dev/hda" if that's where GRUB is installed).
Cheers,
Brendan
You would also need to change GRUB's configuration file and reinstall GRUB.asmboozer wrote:hi, can i simply add the kernel.bin into /boot folder?
I am using vmware, in which fedora 5 (2.6.16.1) installed,
i have put the kernel.bin file accompanied with that tutorial into fedora /boot folder, but it doesn't work.
i think it should work. even the kernel.bin made by myself didn't work either.
For example, edit the file "/boot/grub/grub.conf" and then do "grub-install [options] <install_device>", where file names may be different for Fedora (these are correct for Gentoo), and options and install_device depend on what you want - just type "grub-install" for help (but you could probably use "grub-install /dev/hda" if that's where GRUB is installed).
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re:will 0xb8000 work with the bare GRUB loader?
first i Installed Win XP on hard disk, then vmware installed, fedora installed in vmware. now kernel of the Fedora 5 is of 2.6.16.1, i also noted there is folder /boot/grub/, but I always changes the grub.conf file in /etc/ folder, in which i added the newer kernel. such asBrendan wrote: Hi,
You would also need to change GRUB's configuration file and reinstall GRUB.asmboozer wrote:hi, can i simply add the kernel.bin into /boot folder?
I am using vmware, in which fedora 5 (2.6.16.1) installed,
i have put the kernel.bin file accompanied with that tutorial into fedora /boot folder, but it doesn't work.
i think it should work. even the kernel.bin made by myself didn't work either.
For example, edit the file "/boot/grub/grub.conf" and then do "grub-install [options] <install_device>", where file names may be different for Fedora (these are correct for Gentoo), and options and install_device depend on what you want - just type "grub-install" for help (but you could probably use "grub-install /dev/hda" if that's where GRUB is installed).
Cheers,
Brendan
title FeDora Core (2.6.16.1)
root (hd0,0)
kernel /vmlinuz-2.6.16.1 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.16.1.img
title Fedora Core (2.6.15-1.2054_FC5)
root (hd0,0)
kernel /vmlinuz-2.6.15-1.2054_FC5 ro root=/dev/VolGroup00/LogVol00 rhgb
quiet
initrd /initrd-2.6.15-1.2054_FC5.img
i setup the kernel.bin as
title BaumannKern
root(hd0,0)
kernel /bkern ro root=/dev/VolGroup00/LogVol00 rhgb quiet
but it won't work.
I do the test in vmware OS (fedora 5)
Re:will 0xb8000 work with the bare GRUB loader?
Hi,
Did GRUB give any error messages (either during re-installation or during boot)?
Also, does your kernel handle parameters? You could probably just use "kernel /bkern".
Lastly, try hitting "escape" at GRUB's boot menu and typing it into GRUB's command line manually. You should be able to type this (IIRC):
root(hd0,0)
kernel /bkern
boot
That way you should see exactly what the error was, and at which step it occured....
Cheers,
Brendan
Did you copy the "kernel.bin" to "/boot/bkern" (or where the linux boot images are - it depends how you setup the partitions), and did you run "grub-install"?asmboozer wrote:i setup the kernel.bin as
title BaumannKern
root(hd0,0)
kernel /bkern ro root=/dev/VolGroup00/LogVol00 rhgb quiet
but it won't work.
Did GRUB give any error messages (either during re-installation or during boot)?
Also, does your kernel handle parameters? You could probably just use "kernel /bkern".
Lastly, try hitting "escape" at GRUB's boot menu and typing it into GRUB's command line manually. You should be able to type this (IIRC):
root(hd0,0)
kernel /bkern
boot
That way you should see exactly what the error was, and at which step it occured....
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re:will 0xb8000 work with the bare GRUB loader?
yes , I did copy kernel.bin to /boot/bkern, and I see the menu item in Grub Box,Did you copy the "kernel.bin" to "/boot/bkern" (or where the linux boot images are - it depends how you setup the partitions), and did you run "grub-install"?
i compiled & linked as the tutorial instructed. only add *(.rodata*) after *(.text), if not the kernel would be
-rwxr-xr-x 1 root root 1056768 04-16 12:16 kernel.bin,
if*(.rodata*) added, the kernel would be
-rwxr-xr-x 1 root root 8192 04-16 12:19 kernel.bin
the kernel comprised of the files start.asm, main.c scrn.c gdt.c of the tutorial. not all of that tutorial.
the original kernel.bin of the tutorial would be 12kb of size.
my kernel won't work, the tutorial's kernel does [shadow=red,left]WORK[/shadow]
no , I did not run grub install, as I update the kernel, I don't need install grub again, so I don't.
no error message.Did GRUB give any error messages (either during re-installation or during boot)?
the tutorial's kernel only prints hello world( I only followed the first several chapters of that tutorial ).
but nothing prints out,
same as jmp $ after enter into pmode.
no parametersAlso, does your kernel handle parameters? You could probably just use "kernel /bkern".
the main() prototype is void main()