Skip to main content
GameDev.net gamedev.net
🔒 Locked

How to create a very simple OS

Started by cNoob Feb 27, 2006 at 8:41 AM 16 replies 2.6k views
Original Post
cNoob
cNoob
Ive just got given a very very old pc because I was woundering whether it was possible for one to create a very simple OS so I could install it on the system. I know an OS needs a kernal then programs to run is there anywhere on the net that helps you make a simple OS or a kernal file. The OS will be very simple something like boots up waits for about 10 seconds then shuts down. Thanx
cNoob
cNoob
Thanx for the fast reply ill check it out.
UbErBeAsT
UbErBeAsT
http://www.linuxfromscratch.org/ << If you want to add on to some preexisting work.
Oxyd
Oxyd
Bona Fide OS Development — You can find some further links there as well as some tutorials and documents.
Mega–Tokyo — Check out the wiki and the forums

Making an OS that just boots up, prints some message and then halts isn’t that hard. You can do this just with few lines of assembly that you put on the bootsector of your disk. However, making an OS that actually shuts down the PC would be a lot harder.
cNoob
cNoob
Ok thanx for that oxyd i shall do just that then. Ive just read one of the tuts from bonafide called Getting Started In OS Development. Im now going to look for one that actually shows me some code so i can get started. I also noticed that ASM is required to create an OS is there any tutorials you guys no of to teach me ASM as i havnt used it in a long time.
cNoob
cNoob
thanx for that link UbErBeAsT but it isnt what im trying to acheive i want to create a OS from scrath. Thanx Anyways :)
cNoob
cNoob
write i have written my OS well the start in asm and ive compiled it into a binary file as the tutorial says. I now need to simulate the .bin in a program called bochs but i cant seem to get it to work has anyone used this before.
Monder
Monder
How did you create the .bin file and what problems are you having in getting it to work in bochs?
CableGuy
CableGuy
I personally use VMware it is much better than boch.
Muhammad Haggag
Muhammad Haggag
Quote:
Original post by cNoob
write i have written my OS well the start in asm and ive compiled it into a binary file as the tutorial says. I now need to simulate the .bin in a program called bochs but i cant seem to get it to work has anyone used this before.

First, you need to create a disk image. For example, using the bximage tool that comes with bochs.

Then you need to add your kernel to that image. On linux/unix you can do it like this, using loopback devices. I haven't tried it, but I believe you can just copy the binary over the disk image as a straight-forward file operation, but then you'd need to take care to get the boot signature right.

cNoob
cNoob
i created my .bin file by running cmd then located nasmw and typed the following

nasmw -f bin booting.asm -o booting.bin

then i have no idea on how to load it into bochs so i might try VMware.
Oberon_Command
Oberon_Command
Quote:
Original post by cNoob
i created my .bin file by running cmd then located nasmw and typed the following

nasmw -f bin booting.asm -o booting.bin

then i have no idea on how to load it into bochs so i might try VMware.


This tutorial teaches you how to get a bootloader working, and how to get it working with Bochs. Specifically, check out the example config file that the author provides. It will show you how to set everything up...
cNoob
cNoob
oberon_command thats the tutorial i followed ive got everything done up intil loading it in bochs for some reason i cant get it working.
Muhammad Haggag
Muhammad Haggag
Quote:
Original post by cNoob
oberon_command thats the tutorial i followed ive got everything done up intil loading it in bochs for some reason i cant get it working.

To let bochs use a specific floppy for booting, you need a disk image. And you need a line like this in the bochs configuration file, bochsrc:
floppya: 1_44=bin/a.img, status=inserted

Now, to get the disk image: Create an empty file, a.img, that is 1.44 MB in size, all filled with zeros. Let's say your booting.bin is 4K. Copy those 4K over the first 4K of a.img. How do you do that? Just write a small program that does it.

Oberon_Command
Oberon_Command
Quote:
Original post by cNoob
oberon_command thats the tutorial i followed ive got everything done up intil loading it in bochs for some reason i cant get it working.


Are you sure that the paths in your config file are correct? If so, double check them, and if you haven't done so already be sure to point the config file to the correct boot image. Also be sure to point Bochs to the config file itself, otherwise it won't work.

What problems are you having exactly?
KittyRa
KittyRa
Quote:
Original post by cNoob
write i have written my OS well the start in asm and ive compiled it into a binary file as the tutorial says. I now need to simulate the .bin in a program called bochs but i cant seem to get it to work has anyone used this before.
As long as you have the old PC you were given why not use it? I have a seperate PC for OS testing and I perfer it to using a simulator like bochs, of course it can be unpleasent transfering the binaries to floppies and that sort of thing:).


F-R-E-D F-R-E-D-B-U-R...G-E-R! - Yes!
cNoob
cNoob
OK i didnt try it on the old pc because i didnt have a floppy disk so i bought one today and ive used a piece of software to copy my boot sector to the floppy and tested my simple os and all went well. Thanks to everyone that posted in this thread for all the help you gave im really greatfull for what you guys have done.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.