Page 1 of 1

Considering changing to linux and viewing kernel sources

Posted: Mon Nov 26, 2007 2:38 pm
by maverick777
Hiya, after going through a few practical guides , its given me insight into areas I need to improve. I actually have been reading for much of today , where the theory Ive come across is consise I seem to be understanding it. Anyway I am thinking I should setup linux , goto some kernel sources site and try and find a basic kernel with minimal io drivers and a shell at most , and one that has all the parts of the kernel documented. Im thinking if I can follow coherent documentation plus actually delve into the sourcecode of good coders I can see how things are done in basic systems. I feel I will be in a better position to mess with source code in linux and learn than from source related to windows.

The first thing I will be doing is James'es tutorial from this site, on gentoo.(I said this before but after reading quite a bit today Im set to do some other guides on this site + what I mentioned above)

Im just wandering if people think I will be in a better position to learn going the linux route and if the idea of looking at kernel sources and how the layers are built to make a minimal OS is a realistic route to go? Finally are there generally more OS development docs that are more in abundance in relation to linux ? (Im hoping linux related kernel sites are going to have maybe some guides of use to people starting out)

Thanks again
David

Posted: Mon Nov 26, 2007 3:21 pm
by Dandee Yuyo
I'm not sure if it's a good way to go. Maybe it's too way complex to 'reverse engineer'. Did you try Skelix tutorials?

http://en.skelix.org/skelixos/

There's some good stuff in it. The multitasking is wrong dough. :shock:

Posted: Mon Nov 26, 2007 3:55 pm
by maverick777
Thanks for the reply :-) , yeah I am thinking the same actually in regards to complexity , that tutorial link you sent me looks good , I have had a look at quite a few now but didn't know about that one. Im going to put linux on a partition atm as some of the guides are written using linux, I know I could use cgywin but I dunno using GCC just makes me think Im as well using linux :-)

Im actually trying to read as much about descriptors as possible atm, and am currently trying to make sure I understand the IDT and TSS now. You have probably seen this site but Im posting it for any that hasnt as its good reading in parallel with the practical guides.

cheers for replying :-) cant wait to try those guides you linked but for now I will get installing gentoo and give the brain some rest hehe
There's some good stuff in it.
Yeah seems that way ty :-)

Posted: Mon Nov 26, 2007 7:25 pm
by Dandee Yuyo
You have probably seen this site but Im posting it for any that hasnt as its good reading in parallel with the practical guides.
Which one? :?

Posted: Tue Nov 27, 2007 8:42 am
by maverick777
lol silly me :-)

Ok heres the links:

Some theory on descriptors etc

JamesMs guide

This ones well known^^ so Im almost certain you will have, and of course the ones on the wiki like the brokenthorn guide but thinking back it was the first link I was refering to, the theory on descriptors one but all the mentioned ones are good :-)

Posted: Tue Nov 27, 2007 7:16 pm
by Dandee Yuyo
Thanks! Added to favorites... \:D/

Posted: Thu Nov 29, 2007 8:36 am
by maverick777
Ahh Im glad they are some use to you :-) I figured you would have them all, actually Im going to post all the links Ive come across so yyourself and anyone else who hasnt got any can add them to there collection, In fact this thread subject is misleading so Im going to create a new thread called submit your links and people can add their person links that they use for educating themselves in OS dev, I realise we have the wiki but I think one thread with heaps of os dev links would be really useful. Maybe even something the admins may want to consider in future(A pure and simple thread of links)

Posted: Sun Dec 02, 2007 1:41 pm
by elfenix
The linux kernel isn't all that bad in terms of understandability. It's also a good case study for how a 'real' kernel works. That said, the documentation isn't all that good unless you obtain a book.

The main problem is that there is a _LOT_ of work you need to do before you can get to the point of programming that the linux kernel makes easy - setting up interrupts, descriptors, moving to protected mode, etc.... As linux is established, they can use all sorts of data structures and functionality that you won't have implemented yet to do that.

As an example, a hardware interrupt handler will often schedule work on a work queue and then return. The scheduled work is then run by a thread, which was switched in by the scheduler. All of that setup is easy for the module author, but that simple routine required -

a working scheduler,
a working queue structure,
a working queue thread,
working memory management,
working interrupts to implement the above,
etc...

So, in order to structure things like the linux kernel, would require you to get a lot of stuff working together, at once, simultaneously. So, you might want to see it as a case study on how to structure things - allowing you to structure your own kernel in such a way that it can mature into something well designed. Trying to use it to figure out something like, "how do I enable interrupts", could be extremely frustrating.

Posted: Mon Dec 03, 2007 1:54 pm
by maverick777
Yeah I hear ya :-) , currently I have just finished getting gentoo setup, finally got round some bugs and have 2 stable systems dual booted for flexability doing guides, I have also just bought the developing your own 32 bit OS book , the guy that writes that book done memmory management in a more simplistic way but I am going to try and write my memmory manangement myself as much as possible after going through more theory and guides, I also have a spare HDD but Im a fair way off attempting to put my OS on my IDE HDD. I remember seeing on here that some people didnt like that book but it has heaps of C code which Im hoping is going to be off use when I start IO drivers since Ive found certain IO info on the web to be lacking.

Im am not afraid to admit that the linux kernel would be alot to comprehend at this stage, I have actually read some open uni books that are have lots of theory on threads , semaphores and such things but I wont be looking much into the linux kernel until I have a decent enough structure in my OS where I am able to immplement the most basic forms of threads --- so the kernel idea is very long term and for use when I have mananged to get some layer of my OS working and I want to see how that layer is done properly(Without concise docs as you have said though it is going to no doubt be extremely difficult and frustrating) Im probably going to buy some more books in the next few weeks -- I want the indespensable PC hardware book, latest one but its very expensive , what do you think the next book I should buy, should be? Is the PCHW book really that good? (Reason I ask is im considering it)
a working scheduler,
a working queue structure,
a working queue thread,
working memory management,
working interrupts to implement the above,
etc...
Yeah :-) I have got heaps(ahh no pun intended sticking with stacks initially lol) to do! Actually should have progressed more but got sidetracked getting linux sorted up :-).

All I can do is give it my best shot and just keep buying books of relevance to any skills I lack.

Posted: Tue Dec 04, 2007 2:22 am
by elfenix
For books? I'm not really the person to ask on tech docs, most of what I have comes from vendors, and I only do x86 stuff when I have free time, which is, not often...

The wiki has what looks like good tech books.

If you aren't already well versed in semaphores, stack frames, elevators, scheduling, etc... you should really get a theory book. Probably first. You can find a lot online about hardware, but finding good resources on the net about architecture and theory is a lot more difficult. Another good theory set is the "Art of Programming", which includes most of your major algorithms.