From baf93da2122eb74d256ed6c069f455fe8b8ebf2d Mon Sep 17 00:00:00 2001 From: Gun Kim Date: Thu, 29 Nov 2012 21:14:52 +0900 Subject: [PATCH] [Title] added CLI for native-app. (build, package, install, uninstall, debug) [Type] [Module] [Priority] [Jira#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] Change-Id: If1cea663c5fbabd168b6c4b1c4b09d87626dc509 --- org.tizen.cli/doc/install/native_bin/native-debug | 143 +++++++++++++++++++++ .../doc/install/native_bin/native-install | 91 +++++++++++++ org.tizen.cli/doc/install/native_bin/native-make | 23 ++++ org.tizen.cli/doc/install/native_bin/native-pack | 23 ++++ .../doc/install/native_bin/native-uninstall | 91 +++++++++++++ 5 files changed, 371 insertions(+) create mode 100755 org.tizen.cli/doc/install/native_bin/native-debug create mode 100755 org.tizen.cli/doc/install/native_bin/native-install create mode 100755 org.tizen.cli/doc/install/native_bin/native-make create mode 100755 org.tizen.cli/doc/install/native_bin/native-pack create mode 100755 org.tizen.cli/doc/install/native_bin/native-uninstall diff --git a/org.tizen.cli/doc/install/native_bin/native-debug b/org.tizen.cli/doc/install/native_bin/native-debug new file mode 100755 index 0000000..8a9c54a --- /dev/null +++ b/org.tizen.cli/doc/install/native_bin/native-debug @@ -0,0 +1,143 @@ +#!/bin/sh + +SUBSTRING_START_POSITION=2 + +init() { + SCRIPT="$0" + while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi + done + + DIR_BIN=`dirname $SCRIPT` + TOOLS_HOME="$DIR_BIN/../.." + SDB="$TOOLS_HOME/sdb" +} + +usage() { + echo "Usage: $0 [options]" + echo " -s, --serial \t\tdirects command to the USB device or emulator with" + echo "\t\t\t\t\tthe given serial number." + echo " -a, --appid \t\t\tdebug this app on target." + echo " -b, --binary \t\tdebug this binary on target." +} + +parse_param() { + until [ -z "$1" ] + do + case "$1" + in + -h) + usage + exit; + ;; + -s|--serial) + if [ -z "$2" ] + then + usage + exit 1; + fi + serial=$2 + shift 2; + ;; + -a|--appid) + if [ -z "$2" ] + then + usage + exit 1; + fi + appid=$2 + shift 2; + ;; + -b|--binary) + if [ -z "$2" ] + then + usage + exit 1; + fi + binary=$2 + shift 2; + ;; + *) + usage + exit; + ;; + esac + done + + if [ -z "$appid" ] + then + usage + exit 1; + fi + + if [ -z "$binary" ] + then + usage + exit 1; + fi + + devices=`sdb devices | wc -l` + if [ "$devices" -lt 2 ] + then + echo "error: device not found" + exit 2; + fi + + if [ "$devices" -gt 2 ] + then + if [ -z "$serial" ] + then + echo "error: more than one device and emulator" + exit 2; + fi + fi +} + +launch_gdbserver() { + target_install_path=/opt/apps/$appid/bin/$binary + gdbserver_command="/home/developer/sdk_tools/gdbserver/gdbserver :26102 $target_install_path" + + SDB_COMMAND="$SDB" + if [ -n "$serial" ] + then + SDB_COMMAND="$SDB_COMMAND -s $serial" + fi + sdb_gdbserver_command="$SDB_COMMAND shell $gdbserver_command" + $sdb_gdbserver_command 2> /dev/null & + sleep 1 + echo ""; +} + +launch_gdb() { + `$SDB_COMMAND forward tcp:7123 tcp:26102` + device="/dev/samsung_sdb" + sdb_cmd="$SDB_COMMAND shell ls $device > /dev/null 2> /dev/null ; echo \$?" + result=`$sdb_cmd` + if [ $result = $'0\r' ] + then + gdb="$TOOLS_HOME/arm-linux-gnueabi-gdb-7.2/bin/arm-linux-gnueabi-gdb" + elif [ $result = "0" ] + then + gdb="$TOOLS_HOME/arm-linux-gnueabi-gdb-7.2/bin/arm-linux-gnueabi-gdb" + else + gdb="$TOOLS_HOME/i386-linux-gnueabi-gdb-7.2/bin/i386-linux-gnueabi-gdb" + fi + + $gdb $binary '--eval-command=target remote:7123' + echo ""; +} + + +init +parse_param $* +launch_gdbserver +launch_gdb + +exit $?; diff --git a/org.tizen.cli/doc/install/native_bin/native-install b/org.tizen.cli/doc/install/native_bin/native-install new file mode 100755 index 0000000..cfb5631 --- /dev/null +++ b/org.tizen.cli/doc/install/native_bin/native-install @@ -0,0 +1,91 @@ +#!/bin/sh + +SUBSTRING_START_POSITION=2 + +SCRIPT="$0" +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +DIR_BIN=`dirname $SCRIPT` +TOOLS_HOME="$DIR_BIN/../.." +SDB="$TOOLS_HOME/sdb" + +usage() +{ + echo "Usage: $0 [options]" + echo " -s, --serial \t\tdirects command to the USB device or emulator with" + echo "\t\t\t\t\tthe given serial number." + echo " -p, --package \t\tpush tpk package file and install it." +} + +until [ -z "$1" ] +do + case "$1" + in + -h) + usage + exit; + ;; + -s|--serial) + if [ -z "$2" ] + then + usage + exit 1; + fi + serial=$2 + shift 2; + ;; + -p|--package) + if [ -z "$2" ] + then + usage + exit 1; + fi + package=$2 + shift 2; + ;; + *) + usage + exit; + ;; + esac +done + +if [ -z "$package" ] +then + usage + exit 1; +fi + +devices=`$SDB devices | wc -l` +if [ "$devices" -lt 2 ] +then + echo "error: device not found" + exit 2; +fi +if [ "$devices" -gt 2 ] +then + if [ -z "$serial" ] + then + echo "error: more than one device and emulator" + exit 2; + fi +fi + +command="$SDB" +if [ -n "$serial" ] +then + command="$command -s $serial" +fi +command="$command install $package" + +$command + diff --git a/org.tizen.cli/doc/install/native_bin/native-make b/org.tizen.cli/doc/install/native_bin/native-make new file mode 100755 index 0000000..4273ccd --- /dev/null +++ b/org.tizen.cli/doc/install/native_bin/native-make @@ -0,0 +1,23 @@ +#!/bin/sh + +SUBSTRING_START_POSITION=2 +SCRIPT="$0" +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +DIR_BIN=`dirname $SCRIPT` +TOOLS_HOME="$DIR_BIN/../.." + +command="$TOOLS_HOME/smart-build-interface/bin/sbi_make $@" + +$command + +exit $?; diff --git a/org.tizen.cli/doc/install/native_bin/native-pack b/org.tizen.cli/doc/install/native_bin/native-pack new file mode 100755 index 0000000..66f0ddb --- /dev/null +++ b/org.tizen.cli/doc/install/native_bin/native-pack @@ -0,0 +1,23 @@ +#!/bin/sh + +SUBSTRING_START_POSITION=2 +SCRIPT="$0" +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +DIR_BIN=`dirname $SCRIPT` +TOOLS_HOME="$DIR_BIN/../.." + +command="$TOOLS_HOME/smart-build-interface/bin/sbi_pack $@" + +$command + +exit $?; diff --git a/org.tizen.cli/doc/install/native_bin/native-uninstall b/org.tizen.cli/doc/install/native_bin/native-uninstall new file mode 100755 index 0000000..64ab52b --- /dev/null +++ b/org.tizen.cli/doc/install/native_bin/native-uninstall @@ -0,0 +1,91 @@ +#!/bin/sh + +SUBSTRING_START_POSITION=2 +SCRIPT="$0" +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +DIR_BIN=`dirname $SCRIPT` +TOOLS_HOME="$DIR_BIN/../.." +SDB="$TOOLS_HOME/sdb" + +usage() +{ + echo "Usage: $0 [options]" + echo " -s, --serial \t\tdirects command to the USB device or emulator with" + echo "\t\t\t\t\tthe given serial number." + echo " -a, appid \t\t\tuninstall this app from the device." +} + +until [ -z "$1" ] +do + case "$1" + in + -h) + usage + exit; + ;; + -s|--serial) + if [ -z "$2" ] + then + usage + exit 1; + fi + serial=$2 + shift 2; + ;; + -a|--appid) + if [ -z "$2" ] + then + usage + exit 1; + fi + appid=$2 + shift 2; + ;; + *) + usage + exit; + ;; + esac +done + +if [ -z "$appid" ] +then + usage + exit 1; +fi + +devices=`$SDB devices | wc -l` +if [ "$devices" -lt 2 ] +then + echo "error: device not found" + exit 2; +fi +if [ "$devices" -gt 2 ] +then + if [ -z "$serial" ] + then + echo "error: more than one device and emulator" + exit 2; + fi +fi + +command="$SDB" +if [ -n "$serial" ] +then + command="$command -s $serial" +fi +command="$command uninstall $appid" + +$command + +exit $?; -- 2.7.4