Jump to content











Photo
- - - - -

makebootfat FAT32+MSDOS


  • Please log in to reply
6 replies to this topic

#1 Anarchi

Anarchi
  • Members
  • 4 posts
  •  
    Australia

Posted 25 June 2009 - 03:20 AM

I am trying to make my USB Flash Drive bootable with FAT32 and MSDOS (Win98 sys), using only makebootfat.exe v1.4
If I use HP's USB Storage Tool, my FAT32 USB Drive boots successfully!

WORKS: FreeDOS, 32MB USB Drive, FAT16

makebootfat -o usb -2 Freedos.bss -c COMMAND.COM -c KERNEL.SYS -v D:\Dummy

WORKS: FreeDOS, 1GB USB Drive, FAT32

makebootfat -o usb -3 FDFAT32.bin -c COMMAND.COM -c KERNEL.SYS -v D:\Dummy

WORKS! MSDOS (Win98 4.1), 32MB USB Drive, FAT16

makebootfat -o usb -b MSFAT16.bin -c COMMAND.COM -c MSDOS.SYS -c IO.SYS -v D:\Dummy

FAILS.... MSDOS (Win98 4.1), 1GB USB Drive, FAT32

makebootfat -o usb -3 FAT32USB.bin -c COMMAND.COM -c MSDOS.SYS -c IO.SYS -v D:\Dummy


makebootfat creates the USB drive successfully, but when I try to boot, it just hangs with a flashing cursor.

I've tried countless makebootfat parameters, such as -m mbrfat.bin, -F, -Z, -D, -P, -E
I've tried different boot sector images, from a FAT32 HDD with Win98, from a FAT12 Floppy Disk, from a FAT32 USB Key that can boot (created by HP's tool), but nothing works :lol:
I've tried different command.com files, and even tried HP's system files.

Note that most boot sectors are 512bytes. But HP's built-in FAT32 boot sector is 1500Bytes!

When I try writing that 1500Byte sector using makebootfat, it only write 512bytes.
When I try writing that 1500Byte sector using HDHacker, the drive shows corrupted files and folders.


So my question is, how does HP write the 1500Byte boot sector? Is it writing an MBR with a partition table?

Can I force makebootfat to write the whole 1500bytes?

Maybe I need to use a different mbrfat.bin file?

#2 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 25 June 2009 - 03:59 PM

ALL the "DATA" and the "CODE" in a FAT 12/16 bootsector is within one sector (bootsector)

ALL the "DATA", but only most of the "CODE" in a FAT32 is within first sector.

An actual "complete" bootsector for FAT32 is actually:
1st, 2nd and 3rd sector FAT32 DOS.
1st, 2nd and 12th sector FAT32 (2K/XP/2003, etc.)
1st, 2nd and 14th sector FAT32 (ReactOS)

Check these:
http://www.boot-land...?...=7512&st=56
http://www.boot-land...?...=7739&st=89

And of course the "base reference":
http://thestarman.pc...mbr/MSWIN41.htm

On a freshly formatted FAT32 volume "default value" of bytes on 2nd sector are (Absolute offsets from begiinning of first sector, hex):
at 0x0200:
52 52 61 41
at 0x03E4:
72 72 61 41
at 0x03E8:
FF FF FF FF
at 0x03EC usually:
02 00 00 00
at 0x03FE:
55 AA

Thus:
1st sector contains both "CODE" (fixed) and "DATA" (variable)
2nd sector contains both "CODE" (fixed) and "DATA" (variable) but of which the "standard values" are known
3rd sector (as saind not necessarily the actual sector at offset 0x0400) contains only "CODE" (fixed)

It's a long time I experimented with makebootfat, cannot remember details, you may find something of interest in this report:
http://www.911cd.net...o...13784&st=44

The workaround was simply to run DOS 7.x/8.0 SYS.COM in a VM:

Please note that this option (FAT32 on a 512 Mb USB key) did NOT make a bootable volume. I suspect that there is something not right in the FAT32 identifier (hex 0b) and structure. By running (in Qemu) sys.com, it changed (between other things) the identifier to LBA mappped (hex 0c) and the volume booted.


I guess that SYS.COM fixed, besides the Partition ID, the missing 2nd and 3rd sector. ;)

Since the 2nd and 3rd sector are "fixed" (at least for a freshly formatted system they should work allright if copied to the stick with dsfo/dsfi (or HDhacker).

I.e.:
  • let makebootfat partition/format the and write the 1st bootsector, including "right" "fixed" CODE and (hopefully) "right" DATA
  • duplicate if needed the first sector to 6th one
  • write "pre-made" "fixed" 2nd and 3rd sectors
  • write again same sectors to 7th and 8th sectors

Let me know how it goes....

:lol:

jaclaz

#3 Anarchi

Anarchi
  • Members
  • 4 posts
  •  
    Australia

Posted 25 June 2009 - 10:44 PM

Thank for the info jaclaz.

So basically I need to write more than 512bytes, which is why HP's utility writes 1.5KB of sectors.

The question is, can makebootfat v1.4 (latest) do this? or would it need to be updated?

Or would I need to use another tool?

#4 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 26 June 2009 - 08:19 AM

So basically I need to write more than 512bytes, which is why HP's utility writes 1.5KB of sectors.

Yep. :lol:

The question is, can makebootfat v1.4 (latest) do this? or would it need to be updated?

It seems to me that your experience, summed up to the one I did at the time (and it was ALREADY version 1.4) already produced an answer: it seems like NOT. ;)
makebootfat seems like a dead project, unfortunately. ;)
We would need a programmer to take the Source Code and fix/integrate/update it.


Or would I need to use another tool?

I guess you need one. ;)

You can use HDhacker:
http://dimio.altervista.org/eng/

to try ADDING the missing/wrong 2nd and "3rd" (beware of the placement of this last one as 12th sector for Windows 2K/XP/2003 and probably for Vista/2008/Windows7) as hinted above AFTER having used makebootfat to generate the 1st sector (and the other filesystem structure).

If it works, you can then script it and use dsfo/dsfi to automate the process.

You can take some examples of how to perform this kind of actions by reading the code of my small batches MBRBATCH/MKIMG:
http://www.boot-land...?showtopic=3191
http://www.boot-land...?showtopic=5000

;)

jaclaz

#5 Anarchi

Anarchi
  • Members
  • 4 posts
  •  
    Australia

Posted 29 June 2009 - 02:21 AM

I had a look at your batch files and get the general idea, but its way beyond my knowledge of file systems :lol: I'll need to read up on how boot sectors, FAT32, partition tables, etc.. work.

I know c++ so I can modify makebootfat, implementing the changes is the hard part. I'll have a look at the source when I get a chance.

#6 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 29 June 2009 - 02:17 PM

I'll need to read up on how boot sectors, FAT32, partition tables, etc.. work.


Standard (GOOD ;) ) reference:
http://mirror.href.c.../mbr/index.html
http://www.goodells.net/multiboot/
http://home.att.net/...ot/w95b_mbr.htm
(several interestring pages on each of the above links)

Also, check these::
http://www.911cd.net...showtopic=21914
http://www.911cd.net...o...1702&st=129

And this:
http://homepages.tes...name-field.html

:lol:

jaclaz

#7 Anarchi

Anarchi
  • Members
  • 4 posts
  •  
    Australia

Posted 03 July 2009 - 06:58 AM

Thanks for the links :lol:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users