Bootloaders

From Alpine Linux
Revision as of 10:58, 25 June 2017 by Bun (talk | contribs) (Consistently use "bootloader")

By default Alpine uses Syslinux as bootloader. If you for any reason want to switch bootloaders or apply some manual configuration


Installing Syslinux

If you want to switch from another bootloader back to Syslinux, or if you for some reason want to install yslinux manually, the following steps are required.

Install the syslinux package:

apk add syslinux

If you're using GPT partitions, install the GPT MBR onto the drive you want to install the bootloader on (in this case /dev/sda):

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

Or if you're using DOS partitions, install the DOS MBR instead:

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


Next install the required Syslinux binaries. Despite being called extlinux, Syslinux supports booting from FAT12/16/32, NTFS, ext2/3/4, Btrfs, XFS, and UFS/FFS filesystems.

extlinux --install /boot

The configuration file is located in /boot/extlinux.conf. Alpine ships with a script called update-extlinux which automatically (re)generates this file, for example on updates to Syslinux. The settings for this script can be found in /etc/update-extlinux.conf, including the option to disable automatic overwriting of /boot/extlinux.conf. You can also place additional menu entries in the /etc/update-extlinux.d/ directory, e.g. for dual boating.


Installing GRUB

Todo: EFI example, dual boot scenarios.


To install GRUB in BIOS mode, (optionally) remove the Syslinux package and install the required GRUB packages:

apk del syslinux
apk add grub grub-bios

Next install the MBR and GRUB binaries to disk:

grub-install /dev/vda

GRUB ships with an automatic config generator, including some automatic detection of other operating systems installed on the device:

grub-mkconfig -o /boot/grub/grub.cfg

This script can be configured via the /etc/default/grub file. See [1] for a list of available options.