remote_run: support specifying ssh options

This commit is contained in:
Sebastien Bourdeauducq 2020-07-04 23:41:28 +08:00
parent b6797e69ca
commit b9f896e14b
1 changed files with 11 additions and 8 deletions

View File

@ -6,8 +6,9 @@ target_host="rpi-4.m-labs.hk"
impure=0
pure_dir="result"
impure_dir="build"
sshopts=""
while getopts "h:id:" opt; do
while getopts "h:id:o:" opt; do
case "$opt" in
\?) exit 1
;;
@ -18,21 +19,23 @@ while getopts "h:id:" opt; do
d) pure_dir=$OPTARG;
impure_dir=$OPTARG;
;;
o) sshopts=$OPTARG
;;
esac
done
target_folder=/tmp/zynq-$USER
echo "Creating $target_folder..."
ssh $target_host "mkdir -p $target_folder"
ssh $sshopts $target_host "mkdir -p $target_folder"
echo "Copying files..."
rsync openocd/* $target_host:$target_folder
rsync -e "ssh $sshopts" openocd/* $target_host:$target_folder
if [ $impure -eq 1 ]; then
rsync $impure_dir/firmware/armv7-none-eabihf/release/szl $target_host:$target_folder/szl.elf
rsync $impure_dir/gateware/top.bit $target_host:$target_folder
rsync -e "ssh $sshopts" $impure_dir/firmware/armv7-none-eabihf/release/szl $target_host:$target_folder/szl.elf
rsync -e "ssh $sshopts" $impure_dir/gateware/top.bit $target_host:$target_folder
else
rsync -Lc $pure_dir/szl.elf $target_host:$target_folder
rsync -Lc $pure_dir/top.bit $target_host:$target_folder
rsync -e "ssh $sshopts" -Lc $pure_dir/szl.elf $target_host:$target_folder
rsync -e "ssh $sshopts" -Lc $pure_dir/top.bit $target_host:$target_folder
fi
echo "Programming board..."
ssh $target_host "cd $target_folder; openocd -f zc706.cfg -c 'pld load 0 top.bit; load_image szl.elf; resume 0; exit'"
ssh $sshopts $target_host "cd $target_folder; openocd -f zc706.cfg -c 'pld load 0 top.bit; load_image szl.elf; resume 0; exit'"