DOS chained images

From Syslinux Wiki
Revision as of 01:59, 6 March 2009 by Sha0 (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

THERE SHOULD BE NO LINKS TO THIS PAGE, BUT IN CASE YOU CAME ACROSS IT USING THE SEARCH... PLEASE DO NOT USE THESE INSTRUCTIONS JUST YET. THEY ARE INCOMPLETE.

CURRENTLY INVESTIGATING CHAIN.C32 BEING BROKEN FOR VARIOUS DOS VERSIONS.

You can create an HDD image with a FAT[12|16|32] partition (for use with a virtual machine or MEMDISK) of an arbitrary size and to chain to FreeDOS, MS-DOS, PC-DOS, or NTLDR, without needing their specific filesystem boot-sector code, which normally loads these.

Understanding Disk Geometry

For common floppy and hard disks:

  • cylinders (C) = tracks / heads (H)
  • heads (H) = tracks / cylinders (C)
  • tracks = cylinders (C) * heads (H)
  • total sectors = tracks * sectors-per-track (S)
  • total bytes = total sectors * 512 bytes-per-sector


Create your HDD of an arbitrary size (XX: Total megabytes for the image):

# dd if=/dev/zero of=my_image.hdd count=$((XX * 2 * 1024))

Attach the image to your favourite loop-device (X: Your favourite):

# losetup /dev/loopX my_image.hdd

Use 'fdisk' to manipulate your image. Since QEmu is such a common VM emulator and requires for an HDD image that:

  • 1 <= cylinders <= 16383
  • 1 <= heads <= 16
  • 1 <= sectors-per-track <= 63

you might be inclined to use compatible parameters, as needed:

# fdisk -H 16 -S 63 /dev/loopX
: u
: n
: p
: 1
:
:
: t
: 0c
: a
: 1
: p
: w

Above, we have shown the commands to:

  • change the units to sectors
  • create a new partition
  • choose to create a primary partition
  • choose to create the first partition
  • choose the default starting sector
  • choose the default partition size
  • change the type of the only partition
  • change it to type 0x0C (FAT32 LBA, just an example choice of FAT)
  • make a partition bootable
  • choose the first partition to be bootable
  • display the results
  • commit the changes and quit 'fdisk'