[syslinux] Installing syslinux on a purely virtual disk

Dany St-Amant dany.ephemeral.2014 at icloud.com
Fri Apr 19 09:10:11 PDT 2019

Interesting challenge.

The floppy plugin limitations don't seem to play nice with syslinux normal installation and loading
- no write support
- no MBR code,  no VBR code
- cluster/LBA location not fixed (will change if files added to source location)
- no dynamic refresh of added file at source location
Here floppy seems to be a misnomer as floppy do not have partition table, it's more a 'single FAT partition hard disk' plugin.

The location of the first sector of ldlinux.sys must be known to the VBR, and the location of remaining ldlinux.sys sectors must be known to ldlinux.sys. (Note that ldlinux.sys also contains another modifiable section.)

If I were you, I'd explore using the "wasted" sectors between the MBR and VBR (sector 1 to 2047), to make ldlinux.sys available through a fixed location in that area (either as a real region or as a remapping toward the file ldlinux.sys). Such fixed location has the advantage of not requiring the floppy plugin to know about the internals of syslinux.

By modifying/cloning linux/syslinux.c, one could easily get a 'fixlinux --at 1024' to produce a virtual VBR and ldlinux.sys which can then then be used by the floppy plugin to provide the VBR (sector 2048 aka floppy->bootsect) and data for read issued at sector 1024+ for ldlinux.sys. If this new 'fixlinux' output to stdout a concat of the VBR (always 512 bytes) and ldlinux.sys, the floppy plugin could dynamically create the proper information without the need of intermediary files.

Disclaimer: I am not one of the main syslinux developer, so my understanding of its behaviour might be flawed.


> Le 18 avr. 2019 à 16:07, Richard W.M. Jones via Syslinux <syslinux at syslinux.org> a écrit :
> I'm trying to add boot support to
> https://github.com/libguestfs/nbdkit/tree/master/plugins/floppy
> This NBD server plugin generates a completely virtual FAT filesystem
> and partition table.  Nothing is ever written to a file, and it must
> run without anything needing to be root, loop mounting etc.  Running
> "syslinux --install <something>" is a non-starter.
> So I've looked at how syslinux works and I see that it adds the files
> LDLINUX.SYS and LDLINUX.C32 to the FAT filesystem -- I can easily
> emulate this bit in the plugin since we are already creating a full
> FAT32 filesystem on the fly.
> However the problem is that syslinux also creates a boot sector [ie.
> core/bios/diskboot.inc in the syslinux source] and I suppose it must
> encode the offset of the LDLINUX.SYS file.  I haven't quite worked out
> the details.
> The question, is there a way to simulate the work that syslinux does
> in a reasonably supportable way that won't break on future updates of
> syslinux?
> Rich.
> -- 
> Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> Read my programming and virtualization blog: http://rwmj.wordpress.com
> virt-df lists disk usage of guests without needing to install any
> software inside the virtual machine.  Supports Linux and Windows.
> http://people.redhat.com/~rjones/virt-df/
> _______________________________________________
> Syslinux mailing list
> Submissions to Syslinux at syslinux.org
> Unsubscribe or set options at:
> https://lists.syslinux.org/syslinux

More information about the Syslinux mailing list