Syslinux

From Gentoo Wiki
(Redirected from Syslinux Bootloader)
Jump to: navigation, search
External resources

Syslinux is a package that contains a family of bootloaders, that are a good replacement to other "advanced" bootloaders such as GRUB. The syslinux package includes:

  • SYSLINUX - FAT filesystem bootloader
  • EXTLINUX - ext2/3/4 and btrfs filesystem bootloader
  • PXELINUX - Network PXE bootloader
  • ISOLINUX - ISO-9660 (CDROM) bootloader

Contents

Installation

Install sys-boot/syslinux:

→ Information about USE flags
USE flag Default Recommended Description
custom-cflags No No Build with user-specified CFLAGS (unsupported)
root # emerge --ask syslinux

Setup

Note
Assuming /dev/sda1 is the boot partition. If not: make adjustments!

MBR setup

root # dd bs=440 conv=notrunc count=1 if=/usr/share/syslinux/mbr.bin of=/dev/sda

Set the boot partition as active:

root # fdisk /dev/sda
Command (m for help): a
Partition number (1-4): 1
Command (m for help): p
 ...
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      133119       65536   83  Linux
/dev/sda2          133120     4327423     2097152   82  Linux swap / Solaris
/dev/sda3         4327424  1953525167   974598872   83  Linux

Command (m for help): w
 ...

GPT setup

root # dd bs=440 conv=notrunc count=1 if=/usr/share/syslinux/gptmbr.bin of=/dev/sda

Run gdisk and enable legacy BIOS boot partition attributes on the partition where /boot/extlinux is stored.

EXTLINUX setup

root # mkdir /boot/extlinux
root #
extlinux --install /boot/extlinux
root #
ln -snf . /boot/boot
Note
The "boot -> ." symlink is not necessary per se, but for the sake of consistency, it's made so the example configurations are the same for users with /boot on same partition and those with separate partitions.

SYSLINUX setup

root # syslinux --install /dev/sda1

PXELINUX setup

With PXELINUX is possible to netboot using images that are shared through a TFTP server. This article will assume there is a TFTP server installed, and it's TFTP root directory is in /var/lib/tftpboot. With this setup, copy the PXELINUX loader to the TFTP boot dir and create a config dir.

root # cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/pxelinux.0
root #
mkdir /var/lib/tftpboot/pxelinux.cfg

The config dir can be used to store different configurations for your netbooted clients. When a client tries to boot, the MAC address or the IP address is used to determine the appropriate client config file. First it tries to look for the MAC address, followed by a try on the hexadecimal representation of the client IP. Next, a character is stripped from the end of this value, until no more characters are left, or until a config file is found. If none of the tries match, the default config file is used.

The hexadecimal representation of an IP can be found with the following command:

user $ gethostip -x YOUR_IP

An example config file matching occurs as follows:

Code

01-88-99-aa-bb-cc-dd
C0A80032
C0A8003
C0A800
C0A80
C0A8
C0A
C0
C
default
Note
For easy maintenance, create config files by hostname and symlink to the IP representation. If you want a default netboot, just delete the symlink.

Modules

syslinux package contain various modules to support variants of features, starting with syslinux 5 some modules depends on others, its good idea to copy most basic modules regardless of usecase.

root # cp /usr/share/syslinux/{menu.c32,memdisk,libcom32.c32,libutil.c32} /boot/extlinux/

Configuration

Configuration file varies between bootloaders:

  • SYSLINUX: syslinux.cfg
  • EXTLINUX: extlinux.conf
  • ISOLINUX: isolinux.cfg

The configuration format is the same.

Simple configuration

This will give you a simple "boot:" prompt, similar to the one in Gentoo's Minimal LiveCD:

File/boot/extlinux/extlinux.conf

DEFAULT gentoo

LABEL gentoo
      LINUX /boot/kernel-3.6.11-gentoo

Menu configuration

The following configuration provides a simple text menu example.

This is done via the vesamenu module, in some cases where vesa is not compatible, the simpler menu module will work.

Copy the VESA menu module into the boot filesystem:

root # cp /usr/share/syslinux/vesamenu.c32 /boot/extlinux/
File/boot/extlinux/extlinux.conf

TIMEOUT 30
ONTIMEOUT gentoo

UI vesamenu.c32
MENU TITLE Boot

LABEL gentoo
      MENU LABEL Gentoo Linux
      LINUX /boot/kernel-3.6.11-gentoo

LABEL gentoo-old
      MENU LABEL Gentoo Linux (previous kernel)
      LINUX /boot/kernel-3.5.7-gentoo
Note
Avoid using 'KERNEL' for selecting the kernel images, use LINUX instead, As example, if you use KERNEL and the image ends with .0 the extlinux will misunderstand it and try to PXE it ending with a screen graphical artefacts and nothing else.
Personal tools
Namespaces

Variants
Actions
Gentoo Websites logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Navigation
Toolbox
Categories