1.. _bin-blobs: 2 3Binary Blobs 4############ 5 6In the context of an operating system that supports multiple architectures and 7many different IC families, some functionality may be unavailable without the 8help of executable code distributed in binary form. Binary blobs (or blobs for 9short) are files containing proprietary machine code or data in a binary format, 10e.g. without corresponding source code released under an OSI approved license. 11 12Zephyr supports downloading and using third-party binary blobs via its built-in 13mechanisms, with some important caveats, described in the following sections. It 14is important to note that all the information in this section applies only to 15`upstream (vanilla) Zephyr <https://github.com/zephyrproject-rtos/zephyr>`_. 16 17There are no limitations whatsoever (except perhaps license compatibility) in 18the support for binary blobs in forks or third-party distributions of Zephyr. In 19fact, Zephyr’s build system supports arbitrary use cases related to blobs. This 20includes linking against libraries, flashing images to targets, etc. Users are 21therefore free to create Zephyr-based downstream software which uses binary 22blobs if they cannot meet the requirements described in this page. 23 24Software license 25**************** 26 27Most binary blobs are distributed under proprietary licenses which vary 28significantly in nature and conditions. It is up to the vendor to specify the 29license as part of the blob submission process. Blob vendors may impose a 30click-through or other EULA-like workflow when users fetch and install blobs. 31 32Hosting 33******* 34 35Blobs must be hosted on the Internet and managed by third-party infrastructure. 36Two potential examples are Git repositories and web servers managed by 37individual hardware vendors. 38 39The Zephyr Project does not host binary blobs in its Git repositories or 40anywhere else. 41 42Fetching blobs 43************** 44 45Blobs are fetched from official third-party sources by the :ref:`west blobs 46<west-blobs>` command. 47 48The blobs themselves must be specified in the :ref:`module.yml 49<modules-bin-blobs>` files included in separate Zephyr :ref:`module repositories 50<modules>` maintained by their respective vendors. This means that in order to 51include a reference to a binary blob to the upstream Zephyr distribution, a 52module repository must exist first or be created as part of the submission 53process. 54 55Each blob which may be fetched must be individually identified in the 56corresponding :file:`module.yml` file. A specification for a blob must contain: 57 58- An abstract description of the blob itself 59- Version information 60- A reference to vendor-provided documentation 61- The blob’s :ref:`type <bin-blobs-types>`, which must be one of the allowed types 62- A checksum for the blob, which ``west blobs`` checks after downloading. 63 This is required for reproducibility and to allow bisecting issues as blobs 64 change using Git and west 65- License text applicable to the blob or a reference to such text, in SPDX 66 format 67 68See the :ref:`corresponding section <modules-bin-blobs>` for a more formal 69definition of the fields. 70 71The :ref:`west blobs <west-blobs>` command can be used to list metadata of 72available blobs and to fetch blobs from user-selected modules. 73 74The ``west blobs`` command only fetches and stores the binary blobs themselves. 75Any accompanying code, including interface header files for the blobs, must be 76present in the corresponding module repository. 77 78Tainting 79******** 80 81Inclusion of binary blobs will taint the Zephyr build. The definition of 82tainting originates in the `Linux kernel 83<https://www.kernel.org/doc/html/latest/admin-guide/tainted-kernels.html>`_ and, 84in the context of Zephyr, a tainted image will be one that includes binary blobs 85in it. 86 87Tainting will be communicated to the user in the following manners: 88 89- One or more Kconfig options ``TAINT_BLOBS_*`` will be set to ``y`` 90- The Zephyr build system, during its configuration phase, will issue a warning. 91 It will be possible to disable the warning using Kconfig 92- The ``west spdx`` command will include the tainted status in its output 93- The kernel's default fatal error handler will also explicitly print out the 94 kernel's tainted status 95- The boot banner prints the kernel's tainted status 96 97.. _bin-blobs-types: 98 99Allowed types 100************* 101 102The following binary blob types are acceptable in Zephyr: 103 104* Precompiled libraries: Hardware enablement libraries, distributed in 105 precompiled binary form, typically for SoC peripherals. An example could be an 106 enablement library for a wireless peripheral 107* Firmware images: An image containing the executable code for a secondary 108 processor or CPU. This can be full or partial (typically delta or patch data) 109 and is generally copied into RAM or flash memory by the main CPU. An example 110 could be the firmware for the core running a Bluetooth LE Controller 111* Miscellaneous binary data files. An example could be pre-trained neural 112 network model data 113 114Hardware agnostic features provided via a proprietary library are not 115acceptable. For example, a proprietary and hardware agnostic TCP/IP stack 116distributed as a static archive would be rejected. 117 118Note that just because a blob has an acceptable type does not imply that it will 119be unconditionally accepted by the project; any blob may be rejected for other 120reasons on a case by case basis (see library-specific requirements below). 121In case of disagreement, the TSC is the arbiter of whether a particular blob 122fits in one of the above types. 123 124Precompiled library-specific requirements 125***************************************** 126 127This section contains additional requirements specific to precompiled library 128blobs. 129 130Any person who wishes to submit a precompiled library must represent that it 131meets these requirements. The project may remove a blob from the upstream 132distribution if it is discovered that the blob fails to meet these requirements 133later on. 134 135Interface header files 136====================== 137 138The precompiled library must be accompanied by one or more header files, 139distributed under a non-copyleft OSI approved license, that define the interface 140to the library. 141 142Allowed dependencies 143==================== 144 145This section defines requirements related to external symbols that a library 146blob requires the build system to provide. 147 148* The blob must not depend on Zephyr APIs directly. In other words, it must have 149 been possible to build the binary without any Zephyr source code present at 150 all. This is required for loose coupling and maintainability, since Zephyr 151 APIs may change and such blobs cannot be modified by all project maintainers 152* Instead, if the code in the precompiled library requires functionality 153 provided by Zephyr (or an RTOS in general), an implementation of an OS 154 abstraction layer (aka porting layer) can be provided alongside the library. 155 The implementation of this OS abstraction layer must be in source code form, 156 released under an OSI approved license and documented using Doxygen. 157 158Toolchain requirements 159====================== 160 161Precompiled library blobs must be in a data format which is compatible with and 162can be linked by a toolchain supported by the Zephyr Project. This is required 163for maintainability and usability. Use of such libraries may require special 164compiler and/or linker flags, however. For example, a porting layer may require 165special flags, or a static archive may require use of specific linker flags. 166 167Limited scope 168============= 169 170Allowing arbitrary library blobs carries a risk of degrading the degree to 171which the upstream Zephyr software distribution is open source. As an extreme 172example, a target with a zephyr kernel clock driver that is just a porting layer 173around a library blob would not be bootable with open source software. 174 175To mitigate this risk, the scope of upstream library blobs is limited. The 176project maintainers define an open source test suite that an upstream 177target must be able to pass using only open source software included in the 178mainline distribution and its modules. The open source test suite currently 179consists of: 180 181- :file:`samples/philosophers` 182- :file:`tests/kernel` 183 184The scope of this test suite may grow over time. The goal is to specify 185tests for a minimal feature set which must be supported via open source software 186for any target with upstream Zephyr support. 187 188At the discretion of the release team, the project may remove support for a 189hardware target if it cannot pass this test suite. 190 191Support and maintenance 192*********************** 193 194The Zephyr Project is not expected to be responsible for the maintenance and 195support of contributed binary blobs. As a consequence, at the discretion of the 196Zephyr Project release team, and on a case-by-case basis: 197 198- GitHub issues reported on the zephyr repository tracker that require use of 199 blobs to reproduce may not be treated as bugs 200- Such issues may be closed as out of scope of the Zephyr project 201 202This does not imply that issues which require blobs to reproduce will be closed 203without investigation. For example, the issue may be exposing a bug in a Zephyr 204code path that is difficult or impossible to trigger without a blob. Project 205maintainers may accept and attempt to resolve such issues. 206 207However, some flexibility is required because project maintainers may not be 208able to determine if a given issue is due to a bug in Zephyr or the blob itself, 209may be unable to reproduce the bug due to lack of hardware, etc. 210 211Blobs must have designated maintainers that must be responsive to issue reports 212from users and provide updates to the blobs to address issues. At the discretion 213of the Zephyr Project release team, module revisions referencing blobs may be 214removed from :file:`zephyr/west.yml` at any time due to lack of responsiveness or 215support from their maintainers. This is required to maintain project control 216over bit-rot, security issues, etc. 217 218The submitter of the proposal to integrate a binary blob must commit to maintain 219the integration of such blob for the foreseeable future. 220 221Regarding Continuous Integration, binary blobs will **not** be fetched in the 222project's CI infrastructure that builds and optionally executes tests and samples 223to prevent regressions and issues from entering the codebase. This includes 224both CI ran when a new GitHub Pull Request is opened as well as any other 225regularly scheduled execution of the CI infrastructure. 226 227.. _blobs-process: 228 229Submission and review process 230***************************** 231 232For references to binary blobs to be included in the project, they must be 233reviewed and accepted by the Technical Steering Committee (TSC). This process is 234only required for new binary blobs, updates to binary blobs follow the 235:ref:`module update procedure <modules_changes>`. 236 237A request for integration with binary blobs must be made by creating a new 238issue in the Zephyr project issue tracking system on GitHub with details 239about the blobs and the functionality they provide to the project. 240 241Follow the steps below to begin the submission process: 242 243#. Make sure to read through the :ref:`bin-blobs` section in 244 detail, so that you are informed of the criteria used by the TSC in order to 245 approve or reject a request 246#. Use the :github:`New Binary Blobs Issue 247 <new?assignees=&labels=RFC&template=008_bin-blobs.md&title=>` to open an issue 248#. Fill out all required sections, making sure you provide enough detail for the 249 TSC to assess the merit of the request. Additionally you must also create a Pull 250 Request that demonstrates the integration of the binary blobs and then 251 link to it from the issue 252#. Wait for feedback from the TSC, respond to any additional questions added as 253 GitHub issue comments 254 255If, after consideration by the TSC, the submission of the binary blob(s) is 256approved, the submission process is complete and the binary blob(s) can be 257integrated. 258