[syslinux] help: booting dos from syslinux/memdisk

Christian Marg christian.marg at tu-clausthal.de
Thu Jul 3 05:10:49 PDT 2003


Hello...

-------------------

> 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

This means, your disk.img file contains a valid harddisk image with a
partition table in sector 0 and a Partition starting at Sector 63 aka
CHS 1/1/0

> losetup -o 32256 /dev/loop0 disk.img

Here you setup the loop0-device to point to the start of the partition
_within_ the file. (Thats what the offset does!)

> I can even do a fdisk -l /dev/loop0

That doesn't make sense, because /dev/loop0 at best points to a valid
Boot record (first sector of a Partiton) but not to a Partition table
(ie. the first sector of your disk.img).

> Also assigning a letter to mtools is working.
> cat << EOF >> /etc/mtools.conf
> drive e: file="/dev/loop0"
> EOF
> 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

This is correct, since, as I said, the loop0 device points to your
actual partition.

> But how can I now transfer an OS to this image ?

Here comes a tricky part.

> The device /dev/loop0p1 does not exist.

That statement is correct. 

> So I cannot do a syslinux /dev/loop0p1.

Thats not correct. It should read syslinux /dev/loop0 because you want
to make the first partition in your disk.img bootable (remember the
offset)

Using dosemu is a little complicated, since you've got to throw away
most of the default configuration. DOSEMU with the default config
doesn't allow you to use the tags for mounting a harddisk image. So
you throw away the default config and use that tag (which you've got
to look up) in a "virgin" config file. I used a DOS floppy disk image
to boot 
DOSEMU and then sys to make the partition from the diskimage I also
mounted bootable.

bye
Christian
-- 
HiWi PC-Administration
Rechenzentrum TU-Clausthal



More information about the Syslinux mailing list