RFC-0100 - 产品元数据

RFC-0100:商品元数据
状态已接受
领域
  • 开发者
说明

产品元数据的规范表示形式

Gerrit 更改
  • 523152
作者
审核人
提交日期(年-月-日)2021-04-30
审核日期(年-月-日)2021-06-02

总结

Fuchsia 软件开发套件 (SDK) 目前附带所谓的设备配置文件元数据(在本文档中,只是元数据),其架构在 //build/sdk/meta/device_profile.json 中定义。元数据旨在描述可在设备上安装的系统映像和软件包。我们发现该架构不完整,需要现代化改造。此外,SDK 之外的工具现在也需要这些元数据,从而提高了其重要性。

此 RFC 引入了此信息的新架构,作为平台和工具之间的合约,并说明了将来更新该架构的流程。

设计初衷

目前,元数据随 SDK 一起提供。它目前包含设备名称、该设备的文字说明,以及可供用户下载映像和软件包信息的 URI。我们发现,这些元数据难以保持最新且不完整,因此不可用。

工具最终依赖于有关映像和软件包的非官方惯例,或可能改变的硬编码假设(例如用于下载的 URI 的结构)。这样一来,如果这些惯例发生变化,这些工具很容易被破坏。

我们希望解决这些问题。我们将为元数据指定正式架构,以便工具使用。

在我们分发完整且易于使用的元数据时,SDK 用户将能够选择要刷写到设备或使用模拟器启动的映像,而无需 Fuchsia 基础架构或 SDK 团队提供重大帮助。SDK 开发者将通过单一可信来源向用户呈现商品相关信息。工具开发者将就如何使用此类信息制定明确的合同。

更新难易程度

目前,元数据在生成 SDK 的过程中是硬编码的,每当我们发布新图片时,都需要手动进行更新。这使得添加、重命名或移除元数据变得很麻烦,且容易出错。这些信息经常会过时,甚至更糟,根本不会添加。

在实践中,由于 SDK 使用方无法依赖于 SDK 附带的元数据的准确性,因此他们将软件包和映像的位置以及其他脆弱的依赖于实现的信息编入其工具中。例如,除了对网址进行硬编码之外,树外模拟器的启动还依赖于系统映像中是否存在未记录的 images.json 文件。

此方案为我们预期外部用户所依赖的元数据提供了新的架构。这是我们不断更新相关信息的动力。

完整性

现有的设备元数据缺少重要细节。例如,用于刷写设备的工具需要分区名称列表,以及要写入这些分区的文件名。这目前尚未正式实施,因此,我们分发的内容与执行刷写的工具之间没有合约。这就使得我们很难提供稳定性 / 兼容性保证。

如果架构缺乏完整性,又有更新元数据的难度,就会使问题变得更加复杂。例如,假设有一个模拟器工具示例,该工具希望确保启动的模拟器的架构与用户想要运行的映像相同。 在不尝试启动映像的情况下,该工具应该如何知道特定位置中的任何映像是否与特定架构兼容?更新架构后,我们可以获得一组同时描述图片架构及其位置的元数据。这样,该工具就可以直接为给定图像选择正确的架构。

此方案将概述元数据的初始架构,并提供更新路径以确保保持相关更新。

设计

  • 为元数据定义一个新架构。
  • 定义更新该架构的过程。
  • 在构建过程中生成遵循该架构的元数据,并在树中使用这些元数据。
  • 在 SDK 版本中分发遵循该架构的元数据,并从树外使用它们。
  • 提供使用元数据的标准工具和库,以用于刷写和模拟工作流。

请注意,虽然我们在此处定义了初始架构,但允许通过 API-Council 审核进行改进,而无需额外的 RFC。

定义

在本文档中,我们使用以下定义:

  • 架构是对元数据组织的正式描述。
  • 元数据是给定架构的具体实例化。
  • 工件是 URI 经常在元数据中引用的任何具体文件或数据。
  • 清单是包含工件列表的元数据。
  • 映像是刷写实体设备或启动模拟器所需的工件的集合。
  • 软件包是 Fuchsia 中软件分发的单元,通常打包为 Fuchsia ARchive (FAR) 文件。
  • 产品是用于创建映像和软件包的 build 配置
  • 产品软件包是映像和软件包的集合,它们是产品 build 的输出。
  • Target (device) 是指用于运行某产品的物理或虚拟 Fuchsia 设备。

我们将使用 JSON 来表示元数据。Schemata 以 json-schema.org 中定义的草稿 7 格式表示。

架构

本部分详细介绍了初始要求以及我们将对架构进行的初始更改。

初始架构的要求

  1. 元数据必须具有唯一的名称或 ID。
  2. 元数据必须具有人类可读的说明。
  3. 必须对元数据架构进行版本控制。
  4. 元数据必须指定目标设备硬件特性。其中必须至少包含以下内容:
    1. 目标 CPU 架构,目前为 arm64 或 x64。
  5. 元数据必须指定一个或多个商品套装,每个套装都必须包含:
    1. 一个唯一的名称。
    2. 直观易懂的说明。
    3. 一个映像软件包。
    4. 软件包。
  6. 元数据可能包含键值对形式的附加产品元数据,用于帮助用户选择所需的产品。此类元数据的示例包括 build 类型(用户与 eng)、启动类型(正常与被捕)。
  7. 映像或软件包软件包必须:
    1. 指定一个或多个基本 URI。
      1. URI 元数据必须允许用户指定特定格式。例如,对 URI 的访问可能是归档(tar 压缩或 zip)访问,也可能是纯文本。
      2. 使用此元数据的 SDK 工具必须支持 gshttp(s)file URI scheme。本地访问需要 file URI。
      3. 如果工件可公开访问,则使用此元数据的 SDK 工具不得要求进行身份验证。
    2. 指定闪存元数据,其中包含通过 fastboot 协议预配设备的足够详细信息。
    3. 指定模拟器元数据,其中包含足够的详细信息,用于在虚拟设备上启动映像。

架构演变

架构的演变未来有许多发展方向。 例如:

  1. 物理硬件元数据可能包括设备硬件功能,例如屏幕、键盘或指控设备的屏幕。
  2. 虚拟硬件元数据可以指定足以配置模拟器的虚拟设备特性。

考虑到这一点,架构已进行版本控制。版本是一个字符串,每当添加或移除架构的元素时,该字符串都会更新。工具可能以架构的多个不同版本为目标,或者用户可能需要借助旧版工具才能使用较旧的架构。

为了简化版本之间的转换,我们提出了一种灵活的解析和版本控制方案。我们引入了版本化信封来简化 JSON 解析。解析器可以读取版本字段,同时忽略 JSON 文档的其余部分。这样,该工具就可以为每个受支持的架构版本选择正确的解析器。

我们提议使用随机生成的 8 位十六进制数字对每个架构文件进行独立版本控制。此编号在所有现有架构文件中必须是唯一的。为了防止发生冲突,建议实现构建时碰撞检测,以防止意外重复提交。

由于一个架构可能会通过 $ref 功能包含其他架构,因此我们提议将架构的版本附加到架构文件名中。这不仅能消除常用文件(如 //build/sdk/meta/common.json)的多个版本之间的歧义,还会触发引荐来源网址架构的版本重新计算。

每项不兼容的架构更改(例如添加或移除必填字段)都会触发版本重新计算。

我们允许通过 API 审核流程更改架构。对架构所做的更改属于开发者功能区域。

实现

架构本身的实现主要是将架构添加到 fuchsia.git 并确保其通过 API 审核。此外还有两个问题:元数据是在哪里生成的?在哪里使用元数据?

最初将生成设备元数据:

  • 作为 fuchsia.git 中 Fuchsia build 的一部分;
  • 作为发布映像的一部分,以供在树外使用;以及

它也可能会在其他地方生成,尤其是针对在 SDK 版本之外发布的映像和软件包。

设备元数据主要由 ffx 工具使用,该工具将使用这些元数据来刷写设备和启动模拟器。因为我们将使用 SDK 发布此架构,因此 Fuchsia 树之外的工具也可能会使用与之关联的元数据。

如果使用此方法,所有刷写和模拟工作流(无论是在树内还是树外使用)都将使用设备元数据进行规范。

这两项工作要求的设计不在本 RFC 的范围之外。

通用架构

我们将按如下方式扩展 common.json 架构定义。无需考虑向后不兼容性,因为这不是不兼容的更改。为简洁起见,下文省略了 common.json 中的现有定义。

为简洁起见,我们省略了文件的原始内容,并使用 ... 表示遗漏。

/** build/sdk/meta/common.json */
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "id": "http://fuchsia.com/schemas/sdk/common.json",
  "definitions": {
    ...,
    "envelope": {
      "description": "A versioned envelope.",
      "type": "object",
      "properties": {
        "version": {"$ref": "#/definitions/version"},
        "data": {
          "description": "The payload."
         }
      },
      "required": [
        "version",
        "data"
      ],
      "additionalProperties": false
    },
    "versioned_sdk_element": {
      "type": "object",
      "allOf": [
        {"$ref": "#/definitions/envelope"},
        {
          "type": "object",
          "properties": {
            "data": {
              "oneOf": [
                {"$ref": "#/definitions/sdk_element"}
              ]
            }
          }
        }
      ]
    },
    "version": {
      "description": "An opaque version string. The string may include any characters. Tools must not attempt to draw any conclusions about inter version compatibility other than the version 'X' manifest complies with the version 'X' of the schema and is therefore parsable by the version 'X' parser. There are no guarantees, for example, a parser for version 'B' may be able to parse a JSON document versioned 'A'.",
      "type": "string",
      "minLength": 1
    },
  }
}

请注意,由于此架构定义了我们正在使用的架构版本,因此无法轻松进行更改。工具必须读取符合此架构的文件以了解封装的 JSON。

设备

由于设备上可能会安装多个映像,因此我们会将设备硬件规范分解到其自己的定义中。设备硬件规范有以下两种用途:

  1. 它介绍了运行映像所需的最低硬件要求。
  2. 它用于指定为了运行映像而创建的虚拟(模拟)设备。

我们为实体设备和虚拟设备引入了两个新的版本化 SDK 元素。

体质

目前,我们只关注实体设备的 CPU 架构。未来版本的架构中将添加其他硬件属性。为了提供完整示例,以下架构定义将信封架构与 sdk_element 架构1相结合。

/** build/sdk/meta/physical_device-c906d79c.json */
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "id": "http://fuchsia.com/schemas/sdk/physical_device-c906d79c.json",
  "description": "A physical device specification.",
  "type": "object",
  "allOf": [
    {"$ref": "common.json#/definitions/envelope"},
    {
      "type": "object",
      "properties": {
        "data": {
          "allOf": [
            {"$ref": "common.json#/definitions/sdk_element"},
            {
              "properties": {
                 "type": {
                   "allOf": [
                     {"$ref": "common.json#/definitions/type"},
                     {"enum": ["physical_device"]}
                   ]
                 }
              }
            },
            {"$ref": "hardware-f9928aa4391e2ae3644ce712074a1ef7.json#/definitions/requirements"}
          ]
        }
      }
    }
  ]
}

实体设备要求架构

我们可以通过这种架构表达设备硬件要求。这样,工具就可以确保设备硬件与我们将用于配置的工件相匹配。目前,本文仅介绍 CPU 架构。

/** build/sdk/meta/hardware-c0a116ca.json */
{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "definitions": {
        "requirements": {
            "properties": {
                "hardware": {
                    "additionalProperties": false,
                    "properties": {
                        "cpu": {
                            "additionalProperties": false,
                            "properties": {
                                "arch": {
                                    "oneOf": [
                                      {"$ref": "common.json#/definitions/target_arch"}
                                    ]
                                }
                            },
                            "required": ["arch"],
                            "type": "object"
                        }
                    },
                    "required": ["cpu"],
                    "type": "object"
                }
            },
            "required": ["hardware"],
            "type": "object"
        },
    },
    "description": "Hardware requirements for running a product image.",
    "id": "http://fuchsia.com/schemas/sdk/hardware-c0a116ca.json"
}

虚拟

根据虚拟设备规范,我们可以选择用于启动模拟器的适当产品包。在未来的版本中,我们将进一步开发该架构来配置模拟器。例如,下面的架构定义使用的是新定义的 versioned_sdk_element 架构。

/** build/sdk/meta/virtual_device-8a8e2ba9.json */
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "id": "http://fuchsia.com/schemas/sdk/virtual_device-8a8e2ba9.json",
  "description": "A virtual device specification for launching emulators.",
  "type": "object",
  "allOf": [
    {"$ref": "common.json#/definitions/versioned_sdk_element"},
    {
      "type": "object",
      "properties": {
        "data": {
          "type": "object",
          "properties": {
             "type": {
               "allOf": [
                 {"$ref": "common.json#/definitions/type"},
                 {"enum": ["virtual_device"]}
               ]
             },
             "description": {"type": "string"},
             "virtual": {"$ref": "virtual_hardware-4c5d1a5d.json#/definitions/spec"}
          },
          "required": ["virtual"]
        }
      }
    }
  ]
}

虚拟设备要求架构

虚拟硬件规范用于在启动模拟器时选择相应的产品软件包。

/** build/sdk/meta/virtual_hardware-4c5d1a5d.json */
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "id": "http://fuchsia.com/schemas/sdk/virtual_hardware-4c5d1a5d.json",
  "description": "A virtual device specification for launching emulators.",
  "definitions": {
    "spec": {
      "emu": {
        "type": "object",
        "properties": {
          "cpu": {
            "type": "object",
            "properties": {
              "arch": {
                "oneOf": [
                  {"$ref": "common.json#/definitions/target_arch"}
                ]
              }
            },
            "required": ["arch"],
            "additionalProperties": false
          }
        },
        "required": ["cpu"],
        "additionalProperties": false
      }
    },
    "required": ["emu"]
    }
  }
}

商品套装

通过映像和软件包软件包,您可以访问设备上安装的软件工件。

/** build/sdk/meta/product_bundle-514c2856.json */
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "id": "http://fuchsia.com/schemas/sdk/product_bundle-514c2856.json",
  "description": "Artifacts required to boot and run software on a device.",
  "type": "object",
   "allOf": [
    {"$ref": "common.json#/definitions/versioned_sdk_element"},
    {
      "type": "object",
      "properties": {
        "data": {
          "type": "object",
          "properties": {
             "type": {
               "allOf": [
                 {"$ref": "common.json#/definitions/type"},
                 {"enum": ["product_bundle"]}
               ]
             },
             "description": {
               "description": "A human readable description of the product bundle.",
               "type": "string"
             },
             "device_refs": {
               "description": "A list of physical or virtual device names this product can run on.",
               "type": "array",
               "minItems": 1,
               "items": {
                   "type": "string",
                   "minLength": 1
               }
             },
             "metadata": {
               "description": "A list of key-value pairs describing product dimensions. Tools must not rely on the presence or absence of certain keys. Tools may display them to the human user in order to assist them in selecting a desired image or log them for the sake of analytics. Typical metadata keys are: build_info_board, build_info_product, is_debug.",
               "$ref": "common.json#/definitions/key_value_list"
             },
             "manifests": {
               "description": "Manifests describing how to boot the product on a device.",
               "flash": {"$ref": "flash_manifest-c85dbd8e.json#/definitions/manifest"},
               "emu": {"$ref": "emu_manifest-b0708439.json#/definitions/manifest"}
             },
             "images": {
               "description": "A list of system image bundles. Each image bundle must be equivalent to all others. I.e., all image bundle URIs are effectively mirrors of each other. Their formats may vary. Pick an entry that best suits your needs.",
               "type": "array",
               "minItems": 1,
               "items": {"$ref": "#/definitions/image_bundle"}
             },
             "packages": {
               "description": "A list of package bundles. Each package bundle must be equivalent to all otherwise. I.e., all package bundle URIs are effectively mirrors of each other. Their formats may vary. Pick an entry that best suits your needs.",
               "type": "array",
               "minItems": 1,
               "items": {"$ref": "#/definitions/package_bundle"}
             }
          },
          "required": ["device_refs", "manifests", "images", "packages"]
        }
      }
    }
  ],
  "definitions": {
    "image_bundle": {
      "description": "A set of artifacts necessary to provision a physical or virtual device",
      "type": "object",
      "properties": {
         "base_uri": {
           "description": "A base URI for accessing artifacts in the bundle.",
           "$ref": "#/definitions/bundle_uri"
         },
         "format": {
           "description": "Bundle format: files - a directory layout; tgz - a gzipped tarball. In case of the 'files' format, the base base path points to a directory. The manifest paths is relative to the directory. To get a full path append a path inside the manifest to base_uri. In case of the 'tgz' format, the base path points to the archive. The manifest path is relative within the archive."
           "enum": [
             "files",
             "tgz"
            ]
         }
      },
      "required": [
        "base_uri",
        "format"
      ],
      "additionalProperties": false
    },
    "package_bundle": {
      "description": "A set of artifacts necessary to run a physical or virtual device",
      "type": "object",
      "properties": {
         "repo_uri": {
           "description": "A package repository URI. This may be an archive or a directory.",
           "$ref": "#/definitions/bundle_uri"
         },
         "format": {
           "description": "Repository format: files - a directory layout; tgz - a gzipped tarball.",
           "enum" : [
             "files",
             "tgz"
           ]
         },
         "blob_uri": {
           "description": "An optional blob repository URI. If omitted, it is assumed to be <repo_uri>/blobs. If repo_uri refers to a gzipped tarball, ./blobs directory is expected to be found inside the tarball.",
           "$ref": "#/definitions/bundle_uri"
         }
      },
      "required": [
        "repo_uri",
        "format"
      ],
      "additionalProperties": false
    },
    "bundle_uri": {
      "description": "Allowed system image and package bundle URIs.",
      "type": "string",
      "format": "uri",
      "pattern": "^(?:http|https|gs|file):\/\/"
    }
  }
}

Flash 架构

基于刷写架构的清单描述了刷写设备所需的映像工件。该清单与 build 生成的现有 flash.json 一致。Flash 元数据将嵌入到产品包 SDK 元素中。

/** build/sdk/meta/flash_manifest-c85dbd8e.json */
{

  "$schema": "http://json-schema.org/draft-07/schema#",
  "id": "http://fuchsia.com/schemas/sdk/flash_manifest-c85dbd8e.json",
  "description": "A manifest that describes how to flash a device.",
  "type": "object",
  "properties": {
    "manifest": {"$ref": "#/definitions/manifest"}
  },
  "required": ["manifest"],
  "additionalProperties": false,
  "definitions": {
    "manifest": {
      "description": "A named list of partitions and OEM files necessary to flash a device.",
      "type": "object",
      "properties": {
        "hw_revision" : {
          "description": "A board name used to verify whether the device can be flashed using this manifest.",
          "type": "string"
        },
        "products": {
          "description": "A list of product specifications that can be flashed onto the device.",
          "type": "array",
          "items": {"$ref": "#/definitions/product"},
          "minItems": 1
        }
      },
      "required": ["hw_revision", "products"],
      "additionalProperties": false
    },
    "product": {
      "description": "A named product specification.",
      "type": "object",
      "properties": {
        "name": {
          "description": "A unique name of this manifest.",
          "type": "string"
        },
        "partitions": {
          "description": "A list of partition names and file names corresponding to the partitions.",
          "$ref": "common.json#/definitions/key_value_list"
        },
        "bootloader_partitions": {
          "description": "A list of partition names and file names corresponding to the partitions.",
          "$ref": "common.json#/definitions/key_value_list"
        },
        "oem_files": {
          "description": "A list of OEM command and file names corresponding to the command.",
          "$ref": "common.json#/definitions/key_value_list"
        }
      },
      "required": ["name", "partitions"],
      "additionalProperties": false
    }
  }
}

模拟器架构

模拟器架构指定了在模拟器上启动产品所需的映像工件。

/** build/sdk/meta/emu_manifest-b0708439.json */
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "id": "http://fuchsia.com/schemas/sdk/emu_manifest-b0708439.json",
  "definitions": {
    "manifest": {
      "description": "A manifest that describes how to boot an emulator.",
      "type": "object",
      "properties": {
        "kernel": {
          "description": "A path to the kernel image file. The path is relative to the image bundle base.",
          "type": "string",
          "minLength": 1
        },
        "initial_ramdisk": {
          "description": "A path to the initial ramdisk, the kernel ZBI. The path is relative to the image bundle base.",
          "type": "string",
          "minLength": 1
        },
        "disk_images": {
          "description": "A list of one or more disk image paths to FVM images. Each path is relative to the image bundle base.",
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
          },
          "minItems": 1
        }
      },
      "required": ["kernel", "initial_ramdisk", "disk_images"],
      "additionalProperties": false
    }
  }
}

其他常见定义

以下是对常见定义的额外补充。如需了解与版本相关的新增内容,请参阅 common.json 部分。为简洁起见,下文省略了 common.json 中的现有定义。

/** build/sdk/meta/common.json */
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "id": "http://fuchsia.com/schemas/sdk/common.json",
  "definitions": {
    ...,
   "key_value": {
     "description": "A key-value pair.",
      "type": "array",
      "items": [
        {"type": "string"},
        {"type": ["number", "string"]}
      ],
      "minItems": 2,
      "additionalItems": false
    },
    "key_value_list": {
      "description": "A list of key-value pairs.",
      "type": "array",
      "items": {"$ref": "#/definitions/key_value"}
    }

示例

设备

物理设备

以下是设备硬件规格的示例。

{
  "version": "c906d79c",
  "data": {
    "type": "physical_device",
    "name": "generic-x64",
    "description": "A generic x64 device.",
    "hardware": {
      "cpu": {
        "arch": "x64"
      }
    }
  }
}

商品套装

实体设备上的终端

这是一个可在通用 x64 设备上启动的通用终端产品示例,该设备包含两个可通过基于 gshttps 的 URI 访问的映像和软件包的两个归档镜像。

{
  "version": "514c2856",
  "data": {
    "type": "product_bundle",
    "name": "generic-x64",
    "description": "A terminal x64 product.",
    "device_refs": ["generic-x64"],
    "metadata": [
      ["build-type", "release"],
      ["product", "terminal"]
    ],
    "manifests": {
      "flash": {
        "hw_revision": "x64",
        "products" : [
          {
            "bootloader_partitions": [],
            "name": "fuchsia",
            "oem_files": [],
            "partitions": [
              ["", "fuchsia.zbi"],
              ["", "zedboot.zbi"],
              ["", "fuchsia.vbmeta"],
              ["", "zedboot.vbmeta"]
            ]
          }
        ]
      }
    },
    "images": [
      {
        "base_uri": "gs://fuchsia/development/0.20201216.2.1/images/generic-x64.tgz",
        "format": "tgz"
      },
      {
        "base_uri": "https://storage.googleapis.com/fuchsia/development/0.20201216.2.1/images/generic-x64.tgz",
        "format": "tgz"
      }
    ],
    "packages": [
      {
        "repo_uri": "gs://fuchsia/development/0.20201216.2.1/packages/generic-x64.tar.gz",
        "format": "tgz"
      },
      {
        "repo_uri": "https://storage.googleapis.com/fuchsia/development/0.20201216.2.1/packages/generic-x64.tar.gz",
        "format": "tgz"
      }
    ]
  }
}
模拟器上的终端

这是一个可在 x64 模拟器上启动的通用终端产品示例。映像和软件包都可以直接从 GCS 访问。

{
  "version": "514c2856",
  "data": {
    "type": "product_bundle",
    "name": "generic-x64",
    "description": "A terminal x64 product.",
    "device_refs": ["qemu-x64"],
    "metadata": [
      ["build-type" , "debug"],
      ["product", "terminal"]
    ],
    "manifests": {
      "emu": {
        "kernel": "qemu-kernel.kernel",
        "initial_ramdisk": "zircon-a.zbi",
        "disk_images": ["storage-sparse.blk"]
      }
    },
    "images": [
      {
        "base_uri": "https://storage.googleapis.com/fuchsia-artifacts/builds/8852232026486839104/images/",
        "format": "files"
      }
    ],
    "packages": [
      {
        "repo_uri": "https://storage.googleapis.com/fuchsia-artifacts/builds/8852232026486839104/packages/",
        "blob_repo_uri": "https://storage.googleapis.com/fuchsia-artifacts/blobs/",
        "format": "files"
      }
    ]
  }
}

性能

这不太可能影响性能,因为元数据的生成和解析不是资源密集型。

工效学设计

发布标准化元数据时,无需进行脆弱的硬编码配置,因而可以更轻松地进行集成。

我们选择 JSON 是因为它是一种成熟的格式,并且是 Fuchsia 配置文件的实际标准。JSON 架构格式已正式化并经过同行评审。

向后兼容性

元数据的引入不会影响向后兼容性,因为现有元数据没有当前用户。

这些架构的未来修订版本将接受 API 审核,并按照标准的 LSC 流程(涉及测试和与高优先级客户的直接互动)进行管理。对架构定义进行版本控制将有助于该过程。

安全注意事项

基于这些架构的元数据在安全性上并不低于现有解决方案,后者是对类似信息的临时硬编码。

我们将在这些架构的生命周期早期提高工件交付的安全性。这可能在部署之前完成,具体取决于安全团队正在获取的反馈。重要的一点是,工具必须验证所下载工件的内容的完整性:工件必须是元数据发布时的预期内容。为此,您可以将哈希函数的输出添加到架构中,也可以使用支持完整性检查的协议(例如 TUF)。

作为 Fuchsia SDK 一部分提供的工具,如果使用此架构和提取工件,则必须实施额外的安全措施来确保传输安全,以防止中间人等攻击。为此,他们可能会拒绝从不安全 / 不可信的位置提取或使用工件。

隐私注意事项

此提案没有已知的隐私保护注意事项。发布元数据的个人或团队可能需要考虑隐私权方面的注意事项;我们希望他们自行执行隐私权审核。例如,发布元数据的团队可能需要仔细考虑他们跟踪下载的方式。

测试

虽然无需测试架构是否存在,但我们将确保由构建生成的元数据符合架构。我们还将进行兼容性测试,确保工具会根据需要继续使用旧架构。

文档

目前,我们未计划在架构本身之外编写任何文档,但可能会随需求而变化。创建或更新架构的开发者可能需要提供术语表、每个架构的使用方式以及它们之间的交互方式的说明。

缺点、替代方案和未知情况

我们将提交一个用于指定设备映像的特定 API。这样做的好处是可以提高不同版本的兼容性,利用现有的变更管理流程,并让我们能够分发一致工作的工具,但缺点是灵活性降低(由于官僚型障碍,更改架构需要更长的时间)。

早期技术和参考资料

本文档将前面提到的整个树中的常见配置收集并系统化。许多现有元数据都可以在 //build/images/BUILD.gn 中找到;例如,此处可以找到当前版本的刷写架构


  1. 所有元数据均以 SDK 元素的形式分发。