Boot Sector on Flash Sometimes Detecting as HDD and not FDD

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
kemosparc
Member
Member
Posts: 207
Joined: Tue Oct 29, 2013 1:13 pm

Boot Sector on Flash Sometimes Detecting as HDD and not FDD

Post by kemosparc »

Hi,

I have followed the baby step 2 at http://wiki.osdev.org/Babystep2 listed on the tutorial page of osdev.

I compiled the code using :

Code: Select all

nasm boot.asm -f bin -o boot.bin

and then wrote it to a USB device using the dd command:

Code: Select all

dd if=boot.bin of=/dev/sdb
When I use the USB to boot, sometimes the BIOS recognizes the USB as FDD and some times as HDD. When the USB is recognized as HDD it does not boot. I tried this on a lenovo thinkpad x220 which has both USB-FDD and USB-HDD in its boot list and the USB-FDD has a higher priority, when I press F12 the USB shows up as USB-HDD.

Thanks,
Karim.
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: Boot Sector on Flash Sometimes Detecting as HDD and not

Post by Antti »

If you look at the binary layout of the first 512 bytes, there is neither a BPB nor a partition table (MBR).

The BIOS does not know how it should handle it.
kemosparc
Member
Member
Posts: 207
Joined: Tue Oct 29, 2013 1:13 pm

Re: Boot Sector on Flash Sometimes Detecting as HDD and not

Post by kemosparc »

Hi,

So you mean it is up to the BIOS, and that is why some BIOS will detect it and some others will not.

So to make sure I understand, if I add the FAT12 BPB to my boot sector and copied it to a flash it should work and detect the FLASH as USB-FDD, right?

Thanks,
Karim.
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: Boot Sector on Flash Sometimes Detecting as HDD and not

Post by Antti »

kemosparc wrote:if I add the FAT12 BPB to my boot sector and copied it to a flash it should work and detect the FLASH as USB-FDD, right?
There is no warranty. It depends on the BIOS implementation. Having a valid "floppy-like" structure just makes it more likely.
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

Re: Boot Sector on Flash Sometimes Detecting as HDD and not

Post by digo_rp »

This in some cases can be changed in the bios usb device emulation. Like fdd hdd optical, etc. Try to take a look at bios and find it.
i hope this helps.

Good luck.
kemosparc
Member
Member
Posts: 207
Joined: Tue Oct 29, 2013 1:13 pm

Re: Boot Sector on Flash Sometimes Detecting as HDD and not

Post by kemosparc »

Hi,

Actually the only think that I can do is to add them to the boot list. But the USB type isdetected at boot time and the type is selected and displayed accordingly.

Thanks
Karim.
User avatar
Muazzam
Member
Member
Posts: 543
Joined: Mon Jun 16, 2014 5:59 am
Location: Shahpur, Layyah, Pakistan

Re: Boot Sector on Flash Sometimes Detecting as HDD and not

Post by Muazzam »

If there is BIOS Parameter Block in first sector of USB drive, BIOS usually detects it as Floppy otherwise as a Hard disk.
Post Reply