efi-stub.txt 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. The EFI Boot Stub
  2. ---------------------------
  3. On the x86 platform, a bzImage can masquerade as a PE/COFF image,
  4. thereby convincing EFI firmware loaders to load it as an EFI
  5. executable. The code that modifies the bzImage header, along with the
  6. EFI-specific entry point that the firmware loader jumps to are
  7. collectively known as the "EFI boot stub", and live in
  8. arch/x86/boot/header.S and arch/x86/boot/compressed/eboot.c,
  9. respectively.
  10. By using the EFI boot stub it's possible to boot a Linux kernel
  11. without the use of a conventional EFI boot loader, such as grub or
  12. elilo. Since the EFI boot stub performs the jobs of a boot loader, in
  13. a certain sense it *IS* the boot loader.
  14. The EFI boot stub is enabled with the CONFIG_EFI_STUB kernel option.
  15. **** How to install bzImage.efi
  16. The bzImage located in arch/x86/boot/bzImage must be copied to the EFI
  17. System Partiion (ESP) and renamed with the extension ".efi". Without
  18. the extension the EFI firmware loader will refuse to execute it. It's
  19. not possible to execute bzImage.efi from the usual Linux file systems
  20. because EFI firmware doesn't have support for them.
  21. **** Passing kernel parameters from the EFI shell
  22. Arguments to the kernel can be passed after bzImage.efi, e.g.
  23. fs0:> bzImage.efi console=ttyS0 root=/dev/sda4
  24. **** The "initrd=" option
  25. Like most boot loaders, the EFI stub allows the user to specify
  26. multiple initrd files using the "initrd=" option. This is the only EFI
  27. stub-specific command line parameter, everything else is passed to the
  28. kernel when it boots.
  29. The path to the initrd file must be an absolute path from the
  30. beginning of the ESP, relative path names do not work. Also, the path
  31. is an EFI-style path and directory elements must be separated with
  32. backslashes (\). For example, given the following directory layout,
  33. fs0:>
  34. Kernels\
  35. bzImage.efi
  36. initrd-large.img
  37. Ramdisks\
  38. initrd-small.img
  39. initrd-medium.img
  40. to boot with the initrd-large.img file if the current working
  41. directory is fs0:\Kernels, the following command must be used,
  42. fs0:\Kernels> bzImage.efi initrd=\Kernels\initrd-large.img
  43. Notice how bzImage.efi can be specified with a relative path. That's
  44. because the image we're executing is interpreted by the EFI shell,
  45. which understands relative paths, whereas the rest of the command line
  46. is passed to bzImage.efi.