GNU/Linux distributions need bootloaders during installation. These bootloaders are responsible for loading system files that run when you install any GNU/Linux distro. If you are developing any GNU/Linux distribution, you may need to work with bootloaders so users can install it on their systems.
One such bootloader is Syslinux. There are several types of Syslinux, each dedicated to a specific file system. Here’s everything you need to know about Syslinux bootloaders, including how to install them.
SYSLINUX is Syslinux’s variant for FAT file systems. Also, this is the oldest type of Syslinux bootloader. It supports FAT12, FAT16, and FAT32 file systems. If you are using Windows or DOS, SYSLINUX is the one you should go for.
Structure of SYSLINUX
If you download SYSLINUX using mirror links, you will get a compressed archive. When you open this folder, you’ll see the bios directory inside. Under this folder, there are mbr and core directories.
At the boot sector stage of the disk, you require the mbr.bin file located in the /bios/mbr directory. Inside the /bios/core directory, you can see the ldlinux.sys file, which is the core file of SYSLINUX.
ldlinux.sys needs the ldlinux.c32 file to work. Therefore, ldlinux.c32 and ldlinux.sys must be in the same directory.
Other files must also be in the current directory path or subdirectories of the current directory path. You can have a look at the syslinux.cfg config file for this. It must be in the current directory path and you’ll have to create this file yourself.
Optionally, you can find plugins, help files, and other configuration files under the parent directory.
You can see the location of the SYSLINUX installation files according to the systems in the table below:
The default commands you can use to install SYSLINUX on a disk are as follows:
syslinux -m -a -d <directory> <partition>
syslinux64 -m -a -d <directory> <partition>
syslinux -i <partition>
The EXTLINUX bootloader supports ext2, ext3, ext4, btrfs, FAT12, FAT16, FAT32, NTFS, XFS, HFS, and UFS file systems. The working logic and file structure of EXTLINUX is exactly the same as SYSLINUX. It’s just more advanced in terms of file system support and has a few additional features.
EXTLINUX is a good choice if you want to install the GNU/Linux kernel on your computer. You can install EXTLINUX first and immediately place the GNU/Linux kernel on top of this partition.
Other details you should know, EXTLINUX has been available since version 3.00 of Syslinux. Also, those who use different versions should know that ext4, btrfs, FAT12, FAT16, and FAT32 support came to EXTLINUX in version 4.00, NTFS support in version 4.05, XFS support in version 5.00, and UFS support with HFS came in version 5.00.
Structure of EXTLINUX
Just like SYSLINUX, EXTLINUX’s core file is ldlinux.sys. The rules specified in SYSLINUX regarding the directory of the core file also apply here. Unlike SYSLINUX, the configuration file for EXTLINUX is extlinux.conf.
If you downloaded the most recent version of Syslinux, you can find a setup file in the /bios/extlinux folder. You can utilize this file with certain command-line options.
You can use the following command for installing the bootloader:
extlinux --install <current-directory-path>
Also, other parameters you can use are:
extlinux --update <current-directory-path>
extlinux --raid --install <current-directory-path>
extlinux --once /initrd.img root=/dev/sda0 initrd=initrd.img vga=794 /boot/extlinux
In EXTLINUX, you can easily make any initial specification from the command line. This system is called the Auxillary Data Vector (ADV). You can see how to use it in the following examples:
extlinux --once /initrd.img root=/dev/sda0 initrd=initrd.img vga=794 /boot/extlinux
extlinux --clear-once <current-directory-path>
extlinux --reset-adv <current-directory-path>
Some Features of EXTLINUX
Unlike SYSLINUX, EXTLINUX can access any directory on the storage unit. The naming of directory paths is the same as in GNU/Linux. If there is no “/” sign, EXTLINUX uses the current directory. You can use a directory path up to 511 characters in length.
Also, EXTLINUX supports aliases. However, you should not keep these aliases too long, because you may get stuck in the path block. When using aliases, you only need to do Linux-type directory naming.
If you are going to use Syslinux for CDs and DVDs, you should be familiar with ISOLINUX. But nowadays, USBs are more prevalent than CDs and DVDs. Therefore, ISOLINUX usage is less than other Syslinux types.
What You Need to Install ISOLINUX
To install ISOLINUX, you need to download Syslinux first. You’d need software like a CD or DVD burner to install ISOLINUX. Also, if you are going to use DVDs, the DVD burner must support boot disc creation. Note that if you burn ISOLINUX to a non-rewritable CD or DVD, you may not be able to use your CD again. Therefore, it makes sense to use a rewritable CD for this.
Structure of ISOLINUX
The core directory stores the isolinux.bin file. If you are going to create an image, you also need the boot.cat file.
The current directory must contain the ISOLINUX configuration files, namely isolinux.cfg or syslinux.cfg. This file is not created or copied during the installation process, so you have to manually make the necessary adjustments. If this file is not found, ISOLINUX tries to open an image named Linux without parameters and throws an error stating that the image could not be found.
ISOLINUX vs. mkisofs
To create an ISOLINUX CD image, you can use the mkisofs program. Be sure to use the latest stable version of the utility.
Example usage of mkisofs is as follows:
mkisofs -o <iso-image-to-create> -b <current-directory>/isolinux.bin -c <current-directory>/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table <directory-of-files-and-directory-to-be-put-in-the-image>
As obvious, you don’t have to use the aforementioned command as is. You can also use these parameters separately.
File Naming Supported by ISOLINUX
In ISOLINUX, the separating character in directory paths are in the UNIX format and use the slash (/) character. A single / indicates the current directory of ISOLINUX. In ISOLINUX, directory paths must be a maximum of 255 characters. It only uses the ISO 9660 file naming and it’s necessary to use Level one (8.3 characters) or Level two (31 characters) of ISO 9660.
Additionally, there are some things you should keep in mind:
- ISOLINUX discrete files, spaced type, logical block, and sectors supported size is only 2048 bytes
- When mounting an ISOLINUX installed image in GNU/Linux, you must add the norock, nojoliet attribute of the -o parameter to the mount command
- If the computer has problems opening ISOLINUX, use isolinux-debug.bin instead of isolinux.bin when installing ISOLINUX. This way you can see the error messages.
ISOLINUX for Hard Drives
ISOLINUX supports multiple ISO images since version 3.72. You can use the isohybrid tool to create multiple ISO images from a CD or DVD image with ISOLINUX installed.
Its usage is as follows:
However, with this process, the size of the image file increases by an average of 1MB.
PXELINUX is a type of Syslinux used to load the operating system from a TFTP server. It’s for workstations that operate without a disk volume. It helps when installing network adapter PXE (Pre Execution Environment) from a server using BOOTP or TFTP protocols with DHCP.
To use PXELINUX, you require a BOOTP or TFTP server and a bootable computer from another network or virtualization software.
Structure of Pxelinux
In the BOOTP or TFTP server directory, the core file pxelinux.0 must be located in the root directory. If you downloaded the latest version, this file is in /bios/core. Also, PXELINUX’s configuration file is pxelinux.cfg. You can find optional plugins, help files, images, and other configuration files under the current directory.
The Syslinux Bootloader Type Depends on Your Goals
To be able to use your GNU/Linux distribution on other devices and carry it around comfortably, you need a bootloader. Syslinux is just one of these bootloaders. You can choose one of the Syslinux varieties depending on your intended use case and target environments.
Moreover, these Syslinux types will vary depending on where and how you move your GNU/Linux distribution or kernel. Apart from Syslinux, you can also use other bootloaders as an alternative.