How To Create Your Own x86 Operating System for Modern PC Computers

I'd like to create a new operating system for x86 PC computers. I'd like it to be 64-bit but possibly run as 32-bit as well.

I have these kinds of questions:

What kinds of things do you start working on first? Knowing where to start in writing your own operating system seems to me to be a tricky subject, so I am interested in your input.

Generally how to go about making your own 32-bit/64-bit operating system, or good resources that mention useful information about going about writing your own operating system for x86 computers. I don't care how old sources are as long as they are still relevant and useful to what I am doing.

I know that I will want it to have kernel drivers that access peripheral hardware directly. Where should I look for advice and documentation for programming and understanding the interface to peripheral hardware the operating system will communicate with? I will need to understand how the operating system will receive input and interact with keyboards, mice, computer monitors, hard drives, USB, etc. etc. This is probably the area I know least about.

I have the Intel instruction set manuals and have been getting more familiar with assembly programming, so the CPU side of things is what I know the most about.

At this point I'm thinking that I'd like to implement the Linux system calls within my operating system so that programs that run on Linux can run on my operating system. I want my operating system to use the ELF binary format. I wonder what obstacles I have to overcome to achieve this Linux compatibility. Are the main things implementing the system calls that Linux provides, and using the ELF format? What else?

I am also interested in people's thoughts about why it might not be a good idea to make your own operating system, and why it is a good idea to make your own operating system.

Thank you for any input.


You'll probably just want to get it running inside of a virtual machine to begin with. It's a PITA trying to develop an OS on actual hardware (with the constant rebooting and debugging-over-serial-cable).

Inside a VM you've usually got a simplified (and relatively standardised) set of hardware to support which can ease initial development as well. In particular, if you want to show someone else your OS you just give them a .vhd file and be reasonably confident that if it works for you then it'll work for them as well.

You might also want to start with something that's already up & running initially (for example, Microsoft's Singularity is pretty neat). That'll let you get all of the boring boot loader and basic device drivers out of the way and you can get onto the "meaty" stuff more quickly.


It is better that you take a look at Linux 0.01 source code. it is the first version of the OS. it is very simple and informative. It is a good place to start


You'll be wanting this book:

alt text http://ecx.images-amazon.com/images/I/5169V5J687L._SL500_AA300_.jpg

链接地址: http://www.djcxy.com/p/72396.html

上一篇: 计算机如何将寄存器设置为恒定值?

下一篇: 如何为现代PC电脑创建自己的x86操作系统