#
#
-# Makefile for sdb
+# Makefile for sdbd
#
-#
-HOST_OS := $(shell uname -s | tr A-Z a-z)
-
-# sdb host tool
-# =========================================================
-
-# Default to a virtual (sockets) usb interface
-USB_SRCS :=
-EXTRA_SRCS :=
-
-ifeq ($(HOST_OS),linux)
- USB_SRCS := usb_linux.c
- EXTRA_SRCS := get_my_path_linux.c
- LOCAL_LDLIBS += -lrt -lncurses -lpthread
-endif
-
-ifeq ($(HOST_OS),darwin)
- USB_SRCS := usb_osx.c
- EXTRA_SRCS := get_my_path_darwin.c
- LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
- SDB_EXTRA_CFLAGS := -mmacosx-version-min=10.4
-endif
-
-ifeq ($(HOST_OS),freebsd)
- USB_SRCS := usb_libusb.c
- EXTRA_SRCS := get_my_path_freebsd.c
- LOCAL_LDLIBS += -lpthread -lusb
-endif
-
-
-
-SDB_SRC_FILES := \
- src/sdb.c \
- src/console.c \
- src/transport.c \
- src/transport_local.c \
- src/transport_usb.c \
- src/commandline.c \
- src/sdb_client.c \
- src/sockets.c \
- src/services.c \
- src/file_sync_client.c \
- src/$(EXTRA_SRCS) \
- src/$(USB_SRCS) \
- src/utils.c \
- src/usb_vendors.c \
- src/fdevent.c \
- src/socket_inaddr_any_server.c \
- src/socket_local_client.c \
- src/socket_local_server.c \
- src/socket_loopback_client.c \
- src/socket_loopback_server.c \
- src/socket_network_client.c
-
-SDB_CFLAGS := -O2 -g -DSDB_HOST=1 -DSDB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter
-SDB_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
-SDB_CFLAGS += -DHAVE_FORKEXEC -DHAVE_TERMIO_H -DHAVE_SYMLINKS
-SDB_LFLAGS := $(LOCAL_LDLIBS)
-
SDBD_SRC_FILES := \
src/sdb.c \
src/fdevent.c \
OBJDIR := bin
INSTALLDIR := usr/sbin
INITSCRIPTDIR := etc/init.d
-RCSCRIPTDIR := etc/rc.d/rc3.d
-LAUNCH_SCRIPT := sdk_launch
-
-UNAME := $(shell uname -sm)
-ifneq (,$(findstring 86,$(UNAME)))
- HOST_ARCH := x86
-endif
-TARGET_ARCH = $(HOST_ARCH)
-ifeq ($(TARGET_ARCH),)
- TARGET_ARCH := arm
-endif
-
-ifeq ($(TARGET_ARCH),arm)
- MODULE := sdbd
- SDBD_CFLAGS += -DANDROID_GADGET=1
-else
-ifeq ($(TARGET_HOST),true)
- MODULE := sdb
-else
- MODULE := sdbd
-endif
-endif
+MODULE := sdbd
all : $(MODULE)
-sdb : $(SDB_SRC_FILES)
- mkdir -p $(OBJDIR)
- $(CC) -pthread -o $(OBJDIR)/$(MODULE) $(SDB_CFLAGS) $(SDB_EXTRA_CFLAGS) $(SDB_LFLAGS) $(IFLAGS) $(SDB_SRC_FILES)
-
sdbd : $(SDBD_SRC_FILES)
mkdir -p $(OBJDIR)
$(CC) -pthread -o $(OBJDIR)/$(MODULE) $(SDBD_CFLAGS) $(IFLAGS) $(SDBD_SRC_FILES) $(SDBD_LFLAGS)
install :
mkdir -p $(DESTDIR)/$(INSTALLDIR)
install $(OBJDIR)/$(MODULE) $(DESTDIR)/$(INSTALLDIR)/$(MODULE)
- install $(LAUNCH_SCRIPT) $(DESTDIR)/$(INSTALLDIR)/$(LAUNCH_SCRIPT)
-ifeq ($(MODULE),sdbd)
mkdir -p $(DESTDIR)/$(INITSCRIPTDIR)
install script/sdbd $(DESTDIR)/$(INITSCRIPTDIR)/sdbd
-endif
-ifeq ($(TARGET_ARCH),x86)
- mkdir -p $(DESTDIR)/$(RCSCRIPTDIR)
- install script/S06sdbd $(DESTDIR)/$(RCSCRIPTDIR)/S06sdbd
-endif
clean :
rm -rf $(OBJDIR)/*
--- /dev/null
+* Wed Apr 04 2013 Ho Namkoong <ho.namkoong@samsung.com>
+ - supports platform gdbserver
+* Mon Dec 02 2012 Yoonki Park <yoonki.park@samsung.com>
+ - supports cs report service using inotify
+* Mon Dec 02 2012 Yoonki Park <yoonki.park@samsung.com>
+ - sdb code dropped from adb (Ice Cream Samdwich 4.1.1)
+* Wed Apr 18 2012 Yoonki Park <yoonki.park@samsung.com>
+ - set dir permission to 777
+* Sat Mar 31 2012 Yoonki Park <yoonki.park@samsung.com>
+ - let sshd be daemon and create sshd.pid file
\ No newline at end of file
Name: sdbd
Summary: SDB daemon
-Version: 2.2.8
-Release: 1
-Group: TO_BE/FILLED_IN
-License: TO BE FILLED IN
+Version: 2.2.13
+Release: 0
+License: Apache-2.0
+Summary: SDB daemon
+Group: System/Utilities
Source0: %{name}-%{version}.tar.gz
+Source1001: sdbd_device.service
+Source1002: sdbd_emulator.service
BuildRequires: capi-system-info-devel
Requires(post): pkgmgr
Requires: dbus
%description
-Description: SDB daemon
+Description: SDB daemon.
%prep
mkdir -p %{buildroot}/usr/share/license
cp LICENSE %{buildroot}/usr/share/license/%{name}
+
%make_install
+mkdir -p %{buildroot}%{_libdir}/systemd/system
+%if 0%{?simulator}
+install -m 0644 %SOURCE1001 %{buildroot}%{_libdir}/systemd/system/sdbd.service
+%else
+install -m 0644 %SOURCE1002 %{buildroot}%{_libdir}/systemd/system/sdbd.service
+%endif
+
+mkdir -p %{buildroot}%{_prefix}/sbin
+install -m 755 script/sdk_launch %{buildroot}%{_prefix}/sbin/
%post
chsmack -a sdbd::home /home/developer
%{_prefix}/sbin/sdk_launch
%{_sysconfdir}/init.d/sdbd
/usr/share/license/%{name}
-
-%ifarch %{ix86}
- %{_sysconfdir}/rc.d/rc3.d
-%endif
+%{_libdir}/systemd/system/sdbd.service
%changelog
-* Wed Apr 04 2013 Ho Namkoong <ho.namkoong@samsung.com>
- - supports platform gdbserver
-* Mon Dec 02 2012 Yoonki Park <yoonki.park@samsung.com>
- - supports cs report service using inotify
-* Mon Dec 02 2012 Yoonki Park <yoonki.park@samsung.com>
- - sdb code dropped from adb (Ice Cream Samdwich 4.1.1)
-* Wed Apr 18 2012 Yoonki Park <yoonki.park@samsung.com>
- - set dir permission to 777
-* Sat Mar 31 2012 Yoonki Park <yoonki.park@samsung.com>
- - let sshd be daemon and create sshd.pid file
--- /dev/null
+[Unit]
+Description=sdbd
+After=default.target
+
+[Service]
+Type=forking
+Environment=DISPLAY=:0
+PIDFile=/tmp/.sdbd.pid
+RemainAfterExit=yes
+ExecStart=/usr/sbin/sdbd
--- /dev/null
+[Unit]
+Description=sdbd
+Before=sensord.service
+
+[Service]
+Type=forking
+Environment=DISPLAY=:0
+PIDFile=/tmp/.sdbd.pid
+RemainAfterExit=yes
+ExecStartPre=/bin/bash -c "/bin/echo `/bin/sed 's/^.*sdb_port=\([^, ]*\).*$/\1/g' /proc/cmdline` > /opt/home/sdb_port.txt"
+ExecStart=/usr/sbin/sdbd
+
+[Install]
+WantedBy=emulator.target
+
--- /dev/null
+#!/bin/bash
+
+# Authors:
+# Kangho Kim <kh5325.kim@samsung.com>, Yoonki Park <yoonki.park@samsung.com>
+#
+# Description: front hand of app launcher
+
+APP_PATH_PREFIX=/opt/apps
+SDK_TOOLS_PATH=/home/developer/sdk_tools
+
+print_usage()
+{
+ echo "usage: $0 -p <pkgid> -e <executable> -m <run|debug|da|oprofile> [-P <port>] [-attach <pid>] -t <gtest,gcov> [<args...>]"
+}
+
+first="true"
+
+until [ -z "$1" ]; do
+ case "$1" in
+ -p)
+ if [ -z "$2" ]
+ then
+ print_usage
+ exit 1;
+ fi
+ pkgid=$2
+ shift 2;
+ ;;
+ -e)
+ if [ -z "$2" ]
+ then
+ print_usage
+ exit 1;
+ fi
+ exe=${2/%.exe/}
+ shift 2;
+ ;;
+ -m)
+ if [ "$2" != "run" ] && [ "$2" != "debug" ] && [ "$2" != "da" ] && [ "$2" != "oprofile" ]
+ then
+ print_usage
+ exit 1;
+ fi
+ mode=$2
+ shift 2;
+ ;;
+ -P)
+ if [ -z "$2" ]
+ then
+ print_usage
+ exit 1;
+ fi
+ port=$2
+ shift 2;
+ ;;
+ -attach)
+ if [ -z "$2" ]
+ then
+ print_usage
+ exit 1;
+ fi
+ attach_id=$2
+ shift 2;
+ ;;
+ -t)
+ if [ "$2" = "" ] || [ ${2:0:1} = "-" ]
+ then
+ shift 1;
+ else
+# parse -t option
+ OLD_IFS=$IFS;IFS=,;
+ for type in $2;do
+ if [ "$type" = "gtest" ]
+ then
+ COV_TEST_PREFIX="export LD_LIBRARY_PATH=%s/gtest/usr/lib && $COV_TEST_PREFIX"
+ if [ "" != "$result_mode" ]
+ then
+ result_mode="$result_mode,UNIT_TEST"
+ else
+ launch_app_mode="__LAUNCH_APP_MODE__ SYNC"
+ result_mode="UNIT_TEST"
+ fi
+ fi
+ if [ "$type" = "gcov" ]
+ then
+ COV_TEST_PREFIX="export GCOV_PREFIX=/tmp/%s/data && export GCOV_PREFIX_STRIP=0 && $COV_TEST_PREFIX"
+ if [ "" != "$result_mode" ]
+ then
+ result_mode="$result_mode,CODE_COVERAGE"
+ else
+ launch_app_mode="__LAUNCH_APP_MODE__ SYNC"
+ result_mode="CODE_COVERAGE"
+ fi
+ fi
+ done;
+ IFS=$OLD_IFS
+
+ shift 2;
+ fi
+ ;;
+ *)
+ if [ "$first" = "true" ]
+ then
+ first="false"
+ args="__DLP_UNIT_TEST_ARG__ $1"
+ else
+ args="$args","$1"
+ fi
+ shift 1;
+ esac
+done
+
+if [ "$mode" = "debug" ]
+then
+ if [ "" != "$attach_id" ]
+ #debug attach
+ then
+ cmd="$COV_TEST_PREFIX /home/developer/sdk_tools/gdbserver/gdbserver :$port --attach $attach_id"
+ #debug
+ else
+ if [ "" != "$result_mode" ]
+ then
+ result_mode="DEBUG,$result_mode"
+ else
+ result_mode="DEBUG"
+ fi
+ cmd="/usr/bin/launch_app $pkgid.$exe __AUL_SDK__ $result_mode __DLP_DEBUG_ARG__ :$port $launch_app_mode"
+# cmd="$COV_TEST_PREFIX /home/developer/sdk_tools/gdbserver/gdbserver :$port /opt/apps/$pkgid/bin/$exe"
+ fi
+else
+ if [ "$mode" = "run" ]
+ then
+ if [ "" != "$result_mode" ]
+ then
+ cmd="/usr/bin/launch_app $pkgid.$exe __AUL_SDK__ $result_mode $launch_app_mode"
+ else
+ cmd="/usr/bin/launch_app $pkgid.$exe"
+ fi
+ else
+ if [ "$mode" = "da" ]
+ then
+ if [ "" != "$result_mode" ]
+ then
+ result_mode="DYNAMIC_ANALYSIS,$result_mode"
+ else
+ result_mode="DYNAMIC_ANALYSIS"
+ fi
+ fi
+ if [ "$mode" = "oprofile" ]
+ then
+ if [ "" == "$result_mode" ]
+ then
+ result_mode="OPROFILE"
+ fi
+ fi
+ cmd="/usr/bin/launch_app $pkgid.$exe __AUL_SDK__ $result_mode"
+ fi
+fi
+
+# execute command
+$cmd $args
+++ /dev/null
-#!/bin/bash
-
-# Authors:
-# Kangho Kim <kh5325.kim@samsung.com>, Yoonki Park <yoonki.park@samsung.com>
-#
-# Description: front hand of app launcher
-
-APP_PATH_PREFIX=/opt/apps
-SDK_TOOLS_PATH=/home/developer/sdk_tools
-
-print_usage()
-{
- echo "usage: $0 -p <pkgid> -e <executable> -m <run|debug|da|oprofile> [-P <port>] [-attach <pid>] -t <gtest,gcov> [<args...>]"
-}
-
-first="true"
-
-until [ -z "$1" ]; do
- case "$1" in
- -p)
- if [ -z "$2" ]
- then
- print_usage
- exit 1;
- fi
- pkgid=$2
- shift 2;
- ;;
- -e)
- if [ -z "$2" ]
- then
- print_usage
- exit 1;
- fi
- exe=${2/%.exe/}
- shift 2;
- ;;
- -m)
- if [ "$2" != "run" ] && [ "$2" != "debug" ] && [ "$2" != "da" ] && [ "$2" != "oprofile" ]
- then
- print_usage
- exit 1;
- fi
- mode=$2
- shift 2;
- ;;
- -P)
- if [ -z "$2" ]
- then
- print_usage
- exit 1;
- fi
- port=$2
- shift 2;
- ;;
- -attach)
- if [ -z "$2" ]
- then
- print_usage
- exit 1;
- fi
- attach_id=$2
- shift 2;
- ;;
- -t)
- if [ "$2" = "" ] || [ ${2:0:1} = "-" ]
- then
- shift 1;
- else
-# parse -t option
- OLD_IFS=$IFS;IFS=,;
- for type in $2;do
- if [ "$type" = "gtest" ]
- then
- COV_TEST_PREFIX="export LD_LIBRARY_PATH=%s/gtest/usr/lib && $COV_TEST_PREFIX"
- if [ "" != "$result_mode" ]
- then
- result_mode="$result_mode,UNIT_TEST"
- else
- launch_app_mode="__LAUNCH_APP_MODE__ SYNC"
- result_mode="UNIT_TEST"
- fi
- fi
- if [ "$type" = "gcov" ]
- then
- COV_TEST_PREFIX="export GCOV_PREFIX=/tmp/%s/data && export GCOV_PREFIX_STRIP=0 && $COV_TEST_PREFIX"
- if [ "" != "$result_mode" ]
- then
- result_mode="$result_mode,CODE_COVERAGE"
- else
- launch_app_mode="__LAUNCH_APP_MODE__ SYNC"
- result_mode="CODE_COVERAGE"
- fi
- fi
- done;
- IFS=$OLD_IFS
-
- shift 2;
- fi
- ;;
- *)
- if [ "$first" = "true" ]
- then
- first="false"
- args="__DLP_UNIT_TEST_ARG__ $1"
- else
- args="$args","$1"
- fi
- shift 1;
- esac
-done
-
-if [ "$mode" = "debug" ]
-then
- if [ "" != "$attach_id" ]
- #debug attach
- then
- cmd="$COV_TEST_PREFIX /home/developer/sdk_tools/gdbserver/gdbserver :$port --attach $attach_id"
- #debug
- else
- if [ "" != "$result_mode" ]
- then
- result_mode="DEBUG,$result_mode"
- else
- result_mode="DEBUG"
- fi
- cmd="/usr/bin/launch_app $pkgid.$exe __AUL_SDK__ $result_mode __DLP_DEBUG_ARG__ :$port $launch_app_mode"
-# cmd="$COV_TEST_PREFIX /home/developer/sdk_tools/gdbserver/gdbserver :$port /opt/apps/$pkgid/bin/$exe"
- fi
-else
- if [ "$mode" = "run" ]
- then
- if [ "" != "$result_mode" ]
- then
- cmd="/usr/bin/launch_app $pkgid.$exe __AUL_SDK__ $result_mode $launch_app_mode"
- else
- cmd="/usr/bin/launch_app $pkgid.$exe"
- fi
- else
- if [ "$mode" = "da" ]
- then
- if [ "" != "$result_mode" ]
- then
- result_mode="DYNAMIC_ANALYSIS,$result_mode"
- else
- result_mode="DYNAMIC_ANALYSIS"
- fi
- fi
- if [ "$mode" = "oprofile" ]
- then
- if [ "" == "$result_mode" ]
- then
- result_mode="OPROFILE"
- fi
- fi
- cmd="/usr/bin/launch_app $pkgid.$exe __AUL_SDK__ $result_mode"
- fi
-fi
-
-# execute command
-$cmd $args