Files
alkane-os/ci/afw_boards.py
T

186 lines
6.8 KiB
Python

# SPDX-License-Identifier: MIT
"""Board profiles used by the .afw producer and the CI checker.
An .afw is valid for exactly one board family. The arch and bootloader policy
come from this table, never from the caller alone, so a bundle cannot claim a
board it was not built for. cv1835 and am335x have complete, buildable profiles in this release; the
other Antminer families are listed so a wrong-board bundle is rejected by name
instead of being accepted as "unknown".
"""
AM335X_PARTITIONS = [
{"name": "mtd0", "device": "/dev/mtd0", "offset": 0x0000000, "size": 0x20000,
"secure": True, "boot_critical": True, "write_order": 0, "image": None},
{"name": "mtd1", "device": "/dev/mtd1", "offset": 0x0020000, "size": 0x20000,
"secure": True, "boot_critical": True, "write_order": 0, "image": None},
{"name": "mtd2", "device": "/dev/mtd2", "offset": 0x0040000, "size": 0x20000,
"secure": True, "boot_critical": True, "write_order": 0, "image": None},
{"name": "mtd3", "device": "/dev/mtd3", "offset": 0x0060000, "size": 0x20000,
"secure": True, "boot_critical": True, "write_order": 0, "image": None},
{"name": "mtd4", "device": "/dev/mtd4", "offset": 0x0080000, "size": 0x1C0000,
"secure": True, "boot_critical": True, "write_order": 0, "image": None},
{"name": "mtd5", "device": "/dev/mtd5", "offset": 0x0240000, "size": 0x20000,
"secure": True, "boot_critical": True, "write_order": 0, "image": None},
{"name": "mtd6", "device": "/dev/mtd6", "offset": 0x0260000, "size": 0x20000,
"secure": False, "boot_critical": True, "write_order": 2, "image": "dtb"},
{"name": "mtd7", "device": "/dev/mtd7", "offset": 0x0280000, "size": 0x500000,
"secure": False, "boot_critical": True, "write_order": 3, "image": "kernel"},
{"name": "mtd8", "device": "/dev/mtd8", "offset": 0x0800000, "size": 0x1400000,
"secure": False, "boot_critical": True, "write_order": 1, "image": "rootfs"},
{"name": "mtd9", "device": "/dev/mtd9", "offset": 0x1C00000, "size": 0x200000,
"secure": True, "boot_critical": False, "write_order": 0, "image": None},
{"name": "mtd10", "device": "/dev/mtd10", "offset": 0x1E00000, "size": 0x200000,
"secure": True, "boot_critical": False, "write_order": 0, "image": None},
{"name": "mtd11", "device": "/dev/mtd11", "offset": 0x2000000, "size": 0x6000000,
"secure": True, "boot_critical": False, "write_order": 0, "image": None},
]
AM335X_IMAGES = [
{"name": "kernel", "source": "alkane-am335x.uImage", "role": "kernel",
"format": "uimage", "partition": "mtd7", "install": True, "exact_bytes": None},
{"name": "dtb", "source": "am335x-alkane.dtb", "role": "dtb",
"format": "fdt", "partition": "mtd6", "install": True, "exact_bytes": None},
{"name": "rootfs", "source": "alkane-am335x-ramdisk.uImage", "role": "rootfs",
"format": "uimage", "partition": "mtd8", "install": True, "exact_bytes": None},
]
BOARDS = {
"am335x": {
"arch": "arm",
"bootloader_policy": "preserve",
"buildable": True,
"format_checks": ["uimage", "fdt", "uimage"],
"partitions": AM335X_PARTITIONS,
"images": AM335X_IMAGES,
},
"cv1835": {
"arch": "arm64",
"bootloader_policy": "preserve",
"buildable": True,
"format_checks": ["fit", "arm64-image", "fdt", "cpio-gzip"],
"partitions": [
{
"name": "p1",
"device": "/dev/mmcblk0p1",
"offset": 0,
"size": 16 * 1024 * 1024,
"secure": False,
"boot_critical": True,
"write_order": 1,
"image": "p1",
},
{
"name": "p3",
"device": "/dev/mmcblk0p3",
"offset": 0,
"size": 32 * 1024 * 1024,
"secure": True,
"boot_critical": False,
"write_order": 0,
"image": None,
},
{
"name": "boot0",
"device": "/dev/mmcblk0boot0",
"offset": 0,
"size": 4 * 1024 * 1024,
"secure": True,
"boot_critical": True,
"write_order": 0,
"image": None,
},
{
"name": "boot1",
"device": "/dev/mmcblk0boot1",
"offset": 0,
"size": 4 * 1024 * 1024,
"secure": True,
"boot_critical": True,
"write_order": 0,
"image": None,
},
],
"images": [
{
"name": "kernel",
"source": "Image",
"role": "kernel",
"format": "arm64-image",
"partition": None,
"install": False,
"exact_bytes": None,
},
{
"name": "dtb",
"source": "cv-alkane.dtb",
"role": "dtb",
"format": "fdt",
"partition": None,
"install": False,
"exact_bytes": None,
},
{
"name": "rootfs",
"source": "rootfs.cpio.gz",
"role": "rootfs",
"format": "cpio-gzip",
"partition": None,
"install": False,
"exact_bytes": None,
},
{
"name": "p1",
"source": "alkane-cv1835-p1.fit",
"role": "boot",
"format": "fit",
"partition": "p1",
"install": True,
"exact_bytes": 16 * 1024 * 1024,
},
],
},
# Antminer families that the seven-board release gate still lists. They are
# known, so a wrong-board bundle is refused by identity, but they do not
# have a buildable .afw profile in this release.
"zynq-7010": {"arch": "armv7", "bootloader_policy": "preserve", "buildable": False},
"zynq-s17": {"arch": "armv7", "bootloader_policy": "include", "buildable": False},
"a113d": {"arch": "armv7", "bootloader_policy": "preserve", "buildable": False},
"a113d-s21pro": {"arch": "armv7", "bootloader_policy": "preserve", "buildable": False},
"am335x-bb": {"arch": "armv7", "bootloader_policy": "preserve", "buildable": False},
}
SAFE_IMAGE_FORMATS = {
"fit",
"arm64-image",
"fdt",
"cpio-gzip",
"uimage",
"raw",
}
SAFE_IMAGE_ROLES = {
"kernel",
"dtb",
"rootfs",
"bootloader",
"boot",
"component",
}
def board(name):
"""Return the profile for a board family, or raise KeyError."""
return BOARDS[name]
def known_board(name):
return name in BOARDS
def expect_arch(name):
return BOARDS[name]["arch"]
def expect_policy(name):
return BOARDS[name]["bootloader_policy"]