SLIDE 1 Marrying U-Boot, UEFI and grub
SLIDE 2 About Me
- Alexander Graf
- KVM and QEMU developer for SUSE
- Server class PowerPC KVM port
- Nested SVM
- Founding member of SUSE ARM team
SLIDE 4 Boot ROM
Booting on ARM
SLIDE 5 Firmware Flash Boot ROM
Booting on ARM
SLIDE 6 Firmware Flash Boot ROM SD / USB / etc
Booting on ARM
custom extlinux vboot UEFI
SLIDE 7 Firmware, do not care Firmware Flash Boot ROM SD / USB / etc
Ideal Distro boot flow
custom extlinux vboot UEFI
SLIDE 8 Firmware, do not care Firmware Flash Boot ROM SD / USB / etc
Ideal Distro boot flow
One protocol to
rule them all
SLIDE 10 UEFI boot flow
UEFI
SLIDE 11 UEFI boot flow
UEFI
NVRAM
SLIDE 12 UEFI boot flow
UEFI
NVRAM
sda2/foo.efi mmc0/bar.efi eth0/dhcp4
SLIDE 13 UEFI boot flow
NVRAM
sda2/foo.efi mmc0/bar.efi eth0/dhcp4 UEFI
SLIDE 14 UEFI boot flow
NVRAM
sda2/foo.efi mmc0/bar.efi eth0/dhcp4
✗
UEFI
SLIDE 15 UEFI boot flow
NVRAM
sda2/foo.efi mmc0/bar.efi eth0/dhcp4
✗ ✗
UEFI
SLIDE 16 UEFI boot flow
NVRAM
sda2/foo.efi mmc0/bar.efi eth0/dhcp4
✗ ✗ ✗
UEFI
SLIDE 17 UEFI boot flow
Removable NVRAM
UEFI
SLIDE 18 UEFI boot flow
Removable NVRAM
sda/ESP/efi/
boot/bootaa64.efi mmc0/ESP/efi/
boot/bootaa64.efi cd0/eltorito/efi/
boot/bootaa64.efi UEFI
SLIDE 19 UEFI boot flow
Removable NVRAM
sda/ESP/efi/
boot/bootaa64.efi cd0/eltorito/efi/
boot/bootaa64.efi mmc0/ESP/efi/
boot/bootaa64.efi UEFI
SLIDE 20 UEFI boot flow
Removable NVRAM
sda/ESP/efi/
boot/bootaa64.efi cd0/eltorito/efi/
boot/bootaa64.efi
✗
mmc0/ESP/efi/
boot/bootaa64.efi UEFI
SLIDE 21 mmc0/ESP/efi/
boot/bootaa64.efi
UEFI boot flow
Removable NVRAM
sda/ESP/efi/
boot/bootaa64.efi cd0/eltorito/efi/
boot/bootaa64.efi
✗ ✗
UEFI
SLIDE 22 mmc0/ESP/efi/
boot/bootaa64.efi
UEFI boot flow
Removable NVRAM
sda/ESP/efi/
boot/bootaa64.efi cd0/eltorito/efi/
boot/bootaa64.efi
✗ ✗
✔
UEFI
SLIDE 23 mmc0/ESP/efi/
boot/bootaa64.efi
UEFI boot flow
Removable NVRAM
sda/ESP/efi/
boot/bootaa64.efi cd0/eltorito/efi/
boot/bootaa64.efi
✗ ✗
✔
bootaa64.efi
UEFI
SLIDE 24 UEFI boot flow
bootaa64.efi
UEFI
SLIDE 25 UEFI boot flow
bootaa64.efi EFI Runtime Data Console Boot Services Runtime Services Tables
UEFI
SLIDE 26 UEFI boot flow
bootaa64.efi EFI Runtime Data Console Runtime Services Tables
UEFI
Boot Services
SLIDE 27 UEFI boot flow
bootaa64.efi
UEFI
Boot Services
SLIDE 28 btrfs
UEFI boot flow
bootaa64.efi
UEFI
Boot Services
SLIDE 29 btrfs
UEFI boot flow
bootaa64.efi
UEFI
Boot Services
SLIDE 30 btrfs
UEFI boot flow
bootaa64.efi
UEFI
Boot Services
SLIDE 31 btrfs
UEFI boot flow
bootaa64.efi
✗ ✗
UEFI
Boot Services
✗
SLIDE 32 UEFI boot flow
Runtime Services NVRAM
UEFI
SLIDE 33 UEFI boot flow advantages
SLIDE 34 UEFI boot flow advantages
UEFI
SLIDE 35 Firmware, do not care
UEFI boot flow advantages
UEFI
SLIDE 36 Firmware, do not care
UEFI boot flow advantages
UEFI
SLIDE 37 Firmware, do not care
UEFI boot flow advantages
UEFI
btrfs
SLIDE 38 zfs Firmware, do not care
UEFI boot flow advantages
UEFI
btrfs
SLIDE 39 ext4 extension 593 zfs Firmware, do not care
UEFI boot flow advantages
UEFI
btrfs
SLIDE 40 ext4 extension 593 zfs Firmware, do not care
UEFI boot flow advantages
btrfs
UEFI
SLIDE 41 Firmware, do not care
UEFI boot flow advantages
UEFI
SLIDE 42 UEFI boot flow advantages
SLIDE 43
SLIDE 44
SLIDE 45 U-Boot
SLIDE 46 U
EFI_STATUS EFIAPI GetNextMonotonicCount ( OUT UINT64 *Count ) { if (Count == NULL) { return EFI_INVALID_PARAMETER; } *Count = gCurrentMonotonicCount++; return EFI_SUCCESS; }
SLIDE 47 static efi_status_t EFIAPI efi_get_next_monotonic_count(uint64_t *count) { static uint64_t mono = 0; EFI_ENTRY("%p", count); *count = mono++; return EFI_EXIT(EFI_SUCCESS); }
U-Boot
SLIDE 48 U
SLIDE 49 U UEFI
SLIDE 50 U
SLIDE 51 U Black Boxes
SLIDE 52 U-Boot
SLIDE 53 U-Boot Monolithic
SLIDE 54 U-Boot
SLIDE 55 U-Boot
core
SLIDE 56 U-Boot
core BBB
SLIDE 57 U-Boot
core BBB Open
Platform
SLIDE 58 U-Boot
core BBB Open
Platform
$ grep -R ARM configs/ | wc -l
684
SLIDE 59 U-Boot
Foundation for black box modules Monolithic, GPL Windows coding style Linux coding style Built to fork Built to include
SLIDE 64 UEFI interfaces
u32 block_size u64 last_block char read_only read_blocks() write_blocks()
SLIDE 65 UEFI interfaces
u8 mac_address[32] u8 ip_address[16] u8 media_present transmit() receive()
SLIDE 66 U-Boot interfaces
SLIDE 67 U-Boot interfaces
ulong blksz u64 lba char removable blk_dread() blk_dwrite()
eth_get_ethaddr() net_send_packet() eth_rx()
SLIDE 70 UEFI interfaces
efi_loader
SLIDE 71 efi_loader
SLIDE 72 efi_loader bootefi
SLIDE 73 bootefi
SLIDE 74 bootefi
SLIDE 75 bootefi
SLIDE 76 bootefi
U-Boot> load mmc 0:1 $kernel_addr_r Image
SLIDE 77 bootefi
U-Boot> load mmc 0:1 $kernel_addr_r Image reading Image 568320 bytes read in 165 ms (3.3 MiB/s)
SLIDE 78 bootefi
U-Boot> bootefi $kernel_addr_r $fdt_addr_r
SLIDE 79 bootefi
U-Boot> bootefi $kernel_addr_r $fdt_addr_r ## Starting EFI application at 0x01000000 … EFI stub: Booting Linux Kernel... EFI stub: UEFI Secure Boot is enabled. EFI stub: Using DTB from configuration table EFI stub: Exiting boot services and installing virtual address map...
SLIDE 80 bootefi
U-Boot> bootefi $kernel_addr_r $fdt_addr_r ## Starting EFI application at 0x01000000 … EFI stub: Booting Linux Kernel... EFI stub: UEFI Secure Boot is enabled. EFI stub: Using DTB from configuration table EFI stub: Exiting boot services and installing virtual address map...
SLIDE 81 bootefi
SLIDE 82 bootefi
SLIDE 83 bootefi
KASLR
SLIDE 84 efi_loader bootefi
SLIDE 85 efi_loader bootefi distro boot
SLIDE 86 distro boot
SLIDE 87 distro boot
boot_targets=mmc0 usb0 pxe dhcp
SLIDE 88 distro boot
boot_targets=mmc0 usb0 pxe dhcp
extlinux
SLIDE 89 distro boot
boot_targets=mmc0 usb0 pxe dhcp
extlinux boot.script
SLIDE 90 distro boot
boot_targets=mmc0 usb0 pxe dhcp
extlinux boot.script EFI
SLIDE 91 EFI distro boot
SLIDE 92 EFI distro boot
SLIDE 93 EFI distro boot Partition Table ESP
SLIDE 94 EFI distro boot ESP $fdtfile
SLIDE 95 EFI distro boot ESP $fdtfile / /dtb/ /dtb/current/ /boot/ /boot/dtb/ /boot/dtb/current/
SLIDE 96 EFI distro boot ESP $fdtfile efi/boot/bootaa64.efi
SLIDE 97 EFI distro boot ESP $fdtfile
SLIDE 98 EFI distro boot ESP $fdtfile
SLIDE 99 EFI distro boot ESP $fdtfile
SLIDE 100 EFI distro boot
✔
SLIDE 101 EFI distro boot
✔
SLIDE 102 EFI distro boot
SLIDE 103 EFI distro boot ISO9660 el torito
SLIDE 104 EFI distro boot ISO9660 el torito el torito
SLIDE 105 Partition Table EFI distro boot el torito el torito
SLIDE 106 Partition Table EFI distro boot el torito $fdtfile el torito
SLIDE 107 EFI distro boot
✔ ✔
SLIDE 108 EFI distro boot DHCP Distro Boot
SLIDE 109 EFI distro boot DHCP Distro Boot DHCP Server
SLIDE 110 EFI distro boot DHCP Distro Boot DHCP Server DHCP req
SLIDE 111 EFI & Arch VCI EFI distro boot DHCP Distro Boot DHCP Server DHCP req
SLIDE 112 filename EFI & Arch VCI EFI distro boot DHCP Distro Boot DHCP Server DHCP req DHCP ack
SLIDE 113 TFTP filename EFI & Arch VCI EFI distro boot DHCP Distro Boot DHCP Server DHCP req DHCP ack
SLIDE 114 EFI distro boot
✔ ✔ ✔
SLIDE 116 UEFI Tables
bootaa64.efi EFI Runtime Data Console Boot Services Runtime Services
UEFI
Tables
SLIDE 117 UEFI Tables
Tables
SLIDE 118 UEFI Tables
Tables
ACPI
SLIDE 119 UEFI Tables
Tables
ACPI
✗
SLIDE 120 UEFI Tables
Tables
ACPI
✗
SLIDE 121 UEFI Tables
Tables
SLIDE 122 Missing Features
SLIDE 123 Missing Features
NVRAM
SLIDE 124 Missing Features
NVRAM
SLIDE 125 Missing Features
NVRAM UEFI RTS
SLIDE 126 Missing Features
NVRAM UEFI RTS
✗
SLIDE 127 Missing Features
NVRAM UEFI RTS
✗ ✗
SLIDE 128 Missing Features
SLIDE 129 Missing Features
init
SLIDE 130 Missing Features
init
SLIDE 131 Missing Features
init
SLIDE 132 Missing Features
bootefi
SLIDE 133 Missing Features
bootefi
SLIDE 134 Missing Features
bootefi
✗
SLIDE 135 Missing Features
SLIDE 136 Missing Features
SLIDE 137 Missing Features
EFI Shell
SLIDE 138 Missing Features
✗
EFI Shell
SLIDE 139 Missing Features
✗
EFI Shell
✗
SLIDE 142 Why?
Department A Department B
SLIDE 155 Further Information
https://events.opensuse.org/conference/oSC16/program/proposal/946
SLIDE 156 External Sources
https://commons.wikimedia.org/wiki/File:Raspberry_Pi_B%2B_illustration.svg https://commons.wikimedia.org/wiki/File:Sd-card-1377140.svg
http://eu.mophie.com/shop/media/catalog/product/cache/3/small_image/270x330/9df78eab33525d08d6e5fb8d27136e95/u/s/usb-micro3-40-blk_usb-tip-detail_front-back_540px.jpg
https://commons.wikimedia.org/wiki/File:Circle-icons-submarine.svg https://commons.wikimedia.org/wiki/File:150-8-DIP.jpg https://commons.wikimedia.org/wiki/File:Hdd_icon.svg https://commons.wikimedia.org/wiki/File:ARM_CPU_icon.svg
http://findicons.com/icon/177982/memory#
SLIDE 157 OSA Icons
Icons received from http://www.opensecurityarchitecture.org/cms/library/icon-library
SLIDE 158 emojione Icons
Icons received from http://www.opensecurityarchitecture.org/cms/library/icon-library
SLIDE 159 Other Icons
http://findicons.com/icon/download/234261/clock/128/png
http://findicons.com/icon/439269/button_power
https://fosdem.org/2017/schedule/event/grub_new_maintainers/attachments/slides/1768/export/events/attachments/grub_new_maintainers/slides/1768/slides.pdf
https://de.wikipedia.org/wiki/BeagleBoard#/media/File:Beagle_Board_big.jpg https://thenounproject.com/term/folder-tree/27307/
https://commons.wikimedia.org/wiki/File:Crystal_Project_Hardware.png
http://findicons.com/icon/202613/folder_library
SLIDE 160 Other Icons
http://tumboy.tumblr.com/post/10052361836 http://findicons.com/icon/132807/b_leg_embossed http://findicons.com/icon/237892/text_plain
http://findicons.com/icon/226957/package_games_board