OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Jul 28, 2017 12:42 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: FAT32 (kernel loading) bootsector
PostPosted: Sat Mar 11, 2017 12:02 pm 
Offline

Joined: Sun Jan 29, 2017 2:13 pm
Posts: 3
I some time ago i saw similar project on Github, but it only loaded first file on FAT32 partition. I've decided to make bootloader that:
1. Finds first FAT32, bootable partition
2. Searches for specified file(in root directory)
3. Loads and executes it

Another part that is different, is my custom script(made on ubuntu so it's not for windows) which:
1. lets you choose filename that bootloader will search for
2. lets you very easily choose device/partition for bootloader(writes bootsector on specified device - of course leaving MBR ,and sets boot flag on specified partition)

For me, and i think a lot of you guys this is a fast way to just run script, copy your extended loader(or small kernel) on a device and run OS on real hardware

If you want to check it out: https://github.com/TebexPL/FAT32-Bootsector


Top
 Profile  
 
 Post subject: Re: FAT32 (kernel loading) bootsector
PostPosted: Sun Mar 12, 2017 6:05 am 
Offline
Member
Member
User avatar

Joined: Fri Feb 17, 2017 4:01 pm
Posts: 133
Location: Ukraine, Bachmut
your code only checks for 0x0b in the OSType field. This is not how FAT32 is detected. There might be FAT12/FAT16 with that marker, or there might be FAT32 with a different marker. Also because of the same reason, your code will fail at Protective MBR. They should be common now.
Of course it's much easier to only check for 0x0b in one field rather than doing all those calculations as described in the spec, but that's how it should have been done should it be a "FAT32 boot sector".

_________________
Trying to write an NT-like OS (ANT). First target architecture is mips32r2.
Hopefully this is not only not NSFW, but rather opposite. and feasible as well.


Top
 Profile  
 
 Post subject: Re: FAT32 (kernel loading) bootsector
PostPosted: Sun Mar 12, 2017 11:08 am 
Offline

Joined: Sun Jan 29, 2017 2:13 pm
Posts: 3
zaval wrote:
your code only checks for 0x0b in the OSType field. This is not how FAT32 is detected. There might be FAT12/FAT16 with that marker, or there might be FAT32 with a different marker. Also because of the same reason, your code will fail at Protective MBR. They should be common now.
Of course it's much easier to only check for 0x0b in one field rather than doing all those calculations as described in the spec, but that's how it should have been done should it be a "FAT32 boot sector".


Well, that's what i will be trying to change in near future. Thanks for advice.

And by "Protective MBR" you mean GPT? I'm not sure if GPT handling and making sure it's FAT32 will fit in 446 bytes :cry:


Top
 Profile  
 
 Post subject: Re: FAT32 (kernel loading) bootsector
PostPosted: Sun Mar 12, 2017 4:09 pm 
Offline
Member
Member
User avatar

Joined: Fri Feb 17, 2017 4:01 pm
Posts: 133
Location: Ukraine, Bachmut
Tebex wrote:
zaval wrote:
your code only checks for 0x0b in the OSType field. This is not how FAT32 is detected. There might be FAT12/FAT16 with that marker, or there might be FAT32 with a different marker. Also because of the same reason, your code will fail at Protective MBR. They should be common now.
Of course it's much easier to only check for 0x0b in one field rather than doing all those calculations as described in the spec, but that's how it should have been done should it be a "FAT32 boot sector".


Well, that's what i will be trying to change in near future. Thanks for advice.

And by "Protective MBR" you mean GPT? I'm not sure if GPT handling and making sure it's FAT32 will fit in 446 bytes :cry:

Yes, GPT. The whole code might not fit 446 bytes of course, that's why it would be better to implement this functionality not as an MBR boot-code, rather as a boot-sector code doing something inside 512 bytes capability and proceeding as for example MS boot sector code does - it loads additional sectors with its continuation from the "reserved" area (sector 12 if i remember properly, relative to the FAT partition of course). This way it can do more sophisticated stuff. This is the case for the FAT boot-sector code, not to mention NTFS one. With the latter, it additionally loads way more than yet 1 sector. For dealing with GPT just 1 additional sector should be enough.

_________________
Trying to write an NT-like OS (ANT). First target architecture is mips32r2.
Hopefully this is not only not NSFW, but rather opposite. and feasible as well.


Top
 Profile  
 
 Post subject: Re: FAT32 (kernel loading) bootsector
PostPosted: Wed Mar 15, 2017 2:02 pm 
Offline

Joined: Sun Jan 29, 2017 2:13 pm
Posts: 3
zaval wrote:
Tebex wrote:
zaval wrote:
your code only checks for 0x0b in the OSType field. This is not how FAT32 is detected. There might be FAT12/FAT16 with that marker, or there might be FAT32 with a different marker. Also because of the same reason, your code will fail at Protective MBR. They should be common now.
Of course it's much easier to only check for 0x0b in one field rather than doing all those calculations as described in the spec, but that's how it should have been done should it be a "FAT32 boot sector".


Well, that's what i will be trying to change in near future. Thanks for advice.

And by "Protective MBR" you mean GPT? I'm not sure if GPT handling and making sure it's FAT32 will fit in 446 bytes :cry:

Yes, GPT. The whole code might not fit 446 bytes of course, that's why it would be better to implement this functionality not as an MBR boot-code, rather as a boot-sector code doing something inside 512 bytes capability and proceeding as for example MS boot sector code does - it loads additional sectors with its continuation from the "reserved" area (sector 12 if i remember properly, relative to the FAT partition of course). This way it can do more sophisticated stuff. This is the case for the FAT boot-sector code, not to mention NTFS one. With the latter, it additionally loads way more than yet 1 sector. For dealing with GPT just 1 additional sector should be enough.


Sorry for delay, but I've been making Windows install app.

The main focus for me was to have as much functionality in the boot sector as possible. In this project I don't focus on GPT loading, etc. I want to keep it simple(at least for now). It was a project to help me(and maybe someone else) understand the basics of FAT and MBR

In future, as I will learn more I will definetly make more functional and reasonable projects. Thanks for advice!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group