Introducing 

Prezi AI.

Your new presentation assistant.

Refine, enhance, and tailor your content, source relevant images, and edit visuals quicker than ever before.

Loading…
Transcript

Way back in 2.5.64

bzImage

`dd if=bzImage of=/dev/sda`

wait, what?

_start()

bootsect.o

setup_sects

  • Relocate itself at 0x90000
  • Load setup.o at 0x90200
  • Load system at 0x100000

To loot, you first need to boot

start_of_setup()

setup.o

  • Check memory layout
  • Setup idt/gdt
  • Switch to protected mode
  • Jump at 0x100000

proot

startup_32()

decompress_kernel()

{head,misc}.o

  • Decompress the kernel in-place
  • Re-jump at 0x100000 into startup_32

The case of piggy.o

As of 3.2.55

setup_sects

start_of_setup()

main()

setup_video()

startup_32()

decompress_kernel()

  • dummy bootsect.S
  • setup.S moved to main.c
  • creation of header.S

linux!

Booting like normal people

  • Load real-mode code at an offset in low-memory (below 1Mo)
  • Load command-line right behind the real-mode code
  • Load the vmlinux.bin.gz file above 0x100000
  • Jump over the dummy MBR into _start()
  • Jump directly into start_of_setup(), which calls main

How do I do?

Basic concepts

The UEFI boot stub

Booting for men, by men

UEFI: Introduction

Encapsulated in Portable Executable file (PE)

Easy development possible thanks to gnu-efi

Sample application:

Since linux 3.3

gnu-efi is for noobs

hand-made PE headers

Legacy Boot: Conclusion

Three types of application:

  • Simple app (type=10)
  • Boot Services (type=11)
  • Runtime Services (type=12)

Services implement protocols (drivers) and handles (devices)

Apps stored on EFI fat32 partition of type 0xEF

  • EFI by Intel in 2001 for IA64
  • Goals: get rid of 16 to 32 to 64 bits booting, provide user-friendly API, unify boot procedure
  • UEFI in 2005 by major actors: Intel, AMD, Dell, Apple, IBM, Microsoft, Phoenix...

Boot manager using NvRAM:

Boot order defaults to:

  • Try to boot on floppy
  • Try to boot on hard drive
  • Try to boot on NIC0
  • Run a shell application

Editable via `efibootmgr` and efivars or efivarfs modules

EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab)

{

SIMPLE_TEXT_OUTPUT_INTERFACE *conout;

InitializeLib(image_handle, systab);

conout = systab->ConOut;

uefi_call_wrapper(conout->OutputString, 2, conout, (CHAR16 *)L"Hello World!\n\r");

}

echo "CONFIG_EFI_STUB=y" >> .config

make -j8

mv arch/x86/boot/bzImage /boot/efi/EFI/bzImage.efi

cp /boot/initramfs-linux.img /boot/efi/EFI/initramfs.img

reboot

bzImage.efi root=/dev/sda2 initrd=EFI\initramfs.img

Learn more about creating dynamic, engaging presentations with Prezi