zte's code,first commit
Change-Id: I9a04da59e459a9bc0d67f101f700d9d7dc8d681b
diff --git a/ap/lib/libdemo/Makefile b/ap/lib/libdemo/Makefile
new file mode 100755
index 0000000..9504bee
--- /dev/null
+++ b/ap/lib/libdemo/Makefile
@@ -0,0 +1,31 @@
+#*******************************************************************************
+# include ZTE library makefile
+#*******************************************************************************
+include $(COMMON_MK)
+
+LIB_STATIC = libdemo.a
+LIB_SHARED = libdemo.so
+
+OBJS = demo.o
+
+#定义宏和头文件目录,要用+=,不要用=,否则会覆盖COMMON_MK里的值
+CFLAGS += -g
+#CFLAGS += -I$(APP_DIR)/include
+
+#下面不要修改
+CFLAGS += -fPIC
+LDFLAGS += -shared
+
+all: $(LIB_STATIC) $(LIB_SHARED)
+
+$(LIB_STATIC) : $(OBJS)
+ $(AR) rcs $(LIB_STATIC) $(OBJS)
+
+$(LIB_SHARED): $(OBJS)
+ $(CC) $(LDFLAGS) -o $@ $^
+
+romfs:
+ $(ROMFSINST) $(LIB_SHARED) /lib/$(LIB_SHARED)
+
+clean:
+ -@rm *.a *.o *.so $(LIB_SHARED) $(LIB_STATIC) $(OBJS)
diff --git a/ap/lib/libdemo/demo.c b/ap/lib/libdemo/demo.c
new file mode 100755
index 0000000..88cf05d
--- /dev/null
+++ b/ap/lib/libdemo/demo.c
@@ -0,0 +1,47 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <pthread.h>
+
+static void *thread_func(void *arg)
+{
+ char buffer[10];
+
+ while(1)
+ {
+ printf("thread_func\n");
+ sleep(1);
+ }
+ pthread_exit(0);
+}
+
+int demo_main(void)
+{
+ pthread_attr_t attr;
+ pthread_t tid;
+ int s;
+
+ s = pthread_attr_init(&attr);
+ if (s != 0)
+ {
+ perror("pthread_attr_init error\n");
+ exit(-1);
+ }
+
+
+ s = pthread_create(&tid, &attr, thread_func, NULL);
+ if (s != 0)
+ {
+ perror("pthread_create error\n");
+ exit(-2);
+ }
+
+ s = pthread_join(tid, NULL);
+ if (s != 0)
+ {
+ perror("pthread_join error\n");
+ exit(-3);
+ }
+
+ return 0;
+}