Page 1 of 1
What now?
Posted: Thu Apr 04, 2002 3:48 pm
by f2
I've written the bootloader (located in teh bootsector) that pretty much just prints out a message to the screen. Now, I'm trying to make the bootloader load the bootstrap to do whatever is needed without a 510 bytes limit. So, what is needed to be done in the bootstrap? Open the A20 gate? Select a file system (how is this done?)? Load the kernel?
Thanks!
Re: What now?
Posted: Thu Apr 04, 2002 5:22 pm
by bchadwick01
Tommy,
I'm guessing that you're using at least a little, if not all assembler? If so you should check on disk routines from the BIOS services (INT 0x13), here's a link to some stuff (
http://www.iro.umontreal.ca/~feeley/cou ... int13.html)
You can use that to read from your disk, floppy or otherwise, then you have to choose your file system. If you're using floppies on Windows, I suggest looking at Vnutz page (
http://www.geocities.com/mvea/bootstrap.htm). THis is a great Fat12 (Windows/DOS floppy format) bootsector that loads a binary file and jumps to it. Just edit the needed constants (like the OS filename), or rewrite as you wish, assemble it, and write it to the first sector of a DOS formatted floppy. Then you can build you're OS into a plain binary file and put it on the floppy for loading. It saves a lot of time if you can just drag you're OS files instead of waisting formatted disks.
Hope that helps a little,
BC
Re: What now?
Posted: Fri Apr 05, 2002 6:46 am
by f2
Yeah, I don't think I'm choosing my file system. For now, I'm using interrupt 13 and loading from a certain sector, track, head. I'm going to specifically put the bootstrap into a sector, track, and head that I know so I can set up for the interrupt to BIOS. That's how I'm going to load the bootstrap.
But my question is: What is needed to be done in the bootstrap? I listed a couple of things in the first post of this thread. Anything else? How?
Re: What now?
Posted: Fri Apr 05, 2002 10:19 am
by bchadwick01
Basically what you have to do depends on what you want to do with your OS. The least that needs to be done is load your OS file/sectors from disk and jmp to them.
If you want to get into protected mode, then you need to check for a 386, setup a gdt and enable A20 before you switch (change CR0), and jump to your new cod segment descriptor, but all that can be done in your main OS file instead of your bootstrap if you want. Once in pmode you can't use the bios ints, so you might want to do all your loading from real mode, unless you're going to write a disk driver. Eventually you'll probably want to setup an IDT and move the hardware interrupts to a different vector number.
Otherwise you could just use the bios interrupts and functions and stay in real mode and have some fun with the graphics modes or something (INT 0x10). It's really up to you.
good luck.
BC
Re: What now?
Posted: Fri Apr 05, 2002 11:49 am
by f2
Where's the best site to learn about IDTs, writing my own disk driver, etc.? I would like to really study this and then do this all manually.
Re: What now?
Posted: Fri Apr 05, 2002 9:27 pm
by K.J.
Tommy said:
Where's the best site to learn about IDTs, writing my own disk driver, etc.? I would like to really study this and then do this all manually.
Well... there isn't one.
You could download Chris Giese's OSD sample kernels for IDT info:
http://www.execpc.com/~geezer/osd/code/osd.zip
As for what your bootstrap should do, it deepends on whether or not you are making a protected or real mode OS. For a PMode OS, you should enable the A20, set up a GDT, switch to PMode(you don't need to check for a 386), and load your kernel and run it. For a real mode OS, just load the kernel and run it.
Hope that helps,
K.J.
Re:What now?
Posted: Sat Apr 06, 2002 12:39 pm
by f2
Yeah, I think I know what I need now. How about choosing or making a file system? Where do you choose one?
I started a thread asking about opening the A20 gate and your answer would be greatly appreciated if you could go to that thread and I could have your input
Re:What now?
Posted: Sun Apr 07, 2002 5:38 am
by virtus
What filesystem to choose is up to you, you could code your own, but alot of people tend to use FAT..
It's your choice.. Coding your own could be phun too
Re:What now?
Posted: Sun Apr 07, 2002 8:45 am
by f2
I'm really thinking about coding my own. I'm not sure for the first version of my OS, but I will definitely do it in teh future.
Expect a thread asking about it
Re:What now?
Posted: Sun Apr 07, 2002 5:02 pm
by K.J.
A very simple filesystem(BadFS) can be found with the LR-OS source code:
http://www22.brinkster.com/badsector/lros/
K.J.
Re:What now?
Posted: Sun Apr 07, 2002 5:25 pm
by f2
I'll take a look at it. Is the source code in NASM (Netwide Assembly), by any chance? I'm programming the WHOLE operating system in pure NASM.
Re:What now?
Posted: Sun Apr 07, 2002 5:49 pm
by K.J.
Yes, the ENTIRE source is NASM.
K.J.