What is a SYSLINUX disk ?
Throughout the Syslinux wiki, the term "disk" is used for a storage medium which can host a random-access read-write filesystem.
For SYSLINUX, frequently the filesystem is some variant of FAT, e.g. FAT32/16/12. SYSLINUX can also be installed on NTFS, and EXTLINUX supports some additional filesystems, such as ext2/3/4 and btrfs.
There are optical disc (not "disk") families of CD, DVD, and BD (Blu-ray). Optical media uses the ISO9660 filesystem, and can boot by means of "The El Torito" specification, which includes 3 alternative boot modes:
- floppy emulation (using SYSLINUX)
- hard disk emulation (using SYSLINUX)
- no emulation (using ISOLINUX)
In addition to real media, regular data files qualify as SYSLINUX disks if they get prepared with a supported filesystem, typically FAT. It can include MBR, or GPT, or otherwise be a "partitionless" media (e.g. floppy).
After its preparation, such a data file is called a disk image. For booting it with real hardware, it usually has to be written onto a real storage device. e.g. onto a USB pen drive attached to a Linux system as "/dev/sdX". (Make sure to use the right device address and to backup any valuable content of the pen drive before proceeding.)
One possible method to write "my_disk.img" to the "sdc" device is:
dd if=my_disk.img of=/dev/sdc conv=fdatasync
Nevertheless, there are occasions where disk image files are part of a boot process, without occupying a whole own storage device. Such case is out of the scope of this article.
Installing SYSLINUX on disk images under Linux
The following procedures refer to a disk image with MBR.
We need to know the start address of the partition with the FAT filesystem:
/sbin/fdisk -lu my_disk.img
which displays a result similar to:
Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Device Boot Start End Blocks Id System my_disk.img1 * 32 511999 255984 6 FAT16
In the above result, note the start address by the number underneath "Start" (32 sectors in the above example).
Multiply it by 512 bytes. The result can be used with mount option "-o offset=" and with the "-t" (aka "--offset") option of the SYSLINUX installer.
In this example the respective commands would be:
mount -o loop,offset=16384 my_disk.img /mnt/my_disk_root
syslinux --directory /boot/syslinux/ -t 16384 --install my_disk.img
An example of disk image production is the Howto for hard disk images. It uses other means to apply the offset to mount, though. It lets losetup create a loop device for the image and another one for the partition in it. As always, the SYSLINUX installer operates on the partition device.