C++ 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
Jankins

C++ Kernel

Post by Jankins »

I was just wondering with a C++ kernel to get it to Display Some words e.g.

"Welcome To MyOs"

Would u use cout<<"Welcome To MyOs";

or Something else?
and when I type

ld kernel.o -o kernel.bin -oformat binary -Ttext 0x100000

It comes up with a error saying No Such Dirrectory (I am using linux) is there a different way to link kernel.o?

And Could some one plz type a baisc VERY VERY basic OS in like a template to work on, with nothing in it but Hello world sorta thing, if not don't worrie about it.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:C++ Kernel

Post by Solar »

Jankins wrote: Would u use cout<<"Welcome To MyOs";

or Something else?
cout - just like printf() - is part of the standard library. When writing a new kernel, you do not have a standard library at your disposal, until you either implement one yourself or port an existing one to your kernel.

Also, both cout and printf() write to standard output - which is set up by the C runtime environment. Your kernel, however, is not started by a C runtime, so you do not have a standard output.

The traditional way is to implement a scaled-down kprintf() (or kout) which can do basic output by writing directly to video memory.
And Could some one plz type a baisc VERY VERY basic OS in like a template to work on, with nothing in it but Hello world sorta thing, if not don't worrie about it.
Find attached a very early implementation of my own "testing" kernel. It might actually not compile correctly, as this is a snapshot of my working directory instead of a repository snapshot - I'm in the midst of a reinstallation of my machine.

It requires GRUB to boot the kernel, and does nothing but printing some data from the GRUB multiboot header to screen.

[attachment deleted by admin]
Every good solution is obvious once you've found it.
Post Reply