Page 1 of 2
Kernel Development
Posted: Wed Sep 08, 2004 6:51 am
by Irshad Ahmad
Is there anyone willing to teach me kernel development in C language. I am a C programmer but I have never worked on kernel development. If anyone is willing kindly contact me as soon as possible. Also provide the source code of a minimum possible kernel and bootloader that can be used as a learning vehicle.
Thanks.
Re:Kernel Development
Posted: Wed Sep 08, 2004 7:08 am
by Pype.Clicker
Re:Kernel Development
Posted: Wed Sep 08, 2004 7:14 am
by kernel_journeyman
Hello Irshad,
You may like to look at the early versions of Linux, such as version 1.0. It is quite readable. Head over to
http://www.kernel.org/pub/linux/kernel/ and take a look around. You will see the different versions, etc. Go for v1.0 and get linux-1.0.tar.bz2. It's only a megabyte. If you're on Windows using Winzip, get linux-1.0.tar.gz instead. Winzip will be able to handle it.
Good luck!
Re:Kernel Development
Posted: Wed Sep 08, 2004 1:09 pm
by Schol-R-LEA
You might want to look into both
Minix and
Nachos, both of which are operating systems specifically designed for study. Both are relatively conventional Unix-like operating systems, though NACHOS is writtn in a subset of C++ rather than in C.
Perhaps I should start working on
LoIS again... I haven't done anything with it for quite while now, as I'd decided it wasn't worth the troulbe, but it sounds like it could be of use after all.
OTOH, part of the point of LoIS is to explain bootloaders enough so that a new programmer could understand them without writing one from scratch. While writing a bootloader is a good coding excercise, it's not necessarily the best place to begin an OS project. If your goal is to write a kernel in C, and you don't want or need to hone your assembly coding, GRUB is a much better starting point.
Re:Kernel Development
Posted: Wed Sep 08, 2004 11:57 pm
by Dreamsmith
Schol-R-LEA wrote:While writing a bootloader is a good coding excercise, it's not necessarily the best place to begin an OS project.
I have to laugh, because you're entirely right, and yet, isn't that pretty much what most of us here did? First thing I did was write a bootloader, only to throw it away soon after.
So if you want to tread down the well beaten path OS coders traditionally follow, waste time writing a bootloader so you can throw it away.
See, the thing is, it's an easy first step and leads to a wonderful sense of accomplishment. To be able to, fairly early on in your development process, bring a machine from power up to doing something you wanted it to do, without an OS between you and the hardware. No Windows, no Linux, no DOS, just straight from power on into your code, doing whatever you want it to -- it's an emotional boost (read: ego trip) that'll get you through some later problems.
So, it's ultimately a waste of time, but I don't regret having done it rather than just using GRUB from the very beginning, and I'm hesitant to suggest skipping this step. It's not hard enough to be completely discouraging, and not easy enough to be completely boring. In short, it's a fun place to start. I'd recommend starting with it, even if you end up throwing it all away later. It'll be the seed that gets you working on the full OS, to be kicked away when it's no longer needed. Simply put, it'll bootstrap your OS. ;D
Re:Kernel Development
Posted: Thu Sep 09, 2004 3:13 am
by Schol-R-LEA
You know, that has got to be the best argument in favor of writing a bootloader I've read to date.
Re:Kernel Development
Posted: Thu Sep 09, 2004 6:18 pm
by mystran
I agree with Schol-R-LEA.
Re:Kernel Development
Posted: Fri Sep 10, 2004 1:28 am
by Irshad Ahmad
Thanks to all the people around who have really spent their precious time to reply to me.
Thanks once again and stay in touch.
Re:Kernel Development
Posted: Fri Sep 10, 2004 3:22 am
by Irshad Ahmad
Dreamsmith wrote:
Schol-R-LEA wrote:While writing a bootloader is a good coding excercise, it's not necessarily the best place to begin an OS project.
I have to laugh, because you're entirely right, and yet, isn't that pretty much what most of us here did? First thing I did was write a bootloader, only to throw it away soon after.
So if you want to tread down the well beaten path OS coders traditionally follow, waste time writing a bootloader so you can throw it away.
See, the thing is, it's an easy first step and leads to a wonderful sense of accomplishment. To be able to, fairly early on in your development process, bring a machine from power up to doing something you wanted it to do, without an OS between you and the hardware. No Windows, no Linux, no DOS, just straight from power on into your code, doing whatever you want it to -- it's an emotional boost (read: ego trip) that'll get you through some later problems.
So, it's ultimately a waste of time, but I don't regret having done it rather than just using GRUB from the very beginning, and I'm hesitant to suggest skipping this step. It's not hard enough to be completely discouraging, and not easy enough to be completely boring. In short, it's a fun place to start. I'd recommend starting with it, even if you end up throwing it all away later. It'll be the seed that gets you working on the full OS, to be kicked away when it's no longer needed. Simply put, it'll bootstrap your OS. ;D
As you have said that you had developed a bootloader. May I have the source code as well as the bootloader itself?
Re:Kernel Development
Posted: Fri Sep 10, 2004 4:20 am
by Solar
Irshad Ahmad wrote:
May I have the source code as well as the bootloader itself?
Unless you are interested in Dreamsmith's bootloader for personal reasons, well, GRUB is Open Source (at
http://www.gnu.org/software/grub/), and rather feature-rich.
Re:Kernel Development
Posted: Sat Sep 11, 2004 12:27 am
by Dreamsmith
Irshad Ahmad wrote:As you have said that you had developed a bootloader. May I have the source code as well as the bootloader itself?
I guarentee you'd much rather have the source code from about a hundred other bootloaders you can download from the web, unless you really really want to base your OS around my old filesystem code (my bootloader loaded the "blessed" file from a ZR/FS partition -- you'd never even get your kernel loaded onto a ZR/FS partition without a lot of funky utilities, which I haven't kept up to date since I long ago switched to using ext2).
Re:Kernel Development
Posted: Sat Sep 11, 2004 3:34 am
by Irshad
Thanks to all the friends for their kind helpfulness.
May I have some more web addresses of sites offering source of bootloaders and operating systems.
Re:Kernel Development
Posted: Sat Sep 11, 2004 11:36 am
by bubach
Re:Kernel Development
Posted: Sat Sep 11, 2004 11:41 pm
by Schol-R-LEA
Well, if it helps ant, I can attach a copy of my demo boot loader and second stage. Note however that this isn't the best code in the world for this sort of thing; I wrote it to be understandable rather than efficient. Also, it is in something of an intermediate state, as a few months ago I made some changes (I had thought to try turning it into a FAT12 loader, but never got back to it). I have checked it, however, and it does assemble and run to spec. The code is written for NASM.
Of course, the odd condition of the code and the piecemeal way of I have worked on it just highlights one of the ironies of my career: I'm a rather diffident coder, and tend to drag my feet. Even though I have been studying OS design for over a decade, in terms of actual code I am far behind several of those I helped learn the basics. I tend to work in spurts, and all too often try to second-guess myself. Of literally dozens of coding projects of all sizes, I have completed only a handful of them (this same problem happens with my writing, especially with fiction). Even now, I ought to be working on an assembler I started (for a stack-based pseudomachine I wrote an interpreter for last weekend). I am about a third of the way through it, and finishing it should only take a few hours, but I can't seem to get down to it. Once I start coding, it usually flows nicely - for example, the interpreter was mostly coded in a single burst of energy last saturday, done entirely on a whim - but I can't just dive into something at will.
Is there a Muse of programming, and if so, where the hell is She, and what can I do to get on Her good side?
Re:Kernel Development
Posted: Sun Sep 12, 2004 12:28 am
by Candy
Schol-R-LEA wrote:
Well, if it helps ant, I can attach a copy of my demo boot loader and second stage. Note however that this isn't the best code in the world for this sort of thing; I wrote it to be understandable rather than efficient. Also, it is in something of an intermediate state, as a few months ago I made some changes (I had thought to try turning it into a FAT12 loader, but never got back to it). I have checked it, however, and it does assemble and run to spec. The code is written for NASM.
That's almost a queue for me. My boot loader, also written in nasm-ish code, in combination with C code (for the second stage) has a boot sector that loads the bootloader and kernel from floppy disk, in FAT12 format, and starts up the kernel in 32-bit mode with wiped windows, eh, memory.
Even though I have been studying OS design for over a decade, in terms of actual code I am far behind several of those I helped learn the basics. I tend to work in spurts, and all too often try to second-guess myself. Of literally dozens of coding projects of all sizes, I have completed only a handful of them (this same problem happens with my writing, especially with fiction). Even now, I ought to be working on an assembler I started (for a stack-based pseudomachine I wrote an interpreter for last weekend). I am about a third of the way through it, and finishing it should only take a few hours, but I can't seem to get down to it. Once I start coding, it usually flows nicely - for example, the interpreter was mostly coded in a single burst of energy last saturday, done entirely on a whim - but I can't just dive into something at will.
I think I suffered from the same problem. My problem was that I usually halfway through the previous program got such a good idea that I started working on that one instead. My solution to that is to first finish this one thing, and then to carry on. For programs I do it in phases, where I tell myself that I first have to complete that phase of the program before I can go on to a next one.
That being said, I also have loads of open projects needing a little work to be a lot more useful. These include my website (yes, I'm well aware of it, even asked mpp.eox3 for some help, should be getting that going within a few weeks), my lexical analyser generator that spits out 100% C++ code (which has all, but an NFA->DFA converter), for which I 100% understand the algorithm but just didn't put it in yet, and my OS of course. It needs a lot of work on the new boot loader before I can speak of a functional 0.0.3, and by that time I'll have enough usermode/glue code to call it 0.0.4 instantly. As for me not appearing to do anything, the diff between the previous version and this one is bigger than the entire previous version. In working state that is.
Is there a Muse of programming, and if so, where the hell is She, and what can I do to get on Her good side?
My Muse is in Mexico at the moment, waiting for her to return... It truly isn't fun programming when she is gone :S... Having her around just gives me the energy to code anything... You might experience similar results, but I'd like to keep her to myself