Hi,
I am a new learning OS development,and got confused with one problem. Here is the detail:
step 1.wrote a boot program(stage1) and copy it to the first sector of a floppy disk using debug command(-w 100 0 0 1).
step 2.tried to use "copy stage2.sys A:\stage2.sys" to copy my stage2 program to the disk
but at the second step,my OS just complained that the file system of the floppy disk could not be recognized.I really get confused with this. My OS is windows 7.Seems like the behavior of copy of the bootloader(stage1) has crashed the FAT fs of the floppy ,but how could this happen?
Thanks in advance!
Question about second stage of bootloader.
Re: Question about second stage of bootloader.
Hi,
Cheers,
Brendan
The first sector of the floppy disk (that you overwrote) is also the first sector of the FAT file system and contains important information needed to understand the FAT file system.dash wrote:Seems like the behavior of copy of the bootloader(stage1) has crashed the FAT fs of the floppy ,but how could this happen?
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Question about second stage of bootloader.
It would seem you overwrote the BIOS parameter block...
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
If you're new, check this out.
Re: Question about second stage of bootloader.
I see~~~.yes,I forgot to put the BPB into my boot loader.but still there's a little strange.
the first time I put the BPB like this,which still caused the same problem:
-------------------------
--------------------------
and after I replaced
with ,the problme was fixed.(start is label of the first jmp instruction)
Is there any differences?
the first time I put the BPB like this,which still caused the same problem:
-------------------------
Code: Select all
bpbOEM: DB "My OS " ;8 bytes
bpbBytesPerSector: DW 512
bpbSectorsPerCluster: DB 1
bpbReservedSectors: DW 1
bpbNumberOfFATs: DB 2
bpbRootEntries: DW 224
bpbTotalSectors: DW 2880
bpbMedia:DB 0xF0
bpbSectorsPerFAT: DW 9
bpbSectorsPerTrack: DW 18
bpbHeadsPerCylinder: DW 2
bpbHiddenSectors: DD 0
bpbTotalSectorsBig: DD 0
bsDriveNumber: DB 0
bsUnused: DB 0
bsExtBootSignature: DB 0x29
bsSerialNumber: DD 0xa0a1a2a3
bsVolumeLabel: DB "MOS FLOPPY "
bsFileSystem: DB "FAT12 "
and after I replaced
Code: Select all
bpbOEM: DB "My OS " ;8 bytes
Code: Select all
TIMES 0Bh - ($-start) db 0
Is there any differences?
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Question about second stage of bootloader.
The first option isn't guaranteed to put the BPB at the right place (jmp + OEM must be 11 bytes), while the latter simply puts the BPB where it should regardless of what opcode the assembler put in for the jump.dash wrote:and after I replacedwithCode: Select all
bpbOEM: DB "My OS " ;8 bytes
,the problme was fixed.(start is label of the first jmp instruction)Code: Select all
TIMES 0Bh - ($-start) db 0
Is there any differences?
Re: Question about second stage of bootloader.
I understand.
Thank you all very much
Thank you all very much
Re: Question about second stage of bootloader.
Also, some versions of windows require that the oem label be either blank or "MSWIN4.0" (It's 4, not 2, right?)
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
If you're new, check this out.