how can I write 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
Tanzadeh
Posts: 3
Joined: Tue Aug 26, 2014 3:18 pm

how can I write Kernel?

Post by Tanzadeh »

can I use C# or java for write kernel if I can't how can I use C.
I have one C program can I boot it with grub

Code: Select all

#include <stdio.h>
int main(){
printf("Welcome to IROS");
char *a;
for(;;){
gets(a);
printf("text typed:");
puts(a);
}
}
what about golang can I make Kernel with golang

if my sentences are bad Excuse me I'm not very good in English my Language is persian. and I'm just 13.
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: how can I write Kernel?

Post by zhiayang »

http://forum.osdev.org/viewtopic.php?f=1&t=16944
Beginner Mistakes
Required Knowledge

This essentially a post saying
"how to osdev plz halp"


It appears [com]buster is online so I'll leave it to him if he bothers to leave a more eloquent reply.


I'll try and be at least a little accommodating.
1. People have written OSes in C# before. It is not easy.
2. People have written OSes in Java before. It is not easy.
3. I don't know if people have written OSes in Go before, but looking at (1) and (2), it is probably not easy.
4. Your C program doesn't even work properly.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: how can I write Kernel?

Post by Combuster »

Knowing English is one important thing you should try working on, and the other is to make it a habit for yourself to both look around (it's quite obvious you neglected the forum rules, or you didn't understand them) and to look things up before you ask a question.
Tanzadeh (corrected) wrote:Can I use C# or Java to write a kernel?
There's quite some literature on Languages. For most people, the answer to this question is basically "no".
if I can't, how can I use C?
See the Tutorials
If I have this C program, can I boot it with grub?
No, the reason being that you include stdio, which depends on an existing OS's features.
What about Golang? Can I write a Kernel using golang
See your first question. It's likely more difficult than C, but much easier than bytecode languages.
My apologies for any writing errors. I'm not very good at English, My first Language is Persian, and I'm only 13 years old.
It's far from hopeless, but I fixed it for you anyway. :wink:
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Tanzadeh
Posts: 3
Joined: Tue Aug 26, 2014 3:18 pm

Re: how can I write Kernel?

Post by Tanzadeh »

Combuster wrote:Knowing English is one important thing you should try working on, and the other is to make it a habit for yourself to both look around (it's quite obvious you neglected the forum rules, or you didn't understand them) and to look things up before you ask a question.
Tanzadeh (corrected) wrote:Can I use C# or Java to write a kernel?
There's quite some literature on Languages. For most people, the answer to this question is basically "no".
if I can't, how can I use C?
See the Tutorials
If I have this C program, can I boot it with grub?
No, the reason being that you include stdio, which depends on an existing OS's features.
What about Golang? Can I write a Kernel using golang
See your first question. It's likely more difficult than C, but much easier than bytecode languages.
My apologies for any writing errors. I'm not very good at English, My first Language is Persian, and I'm only 13 years old.
It's far from hopeless, but I fixed it for you anyway. :wink:
Tank's for help
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: how can I write Kernel?

Post by SpyderTL »

Tanzadeh wrote:Tank's for help
Thanks for the help. :)
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: how can I write Kernel?

Post by SpyderTL »

Tanzadeh wrote:can I use C# or java for write kernel.
As requimrar said, the answer is "no". You cannot write a kernel in C# or Java, and run them on real hardware. But what you can do with C# and/or Java is write a Compiler.

Once you've done that, then you will be able to use any language you want -- C#, Java, or even make up your own language. This is essentially the approach that I took. I wrote a simple Compiler in C# that reads XML files and writes out byte code that can be copied to a CD and run on real hardware.

There are several other projects on this site that have taken a similar approach. You may want to take a look at jEmbryOS, which has a Java compiler and a Java runtime, which are both written in Java.

Of course, writing a compiler requires a lot of time and effort before you can even start working on your kernel, so you will need to decide whether it is worth the extra effort, or if it would just be easier to learn Assembly and C.

If you want to see how I'm compiling XML using C#, my code is available at http://ozone.codeplex.com.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Post Reply