修改mkota脚本,支持直接用指令制作ota_diff 的ota包。同时修改ota包文件名前缀,更直白的表达清楚本包的制作参数。 580/2 580/head 581/target/1 582/target/1 583/target/1
authorSnickerSun <snickersun@163.com>
Wed, 24 Jul 2024 04:13:25 +0000 (12:13 +0800)
committerSnickerSun <snickersun@163.com>
Wed, 24 Jul 2024 04:13:25 +0000 (12:13 +0800)
code/sdk/build/config/target_config/brandy/build_brandy_update.py
code/sdk/build/config/target_config/brandy/fota/fota_app_diff.cfg [new file with mode: 0644]
mkota.sh

index 26c4ccc..d3bc2f4 100755 (executable)
@@ -29,7 +29,11 @@ class upg_base_info:
         # 升级包结构配置文件
         self.fota_format_path = os.path.join(self.root_path, "build", "config", "target_config", "brandy", "fota")
         # 产品升级配置文件
-        self.fota_cfg = os.path.join(self.root_path, "build", "config", "target_config", "brandy", "fota", "fota.cfg")
+        if os.path.exists(os.path.join(self.root_path,"output","ota_diff")) :
+            self.fota_cfg = os.path.join(self.root_path, "build", "config", "target_config", "brandy", "fota", "fota_app_diff.cfg")
+        else:
+            self.fota_cfg = os.path.join(self.root_path, "build", "config", "target_config", "brandy", "fota", "fota.cfg")
+        
         # 产品镜像输出路径
         self.output = os.path.join(self.root_path, "output", "brandy","TestOTA")
         # 产品升级镜像包输出路径
diff --git a/code/sdk/build/config/target_config/brandy/fota/fota_app_diff.cfg b/code/sdk/build/config/target_config/brandy/fota/fota_app_diff.cfg
new file mode 100644 (file)
index 0000000..7f87fa3
--- /dev/null
@@ -0,0 +1,491 @@
+# SignSuite : 签名秘钥类型
+    # 0: ECDSA_SHA256
+    # 1: ECDSA_SHA256_LEA_CTR
+    # 2: ECDSA_SHA256_LEA_CBC_MAC
+    # 3: ECDSA_SHA256_AES_CBC
+
+    # 10: SM2_SM3
+    # 11: SM2_SM3_LEA_CTR
+    # 12: SM2_SM3_LEA_CBC_MAC
+    # 13: SM2_SM3_SM4_CBC
+
+    # 30: RSA 4096
+    # 34: RSA 4096 - SHA256
+[SIGN_CFG]
+# 此SignSuite默认为非安全升级的34
+# 若想进行安全升级需改为30,并将下方[FOTA_KEY_AREA]中KeyAlg的值修改为0x2A13C845
+SignSuite=34
+UpgImagePath =
+UpgSignedImagePath =
+RootKeyFile=build/config/target_config/brandy/signature/rsa_4096.pem
+SubKeyFile=build/config/target_config/brandy/signature/rsa_4096.pem
+
+[TOOLS]
+UpgToolPath=tools/bin/sign_tool/sign_tool_pltuni
+LzmaToolPath=tools/bin/lzma_tool/lzma_tool
+UpgToolWinPath=tools\bin\sign_tool\sign_tool_pltuni.exe
+LzmaToolWinPath=tools\bin\lzma_tool\lzma_tool.exe
+
+# Default Single sign mode. If there are 'RootKeyFileExt' & 'SubKeyFileExt' then means Double Sign mode.
+# RootKeyFileExt=
+# SubKeyFileExt=
+[FOTA_KEY_AREA]
+ImageId=0xCB8D154E
+StructVersion=0x00010000
+KeyOwnerId=0
+KeyId=0
+
+# KeyAlg :Algorithm of the external public key:
+    # 0x2A13C812: ECC256_SHA256
+    # 0x2A13C823: SM2_SM3
+    # 0x2A13C845: RSA4096_SHA256
+    # 0x2A13C856: SHA256(ECC256 FORMAT)
+    # 0x2A13C867: SHA256(RSA4096)
+    # 0x2A13C878: SM3_ONLY
+    # Others: Invalid
+KeyAlg=0x2A13C867
+
+KeyVersion=0x00000000
+KeyVersionMask=0x00000000
+Msid=0x00000000
+MsidMask=0x00000000
+
+[FOTA_INFO_AREA]
+ImageId=0xCB8D154E
+StructVersion=0x00010000
+Version=0x00000000
+VersionMask=0x00000000
+Msid=0x00000000
+MsidMask=0x00000000
+HardwareID=0
+
+[ssb_sign]
+HeaderMagic=0x464F5451
+ImageId=0x4B1E3C1E
+
+# DecompressFlag :升级镜像模式标记
+    # 0x3C7896E1 - compressed image
+    # 0x44494646 - diff image
+    # other :原始镜像不处理
+DecompressFlag=0x44494646
+
+# ReRncFlag:升级镜像加密标记
+    # 0x3C7896E1:加密
+    # other:不加密
+ReRncFlag=0x0
+
+# RootKeyType : 用于加密图像的根密钥,在ReEncFlag启用时有效
+    # 0 - ODRK0, for TEE runtime FW image.
+    # 1 - ODRK1, for Protocol and REE Application image.
+RootKeyType=0x0
+
+# 用于解密更新映像的1级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL1=
+
+# 用于解密更新映像的2级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL2=
+
+version_ext=0x00000000
+version_mask=0x00000000
+
+[ssb]
+HeaderMagic=0x464F5451
+ImageId=0x4B1E3C2D
+
+# DecompressFlag :升级镜像模式标记
+    # 0x3C7896E1 - compressed image
+    # 0x44494646 - diff image
+    # other :原始镜像不处理
+DecompressFlag=0
+
+# ReRncFlag:升级镜像加密标记
+    # 0x3C7896E1:加密
+    # other:不加密
+ReRncFlag=0x0
+
+# RootKeyType : 用于加密图像的根密钥,在ReEncFlag启用时有效
+    # 0 - ODRK0, for TEE runtime FW image.
+    # 1 - ODRK1, for Protocol and REE Application image.
+RootKeyType=0x0
+
+# 用于解密更新映像的1级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL1=
+
+# 用于解密更新映像的2级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL2=
+
+version_ext=0x00000000
+version_mask=0x00000000
+
+[nv]
+HeaderMagic=0x464F5451
+ImageId=0xCB9E063C
+
+# DecompressFlag :升级镜像模式标记
+    # 0 :原始镜像不处理 (nv只能使用该值)
+DecompressFlag=0
+
+# ReRncFlag:升级镜像加密标记
+    # 0x3C7896E1:加密
+    # other:不加密
+ReRncFlag=0x0
+
+# RootKeyType : 用于加密图像的根密钥,在ReEncFlag启用时有效
+    # 0 - ODRK0, for TEE runtime FW image.
+    # 1 - ODRK1, for Protocol and REE Application image.
+RootKeyType=0x0
+
+# 用于解密更新映像的1级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL1=
+
+# 用于解密更新映像的2级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL2=
+
+version_ext=0x00000000
+version_mask=0x00000000
+
+[recovery_sign]
+HeaderMagic=0x464F5451
+ImageId=0x4B69871E
+
+# DecompressFlag :升级镜像模式标记
+    # 0x3C7896E1 - compressed image
+    # 0x44494646 - diff image
+    # other :原始镜像不处理
+DecompressFlag=0x44494646
+
+# ReRncFlag:升级镜像加密标记
+    # 0x3C7896E1:加密
+    # other:不加密
+ReRncFlag=0x0
+
+# RootKeyType : 用于加密图像的根密钥,在ReEncFlag启用时有效
+    # 0 - ODRK0, for TEE runtime FW image.
+    # 1 - ODRK1, for Protocol and REE Application image.
+RootKeyType=0x0
+
+# 用于解密更新映像的1级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL1=
+
+# 用于解密更新映像的2级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL2=
+
+version_ext=0x00000000
+version_mask=0x00000000
+
+[recovery]
+HeaderMagic=0x464F5451
+ImageId=0x4B69872D
+
+# DecompressFlag :升级镜像模式标记
+    # 0x3C7896E1 - compressed image
+    # 0x44494646 - diff image
+    # other :原始镜像不处理
+DecompressFlag=0x3C7896E1
+
+# ReRncFlag:升级镜像加密标记
+    # 0x3C7896E1:加密
+    # other:不加密
+ReRncFlag=0x0
+
+# RootKeyType : 用于加密图像的根密钥,在ReEncFlag启用时有效
+    # 0 - ODRK0, for TEE runtime FW image.
+    # 1 - ODRK1, for Protocol and REE Application image.
+RootKeyType=0x0
+
+# 用于解密更新映像的1级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL1=
+
+# 用于解密更新映像的2级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL2=
+
+version_ext=0x00000000
+version_mask=0x00000000
+
+[application_sign]
+HeaderMagic=0x464F5451
+ImageId=0x4B0F2D1E
+
+# DecompressFlag :升级镜像模式标记
+    # 0x3C7896E1 - compressed image
+    # 0x44494646 - diff image
+    # other :原始镜像不处理
+DecompressFlag=0x44494646
+
+# ReRncFlag:升级镜像加密标记
+    # 0x3C7896E1:加密
+    # other:不加密
+ReRncFlag=0x0
+
+# RootKeyType : 用于加密图像的根密钥,在ReEncFlag启用时有效
+    # 0 - ODRK0, for TEE runtime FW image.
+    # 1 - ODRK1, for Protocol and REE Application image.
+RootKeyType=0x0
+
+# 用于解密更新映像的1级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL1=
+
+# 用于解密更新映像的2级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL2=
+
+version_ext=0x00000000
+version_mask=0x00000000
+
+[application]
+HeaderMagic=0x464F5451
+ImageId=0x4B0F2D2D
+
+# DecompressFlag :升级镜像模式标记
+    # 0x3C7896E1 - compressed image
+    # 0x44494646 - diff image
+    # other :原始镜像不处理
+DecompressFlag=0x44494646
+
+# ReRncFlag:升级镜像加密标记
+    # 0x3C7896E1:加密
+    # other:不加密
+ReRncFlag=0x0
+
+# RootKeyType : 用于加密图像的根密钥,在ReEncFlag启用时有效
+    # 0 - ODRK0, for TEE runtime FW image.
+    # 1 - ODRK1, for Protocol and REE Application image.
+RootKeyType=0x0
+
+# 用于解密更新映像的1级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL1=
+
+# 用于解密更新映像的2级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL2=
+
+version_ext=0x00000000
+version_mask=0x00000000
+
+[bt_sign]
+HeaderMagic=0x464F5451
+ImageId=0x4BF01E1E
+
+# DecompressFlag :升级镜像模式标记
+    # 0x3C7896E1 - compressed image
+    # 0x44494646 - diff image
+    # other :原始镜像不处理
+DecompressFlag=0x44494646
+
+# ReRncFlag:升级镜像加密标记
+    # 0x3C7896E1:加密
+    # other:不加密
+ReRncFlag=0x0
+
+# RootKeyType : 用于加密图像的根密钥,在ReEncFlag启用时有效
+    # 0 - ODRK0, for TEE runtime FW image.
+    # 1 - ODRK1, for Protocol and REE Application image.
+RootKeyType=0x0
+
+# 用于解密更新映像的1级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL1=
+
+# 用于解密更新映像的2级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL2=
+
+version_ext=0x00000000
+version_mask=0x00000000
+
+[bt]
+HeaderMagic=0x464F5451
+ImageId=0x4BF01E2D
+
+# DecompressFlag :升级镜像模式标记
+    # 0x3C7896E1 - compressed image
+    # 0x44494646 - diff image
+    # other :原始镜像不处理
+DecompressFlag=0x3C7896E1
+
+# ReRncFlag:升级镜像加密标记
+    # 0x3C7896E1:加密
+    # other:不加密
+ReRncFlag=0x0
+
+# RootKeyType : 用于加密图像的根密钥,在ReEncFlag启用时有效
+    # 0 - ODRK0, for TEE runtime FW image.
+    # 1 - ODRK1, for Protocol and REE Application image.
+RootKeyType=0x0
+
+# 用于解密更新映像的1级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL1=
+
+# 用于解密更新映像的2级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL2=
+
+version_ext=0x00000000
+version_mask=0x00000000
+
+[dsp_main_sign]
+HeaderMagic=0x464F5451
+ImageId=0x5A87A51E
+
+# DecompressFlag :升级镜像模式标记
+    # 0x3C7896E1 - compressed image
+    # 0x44494646 - diff image
+    # other :原始镜像不处理
+DecompressFlag=0x44494646
+
+# ReRncFlag:升级镜像加密标记
+    # 0x3C7896E1:加密
+    # other:不加密
+ReRncFlag=0x0
+
+# RootKeyType : 用于加密图像的根密钥,在ReEncFlag启用时有效
+    # 0 - ODRK0, for TEE runtime FW image.
+    # 1 - ODRK1, for Protocol and REE Application image.
+RootKeyType=0x0
+
+# 用于解密更新映像的1级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL1=
+
+# 用于解密更新映像的2级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL2=
+
+version_ext=0x00000000
+version_mask=0x00000000
+
+[dsp_main]
+HeaderMagic=0x464F5451
+ImageId=0x5A87A52D
+
+# DecompressFlag :升级镜像模式标记
+    # 0x3C7896E1 - compressed image
+    # 0x44494646 - diff image
+    # other :原始镜像不处理
+DecompressFlag=0x3C7896E1
+
+# ReRncFlag:升级镜像加密标记
+    # 0x3C7896E1:加密
+    # other:不加密
+ReRncFlag=0x0
+
+# RootKeyType : 用于加密图像的根密钥,在ReEncFlag启用时有效
+    # 0 - ODRK0, for TEE runtime FW image.
+    # 1 - ODRK1, for Protocol and REE Application image.
+RootKeyType=0x0
+
+# 用于解密更新映像的1级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL1=
+
+# 用于解密更新映像的2级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL2=
+
+version_ext=0x00000000
+version_mask=0x00000000
+
+[dsp_overlay_sign]
+HeaderMagic=0x464F5451
+ImageId=0x5A87A53A
+
+# DecompressFlag :升级镜像模式标记
+    # 0x3C7896E1 - compressed image
+    # 0x44494646 - diff image
+    # other :原始镜像不处理
+DecompressFlag=0x44494646
+
+# ReRncFlag:升级镜像加密标记
+    # 0x3C7896E1:加密
+    # other:不加密
+ReRncFlag=0x0
+
+# RootKeyType : 用于加密图像的根密钥,在ReEncFlag启用时有效
+    # 0 - ODRK0, for TEE runtime FW image.
+    # 1 - ODRK1, for Protocol and REE Application image.
+RootKeyType=0x0
+
+# 用于解密更新映像的1级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL1=
+
+# 用于解密更新映像的2级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL2=
+
+version_ext=0x00000000
+version_mask=0x00000000
+
+[dsp_overlay]
+HeaderMagic=0x464F5451
+ImageId=0x5A87A54B
+
+# DecompressFlag :升级镜像模式标记
+    # 0x3C7896E1 - compressed image
+    # 0x44494646 - diff image
+    # other :原始镜像不处理
+DecompressFlag=0x3C7896E1
+
+# ReRncFlag:升级镜像加密标记
+    # 0x3C7896E1:加密
+    # other:不加密
+ReRncFlag=0x0
+
+# RootKeyType : 用于加密图像的根密钥,在ReEncFlag启用时有效
+    # 0 - ODRK0, for TEE runtime FW image.
+    # 1 - ODRK1, for Protocol and REE Application image.
+RootKeyType=0x0
+
+# 用于解密更新映像的1级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL1=
+
+# 用于解密更新映像的2级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL2=
+
+version_ext=0x00000000
+version_mask=0x00000000
+
+[res_index]
+HeaderMagic=0x464F5451
+ImageId=0xCB9E0826
+
+# DecompressFlag :升级镜像模式标记
+    # 0x3C7896E1 - compressed image
+    # other :原始镜像不处理
+DecompressFlag=0
+
+# ReRncFlag:升级镜像加密标记
+    # 0x3C7896E1:加密
+    # other:不加密
+ReRncFlag=0x0
+
+# RootKeyType : 用于加密图像的根密钥,在ReEncFlag启用时有效
+    # 0 - ODRK0, for TEE runtime FW image.
+    # 1 - ODRK1, for Protocol and REE Application image.
+RootKeyType=0x0
+
+# 用于解密更新映像的1级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL1=
+
+# 用于解密更新映像的2级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL2=
+
+version_ext=0x00000000
+version_mask=0x00000000
+
+[res_data]
+HeaderMagic=0x464F5451
+ImageId=0xCB9E0832
+
+# DecompressFlag :升级镜像模式标记
+    # 0x3C7896E1 - compressed image
+    # other :原始镜像不处理
+DecompressFlag=0
+
+# ReRncFlag:升级镜像加密标记
+    # 0x3C7896E1:加密
+    # other:不加密
+ReRncFlag=0x0
+
+# RootKeyType : 用于加密图像的根密钥,在ReEncFlag启用时有效
+    # 0 - ODRK0, for TEE runtime FW image.
+    # 1 - ODRK1, for Protocol and REE Application image.
+RootKeyType=0x0
+
+# 用于解密更新映像的1级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL1=
+
+# 用于解密更新映像的2级加密保护密钥,在ReEncFlag启用时有效
+ProtectionKeyL2=
+
+version_ext=0x00000000
+version_mask=0x00000000
\ No newline at end of file
index f1068ca..728dd0e 100755 (executable)
--- a/mkota.sh
+++ b/mkota.sh
@@ -10,6 +10,7 @@ ROOTDIR=`basename $PWD`
 ADDITIONAL_RES_DIR=$PWD/code/sdk/output/additional_fs
 OTA_ALL_FLAG_PATH=$PWD/code/sdk/output/ota_all
 RES_ONLY_FLAG_PATH=$PWD/code/sdk/output/res_only
+OTA_DIFF_FLAG_PATH=$PWD/code/sdk/output/ota_diff
 if [ ! -d "$SOURCE_DIR" ] ; then
 echo "$SOURCE_DIR not exist , skip create ota package"
 echo ""
@@ -21,11 +22,18 @@ echo ""
 exit 0
 fi
 
-rm $OTA_ALL_FLAG_PATH $RES_ONLY_FLAG_PATH -f
+rm $OTA_ALL_FLAG_PATH $RES_ONLY_FLAG_PATH $OTA_DIFF_FLAG_PATH -f
 if [ "$3" == "ota_all" ]; then
 touch $OTA_ALL_FLAG_PATH
+OTA_PKG_HEAD=ota_all_
+elif [ "$3" == "ota_diff" ]; then
+touch $OTA_DIFF_FLAG_PATH
+OTA_PKG_HEAD=ota_diff_
 elif [ "$3" == "res_only" ]; then
 touch $RES_ONLY_FLAG_PATH
+OTA_PKG_HEAD=res_only_
+else
+OTA_PKG_HEAD=ota_
 fi
 
 
@@ -74,7 +82,8 @@ cd $PWD/code/sdk/
 cd -
 
 mkdir release/ota -p
-target_fwpkg_filepath=release/ota/${SOURCE_VERSION}_2_${TARGET_VERSION}_ota.fwpkg
+
+target_fwpkg_filepath=release/ota/${OTA_PKG_HEAD}${SOURCE_VERSION}_2_${TARGET_VERSION}.fwpkg
 cp code/sdk/output/brandy/TestOTA/upgrade/update.fwpkg $target_fwpkg_filepath
 fwpkg_filesize=`ls $target_fwpkg_filepath -lh|awk '{print $5}'`