Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work with any other bootable partitions ? #2

Open
sci-ripper opened this issue Mar 31, 2021 · 0 comments
Open

Does not work with any other bootable partitions ? #2

sci-ripper opened this issue Mar 31, 2021 · 0 comments

Comments

@sci-ripper
Copy link

sci-ripper commented Mar 31, 2021

Hi,
I'm coding my own toy OS and I'm using your MBR Boot Manager. I made a simple kernel that prints "Hello" and put it in a FAT32 partition. For the FAT32 partition boot sector, I used a modified version of boot.asm from https://github.com/ishanthilina/USB-FAT32-Bootloader . I modified it to match my partition like so :


[BITS 16]
[ORG 0x0000]
jmp short START
nop

OEM_ID                db 		"MSWIN4.1"
BytesPerSector        dw 		512
SectorsPerCluster     db 		64
ReservedSectors       dw 		32
TotalFATs             db 		2
MaxRootEntries        dw 		0x0000
NumberOfSectors       dw 		0x0000
MediaDescriptor       db 		0xF0 ;F0 because I'm using Flash memory
SectorsPerFAT         dw 		0x0000
SectorsPerTrack       dw 		63
SectorsPerHead        dw 		255
HiddenSectors         dd 		0x00000800
TotalSectors          dd 		501251072
BigSectorsPerFAT      dd 		61181
Flags                 dw 		0x0000
FSVersion             dw 		0x0000
RootDirectoryStart    dd 		0x00000002
FSInfoSector          dw 		0x0001
BackupBootSector      dw 		0x0006

TIMES 12 DB 0 ;jumping to next offset

DriveNumber           db 		128
ReservedByte          db   		0
Signature             db 		0x29
VolumeID              dd 		0x0931FBD0
VolumeLabel           db 		"NO NAME    "
SystemID              db 		"FAT32   "

When I boot the computer, I can see the 4 partitions (I actually have only one partition but I understand why four partitions appears) on the flash drive. When I select the first and only (active) partition, the message "Boot sector error" and then reboot.

I tried debugging the MBR and from what I've seen, the code/condition that triggers the error message is the following :

CHECK_OS:
CMP WORD [0x7DFE], 0xAA55
JNZ PRINT_ERROR             ; Missing bootable mark <-- this part here

Clearly this shouldn't be happening because my FAT32 boot sector has the signature 0xAA55 (I can show the full FAT32.asm boot sector code if needed, it's just the same as https://github.com/ishanthilina/USB-FAT32-Bootloader expect for the aformentioned changes I made).

EDIT : The FAT32 Partition starts at sector 2048

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant