This article at LinuxGazette is a hands-on tutorial for building a small boot sector. The first section provides the theory behind what happens at the time the computer is switched on. It also explains our plan. The second section tells all the things you should have on hand before proceeding further, and the third section deals with the programs. The little startup program won’t actually boot Linux, but it will display something on the screen.
I really hate that program that writes the bootsector.
the disadvantage is that you might not notice that the code is bigger than 512 bytes.
using NASM it is very good to use
TIMES 510-($-$$) db 0
dw 0xAA55
at the end of the bootsector code
to fill the bootsector and then place bigger code after the signature. then it is very easy and portable to write the whole file with dd, rawrite, or my fav, fdimage
This sentence made me laugh:
“At startup, every microprocessor is just another 8086.”
Not where I live, it isn`t. 😉
Ya, same here. I haven’t used an x86 processor in a decade!
I wonder if this one will progress beyond a boot sector.
Hint to anyone wanting to write a real OS:
1) Download and install GRUB
2) Read http://www.themoebius.org.uk/tutes/
Use DOS in the beginning. Switch to protected mode and take over the PC as an ordinary user program. No need to write disk handling until it’s needed. Maybe you’ll have to worry about a few of DOS quirks, but isn’t that a better start?
I was thinking of using DOS in the beginning when writing my OS, but after I saw all the features GRUB had (including loading arbitrary files for your kernel to use and generating a system RAM map that encompasses > 64MB) I decided to make my kernel multiboot complient instead. Using GRUB, you don’t have to go back and ‘fix’ you’re bootloader stuff when you want to distribute your work to a larger audience, you don’t have to deal with the ideosyncracies of how DOS initializes hardware, etc.
Thanks for the info. I’ll look into GRUB then.
Does anyone know where one can find a “Write your own OS” introduction for the Mac/PPC architecture? I know where to find general stuff about OS design, but I’d like to find some information on PPC HW and bootstrapping.
This “Write Your Own Operating System” seems to have a little more breadth to it:
http://www.mega-tokyo.com/os/os-faq.html
It provides a good bibliography too.
If you are interested in a toy os, you can use the flux os kit as a bootstrap, saving driver writing till later.
http://www.cs.utah.edu/flux/oskit/
To be honest, I found the article very interesting, as well as some of the sites the rest of you have posted links to. I very interseted in OS developmen, not because I think that my operating system will be the next Linux, but because I love the challange, and I think that it is a great learning process.
Does anyone else know of some sites that give advice/direction on building your own operating system?
> I found the article very interesting
actually, I agree with you…
> Does anyone else know of some sites
well.. I’ve found this…
http://www.groovyweb.uklinux.net/index.php?page_name=how%20to~*… .
byez
I tried the code last night on my i486 and all I get is a cursor in the top left corner. Today I brough my boot disk in to work and get the same thing on a P3 850. I’m not familliar with intel syntax or coding with segmented memory. I think the address for the video memory is correct. Has anyone seen this code work? One catch: my ‘ld86’ (slackware 4) complains about the -d flag but I did use the -s flag. Time to upgrade tonight I guess.
Yup that was it. Just download and compile ls86 from current source and it’s fine. (Yeah I read the note in the article but thought I was okay .
Bonus: Now I have man pages!
/Chuck