Skip to content

Instantly share code, notes, and snippets.

@laris
Last active October 26, 2018 04:41
Show Gist options
  • Save laris/a00d1f37650ab6cfa9948e6aba2df757 to your computer and use it in GitHub Desktop.
Save laris/a00d1f37650ab6cfa9948e6aba2df757 to your computer and use it in GitHub Desktop.
EFI_Shells_and_Scripting_by_Intel.md

EFI-Boot-process http://itman.in/efi-boot/

# EFI boot process

The boot process when using EFI is different from the boot process of the computer with the BIOS

When using EFI, the following happens:

  1. EFI bootloader starts. Its task is to select a device for further loading, similar to the user choosing a device when using BIOS .

  2. After selecting a device, the bootloader finds the system partition on the disk (EFI System partition) and downloads a file from it that is responsible for further loading of the operating system. This file is always located at the same address. For amd64, this is  /efi/boot/bootx64.efi

    .

    ESR is determined by the loader by a specific GUID and formatted in the FAT system.

  3. After transferring control to the OS loader from the ESR system partition, the further process continues as usual and depends on the operating system.

Content [ hide ]

Description by Redhat

GRUB loads itself into the memory in stages:

  1. UEFI platforms read the partition table and connect an ESP partition (EFI System Partition) - a VFAT partition with a unique GUID (Globally Unique Identifier). ESP contains EFI applications — loaders and utilities. In Red Hat Enterprise Linux 6, this is a section  /boot/efi/ , and EFI programs are located at  /boot/efi/EFI/redhat/ .

  2. /boot/efi/EFI/redhat/ содержит grub.efi — версию загрузчика, скомпилированную специально для EFI. В самом простом случае менеджер загрузки EFI выбирает этот файл в качестве загрузчика и загружает его в память.

    Если раздел ESP содержит другие программы EFI, менеджер загрузки предложит выбрать программу для выполнения.

  3. Как только GRUB определит операционную систему или ядро для загрузки, они будут загружены в память и им будет передано управление.

Так как производители оборудования обычно добавляют собственные каталоги в раздел ESP, необходимо создать условия для цепной загрузки. Менеджер загрузки EFI может запустить загрузчики любых операционных систем, если они расположены в ESP.

Booting an OS using UEFI ****

UEFI firmware does not support booting through the above mentioned method which is the only way supported by BIOS**.** UEFI has support for reading both the partition table as well as understanding filesystems.

The commonly used UEFI firmwares support both MBR and GPT partition table**.** EFI in Apple-Intel Macs are known to support Apple Partition Map also apart from MBR and GPT**.** Most of the UEFI firmwares have support for accessing FAT12 (floppy disks) , FAT16 and FAT32 filesystems in HDD and ISO9660 (and UDF) in CD/DVDs**.** EFI in Apple-Intel Macs can access HFS/HFS+ filesystems also apart from the mentioned ones**.**

UEFI does not launch any boot code in the MBR whether it exists or not**.** Instead it uses a special partition in the partition table called «EFI SYSTEM PARTITION» in which files required to be launched by the firmware are stored**.** Each vendor can store its files under /EFI// folder and can use the firmware or its shell (UEFI shell) to launch the boot program**.** An EFI System Partition is usually formatted as FAT32**.**

Under UEFI, every program whether they are OS loaders or some utilities (like memory testing apps) or recovery tools outside the OS, should be a UEFI Application corresponding to the EFI firmware architecture**.** Most of the UEFI firmware in the market, including recent Apple Macs use x86_64 EFI firmware**.** Only some older macs use i386 EFI firmware while no non-Apple UEFI system is known to use i386 EFI firmware**.**

Note: Some older Intel Server boards are known to operate on Intel EFI 1**.**10 firmware, and require i386 EFI applications.

A x86_64 EFI firmware does not include support for launching 32-bit EFI apps unlike the 64-bit Linux and Windows which include such support**.** Therefore the bootloader must be compiled for that architecture correctly**.**

Multibooting on UEFI ****

Since each OS or vendor can maintain its own files within the EFI SYSTEM PARTITION without affecting the other, multi-booting using UEFI is just a matter of launching a different UEFI application corresponding to the particular OS’s bootloader**.** This removes the need for relying on chainloading mechanisms of one bootloader to load another to switch OSes**.**

Linux Windows x86_64 UEFI-GPT Multiboot ****

Windows Vista (SP1+) and 7 pr 8 x86_64 versions support booting natively using UEFI firmware**.** But for this they need GPT partitioning of the disk used for UEFI booting**.Windows x86_64 versions support either UEFI-GPT booting or BIOS-MBR booting.Windows 32-bit versions support only BIOS-MBR booting.** Follow the instructions provided in the forum link given in the references sections as to how to do this**.** Seehttp://support.microsoft.com/default.aspx**?**scid=kb;EN-US;2581408 for more info**.**

This limitation does not exist in Linux Kernel but rather depends on the bootloader used**.For the sake of Windows UEFI booting, the Linux bootloader used should also be installed in UEFI-GPT mode if booting from the same disk.**

Boot Process under UEFI ****

  1. System switched on — Power On Self Test, or POST process**.**
  2. UEFI firmware is loaded**.**
  3. Firmware reads its Boot Manager to determine which UEFI application to be launched and from where (ie**.** from which disk and partition).
  4. Firmware launches the UEFI application from the FAT32 formatted UEFISYS partition as defined in the boot entry in the firmware’s boot manager**.**
  5. UEFI application may launch another application (in case of UEFI Shell or a boot manager like rEFInd) or the kernel and initramfs (in case of a bootloader like GRUB) depending on how the UEFI application was configured**.**

Detecting UEFI Firmware Arch ****

If you have a non-mac UEFI system, then you have a x86_64 (aka 64-bit) UEFI 2**.x firmware.**

Some of the known x86_64 UEFI 2.x firmwares are Phoenix SecureCore Tiano, AMI Aptio, Insyde H2O**.**

Some of the known systems using these firmwares are Asus EZ Mode BIOS (in Sandy Bridge P67 and H67 motherboards), MSI ClickBIOS, HP EliteBooks, Sony Vaio Z series, many Intel Server and Desktop motherboards

Pre-2008 Macs mostly have i386-efi firmware while >=2008 Macs have mostly x86_64-efi**.** All macs capable of running Mac OS X Snow Leopard 64-bit Kernel have x86_64 EFI 1**.**x firmware.

To find out the arch of the efi firmware in a Mac, boot into Mac OS X and type the following command

ioreg -l -p IODeviceTree | grep firmware-abi

If the command returns EFI32 then it is i386 EFI 1**.x firmware. If it returns EFI64 then it is x86_64 EFI 1.x firmware. Macs do not have UEFI 2.x firmware as Apple’s EFI implementation is not fully compliant with UEFI Specification.**

UEFI Support in Linux Kernel ****

Linux Kernel config options for UEFI ****

The required Linux Kernel configuration options for UEFI systems are :

CONFIG_EFI=y


CONFIG_EFI_STUB=y


CONFIG_RELOCATABLE=y


CONFIG_FB_EFI=y


CONFIG_FRAMEBUFFER_CONSOLE=y

UEFI Runtime Variables/Services Support — ‘efivars’ kernel module . This option is important as this is required to manipulate UEFI Runtime Variables using tools likeefibootmgr****.

CONFIG_EFI_VARS=m

Note: This option is compiled as module in Arch core/testing kernel**.**

Note: For Linux to access UEFI Runtime Services, the UEFI Firmware processor architecture and the Linux kernel processor architecture must match**.** This is independent of the bootloader used**.**

Note: If the UEFI Firmware arch and Linux Kernel arch are different, then the «noefi» kernel parameter must be used to avoid the kernel panic and boot successfully**.** The «noefi» option instructs the kernel not to access the UEFI Runtime Services**.**

GUID Partition Table GPT config option — mandatory for UEFI support

CONFIG_EFI_PARTITION=y

Note: All of the above options are required to boot Linux via UEFI, and are enabled in Archlinux kernels in official repos**.**

Retrieved fromhttp://git.kernel.org/**?**p=linux/kernel/git/torvalds/linux.git;a=blob_plain;f=Documentation/x86/x86_64/uefi.txt;hb=HEAD.

UEFI Variables Support ****

UEFI defines variables through which an operating system can interact with the firmware**.UEFI Boot Variables are used by the boot-loader and used by the OS only for early system start-up.** UEFI Runtime Variables allow an OS to manage certain settings of the firmware like the UEFI Boot Manager or managing the keys for UEFI Secure Boot Protocol etc**.**

Note: The below steps will not work if the system has been booted in BIOS mode and will not work if the UEFI processor architecture does not match the kernel one, i.e. x86_64 UEFI + x86 32-bit Kernel and vice-versa config will not work**.** This is true only for efivars kernel module and efibootmgr step**.** The other steps (ie. upto setting up /EFI/arch/refind/{refindx64.efi,refind.conf} ) can be done even in BIOS/Legacy boot mode**.**

Access to UEFI Runtime services is provided by «efivars» kernel module which is enabled through the CONFIG_EFI_VAR=m kernel config option**.** This module once loaded exposes the variables under the directory /sys/firmware/efi/vars. One way to check whether the system has booted in UEFI boot mode is to load the «efivars» kernel module and check for the existence of /sys/firmware/efi/vars directory with contents similar to :

Sample output (x86_64-UEFI 2**.**3.1 in x86_64 Kernel):




# ls -1 /sys/firmware/efi/vars/


Boot0000-8be4df61-93ca-11d2-aa0d-00e098032b8c/


BootCurrent-8be4df61-93ca-11d2-aa0d-00e098032b8c/


BootOptionSupport-8be4df61-93ca-11d2-aa0d-00e098032b8c/


BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c/


ConIn-8be4df61-93ca-11d2-aa0d-00e098032b8c/


ConInDev-8be4df61-93ca-11d2-aa0d-00e098032b8c/


ConOut-8be4df61-93ca-11d2-aa0d-00e098032b8c/


ConOutDev-8be4df61-93ca-11d2-aa0d-00e098032b8c/


ErrOutDev-8be4df61-93ca-11d2-aa0d-00e098032b8c/


Lang-8be4df61-93ca-11d2-aa0d-00e098032b8c/


LangCodes-8be4df61-93ca-11d2-aa0d-00e098032b8c/


MTC-eb704011-1402-11d3-8e77-00a0c969723b/


MemoryTypeInformation-4c19049f-4137-4dd3-9c10-8b97a83ffdfa/


PlatformLang-8be4df61-93ca-11d2-aa0d-00e098032b8c/


PlatformLangCodes-8be4df61-93ca-11d2-aa0d-00e098032b8c/


RTC-378d7b65-8da9-4773-b6e4-a47826a833e1/


del_var


new_var

The UEFI Runtime Variables will not be exposed to the OS if you have used «noefi» kernel parameter in the boot-loader menu**.** This parameter instructs the kernel to completely ignore UEFI Runtime Services**.**

Userspace Tools ****

There are few tools that can access/modify the UEFI variables, namely

  1. efibootmgr — Used to create/modify boot entries in the UEFI Boot Manager —efibootmgr or efibootmgr-git
  2. uefivars — simply dumps the variables — uefivars-git — uses efibootmgr library
  3. Ubuntu’s Firmware Test Suite — fwts — fwts-git — uefidump command — fwts uefidump

Non-Mac UEFI systems ****

efibootmgr ****

Warning: Using efibootmgr in Apple Macs will brick the firmware and may need reflash of the motherboard ROM**.** There have been bug reports regarding this in Ubuntu/Launchpad bug tracker**.** Use bless command alone in case of Macs. Experimental «bless» utility for Linux by Fedora developers — mactel-boot .

Note: efibootmgr command will work only if you have booted the system in UEFI mode itself, since it requires access to UEFI Runtime Variables which are available only in UEFI boot mode (with «noefi» kernel parameter NOT being used). Otherwise the message Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables is shown**.**

Initially the user may be required to manually launch the boot-loader from the firmware itself (using maybe the UEFI Shell) if the UEFI boot-loader was installed when the system is booted in BIOS mode**.** Then efibootmgr should be run to make the UEFI boot-loader entry as the default entry in the UEFI Boot Manager**.**

To use efibootmgr, first load the ‘efivars’ kernel module:

# modprobe efivars

If you get no such device found error for this command, that means you have not booted in UEFI mode or due to some reason the kernel is unable to access UEFI Runtime Variables (noefi**?).**

Verify whether there are files in /sys/firmware/efi/vars/ directory**.** This directory and its contents are created by «efivars» kernel module and it will exist only if you have booted in UEFI mode, without the «noefi» kernel parameter**.**

If /sys/firmware/efi/vars/ directory is empty or does not exist, then efibootmgr command will not work**.** If you are unable to make the ISO/CD/DVD/USB boot in UEFI mode try#Create_UEFI_bootable_USB_from_ISO.

Note: The below commands use gummiboot-efi boot-loader as example**.**

Assume the boot-loader file to be launched is /boot/efi/EFI/gummiboot/gummibootx64.efi./boot/efi/EFI/gummiboot/gummibootx64.efi can be split up as /boot/efi and/EFI/gummiboot/gummibootx64.efi, wherein /boot/efi is the mountpoint of the UEFI System Partition, which is assumed to be /dev/sdXY (here X and Y are just placeholders for the actual values — eg:- in /dev/sda1 , X=a Y=1).

To determine the actual device path for the UEFI System Partition (should be in the form/dev/sdXY), try :

# findmnt /boot/efi


TARGET SOURCE  FSTYPE OPTIONS


/boot/efi  /dev/sdXY  vfat         rw,flush,tz=UTC

Then create the boot entry using efibootmgr as follows :

# efibootmgr -c -g -d /dev/sdX -p Y -w -L "Gummiboot" -l '\EFI\gummiboot\gummibootx64.efi'

In the above command /boot/efi/EFI/gummiboot/gummibootx64.efi translates to /boot/efi and/EFI/gummiboot/gummibootx64.efi which in turn translate to drive /dev/sdX -> partition Y -> file /EFI/gummiboot/gummibootx64.efi.

UEFI uses backward slash as path separator (similar to Windows paths).

The ‘label’ is the name of the menu entry shown in the UEFI boot menu**.** This name is user’s choice and does not affect the booting of the system**.** More info can be obtained from efibootmgr GIT README .

FAT32 filesystem is case-insensitive since it does not use UTF-8 encoding by default**.** In that case the firmware uses capital ‘EFI’ instead of small ‘efi’, therefore using\EFI\gummiboot\gummibootx64.efi or \efi\gummiboot\gummibootx64.efi does not matter (this will change if the filesystem encoding is UTF-8).

Linux Bootloaders for UEFI ****

See UEFI Bootloaders .

Create an UEFI System Partition in Linux ****

Note: The UEFISYS partition can be of any size supported by FAT32 filesystem**.According to Microsoft Documentation, the minimum partition/volume size for FAT32 is 512 MiB.** Therefore it is recommended for UEFISYS partition to be at least 512 MiB**.Higher partition sizes are fine, especially if you use multiple UEFI bootloaders, or multiple OSes booting via UEFI, so that there is enough space to hold all the related files.If you are using Linux EFISTUB booting, then you need to make sure there is adequate space available for keeping the Kernel and Initramfs files in the UEFISYS partition.**

For GPT partitioned disks ****

Two choices:

  • Using GNU Parted/GParted: Create a FAT32 partition**.** Set «boot» flag on for that partition**.**
  • Using GPT fdisk (aka gdisk): Create a partition with gdisk type code «EF00». Then format that partition as FAT32 using mkfs.vfat -F32 /dev/<THAT_PARTITION>

Note: Setting «boot» flag in parted in a MBR partition marks that partition as active, while the same «boot» flag in a GPT partition marks that partition as «UEFI System Partition».

Warning: Do not use util-linux fdisk, cfdisk or sfdisk to change the type codes in a GPT disk**.** Similarly do not use gptfdisk gdisk, cgdisk or sgdisk on a MBR disk, it will be automatically converted to GPT (no data loss will occur, but the system will fail to boot).

For MBR partitioned disks ****

Two choices:

  • Using GNU Parted/GParted: Create FAT32 partition**.** Change the type code of that partition to 0xEF using fdisk, cfdisk or sfdisk**.**
  • Using fdisk: Create a partition with partition type 0xEF and format it as FAT32 usingmkfs.vfat -F32 /dev/<THAT_PARTITION>

Note: It is recommended to use always GPT for UEFI boot as some UEFI firmwares do not allow UEFI-MBR boot**.**

UEFI Shell ****

The UEFI Shell is a shell/terminal for the firmware which allows launching uefi applications which include uefi bootloaders**.** Apart from that, the shell can also be used to obtain various other information about the system or the firmware like memory map (memmap), modifying boot manager variables (bcfg), running partitioning programs (diskpart), loading uefi drivers, editing text files (edit), hexedit etc**.**

UEFI Shell download links ****

You can download a BSD licensed UEFI Shell from Intel’s Tianocore UDK/EDK2 Sourceforge.net project**.**

Shell 2.0 works only in UEFI 2.3+ systems and is recommended over Shell 1.0 in those systems. Shell 1**.0 should work in all UEFI systems irrespective of the spec.** version the firmware follows**.** More info at ShellPkg and this mail

Launching UEFI Shell ****

Few Asus and other AMI Aptio x86_64 UEFI firmware based motherboards (from Sandy Bridge onwards) provide an option called "Launch EFI Shell from filesystem device" . For those motherboards, download the x86_64 UEFI Shell and copy it to your UEFI SYSTEM PARTITION as <UEFI_SYSTEM_PARTITION>/shellx64.efi (mostly /boot/efi/shellx64.efi) .

Systems with Phoenix SecureCore Tiano UEFI firmware are known to have embedded UEFI Shell which can be launched using either F6, F11 or F12 key**.**

Note: If you are unable to launch UEFI Shell from the firmware directly using any of the above mentioned methods, create a FAT32 USB pen drive with Shell.efi copied as (USB)/efi/boot/bootx64.efi . This USB should come up in the firmware boot menu. Launching this option will launch the UEFI Shell for you**.**

Important UEFI Shell Commands ****

UEFI Shell commands usually support -b option which makes output pause after each page**.** map lists recognized filesystems (fs0, ...) and data storage devices (blk0, ...). Run help -b to list available commands**.**

More info at http://software.intel.com/en-us/articles/efi-shells-and-scripting/

BCFG command is used to modify the UEFI NVRAM entries, which allow the user to change the boot entries or driver options**.** This command is described in detail in page 83 (Section 5**.**3) of «UEFI Shell Specification 2.0» pdf document.

Note: Users are recommended to try bcfg only if efibootmgr fails to create working boot entries in their system**.**

Note: UEFI Shell 1**.0 does not support bcfg command.**

To dump a list of current boot entries —

Shell> bcfg boot dump -v

To add a boot menu entry for rEFInd (for example) as 4th (numbering starts from zero) option in the boot menu

Shell> bcfg boot add 3 fs0:\EFI\arch\refind\refindx64.efi "Arch Linux (rEFInd)"

where fs0: is the mapping corresponding to the UEFI System Partition and \EFI\arch\refind\refindx64.efi is the file to be launched**.**

To remove the 4th boot option

Shell> bcfg boot rm 3

To move the boot option #3 to #0 (i**.**e. 1st or the default entry in the UEFI Boot menu)

Shell> bcfg boot mv 3 0

For bcfg help text

Shell> help bcfg -v -b
Shell> bcfg -**?** -v -b

EDIT command provides a basic text editor with an interface similar to nano text editor, but slightly less functional**.** It handles UTF-8 encoding and takes care or LF vs CRLF line endings**.**

To edit, for example rEFInd’s refind.conf in the UEFI System Partition (fs0: in the firmware)

Shell> fs0:


FS0:\> cd \EFI\arch\refind


FS0:\EFI\arch\refind\> edit refind.conf

Type Ctrl-E for help**.**

Hardware Compatibility ****

Main page HCL/Firmwares/UEFI

Create UEFI bootable USB from ISO ****

Note: The instructions below are specifically for Archiso /official media; Archbootpreparation is identical, with this refind.conf instead of the one mentioned below (which is for Archiso) and without the filesystem label requirement**.**

Note: The USB can use either MBR or GPT partition table**.** The filesystem should be either FAT32 (recommended) or FAT16**.** FAT12 is designed for floppy drives and therefore not recommended for USB drives**.**

First create a MBR partition table in the USB using fdisk**.** Mount the USB partition and create a FAT32 filesystem with LABEL as used in the Archiso configuration**.**

# mkdir -p /mnt/{usb,iso}


# mount -o loop archlinux-2012**.**12.01-dual.iso /mnt/iso

Obtain the label from /mnt/iso/loader/entries/archiso-x86_64.conf; this is used by the archisohook in initramfs to identify the udev path to the installation media**.**

# awk 'BEGIN {FS="="} /archisolabel/ {print $3}' /mnt/iso/loader/entries/archiso-x86_64.conf | xargs mkfs.vfat /dev/sdXY -n

Mount the newly created FAT32 USB partition, and copy the contents of the installation media to the USB media**.**

# mount /dev/sdXY /mnt/usb




# cp -r / mnt / iso / * / mnt / usb


# umount /mnt/{usb,iso}


# sync

If you find the error: «No loader found**.** Configuration files in /loader/entries/*.conf are needed**.**« A possible fix is to use a different uefi bootloader to the included one, gummiboot**.**

Download refind-efi pkg and extract the file /usr/lib/refind/refind_x64.efi from within the package to (USB)/EFI/boot/bootx64.efi (overwrite or rename any existing(USB)/EFI/boot/bootx64.efi file).

Then copy this text to EFI/boot/refind.conf. Take care that the label in the Arch menu section (ARCH_201302 here) matches that of your usb’s**.**

refind.conf
timeout 5




textonly




showtools about,reboot,shutdown,exit


# scan_driver_dirs EFI/tools/drivers_x64


scanfor manual,internal,external,optical




scan_delay 1


dont_scan_dirs EFI/boot




max_tags 0


default_selection "Arch Linux Archiso x86_64 UEFI USB"




menuentry "Arch Linux Archiso x86_64 UEFI USB" {


  loader /arch/boot/x86_64/vmlinuz


  initrd /arch/boot/x86_64/archiso.img


  ostype Linux


  graphics off


  options "archisobasedir=arch archisolabel=ARCH_201302 add_efi_memmap"


}




menuentry "UEFI x86_64 Shell v2" {


  loader /EFI/shellx64_v2.efi




  graphics off




}




menuentry "UEFI x86_64 Shell v1" {


  loader /EFI/shellx64_v1.efi




  graphics off




}

You should now be able to successfully boot, and you can choose which EFI you’d like to load**.**

Remove UEFI boot support from ISO ****

Warning: In the event that UEFI+isohybrid El Torito/MBR really causes problems, it would be better to just UEFI boot using the USB stick instructions in the previous section

Most of the 32-bit EFI Macs and some 64-bit EFI Macs refuse to boot from a UEFI(X64)+BIOS bootable CD/DVD**.** If one wishes to proceed with the installation using optical media, it might be necessary to remove UEFI support first**.**

Mount the official installation media and obtain the archisolabel as shown in the previous section**.**

Rebuild the ISO using xorriso from libisoburn :

$ xorriso -as mkisofs -iso-level 3 \


    -full-iso9660-filenames\


    -volid "ARCH_201212" \


    -appid "Arch Linux CD" \


    -publisher "Arch Linux " \


    -preparer "prepared like a BAWSE" \


    -eltorito-boot isolinux/isolinux.bin \


    -eltorito-catalog isolinux/boot.cat \


    -no-emul-boot -boot-load-size 4 -boot-info-table \


    -isohybrid-mbr "/mnt/iso/isolinux/isohdpfx.bin" \


    -output "~/archiso.iso" "/mnt/iso/"

Burn ~/archiso.iso to optical media and proceed with installation normally**.**

Posted by [20.02.2013

21.02.2013](http://itman.in/efi-boot/)Author Sergey Sharmazanov Categories

Uncategorized

EFI_EFI_SHELL_intro.md

EFI及EFI SHELL简介 http://smilejay.com/2011/05/efi_efi-shell/ 05/16/2011MASTER 5 COMMENTS 今天升级Sandy Bridge EP测试机的BIOS,可谓是曲折啊,尝试各种方法、遇到各种软硬件问题问题。其中一种方法是按照Intel的官方BIOS文档中的说明,用在EFI Shell中升级。所以稍微了解了一下EFI和EFI Shell。 大致来说,EFI是Extensible Firmware Interface的缩写,是介于平台固件和操作系统之间的一层软件接口(及其详细规格说明文档)。EFI是Intel在1998年开始的一个项目演变而来,而在2005年Intel将EFI 1.10开源并交由Unified EFI开源社区去维护和开发,Intel自己的EFI也就不单独做了,都和开源社区共用一个。现在也通常用EFI来代指UEFI,二者不再有意区分。 EFI Shell是EFI提供的一个交互式的命令行Shell环境,在这里你可以执行一些efi应用程序,加载efi设备驱动程序,以及引导操作系统,从引导菜单项中选择”efi shell”,回车,待出现”shell]”提示符时即表明你已进入efi shell环境中,下面对一些常用的efi shell环境下的命令作些简要介绍:

[drive_name]: 改变当前驱动器.例如, fs0当前映射到了ls-240 驱动器的话,shell] fs0: [回车]就将提供对ls-240 驱动器的访问. alias [-bdv] [sname] [value] 设置或获取别名; attrib [-b] [+/- rhs] [file] 察看或设置文件属性 bcfg -? 配置efi nvram中启动时所加载的驱动选项 botmaint 执行启动维护管理 break 设置执行断点 cd [path] 改变当前目录 cls [background color] 清屏 comp file1 file2 进行文件比较 connect [-r] [-c] handle# .devicehandle# driverhandle# 绑定efi驱动到一个设备并激活该驱动 cp [-r] file [file] ... [dest] 拷贝文件和目录 date [mm/dd/yyyy] 获取或设置日期 dblk device [lba] [blocks] 察看块设备的16进制印象 devices [-b] [-1xxx] 列出系统中的所有设备 devtree [-b] [-d] 显示设备树 dh [-b] [-p prot_id] | [handle] 察看文件句柄信息 disconnect devicehandle# [driverhandle# [childhandle#] 卸载设备驱动 dmem {address] [size] [;mmio] 察看指定内存中的内容 dmpstore drivers [-b] [-lxxx] 列出安装的驱动 drvcfg [-c] [-lxxx] [-f] [-v] [-s] 调用驱动配置协议 drvdiag [-c] [-lxxx] [-s] [-e] [-m] 调用驱动诊断协议 echo [[-on | -off] | [text] 回显 edit [filename] 文本编辑 eficompress infile outfile 压缩efi文件 efidecompress infile outfile 解压efi文件 guid [-b] [sname] 察看知名guid ids help [-b] [internal_command] 显示帮助信息 hexedit [[-f]filename|[-d diskname offset size]|[-m offset size]] 16进制编 load driver_name 加载驱动 loadbmp [-c] [-t] [-i[uga instance]] file 在屏幕上显示一个位图文件 loadpcirom romfile 加载pci option rom ls [-b] [dir] [dir] ... 获得目录列表 map [-bdvr] [sname[:]] [handle] 映射驱动器路径 mem [address] [size] [;mmio] 察看内存或内存映射i/o memmap [-b] 察看内存映射表 mkdir dir [dir] 创建目录项 mm address [width] [;type] [n] 内存编辑 mode [col row] 设置当前图形显示模式 mount blkdevice [sname[:]] 在一个块设备上加载文件系统 mv [src…] [dst] 移动文件或目录 pci [bus_dev] [func] 显示pci设备信息 rconnect devicehandle# [driverhandle# [childhandle#]] | [-r] 驱动重载 reset [reset_string] 冷启动 rm file/dir [file/dir] 删除文件或目录 setsize file 设置文件大小 stall microseconds 延时 time [hh:mm:ss] 获取或设置时间 type [-a] [-u] [-b] file 察看文件内容 ver 显示版本信息 vol fs [volume_label] 设置卷标 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 [drive_name]: 改变当前驱动器.例如, fs0当前映射到了ls-240 驱动器的话,shell] fs0: [回车]就将提供对ls-240 驱动器的访问. alias [-bdv] [sname] [value] 设置或获取别名; attrib [-b] [+/- rhs] [file] 察看或设置文件属性 bcfg -? 配置efi nvram中启动时所加载的驱动选项 botmaint 执行启动维护管理 break 设置执行断点 cd [path] 改变当前目录 cls [background color] 清屏 comp file1 file2 进行文件比较 connect [-r] [-c] handle# .devicehandle# driverhandle# 绑定efi驱动到一个设备并激活该驱动 cp [-r] file [file] ... [dest] 拷贝文件和目录 date [mm/dd/yyyy] 获取或设置日期 dblk device [lba] [blocks] 察看块设备的16进制印象 devices [-b] [-1xxx] 列出系统中的所有设备 devtree [-b] [-d] 显示设备树 dh [-b] [-p prot_id] | [handle] 察看文件句柄信息 disconnect devicehandle# [driverhandle# [childhandle#] 卸载设备驱动 dmem {address] [size] [;mmio] 察看指定内存中的内容 dmpstore drivers [-b] [-lxxx] 列出安装的驱动 drvcfg [-c] [-lxxx] [-f] [-v] [-s] 调用驱动配置协议 drvdiag [-c] [-lxxx] [-s] [-e] [-m] 调用驱动诊断协议 echo [[-on | -off] | [text] 回显 edit [filename] 文本编辑 eficompress infile outfile 压缩efi文件 efidecompress infile outfile 解压efi文件 guid [-b] [sname] 察看知名guid ids help [-b] [internal_command] 显示帮助信息 hexedit [[-f]filename|[-d diskname offset size]|[-m offset size]] 16进制编 load driver_name 加载驱动 loadbmp [-c] [-t] [-i[uga instance]] file 在屏幕上显示一个位图文件 loadpcirom romfile 加载pci option rom ls [-b] [dir] [dir] ... 获得目录列表 map [-bdvr] [sname[:]] [handle] 映射驱动器路径 mem [address] [size] [;mmio] 察看内存或内存映射i/o memmap [-b] 察看内存映射表 mkdir dir [dir] 创建目录项 mm address [width] [;type] [n] 内存编辑 mode [col row] 设置当前图形显示模式 mount blkdevice [sname[:]] 在一个块设备上加载文件系统 mv [src…] [dst] 移动文件或目录 pci [bus_dev] [func] 显示pci设备信息 rconnect devicehandle# [driverhandle# [childhandle#]] | [-r] 驱动重载 reset [reset_string] 冷启动 rm file/dir [file/dir] 删除文件或目录 setsize file 设置文件大小 stall microseconds 延时 time [hh:mm:ss] 获取或设置时间 type [-a] [-u] [-b] file 察看文件内容 ver 显示版本信息 vol fs [volume_label] 设置卷标 参考资料: http://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface#The_EFI_shell http://www.intel.com/technology/efi/ (Intel对EFI的技术) http://software.intel.com/en-us/articles/efi-shells-and-scripting/ (Intel的EFI Shell介绍及脚本编写) http://blog.sina.com.cn/s/blog_4a44ac500100g6rh.html

EFI_Shells_and_Scripting_by_Intel.md

EFI Shells and Scripting https://software.intel.com/en-us/articles/efi-shells-and-scripting/ Published on October 22, 2008

Translate

Introduction Extensible firmware interface (EFI) brings new flexibility and opportunities to users by allowing them to work in the layer between their OS and BIOS, without altering either one. This paper explains how to use EFI shell commands, create a script file and set up the boot menu with shells and scripts. In addition, this paper demonstrates dual boot selection for the 64-bit Red Hat Linux* 7.1 and 64-bit Microsoft Windows* XP Professional operating systems.

EFI Shell Commands The following is the list of the EFI 0.99[12.29] shell commands:

Commands Descriptions help [-b] [internal command] Displays this help guid [-b] [sname] Lists known GUID (Global Unique Identifiers) set [-bdv] [sname] [value] Gets or sets environment variable alias [-bdv] [sname] [value] Gets or sets alias settings dh [-b] [-p prot_id] | [handle] Dumps handle information unload [-nv] HandleIndex Unloads a protocol image map [-bdvr] [sname[:]] [handle] Maps shortname to device path mount BlkDevice [sname[:]] Mounts a file system on a block device cd [path] Updates the current directory echo [[-on | -off] | [text] Echoes text to stdout or toggle script echo if [not] condition then Script-only: IF THEN construct endif Script-only: Delimiter for IF THEN construct goto label Script-only: Jump to label location in script for var in < /td> Script-only: Loop construct endfor Script-only: Delimiter for loop construct pause Script-only: Prompt to quit or continue ls [-b] [dir] [dir] ... Obtains directory listing mkdir dir [dir] ... Makes directory mode [col row] Gets or sets current text mode cp [-r] file [file] ... [dest] Copies files/directories comp file1 file2 Compares two files rm file/dir [file/dir] Remove files/directories memmap [-b] Dumps memory map type [-a] [-u] [-b] file Types file dmpstore Dumps variable store load driver_name Loads a driver ver Displays version information err [level] Sets or displays error level time [hh:mm:ss] Gets or sets time date [mm/dd/yyyy] Gets or sets date stall microseconds Delay for x microseconds reset [/warm] [reset string] Cold or warm reset vol fs [Volume Label] Sets or displays volume label attrib [-b] [+/- rhs] [file] Sets or displays file attributes cls [background color] Clears screen bcfg -? Configures boot driver and load options edit [file name] Edits a file Edd30 [On | Off] Enables or disables EDD 3.0 device paths dblk device [Lba] [Blocks] Hex dump of BlkIo devices pci [bus dev] [func] Displays PCI device(s) information mm Address [Width] [;Type] Modifies memory: Mem, MMIO, IO, PCI mem [Address] [size] [;MMIO] Dumps memory or memory mapped IO EddDebug [BlockDeviceName] Dumps EDD information from adapter card Table 1: EFI 0.99[12.29] shell commands

This list appears when you type the command "help" at the shell prompt. However, it does not contain all of the EFI shell commands; the commands "attrib" and "exit" are absent. Not all commands can be used in script files. For example, the command "exit" missing from the list cannot be used in a script file. To exit out of a script, simply jump to the end of the file. Conversely, some of the commands like "if...then," "for...in," "goto" can only be used inside the script file.

To execute a command, type it at the shell prompt, which can be as follows:

Shell>

fs0:> (If there is a disk in the floppydrive before the PC is turned on, then the current media defaults to the floppy disk. If not, then the current media is the first hard disk partition.) fs1:> (The first hard disk partition if fs0 is the floppy disk.) fs2:> (Indicates the CD-ROM drive.)

This environment is similar to Microsoft DOS* (MS-DOS) in that the user types in commands and presses "Enter" to execute the commands. As demonstrated below, changing to another drive is easy: type the name of the drive and then press "Enter". ("" is a "carriage return" which translates to "press Enter.")

Shell> fs0: Fs0:> fs2:

Fs2:>

If the user is unfamiliar with the use of a command, they simply type it at the shell prompt and the computer displays the correct syntax and meaning of each of the switches.

EFI Shell Scripts In basic terms, a script file is one that contains a sequence of shell commands that the user would like the computer to execute. Rather than entering them at the shell prompt, the user places the appropriate shell commands into a file and names the file "filename.nsh" to create a script file. This is extremely useful for repetitive tasks.

The script file resembles a batch file in MS-DOS; in EFI, a file called "startup.nsh" automatically runs every time a shell environment is opened. You can create the script using any ASCII or Unicode text editor. The following are shell commands frequently used in a script:

3.1 Echo: Syntax:echo [-on |

-off]

echo [text]

The first line in a script is usually "echo -off." This prevents subsequent batch file commands from displaying on the screen so that only results display.

For example, in a script file, there are such commands:

Batch commands:echo -on

echo This is a test

When you run that script, you see the following lines on the screen:

Result:echo -on

echo This is a test

This is a test

The first two lines in bold are batch commands from the script, and the third line is the result of the second batch command. Note the display when the echo command is turned off:

Batch commands:echo -off

echo This is a test

Result:echo -off

This is a test

The batch command "echo This is a test" no longer displays onscreen because the echo has been turned off. You always see the batch command "echo -off" because the echo does not disable after this line has been executed.

3.2 If Syntax:if [not] exist filename then...endifif [not] string1 == string2

then

... endif The first form checks for file existence. Type either just the file name or the path and the file name. For example:

set test "startup.nsh" # Assign "startup.nsh" to the

environment

 # variable named test

if exist %test% then # Check to see if the file

"startup.nsh"

 # exists in the current directory

type %test% # Displays the contents of "startup.nsh"

 # if found.

endif # End of if ... then statement

The second form is the comparison between strings:

set env1 "world"

set env2 "map"

if %env1% == %env2% then # Compare the value of 2

variables

echo %env1% is equal to %env2%

endif

Note: Spaces need to be inserted at both ends of the "==" sign. Otherwise, the shell generates an error.

%env1% == %env2% correct

%env1%==%env2% incorrect

3.3 For Syntax:for %index in

group

...

endfor

This is a "for" loop. The index here is any single character, like a, b, c and so on, but it can't be a digit like 1, 2 or 3 because they can be misinterpreted as "argument" variables. Groups can be made up of strings or file names separated by the use of spaces. Consider the following examples:

Batch commands:for %b in 1

2 3 4

type %b

**

endfor

Result:1

**

2

**

3

**

4

**

Batch commands:for %m in

*.nsh

type

%m

 endfor

Result: The list of all files with extension "nsh" in the current directory.

Note: Spaces need to be inserted at both ends of the %index. Otherwise, the shell generates an error.

Type %b ** correct

Type %b** incorrect

Dual Boot Selection Consider the procedure for setting up dual boot on an Intel Itanium processor-based system. If Windows* 9x and Windows NT* or Windows* 2000 is installed on an Intel® Itanium® platform, you can set up a dual boot under Windows NT or Windows 2000. If Windows 9x and Linux are installed, you can set up a dual boot under Linux.

On the Intel Itanium platform, there is a layer between the firmware and the OS—that layer is the EFI. You can boot to any installed OS from the EFI layer as long as the OS is EFI-compliant.

Below is a demonstration of dual booting 64-bit versions of Red Hat Linux* and Microsoft Windows* 2000.

Before starting to build the boot menu:

A) You must disable the file "startup.nsh." This script runs automatically when you turn on the system and select the "Boot OS" option. When you install Windows 2000, it creates the "startup.nsh" file. This file executes a file called "launcher.efi," which boots directly to Windows 2000. Perform the following steps to disable the startup.nsh file:

  1. During the Windows booting process, press any key to interrupt it.

  2. Change the access right of the startup.nsh file to modify or delete it. From the shell prompt, "Shell>," go to the main partition:

Shell> fs0:

 or 

Shell> fs1: The choice between "fs0" and "fs1" depends on whether a disk is in the floppy drive.

Note: To use the floppy drive, a floppy disk must be inserted. Otherwise, the floppy drive is not recognized; the same caution applies to the CD-ROM drive.

fs0:> attrib -r startup.nshfs0:> edit startup.nsh In edit mode, type a # sign at the beginning of the line containing the word "launcher" to comment it out.

B) Make sure the BIOS build 89B is flashed. One way to establish the correct build number is to look at the EFI version when you first turn on the PC; if it's correct, you see something like:

EFI Version 0.99[12.31]...

There are instances in which an incorrect BIOS version has been preloaded to the Software Development Vehicle (SDV). If you see "EFI Version 1.0[12.25]..." displayed on the screen, reflash the BIOS with build 89B or 99.

Assume you want the following multiple boot menu:

Windows XP* Professional Red Hat Linux* EFI Shell You can create it using any of these methods:

boot maintenance menu BCFG command script 4.1 Using Boot Maintenance Menu: Follow these steps to create a boot menu:

  1. Turn on the system.

  2. Select "Boot OS."

  3. At the shell prompt, type "exit" and press Enter.

Shell> exit 4) The screen displays a boot menu similar to the following:

EFI Boot Manager ver. 0.99[12.29]

Select boot option

EFI Shell [built in]

Boot option maintenance menu 5) Select the boot option maintenance menu.

  1. Select "Add a boot option."

  2. Select the partition containing the OS loader. In this case, it is the first hard disk partition. Something similar to the following appears onscreen:

NO VOLUME LABEL [VenHw(Unknown D evice:80)/HD(Part1, Sig948939)]

Removable Media [VenHw(Unknown Device:01)]

Removable Media [VenHw(Unknown Device:FF)]

Load File [Acpi(PNP0A03,0)/Pci(4|0)/mac(009027E4A0F4)]

Load File [EFI Shell [Built-in]]

Legacy Boot A:

Legacy Boot C:

Exit

  1. Select the first item, "NO VOLUME LABEL..."

  2. The screen displays the files of the directory of the selected partition.

Select the file "eli.efi." This is the Linux loader file.

  1. Type the title you wish to display on the boot menu when asked for the description: "Red Hat Linux*."

  2. When prompted with:

"New boot option data: ASCII/Unicode string only Enter Boot option Data type[A- SCII U- Unicode N- No BootOption]," select "N."

  1. Next, select the option "Save Changes to NVRAM[Y-yes N-No]:" and type "Y."

  2. When you have no other OS to set, select "exit" to return to the previous menu.

  3. Select "Cold Reset" to reboot the system.

  4. To create an EFI shell prompt, select option "EFI Shell[built in]" from step 7 and type "EFI Shell" at step 10.

  5. Type "exit" at the shell prompt "Shell>" to go to the boot menu.

4.2 Using the BCFG Command The "Bcfg" is the boot configuration shell command. Assuming that "fs0" is the main partition, type the following statement to create the boot menu:

fs0:> bcfg boot add 2 eli.efi "Red Hat Linux*"

Note: You cannot create an EFI shell prompt using this method; you must use the previous method.

4.3 Using Script Since there is no user-prompt command under the EFI shell to accept users' selected input, you must use an alternative method:

a) If the file startup.nsh does not exist,

create it or modify it to

contain strictly the following line:

Menu b) Create a file and name it menu.nsh with the following:

Echo -off

Dblk3:

Echo 2- Red Hat Linux

Echo Enter choice and press Enter

Note:

  1. There is no option for the shell prompt since the command "nshell" is not on the list.

  2. The current partition is set to "dblk3" instead of "fs0" or "fs1." This is because if there is a floppy disk in the floppy drive, then "fs0" is the floppy disk and "fs1" is the first hard disk partition. Otherwise, "fs0" is the first hard disk partition .

c) Create a file and name it "2.nsh" with the following contents:

eli Note: The "2.nsh" script is used to boot to Red Hat Linux*. Conclusion This represents only the beginning of the uses and benefits of EFI shell commands and scripts. Not only can EFI be used similarly to a MS-DOS device driver, its capabilities also remove the hassle of modifying the OS. Disk utility vendors can use EFI to craft powerful tools like platform-independent disk partitioning. Another of EFI's benefits is that the same device drivers can be used by many EFI-compliant platforms, thus providing a good return on investment. EFI allows users to create device drivers to access hardware directly without having to go through the OS, making the process both simpler and faster.

For more complete information about compiler optimizations, see our Optimization Notice. 4 commentsTop BADAR S. said on May 19,2017

BADAR S.'s picture This is first time learning about EFI Shel. So, I was wondering how can I create a bootable EFI shell USB key?

murala s. said on Nov 14,2016

murala s.'s picture Hi,

I need small help,

I want to run following content using EFI shell script file like script.nsh.

MyApp.efi "BootOption #"

But when i run script.nsh it is treating as like below,

MyApp.efi "BootOption

Please help me how to pass # also ,

thanks,

Shi Hao C. (Intel) said on Jun 3,2015

Shi Hao C. (Intel)'s picture It would be most helpful if there's a link to further describe/expand on the commands in the table at the end of this page here. Or where/how to access the user manuals of EFI shell itself. All in all this documentation does provide basic functionality of EFI shell. Thanks.

Henry L. said on Oct 21,2014

Henry L.'s picture Good tool

Intel-UEFI-Shell-2011

https://software.intel.com/en-us/articles/uefi-shell By wolfgang-rosenbergsr (Intel), published on March 21, 2011
Translate

Home >> | Back to Courseware Access page >> | Back to Other Courseware Content page >> |

UEFI Curriculum

About UEFI

UEFI-Framework Course Contents

Introduction to PC Architecture

Beyond BIOS

UEFI Introduction

UEFI Architecture and Technical Overview

UEFI Application

UEFI Shell

UEFI Boot Manager

UEFI Services

UEFI Drivers

Framework Architecture and Technical Overview

Labs

References

Potential research topics

UEFI Shell Users’ Guide

Contents 1UEFI Shell Overview 2EFI Shell Open Source 3Analogy to Old DOS: BIOS 4Shell Usage 5EFI File System 6Device Path 7Executing UEFI Applications 8Execute a UEFI Shell 9Wild Card Expansion 10Output Redirection 11EFI Shell Commands 12Internal EFI Shell Commands 13External Shell Commands 14EFI Shell Commands 15Unix-like Shell Commands 16Script File Example 17Help or ?: Command List in Shell 18DH – Dump Handle

launch-efi-shell-from-filesystem-device-warning-not-found.md

https://wiki.debian.org/UEFI#A32-bit_x86_PC_.28i386.29_support_for_UEFI

  • Support for mixed-mode systems: 64-bit system with 32-bit UEFI

Some systems have been released containing 64-bit Intel Atom CPUs (such as the Bay Trail), but unfortunately use 32-bit UEFI firmware with no BIOS compatibility mode. Using the 32-bit UEFI x86 support, an i386 installation should be possible on these machines but it won't make the most of the 64-bit hardware.

Debian Jessie (8.0) was the first Linux distribution to include full support for mixed-mode UEFI installation on these machines. The multi-arch installation media (available in netinst and DVD form) include the UEFI boot loaders necessary for both i386 and amd64 boot. By selecting "64-bit install" from the initial boot menu, debian-installer will install a 64-bit (amd64) version of Debian. The system will automatically detect that the underlying UEFI firmware is 32-bit and will install the appropriate version of grub-efi to work with it.

My Asrock H67m motherboard has an option to "Launch EFI Shell from filesystem device," but when I try to run it I receive an error, "NOT FOUND". I've found the section of the Wiki article on UEFI where it talks about motherboards with that option, but the fix involves downloading and coping the shell. I haven't been able to boot yet, and I don't know how to download the shell. Any ideas?
2016年2月29日 星期一
USB Boot with UEFI Shell Environment.
如何在 UEFI-aware platform 上讓 USB 直接開機進 shell




在 UEFI platform 上(若不考慮 CSM 時), BDS phase 在開機時會主動搜尋 media 上的 /efi/boot/bootx64.efi 或 bootia32.efi 做為開機的起點. 而這檔案就分別是 X64 或 IA32 版的 shell.efi .

有 EDK II/UDK2010 的人, 可以把 EdkShellBinPkg 裡的 shell 複製到 UFD (請確定 UFD 是FAT 格式)裡:
    FullShell\Ia32\Shell_Full.efi to \efi\boot\bootia32.efi
    FullShell\X64\Shell_Full.efi to \efi\boot\bootx64.efi

    or

    MinimumShell\Ia32\Shell.efi to \efi\boot\bootia32.efi
    MinimumShell\X64\Shell.efi to \efi\boot\bootx64.efi

Ps.可以只複製 bootx64.efi 就夠了

順帶一提,手上有 AMI Aptio code 的人可以找一下 addon 裡面, 依樣劃葫蘆:

addon\shell.efi to \efi\boot\bootx64.efi

如此一來,就可以在 Aptio Setup Utility 的 Boot 裡選用 "UEFI:" 開頭的 USB device 開機了. (當然了, 直接選用 Save & Exit 裡的 Boot Override 也可以). 這樣當你在沒包 shell UEFI-aware platform 上, 就可以不必用 Launch EFI Shell from filesystem device 的方法來手動 boot to shell 了. (這方法得把 shell.efi 複製到根目錄,並改為 shellx64.efi)

Reference: UEFI 2.5 - Chapter 12.3.1.3 Directory Structure 
張貼者: Hsie 於 上午6:52 
以電子郵件傳送這篇文章
BlogThis!
分享至 Twitter
分享至 Facebook
分享到 Pinterest

標籤: [UEFI][Shell] USB Boot

How to launch vmlinuz-linux from efi shell? https://superuser.com/questions/1034894/how-to-launch-vmlinuz-linux-from-efi-shell

Ask Question up vote 2 down vote favorite How to start vmlinuz-linux from efi shell ? I jump into the ESP and type vmlinuz-linux (vmlinuz-linux is in the ESP) but it says vmlinuz-linux isn't recognized as an internal or external command, operable program, or batch file, why do I have to start a boot loader first I don't get it.

linux-kernel efi shareimprove this question asked Feb 3 '16 at 1:19

ChiseledAbs 360923 add a comment 3 Answers active oldest votes up vote 2 down vote Just had to type /vmlinuz-linux root=PARTUUID=3518bb68-d01e-45c9-b973-0b5d918aae96 initrd=/initramfs-linux.img from this https://wiki.archlinux.org/index.php/EFISTUB#Booting_EFISTUB but had to remove the forward slash / before vmlinuz-linux to get it to work.

shareimprove this answer answered Feb 4 '16 at 9:29

ChiseledAbs 360923 add a comment up vote 1 down vote Whether you need a boot loader or not depends on whether your particular version of the Linux kernel supports EFI BOOT STUB.

See the following for more information: https://www.kernel.org/doc/Documentation/efi-stub.txt

shareimprove this answer answered Feb 3 '16 at 4:46

fpmurphy1 1,024511 add a comment up vote 1 down vote IIRC, the EFI shell won't launch files as programs if their names don't end in .efi. Thus, you must first rename the kernel file so that its name ends in .efi.

If you can't rename the kernel file, you can still launch a kernel using the EFI stub loader via another boot manager program, such as gummiboot/systemd-boot or rEFInd. These tools don't care about the filename extension -- at least, not as much as the shell does. (rEFInd's auto-scanning feature matches to .efi, vmlinuz, bzImage*, and kernel*, but manual boot configuration for both programs will work with any filename.)

Also, as fpmurphy1 says, the kernel must be compiled with EFI stub support. Most distributions have included this support in their 3.3.0 and later kernels, but this may not be 100% universal, particularly if you compile your kernel yourself. (The last I checked, EFI stub support was not part of the default kernel configuration for kernel source obtained from kernel.org.)

shareimprove this answer answered Feb 3 '16 at 14:10

Rod Smith 16.7k21942

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment