summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2023-11-15 10:46:42 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2023-11-15 10:46:42 +0800
commit1d7f822aee2d49288c5e139e69a01cbc05427f7a (patch)
tree0a188d79f682da6dfd249686f07ce8a950873d6d
parent3d6c7c0ec3618ad4e213bb43a775c6767e3a20be (diff)
db845c & hikey & x15: update deploy script to support remote
like https urls Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rwxr-xr-xandroid-tools/db845c/db845c-deploy.sh55
-rwxr-xr-xandroid-tools/hikey/hikey-deploy.sh52
-rwxr-xr-xandroid-tools/x15/flash.sh59
3 files changed, 142 insertions, 24 deletions
diff --git a/android-tools/db845c/db845c-deploy.sh b/android-tools/db845c/db845c-deploy.sh
index 2a7e0fb..59ee8c0 100755
--- a/android-tools/db845c/db845c-deploy.sh
+++ b/android-tools/db845c/db845c-deploy.sh
@@ -1,6 +1,6 @@
-#!/bin/bash
+#!/bin/bash -ex
-local_android_serial="cbe37e"
+local_android_serial="897afb61"
local_android_product="SuperEDK2k"
if adb devices|grep ${local_android_serial}; then
@@ -37,10 +37,10 @@ else
FIRMWARE_DIR="${img_dir}"
fi
-if ! [ -d ${img_dir} ]; then
- echo "The specified path is not a directory:${img_dir}"
- exit 1
-fi
+#if ! [ -d ${img_dir} ]; then
+# echo "The specified path is not a directory:${img_dir}"
+# exit 1
+#fi
function flash_image(){
local partition=$1
@@ -48,9 +48,46 @@ function flash_image(){
if [ -z "${partition}" ] || [ -z "${file_img}" ]; then
return
fi
+ temp_file=false
+ if echo "${file_img}"|grep -E "^http://|^https://"; then
+ f_img_local=$(mktemp -u "/tmp/${partition}-XXX.img")
+ ## + wget -c http://192.168.1.14:8000/android/lkft/lkft-aosp-main-db845c/1662/images//cache.img --progress=dot:mega -O /tmp/cache-GNu.img
+ ## --2023-10-19 14:08:42-- http://192.168.1.14:8000/android/lkft/lkft-aosp-main-db845c/1662/images//cache.img
+ ## Connecting to 192.168.1.14:8000... connected.
+ ## HTTP request sent, awaiting response... 404 File not found
+ ## 2023-10-19 14:08:42 ERROR 404: File not found.
+ is_xz_file=false
+ if wget --spider "${file_img}"; then
+ cmd_wget="wget -c ${file_img} --progress=dot:giga -O ${f_img_local}"
+ elif wget --spider "${file_img}.xz"; then
+ cmd_wget="wget -c ${file_img}.xz --progress=dot:giga -O ${f_img_local}.xz"
+ is_xz_file=true
+ else
+ echo "Neither ${file_img} nor ${file_img}.xz exists"
+ return
+ fi
+ if ${cmd_wget}; then
+ ${is_xz_file} && xz -d "${f_img_local}.xz"
+ file_img="${f_img_local}"
+ temp_file=true
+ else
+ rm -f "${f_img_local}"
+ return
+ fi
+ fi
- if [ ! -f "${file_img}" ]; then
- echo "${file_img} does not exist"
+ if [ -f "${file_img}" ]; then
+ :
+ elif [ -f "${file_img}.xz" ]; then
+ f_img_local=$(mktemp -u "/tmp/${partition}-XXX.img")
+ if xz -c -d "${file_img}.xz" >"${f_img_local}"; then
+ temp_file=true
+ file_img="${f_img_local}"
+ else
+ return
+ fi
+ else
+ echo "Neither ${file_img} nor ${file_img}.xz exists"
return
fi
@@ -60,6 +97,8 @@ function flash_image(){
if [ $? -ne 0 ]; then
echo "Failed to deploy ${file_img}"
exit 1
+ elif ${temp_file}; then
+ rm ${file_img}
fi
# sleep 2 after flash
sleep 2
diff --git a/android-tools/hikey/hikey-deploy.sh b/android-tools/hikey/hikey-deploy.sh
index ad2cddf..637d306 100755
--- a/android-tools/hikey/hikey-deploy.sh
+++ b/android-tools/hikey/hikey-deploy.sh
@@ -37,10 +37,10 @@ else
FIRMWARE_DIR="${img_dir}"
fi
-if ! [ -d ${img_dir} ]; then
- echo "The specified path is not a directory:${img_dir}"
- exit 1
-fi
+#if ! [ -d ${img_dir} ]; then
+# echo "The specified path is not a directory:${img_dir}"
+# exit 1
+#fi
function flash_image(){
local partition=$1
@@ -48,8 +48,46 @@ function flash_image(){
if [ -z "${partition}" ] || [ -z "${file_img}" ]; then
return
fi
- if [ ! -e "${file_img}" ]; then
- echo "${file_img} does not exist"
+ temp_file=false
+ if echo "${file_img}"|grep -E "^http://|^https://"; then
+ f_img_local=$(mktemp -u "/tmp/${partition}-XXX.img")
+ ## + wget -c http://192.168.1.14:8000/android/lkft/lkft-aosp-main-db845c/1662/images//cache.img --progress=dot:mega -O /tmp/cache-GNu.img
+ ## --2023-10-19 14:08:42-- http://192.168.1.14:8000/android/lkft/lkft-aosp-main-db845c/1662/images//cache.img
+ ## Connecting to 192.168.1.14:8000... connected.
+ ## HTTP request sent, awaiting response... 404 File not found
+ ## 2023-10-19 14:08:42 ERROR 404: File not found.
+ is_xz_file=false
+ if wget --spider "${file_img}"; then
+ cmd_wget="wget -c ${file_img} --progress=dot:giga -O ${f_img_local}"
+ elif wget --spider "${file_img}.xz"; then
+ cmd_wget="wget -c ${file_img}.xz --progress=dot:giga -O ${f_img_local}.xz"
+ is_xz_file=true
+ else
+ echo "Neither ${file_img} nor ${file_img}.xz exists"
+ return
+ fi
+ if ${cmd_wget}; then
+ ${is_xz_file} && xz -d "${f_img_local}.xz"
+ file_img="${f_img_local}"
+ temp_file=true
+ else
+ rm -f "${f_img_local}"
+ return
+ fi
+ fi
+
+ if [ -f "${file_img}" ]; then
+ :
+ elif [ -f "${file_img}.xz" ]; then
+ f_img_local=$(mktemp -u "/tmp/${partition}-XXX.img")
+ if xz -c -d "${file_img}.xz" >"${f_img_local}"; then
+ temp_file=true
+ file_img="${f_img_local}"
+ else
+ return
+ fi
+ else
+ echo "Neither ${file_img} nor ${file_img}.xz exists"
return
fi
@@ -59,6 +97,8 @@ function flash_image(){
if [ $? -ne 0 ]; then
echo "Failed to deploy ${file_img}"
exit 1
+ elif ${temp_file}; then
+ rm ${file_img}
fi
# sleep 2 after flash
sleep 2
diff --git a/android-tools/x15/flash.sh b/android-tools/x15/flash.sh
index f8a6067..1f1fd7e 100755
--- a/android-tools/x15/flash.sh
+++ b/android-tools/x15/flash.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -ex
# https://wiki-archive.linaro.org/Boards/BeagleBoard-X15
# https://linaro.atlassian.net/wiki/spaces/CTT/pages/25111140766/BeagleBoard+X15
@@ -48,16 +48,16 @@ fi
img_dir=${1}
if [ -z "${img_dir}" ]; then
- img_dir="out/target/product/am57xevm"
-fi
-if [ ! -d "${img_dir}" ]; then
img_dir="out/target/product/beagle_x15"
fi
+#if [ ! -d "${img_dir}" ]; then
+# img_dir="out/target/product/beagle_x15"
+#fi
-if ! [ -d ${img_dir} ]; then
- echo "The specified path is not a directory:${img_dir}"
- exit 1
-fi
+#if ! [ -d ${img_dir} ]; then
+# echo "The specified path is not a directory:${img_dir}"
+# exit 1
+#fi
function flash_image(){
local partition=$1
@@ -65,9 +65,46 @@ function flash_image(){
if [ -z "${partition}" ] || [ -z "${file_img}" ]; then
return
fi
+ temp_file=false
+ if echo "${file_img}"|grep -E "^http://|^https://"; then
+ f_img_local=$(mktemp -u "/tmp/${partition}-XXX.img")
+ ## + wget -c http://192.168.1.14:8000/android/lkft/lkft-aosp-main-db845c/1662/images//cache.img --progress=dot:mega -O /tmp/cache-GNu.img
+ ## --2023-10-19 14:08:42-- http://192.168.1.14:8000/android/lkft/lkft-aosp-main-db845c/1662/images//cache.img
+ ## Connecting to 192.168.1.14:8000... connected.
+ ## HTTP request sent, awaiting response... 404 File not found
+ ## 2023-10-19 14:08:42 ERROR 404: File not found.
+ is_xz_file=false
+ if wget --spider "${file_img}"; then
+ cmd_wget="wget -c ${file_img} --progress=dot:giga -O ${f_img_local}"
+ elif wget --spider "${file_img}.xz"; then
+ cmd_wget="wget -c ${file_img}.xz --progress=dot:giga -O ${f_img_local}.xz"
+ is_xz_file=true
+ else
+ echo "Neither ${file_img} nor ${file_img}.xz exists"
+ return
+ fi
+ if ${cmd_wget}; then
+ ${is_xz_file} && xz -d "${f_img_local}.xz"
+ file_img="${f_img_local}"
+ temp_file=true
+ else
+ rm -f "${f_img_local}"
+ return
+ fi
+ fi
- if [ ! -f "${file_img}" ]; then
- echo "${file_img} does not exist"
+ if [ -f "${file_img}" ]; then
+ :
+ elif [ -f "${file_img}.xz" ]; then
+ f_img_local=$(mktemp -u "/tmp/${partition}-XXX.img")
+ if xz -c -d "${file_img}.xz" >"${f_img_local}"; then
+ temp_file=true
+ file_img="${f_img_local}"
+ else
+ return
+ fi
+ else
+ echo "Neither ${file_img} nor ${file_img}.xz exists"
return
fi
@@ -77,6 +114,8 @@ function flash_image(){
if [ $? -ne 0 ]; then
echo "Failed to deploy ${file_img}"
exit 1
+ elif ${temp_file}; then
+ rm ${file_img}
fi
# sleep 2 after flash
sleep 2