[syslinux] help: booting dos from syslinux/memdisk

Thomas Baumann tom at tiri.li
Thu Jul 3 02:22:54 PDT 2003

Thanks to christian for his input. But I need some more help.

> | # creating a 16MB image with structure C/H/S 2/256/63
> | mkdiskimage disk.img 2 256 63

cfdisk gives an error for illegal heads value. this means there is
sth. essentually faulty. so i did the correction:

# creating a 16MB image with structure C/H/S 8/64/63
mkdiskimage disk.img 8 64 63

then i called cfdisk (you need ncurses to run this tool).
download redhat 9 RPM at 

cfdisk -c 8 -h 64 -s 63
# disk1  Boot  Pri   DOS FAT16 [NO NAME]   15.75MB

cfdisk partition table for disk.img
         -start-        ---end--- start numOf 
  # flag  H  S  C  ID   H  S  C   Sect  Sect
# 1 0x80  1  1  0  0x04 63 63 7    63   32193

> After that you should use losetup (as root) to mount the diskimage with
> a proper offset (which is usually the first track calculated in bytes,
> in this case 63*512. You can look up the sector offset in cfdisk) to
> point to the start of the partition. Then you can use mkdosfs on that
> loop device.

losetup -o 32256 /dev/loop0 disk.img

I can even do a fdisk -l /dev/loop0
# Disk /dev/loop0: 16MB, ...
# 64heads, 63sec, 7 cyl
# Units= cyl of 4032 * 512 = 2.064.384 bytes
# /dev/loop0p1  *   1   8   16128   4   FAT16<32M

Also assigning a letter to mtools is working.
cat << EOF >> /etc/mtools.conf
drive e: file="/dev/loop0"
mlabel -N 00 e:MYDISK
mdir e:
# Volume in Drive E is MYDISK
# Volume Serial Number os 0000-0000
# Directory for E:/
# No files
#              16.380.928 bytes free

But how can I now transfer an OS to this image ?
The device /dev/loop0p1 does not exist.
So I cannot do a syslinux /dev/loop0p1.
I even cant use the device with dosemu:
# dosemu.conf
# $_hdimage="drives/* /dev/loop0"
Error from dosemu:
/dev/loop0 must be a partition, can't find number suffix.

Thanks for any further help.


Thomas Baumann // Postfach 110115 // D-64216 Darmstadt // <tom at tiri.li>

More information about the Syslinux mailing list