[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howtos:slackware_admin:linux_kernel_options_for_uefi_and_elilo [2013/12/14 11:30 (UTC)] – [Sources] Remove the 'template' tag alienbobhowtos:slackware_admin:linux_kernel_options_for_uefi_and_elilo [2021/01/11 07:07 (UTC)] (current) – fix for mmcblk louigi600
Line 5: Line 5:
 The following options are required for booting a kernel from UEFI. These are already set in the stock Slackware kernels. The following options are required for booting a kernel from UEFI. These are already set in the stock Slackware kernels.
  
-<note important>Booting from UEFI requires that the kernel be the same bitness as the UEFI firmware. This usually means 64-bit, with the exception of older (pre-2008) Apple Macs and Intel Server boards using EFI v1.10 in 32-bit mode, and some Intel Cloverfield ultrabooks. However, you can still enable 32-bit emulation in the kernel and run 32-bit programs in Linux using multilib.</note>+<note important>Booting from UEFI requires that the kernel be the same bitness as the UEFI firmware. This usually means 64-bit, with the exception of new Intel Atom System-on-Chip (2013), older (pre-2008) Apple Macs and Intel Server boards using EFI v1.10 in 32-bit mode, and some Intel Cloverfield ultrabooks. However, you can still enable 32-bit emulation in the kernel and run 32-bit programs in Linux using multilib.</note>
  
-**Enable the block layer** +  * **Enable the block layer** 
->> Partition Types +    Partition Types 
->>> Advanced partition selection +      Advanced partition selection 
->>>> EFI GUID Partition support (CONFIG_EFI_PARTITION)+        EFI GUID Partition support (CONFIG_EFI_PARTITION [=y])
  
-**Processor type and features** +  * **Processor type and features** 
->> EFI runtime service support (CONFIG_EFI) +    EFI runtime service support (CONFIG_EFI [=y]
->> EFI stub support (CONFIG_EFI_STUB) +    EFI stub support (CONFIG_EFI_STUB [=y]
->> Build a relocatable kernel (CONFIG_RELOCATABLE)+    Build a relocatable kernel (CONFIG_RELOCATABLE [=y])
  
-**Device Drivers** +  * **Device Drivers** 
->> Graphics support +    Graphics support 
->>> Support for frame buffer devices (CONFIG_FB) +      Support for frame buffer devices (CONFIG_FB [=y]
->>>> EFI-based Framebuffer Support (CONFIG_FB_EFI)+        EFI-based Framebuffer Support (CONFIG_FB_EFI [=y])
  
-**File systems** +  * **File systems** 
->> Miscellaneous filesystems +    Miscellaneous filesystems 
->>> EFI Variable filesystem (CONFIG_EFIVAR_FS)+      EFI Variable filesystem (CONFIG_EFIVAR_FS [=y])
  
 <note important>You should **DISABLE** the old efivars sysfs interface found at: <note important>You should **DISABLE** the old efivars sysfs interface found at:
-**Firmware Drivers** +  * **Firmware Drivers** 
->> EFI (Extensible Firmware Interface) Support +    EFI (Extensible Firmware Interface) Support 
->>> EFI Variable Support via sysfs (CONFIG_EFI_VARS)+      EFI Variable Support via sysfs (CONFIG_EFI_VARS [=n])
 as it is deprecated in favor of CONFIG_EFIVAR_FS, because it has a 1024-byte variable size limit, and because it can [[https://lkml.org/lkml/2013/4/16/473|cause data inconsistency issues]]. as it is deprecated in favor of CONFIG_EFIVAR_FS, because it has a 1024-byte variable size limit, and because it can [[https://lkml.org/lkml/2013/4/16/473|cause data inconsistency issues]].
-However, if you do disable this, you will need a fork of the ''efibootmgr'' program that supports the new EFI Variable filesystem found at: +However, if you do disable this, you will need a fork of the ''efibootmgr'' program that supports the new EFI Variable filesystem.
-https://github.com/vathpela/efibootmgr/tree/libefivars+
 </note> </note>
 +==== Using the new EFI variable filesystem ==== 
 +In order to use the new EFI variable filesystem interface, you need to remove the old ''efibootmgr'' program and replace it with a new one that supports the EFI variable filesystem. 
 +  - Download and install: https://github.com/vathpela/efivar 
 +  - Download and install: https://github.com/rhboot/efibootmgr 
 +  - Run:<code> 
 +modprobe efivarfs 
 +mount -t efivarfs efivarfs /sys/firmware/efi/efivars 
 +efibootmgr 
 +</code> 
 +==== The EFI System Partition (ESP) ==== 
 +In order to boot from UEFI you need to create an EFI System Partition (ESP) using ''gdisk'' or ''cgdisk'' instead of the old ''fdisk'' and ''cfdisk''. The Slackware [[ftp://mirrors.usc.edu/pub/linux/distributions/slackware/slackware64-14.1/README_UEFI.TXT|README_UEFI.TXT]] recommends a size of 100M, which is also the minimum partition size (except for 4K native drives, where it is 260M). You also need to set the partition hex code to ''EF00'', which identifies it as the ESP.
 ==== UEFI and ELILO ==== ==== UEFI and ELILO ====
-During the install procedure of Slackware 14.1 for ELILO (the ''eliloconfig'' script), the following happens and is required for booting from UEFI using ELILO.+During the install procedure of Slackware 14.1 or above for ELILO (the ''eliloconfig'' script), the following happens and is required for booting from UEFI using ELILO.
  
   - The EFI System Partition (ESP) is located and mounted. On a running system it is usually found already mounted at ''/boot/efi''. This is a special FAT partition that is basically the UEFI firmware replacement of what the MBR was for BIOS. However, it can not only hold a bootloader (all the MBR was capable of), but also config files, the kernel, and other things you might want to access using the UEFI firmware.   - The EFI System Partition (ESP) is located and mounted. On a running system it is usually found already mounted at ''/boot/efi''. This is a special FAT partition that is basically the UEFI firmware replacement of what the MBR was for BIOS. However, it can not only hold a bootloader (all the MBR was capable of), but also config files, the kernel, and other things you might want to access using the UEFI firmware.
Line 44: Line 53:
     - The kernel, usually titled ''vmlinuz''     - The kernel, usually titled ''vmlinuz''
   - A boot entry variable is registered in the UEFI firmware using ''efibootmgr''. The exact command that is run is <code bash>   - A boot entry variable is registered in the UEFI firmware using ''efibootmgr''. The exact command that is run is <code bash>
-EFI_DEVICE=$(mount | grep vfat | grep -w /boot/efi | cut -b 1-8+EFIDISK=$(df  /boot/efi|awk 'END{printf("%s\n",$1)}'
-EFI_PARTITION=$(mount | grep vfat | grep -w /boot/efi | cut --d ' ' | cut -b 9-)+EFI_DEVICE=$(sed 's%[0-9]\+$%%;s%\([0-9]\)p%\1%<<< $EFIDISK) 
 +EFI_PARTITION=$(sed 's%.*[a-z]\([0-9]\+\)$%\1%' <<< $EFIDISK)
 efibootmgr -q -c -d $EFI_DEVICE -p $EFI_PARTITION -l "\\EFI\\Slackware\\elilo.efi" -L "Slackware" efibootmgr -q -c -d $EFI_DEVICE -p $EFI_PARTITION -l "\\EFI\\Slackware\\elilo.efi" -L "Slackware"
 </code> so if ''mount'' outputs <code>/dev/sda1 on /boot/efi type vfat (rw)</code>EFI_DEVICE would be ''/dev/sda'' and EFI_PARTITION would be ''1'', each components of ''/dev/sda1'', which is the ESP. </code> so if ''mount'' outputs <code>/dev/sda1 on /boot/efi type vfat (rw)</code>EFI_DEVICE would be ''/dev/sda'' and EFI_PARTITION would be ''1'', each components of ''/dev/sda1'', which is the ESP.
Line 51: Line 61:
 ==== Upgrading your kernel ==== ==== Upgrading your kernel ====
 This task is now much easier than it used to be. All you really need to do is copy ''vmlinuz'' onto the ESP on top of the old kernel. No need to edit any configs or add any boot entries, unless you want to. Note that you can edit the config in place and ELILO will pick up the changes on next boot, no need to run any commands like with the old lilo. This task is now much easier than it used to be. All you really need to do is copy ''vmlinuz'' onto the ESP on top of the old kernel. No need to edit any configs or add any boot entries, unless you want to. Note that you can edit the config in place and ELILO will pick up the changes on next boot, no need to run any commands like with the old lilo.
 +==== Updating your UEFI firmware ====
 +As all UEFI firmware has a flashing utility built-in, it is now much easier to update the firmware. All you have to do is copy the new firmware onto the ESP and the UEFI firmware should recognize it when you go to the flashing utility menu. However, remember that flashing the firmware can still potentially brick the system, especially if it is interrupted during the flashing process.
 +<note important>
 +Updating your UEFI firmware may reset your settings and prevent you from booting unless you plan ahead.
 +</note>
 +==== My UEFI settings were reset and I can't boot, or planning ahead to avoid surprises ====
 +This can happen either after updating the UEFI firmware or after replacing the CMOS battery. There are three main ways to fix it:
 +  - Probably the easiest and most convenient way is to use the default boot location. Note that some UEFI firmwares do NOT support the default boot location, so this will not work. However, if it does, you won't have to worry about the system not booting again. To do this you can boot into the Slackware install DVD, mount the ESP and copy the files to the following places:
 +    - ''elilo.efi'' -> ''/EFI/boot/bootx64.efi''
 +    - ''elilo.conf'' -> ''/EFI/boot/elilo.conf''
 +    - ''vmlinuz'' -> ''/EFI/boot/vmlinuz''
 +  - You can boot into the Slackware install DVD, run through the menus, and reinstall elilo.
 +  - You can download and install one of the following EFI shells to the root directory of your ESP (that is ''/'' NOT ''/EFI'').
 +    - [[https://svn.code.sf.net/p/edk2/code/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi|This version supports only UEFI version 2 and up]]
 +    - [[http://dl.dropbox.com/u/17629062/Shell2.zip | This version may support earlier UEFI versions]]
 +    - Boot into the shell and run: <code>bcfg boot add 0 fs0:\EFI\Slackware\elilo.efi Slackware</code>
 +==== External Links ====
 +[[http://blog.uncooperative.org/blog/2014/02/06/the-efi-system-partition/|A comprehensive analysis of the ESP and default boot behavior.]]
 ====== Sources ====== ====== Sources ======
   * Original author: [[wiki:user:metaschima]]   * Original author: [[wiki:user:metaschima]]
 howtos:slackware_admin:linux_kernel_options_for_uefi_and_elilo ()