grub ancient and modern
play

GRUB, ancient and modern GRUB Legacy Of course originally just GRUB - PowerPoint PPT Presentation

GRUB, ancient and modern GRUB Legacy Of course originally just GRUB Started in 1995 by Erich Boleyn Multiboot Editable menus, reasonable FS interface BALGE Multiboot https://xkcd.com/927/ GRUB Legacy: stages Stage 1: MBR,


  1. GRUB, ancient and modern

  2. GRUB Legacy • Of course originally just GRUB • Started in 1995 by Erich Boleyn • Multiboot • Editable menus, reasonable FS interface • BALGE

  3. Multiboot https://xkcd.com/927/

  4. GRUB Legacy: stages • Stage 1: MBR, just reads first sector of Stage 1.5 and jumps to it • Stage 1.5: enough file system code to read Stage 2 from an ordinary file system • Stage 2: rest of loader, e.g. Linux boot code

  5. GRUB Legacy: problems • Ad-hoc FS abstraction, multiple stage1.5s • Not much other abstraction worth mentioning • Difficult to extend safely • Lots of PC/BIOS assumptions • Divergence

  6. GRUB 2 rewrite

  7. New design • Small kernel, almost everything in modules • grub-install detects modules needed to read /boot/grub/ and builds a core image • Heavy use of abstraction layers; highly composable • Userspace tools built from same code • 10 kLoC asm, 250 kLoC C (excluding libgcrypt) – Includes all arches; i386-pc 4.5 kLoC asm

  8. Architecture support • x86: BIOS, UEFI, Coreboot, IEEE1275 (!), Xen • PowerPC, SPARC: IEEE1275 • IA/64: UEFI • MIPS: ARC, Yeeloong, Fuloong, Loongson • ARM: U-Boot, UEFI • ARM64: UEFI

  9. Normal hacking routine • Hardest Legacy problems were with reading files from disk • Usually stuck with emulator + printf or (in extremis) gdb • grub-probe and grub-fstest • Spin-off benefits: grub-mount

  10. When userspace doesn't help • bash-style interactive shell; set debug=foo • grub-mkrescue • Easy to run configuration files or even plug in new commands

  11. Configuration • Debian update-grub → upstream, with clearer input/output separation • Now /etc/default/grub and /etc/grub.d/ • (Almost) all customisable • … but some customisation is hard

  12. PCs suck • MBR: no formal space for boot code – Trivial loader in 446 bytes – Embed rest of brain in file system – Skate edge of (non-)spec: use boot track • Unpredictable with multiple disks

  13. PCs suck (2) • GPT much better, but different problems • Variant MBR interpretations – Apple – boot flag on PMBR

  14. UEFI • New big thing on PCs; bye-bye legacy BIOS • Core support basically fine • “Secure Boot” works in Ubuntu, but needs archive signing set up in Debian • Can require signed kernels without impinging on freedom once MokManager is in place • ESP layout pain

  15. Non-x86 • powerpc/sparc basically work fine, though defaults not switched • Some mipsen work well, e.g. Yeeloong • Trend towards new architectures including GRUB port early on • Most recent port (arm64) was about 2000 lines

  16. Debian pros/cons • Other loaders: LILO, syslinux and friends, yaboot, etc. • Some pretty good, all smaller/simpler • … but result is complexity elsewhere • Any architecture, any disk layout • Portable loader allows common boot UI across architectures and common tools

  17. Help wanted • Mostly just me right now in Debian; BUGS • Everyone's boot problem is critical for them • Overhaul configuration • MBR robustness • Rest of UEFI • Xen • Take better advantage of ports

  18. Discussion Colin Watson <cjwatson@debian.org>

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend