[IMPROVE] WSP data via debugfs 27/50427/1
authorAlexander Aksenov <a.aksenov@samsung.com>
Wed, 7 Oct 2015 09:54:04 +0000 (12:54 +0300)
committerAlexander Aksenov <a.aksenov@samsung.com>
Wed, 28 Oct 2015 12:14:36 +0000 (15:14 +0300)
Previously webapp and ewebkit paths were hardcoded in modules,
now they are found out during manager compilation.

Change-Id: I3e43b4b3eeacde7e499a7b7796f42cf42dce17be
Signed-off-by: Alexander Aksenov <a.aksenov@samsung.com>
daemon/Makefile
packaging/swap-manager.spec
scripts/gen_wsp_data.sh
scripts/start.sh

index dd1322f..9bd6b35 100644 (file)
@@ -130,7 +130,13 @@ DASCRIPT = da_command
 START_SH = ../scripts/start.sh
 STOP_SH = ../scripts/stop.sh
 INIT_PRELOAD_SH = ../scripts/init_preload.sh
+INIT_WSP_SH = ../scripts/init_wsp.sh
 PRELOAD_SCRIPT = ../scripts/gen_preload_header.sh
+SCRIPTS := \
+       $(START_SH) \
+       $(STOP_SH) \
+       $(INIT_PRELOAD_SH) \
+       $(INIT_WSP_SH)
 
 all: debug
 
@@ -145,14 +151,28 @@ $(GENERATED_WSI_PROF_H): ../scripts/gen_wsi_prof.sh
        sh $< > $@
 
 
+#Preload
+$(INIT_PRELOAD_SH): $(PRELOAD_SCRIPT)
+       bash $< $@
+
 # WSP
+$(INIT_WSP_SH): $(WSP_SCRIPT)
+ifeq ($(WSP_SUPPORT),y)
+       bash $(WSP_SCRIPT) -s > $@
+else # WSP_SUPPORT
+       echo "#!/bin/bash" > $@
+       echo "echo \"Do not init WSP!\" " >> $@
+endif # WSP_SUPPORT
+
 ifeq ($(WSP_SUPPORT),y)
   SRC_CPP += cpp/features/feature_wsp.cpp
   GENERATED_WSP_H = include/generated/wsp_data.h
+  WSP_SCRIPT = ../scripts/gen_wsp_data.sh
   GENERATED_HEADERS += $(GENERATED_WSP_H)
 
-  $(GENERATED_WSP_H): ../scripts/gen_wsp_data.sh
-       sh $< > $@
+  $(GENERATED_WSP_H): $(WSP_SCRIPT)
+       bash $< -h > $@
+
 endif # WSP_SUPPORT
 
 
@@ -182,18 +202,17 @@ OBJS := $(OBJS_C) $(OBJS_CPP)
        $(CPP) $(CPPFLAGS) -c -o $@ $<
 
 
-debug: rmheaders headers $(OBJS)
+debug: rmheaders headers $(SCRIPTS) $(OBJS)
        $(CPP) $(OBJS) -o $(TARGET) $(LDFLAGS)
 
 
 install: BINDIR = $(DESTDIR)/usr/bin
 install: OPTDIR = $(DESTDIR)/opt/swap/sdk
-install: $(TARGET)
+install: $(TARGET) $(SCRIPTS)
        mkdir -p $(BINDIR)
        mkdir -p $(OPTDIR)
        install $(TARGET) -t $(BINDIR)
-       bash $(PRELOAD_SCRIPT) $(INIT_PRELOAD_SH)
-       install -m 755 $(INIT_PRELOAD_SH) $(START_SH) $(STOP_SH) -t $(OPTDIR)
+       install -m 755 $(SCRIPTS) -t $(OPTDIR)
 
 clean:
        rm -f $(TARGET) $(OBJS)
index 6e8621a..909c299 100644 (file)
@@ -13,6 +13,7 @@ BuildRequires:  vconf-devel
 BuildRequires:  capi-system-info-devel
 BuildRequires:  capi-system-runtime-info-devel
 BuildRequires:  libwebsockets-devel
+BuildRequires:  wrt
 %if "%{sec_product_feature_profile_wearable}" == "1"
 BuildRequires:  libjson-devel
 %else
@@ -103,6 +104,7 @@ touch /opt/usr/etc/resourced_proc_exclude.ini
 /opt/swap/sdk/start.sh
 /opt/swap/sdk/stop.sh
 /opt/swap/sdk/init_preload.sh
+/opt/swap/sdk/init_wsp.sh
 
 %changelog
 
index 18adec2..a8432f0 100755 (executable)
@@ -1,7 +1,9 @@
 #!/bin/bash
 
-
+output_type=$1
 script_dir=$(readlink -f $0 | xargs dirname)
+webapp_path="/sys/kernel/debug/swap/wsp/webapp_path"
+ewebkit_path="/sys/kernel/debug/swap/wsp/ewebkit_path"
 source $script_dir/dyn_vars
 
 if [ "$__tizen_profile_name__" == "tv" ]; then
@@ -96,56 +98,82 @@ gen_array()
        done
 }
 
+function gen_header_out()
+{
+       if [ "$__tizen_profile_name__" == "tv" ] || [ "$__tizen_product_2_4_wearable__" == "1" ]; then
+               add_func_plt soup_requester_request_uri@plt soup_request
+               add_func _ZN7WebCore14ResourceLoader15willSendRequestERNS_15ResourceRequestERKNS_16ResourceResponseE main_res_will
+               add_func _ZN7WebCore11CachedImage7addDataEPKcj main_res_add
+               add_func _ZN7WebCore14ResourceLoader16didFinishLoadingEd main_res_finish
+               add_func _ZN7WebCore14ResourceLoader15willSendRequestERNS_15ResourceRequestERKNS_16ResourceResponseE res_will
+               add_func _ZN7WebCore14ResourceLoader16didFinishLoadingEPNS_14ResourceHandleEd res_finish
+               add_func _ZN7WebCore22CompositingCoordinator24flushPendingLayerChangesEv redraw
+       else
+               add_func_plt soup_requester_request@plt soup_request
+               add_func _ZN7WebCore18MainResourceLoader15willSendRequestERNS_15ResourceRequestERKNS_16ResourceResponseE main_res_will
+               add_func _ZN7WebCore18MainResourceLoader7addDataEPKcib main_res_add
+               add_func _ZN7WebCore18MainResourceLoader16didFinishLoadingEd main_res_finish
+               add_func _ZN7WebCore14ResourceLoader15willSendRequestERNS_15ResourceRequestERKNS_16ResourceResponseE res_will
+               add_func _ZN7WebCore14ResourceLoader16didFinishLoadingEPNS_14ResourceHandleEd res_finish
+               add_func _ZN6WebKit20LayerTreeCoordinator24flushPendingLayerChangesEv redraw
+       fi
 
-if [ "$__tizen_profile_name__" == "tv" ] || [ "$__tizen_product_2_4_wearable__" == "1" ]; then
-       add_func_plt soup_requester_request_uri@plt soup_request
-       add_func _ZN7WebCore14ResourceLoader15willSendRequestERNS_15ResourceRequestERKNS_16ResourceResponseE main_res_will
-       add_func _ZN7WebCore11CachedImage7addDataEPKcj main_res_add
-       add_func _ZN7WebCore14ResourceLoader16didFinishLoadingEd main_res_finish
-       add_func _ZN7WebCore14ResourceLoader15willSendRequestERNS_15ResourceRequestERKNS_16ResourceResponseE res_will
-       add_func _ZN7WebCore14ResourceLoader16didFinishLoadingEPNS_14ResourceHandleEd res_finish
-       add_func _ZN7WebCore22CompositingCoordinator24flushPendingLayerChangesEv redraw
-else
-       add_func_plt soup_requester_request@plt soup_request
-       add_func _ZN7WebCore18MainResourceLoader15willSendRequestERNS_15ResourceRequestERKNS_16ResourceResponseE main_res_will
-       add_func _ZN7WebCore18MainResourceLoader7addDataEPKcib main_res_add
-       add_func _ZN7WebCore18MainResourceLoader16didFinishLoadingEd main_res_finish
-       add_func _ZN7WebCore14ResourceLoader15willSendRequestERNS_15ResourceRequestERKNS_16ResourceResponseE res_will
-       add_func _ZN7WebCore14ResourceLoader16didFinishLoadingEPNS_14ResourceHandleEd res_finish
-       add_func _ZN6WebKit20LayerTreeCoordinator24flushPendingLayerChangesEv redraw
-fi
+       IFS=$'\n'
 
-IFS=$'\n'
+       array=`gen_array`
+       if [ $? -ne 0 ]; then
+               exit 1
+       fi
 
-array=`gen_array`
-if [ $? -ne 0 ]; then
-       exit 1
-fi
+       cat <<- EOF
+
+               /*
+                * Autogenerated header
+                */
 
+               #ifndef __WSP_DATA__
+               #define __WSP_DATA__
 
+               struct wsp_data {
+                       const char *name;
+                       const char *nick_name;
+                       unsigned long addr;
+               };
 
-cat << EOF
-/*
- * Autogenerated header
- */
+               static struct wsp_data wsp_data[] = {
+               ${array}
+               };
 
-#ifndef __WSP_DATA__
-#define __WSP_DATA__
+               enum {
+                       wsp_data_cnt = sizeof(wsp_data) / sizeof(struct wsp_data)
+               };
 
-struct wsp_data {
-       const char *name;
-       const char *nick_name;
-       unsigned long addr;
-};
+               #endif /* __WSP_DATA__ */
 
-static struct wsp_data wsp_data[] = {
-${array}
-};
+EOF
+}
+
+function gen_script_out()
+{
+       webapp_package_name=wrt
+       path_webapp=`rpm -ql $webapp_package_name | grep "wrt_launchpad_daemon$" | head -1`
+
+       cat <<- EOF
+
+               #!/bin/bash
 
-enum {
-       wsp_data_cnt = sizeof(wsp_data) / sizeof(struct wsp_data)
-};
+               #WSP initialze autogenerated script
+
+               /bin/echo "$path_webapp" > $webapp_path
+               /bin/echo "$path_libewebkit2" > $ewebkit_path
 
-#endif /* __WSP_DATA__ */
 EOF
+}
 
+if [ "$1" == "-h" ]; then
+       gen_header_out
+elif [ "$1" == "-s" ]; then
+       gen_script_out
+else
+       exit 1
+fi
index 079036a..99a7ac1 100755 (executable)
@@ -100,4 +100,10 @@ then
        ./init_preload.sh
 fi
 
+#WSP
+if [ -d /sys/kernel/debug/swap/wsp/ ]
+then
+       ./init_wsp.sh
+fi
+
 exit $ERR_NO