@@ -1,17 +1,36 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
+LOCAL_MODULE := powertop
+
LOCAL_MODULE_TAGS := debug
LOCAL_SHARED_LIBRARIES := libstlport \
libnl \
libpci \
- libtraceevnet \
-LOCAL_MODULE := powertop
+
+LOCAL_STATIC_LIBRARIES := libncurses
+
+CSSTOH_SOURCE := $(LOCAL_PATH)/src/csstoh.c
+POWERTOP_CSS_SOURCE := $(LOCAL_PATH)/src/powertop.css
+GEN_CSSTOH := $(LOCAL_PATH)/src/csstoh
+GEN_CSS_H := $(LOCAL_PATH)/src/css.h
+$(GEN_CSS_H):
+ $(CC) -o $(GEN_CSSTOH) $(CSSTOH_SOURCE)
+ ./$(GEN_CSSTOH) $(POWERTOP_CSS_SOURCE) $@
+
+LOCAL_GENERATED_SOURCES += $(GEN_CSS_H)
#LOCAL_CFLAGS += -Wall -O2 -g -fno-omit-frame-pointer -fstack-protector -Wshadow -Wformat -D_FORTIFY_SOURCE=2
#LOCAL_CPPFLAGS += -Wall -O2 -g -fno-omit-frame-pointer
-LOCAL_C_INCLUDES += external/stlport/stlport/ external/stlport/stlport/stl external/stlport/stlport/using/h/ bionic external/libnl/include/
+LOCAL_C_INCLUDES += external/stlport/stlport/ \
+ external/stlport/stlport/stl \
+ external/stlport/stlport/using/h/ \
+ bionic \
+ external/libnl/include/ \
+ external/ncurses/include \
+ external/elfutils/bionic-fixup \
+ $(LOCAL_PATH)/src
LOCAL_SRC_FILES += \
src/parameters/parameters.cpp \
@@ -21,10 +40,11 @@ LOCAL_SRC_FILES += \
src/process/work.cpp \
src/process/process.cpp \
src/process/timer.cpp \
- src/process/device.cpp \
+ src/process/processdevice.cpp \
src/process/interrupt.cpp \
src/process/do_process.cpp \
src/cpu/intel_cpus.cpp \
+ src/cpu/intel_gpu.cpp \
src/cpu/cpu.cpp \
src/cpu/cpu_linux.cpp \
src/cpu/cpudevice.cpp \
@@ -33,20 +53,21 @@ LOCAL_SRC_FILES += \
src/cpu/abstract_cpu.cpp \
src/measurement/measurement.cpp \
src/measurement/acpi.cpp \
+ src/measurement/sysfs.cpp \
src/measurement/extech.cpp \
src/measurement/power_supply.cpp \
src/display.cpp \
src/report.cpp \
src/main.cpp \
src/tuning/tuning.cpp \
- src/tuning/usb.cpp \
+ src/tuning/tuningusb.cpp \
src/tuning/bluetooth.cpp \
src/tuning/ethernet.cpp \
src/tuning/runtime.cpp \
src/tuning/iw.c \
src/tuning/iw.h \
src/tuning/tunable.cpp \
- src/tuning/sysfs.cpp \
+ src/tuning/tuningsysfs.cpp \
src/tuning/cpufreq.cpp \
src/tuning/wifi.cpp \
src/perf/perf_bundle.cpp \
new file mode 100644
@@ -0,0 +1,47 @@
+#include <linux/ethtool.h>
+#include <sys/socket.h>
+
+/* Android doesn't provide locale support int its C and C++
+ * runtime. Handled at higher level in application stack.
+ * So define stubs for gettext funtions used.
+ */
+#define PACKAGE 0
+#define LOCALEDIR 0
+#define bindtextdomain(x, y)
+#define textdomain(x)
+#define gettext(x) (x)
+
+/* Android C++ new operator does not throw exception on failure */
+#define set_new_handler(x)
+
+/* define stubs for C++ exception handling */
+#define try if (true)
+#define catch(x) if (false)
+
+/* Define __NR_perf_event_open if not already defined */
+#if __arm__
+#ifndef __NR_perf_event_open
+#define __NR_perf_event_open 364
+#endif
+#endif
+
+/* Implement missing functions */
+static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
+ __u32 speed)
+{
+
+ ep->speed = (__u16)speed;
+ ep->speed_hi = (__u16)(speed >> 16);
+}
+
+static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep)
+{
+ return (ep->speed_hi << 16) | ep->speed;
+}
+
+static inline char *strchrnul(const char *s, int c)
+{
+ while (*s && (*s != c))
+ s++;
+ return (char *)s;
+}
@@ -33,6 +33,10 @@
#include "config.h"
#endif
+#ifdef __ANDROID__
+#include "android_stubs.h"
+#endif
+
#define _(STRING) gettext(STRING)
#define POWERTOP_VERSION "v2.1"
This patch adds stubs for features that are not supported by Andriod. An header file which defines all stubs is included only for Android builds. Signed-off-by: Rajagopal Venkat <rajagopal.venkat@linaro.org> --- Android.mk | 33 +++++++++++++++++++++++++++------ src/android_stubs.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/lib.h | 4 ++++ 3 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 src/android_stubs.h