blob: 140c3c56cf4a6fe919ba951f76e4d8990b900e6e [file] [log] [blame]
From 61500b369c926840d5a519a02673d8cee63db62a Mon Sep 17 00:00:00 2001
From: Yong Wu <yong.wu@mediatek.com>
Date: Tue, 9 Jan 2018 13:51:40 +0800
Subject: [PATCH 1/2] libion: Add makefile
1. Add makefile
2. fix size_t build fail
3. fix LOGD build fail
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
---
libion/Makefile | 26 ++++++++++++++++++++++++++
libion/ion.c | 7 ++++++-
libion/kernel-headers/linux/ion.h | 1 +
3 files changed, 33 insertions(+), 1 deletion(-)
create mode 100644 libion/Makefile
diff --git a/libion/Makefile b/libion/Makefile
new file mode 100644
index 0000000..9112288
--- /dev/null
+++ b/libion/Makefile
@@ -0,0 +1,26 @@
+TARGET=libion-android.so.1
+SRC=ion.c
+OBJS=${SRC:%.c=%.o}
+
+.PHONY: all clean install
+
+all : ${TARGET}
+
+${TARGET} : $(OBJS)
+ ${CC} -g -shared -Wl,-soname,libion-android.so.1 -o ${TARGET} $<
+
+%.o: %.c
+ ${CC} -g -fPIC -I./include -I./kernel-headers -c $< -o $@
+
+clean:
+ ${RM} -r *.o
+
+install:
+ install -d ${DESTDIR}${LIBDIR}
+ install -d ${DESTDIR}${INCDIR}/
+ install -d ${DESTDIR}${INCDIR}/ion/
+ install -m 644 ${SRCDIR}/libion/libion-android.so.1 ${DESTDIR}${LIBDIR}
+ install -m 444 ${SRCDIR}/libion/include/ion/ion.h ${DESTDIR}${INCDIR}/ion/ion.h
+ install -d ${DESTDIR}${INCDIR}/linux
+ install -m 444 ${SRCDIR}/libion/kernel-headers/linux/ion.h ${DESTDIR}${INCDIR}/linux/ion.h
+ install -m 444 ${SRCDIR}/libion/kernel-headers/linux/ion_mtk.h ${DESTDIR}${INCDIR}/linux/ion_mtk.h
diff --git a/libion/ion.c b/libion/ion.c
index 9aaa6f2..bf4dec2 100644
--- a/libion/ion.c
+++ b/libion/ion.c
@@ -30,7 +30,12 @@
#include <unistd.h>
#include <ion/ion.h>
-#include <log/log.h>
+/* #include <log/log.h> */
+
+#define ALOGE(format, arg...) \
+ do { \
+ dprintf(0, "%s" format"\n", "LIBION", ##arg); \
+ } while (0)
int ion_open()
{
diff --git a/libion/kernel-headers/linux/ion.h b/libion/kernel-headers/linux/ion.h
index 3c28080..7c0aa34 100644
--- a/libion/kernel-headers/linux/ion.h
+++ b/libion/kernel-headers/linux/ion.h
@@ -20,6 +20,7 @@
#define _UAPI_LINUX_ION_H
#include <linux/ioctl.h>
#include <linux/types.h>
+#include <sys/types.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
typedef int ion_user_handle_t;
enum ion_heap_type {
--
1.9.1