Writing a Kernel ???

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
TheDeciever

Writing a Kernel ???

Post by TheDeciever »

  
  I have already written a kernel in assembly and I was wondering whether I should write it in C rather that assmebly, but I am not really sure so If you have any suggestions as to how my kernel should be developed that would be great. thx
hartyl

RE:Writing a Kernel ???

Post by hartyl »

hi there,
i was also in the same situation about a week ago. in the assembly-version i was about to write the gui. as i noticed that it's so difficult to write the gui in assembly i decided to port to c.
the c-core is not so far complete but i think it's a better solution, although it's really difficult to set everything up. i'm using gcc and jloc as linker. the assembly-part is in fasm outputting in coff. in the beginning you have to check the output of your linker if all adresses are correct (especially: paging!)
so, stay & try hard until you get it; in the end it will be easier, i think.

greets, hartyl
Gnome

RE:Writing a Kernel ???

Post by Gnome »

The choice whether to write in C or Assembly (or any other languages, for that matter) is largely a personal preference. No matter what language you use, for OS development you will *always* need to have some assembly smattered around to access the hardware, so you can't escape it.

Generally, I would suggest using C for the large parts of your kernel, except sensitive parts where you absolutely must know exactly what the processor is doing, or for code that directly accesses hardware. If you have lots of skill/patience/time, assembly will usually yield tighter, more efficent, faster and smaller code, but at the expense of development time and your sanity :)

From the sounds of it (and I mean it in the nicest way possible -- we've all been there, I say that just now I'm escaping that stage), you are a newbie to OS development. If that is the case, I would definately recommend switching to C as early as possible.

My OS is almost entirely written in C. It's compiled to an ELF image that is bootable from GRUB. If I get the desire, I might wean the code off dependency on GRUB, but for the time being this setup works very well for me. I don't have to worry about bugs in the bootloader when debugging my code (I assume that GRUB is bug-free, which I think is a fairly safe assumption). That really helps development go quick at the start of the process.

One further suggestion: don't worry about a GUI for now. Yes, it's eye-candy. Yes, it's something people outside those that frequent this site will be interested in, but testing out the kernel functions from within a GUI causes all sorts of headaches. I don't plan on adding in support for a GUI for quite some time, at least until I have memory paging, a protected runtime, and loadable binary support (aka, executable "files", although my OS has no concept of files, but that's a whole other issue). That also implies that I'll have IDE support and a filesystem (although that's probably not a good name for it since it doesn't store files).

Good luck and happy coding.
graphics in pm

RE:Writing a Kernel ???

Post by graphics in pm »

it is possible to do everything is asm
User avatar
bubach
Member
Member
Posts: 1224
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

RE:Writing a Kernel ???

Post by bubach »

Of course! ASM gives you the RAW POWER of your PC = ASM RULEZ!!  :-)

/ Christoffer
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
ASHLEY4

RE:Writing a Kernel ???

Post by ASHLEY4 »

Hi
Have you not seen MenuetOs, this is writen in full ASM and has a very good GUI.
Get your hands dirty and do it all in ASM.
ASHLEY4
Post Reply