OS won't boot with MBR
OS won't boot with MBR
Hi everyone . I would like a little help with an issue I've been having. I was testing my OS on a virtual hdd. The MBR is Microsoft's default one(probably my first mistake ) anyway I thought Microsoft's MBR could boot any OS include any hobby one but I tried replacing the one made when I formatted the partion (using XP on Virtual PC) but it went to the same screen Virtual PC goes to when there's no bootable device, yet with the default boot sector it worked. I have no idea how to test a .vhd file with bochs so please help me. Oh and the sector I have my VBR is 0x3F if it matters, why I don't know XP put the partion's VBR there so I just overwrote it with mine). Also if this comes up yes the first byte in the first partion entry in the partion table of the MBR has the 0x80 bit set.
Re: OS won't boot with MBR
I suspect it is something else at fault. Microsoft's MBR is a generic MBR - it can boot any partition so long as it is marked as primary and active. (If there is more then 1 primary and active partition, it will fail and display an error.)accelleon wrote:anyway I thought Microsoft's MBR could boot any OS include any hobby one but I tried replacing the one made when I formatted the partion (using XP on Virtual PC) but it went to the same screen Virtual PC goes to when there's no bootable device, yet with the default boot sector it worked.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Re: OS won't boot with MBR
If your own boot loader have more than 446byte, then you have to spilit it...The MBR is Microsoft's default one(probably my first mistake ) anyway I thought Microsoft's MBR could boot any OS include any hobby one but I tried replacing the one made when I formatted the partion (using XP on Virtual PC) but it went to the same screen Virtual PC goes to when there's no bootable device, yet with the default boot sector it worked.
Re: OS won't boot with MBR
I don't know what would be the problem the VBR is the same one that I used for the floppy. I know that my boot loader would display an error but thats what I want to happen so that I know it would work. Also if there is an error it changes the screen to fast to catch it.neon wrote:I suspect it is something else at fault. Microsoft's MBR is a generic MBR - it can boot any partition so long as it is marked as primary and active. (If there is more then 1 primary and active partition, it will fail and display an error.)
I replaced the VBR not the MBR's code. The code in the MBR has to be 446 bytes at the most so that it can fit the partion table and the boot signature. The VBR is the same method used for floppy drives. It can be the size of a sector (in my case 512 bytes) but under the case that the VBR loads other sections of it self (eg. Windows uses 3 sectors) it can be as large as the amount of RAM real mode allows (forgot that amount ).kop99 wrote:If your own boot loader have more than 446byte, then you have to spilit it...
Edit: I am now noticing that when I replace Microsoft's VBR with mine the size decreases from 4 GB to 1.86 MB.
Re: OS won't boot with MBR
Are you sure that you are using correct boot sector? What format of the volume is present, FAT32 or other? Maybe your boot sector (data and/or code) is not suitable for this volume.
If you have seen bad English in my words, tell me what's wrong, please.
Re: OS won't boot with MBR
Why are you using an MBR to boot a floppy VBR? MBRs are typically on hard disks, which is what Windows MBR expects to be booted from.I don't know what would be the problem the VBR is the same one that I used for the floppy
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Re: OS won't boot with MBR
I wanted to test booting from the HDD. I overwrote the partion's boot sector with the floppy's VBR, so the floppy VBR is on the HDD. I should still boot because Microsoft's MBR is supposed to be able to boot any VBR. It is 512 bytes and has 0xAA55 as the last word... It loads a file called ldr.sys witch in turn loads the krnl.exe. I don't have ether of the files on the HDD so I expect it to show an error, 'FATAL ERROR: Missing file "ldr.sys"', and halt the system. It doesn't even load the boot loader. I don't think the sector size is more than 512. Maybe it's the OEM Parameter Block... I would easily be able to change it to the correct values but I don't know the number of sectors let alone the size on a virtual HDD. Is there a program or way to check the values that are used in the OEM Parameter Block in windows XP?
Re: OS won't boot with MBR
Chances are that (unless you did this) the Microsoft MBR has no idea your OS is there because you didn't add the necessary info to the Partition Table.
Vancouver Canucks fan for life
Re: OS won't boot with MBR
I used windows XP to create the partion. It should set up everything but the active byte, but I set it to 0x80... I don't know what else I need to set up.
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: OS won't boot with MBR
Did you happen to also disassemble MS' MBR or are you just asking us to do that for you?
Floppy problem:
Unlike your MBR which probably uses the DL value BIOS passed to it for INT 13h, MS' MBR plays around with the value of DX and then loads it back from the field that defines wether the partition is active or not (0x80 or 0x00, respectively). Since your FDD BAID is 0x00 and you try to use 0x80 guess what happens?
Hard disk problem:
Well, unless you corrupted the partition in some way the right values should already be there. Note however that Windows doesn't really care about the MBR, it only does so for booting. If you start adding partitions after you've installed the OS it won't update the MBR IIRC. It would probably be easy to either take a look around or provide a dump of it. Guessing is always a bad idea and we don't have enough info.
Floppy problem:
Unlike your MBR which probably uses the DL value BIOS passed to it for INT 13h, MS' MBR plays around with the value of DX and then loads it back from the field that defines wether the partition is active or not (0x80 or 0x00, respectively). Since your FDD BAID is 0x00 and you try to use 0x80 guess what happens?
Hard disk problem:
Well, unless you corrupted the partition in some way the right values should already be there. Note however that Windows doesn't really care about the MBR, it only does so for booting. If you start adding partitions after you've installed the OS it won't update the MBR IIRC. It would probably be easy to either take a look around or provide a dump of it. Guessing is always a bad idea and we don't have enough info.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: OS won't boot with MBR
My floppy doesn't have a problem. I am trying to boot using a floppy VBR that's on the HDD using Microsoft's MBR. I just don't understand what's wrong. I know that the problem lies within the VBR cause this only happens when I replace Microsoft's VBR with mine. As for the detected size issue the only section of the boot loader that even has anything to do with the size is the OEM Parameter Block, so from where I'm looking the OEM Parameter Block is the culprit due to the the fact that that's the only thing that deals with the size of the sectors and number of sectors. But for me to test that I need to be able to retrieve the correct information.
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: OS won't boot with MBR
What?! Did you read carefully? I said that Microsoft's MBR uses a hard-coded values: 0x80 (which is both the signature for an active partition an the index for the HDD BAID). In other words, it always passes 0x80 to INT 13h and that doesn't work for a floppy. Your own MBR probably uses DL instead of a hard-coded value.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: OS won't boot with MBR
If you can't figure out what the problem is, you shouldn't be programming.accelleon wrote:I am trying to boot using a floppy VBR that's on the HDD using Microsoft's MBR.
Re: OS won't boot with MBR
You cannot, and should never use a floppy VBR for a HDD. It should not work with any MBR because MBRs were not meant to boot floppy VBRs (for the simple reason that floppies don't need them.)
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}