当前位置: 首页 > 工具软件 > xdelta > 使用案例 >

解决服务器下载慢问题之xdelta工具

丁晋
2023-12-01

服务器端(Linux系统)打包需要下载的文件,sh脚本如下:

#!/bin/bash

ZIP_DIR="delta"


rm -rf delta.zip
rm -rf ${ZIP_DIR}/*
rm -rf new/*

cp ../out/target/product/mek_8q/uuu_imx_android_flash.sh new/
cp ../out/target/product/mek_8q/fastboot_imx_flashall.bat new/
cp ../out/target/product/mek_8q/partition-table.img new/
cp ../out/target/product/mek_8q/spl-imx8qm.bin new/
cp ../out/target/product/mek_8q/bootloader-imx8qm.img new/
cp ../out/target/product/mek_8q/dtbo-imx8qm.img new/
cp ../out/target/product/mek_8q/boot.img new/
cp ../out/target/product/mek_8q/system.img new/
cp ../out/target/product/mek_8q/system_ext.img new/
cp ../out/target/product/mek_8q/vendor.img new/
cp ../out/target/product/mek_8q/product.img new/
cp ../out/target/product/mek_8q/vbmeta-imx8qm.img new/
cp ../out/target/product/mek_8q/u-boot-imx8qm-mek-uuu.imx new/

xdelta3 -v -e -s old/uuu_imx_android_flash.sh new/uuu_imx_android_flash.sh delta/uuu_imx_android_flash.sh.dt
xdelta3 -v -e -s old/fastboot_imx_flashall.bat new/fastboot_imx_flashall.bat delta/fastboot_imx_flashall.bat.dt
xdelta3 -v -e -s old/fastboot_imx_flashall.sh new/fastboot_imx_flashall.sh delta/fastboot_imx_flashall.sh.dt
xdelta3 -v -e -s old/partition-table.img new/partition-table.img delta/partition-table.img.dt
xdelta3 -v -e -s old/spl-imx8qm.bin new/spl-imx8qm.bin delta/spl-imx8qm.bin.dt
xdelta3 -v -e -s old/bootloader-imx8qm.img new/bootloader-imx8qm.img delta/bootloader-imx8qm.img.dt
xdelta3 -v -e -s old/dtbo-imx8qm.img new/dtbo-imx8qm.img delta/dtbo-imx8qm.img.dt
xdelta3 -v -e -s old/boot.img new/boot.img delta/boot.img.dt
xdelta3 -v -e -s old/system.img new/system.img delta/system.img.dt
xdelta3 -v -e -s old/system_ext.img new/system_ext.img delta/system_ext.img.dt
xdelta3 -v -e -s old/vendor.img new/vendor.img delta/vendor.img.dt
xdelta3 -v -e -s old/product.img new/product.img delta/product.img.dt
xdelta3 -v -e -s old/vbmeta-imx8qm.img new/vbmeta-imx8qm.img delta/vbmeta-imx8qm.img.dt
xdelta3 -v -e -s old/u-boot-imx8qm-mek-uuu.imx new/u-boot-imx8qm-mek-uuu.imx delta/u-boot-imx8qm-mek-uuu.imx.dt


sync

zip -r ${ZIP_DIR}".zip" ${ZIP_DIR}

sync
 

客户端(windows系统),下载文件,bat脚本如下:

::@echo off

del /S /Q new
del /S /Q delta
del /S /Q delta.zip
scp yy@xxx.xxx.xxx.xxx:/home/yy/android_build/pk-tmp/delta.zip .     ::注释:yy为服务器上的用户名,xxx.xxx.xxx.xxx为服务器的IP地址
unzip -d . delta.zip

xdelta3.0.exe -v -d -s old/boot.img delta/boot.img.dt new/boot.img
xdelta3.0.exe -v -d -s old/bootloader-imx8qm.img delta/bootloader-imx8qm.img.dt new/bootloader-imx8qm.img
xdelta3.0.exe -v -d -s old/dtbo-imx8qm.img delta/dtbo-imx8qm.img.dt new/dtbo-imx8qm.img
xdelta3.0.exe -v -d -s old/fastboot_imx_flashall.sh delta/fastboot_imx_flashall.sh.dt new/fastboot_imx_flashall.sh
xdelta3.0.exe -v -d -s old/fastboot_imx_flashall.bat delta/fastboot_imx_flashall.bat.dt new/fastboot_imx_flashall.bat
xdelta3.0.exe -v -d -s old/partition-table.img delta/partition-table.img.dt new/partition-table.img
xdelta3.0.exe -v -d -s old/product.img delta/product.img.dt new/product.img
xdelta3.0.exe -v -d -s old/spl-imx8qm.bin delta/spl-imx8qm.bin.dt new/spl-imx8qm.bin
xdelta3.0.exe -v -d -s old/system.img delta/system.img.dt new/system.img
xdelta3.0.exe -v -d -s old/system_ext.img delta/system_ext.img.dt new/system_ext.img
xdelta3.0.exe -v -d -s old/uuu_imx_android_flash.sh delta/uuu_imx_android_flash.sh.dt new/uuu_imx_android_flash.sh
xdelta3.0.exe -v -d -s old/vbmeta-imx8qm.img delta/vbmeta-imx8qm.img.dt new/vbmeta-imx8qm.img
xdelta3.0.exe -v -d -s old/vendor.img delta/vendor.img.dt new/vendor.img
xdelta3.0.exe -v -d -s old/u-boot-imx8qm-mek-uuu.imx delta/u-boot-imx8qm-mek-uuu.imx.dt new/u-boot-imx8qm-mek-uuu.imx

pause

客户端(Linux系统),下载文件,sh脚本如下:

#!/bin/bash

rm -rf new/*
rm -rf delta
rm -rf delta.zip
scp yy@xxx.xxx.xxx.xxx:/home/yy/android_build/pk-tmp/delta.zip .     ::注释:yy为服务器上的用户名,xxx.xxx.xxx.xxx为服务器的IP地址
unzip -d . delta.zip

xdelta3 -d -s old/boot.img delta/boot.img.dt new/boot.img
xdelta3 -d -s old/bootloader-imx8qm.img delta/bootloader-imx8qm.img.dt new/bootloader-imx8qm.img
xdelta3 -d -s old/dtbo-imx8qm.img delta/dtbo-imx8qm.img.dt new/dtbo-imx8qm.img
xdelta3 -d -s old/fastboot_imx_flashall.sh delta/fastboot_imx_flashall.sh.dt new/fastboot_imx_flashall.sh
xdelta3 -d -s old/partition-table.img delta/partition-table.img.dt new/partition-table.img
xdelta3 -d -s old/product.img delta/product.img.dt new/product.img
xdelta3 -d -s old/spl-imx8qm.bin delta/spl-imx8qm.bin.dt new/spl-imx8qm.bin
xdelta3 -d -s old/system.img delta/system.img.dt new/system.img
xdelta3 -d -s old/system_ext.img delta/system_ext.img.dt new/system_ext.img
xdelta3 -d -s old/uuu_imx_android_flash.sh delta/uuu_imx_android_flash.sh.dt new/uuu_imx_android_flash.sh
xdelta3 -d -s old/vbmeta-imx8qm.img delta/vbmeta-imx8qm.img.dt new/vbmeta-imx8qm.img
xdelta3 -d -s old/vendor.img delta/vendor.img.dt new/vendor.img
xdelta3 -d -s old/u-boot-imx8qm-mek-uuu.imx delta/u-boot-imx8qm-mek-uuu.imx.dt new/u-boot-imx8qm-mek-uuu.imx


 

 类似资料: