PDA

View Full Version : Os



7cardcha
October 28th, 2011, 06:54 AM
How would you go about writing your own OS in C using the linux kernel. I know that an OS is mostly a kernel but still. Any ideas(I would write commands QUI etc. I have good knowledge of C/C++/Python
)

V for Vincent
October 28th, 2011, 07:25 AM
I'd start by checking out minix3.org. The original minix helped Linus get started, in any case.

7cardcha
October 28th, 2011, 09:58 PM
I want to take the linux kernel and write the rest of the OS tools(commands etc etc) and packaging software with it. How can I do this LFS is ok BUT THEY DON'T HAVE A GOOD GUIDE I am know C/C++
They only pre-written thing I want to use is the linux kernel. NOTHING MORE.

11jmb
October 28th, 2011, 10:06 PM
Ambitious :D

Perhaps you would consider making your own GNU/Linux flavor first. There is a lot of code that needs to be written to get an operating system working. One way to approach this would be starting with the kenrel, GNU base system, and a simple desktop, then start peeling back the layers once you get it working.

haqking
October 28th, 2011, 10:08 PM
http://www.linuxfromscratch.org/

and what is wrong with the guide http://www.linuxfromscratch.org/lfs/view/stable/

If you cant build a system from that using that guide, i highly doubt you will manage to build your own system

Liiiim
October 28th, 2011, 10:10 PM
Will you be writing your own C library, or are you counting that as part of the kernel (it's not, but writing your own C library would be an enormous undertaking).

If you just want to implement stuff like 'cd', 'echo', etc., take a look at the man pages - those should be all the "guides" you'll need.

lisati
October 28th, 2011, 10:26 PM
Threads merged.

7cardcha
October 28th, 2011, 10:36 PM
Ok Ill stop with LFS. Then come back when I am done with that.

MG&TL
October 28th, 2011, 10:44 PM
And the excellent MikeOS:

http://mikeos.berlios.de/

You might also want to learn how to write drivers for things in C/assembly. If your keyboard doesn't work on your OS, you're kinda screwed.

gsmanners
October 28th, 2011, 11:20 PM
You might also want to learn how to write drivers for things in C/assembly. If your keyboard doesn't work on your OS, you're kinda screwed.

This is why you do all that low level stuff in an emulator first, then build on top of your system once you have the OS and the toolchain installed.

MG&TL
October 28th, 2011, 11:36 PM
...sure. Sorry, my point was that if you can't code the keyboard, then making any further progress is difficult. Right?

And forgive my ignorance, but would not running in a VM throw some problems up when you migrate, as all the low-level memory management *was* dealt with by the host OS. ?

I got my limited knowledge from an outdated book about device drivers for UNIX, so I have a very limited idea what everyone is on about. I was just suggesting that learning to code for devices was a good idea.

Or you might want to build on a *nix kernel, and save yourself the effort of dealing with all that stuff, and get on with the fun things like desktops.

Liiiim
October 29th, 2011, 12:09 AM
I think you're misunderstanding what a VM does. It totally emulates a computer - the BIOS, devices, etc. To an OS running in the VM, the host OS might as well not even exist. Of course VMs aren't perfect and there will be some discrepancies between how the VM behaves and how real hardware behaves, but for the most part running an OS in a VM is like running it on a real computer.

Before you can write device drivers you need a certain amount of foundation to work off of. You would probably at least want to be in protected mode with some basic memory management. Writing that stuff can be fairly difficult and involved, depending on what kind of tools you'll want available when writing the device drivers.

Alternatively you could rewrite drivers for some *nix OS, so that foundation would already exist. That might offer some good practice with low-level programming.

MG&TL
October 29th, 2011, 12:36 AM
I think you're misunderstanding what a VM does. It totally emulates a computer - the BIOS, devices, etc. To an OS running in the VM, the host OS might as well not even exist. Of course VMs aren't perfect and there will be some discrepancies between how the VM behaves and how real hardware behaves, but for the most part running an OS in a VM is like running it on a real computer.



Cool. Thanks, Liiiim.