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.
= systemd-boot=
{{Todo|Work in progress. It is mostly done in Linux basics but doesn't cover topics like creating entries for other Operating Systems.}}
Systemd-boot is the simple EFI bootloader part of the systemd project. It is also available in the Alpine Linux testing repository as a standalone component.
== Installing ==
To install the systemd-boot, enable the testing repository, and install the <code>systemd-boot</code> package. Then make sure the boot and EFI partitions are mounted as read-write and install the bootloader with <code>bootctl</code>.
<pre>
# apk add systemd-boot
# bootctl install
</pre>
The <code>bootctl</code> binary also has support for checking if the bootloader is installed.
<pre>
# bootctl is-installed
yes
</pre>
== Configuring ==
Example configuration files for alpine are available on <code>/usr/share/systemd/bootctl</code> as <code>loader.conf</code> and <code>alpine.conf</code>.
The bootloader (not the boot entries) can be configured via the [https://www.freedesktop.org/software/systemd/man/loader.conf.html# loader.conf] file, an example is available in <code>/usr/share/systemd/bootctl/loader.conf</code>.
systemd-boot makes use of configuration files in <code>/boot/loader/entries</code> to list entries for different OSes it can boot into. An example file for Alpine Linux is present on <code>/usr/share/systemd/bootctl/alpine.conf</code>.
The example file has a skeleton structure that requires minimal modifications to make them work. You need to modify the example file to fit your oeprating system, among them:
* Replace root=UUID=XXXX with the UUID of the root partition. (Or remove UUID= altogether and use PARTUUID=, LABEL= or plain /dev/sdXY)
* Replace rootfstype with the filesystem used for the root filesystem.
* Add boot options required/recommended for booting your operating system (E.g: cryptdm=, cryptroot=, modules=, etc).
* (If you don't use the default linux-lts kernel) Replace vmlinuz-lts and initramfs-lts with the ones that are used.
* (If you use an Intel CPU and need Intel microcode) add <code>initrd /intel-ucode.img</code> before the initrd call for the initramfs
All the options available are documented in the [https://systemd.io/BOOT_LOADER_SPECIFICATION/ systemd boot loader specification] under Technical Details.
=== Unified Kernel Images ===
Systemd-boot also accepts unified kernel images, as outlined in their [https://systemd.io/BOOT_LOADER_SPECIFICATION/#type-2-efi-unified-kernel-images document]. They are a combination of various pieces that are usually separate when normally booting, like the kernel, the initramfs and the kernel commandline.
To generate a unified kernel image the <code>objcopy</code> binary can be used:
The above can be signed, with the bootloader, for use in Secure Boot.
Users that require CPU microcode (like intel-ucode) can include it by concatenating the CPU microcode .img file before the normal initramfs into a single .img file.
Then use that in the .initrd section of the <code>objcopy</code> call.
== Listing Information and Status ==
<code>bootctl</code> can also list the entries available, which one is default and a wealth of information from them. (Example from Alpine Linux developer Leo, which inculdes an entry and a Unified Kernel Image)
And it can also list general status of the system, including information on the current bootloader, the system firmware and options (like if Secure Boot is enabled).
When the <code>systemd-boot</code> package is updated the bootloader installed needs to be updated as well:
<pre>
# bootctl update
</pre>
== Removing ==
If for any reason you wish to not use systemd-boot anymore then the <code>bootctl</code> binary also provides a command for easily removing the files that were installed with the install command:
* [https://wiki.archlinux.org/index.php/systemd-boot ArchWiki extensive article on systemd-boot]
[[Category:Installation]]
[[Category:Installation]]
[[Category:Booting]]
[[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):
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:
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: