we have developed a USB composite device (CDC and MSD classes) on a custom MCU-based hardware. The disk is a RAM disk (24 kb of space) and at power up, it is formatted (FAT 12) by the MCU vendor firmware. Unfortunately, the device is seen as a bootable disk and a typical BIOS tries to boot it. However, we know that connecting various USB disks to different PCs yields different results, depending both on the disk FAT type and on the BIOS behavior (obviously each BIOS has USB boot prior than HDD). Our goal is to have an unbootable USB disk (FAT12 formatted).
We have tried many solutions but none worked. In our opinion it seems BIOSes do more than simply checking the presence of a valid boot sector, copy the first sector to address 0x7C00 and jump at that address, giving control to the x86 ASM boot code. In fact, we have formatted a commercial USB stick with Linux with the command:
mkdosfs -F 12 /dev/sda1
This USB stick has now a FAT12 Volume Boot Record and we have not found to date a BIOS that gets stuck while trying to boot from it.
Therefore, we copied its boot sector to our device and we expected it to work as the commercial USB stick. Nope: the BIOS hangs while trying to boot the disk. Here follows the disassembly of the boot sector generated by the above Linux command.
;Jump instructions
0x00007c00 eb 3c jmp 0x00007c3e
0x00007c02 90 nop
;VBR segment
0x00007c03 6d
0x00007c04 6b 66 73 2e
0x00007c08 66 61
..............
;Boot code
0x00007c3e 0e push %cs
0x00007c3f 1f pop %ds
0x00007c40 be 5b 7c mov $0x7c5b,%si
0x00007c43 ac lods %ds:(%si),%al
0x00007c44 22 c0 and %al,%al
0x00007c46 74 0b je 0x00007c53
0x00007c48 56 push %si
0x00007c49 b4 0e mov $0xe,%ah
0x00007c4b bb 07 00 mov $0x7,%bx
0x00007c4e cd 10 int $0x10
0x00007c50 5e pop %si
0x00007c51 eb f0 jmp 0x00007c43
0x00007c53 32 e4 xor %ah,%ah
0x00007c55 cd 16 int $0x16
0x00007c57 cd 19 int $0x19
0x00007c59 eb fe jmp 0x00007c59
;String to be displayed followed by zeros
0x00007c5b 54
0x00007c5c 68 69 73
..........
;Boot signature
0x00007dfe 55
0x00007dff aa
Apparently, the above code prints the string "This is not a bootable disk. Please insert a bootable floppy and press any key to try again" and then calls INT16H and INT19H.
Why does the BIOS from the PC I am writing from, for example, prints: "Attempting boot from USB disk" and then jumps to my HDD while the same assembly code written in our device does not? That is, it writes "Please insert..."? There exists a code that can substitute this and never try to boot my custom USB disk?
In addition, does the BIOS do some special communications with a USB device before reading the first sector reading, for example, something from the device descriptor in order to understand if it can be used as a boot disk?
Thank you all in advance.