Page 1 of 2
How to create a basic operating system?
Posted: Thu Oct 07, 2010 10:50 pm
by rsmahanti
I got a project to create a basic operating system which will just boot up and can run a calculator in it. I have 28 days to complete the project. I have absolute no idea about how to do it? What I know is basic C programming. Can anybody give me any idea to start with? Any sample piece of code or anything which can help me. Please don't advise me t read a thousand page book. Neither I have money to purchase a book nor I have time to read 1000 page ebook. I want to know
1) What is required to boot up a system? How much code I have to do?
2)Is it possible to run a calculator on a very basic operating system? If possible, how?
3)Can I run his type of OS in vmware? If no, what Extra I have to do to run it in vmware?
4)Is it really possible to do it in 28 days?
The hardware I am going to use is typical pc hardware we use for windows or linux machine.
Re: How to create a basic operating system?
Posted: Thu Oct 07, 2010 10:58 pm
by thepowersgang
May I point you to the wiki.
1. See the barebones tutorials on the wiki.
2. Yes, I'll leave the implementation up to you.
3. Yes, VMWare is exceptionally similar to a real PC (the higher level video interface is a little different to actual hardware, but basic OSs generally don't care about that)
4. It's doable, but it may be tight. It depends on how well you understand things.
Re: How to create a basic operating system?
Posted: Thu Oct 07, 2010 11:09 pm
by rsmahanti
@thepowersgang : Thanks. I will read the wiki. Let's see how much I can understand.
Re: How to create a basic operating system?
Posted: Thu Oct 07, 2010 11:25 pm
by rsmahanti
Can somebody explain the overall procedure for me once? Like to boot up an operating system, I have to code for grub and kernel and what else? If I don't have to code for grub then what I have to do?
Re: How to create a basic operating system?
Posted: Fri Oct 08, 2010 1:02 am
by piranha
Grub boots kernel.
Kernel initializes itself, loading GDT, IDT, interrupt systems, etc.
Kernel starts a keyboard driver.
Kernel runs a calculator program, which you can implement directly in the kernel.
Program yourself a basic kernel that says hello world (see the barebones on the wiki).
Program yourself the GDT and the IDT and etc interrupt stuff (see the wiki [interrupts, gdt, idt, isrs, keyboard]).
Get the keyboard input working (see wiki [keyboard]).
And then write a calculator.
Its doable in 28 days, providing that you are motivated enough to try. If you cannot find the information in the wiki that details the process, you don't have much hope of doing this in 28 days. However, it is doable, but since we don't know the extent of your programming skills we can't give a good estimate on how feasible it is.
Good luck,
-JL
Re: How to create a basic operating system?
Posted: Fri Oct 08, 2010 2:01 am
by JamesM
Hi,
rsmahanti wrote:I got a project to create a basic operating system which will just boot up and can run a calculator in it. I have 28 days to complete the project. I have absolute no idea about how to do it? What I know is basic C programming. Can anybody give me any idea to start with? Any sample piece of code or anything which can help me. Please don't advise me t read a thousand page book. Neither I have money to purchase a book nor I have time to read 1000 page ebook. I want to know
1) What is required to boot up a system? How much code I have to do?
2)Is it possible to run a calculator on a very basic operating system? If possible, how?
3)Can I run his type of OS in vmware? If no, what Extra I have to do to run it in vmware?
4)Is it really possible to do it in 28 days?
The hardware I am going to use is typical pc hardware we use for windows or linux machine.
Here's a bit of a shameless plug:
http://www.jamesmolloy.co.uk/tutorial_html. I wrote some tutorials several years back that should talk you through much of what you want to do. You shouldn't need paging or anything like that for a simple calculator - just a C program writing to the screen, taking interrupts will do. See up to section 5.
Remember that if this is an assignment, be VERY careful not to plagarise works found on the internet. I don't really mind if you take my code verbatim, as long as the copyright is maintained, but I'm sure your lecturers will take a rather less bright view of you not doing your own work!
Read the tutorials by all means, but I wouldn't submit a carbon-copy of the resulting code.
James
Re: How to create a basic operating system?
Posted: Fri Oct 08, 2010 3:05 am
by qw
Re: How to create a basic operating system?
Posted: Sat Oct 09, 2010 8:54 am
by Gaidheal
I have very little to add, just echoing what others have said, really; if you can get a very simple kernel written, use GRUB to load it and start it and then a simple calculator application (your course may expect its implementation to be separate from your kernel, read it to be sure), you'll be done, by the sounds of it.
The code for a calculator is not especially challenging, GRUB is pretty well documented, so the real challenge is writing a basic kernel; in this regard James's excellent tutorial should help you well along the way, in concert with the Wiki to get the theoretical understanding. As James said, though, be careful you don't simply copy-paste other people's code as every university worth its salt is going to notice and call plagiarism on it.
We're not really here to do your homework for you, basically, but most of us will be more than happy to help you gain understanding of the concepts and a working implementation. :¬)
Re: How to create a basic operating system?
Posted: Sun Oct 17, 2010 2:37 pm
by Casm
It sounds as if the calculator might be your kernel. You don't say how sophisticated the calculator will need to be, but it will probably be enough if you can grab input from the keyboard and write output to the screen. If you stay in real mode you could use the BIOS services for that.
Your main challenge would be to write some assembly language routines to replace standard C functions like getch(), or putc(), which won't be available unless you write them yourself.
The other thing you would need to do is write a boot sector which can san through a FAT16 directory, find you calculator program, and load it. Of course, unlike a normal calculator program, this one won't terminate until your turn off the computer. It will just go round an infinite loop, getting input, doing a calculation, displaying the output, and then waiting for some more input.
If you have only got 28 days to do it, I doubt if your instructor is looking for anything much more sophisticated than that.
Re: How to create a basic operating system?
Posted: Wed Oct 20, 2010 8:32 am
by rsmahanti
Thanks everybody for help. I will create the os in next ten 10 days and submit the code here. except bootloader, I am not going to use single piece of code written by someone else. Thanks again for everything.
Re: How to create a basic operating system?
Posted: Wed Oct 20, 2010 9:06 am
by JamesM
rsmahanti wrote:Thanks everybody for help. I will create the os in next ten 10 days and submit the code here. except bootloader, I am not going to use single piece of code written by someone else. Thanks again for everything.
Why submit the code here?
Re: How to create a basic operating system?
Posted: Sun Oct 24, 2010 1:48 am
by Joshua50187
I would recommend sams teach yourself c++ in ten minutes (i believe that is the title) for the calculator and if its just a bet/never will ever be published under your name anywhere as your original work. then do some basic dev tutorials that give boot sector/kernel and then have it load up the program
Its not that easy and im not a expert on Os dev yet so if your just looking for a crap haha look what i can do moment then thats what i would recommend but you will feel more accomplished if you learn how to do it and then do your own code
Re: How to create a basic operating system?
Posted: Sun Oct 24, 2010 9:42 am
by gravaera
I would never recommend any book on C++ whose title followed the form: "Teach yourself C++ in X days". Talk less of one that advertises the same, but in minutes...
Re: How to create a basic operating system?
Posted: Sun Oct 24, 2010 10:07 am
by JamesM
gravaera wrote:I would never recommend any book on C++ whose title followed the form: "Teach yourself C++ in X days". Talk less of one that advertises the same, but in minutes...
Actually, C++ in 21 days by Sams is excellent. It's the book from which I learned.
Re: How to create a basic operating system?
Posted: Sun Oct 24, 2010 12:44 pm
by gravaera
^ I guess that thing I said above would be just me then? Old fashioned me with my Stroustrup, and large books with lots of small text