Git Product home page Git Product logo

ebbr's Introduction

Embedded Base Boot Requirements (EBBR) specification

https://github.com/ARM-software/ebbr/actions/workflows/main.yaml/badge.svg?branch=main

The Embedded Base Boot Requirements specification defines requirements for embedded systems to enable inter-operability between SoCs, hardware platforms, firmware implementations, and operating system distributions. The aim is to establish consistent boot ABIs and behaviour so that supporting new hardware platforms does not require custom engineering work.

The first formal v1.0 release of EBBR was made in March 2019. You can find the current draft text in this repository, but be aware that everything in the draft text is subject to change. Official pdfs can be found in the "Releases" tab of this GitHub project.

Released EBBR PDFs can be found here:

https://github.com/ARM-software/ebbr/releases

The latest development version is available at:

https://ARM-software.github.io/ebbr/

Contributing

Anyone may contribute to EBBR. Discussion is on the [email protected] mailing list, and there is a weekly conference call. See CONTRIBUTING.rst for details.

Build Instructions

Requirements

On Debian and Ubuntu

# apt-get install python3-sphinx texlive texlive-latex-extra \
                  libalgorithm-diff-perl texlive-humanities \
                  texlive-generic-recommended texlive-generic-extra \
                  latexmk

If the version of python-sphinx installed is too old, then an additional new version can be installed with the Python package installer:

$ apt-get install python3-pip
$ pip3 install --user --upgrade Sphinx
$ export SPHINXBUILD=~/.local/bin/sphinx-build

Export SPHINXBUILD (see above) if Sphinx was installed with pip3 --user, then follow Make commands below.

Note: the .github/workflows/main.yaml CI configuration file installs the necessary dependencies for Ubuntu and can be used as an example.

On Fedora

# dnf install python3-sphinx texlive texlive-capt-of texlive-draftwatermark \
              texlive-fncychap texlive-framed texlive-needspace \
              texlive-tabulary texlive-titlesec texlive-upquote \
              texlive-wrapfig texinfo latexmk

On Mac OS X

  • Install MacTeX

  • Install pip if you do not have it:

    $ sudo easy_install pip
    
  • Install Sphinx:

    $ pip install --user --upgrade Sphinx
    

Make Targets

To generate PDF:

$ make latexpdf

To generate hierarchy of HTML pages:

$ make html

To generate a single HTML page:

$ make singlehtml

To generate as text (useful for comparing different versions):

$ make text

Output goes in ./build subdirectory.

To run verifications on this repository:

$ make check

To get some help on the available targets:

$ make help

License

This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License (CC-BY-SA-4.0). To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.

Contributions are accepted under the same with sign-off under the Developer's Certificate of Origin. For more on contributing to EBBR, see CONTRIBUTING.rst.

A copy of the license is included in the LICENSE file.

Creative Commons License

Writers Guide

All documentation in this repository uses reStructuredText markup with Sphinx extensions.

All files in this project must include the relevant SPDX license identifier tag. Generally this means each .rst file should include the line

.. SPDX-License-Identifier: CC-BY-SA-4.0

In general, try to keep the text width to at most 80 columns. Try to write footnotes contents as close a possible to the places referencing them.

Sphinx Extensions

Sphinx extension files are kept under source/extensions/.

Debugging extensions is easier when running Sphinx with debug messages:

$ make singlehtml SPHINXOPTS=-vv

UEFI chapter links

We have an extension for referencing UEFI specifications chapters.

To reference UEFI section 6.1 for example, write:

:UEFI:`6.1`

This will be expanded to the following reference, with a link to the UEFI webpage:

UEFI § 6.1 Block Translation Table (BTT) Background

We keep the UEFI index .csv file under version control for caching, and we have a python script to re-generate it from the UEFI specification webpage. To re-generate the index file, do:

$ ./scripts/update_uefi_index.py

Original Document

Prior to being relicensed to CC-BY-SA 4.0, this specification was released by Arm. The original Draft v0.5 text can be found here:

EBBR Draft v0.5

ebbr's People

Contributors

agraf avatar atishp04 avatar daniel-thompson avatar glikely avatar hrw avatar jacmet avatar jbech-linaro avatar mayeulc avatar orangecms avatar ownia avatar sjg20 avatar vstehle avatar williamleara avatar wmills avatar xypron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ebbr's Issues

ACPI/DT-agnosticism violation in section 4.2

In Section 4.2, we currently have the following recommendation:

Vendors are recommended to use their Devicetree vendor prefix as their vendor subdirectory name.

Vendors that only produce platforms based on ACPI may not have such a prefix. Since ACPI is the preferred system description method (and the only one supported in SBBR), I suggest adding the words "ACPI vendor ID or" before "Devicetree vendor prefix", to read:

Vendors are recommended to use their ACPI vendor ID or Devicetree vendor prefix as their vendor subdirectory name.

Add Appendix for example use cases

Add an appendix that has example use cases to show the value and illustrate operation.
These are examples and are not requirements.
Will reference example platforms to show how use case can be achieved

Include such things as:

  • Installer removable media (or net boot media) installing to platform
  • Board specific media that prompts user for selection of possible OS'es to install (like RPi Noob)
  • OS Live disk image
  • Board specific recovery image (include to show that it is not bound to EBBR rules)

Fix language around runtime SetVariable()

Current language in EBBR requires runtime SetVariable() to work without OS intervention. However, there is no mechanism for doing this on systems with shared storage. (e.g. the OS owns the eMMC device, and corruption can occur if firmware attempts to perform writes to eMMC at runtime).

The language in chapter 3, section "Set Variable" needs to be fixed.

Specify how FDT is to be passed from UEFI

UEFI spec doesn't know anything about the configuration table GUID for FDT.

See https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_A_Feb14.pdf#page=172

...because of that, this spec should cover the GUID used to pass FDT (e.g. gFdtTableGuid = { 0xb1b621d5, 0xf19c, 0x41a5, { 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 } }), as well as requirements on memory - should this BS Data or RT Data? Should the memory type be ACPI NVS or it doesn't matter?

A

Support for UEFI secure boot

We should specify and have in the reference implementation support for UEFI secure boot.
There would need to be means to enroll keys etc.

RTC should be optional

Not all embedded platforms have an RTC, UEFI requires it.
Should it be optional in EBBR? At least for early levels?
Should we recommend OS actions to deal with this?

Storage location of device tree files

For binaries the UEFI specifies a default path for the storage of boot images to run if these are not specified by BootXXXX variables.

For flattened device trees (*.dtb) such a directory is not defined. U-Boot searches the EFI partition paths , \dtb, \dtb\current for a filename specified in the U-Boot configuration (CONFIG_DEFAULT_DEVICE_TREE) by default.

When using boot options BootXXXX or BootNext it is not specified how to declare the related device tree file. A solution might be to use variables FdtXXXX and FdtNext to define the device paths of the FDT matching the boot option.

Add AArch32 support

Current EBBR text only talks about AArch64 support. We want to support AArch32 also.

Add the requirements for AArch32

Support HTTP boot

Section 24.7 HTTP boot of version 2.7 of the UEFI spec. Useful for provisioning of devices.

README should help readers not just writters/contributors

The current README helps people get started on building the document from source and helping to author it. This is good and helpful.

However, right up front we should provide guidance for people that find this site that only want to read the current version (or current released version). Is this just a link to the single *.md file or will it be more complex in the future? When we have a PDF CI loop we could publish the PDF results also and (under a constant URL) add a link in the README.

Variable update at runtime

In chapter 4 this requirement is made:

"Firmware needs a method to modify variable storage at runtime while the OS controls access to the device."

In the footnote: "If firmware doesn't have a dedicated channel to the storage device, then the OS must proxy all runtime storage IO."

  • The requirement is superfluous if we do not require SetVariable() to be implemented.
  • It is completely unclear how an OS could proxy runtime storage IO.

The requirement should be removed.

Create appendix or addendum for secure platform requirements

From mailing list discussion (courtesy Sumit Garg):

What do you think of a security addendum or checklist that goes
alongside EBBR to detail what is required to make the platform actually
secure?

I would be in favour of such a security addendum.

IMO, "make the platform actually secure" has a bit wider scope than
just secure boot. And the scope may vary depending on the threat model
which may be specific to a particular use-case. So I will try to list
down security features along with their requirements as follows.
Please feel free to extend this list in case I missed any relevant
security feature:

Feature: Secure boot
Platform requirements:

  • BootROM being the Root of Trust for Secure boot shall initiate the
    chain of trust via verifying the first stage boot-loader.
  • Provide platform binding of the root public key used for verification.

Feature: Anti-rollback protection
Platform requirements:

  • BootROM shall provide anti-rollback protection for first stage
    boot-loader updates.

Feature: Unbrickable firmware updates
Platform requirements:

  • BootROM shall support A/B partition scheme to load first stage
    boot-loader from alternate locations.

Feature: Secure storage
Platform requirements:

  • Either provide a dedicated non-volatile memory accessible to secure
    world only or provide a RPMB based secure storage.
  • Provide a Hardware Unique Key (HUK) which is accessible to the
    secure world only.

Feature: Secure entropy source
Platform requirements:

  • Provide a hardware entropy source which is accessible to secure world only.

Feature: Memory firewalls / TZASC
Platform requirements:

  • Provide a way to carve out DRAM so that it's accessible to the
    secure world only.

Feature: Secure peripherals / TZPC
Platform requirements:

  • Provide a way to partition peripherals so that secure peripherals
    are accessible to secure world only.

Clarify role of optional UEFI protocols

Currently, the specification lists certain UEFI protocols as required, and others optional. Some protocols, for example EFI_GRAPHICS_OUTPUT_PROTOCOL, are listed in neither category. This can be construed such that supporting EFI_GRAPHICS_OUTPUT_PROTOCOL is forbidden.

It needs to be clarified what it means for a protocol to be optional vs. not listed at all.

Provide a positive list of requirements

In the EBBR we require to implement everything that is in chapter "2.6 Requirements" of the UEFI spec if it is not explicitly excluded in the EBBR.

  • This requires scope that is far too big for the embedded use case.
  • This is not easily testable because of the many cross references in the UEFI spec.
  • It is a scope that U-Boot will never implement.

We should return to a positive list of requirements.

Here are examples of what should be discussed:

  • support for EFI_LOAD_FILE_PROTOCOL and EFI_LOAD_FILE2_PROTOCOL in LoadImage()
  • support for EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL and EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL in ConnectController()
  • supported nodes in EFI_DEVICE_PATH_TO_TEXT_PROTOCOL

Especially for protocols to be implemented we need a list identifying the once really needed to be implemented. Protocols required by chapter 2.6 and not implemented in U-Boot include for example:

  • EFI_DISK_IO_PROTOCOL
  • EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL
  • EFI_EDID_DISCOVERED_PROTOCOL
  • EFI_EDID_ACTIVE_PROTOCOL

Document requirements when platforms stores variables in shared storage

Many embedded platforms only have a single type of storage (ex. eMMC) that is used to store firmware images, firmware variables, and the operating system itself. Shared storage poses problems if both firmware and the OS need to access it at runtime (ex. to store variables in a SetVariable() runtime service call).

Document what is required of the firmware and of the OS to used shared storage for variable storage at runtime.

Document hardware need (if any)

Draft EBBR does not mention any hardware requirement expect ARM CPU architecture.
Purpose of this ticket to mention hardware need (if any) like interrupt controllers, timers etc.
IMO, a small note in this document should be ok .

Create standard path layout for system firmware partitions

To facilitate storing system firmware for multiple SoCs on the same block device, we need a standard path layout for where to store the firmware files. Each Vendor/SoC should get its own subdirectory.

Having a path standard is needed for both the separate system firmware partition scenario, and the firmware-files-in-ESP scenario

DT stability needs to get annotated

We should require device trees to be backwards compatible. The easiest way to ensure this is to have a tag in the DT that tells reviewers and users of the DT that they can expect backwards compatibility of the device tree.

This tag and requirement of the tag needs to get documented in EBBR. Without the tag, EBBR compliance won't exist.

The tag also needs to get an official binding in the Linux DT binding documents.

Add Intro section that gives some (non-binding) context

I think we need an intro section that shows what our approach is and why this is different than the server requirements.

Examples: (not these words)

  • Spec is implementation independent but is defined so it can be satisfied by Tianocore/EDK2 or u-boot
  • DeviceTree or ACPI
  • "Embedded" platforms may not have RTC or require OS and firmware to share a single storage medium

We should also discuss the "levels" of EBBR and how we approach that.

RISC-V: calling convention

UEFI 2.8B spec chapter "2.3.7.3 Detailed Calling Convention" does not describe which registers are saved by the UEFI payload's entry point and restored by the payload before calling the UEFI API or returning to the UEFI payload. This concerns especially
registers gp (x3) and tp (x4).

Into the EBBR or UEFI spec we should put a link to the "RISC-V ELF psABI specification" https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md which is referenced by "The RISC-V Instruction Set Manual".

From the "RISC-V ELF psABI specification" one might conclude that the UEFI payload should not be allowed to change gp and tp before calling ExitBootServices() or SetVirtualAddressMap() whichever occurs last.

Due to this missing clarification U-Boot is currently saving gp before calling the entry point of the payload and restores it on reentry or on entry of an API call. Nothing is done for tp.

ResetSystem() fallback behavior

The ResetSystem() runtime service is marked as optional after ExitBootServices().

With UEFI 2.8 Erratum A the OS would be able to detect that it is not implemented by inspecting the configuration table EFI_RT_PROPERTIES_TABLE. Linux before patch 9b42f76ad58b3f6 does not check this table.

So it is unclear what an unimplemented ResetSystem() should do:

  • simply return (as EDK II mentions in comments)
  • hang in an endless loop (as U-Boot v2020.07 does)

ResetShutdown() has this comment in EDK II: "System shutdown should not return, if
it returns, it means the system does not support shut down reset."

ResetWarm() has this comment in EDK II: "System reset should not return, if it
returns, it means the system does not support warm reset."

If ResetSystem() returns, Linux will try to reset the board by its own means which makes more sense than hanging in an endless loop.

Best regards

Heinrich

cc. @agraf

RISC-V: privilege level when entering OS

The UEFI spec has this sentence:

"When UEFI firmware handoff control to OS, the RISC-V is operated in machine-mode privilege." (M-mode is the equivalent to EL3 in ARM). This does not make any sense to me when using a secure execution environement (SEE) like OpenSBI.

The hand-off should occur in S-Mode if the CPU supports it and only in M-Mode when the CPU only supports M-mode.

We should prescribe this in the EBBR and somehow get the UEFI spec fixed afterwards.

Change EBBR to allow MBR partitioning

GPT partitioning is preferred, but many SoCs use boot schemes that are incompatible with the GPT partition table.

Change the spec to allow MBR or GPT partitioning

Reevaluate priority of PSCI and UEFI interfaces for system reboot

Some feedback on EBBR suggested that this doesn't match how an existing OS already behaves:

"Note: On platforms implementing the Power State Coordination Interface specification [PSCI], it is still required that EBBR compliant Operating Systems calls to reset the system will go via Runtime Services and not directly to PSCI."

It can be argued that the PSCI interfaces are more trustworthy than UEFI interface which requires running firmware code in the kernel context. Need to reevaluate this guidance before a v1.0 release

Add Appendix for example platforms

Add 2 or 3 example platforms in an appendix to illustrate the range of platforms. Don't make the list exhaustive and don't try to cover the worst case.

Support for EFI_RNG_PROTOCOL to provide a random seed for KASLR

The UEFI spec allows to provide a random seed to the kernel. Implement the ability to provide a random seed to enable KASLR in the kernel using the UEFI interface. There should be the ability to use a HW entropy source to provide the seed. It might be worthwhile to provide a default software means of generating a random seed but there might be other implications to that.

Need policy on sharing devices between FW and OS

EBBR needs to comment on whether it is okay for firmware to access devices at runtime (ie. via a Runtime Services call, or via SecureWorld).

Typically there should be no sharing of devices at all. A device's register interface should be either entirely owned by firmware or entirely owned by the OS.

Add implementors notes for U-Boot platforms

The U-Boot project supports a subset of the UEFI specification, but EBBR compliance also depends on how U-Boot is configured. Add an appendix or supplemental document detailing how to configure U-Boot to be EBBR compliant.

Document partitioning tool rules for shared storage

If storage is shared between the OS and FW, any operating system installer program must take care not to overwrite critical firmware components.

Document the requirements on OS storage partitioning and filesystem formatting tools.

Standardizing the devicetree overlay handling at the bootloader level

Embedded devices need a standard way to pass devicetree overlays during boot. Currently, both u-boot and edk2 (not sure how much) have support for handling devicetree overlays, so a standard way to pass and apply them before passing the final dtb to kernel needs to be provisioned.

Below are some of the options:

  1. Separate dtbo partition which can hold an overlay at a time.
  2. A vfat based dtbo partition for handling multiple overlays.
  3. Multiple dtbo partitions like how Android is doing.

CC: @johnstultz-work

Document scope of level 0, level 1, etc.

A roadmap document to describe which features we hope to target for what level would be very useful... especially to keep us focused on getting level 0 out of the door!

UEFI version number mismatch

EBBR v1.0 requires compliance with UEFI specification v2.7 (section 2.1), and then later refers to UEFI v2.8 in section 2.5.3. The whole specification should refer to a single UEFI version.

Update EBBR to use BBR instead of SBBR

Arm has refactored the SBBR document to include a generic part (BBR, Base Boot Requirements) and segment specific recepies (e.g., SBBR, Server Base Boot Requirements). The BBR structure makes it easier for EBBR to draw from language already in the BBR spec without duplicating language from SBBR.

EBBR should be refactored to refer to the generic portions of BBR, particularly in regard to exception level handling and secure world interfaces (PSCI, etc).

BBR Spec: https://developer.arm.com/documentation/den0044/latest

Add RISC-V architectural requirements

The EBBR is applicable independent of architecture but architectural requirements have only been described for ARM. Here is a list of ideas:

  • passing of booting hart and device-tree to next stage
  • privilege levels
  • SBI HSM extension
  • reference to booting section of RISC-V Platform specification

Cc. @avpatel, @lbmeng

Exclude EFI_DECOMPRESS_PROTOCOL

The UEFI specifiction does not describe the compression algorithm used for the EFI_DECOMPRESS_PROTOCOL. Only sample code is provided. So it is impossible to create an independent implementation.

BaseTools/Source/C/Common/EfiCompress.c has a BSD-2-Clause-Patent license. It is unknown if an independent implementation of the compression protocol would infringe Intel's patents.

We should exclude the requirement to implement the EFI_DECOMPRESS_PROTOCOL from the EBBR specification.

Could/should firmware be placed on a GPT disk outside the useable LBAs

On systems where the boot ROM is hardcoded to fetch firmware from a block address >=2 and <34 (yes, they exist) it appears possible and standards compliant to place (for example):

  • Protective MBR at LBA0
  • GPT header in LBA1
  • Firmware at LBA16
  • GPT partition table in LBA(8192 - 32)
  • First usable LBA: LBA8192

Current EBBR text is unclear about whether the above is permitted or not. Currently we require GPT except where it is impossible and we require firmware to reside within protective partitions except where impossible. It's not clear which of these rules should take precedent!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.