Kernel will not boot

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.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

AusZero wrote:Yes I have read getting started, but I don't know much about stacks.
There is an OSDev wiki for a reason... not to mention the official Wikipedia.

http://www.osdev.org/wiki/Stack
http://en.wikipedia.org/wiki/Stack_%28data_structure%29

Seriously, having some programming experience before embarking on the "OSDev" journey is just a "Good Idea(TM)".
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
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:

Post by Combuster »

AusZero wrote:Yes I have read getting started, but I don't know much about stacks.
Can you guess why the link I gave you pointed directly to the required knowledge section? :roll:
"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 ]
Pixion
Posts: 16
Joined: Thu Oct 25, 2007 8:18 pm

Post by Pixion »

Well,

IMHO I don't think this was too helpfull for AusZero...

What would help if he could post the errors he got during linking or loading.

As Pyrofan mentioned, you need to have a stack defined somewhere for your kernel to operate as for every call or interrupt it will store appropriate register information 'on the stack'. Here is how in Bran's tutorial he defined it in his main asm:

Code: Select all

; Here is the definition of our BSS section. Right now, we'll use
; it just to store the stack. Remember that a stack actually grows
; downwards, so we declare the size of the data before declaring
; the identifier '_sys_stack'
SECTION .bss
    resb 8192               ; This reserves 8KBytes of memory here
_sys_stack:
And here Bran's accompanying ld script refering to the stack section bss:

Code: Select all

OUTPUT_FORMAT("binary")
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
  .text phys : AT(phys) {
    code = .;
    *(.text)
    . = ALIGN(4096);
  }
  .data : AT(phys + (data - code))
  {
    data = .;
    *(.data)
    . = ALIGN(4096);
  }
  .bss : AT(phys + (bss - code))
  {
    bss = .;
    *(.bss)
    . = ALIGN(4096);
  }
  end = .;
}
If you are following another tutorial, something similar needs to be defined...
meh
Member
Member
Posts: 52
Joined: Sun Oct 21, 2007 4:30 pm

Post by meh »

I may just forget about making an operating system temporarily.
Pixion
Posts: 16
Joined: Thu Oct 25, 2007 8:18 pm

Post by Pixion »

Sure!

Never try, never succeed!
rv6502
Posts: 19
Joined: Fri Nov 02, 2007 8:28 pm

Post by rv6502 »

AusZero wrote:I may just forget about making an operating system temporarily.
AusZero wrote:Yes I have read getting started, but I don't know much about stacks.
/me bang head on wall ....

don't give up,
but you're trying to do a triple-jump-backflip-summer-sault when you're just starting to walk.

you need to learn more basic system programming skills before jumping into the whole blown OS thing.
learn some more assembly and how to interface assembly and a high-level language for starters, how compilers/assembler/linkers work, how other OSes work, lots of ressources on osdev.org and on the web in general.

not that you need much assembly to write an OS, but you will need *SOME* to make it work and a lot of assembly knowledge to debug things when they crash.

try making some old DOS games first, vga, then vesa, then with sound (irqs) then with dos extenders, then with your own dos extender, then you'll almost have the base for a kernel.
iammisc
Member
Member
Posts: 269
Joined: Thu Nov 09, 2006 6:23 pm

Post by iammisc »

Don't give up on operating system development. You can't just jump into it without knowing about low-level computer languages. Try learning C and using it to make userspace apps and then, when you know C inside out, learn assembly language for the processor you're using and when you know that pretty well, *then* write your operating system.

Just think of the preparation as part of writing the actual operating system.


Hope to see you soon(well not too soon as it might not be enough time to learn C inside out).
meh
Member
Member
Posts: 52
Joined: Sun Oct 21, 2007 4:30 pm

Post by meh »

I know C++, will that do?
Pixion
Posts: 16
Joined: Thu Oct 25, 2007 8:18 pm

Post by Pixion »

C++ will do, as it is a superset of C.

However, I you want to get going, why not start by doing some of the many tutorials around?

-OSDev Wiki: Babysteps
-Bran's kernel
-etc.
meh
Member
Member
Posts: 52
Joined: Sun Oct 21, 2007 4:30 pm

Post by meh »

Do you think I should learn assembly a little bit more before trying the tutorials?
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

Hi,

My opinion of assembly is that you should at least be able to read through the source. Know things like what registers are available, what each register is used for and so on. The freely available Intel Manuals will help with that.

One of the pitfalls of learning applications programming (and something that took some getting around for me initially) is that you may think you are using an integral part of your chosen programming language, but you are actually using functionality which is provided by the OS or library author.

Take C++. Here you have useful tools such as try...catch. You can forget about that in system programming until you have actually written the necessary support (something which is a long way off for my OS). Same with RTTI. And New. And Delete. And Global/Static objects (granted, these are fairly easy to add support for)...oh - and you cant #include any header files you have not written / verified yourself. So if you are doing applications programming, remember that when you switch to systems programming you will have vastly reduced functionality to begin with.

My suggestion to you, is write a 'Hello World' boot loader so you get a feel for how the PC boots (and how stacks work :wink: ). When you are comfortable with all that, by all means switch to using GRUB and start using a higher level language. I really hope none of this puts you off, but hopefully it will prepare you more for the challenge.

Oh - and for some nice boot loader tutorials, try http://www.osdever.net/ .

Cheers,
Adam
meh
Member
Member
Posts: 52
Joined: Sun Oct 21, 2007 4:30 pm

Post by meh »

Thank you all for your help.
User avatar
JAAman
Member
Member
Posts: 879
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Post by JAAman »

if you need a copy of the intel manuals, they can be downloaded or (preferably) ordered at the link in my signature
Post Reply