OptiStick 5 (S905X5M) Secure Boot

2026-10-29 · Wilber Zheng · Sources: Amlogic SDK aml-comp/uboot/fip/s7d/ and meta-meson/; Amlogic "Yocto SDK Enable Secureboot User Guide" rev 0.1 (T6D example, shared by SEI)

1. Amlogic standard flow

1.1 Generate keys (once, offline)

1.2 Root cert and root hash

1.3 eFuse pattern

1.4 Sign firmware (Yocto scs feature, every release)

  1. Copy device-keys/ and fw_arb.cfg to aml-comp/prebuilt/hosttools/aml-linux-scs/<soc>/<chipset>/. Only s4, sc2, t6d, t7 exist today; s7d must be added there and to SOC_FAMILY in aml-linux-scs-native_1.0.bb.
  2. Set DISTRO_FEATURES += "AVB scs".
  3. The build then:

1.5 Burn

1.6 What the options do

OptionEffectCost
Signature check (root hash + enable bits)Only firmware signed with our keys bootsFirmware content is not hidden. No secret goes to SEI.
DVGK / DVUKFirmware encrypted; only chips with the key can decryptSEI's pattern file carries secret keys
USB / DIF passwordUSB burning / debug port needs a per-unit passwordRework and reflash need a per-unit password

1.7 Flow chart: Amlogic standard

            OptiSigns (offline, once)                          SEI (mass production)
 ┌─────────────────────────────────────────┐
 │ 1. gen_all_device_key.sh                │
 │    4 root RSA-4096 key pairs (PEM)      │
 │    + lower-level signing keys (PEM)     │
 │    + DVGK / DVUK AES-128 (.bin)         │
 └───────────────┬─────────────────────────┘
                 │
     ┌───────────┴──────────────┐
     ▼                          ▼
 ┌──────────────────────┐  ┌──────────────────────────────────────┐
 │ 2. Root cert         │  │ 4. Sign firmware (every release)     │
 │  4 root public keys  │  │  a. export device-keys (no root key) │
 │  → SHA-256 (32 B)    │  │     + fw_arb.cfg into SDK            │
 └─────────┬────────────┘  │     aml-linux-scs/ (add s7d)         │
           ▼               │  b. DISTRO_FEATURES += "AVB scs"     │
 ┌──────────────────────┐  │  c. build: signed u-boot;            │
 │ 3. efuse-gen.sh      │  │     vbmeta/recovery signed           │
 │  pattern.efuse:      │  │     (SHA256_RSA4096)                 │
 │  root hash + enable  │  │  d. amlogic_scs_sign_whole_pkg.bash  │
 │  bits (no secrets)   │  │     → aml_upgrade_package_enc.img    │
 └─────────┬────────────┘  └──────────────────┬───────────────────┘
           │                                  │
           └──────────────► to SEI ◄──────────┘
                               │
                               ▼
                ┌──────────────────────────────┐
                │ 5. Burn signed firmware      │
                │ 6. Burn pattern.efuse        │
                │    (irreversible)            │
                └──────────────┬───────────────┘
                               ▼
                ┌──────────────────────────────┐
                │ Boot: ROM hashes root cert,  │
                │ compares with eFuse, then    │
                │ verifies each stage's sig.   │
                │ Unsigned firmware won't boot │
                └──────────────────────────────┘

 Key storage: root keys encrypted, offline, 2 copies.
              Signing keys in GCP Secret Manager, pulled only to sign.

2. Frank's approach

From Frank's draft mail to Amlogic. The names he uses exist in the SDK: CONFIG_AML_SIGNED_UBOOT in fip/s7d/build.sh (line 816 calls device-vendor-scs-signing.sh), and binary-tool/acpu-imagetool has --cmd-signpipe-device-root / -lvl1 / -lvl2 / -bl30..-lvl3.

2.1 Differences from the standard flow

Amlogic standardFrank
Where to signYocto scs: signed u-boot + whole package → aml_upgrade_package_enc.imgu-boot build only (CONFIG_AML_SIGNED_UBOOT=y → device-vendor-scs-signing.sh); no Yocto scs
Private keysPEM files from opensslAll RSA-4096 in Google Cloud KMS, not exportable; acpu-imagetool --cmd-signpipe-* calls KMS; no key file exists
OS verificationvbmeta/recovery signed with bootloader level-3 keyKeep our own AVB key, as today
eFuseAll 6 FEAT_ENABLE_DEVICE_* bitsOnly what is needed; ask which bits are optional
Encryption / passwordsOptionalPrefer none (no USB / debug password) unless Amlogic recommends

2.2 Flow chart: Frank's approach

            OptiSigns                                          SEI (mass production)
 ┌─────────────────────────────────────────┐
 │ 1. Keys in Google Cloud KMS (RSA-4096)  │
 │    root + lower-level keys              │
 │    not exportable; export public keys   │
 └───────────────┬─────────────────────────┘
                 │
     ┌───────────┴──────────────┐
     ▼                          ▼
 ┌──────────────────────┐  ┌──────────────────────────────────────┐
 │ 2. Root cert from    │  │ 4. Sign bootloader (every release)   │
 │  root public keys    │  │  u-boot build                        │
 │  → SHA-256 (32 B)    │  │  CONFIG_AML_SIGNED_UBOOT=y           │
 │  (tool: open Q6)     │  │  → device-vendor-scs-signing.sh      │
 └─────────┬────────────┘  │  → acpu-imagetool --cmd-signpipe-*   │
           ▼               │  → KMS signs → signed bootloader     │
 ┌──────────────────────┐  ├──────────────────────────────────────┤
 │ 3. efuse-gen.sh      │  │ 5. OS: kernel/system via AVB         │
 │  pattern.efuse:      │  │  with our own AVB key (as today)     │
 │  root hash + minimum │  │  no Yocto scs, no encrypted package  │
 │  bits (open Q3)      │  │                                      │
 └─────────┬────────────┘  └──────────────────┬───────────────────┘
           │                                  │
           └──────────────► to SEI ◄──────────┘
                               │
                               ▼
                ┌──────────────────────────────┐
                │ 6. Burn signed firmware      │
                │ 7. Burn pattern.efuse        │
                │    (irreversible)            │
                └──────────────┬───────────────┘
                               ▼
                ┌──────────────────────────────┐
                │ Boot: ROM checks root hash → │
                │ verifies signed bootloader → │
                │ u-boot verifies vbmeta with  │
                │ our AVB key (open Q5)        │
                └──────────────────────────────┘

2.3 Questions to Amlogic

  1. Is signing through the u-boot build supported for mass production, or must we use the Yocto scs feature?
  2. Is bootloader encryption (DVGK/DVUK) required on S905X5M, or is signing alone supported? What do you recommend?
  3. Which eFuse settings should the factory burn, in what order? Which are optional (..._PUBRSA_PROT, USB auth, debug-port lock)?
  4. With --cmd-signpipe-*: full data or SHA-256 hash? RSA-PSS (SHA-256, 32-byte salt) or PKCS#1 v1.5? What output format?
  5. Can the OS keep its own AVB key on a fused unit, or must vbmeta be signed with the level-3 key? Does add-device-keys-bl33.sh replace the AVB key u-boot trusts?
  6. Key generation without key files: gen_all_device_key.sh creates keys locally with openssl, but our keys are generated in Cloud KMS and cannot be exported. Can we build the root cert, root hash and pattern.efuse from the public keys only, and sign the lower-level certs through --cmd-signpipe-device-root / -lvl1 / -lvl2? Which tool and options?