From 1f6f3e0793762c0a6cfb85aa40c64f2351106e4e Mon Sep 17 00:00:00 2001 From: Jin Yoon Date: Mon, 28 Aug 2017 18:49:45 +0900 Subject: [PATCH] Add shell scripts for testing Change-Id: I1b9687b929f0f012358781cd0a43798d2a9d7535 --- tool/install_with_devid.sh | 53 +++++++++++++++++++++ tool/rpi_sdcard_setup.sh | 114 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 167 insertions(+) create mode 100755 tool/install_with_devid.sh create mode 100755 tool/rpi_sdcard_setup.sh diff --git a/tool/install_with_devid.sh b/tool/install_with_devid.sh new file mode 100755 index 0000000..ae86cb2 --- /dev/null +++ b/tool/install_with_devid.sh @@ -0,0 +1,53 @@ +#! /bin/bash +appsrw_path="/home/owner/apps_rw" +file_dev_id=".dev_id" + +display_help() { + echo "Usage: $0 [target ip addr] [pkg file name] [dev id]" + echo + exit 1 +} + +############ +if [ $# -lt 3 ] ; then + display_help +fi + +if [ -e $2 ] ; then + pkg_name=`rpm -qp --queryformat="%{NAME}" $2` + echo "Start to install [$pkg_name] to $1 with dev id[$3]" +else + echo "file [$2] not found" + echo + exit 1 +fi + +filename="${2##*/}" + +sdb kill-server + +if sdb connect $1 | grep -q 'connected'; then + echo "connected to target[$1]" +else + echo "fail to connect target [$1]" + exit 1 +fi + +dev_id_filename=$appsrw_path/$pkg_name/data/$file_dev_id + +sdb root on +sdb shell mount -o remount rw / +sdb push $2 /tmp +sdb shell "rpm -ivh --force /tmp/$filename" + +sdb shell "touch $dev_id_filename" +sdb shell "echo $3 > $dev_id_filename" +sdb shell chsmack -a "User::Pkg::$pkg_name" $dev_id_filename +sdb shell chmod 544 $dev_id_filename +sdb shell pkg_initdb --ro + +sdb shell journalctl --vacuum-size=128M + +sdb shell sync + +exit 1 diff --git a/tool/rpi_sdcard_setup.sh b/tool/rpi_sdcard_setup.sh new file mode 100755 index 0000000..8432751 --- /dev/null +++ b/tool/rpi_sdcard_setup.sh @@ -0,0 +1,114 @@ +#! /bin/bash +download_dir=download +script_fusing=sd_fusing_rpi3.sh +binary_prefix=tizen-unified +binary_version=20170824.1 +boot_img_name=common-boot-arm64-rpi3 +platform_img_name=common-iot_core-2parts-armv7l-rpi3 +usb_node=/dev/sdb +tmp_rfs_dir=$download_dir/rootfs + +download_binaries() { +if [ ! -d $download_dir ]; then + mkdir -p $download_dir +else + echo "download directory aleady exist" +fi + +if [ ! -e $download_dir/$script_fusing ]; then + wget https://git.tizen.org/cgit/platform/kernel/linux-rpi3/plain/scripts/sd_fusing_rpi3.sh?h=submit/tizen/20170725.223437 --output-document=$download_dir/$script_fusing +fi + +chmod 755 $download_dir/$script_fusing + +if [ ! -e $download_dir/brcmfmac43430-sdio.bin ]; then + wget https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm80211/brcm/brcmfmac43430-sdio.bin -P $download_dir +fi + +if [ ! -e $download_dir/brcmfmac43430-sdio.txt ]; then + wget https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm80211/brcm/brcmfmac43430-sdio.txt -P $download_dir +fi + +if [ ! -e $download_dir/BCM43430A1.hcd ]; then + wget https://github.com/OpenELEC/misc-firmware/raw/master/firmware/brcm/BCM43430A1.hcd -P $download_dir +fi + +if [ ! -e $download_dir/$boot_img ]; then + wget http://download.tizen.org/snapshots/tizen/unified/${binary_prefix}_${binary_version}/images/standard/${boot_img_name}/$boot_img -P $download_dir +fi + +if [ ! -e $download_dir/$platform_img ]; then + wget http://download.tizen.org/snapshots/tizen/unified/${binary_prefix}_${binary_version}/images/standard/${platform_img_name}/$platform_img -P $download_dir +fi +} + +fusing_sdcard() { +sudo /bin/bash $download_dir/$script_fusing -d $usb_node --format +sudo /bin/bash $download_dir/$script_fusing -d $usb_node -b $download_dir/$boot_img +sudo /bin/bash $download_dir/$script_fusing -d $usb_node -b $download_dir/$platform_img +} + +copy_firmware() { +mkdir -p $tmp_rfs_dir +sudo mount ${usb_node}2 $tmp_rfs_dir +sudo mkdir -p $tmp_rfs_dir/usr/etc/bluetooth +sudo cp $download_dir/BCM43430A1.hcd $tmp_rfs_dir/usr/etc/bluetooth +sudo mkdir -p $tmp_rfs_dir/usr/lib/firmware/brcm +sudo cp $download_dir/brcmfmac43430-sdio.* $tmp_rfs_dir/usr/lib/firmware/brcm +sync +sudo umount $tmp_rfs_dir +rmdir $tmp_rfs_dir +} + +display_help() { + echo "Usage: $0 [dev node of usb] [binary version]" + echo "example : $0 /dev/sdb 20170824.1" + exit 1 +} + + +################################ +#set -x + +#if [ $# -lt 2 ] ; then +# display_help +#fi + +echo "########### Your Storage Device nodes ############" +echo +lsblk +echo +echo "##################################################" +echo +echo "Please enter device node of usb[enter to use default($usb_node) : " +read input_node +if [ "$input_node" = "" ]; then + echo "########### use default dev node : ${usb_node}" +else + if [ "$input_node" = "/dev/sda" ]; then + echo "[ERROR] /dev/sda is your main storage" + exit 1 + fi + usb_node=${input_node} + echo "########### use dev node : $usb_node" +fi + +echo "Please enter binary version of usb[enter to use default($binary_version) : " +read input_version +if [ "$input_version" = "" ]; then + echo "########### use default version : $binary_version" +else + binary_version=$input_version + echo "########### use binary version : $binary_version" +fi + +boot_img=${binary_prefix}_${binary_version}_${boot_img_name}.tar.gz +platform_img=${binary_prefix}_${binary_version}_${platform_img_name}.tar.gz + +download_binaries + +sleep 5 + +fusing_sdcard +copy_firmware + -- 2.7.4