<<

Coreboot with Rampayload and Slimbootloader with LinuxBoot

RON MINNICH, , [email protected] - US SUBRATA BANIK, Intel, [email protected] – INDIA LEAN SHENG TAN, Intel, [email protected] – MALAYSIA Wed, 4 September 2019 AGENDA Provide latest progress on Coreboot with Rampayload AND Slim with LinuxBoot

Scope

Rampayload LinuxBoot

- Remove redundant - Make full use of kernel programming like PCI - Keep boot kernel part of SPI enumeration, programming to optimize boot time. aka ramstage entirely. - Remove redundant drivers - Optimize boot flow with only programming from payload. required FW programming to boot.

2 COREBOOT WITH RAMPAYLOAD

4 Rampayload

Problem Statement Bootblock

• Functionality duplication in boot flow. • Impacting boot time. Verstage • On growing BIOS/Firmware boundary impacts SPI footprint and increasing bug fixing and porting effort across platform.

Solution romstage

• Have implementation perform ONLY required initialization to be done by BIOS. • Remove duplicate code/functionality to avoid higher SPI footprint postcar and minimize porting/debug fixing effort.

payload

Pilot on Client and IOT products with depthcharge, tianocore and linuxboot payloads

6 POC on latest IA-Chrome platform

bootblock romstage postcar ramstage

- Reset Vector - Chipset initialization - Calling FSP-S depthcharge - Processor Mode Switch - Filling FSP-M UPD - Tear down CAR - PCI enumeration and OS resource allocation - CAR Setup - Calling FSP-M - Setting up MTRR - Create e820, ACPI - Console Enabling - Create Cbmem Tables

Size: 59.1kB Size: 67.6kB Size: 24.0kB Size: 243.2kB

Remove “ramstage” and load payload from “postcar”

postcar - Tear down CAR depthcharge bootblock romstage - Calling FSP-S - Resource mapping for root device OS (B0:D0:F0) - Setting up MTRR - Fixed BAR programming for pre boot devices like emmc, gfx - Create e820, ACPI Tables Size: 59.1kB Size: 67.6kB Size: 102.0kB

What’s New: Rampayload is proposal to have a minimum functional firmware Save time block with Coreboot methodology to boot to OS (primarily Chrome but still by ~240ms capable of booting Windows and Linux). Text in red indicates a problem -- moving functionality, not removing it Impact: Status : WIP • Reduction of ramstage is eventually saving ~41% of code size = ~10% bug count [https://review.coreboot.org/#/q/project:coreboot+branch:master+topic:COREBOOT_LI reduction ? TE] • This effort might help OEM/ODM to reduce SPI flash size. • Improve significant boot performance – Able to reduce additional ~240ms of booting time on latest chrome platform. Origins of the idea

● RISC-V work revealed the ramstage was not always needed ● pgeorgi/rminnich discussion: ramstage could be a configurable payload ○ More flexibility on how ramstage is set up ○ Would allow us to make it optional where appropriate ○ Could make pieces optional, i.e. componentized ramstage ○ Including components from outside coreboot ● Discussions with other users (e.g. 3mdeb) indicated it would help them ● LinuxBoot server usage would benefit

10 Ram{stage,payload} should be configurable

● Example: PCI support ● depthcharge needs it ● Linux does not ● Example: S3 support ● Critical for mobile ● Not needed for server ● IoT not always requires it either ● We are taking a pause on coreboot work ● Using experience gained to guide other efforts ○ There is no ramstage on oreboot, we call it payloader ○ Componentize “ramstage” (Stage2) on Slim Bootloader

11 LINUX BOOT POC ON SLIM BOOTLOADER

12 Why LinuxBoot ‘Let Linux do it’

Problem Statement •Redundant chipset initialization in firmware (i.e. PCI enumeration, Coreboot graphics initialization, PMC driver etc ) U-boot SPL •Less debug capability in firmware (BIOS/ bootloader) Ramstage •Required additional changes to for new SOC/ board support in payload •Underlying SMI calls might compromise security or break real-time requirement Reduced •Any new driver like (eMMC/UFS/NvME) requires porting effort UEFI PEI LinuxBoot stage 2 / Linux stage 1B Solution Kernel • Improves boot reliability by replacing lightly-tested firmware drivers with hardened Linux drivers. Initramfs • Improves boot time by removing unnecessary code. • Allows customization of the initrd runtime to support site- specific needs (both device drivers as well as custom executables). • Proven approach for almost 20 years and industry-wide adoption in military, consumer electronics, and supercomputing systems – wherever reliability and performance are paramount. Source: https://www.linuxboot.org/ Architectural Design Boot Stages to Linux OS (Without LinuxBoot) Stage1A Stage1B Stage2 OS loader/ UEFI Linux OS FSP-T FSP-M FSP-S Payload

Boot Stages to Linux OS (LinuxBoot)

Stage1A Stage2 Linux Stage1B LinuxBoot Linux OS FSP-T FSP-M FSP-S OS

What’s New: • LinuxBoot Kernel replaces payload, hence removes the need for payload to load OS • Stage 2 is simplified as LinuxBoot kernel takes charge

15 Boot Stages Changes - Explained

• Faster boot time observed

• No more redundancy!

16 Building linuxboot payload

$ git clone [email protected]:linuxboot/mainboards $ cd mainboards/slimboot $ make getstuff $ go get github.com/u-root/u-root $ make kernel

Or can get from me ☺ How to build?

$ sudo apt-get install -y build-essential iasl python uuid-dev nasm openssl gcc-multilib qemu

$ git clone https://github.com/slimbootloader/slimbootloader.git

cd slimbootloader

$ python BuildLoader.py build qemu -p "cmdline.txt::Lz4;linuxboot:LINX:Dummy;cmdline.txt:CMDL:Dummy“ Dummy file

Command Line LinuxBoot Image for LinuxKernel

Store in PayloadPkg/PayloadBins

https://slimbootloader.github.io 18 Parameters File Variable Function

BuildLoader.py self.ENABLE_LINUX_PAYLOAD Linuxboot support

self.LOADER_RSVD_MEM_SIZE Reserved memory for Linux Kernel loading self.ENABLE_PCI_ENUM PCI enumeration

self.ENABLE_SMP_INIT MP initialization

Platform/ApollolakeBoardPkg/Boa self.EPAYLOAD_SIZE Linuxboot kernel size rdConfig.py /Platform/ApollolakeBoardPkg/Cfg GEN_CFG_DATA.PayloadId | 'LINX' Payload ID Data/CfgData_Ext_Up2.dlt

19 Demo Time!

Up Squared Board

20 SUMMARY

 Slim bootloader: Seamlessly support LinuxBoot – flexible boot solution

 Embrace open source/ industry requirements - LinuxBoot is being deployed today

 We used Slim Bootloader configurable stage2 to tailor the UP^2 for LinuxBoot 21 QUESTION & ANSWER