# 为镜像签名

镜像签名确保镜像的真实性、完整性和来源。

要刷写镜像，请执行以下操作：

1. 关于使用不同签名方法和安全镜像功能的信息，请参阅 [SecTools V2: Secure Image User Guide](https://docs.qualcomm.com/bundle/80-NM248-12/resource/80-NM248-12_REV_AB_SecTools_V2__Secure_Image_User_Guide.pdf)。
2. 如果使用本地签名者并使用这些命令生成密钥和证书，请参阅[生成本地（不安全）根密钥和证书](https://docs.qualcomm.com/doc/80-70017-11SC/topic/generate-local-insecure-root-key-and-certificates.html#generate-local-insecure-root-key-and-certificates)。
3. 要对单个镜像进行签名，请运行以下命令，其中 `tz.mbn` 用作示例。

> 
> 
> Note
> 
> 
> 用户可以根据需要替换 oem-id” **0x1** “和 oem-product-id” **0xabcd** “的值。

<meta>/common/sectoolsv2/ext/<platform>/sectools.exe secure-image --sign /path/to/tz.mbn --image-id=TZ --security-profile <meta>/common/sectoolsv2/<chipset>_security_profile.xml --oem-id=0x1 --oem-product-id=0xabcd --anti-rollback-version=0x0 --signing-mode=LOCAL --root-certificate=./OEM-KEYS/qpsa_rootca.cer --ca-certificate=./OEM-KEYS/qpsa_attestca.cer --ca-key=./OEM-KEYS/qpsa_attestca.key --outfile ./signed_images_out/tz.mbn
        Copy to clipboard

    以下是 QCS9075/QCS9100 的示例命令。

> 
> 
> <meta>/common/sectoolsv2/ext/<platform>/sectools.exe secure-image --sign /path/to/tz.mbn --image-id=TZ --security-profile <meta>/common/sectoolsv2/lemans_security_profile.xml --oem-id=0x1 --oem-product-id=0xabcd --anti-rollback-version=0x0 --signing-mode=LOCAL --root-certificate=./OEM-KEYS/qpsa_rootca.cer --ca-certificate=./OEM-KEYS/qpsa_attestca.cer --ca-key=./OEM-KEYS/qpsa_attestca.key --outfile ./signed_images_out/tz.mbn
>         Copy to clipboard
4. 关于应拆分的镜像，请使用 `--pil-split` 选项。
5. 要签署完整的 metabuild，请使用以下命令。

> 
> 
> - ::
>     - ./sectools metabuild-secure-image –image-finder  &lt;meta&gt;/common/build/app/image\_finder.py  –sign  –oem-id=0x1 –oem-product-id=0xabcd –anti-rollback-version=0x0 –signing-mode LOCAL –root-certificate=./OEM-KEYS/qpsa\_rootca.cer  –ca-certificate=./OEM-KEYS/qpsa\_attestca.cer  –ca-key=./OEM-KEYS/qpsa\_attestca.key –chipset LEMANS –outdir &lt;path/to/output&gt;

    更多详细信息，请参阅 [SecTools V2: Metabuild Secure Image User Guide](https://docs.qualcomm.com/bundle/80-NM248-17/resource/80-NM248-17_REV_AB_SecTools_V2__Metabuild_Secure_Image_User_Guide.pdf)。

Note

*SecTools* 指南可供具有授权访问权限的许可开发者使用。

Last Published: Apr 27, 2025

[Previous Topic
为 RSA 和 ECDSA 生成 SHA-384 哈希](https://docs.qualcomm.com/bundle/publicresource/80-70017-11SC/topics/generate-sha-384-hash-for-rsa-and-ecdsa.md) [Next Topic
生成已签名的 sec.elf 镜像](https://docs.qualcomm.com/bundle/publicresource/80-70017-11SC/topics/generate-signed-sec-elf-image.md)