Setting up the development of your kernel
Posted: Fri Nov 07, 2008 12:48 am
Hi everyone,
As you may have already guessed, yes I'm wanting to get into hobby kernel development however I'm not liking the difficulty in getting to the stage of actually having an easily compilable and testable C kernel binary (even with just a simple main function .c file).
I've recently decided to scrap learning how to make a bootloader and use GRUB to load my kernel however a nudge in the right direction would be great right now.
I want to use Bochs (2.3.7) to test my kernel binary on and hope that I can come to a point where I can simply do a gcc/ld of my kernel code, run a bochs script and have GRUB auto load my kernel binary in long mode (as I intend to develop only a 64-bit protected mode kernel).
I have gotten a pre-made GRUB floppy image loading and can navigate the various screens and demos in the GRUB floppy (its got some demos like FreeDOS and GRUB Invaders).
Can anyone point out some clues as to what I'd need?
I understand I will need a cross-compiler version of gcc/ld etc as I'm having trouble with gcc on windows adding some extra crap to the object files (like __main and __alloca) whereas I want to simply compile flat generic C code.
Also, what configuration for GRUB in relation to the Bochs configuration would I need to have my boot floppy load my kernel binary off an emulated disk?
I'm probably asking a lot which I could probably find myself but haven't had much luck and merely setting up an kernel coding and emulation environment seems to be full of configuration files, compiling source code I have never compiled before and whatnot.
As much code as I've written and compiled all kinds of languages and programs before, all this linux style compiling of existing libraries and tools via command lines is a bit over my head as theres all kinds of linux related things I'm not up on given my Windows/Visual Studio background.
Once I can do a compile of my C code, run Bochs and 5 seconds later be running a simple main loop then its full steam ahead and I can actually focus on making my kernel instead of scratching my head with how the hell to just load the damn thing. Haha.
UPDATE*** Is Linux an easier environment to develop and test a kernel on (disregarding the actual kernel coding part)?
Thanks for your help.
As you may have already guessed, yes I'm wanting to get into hobby kernel development however I'm not liking the difficulty in getting to the stage of actually having an easily compilable and testable C kernel binary (even with just a simple main function .c file).
I've recently decided to scrap learning how to make a bootloader and use GRUB to load my kernel however a nudge in the right direction would be great right now.
I want to use Bochs (2.3.7) to test my kernel binary on and hope that I can come to a point where I can simply do a gcc/ld of my kernel code, run a bochs script and have GRUB auto load my kernel binary in long mode (as I intend to develop only a 64-bit protected mode kernel).
I have gotten a pre-made GRUB floppy image loading and can navigate the various screens and demos in the GRUB floppy (its got some demos like FreeDOS and GRUB Invaders).
Can anyone point out some clues as to what I'd need?
I understand I will need a cross-compiler version of gcc/ld etc as I'm having trouble with gcc on windows adding some extra crap to the object files (like __main and __alloca) whereas I want to simply compile flat generic C code.
Also, what configuration for GRUB in relation to the Bochs configuration would I need to have my boot floppy load my kernel binary off an emulated disk?
I'm probably asking a lot which I could probably find myself but haven't had much luck and merely setting up an kernel coding and emulation environment seems to be full of configuration files, compiling source code I have never compiled before and whatnot.
As much code as I've written and compiled all kinds of languages and programs before, all this linux style compiling of existing libraries and tools via command lines is a bit over my head as theres all kinds of linux related things I'm not up on given my Windows/Visual Studio background.
Once I can do a compile of my C code, run Bochs and 5 seconds later be running a simple main loop then its full steam ahead and I can actually focus on making my kernel instead of scratching my head with how the hell to just load the damn thing. Haha.
UPDATE*** Is Linux an easier environment to develop and test a kernel on (disregarding the actual kernel coding part)?
Thanks for your help.