兼容glibc
Change-Id: I7b1361d8f1e3c31c2d94b31b6addc32869dee457
diff --git a/build.sh b/build.sh
index 4991331..89fd1e0 100755
--- a/build.sh
+++ b/build.sh
@@ -10,21 +10,24 @@
export BUILD_LIB_TYPE=shared
# gcc-4.9 / gcc-8.4
+# glibc / musl
+export BUILD_STD_LIBC=musl
+
ROOT_DIR=`pwd`
cd ..
grep "url" .git/config | cut -d " " -f 3 | grep "kernel_5.4.195"
if [ $? -eq "0" ]; then
- export BUILD_PLATFORM=asr1806
+ export BUILD_PLATFORM=v2102
else
- export BUILD_PLATFORM=asr1803
+ export BUILD_PLATFORM=master
fi
export BUILD_BRANCH=`git branch | grep "*" | cut -d " " -f 2`
BUILD_PROJECT_TEMP=`cat build_version | grep PROJECT | cut -d '=' -f 2`
echo "BUILD_PROJECT_TEMP=$BUILD_PROJECT_TEMP"
-if [ "$BUILD_PLATFORM" == "asr1803" ];then
+if [ "$BUILD_PLATFORM" == "master" ];then
if [ "`echo $BUILD_PROJECT_TEMP | cut -c 1-4`" == "L509" ];then
export BUILD_PROJECT=L509
elif [ "`echo $BUILD_PROJECT_TEMP | cut -c 1-4`" == "L508" ];then
diff --git a/mbtk/Make.defines b/mbtk/Make.defines
index 03ca961..516d6c3 100755
--- a/mbtk/Make.defines
+++ b/mbtk/Make.defines
@@ -8,7 +8,7 @@
OUT_DIR = $(ROOT)/out
LOCAL_PATH=.
-ifeq ($(BUILD_PLATFORM), asr1803)
+ifeq ($(BUILD_PLATFORM), master)
ifeq ($(BUILD_BRANCH), rls3895)
BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-4.9-rls3895
else
@@ -16,12 +16,17 @@
endif
CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-uclibcgnueabi-gcc
AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-uclibcgnueabi-ar
-else ifeq ($(BUILD_PLATFORM), asr1806)
+else ifeq ($(BUILD_PLATFORM), v2102)
+ifeq ($(BUILD_STD_LIBC), glibc)
+BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-8.4-glibc
+CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-gnueabi-gcc
+AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-gnueabi-ar
+else
BUILD_TOOLCHAIN_DIR = $(ROOT)/toolchain/gcc-8.4
-
CC=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-muslgnueabi-gcc
AR=$(BUILD_TOOLCHAIN_DIR)/bin/arm-openwrt-linux-muslgnueabi-ar
+endif
else
CC=gcc
AR=ar
@@ -73,8 +78,8 @@
#$(info BUILD_PROJECT_X=$(BUILD_PROJECT_X))
# 1806
-ifeq ($(BUILD_PLATFORM), asr1806)
-DEFINE += -DMBTK_PLATFORM_ASR1806
+ifeq ($(BUILD_PLATFORM), v2102)
+DEFINE += -DMBTK_PLATFORM_KERNEL_5
ifeq ($(BUILD_PROJECT), L508_X6)
DEFINE += -DMBTK_PROJECT_L508_X6
@@ -102,7 +107,7 @@
DEFINE += -DMBTK_MP3_SUPPORT
endif
-DEFINE += -DMBTK_PLATFORM_ASR1803
+DEFINE += -DMBTK_PLATFORM_KERNEL_3
ifeq ($(BUILD_PROJECT), L508)
DEFINE += -DMBTK_PROJECT_L508
diff --git a/mbtk/liblynq_lib/Makefile b/mbtk/liblynq_lib/Makefile
index 6a5a50a..d8ef441 100755
--- a/mbtk/liblynq_lib/Makefile
+++ b/mbtk/liblynq_lib/Makefile
@@ -43,7 +43,7 @@
src/lynq_voice_call.c \
src/lynq_chip_id.c
-ifeq ($(BUILD_PLATFORM), asr1806)
+ifeq ($(BUILD_PLATFORM), v2102)
LOCAL_SRC_FILES += src/lynq_audio.c
endif
diff --git a/mbtk/liblynq_lib/src/lynq_log.c b/mbtk/liblynq_lib/src/lynq_log.c
index 09f16f9..e096f8a 100755
--- a/mbtk/liblynq_lib/src/lynq_log.c
+++ b/mbtk/liblynq_lib/src/lynq_log.c
@@ -1,7 +1,7 @@
#include <stdarg.h>
#include <sys/un.h>
#include <sys/socket.h>
-#include "json/json.h"
+#include "json-c/json.h"
#include "lynq_deflog.h"
#include "mbtk_type.h"
diff --git a/mbtk/liblynq_lib/src/lynq_sleep.c b/mbtk/liblynq_lib/src/lynq_sleep.c
index f50447d..84f6d75 100755
--- a/mbtk/liblynq_lib/src/lynq_sleep.c
+++ b/mbtk/liblynq_lib/src/lynq_sleep.c
@@ -24,9 +24,9 @@
Power management principle, as long as a wakelock lock exists, the system will not enter the Suspend state
So the name can be arbitrarily chosen to indicate that such a lock is needed so that the system does not sleep
*/
-#if defined(MBTK_PLATFORM_ASR1806)
+#if defined(MBTK_PLATFORM_KERNEL_5)
#define MTBK_POWERIND "/system/etc/powerind" //1806
-#else if defined(MBTK_PLATFORM_ASR1803)
+#elif defined(MBTK_PLATFORM_KERNEL_3)
#define MTBK_POWERIND "/etc/powerind" //1803
#endif
diff --git a/mbtk/libmbtk_audio/src/mbtk_pcm_stream.c b/mbtk/libmbtk_audio/src/mbtk_pcm_stream.c
index 54ae1be..5c592fc 100755
--- a/mbtk/libmbtk_audio/src/mbtk_pcm_stream.c
+++ b/mbtk/libmbtk_audio/src/mbtk_pcm_stream.c
@@ -23,7 +23,7 @@
static pthread_t recorder_thread_play;
static int lock_get() {
- int fd = open(LOCK_FILE, O_WRONLY | O_CREAT | O_TRUNC);
+ int fd = open(LOCK_FILE, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (fd == -1) {
LOGE("Open(%s) fail:%d", LOCK_FILE, errno);
return -1;
@@ -46,7 +46,7 @@
}
static int lock_free() {
- int fd = open(LOCK_FILE, O_WRONLY | O_CREAT | O_TRUNC);
+ int fd = open(LOCK_FILE, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (fd == -1) {
LOGE("Open(%s) fail:%d", LOCK_FILE, errno);
return -1;
diff --git a/mbtk/libmbtk_audio/src/mbtk_wav.c b/mbtk/libmbtk_audio/src/mbtk_wav.c
index cfe08a8..f2e104c 100755
--- a/mbtk/libmbtk_audio/src/mbtk_wav.c
+++ b/mbtk/libmbtk_audio/src/mbtk_wav.c
@@ -362,7 +362,7 @@
mbtk_audio_pcm_sample_rate_set(sample_rate);
- wav_recorder_fd = open(path, O_WRONLY | O_CREAT | O_TRUNC);
+ wav_recorder_fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (wav_recorder_fd < 0) {
LOGE("%s: error opening file %s!", __FUNCTION__, path);
return -1;
diff --git a/mbtk/libmbtk_coap/Makefile b/mbtk/libmbtk_coap/Makefile
index 2b0a53b..b5afc6a 100755
--- a/mbtk/libmbtk_coap/Makefile
+++ b/mbtk/libmbtk_coap/Makefile
@@ -11,7 +11,7 @@
# -lubus -lubox -luci -lprop2uci -lrilutil -lblobmsg_json
-ifeq ($(BUILD_PLATFORM), asr1803)
+ifeq ($(BUILD_PLATFORM), master)
#LIBS += -lcutils -laudio-apu
endif
diff --git a/mbtk/libmbtk_net/Makefile b/mbtk/libmbtk_net/Makefile
index 00212a5..bbf1198 100755
--- a/mbtk/libmbtk_net/Makefile
+++ b/mbtk/libmbtk_net/Makefile
@@ -9,7 +9,7 @@
LIBS += -llog -lmbtk_lib -lprop2uci
-ifeq ($(BUILD_PLATFORM), asr1803)
+ifeq ($(BUILD_PLATFORM), master)
LIBS += -lpolarssl
else
LIBS += -lssl -lcrypto
diff --git a/mbtk/mbtk_gnssd/Makefile b/mbtk/mbtk_gnssd/Makefile
index e1735ff..acd84e9 100755
--- a/mbtk/mbtk_gnssd/Makefile
+++ b/mbtk/mbtk_gnssd/Makefile
@@ -9,7 +9,7 @@
LIB_DIR +=
-LIBS += -lmbtk_lib -lmbtk_net -lmbtk_ril -lrilutil -lprop2uci -lmtel -laudio-apu -lcutils -ltinyalsa -lacm -lubus -lubox
+LIBS += -lmbtk_lib -lmbtk_net -lmbtk_ril -lrilutil -lprop2uci -lmtel -laudio-apu -lcutils -ltinyalsa -lacm -lubus -lubox -lutil
CFLAGS +=
diff --git a/mbtk/mbtk_logd/main.c b/mbtk/mbtk_logd/main.c
index edc5375..1e7a1af 100755
--- a/mbtk/mbtk_logd/main.c
+++ b/mbtk/mbtk_logd/main.c
@@ -10,8 +10,8 @@
#include <sys/file.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include "json/json.h"
-#include "json/printbuf.h"
+#include "json-c/json.h"
+#include "json-c/printbuf.h"
#include "log_config.h"
//#define DEBUG 1
diff --git a/mbtk/mbtk_logd/syslog_read.c b/mbtk/mbtk_logd/syslog_read.c
index e89a1c9..b15f323 100755
--- a/mbtk/mbtk_logd/syslog_read.c
+++ b/mbtk/mbtk_logd/syslog_read.c
@@ -25,8 +25,8 @@
#define SYSLOG_NAMES
#include <syslog.h>
-#include "json/json.h"
-#include "json/printbuf.h"
+#include "json-c/json.h"
+#include "json-c/printbuf.h"
#include <libubox/ustream.h>
#include <libubox/blobmsg_json.h>
diff --git a/mbtk/test/liblynq_lib_t106/Makefile b/mbtk/test/liblynq_lib_t106/Makefile
index d8eea05..fefde27 100755
--- a/mbtk/test/liblynq_lib_t106/Makefile
+++ b/mbtk/test/liblynq_lib_t106/Makefile
@@ -5,7 +5,7 @@
LIB_DIR +=
-LIBS += -lmbtk_lib -lmbtk_ril -lmbtk_net -lmbtk_audio -lmbtk_fota -lmbtk_gnss -lmbtk_factory -llynq_lib
+LIBS += -lmbtk_lib -lmbtk_ril -lmbtk_net -lmbtk_audio -lmbtk_fota -lmbtk_gnss -lmbtk_factory -llynq_lib -ldl
CFLAGS +=
diff --git a/mbtk/test/others/fs_full.c b/mbtk/test/others/fs_full.c
index 88bf28a..cb53e49 100755
--- a/mbtk/test/others/fs_full.c
+++ b/mbtk/test/others/fs_full.c
@@ -7,7 +7,7 @@
int main(int argc, char *argv[])
{
- int fd = open("/test.data", O_WRONLY | O_CREAT | O_APPEND);
+ int fd = open("/test.data", O_WRONLY | O_CREAT | O_APPEND, 0666);
if(fd < 0) {
printf("open() fail:%d", errno);
return -1;
diff --git a/mbtk/test/others/partition_write_demo.c b/mbtk/test/others/partition_write_demo.c
index 762e49c..1256d75 100755
--- a/mbtk/test/others/partition_write_demo.c
+++ b/mbtk/test/others/partition_write_demo.c
@@ -12,7 +12,7 @@
char buffer[102400];
long len = -1;
long count = 0;
- int fd = open("/etc/file.temp", O_CREAT | O_WRONLY | O_TRUNC);
+ int fd = open("/etc/file.temp", O_CREAT | O_WRONLY | O_TRUNC, 0666);
if(fd < 0) {
printf("Open file error:%d\n", errno);
return -1;
diff --git a/mbtk/test/others/usb_check.c b/mbtk/test/others/usb_check.c
index 7d81a7c..9aa5ebf 100755
--- a/mbtk/test/others/usb_check.c
+++ b/mbtk/test/others/usb_check.c
@@ -17,7 +17,7 @@
int main(int argc, char *argv[])
{
- int fd = open("/tmp/usb.info", O_CREAT | O_WRONLY);
+ int fd = open("/tmp/usb.info", O_CREAT | O_WRONLY, 0666);
signal(SIGINT, sig_handler);
signal(SIGTERM, sig_handler);
if(fd > 0) {