[syslinux] help: booting dos from syslinux/memdisk

Christian Marg christian.marg at tu-clausthal.de
Fri Jul 4 04:52:39 PDT 2003


> mkdiskimage disk 8 64 63
> cfdisk -c 8 -h 64 -s 63 disk

It seems like mkdiskimage already creates a partition with bootflag
inside the disk image, so there is no need to run an fdisk program.
Its just informative.

> losetup -o 32256 /dev/loop0 disk
> mlabel -N 00 e:MYDISK
> mdir e:

mlabel and mdir both work OK because you used losetup correctly and
assigned e: to /dev/loop0

> syslinux /dev/loop0

Now your disk image is bootable. Mount /dev/loop0 to your favorite
mount point, put the needed files in it, unmount it, delete the
/dev/loop0 assignment using losetup ( /d I think) and use your image.
Everything seems to be fine from what you wrote. 

> ############## >>> Why overwrites syslinux my partitiontable ?

Because you still didn't get  it:
The Partition table is located in the first sector of a Harddisk (ie.
first 512 Bytes of your Image) while the first partition Boot record
is located in the 64th sector of the Harddisk (ie. 512 Bytes from
offset 32256 in your image). This is where Syslinux should go. And by
pointing /dev/loop0 to offset 32256 and using syslinux /dev/loop0 you
did just that.

You have to understand: If you want to view the partition table point
your fdisk program (be it fdisk or cfdisk) to offset 0 of your disk
image (by entering the filename as device name)
If you want some program to write to the Boot record of your Partition
point it to offset 32256 (in this case) by using the /dev/loop0 you
setup previously.
If you want to mount the Dos volume (starting with the boot record)
point your mount program to offset 32256 (in this case) by using the
/dev/loop0 you setup previously.

PS: If you still feel the urge to mail verbose logs please mail them
to me privately and not to the list...
HiWi PC-Administration
Rechenzentrum TU-Clausthal

More information about the Syslinux mailing list