Bootloaders: Difference between revisions

From Alpine Linux
m (Fix broken sentence)
No edit summary
(28 intermediate revisions by 7 users not shown)
Line 5: Line 5:
= Installing Syslinux =
= 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.
If you want to switch from another bootloader back to Syslinux, or if you for some reason want to install Syslinux manually, the following steps are required.


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




= Installing GRUB =
== EFI ==


{{Todo|EFI example, dual boot scenarios.}}
{{Todo|Work in progress. This should at least get you started.}}
 
Assuming <code>/mnt</code> is a FAT32 partition of type EF00 and <code>/boot</code> belongs to the rootfs created after running <code>setup-disk</code>:
 
<pre>
mkdir -p /mnt/EFI/syslinux
cp /usr/share/syslinux/efi64/* /mnt/EFI/syslinux/
cp /boot/extlinux.conf /mnt/EFI/syslinux/syslinux.cfg
cp /boot/vmlinuz* /mnt/
cp /boot/initramfs* /mnt/
</pre>
 
You may need to modify <code>/mnt/EFI/syslinux/syslinux.cfg</code> to change the paths to absolute paths (just add a / in front of the vmlinuz/initramfs entries),
or copy the files to <code>/mnt/EFI/syslinux</code> instead (XXX: untested).
 
= GRUB =


To install GRUB in BIOS mode, (optionally) remove the Syslinux package and install the required GRUB packages:
To install GRUB in BIOS mode, (optionally) remove the Syslinux package and install the required GRUB packages:
Line 40: Line 55:
apk add grub grub-bios</pre>
apk add grub grub-bios</pre>


Next install the MBR and GRUB binaries to disk:
For EFI, install Grub's EFI package instead. Note that <code>/boot</code> has to be an EFI compatible filesystem like FAT32.
 
<pre>apk add grub-efi</pre>
 
Next install the MBR and GRUB binaries to disk for BIOS mode:


<pre>grub-install /dev/vda</pre>
<pre>grub-install /dev/vda</pre>
For EFI mode:
<pre>grub-install --target=x86_64-efi --efi-directory=/boot</pre>


GRUB ships with an automatic config generator, including some automatic detection of other operating systems installed on the device:
GRUB ships with an automatic config generator, including some automatic detection of other operating systems installed on the device:
Line 50: Line 73:
This script can be configured via the <code>/etc/default/grub</code> file.
This script can be configured via the <code>/etc/default/grub</code> file.
See [https://www.gnu.org/software/grub/manual/html_node/Simple-configuration.html] for a list of available options.
See [https://www.gnu.org/software/grub/manual/html_node/Simple-configuration.html] for a list of available options.
= External Links =
* [https://www.denx.de/wiki/U-Boot/ReleaseCycle U-Boot Release Cycle]


[[Category:Installation]]
[[Category:Installation]]
[[Category:Booting]]

Revision as of 09:02, 2 February 2020

By default Alpine uses Syslinux as bootloader. This page shows the basic steps you need to perform, 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 Syslinux 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 booting.


EFI

Todo: Work in progress. This should at least get you started.


Assuming /mnt is a FAT32 partition of type EF00 and /boot belongs to the rootfs created after running setup-disk:

mkdir -p /mnt/EFI/syslinux
cp /usr/share/syslinux/efi64/* /mnt/EFI/syslinux/
cp /boot/extlinux.conf /mnt/EFI/syslinux/syslinux.cfg
cp /boot/vmlinuz* /mnt/
cp /boot/initramfs* /mnt/

You may need to modify /mnt/EFI/syslinux/syslinux.cfg to change the paths to absolute paths (just add a / in front of the vmlinuz/initramfs entries), or copy the files to /mnt/EFI/syslinux instead (XXX: untested).

GRUB

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

For EFI, install Grub's EFI package instead. Note that /boot has to be an EFI compatible filesystem like FAT32.

apk add grub-efi

Next install the MBR and GRUB binaries to disk for BIOS mode:

grub-install /dev/vda

For EFI mode:

grub-install --target=x86_64-efi --efi-directory=/boot

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.

External Links