[Feature][T106_eSDK]fix the compile problem of T106-V2.01.01.02P56U06.AP.15.11_rtp_CAP.15.11_rtp.01
Only Configure: No
Affected branch: rtp_tmp
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No
Change-Id: I01e7b887a0cf941831cc7f379e6de66f6f7d3d02
diff --git a/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf b/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
index 949c173..c1ff236 100755
--- a/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
+++ b/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
@@ -317,13 +317,11 @@
lynq-wifi-demo \
lynq-adc-demo \
lynq-at-test \
- lynq-vb-demo \
lynq-monitor-demo \
"
zxic_app_open += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', 'rild', '', d)}"
zxic_app_open += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'BL', 'tel-svr', '', d)}"
-zxic_app_open += "${@bb.utils.contains('CONFIG_VB_TRANSMIT_INTF', 'NULL', 'vb-demo', '', d)}"
#开源应用及库
meta_app_open += "\
diff --git a/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb b/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb
index f15ad14..b86b882 100755
--- a/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb
+++ b/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb
@@ -258,6 +258,7 @@
"
#xf.li@20240716 add start
do_oem_config() {
+ cp -R ${TOPDIR}/prebuilt/rootfs/* ${IMAGE_ROOTFS}/
if [ "${MOBILETEK_LOG_ENCRYPT}" = "enable" ]; then
touch ${IMAGE_ROOTFS}/etc/syslog_encrypt_flag
else
diff --git a/patch/15.11_15.11_rtp/code/15.11_15.11_rtp.patch b/patch/15.11_15.11_rtp/code/15.11_15.11_rtp.patch
index a5d2fc9..66cb1ba 100755
--- a/patch/15.11_15.11_rtp/code/15.11_15.11_rtp.patch
+++ b/patch/15.11_15.11_rtp/code/15.11_15.11_rtp.patch
@@ -133,7 +133,7 @@
# CONFIG_CHROME_PLATFORMS is not set
# CONFIG_MELLANOX_PLATFORM is not set
diff --git a/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf b/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
-index 923307e..a3e8043 100755
+index 55ad19c..c1ff236 100755
--- a/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
+++ b/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
@@ -85,7 +85,7 @@ DISTRO_FEATURES_append = " sysvinit "
@@ -153,21 +153,7 @@
CUSTOM_MACRO += "${@bb.utils.contains('CONFIG_VB_TRANSMIT_INTF', 'RTP', '-D_VB_TRANSMIT_INTF_RTP', '', d)}"
CUSTOM_MACRO += "${@bb.utils.contains('CONFIG_VB_TRANSMIT_INTF', 'USB', '-D_VB_TRANSMIT_INTF_USB', '', d)}"
#wifi 配置
-@@ -316,11 +317,13 @@ zxic_app_open += "\
- lynq-wifi-demo \
- lynq-adc-demo \
- lynq-at-test \
-+ lynq-vb-demo \
- lynq-monitor-demo \
- "
-
- zxic_app_open += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', 'rild', '', d)}"
- zxic_app_open += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'BL', 'tel-svr', '', d)}"
-+zxic_app_open += "${@bb.utils.contains('CONFIG_VB_TRANSMIT_INTF', 'NULL', 'vb-demo', '', d)}"
-
- #开源应用及库
- meta_app_open += "\
-@@ -460,5 +463,5 @@ MOBILETEK_GNSS_UPDATE_ENABLE = "no"
+@@ -460,5 +461,5 @@ MOBILETEK_GNSS_UPDATE_ENABLE = "no"
MOBILETEK_LOG_ENCRYPT = "disable"
LYNQ_CONFIG_COMMITID = "e2a3410390ff0ad762462ccb6af8faa5e16dcd61"
@@ -176,7 +162,7 @@
+LYNQ_CONFIG_VERSION = "T106-V2.01.01.02P56U06.AP.15.11_rtp_CAP.15.11_rtp"
+LYNQ_CONFIG_SW_VERSION = "T106-V2.01.01.02P56U06.AP.15.11_rtp_CAP.15.11_rtp.01"
diff --git a/esdk/layers/meta-zxic-custom/conf/lynq_base.conf b/esdk/layers/meta-zxic-custom/conf/lynq_base.conf
-index 3ec6dd8..d4841c2 100755
+index be8f374..0516be6 100755
--- a/esdk/layers/meta-zxic-custom/conf/lynq_base.conf
+++ b/esdk/layers/meta-zxic-custom/conf/lynq_base.conf
@@ -67,6 +67,6 @@ MOBILETEK_OPENSSH_CFG = "PLATFORM"
@@ -189,881 +175,869 @@
+LYNQ_CONFIG_COMMITID = "23a0609e6a55ac38c3df2bf77d4f2f4c1785a215"
+LYNQ_CONFIG_VERSION = "T106-V2.01.01.02P56U06.AP.15.11_rtp_CAP.15.11_rtp"
+LYNQ_CONFIG_SW_VERSION = "T106-V2.01.01.02P56U06.AP.15.11_rtp_CAP.15.11_rtp.01"
-diff --git a/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb b/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb
-index b86b882..f15ad14 100755
---- a/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb
-+++ b/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb
-@@ -258,7 +258,6 @@ IMAGE_POSTPROCESS_COMMAND += "\
- "
- #xf.li@20240716 add start
- do_oem_config() {
-- cp -R ${TOPDIR}/prebuilt/rootfs/* ${IMAGE_ROOTFS}/
- if [ "${MOBILETEK_LOG_ENCRYPT}" = "enable" ]; then
- touch ${IMAGE_ROOTFS}/etc/syslog_encrypt_flag
- else
diff --git a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.cpp b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.cpp
index 41c5c97..c3187a8 100755
--- a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.cpp
+++ b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-qser-voice-demo/files/lynq-qser-voice-demo.cpp
@@ -29,6 +29,8 @@ st_api_test_case at_api_testcases[] =
- {7, "qser_voice_set_test_num"},
- {8, "qser_voice_fast_ecall"},
- #endif
-+ {9, "qser_voice_set_audio_mode"},
-+ {10, "qser_voice_get_audio_mode"},
- {-1, NULL}
- };
-
+ {7, "qser_voice_set_test_num"},
+ {8, "qser_voice_fast_ecall"},
+ #endif
++ {9, "qser_voice_set_audio_mode"},
++ {10, "qser_voice_get_audio_mode"},
+ {-1, NULL}
+ };
+
@@ -51,6 +53,9 @@ int (*qser_voice_call_answer)(voice_client_handle_type ,int );
- int (*qser_voice_set_speech_volume)(const int volume);
- int (*qser_voice_get_speech_volume)(int *volume);
- int (*qser_voice_set_dtmf)(const char callnum);
-+int (*qser_voice_set_audio_mode)(const int audio_mode);
-+int (*qser_voice_get_audio_mode)(int* audio_mode);
-+
-
- #ifdef ECALL_SUPPORT
- int (*qser_voice_set_test_num)(voice_client_handle_type* h_voice,E_QSER_VOICE_ECALL_SET_TYPE_T type, const char *test_num, int test_num_length);
+ int (*qser_voice_set_speech_volume)(const int volume);
+ int (*qser_voice_get_speech_volume)(int *volume);
+ int (*qser_voice_set_dtmf)(const char callnum);
++int (*qser_voice_set_audio_mode)(const int audio_mode);
++int (*qser_voice_get_audio_mode)(int* audio_mode);
++
+
+ #ifdef ECALL_SUPPORT
+ int (*qser_voice_set_test_num)(voice_client_handle_type* h_voice,E_QSER_VOICE_ECALL_SET_TYPE_T type, const char *test_num, int test_num_length);
@@ -119,6 +124,7 @@ int main(int argc, char const *argv[])
- int ret = 0;
- int voice_call_id = 0;
- voice_client_handle_type h_voice = 0;
-+ int audio_mode = 0;
-
- const char *lynqLibPath_Call = "/lib/liblynq-qser-voice.so";
- dlHandle_call = dlopen(lynqLibPath_Call, RTLD_NOW);
+ int ret = 0;
+ int voice_call_id = 0;
+ voice_client_handle_type h_voice = 0;
++ int audio_mode = 0;
+
+ const char *lynqLibPath_Call = "/lib/liblynq-qser-voice.so";
+ dlHandle_call = dlopen(lynqLibPath_Call, RTLD_NOW);
@@ -230,7 +236,23 @@ int main(int argc, char const *argv[])
- printf("qser_voice_add_ecall_indhandler not defined or exported in %s\n", lynqLibPath_Call);
- return -1;
- }
--#endif
-+#endif
-+
-+ qser_voice_set_audio_mode = (int(*)(const int audio_mode))dlsym(dlHandle_call, "qser_voice_set_audio_mode");
-+ if(qser_voice_set_audio_mode == NULL)
-+ {
-+ printf("qser_voice_set_audio_mode not defined or exported in %s\n", lynqLibPath_Call);
-+ return -1;
-+ }
-+
-+
-+ qser_voice_get_audio_mode = (int(*)(int* audio_mode))dlsym(dlHandle_call, "qser_voice_get_audio_mode");
-+ if(qser_voice_get_audio_mode == NULL)
-+ {
-+ printf("qser_voice_get_audio_mode not defined or exported in %s\n", lynqLibPath_Call);
-+ return -1;
-+ }
-+
-
- ret = qser_voice_call_client_init(&h_voice);
- if(ret != 0 )
+ printf("qser_voice_add_ecall_indhandler not defined or exported in %s\n", lynqLibPath_Call);
+ return -1;
+ }
+-#endif
++#endif
++
++ qser_voice_set_audio_mode = (int(*)(const int audio_mode))dlsym(dlHandle_call, "qser_voice_set_audio_mode");
++ if(qser_voice_set_audio_mode == NULL)
++ {
++ printf("qser_voice_set_audio_mode not defined or exported in %s\n", lynqLibPath_Call);
++ return -1;
++ }
++
++
++ qser_voice_get_audio_mode = (int(*)(int* audio_mode))dlsym(dlHandle_call, "qser_voice_get_audio_mode");
++ if(qser_voice_get_audio_mode == NULL)
++ {
++ printf("qser_voice_get_audio_mode not defined or exported in %s\n", lynqLibPath_Call);
++ return -1;
++ }
++
+
+ ret = qser_voice_call_client_init(&h_voice);
+ if(ret != 0 )
@@ -378,6 +400,22 @@ int main(int argc, char const *argv[])
- break;
- }
- #endif
-+ case 9:
-+ {
-+
-+ printf("please input voice audio mode: 0 codec, 1 rtp\n");
-+ scanf("%d", &audio_mode);
-+ ret = qser_voice_set_audio_mode(audio_mode);
-+ printf("qser_voice_set_audio_mode ret = %d, audio_mode is %d\n", ret, audio_mode);
-+ break;
-+ }
-+ case 10:
-+ {
-+ ret = qser_voice_get_audio_mode(&audio_mode);
-+ printf("qser_voice_get_audio_mode ret = %d, audio_mode is %d\n", ret, audio_mode);
-+ break;
-+ }
-+
- default:
- print_help();
- break;
+ break;
+ }
+ #endif
++ case 9:
++ {
++
++ printf("please input voice audio mode: 0 codec, 1 rtp\n");
++ scanf("%d", &audio_mode);
++ ret = qser_voice_set_audio_mode(audio_mode);
++ printf("qser_voice_set_audio_mode ret = %d, audio_mode is %d\n", ret, audio_mode);
++ break;
++ }
++ case 10:
++ {
++ ret = qser_voice_get_audio_mode(&audio_mode);
++ printf("qser_voice_get_audio_mode ret = %d, audio_mode is %d\n", ret, audio_mode);
++ break;
++ }
++
+ default:
+ print_help();
+ break;
diff --git a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/lynq_vb_demo.c b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/lynq_vb_demo.c
new file mode 100755
index 0000000..6fde401
--- /dev/null
+++ b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/lynq_vb_demo.c
@@ -0,0 +1,778 @@
-+#include <stdio.h>
-+#include <unistd.h>
-+#include <string.h>
-+#include <stdlib.h>
-+#include <stdint.h>
-+#include <sys/ioctl.h>
-+#include <fcntl.h>
-+//#include "voice_ipc.h"
-+
-+#define _USE_VOICE_BUFFER
-+#include "voice_lib.h"
-+#include <fcntl.h>
-+#include <signal.h>
-+#include <semaphore.h>
-+#include <sys/types.h>
-+#include <pthread.h>
-+
-+/*command max len*/
-+#define VOICE_CMD_MAX_LEN 64
-+
-+#define EXIT_CMD_STOP "stop\n"
-+#define EXIT_CMD_Q "q\n"
-+#define EXIT_CMD_EXIT "exit\n"
-+
-+#define REQ_VOICE_BUFFER_TEST_START "voice_buffer_test_start"
-+#define REQ_VOICE_BUFFER_TEST_STOP "voice_buffer_test_stop"
-+#define REQ_VOICE_BUFFER_LOOP_TEST_START "voice_buffer_loop_test_start"
-+#define REQ_VOICE_BUFFER_LOOP_TEST_STOP "voice_buffer_loop_test_stop"
-+#define REQ_VOICE_BUFFER_RTP_TEST_START "voice_buffer_rtp_test_start"
-+#define REQ_VOICE_BUFFER_RTP_TEST_STOP "voice_buffer_rtp_test_stop"
-+
-+
-+
-+#define VBUFFER_TX_FILE_NAME "/mnt/userdata/tx.pcm"
-+#define VBUFFER_RX_FILE_NAME "/mnt/userdata/rx.pcm"
-+#define VBUFFER_TX16_FILE_NAME "/mnt/userdata/tx16.pcm"
-+#define VBUFFER_RX16_FILE_NAME "/mnt/userdata/rx16.pcm"
-+
-+
-+
-+#define VB_MAX_INT 0x7fffffff
-+#define VB_MIN_INT 0
-+#define VB_INT_OVERFLOW(x) if((x < VB_MIN_INT)||(x > VB_MAX_INT)) x = 0;
-+
-+#define RX_FILE_LEN_MAX 0x100000
-+
-+
-+
-+typedef int (vb_thread_proc)(void*);
-+struct vbuf_info_t
-+{
-+ int fd;
-+ pthread_t rx_test_thread;
-+ pthread_t tx_test_thread;
-+ pthread_t loop_test_thread;
-+ int quit;
-+ char *tx_buf;
-+ char *rx_buf;
-+ int buf_size;
-+ char *tx_filename;
-+ char *rx_filename;
-+ FILE *tx_file;
-+ FILE *rx_file;
-+ int tx_filesize;
-+ int rx_filesize;
-+ int fs;
-+};
-+
-+static struct vbuf_info_t vbuf_rec;
-+
-+static void printUsage(const char *Opt)
-+{
-+ printf("Usage: %s\n", Opt);
-+
-+ printf("voice_buffer_test_start value: 8000,16000\n");
-+ printf("voice_buffer_test_stop no value input\n");
-+ printf("voice_buffer_loop_test_start value: 8000,16000\n");
-+ printf("voice_buffer_loop_test_stop no value input\n");
-+ printf("\n");
-+}
-+
-+static int vbuffer_start_flag = 0;
-+static int tx_optcount = 0;
-+static int rx_optcount = 0;
-+static int first_rderr_flag = 0;
-+static int first_wrerr_flag = 0;
-+
-+
-+
-+//whole rx path
-+static int vb_rx_test_thread_func(void *arg)
-+{
-+ int ret;
-+
-+ char* buf = vbuf_rec.rx_buf;
-+ int size = vbuf_rec.buf_size;
-+ int bytes_read = 0;
-+ int r_size;
-+
-+
-+ printf( "%s: start size=%d! \n",__func__,size);
-+ memset (buf,0, size);
-+
-+ while (!vbuf_rec.quit)
-+ {
-+ rx_optcount ++;
-+ VB_INT_OVERFLOW(rx_optcount);
-+ if((rx_optcount%1000) == 0){
-+ printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);
-+
-+ }
-+ else if(rx_optcount == 1000000){
-+ printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);
-+ rx_optcount = 0;
-+
-+ }
-+
-+ //read form ps
-+ r_size = voice_buffer_read(vbuf_rec.fd, buf, size);
-+ if(r_size <= 0)
-+ {
-+ first_rderr_flag++;
-+ VB_INT_OVERFLOW(first_rderr_flag);
-+ continue ;
-+ }
-+ else{
-+ first_rderr_flag = 0;
-+
-+ }
-+
-+ if(vbuf_rec.rx_file != NULL)
-+ {
-+ r_size = fwrite(buf, 1,size, vbuf_rec.rx_file);
-+
-+ if (r_size != size) {
-+ //printf("Error fwrite size not eq,r_size=%d,size=%d\n",r_size,size);
-+ }
-+ else{
-+
-+ bytes_read += size;
-+ if(bytes_read >= vbuf_rec.rx_filesize){
-+ fseek(vbuf_rec.rx_file, 0, SEEK_SET);
-+ bytes_read = 0;
-+ printf("fwrite over write maxsize(%d)!!!\n",vbuf_rec.rx_filesize);
-+
-+ }
-+ }
-+ }
-+
-+
-+ }
-+
-+ return 0;
-+}
-+
-+static int vb_tx_test_thread_func(void *arg)
-+{
-+ int ret;
-+ int num_read;
-+
-+
-+ char* buf = vbuf_rec.tx_buf;
-+
-+ int size = vbuf_rec.buf_size;
-+ int w_size;
-+
-+ printf("%s: start size=%d! \n",__func__,size);
-+
-+
-+ memset(buf, 0,size);
-+ while (!vbuf_rec.quit)
-+ {
-+
-+ if(vbuf_rec.tx_file != NULL)
-+ {
-+
-+ num_read = fread(buf,1,size, vbuf_rec.tx_file);
-+
-+ if (num_read != size) {
-+ //printf("Error fread size not eq,num_read=%d,size=%d\n",num_read,size);
-+ }
-+ if (num_read <= 0) {
-+ printf("Error fread size not eq,num_read=%d,size=%d\n",num_read,size);
-+ fseek(vbuf_rec.tx_file, 0, SEEK_SET);
-+ }
-+ }
-+ tx_optcount ++;
-+ VB_INT_OVERFLOW(tx_optcount);
-+
-+ w_size = voice_buffer_write(vbuf_rec.fd, buf, size);
-+ if(w_size <= 0)
-+ {
-+ first_wrerr_flag++;
-+
-+ VB_INT_OVERFLOW(first_wrerr_flag);
-+
-+ continue;
-+ }
-+ else{
-+ first_wrerr_flag = 0;
-+
-+ }
-+
-+ }
-+ return 0;
-+}
-+
-+
-+static int vb_thread_create( const char *name,pthread_t *thread_t, vb_thread_proc *proc,
-+ int stack_size, unsigned priority,void *arg )
-+{
-+ pthread_attr_t thread_attr;
-+ int ret;
-+ int default_size;
-+
-+ struct sched_param param;
-+ int policy = SCHED_FIFO;
-+
-+ printf("%s: start! \n",__func__);
-+
-+ /* Init thread attributes */
-+ pthread_attr_init(&thread_attr);
-+ /* Create the thread. */
-+
-+ ret = pthread_create( thread_t, &thread_attr,proc, arg);
-+ if (ret != 0)
-+ {
-+ printf("%s: pthread_create fail,ret=%d! \n",__func__,ret);
-+
-+ pthread_attr_destroy(&thread_attr);
-+ return ret;
-+ }
-+
-+ pthread_attr_getstacksize(&thread_attr, &default_size);
-+ printf("%s: pthread_attr_getstacksize(%d)! \n",__func__,default_size);
-+
-+ pthread_attr_destroy(&thread_attr);
-+
-+ printf("%s: end \n",__func__);
-+ return 0;
-+}
-+
-+
-+int voice_buffer_stream_test_start(int fs)
-+{
-+ int ret = 0;
-+ int buf_size = 320;
-+ tx_optcount = 0;
-+ rx_optcount = 0;
-+ int* buf_int;
-+
-+ int i;
-+
-+ if(vbuffer_start_flag == 1){
-+ printf(" VB already start,return \n");
-+
-+ return 0;
-+ }
-+
-+ vbuffer_start_flag = 1;
-+
-+
-+
-+ if((vbuf_rec.fd != -1)&&(vbuf_rec.fd != 0)){
-+ printf(" VB fd already get, vbuf_rec.fd=%d return \n",vbuf_rec.fd);
-+ }
-+
-+ if(fs == 8000){
-+
-+ buf_size = 320;
-+ }
-+ else if(fs == 16000){
-+
-+ buf_size = 640;
-+ }
-+ else
-+ {
-+ buf_size = 320;
-+ }
-+ printf("Starting vb stream fs=%d buf_size=%d \n",fs,buf_size);
-+
-+ printf("%s:open tx and rx file \n",__func__);
-+ if(fs == 8000){
-+
-+ vbuf_rec.tx_filename = VBUFFER_TX_FILE_NAME;//"/cache/tx.pcm";
-+ vbuf_rec.rx_filename = VBUFFER_RX_FILE_NAME;//"/cache/rx.pcm";
-+
-+ }
-+ else if(fs == 16000){
-+
-+ vbuf_rec.tx_filename = VBUFFER_TX16_FILE_NAME;//"/cache/tx16.pcm";
-+ vbuf_rec.rx_filename = VBUFFER_RX16_FILE_NAME;//"/cache/rx16.pcm";
-+
-+ }
-+ else
-+ {
-+ vbuf_rec.tx_filename = VBUFFER_TX_FILE_NAME;//"/cache/tx.pcm";
-+ vbuf_rec.rx_filename = VBUFFER_RX_FILE_NAME;//"/cache/rx.pcm";
-+
-+ }
-+
-+
-+
-+
-+ vbuf_rec.tx_file = fopen(vbuf_rec.tx_filename , "rb");
-+ if (!vbuf_rec.tx_file) {
-+ printf("Unable to open file '%s'\n", vbuf_rec.tx_filename);
-+ //return -1;
-+ }
-+
-+
-+ vbuf_rec.rx_file = fopen(vbuf_rec.rx_filename, "wb");
-+ if (!vbuf_rec.rx_file) {
-+ printf(stderr, "Unable to create file '%s'\n", vbuf_rec.rx_filename);
-+ //fclose(vbuf_rec.tx_file);
-+
-+ //return -1;
-+ }
-+ vbuf_rec.rx_filesize = RX_FILE_LEN_MAX;
-+ printf("%s : vbuf_rec.rx_filesize(%d) \n",__func__,vbuf_rec.rx_filesize);
-+
-+ vbuf_rec.rx_buf = (char*) malloc(buf_size);
-+ if(!vbuf_rec.rx_buf) {
-+ printf("%s : malloc buf fail,return \n",__func__);
-+ goto err;
-+ }
-+ vbuf_rec.tx_buf = (char*) malloc(buf_size);
-+ if(!vbuf_rec.tx_buf) {
-+ free(vbuf_rec.rx_buf);
-+ printf("%s : malloc buf fail,return \n",__func__);
-+ vbuf_rec.rx_buf = NULL;
-+ goto err;
-+ }
-+ vbuf_rec.buf_size = buf_size;
-+
-+ vbuf_rec.quit = 0;
-+
-+ printf("%s : vb open start \n",__func__);
-+
-+
-+ vbuf_rec.fd = voice_buffer_open();
-+ if(vbuf_rec.fd <= 0){
-+ printf("%s : vb open fail fd=%d,return \n",__func__,vbuf_rec.fd);
-+ ret = -1;
-+ goto err;
-+
-+ }
-+ printf("%s :voice_buffer_open end \n",__func__);
-+
-+ printf("%s :rx tx vb_thread_create start \n",__func__);
-+ ret = vb_thread_create ("vb_playback_test",&vbuf_rec.rx_test_thread, vb_rx_test_thread_func,
-+ 4*1024,35,NULL);
-+ if (ret != 0)
-+ {
-+ printf("%s :rx vb_thread_create fail ret=%d,return \n",__func__,ret);
-+ goto err;
-+ }
-+
-+ printf("%s :rx vb_thread_create end \n",__func__);
-+
-+ ret = vb_thread_create ( "vbuf_record_test", &vbuf_rec.tx_test_thread, vb_tx_test_thread_func,
-+ 4*1024,35,NULL);
-+ if (ret != 0)
-+ {
-+
-+ printf("%s :tx vb_thread_create fail ret=%d,return \n",__func__,ret);
-+ vbuf_rec.quit = 1;
-+ pthread_join(vbuf_rec.rx_test_thread,NULL);
-+ vbuf_rec.rx_test_thread = NULL;
-+ goto err;
-+ }
-+ printf("%s :tx vb_thread_create end \n",__func__);
-+
-+ return 0;
-+
-+err:
-+ free(vbuf_rec.rx_buf);
-+ vbuf_rec.rx_buf = NULL;
-+ free(vbuf_rec.tx_buf);
-+ vbuf_rec.tx_buf = NULL;
-+
-+ fclose(vbuf_rec.tx_file);
-+ vbuf_rec.tx_file = NULL;
-+ fclose(vbuf_rec.rx_file);
-+ vbuf_rec.rx_file = NULL;
-+
-+ return ret;
-+}
-+
-+
-+//Stop stream
-+int voice_buffer_stream_test_stop(void)
-+{
-+ int ret = 0;
-+ printf("%s:rx tx thread exit start \n",__func__);
-+ if(vbuf_rec.quit == 1) {
-+ printf("%s,already stop ,return\n",__func__);
-+
-+ }
-+
-+ vbuf_rec.quit = 1;
-+ voice_buffer_stop(vbuf_rec.fd);
-+ if (vbuf_rec.tx_test_thread)
-+ {
-+ pthread_join (vbuf_rec.tx_test_thread,NULL);
-+ vbuf_rec.tx_test_thread = NULL;
-+
-+ }
-+
-+ if (vbuf_rec.rx_test_thread)
-+ {
-+ pthread_join (vbuf_rec.rx_test_thread,NULL);
-+ vbuf_rec.rx_test_thread = NULL;
-+ }
-+
-+ printf("voice_buffer_close start \n");
-+ ret = voice_buffer_close(vbuf_rec.fd);
-+ if(ret != 0)
-+ {
-+ printf("%s : vb close fail \n",__func__);
-+ }
-+ vbuf_rec.fd = -1;
-+
-+ if(vbuf_rec.tx_file != NULL)
-+ {
-+ fclose(vbuf_rec.tx_file);
-+ printf("%s : vb close ,close tx file \n",__func__);
-+ vbuf_rec.tx_file = NULL;
-+ }
-+
-+ if(vbuf_rec.rx_file != NULL)
-+ {
-+
-+ fclose(vbuf_rec.rx_file);
-+ printf("%s : vb close ,close rx file \n",__func__);
-+ vbuf_rec.rx_file = NULL;
-+
-+ }
-+
-+ free(vbuf_rec.rx_buf);
-+ vbuf_rec.rx_buf = NULL;
-+
-+ free(vbuf_rec.tx_buf);
-+ vbuf_rec.tx_buf = NULL;
-+
-+
-+ vbuffer_start_flag = 0;
-+ printf("Stopping vb stream end\n");
-+ return 0;
-+}
-+
-+
-+static int vb_loop_test_thread_func(void *arg)
-+{
-+ int ret;
-+
-+ char* buf = vbuf_rec.rx_buf;
-+ int size = vbuf_rec.buf_size;
-+
-+ //char* buf = vbuf_rec.tx_buf;
-+
-+ //int size = vbuf_rec.buf_size;
-+ int w_size;
-+ int r_size;
-+
-+
-+ printf( "%s: start size=%d! \n",__func__,size);
-+ memset (buf,0, size);
-+
-+ while (!vbuf_rec.quit)
-+ {
-+ rx_optcount ++;
-+ VB_INT_OVERFLOW(rx_optcount);
-+ if((rx_optcount%1000) == 0){
-+ printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);
-+
-+ }
-+ else if(rx_optcount == 1000000){
-+ printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);
-+ rx_optcount = 0;
-+
-+ }
-+
-+ //read form ps
-+ r_size = voice_buffer_read(vbuf_rec.fd, vbuf_rec.rx_buf, size);
-+ if(r_size <= 0)
-+ {
-+ first_rderr_flag++;
-+ VB_INT_OVERFLOW(first_rderr_flag);
-+ continue ;
-+ }
-+ else{
-+ first_rderr_flag = 0;
-+ }
-+ memcpy(vbuf_rec.tx_buf,vbuf_rec.rx_buf,size);
-+ w_size = voice_buffer_write(vbuf_rec.fd, vbuf_rec.tx_buf, size);
-+ if(w_size <= 0)
-+ {
-+ first_wrerr_flag++;
-+
-+ VB_INT_OVERFLOW(first_wrerr_flag);
-+
-+ continue;
-+ }
-+ else{
-+ first_wrerr_flag = 0;
-+ }
-+
-+ }
-+
-+ return 0;
-+}
-+
-+
-+int voice_buffer_stream_loop_test_start(int fs)
-+{
-+ int ret = 0;
-+ int buf_size = 320;
-+ tx_optcount = 0;
-+ rx_optcount = 0;
-+ int* buf_int;
-+
-+ int i;
-+
-+ if(vbuffer_start_flag == 1){
-+ printf(" VB already start,return \n");
-+
-+ return 0;
-+ }
-+
-+ if((vbuf_rec.fd != -1)&&(vbuf_rec.fd != 0)){
-+ printf(" VB fd already get, vbuf_rec.fd=%d return \n",vbuf_rec.fd);
-+ }
-+
-+ vbuffer_start_flag = 1;
-+
-+ if(fs == 8000){
-+
-+ buf_size = 320;
-+ }
-+ else if(fs == 16000){
-+
-+ buf_size = 640;
-+ }
-+ else
-+ {
-+ buf_size = 320;
-+ }
-+ printf("Starting vb stream fs=%d buf_size=%d \n",fs,buf_size);
-+
-+ vbuf_rec.rx_buf = (char*) malloc(buf_size);
-+ if(!vbuf_rec.rx_buf) {
-+ printf("%s : malloc buf fail,return \n",__func__);
-+ return -1;
-+ }
-+ vbuf_rec.tx_buf = (char*) malloc(buf_size);
-+ if(!vbuf_rec.tx_buf) {
-+ free(vbuf_rec.rx_buf);
-+ printf("%s : malloc buf fail,return \n",__func__);
-+ vbuf_rec.rx_buf = NULL;
-+ return -1;
-+ }
-+ vbuf_rec.buf_size = buf_size;
-+
-+ vbuf_rec.quit = 0;
-+
-+ printf("%s : vb open start \n",__func__);
-+
-+
-+ vbuf_rec.fd = voice_buffer_open();
-+ if(vbuf_rec.fd <= 0){
-+ printf("%s : vb open fail fd=%d,return \n",__func__,vbuf_rec.fd);
-+ ret = -1;
-+ goto err;
-+
-+ }
-+ printf("%s :loop vb_thread_create start \n",__func__);
-+ ret = vb_thread_create ("vb_playback_test",&vbuf_rec.loop_test_thread, vb_loop_test_thread_func,
-+ 4*1024,35,NULL);
-+ if (ret != 0)
-+ {
-+ printf("%s :rx vb_thread_create fail ret=%d,return \n",__func__,ret);
-+ goto err;
-+ }
-+
-+ printf("%s :rx vb_thread_create end \n",__func__);
-+
-+ return 0;
-+
-+err:
-+ free(vbuf_rec.rx_buf);
-+ vbuf_rec.rx_buf = NULL;
-+ free(vbuf_rec.tx_buf);
-+ vbuf_rec.tx_buf = NULL;
-+
-+ return ret;
-+}
-+
-+int voice_buffer_stream_loop_test_stop(void)
-+{
-+ int ret = 0;
-+ printf("%s:loop thread exit start \n",__func__);
-+ if(vbuf_rec.quit == 1) {
-+ printf("%s,already stop ,return\n",__func__);
-+
-+ }
-+
-+ vbuf_rec.quit = 1;
-+ voice_buffer_stop(vbuf_rec.fd);
-+ if (vbuf_rec.loop_test_thread)
-+ {
-+ pthread_join (vbuf_rec.loop_test_thread,NULL);
-+ vbuf_rec.tx_test_thread = NULL;
-+
-+ }
-+
-+ printf("voice_buffer_close start \n");
-+ ret = voice_buffer_close(vbuf_rec.fd);
-+ if(ret != 0)
-+ {
-+ printf("%s : vb close fail \n",__func__);
-+ }
-+ vbuf_rec.fd = -1;
-+ free(vbuf_rec.rx_buf);
-+ vbuf_rec.rx_buf = NULL;
-+
-+ free(vbuf_rec.tx_buf);
-+ vbuf_rec.tx_buf = NULL;
-+
-+
-+ vbuffer_start_flag = 0;
-+ printf("Stopping vb stream end\n");
-+ return 0;
-+}
-+
-+int voice_buffer_rtp_test_start(int fs)
-+{
-+ return voice_buffer_stream_test_start(fs);
-+}
-+
-+
-+
-+int voice_buffer_rtp_test_stop(void)
-+{
-+ return voice_buffer_stream_test_stop();
-+}
-+
-+void voice_buffer_cmd_proc(char *cmdstr)
-+{
-+ int ret = 0;
-+ char data[VOICE_CMD_MAX_LEN];
-+ int cmdstr_len = strlen(cmdstr) -1; //-strlen("\r")
-+ int value = 0;
-+ int *p_value = &value;
-+
-+ cmdstr[cmdstr_len] = '\0'; //+strlen("\0")
-+
-+ ret = sscanf(cmdstr, "%s", data);
-+ if(1 != ret){
-+ printf("data sscanf failed!(%d)\n", ret);
-+ return;
-+ }
-+ if(0 == strncmp(data, REQ_VOICE_BUFFER_TEST_START, strlen(REQ_VOICE_BUFFER_TEST_START))){
-+
-+ ret = sscanf(cmdstr, "%*s %d", &value);
-+ if(1 != ret){
-+ printf("%s,value sscanf failed!(%d)\n",data, ret);
-+ return;
-+ }
-+
-+ printf("%s set value %d\n", data, value);
-+ ret = voice_buffer_stream_test_start(value);
-+
-+ printf("%s return ret=%d\n", data, ret);
-+
-+ }
-+ else if(0 == strncmp(data, REQ_VOICE_BUFFER_TEST_STOP, strlen(REQ_VOICE_BUFFER_TEST_STOP))){
-+ ret = voice_buffer_stream_test_stop();
-+ printf("%s return %d\n", data, ret);
-+ }
-+ else if(0 == strncmp(data, REQ_VOICE_BUFFER_LOOP_TEST_START, strlen(REQ_VOICE_BUFFER_LOOP_TEST_START))){
-+
-+ ret = sscanf(cmdstr, "%*s %d", &value);
-+ if(1 != ret){
-+ printf("%s,value sscanf failed!(%d)\n",data, ret);
-+ return;
-+ }
-+
-+ printf("%s set value %d\n", data, value);
-+ ret = voice_buffer_stream_loop_test_start(value);
-+
-+ printf("%s return ret=%d\n", data, ret);
-+
-+ }
-+ else if(0 == strncmp(data, REQ_VOICE_BUFFER_LOOP_TEST_STOP, strlen(REQ_VOICE_BUFFER_LOOP_TEST_STOP))){
-+ printf("voice_buffer_stream_loop_test_stop \n");
-+ ret = voice_buffer_stream_loop_test_stop();
-+ printf("%s return %d\n", data, ret);
-+ }
-+ if(0 == strncmp(data, REQ_VOICE_BUFFER_RTP_TEST_START, strlen(REQ_VOICE_BUFFER_RTP_TEST_START))){
-+
-+ ret = sscanf(cmdstr, "%*s %d", &value);
-+ if(1 != ret){
-+ printf("%s,value sscanf failed!(%d)\n",data, ret);
-+ return;
-+ }
-+
-+ printf("%s set value %d\n", data, value);
-+ ret = voice_buffer_rtp_test_start(value);
-+
-+ printf("%s return ret=%d\n", data, ret);
-+
-+ }
-+ else if(0 == strncmp(data, REQ_VOICE_BUFFER_RTP_TEST_STOP, strlen(REQ_VOICE_BUFFER_RTP_TEST_STOP))){
-+ ret = voice_buffer_rtp_test_stop();
-+ printf("%s return %d\n", data, ret);
-+ }
-+ else{
-+ printf("Request unknow.\n");
-+ printUsage(cmdstr);
-+ }
-+}
-+
-+void signal_handle_func(int sig)
-+{
-+ printf("sig(%d) signal_handle_func exit ",sig);
-+ exit(0);
-+}
-+
-+void signal_handle_func_term(int sig)
-+{
-+ printf("sig(%d) signal_handle_func exit ",sig);
-+ voice_buffer_stream_loop_test_stop();
-+ voice_buffer_stream_test_stop();
-+ voice_buffer_rtp_test_stop();
-+ exit(0);
-+}
-+
-+
-+int main(int argc, char **argv)
-+{
-+ char cmdstr[VOICE_CMD_MAX_LEN];
-+ printf("voice_demo start\n");
-+
-+ signal(SIGINT, signal_handle_func);
-+ signal(SIGQUIT, signal_handle_func);
-+ signal(SIGTERM, signal_handle_func_term);
-+ signal(SIGPIPE, signal_handle_func);
-+
-+ memset(&vbuf_rec,0,sizeof(vbuf_rec));
-+
-+ while(1){
-+ memset(cmdstr, 0, VOICE_CMD_MAX_LEN);
-+
-+ printf("Please input an voice_demo command:\n");
-+
-+ if(NULL != fgets(cmdstr, VOICE_CMD_MAX_LEN - 1, stdin)){
-+ if(0 == strcmp(EXIT_CMD_STOP, cmdstr) ||
-+ 0 == strcmp(EXIT_CMD_Q, cmdstr) ||
-+ 0 == strcmp(EXIT_CMD_EXIT, cmdstr)){
-+ break;
-+ }
-+
-+ printf("len:%d, cmdstr:%s\n", strlen(cmdstr), cmdstr);
-+
-+ if(1 >= strlen(cmdstr)){
-+ continue;
-+ }
-+
-+ voice_buffer_cmd_proc(cmdstr);
-+ }
-+ }
-+
-+ printf("voice_demo end\n");
-+
-+ return 0;
-+}
-+
++#include <stdio.h>
++#include <unistd.h>
++#include <string.h>
++#include <stdlib.h>
++#include <stdint.h>
++#include <sys/ioctl.h>
++#include <fcntl.h>
++//#include "voice_ipc.h"
++
++#define _USE_VOICE_BUFFER
++#include "voice_lib.h"
++#include <fcntl.h>
++#include <signal.h>
++#include <semaphore.h>
++#include <sys/types.h>
++#include <pthread.h>
++
++/*command max len*/
++#define VOICE_CMD_MAX_LEN 64
++
++#define EXIT_CMD_STOP "stop\n"
++#define EXIT_CMD_Q "q\n"
++#define EXIT_CMD_EXIT "exit\n"
++
++#define REQ_VOICE_BUFFER_TEST_START "voice_buffer_test_start"
++#define REQ_VOICE_BUFFER_TEST_STOP "voice_buffer_test_stop"
++#define REQ_VOICE_BUFFER_LOOP_TEST_START "voice_buffer_loop_test_start"
++#define REQ_VOICE_BUFFER_LOOP_TEST_STOP "voice_buffer_loop_test_stop"
++#define REQ_VOICE_BUFFER_RTP_TEST_START "voice_buffer_rtp_test_start"
++#define REQ_VOICE_BUFFER_RTP_TEST_STOP "voice_buffer_rtp_test_stop"
++
++
++
++#define VBUFFER_TX_FILE_NAME "/mnt/userdata/tx.pcm"
++#define VBUFFER_RX_FILE_NAME "/mnt/userdata/rx.pcm"
++#define VBUFFER_TX16_FILE_NAME "/mnt/userdata/tx16.pcm"
++#define VBUFFER_RX16_FILE_NAME "/mnt/userdata/rx16.pcm"
++
++
++
++#define VB_MAX_INT 0x7fffffff
++#define VB_MIN_INT 0
++#define VB_INT_OVERFLOW(x) if((x < VB_MIN_INT)||(x > VB_MAX_INT)) x = 0;
++
++#define RX_FILE_LEN_MAX 0x100000
++
++
++
++typedef int (vb_thread_proc)(void*);
++struct vbuf_info_t
++{
++ int fd;
++ pthread_t rx_test_thread;
++ pthread_t tx_test_thread;
++ pthread_t loop_test_thread;
++ int quit;
++ char *tx_buf;
++ char *rx_buf;
++ int buf_size;
++ char *tx_filename;
++ char *rx_filename;
++ FILE *tx_file;
++ FILE *rx_file;
++ int tx_filesize;
++ int rx_filesize;
++ int fs;
++};
++
++static struct vbuf_info_t vbuf_rec;
++
++static void printUsage(const char *Opt)
++{
++ printf("Usage: %s\n", Opt);
++
++ printf("voice_buffer_test_start value: 8000,16000\n");
++ printf("voice_buffer_test_stop no value input\n");
++ printf("voice_buffer_loop_test_start value: 8000,16000\n");
++ printf("voice_buffer_loop_test_stop no value input\n");
++ printf("\n");
++}
++
++static int vbuffer_start_flag = 0;
++static int tx_optcount = 0;
++static int rx_optcount = 0;
++static int first_rderr_flag = 0;
++static int first_wrerr_flag = 0;
++
++
++
++//whole rx path
++static int vb_rx_test_thread_func(void *arg)
++{
++ int ret;
++
++ char* buf = vbuf_rec.rx_buf;
++ int size = vbuf_rec.buf_size;
++ int bytes_read = 0;
++ int r_size;
++
++
++ printf( "%s: start size=%d! \n",__func__,size);
++ memset (buf,0, size);
++
++ while (!vbuf_rec.quit)
++ {
++ rx_optcount ++;
++ VB_INT_OVERFLOW(rx_optcount);
++ if((rx_optcount%1000) == 0){
++ printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);
++
++ }
++ else if(rx_optcount == 1000000){
++ printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);
++ rx_optcount = 0;
++
++ }
++
++ //read form ps
++ r_size = voice_buffer_read(vbuf_rec.fd, buf, size);
++ if(r_size <= 0)
++ {
++ first_rderr_flag++;
++ VB_INT_OVERFLOW(first_rderr_flag);
++ continue ;
++ }
++ else{
++ first_rderr_flag = 0;
++
++ }
++
++ if(vbuf_rec.rx_file != NULL)
++ {
++ r_size = fwrite(buf, 1,size, vbuf_rec.rx_file);
++
++ if (r_size != size) {
++ //printf("Error fwrite size not eq,r_size=%d,size=%d\n",r_size,size);
++ }
++ else{
++
++ bytes_read += size;
++ if(bytes_read >= vbuf_rec.rx_filesize){
++ fseek(vbuf_rec.rx_file, 0, SEEK_SET);
++ bytes_read = 0;
++ printf("fwrite over write maxsize(%d)!!!\n",vbuf_rec.rx_filesize);
++
++ }
++ }
++ }
++
++
++ }
++
++ return 0;
++}
++
++static int vb_tx_test_thread_func(void *arg)
++{
++ int ret;
++ int num_read;
++
++
++ char* buf = vbuf_rec.tx_buf;
++
++ int size = vbuf_rec.buf_size;
++ int w_size;
++
++ printf("%s: start size=%d! \n",__func__,size);
++
++
++ memset(buf, 0,size);
++ while (!vbuf_rec.quit)
++ {
++
++ if(vbuf_rec.tx_file != NULL)
++ {
++
++ num_read = fread(buf,1,size, vbuf_rec.tx_file);
++
++ if (num_read != size) {
++ //printf("Error fread size not eq,num_read=%d,size=%d\n",num_read,size);
++ }
++ if (num_read <= 0) {
++ printf("Error fread size not eq,num_read=%d,size=%d\n",num_read,size);
++ fseek(vbuf_rec.tx_file, 0, SEEK_SET);
++ }
++ }
++ tx_optcount ++;
++ VB_INT_OVERFLOW(tx_optcount);
++
++ w_size = voice_buffer_write(vbuf_rec.fd, buf, size);
++ if(w_size <= 0)
++ {
++ first_wrerr_flag++;
++
++ VB_INT_OVERFLOW(first_wrerr_flag);
++
++ continue;
++ }
++ else{
++ first_wrerr_flag = 0;
++
++ }
++
++ }
++ return 0;
++}
++
++
++static int vb_thread_create( const char *name,pthread_t *thread_t, vb_thread_proc *proc,
++ int stack_size, unsigned priority,void *arg )
++{
++ pthread_attr_t thread_attr;
++ int ret;
++ int default_size;
++
++ struct sched_param param;
++ int policy = SCHED_FIFO;
++
++ printf("%s: start! \n",__func__);
++
++ /* Init thread attributes */
++ pthread_attr_init(&thread_attr);
++ /* Create the thread. */
++
++ ret = pthread_create( thread_t, &thread_attr,proc, arg);
++ if (ret != 0)
++ {
++ printf("%s: pthread_create fail,ret=%d! \n",__func__,ret);
++
++ pthread_attr_destroy(&thread_attr);
++ return ret;
++ }
++
++ pthread_attr_getstacksize(&thread_attr, &default_size);
++ printf("%s: pthread_attr_getstacksize(%d)! \n",__func__,default_size);
++
++ pthread_attr_destroy(&thread_attr);
++
++ printf("%s: end \n",__func__);
++ return 0;
++}
++
++
++int voice_buffer_stream_test_start(int fs)
++{
++ int ret = 0;
++ int buf_size = 320;
++ tx_optcount = 0;
++ rx_optcount = 0;
++ int* buf_int;
++
++ int i;
++
++ if(vbuffer_start_flag == 1){
++ printf(" VB already start,return \n");
++
++ return 0;
++ }
++
++ vbuffer_start_flag = 1;
++
++
++
++ if((vbuf_rec.fd != -1)&&(vbuf_rec.fd != 0)){
++ printf(" VB fd already get, vbuf_rec.fd=%d return \n",vbuf_rec.fd);
++ }
++
++ if(fs == 8000){
++
++ buf_size = 320;
++ }
++ else if(fs == 16000){
++
++ buf_size = 640;
++ }
++ else
++ {
++ buf_size = 320;
++ }
++ printf("Starting vb stream fs=%d buf_size=%d \n",fs,buf_size);
++
++ printf("%s:open tx and rx file \n",__func__);
++ if(fs == 8000){
++
++ vbuf_rec.tx_filename = VBUFFER_TX_FILE_NAME;//"/cache/tx.pcm";
++ vbuf_rec.rx_filename = VBUFFER_RX_FILE_NAME;//"/cache/rx.pcm";
++
++ }
++ else if(fs == 16000){
++
++ vbuf_rec.tx_filename = VBUFFER_TX16_FILE_NAME;//"/cache/tx16.pcm";
++ vbuf_rec.rx_filename = VBUFFER_RX16_FILE_NAME;//"/cache/rx16.pcm";
++
++ }
++ else
++ {
++ vbuf_rec.tx_filename = VBUFFER_TX_FILE_NAME;//"/cache/tx.pcm";
++ vbuf_rec.rx_filename = VBUFFER_RX_FILE_NAME;//"/cache/rx.pcm";
++
++ }
++
++
++
++
++ vbuf_rec.tx_file = fopen(vbuf_rec.tx_filename , "rb");
++ if (!vbuf_rec.tx_file) {
++ printf("Unable to open file '%s'\n", vbuf_rec.tx_filename);
++ //return -1;
++ }
++
++
++ vbuf_rec.rx_file = fopen(vbuf_rec.rx_filename, "wb");
++ if (!vbuf_rec.rx_file) {
++ printf(stderr, "Unable to create file '%s'\n", vbuf_rec.rx_filename);
++ //fclose(vbuf_rec.tx_file);
++
++ //return -1;
++ }
++ vbuf_rec.rx_filesize = RX_FILE_LEN_MAX;
++ printf("%s : vbuf_rec.rx_filesize(%d) \n",__func__,vbuf_rec.rx_filesize);
++
++ vbuf_rec.rx_buf = (char*) malloc(buf_size);
++ if(!vbuf_rec.rx_buf) {
++ printf("%s : malloc buf fail,return \n",__func__);
++ goto err;
++ }
++ vbuf_rec.tx_buf = (char*) malloc(buf_size);
++ if(!vbuf_rec.tx_buf) {
++ free(vbuf_rec.rx_buf);
++ printf("%s : malloc buf fail,return \n",__func__);
++ vbuf_rec.rx_buf = NULL;
++ goto err;
++ }
++ vbuf_rec.buf_size = buf_size;
++
++ vbuf_rec.quit = 0;
++
++ printf("%s : vb open start \n",__func__);
++
++
++ vbuf_rec.fd = voice_buffer_open();
++ if(vbuf_rec.fd <= 0){
++ printf("%s : vb open fail fd=%d,return \n",__func__,vbuf_rec.fd);
++ ret = -1;
++ goto err;
++
++ }
++ printf("%s :voice_buffer_open end \n",__func__);
++
++ printf("%s :rx tx vb_thread_create start \n",__func__);
++ ret = vb_thread_create ("vb_playback_test",&vbuf_rec.rx_test_thread, vb_rx_test_thread_func,
++ 4*1024,35,NULL);
++ if (ret != 0)
++ {
++ printf("%s :rx vb_thread_create fail ret=%d,return \n",__func__,ret);
++ goto err;
++ }
++
++ printf("%s :rx vb_thread_create end \n",__func__);
++
++ ret = vb_thread_create ( "vbuf_record_test", &vbuf_rec.tx_test_thread, vb_tx_test_thread_func,
++ 4*1024,35,NULL);
++ if (ret != 0)
++ {
++
++ printf("%s :tx vb_thread_create fail ret=%d,return \n",__func__,ret);
++ vbuf_rec.quit = 1;
++ pthread_join(vbuf_rec.rx_test_thread,NULL);
++ vbuf_rec.rx_test_thread = NULL;
++ goto err;
++ }
++ printf("%s :tx vb_thread_create end \n",__func__);
++
++ return 0;
++
++err:
++ free(vbuf_rec.rx_buf);
++ vbuf_rec.rx_buf = NULL;
++ free(vbuf_rec.tx_buf);
++ vbuf_rec.tx_buf = NULL;
++
++ fclose(vbuf_rec.tx_file);
++ vbuf_rec.tx_file = NULL;
++ fclose(vbuf_rec.rx_file);
++ vbuf_rec.rx_file = NULL;
++
++ return ret;
++}
++
++
++//Stop stream
++int voice_buffer_stream_test_stop(void)
++{
++ int ret = 0;
++ printf("%s:rx tx thread exit start \n",__func__);
++ if(vbuf_rec.quit == 1) {
++ printf("%s,already stop ,return\n",__func__);
++
++ }
++
++ vbuf_rec.quit = 1;
++ voice_buffer_stop(vbuf_rec.fd);
++ if (vbuf_rec.tx_test_thread)
++ {
++ pthread_join (vbuf_rec.tx_test_thread,NULL);
++ vbuf_rec.tx_test_thread = NULL;
++
++ }
++
++ if (vbuf_rec.rx_test_thread)
++ {
++ pthread_join (vbuf_rec.rx_test_thread,NULL);
++ vbuf_rec.rx_test_thread = NULL;
++ }
++
++ printf("voice_buffer_close start \n");
++ ret = voice_buffer_close(vbuf_rec.fd);
++ if(ret != 0)
++ {
++ printf("%s : vb close fail \n",__func__);
++ }
++ vbuf_rec.fd = -1;
++
++ if(vbuf_rec.tx_file != NULL)
++ {
++ fclose(vbuf_rec.tx_file);
++ printf("%s : vb close ,close tx file \n",__func__);
++ vbuf_rec.tx_file = NULL;
++ }
++
++ if(vbuf_rec.rx_file != NULL)
++ {
++
++ fclose(vbuf_rec.rx_file);
++ printf("%s : vb close ,close rx file \n",__func__);
++ vbuf_rec.rx_file = NULL;
++
++ }
++
++ free(vbuf_rec.rx_buf);
++ vbuf_rec.rx_buf = NULL;
++
++ free(vbuf_rec.tx_buf);
++ vbuf_rec.tx_buf = NULL;
++
++
++ vbuffer_start_flag = 0;
++ printf("Stopping vb stream end\n");
++ return 0;
++}
++
++
++static int vb_loop_test_thread_func(void *arg)
++{
++ int ret;
++
++ char* buf = vbuf_rec.rx_buf;
++ int size = vbuf_rec.buf_size;
++
++ //char* buf = vbuf_rec.tx_buf;
++
++ //int size = vbuf_rec.buf_size;
++ int w_size;
++ int r_size;
++
++
++ printf( "%s: start size=%d! \n",__func__,size);
++ memset (buf,0, size);
++
++ while (!vbuf_rec.quit)
++ {
++ rx_optcount ++;
++ VB_INT_OVERFLOW(rx_optcount);
++ if((rx_optcount%1000) == 0){
++ printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);
++
++ }
++ else if(rx_optcount == 1000000){
++ printf("%s: rx_optcount=%d! \n",__func__,rx_optcount);
++ rx_optcount = 0;
++
++ }
++
++ //read form ps
++ r_size = voice_buffer_read(vbuf_rec.fd, vbuf_rec.rx_buf, size);
++ if(r_size <= 0)
++ {
++ first_rderr_flag++;
++ VB_INT_OVERFLOW(first_rderr_flag);
++ continue ;
++ }
++ else{
++ first_rderr_flag = 0;
++ }
++ memcpy(vbuf_rec.tx_buf,vbuf_rec.rx_buf,size);
++ w_size = voice_buffer_write(vbuf_rec.fd, vbuf_rec.tx_buf, size);
++ if(w_size <= 0)
++ {
++ first_wrerr_flag++;
++
++ VB_INT_OVERFLOW(first_wrerr_flag);
++
++ continue;
++ }
++ else{
++ first_wrerr_flag = 0;
++ }
++
++ }
++
++ return 0;
++}
++
++
++int voice_buffer_stream_loop_test_start(int fs)
++{
++ int ret = 0;
++ int buf_size = 320;
++ tx_optcount = 0;
++ rx_optcount = 0;
++ int* buf_int;
++
++ int i;
++
++ if(vbuffer_start_flag == 1){
++ printf(" VB already start,return \n");
++
++ return 0;
++ }
++
++ if((vbuf_rec.fd != -1)&&(vbuf_rec.fd != 0)){
++ printf(" VB fd already get, vbuf_rec.fd=%d return \n",vbuf_rec.fd);
++ }
++
++ vbuffer_start_flag = 1;
++
++ if(fs == 8000){
++
++ buf_size = 320;
++ }
++ else if(fs == 16000){
++
++ buf_size = 640;
++ }
++ else
++ {
++ buf_size = 320;
++ }
++ printf("Starting vb stream fs=%d buf_size=%d \n",fs,buf_size);
++
++ vbuf_rec.rx_buf = (char*) malloc(buf_size);
++ if(!vbuf_rec.rx_buf) {
++ printf("%s : malloc buf fail,return \n",__func__);
++ return -1;
++ }
++ vbuf_rec.tx_buf = (char*) malloc(buf_size);
++ if(!vbuf_rec.tx_buf) {
++ free(vbuf_rec.rx_buf);
++ printf("%s : malloc buf fail,return \n",__func__);
++ vbuf_rec.rx_buf = NULL;
++ return -1;
++ }
++ vbuf_rec.buf_size = buf_size;
++
++ vbuf_rec.quit = 0;
++
++ printf("%s : vb open start \n",__func__);
++
++
++ vbuf_rec.fd = voice_buffer_open();
++ if(vbuf_rec.fd <= 0){
++ printf("%s : vb open fail fd=%d,return \n",__func__,vbuf_rec.fd);
++ ret = -1;
++ goto err;
++
++ }
++ printf("%s :loop vb_thread_create start \n",__func__);
++ ret = vb_thread_create ("vb_playback_test",&vbuf_rec.loop_test_thread, vb_loop_test_thread_func,
++ 4*1024,35,NULL);
++ if (ret != 0)
++ {
++ printf("%s :rx vb_thread_create fail ret=%d,return \n",__func__,ret);
++ goto err;
++ }
++
++ printf("%s :rx vb_thread_create end \n",__func__);
++
++ return 0;
++
++err:
++ free(vbuf_rec.rx_buf);
++ vbuf_rec.rx_buf = NULL;
++ free(vbuf_rec.tx_buf);
++ vbuf_rec.tx_buf = NULL;
++
++ return ret;
++}
++
++int voice_buffer_stream_loop_test_stop(void)
++{
++ int ret = 0;
++ printf("%s:loop thread exit start \n",__func__);
++ if(vbuf_rec.quit == 1) {
++ printf("%s,already stop ,return\n",__func__);
++
++ }
++
++ vbuf_rec.quit = 1;
++ voice_buffer_stop(vbuf_rec.fd);
++ if (vbuf_rec.loop_test_thread)
++ {
++ pthread_join (vbuf_rec.loop_test_thread,NULL);
++ vbuf_rec.tx_test_thread = NULL;
++
++ }
++
++ printf("voice_buffer_close start \n");
++ ret = voice_buffer_close(vbuf_rec.fd);
++ if(ret != 0)
++ {
++ printf("%s : vb close fail \n",__func__);
++ }
++ vbuf_rec.fd = -1;
++ free(vbuf_rec.rx_buf);
++ vbuf_rec.rx_buf = NULL;
++
++ free(vbuf_rec.tx_buf);
++ vbuf_rec.tx_buf = NULL;
++
++
++ vbuffer_start_flag = 0;
++ printf("Stopping vb stream end\n");
++ return 0;
++}
++
++int voice_buffer_rtp_test_start(int fs)
++{
++ return voice_buffer_stream_test_start(fs);
++}
++
++
++
++int voice_buffer_rtp_test_stop(void)
++{
++ return voice_buffer_stream_test_stop();
++}
++
++void voice_buffer_cmd_proc(char *cmdstr)
++{
++ int ret = 0;
++ char data[VOICE_CMD_MAX_LEN];
++ int cmdstr_len = strlen(cmdstr) -1; //-strlen("\r")
++ int value = 0;
++ int *p_value = &value;
++
++ cmdstr[cmdstr_len] = '\0'; //+strlen("\0")
++
++ ret = sscanf(cmdstr, "%s", data);
++ if(1 != ret){
++ printf("data sscanf failed!(%d)\n", ret);
++ return;
++ }
++ if(0 == strncmp(data, REQ_VOICE_BUFFER_TEST_START, strlen(REQ_VOICE_BUFFER_TEST_START))){
++
++ ret = sscanf(cmdstr, "%*s %d", &value);
++ if(1 != ret){
++ printf("%s,value sscanf failed!(%d)\n",data, ret);
++ return;
++ }
++
++ printf("%s set value %d\n", data, value);
++ ret = voice_buffer_stream_test_start(value);
++
++ printf("%s return ret=%d\n", data, ret);
++
++ }
++ else if(0 == strncmp(data, REQ_VOICE_BUFFER_TEST_STOP, strlen(REQ_VOICE_BUFFER_TEST_STOP))){
++ ret = voice_buffer_stream_test_stop();
++ printf("%s return %d\n", data, ret);
++ }
++ else if(0 == strncmp(data, REQ_VOICE_BUFFER_LOOP_TEST_START, strlen(REQ_VOICE_BUFFER_LOOP_TEST_START))){
++
++ ret = sscanf(cmdstr, "%*s %d", &value);
++ if(1 != ret){
++ printf("%s,value sscanf failed!(%d)\n",data, ret);
++ return;
++ }
++
++ printf("%s set value %d\n", data, value);
++ ret = voice_buffer_stream_loop_test_start(value);
++
++ printf("%s return ret=%d\n", data, ret);
++
++ }
++ else if(0 == strncmp(data, REQ_VOICE_BUFFER_LOOP_TEST_STOP, strlen(REQ_VOICE_BUFFER_LOOP_TEST_STOP))){
++ printf("voice_buffer_stream_loop_test_stop \n");
++ ret = voice_buffer_stream_loop_test_stop();
++ printf("%s return %d\n", data, ret);
++ }
++ if(0 == strncmp(data, REQ_VOICE_BUFFER_RTP_TEST_START, strlen(REQ_VOICE_BUFFER_RTP_TEST_START))){
++
++ ret = sscanf(cmdstr, "%*s %d", &value);
++ if(1 != ret){
++ printf("%s,value sscanf failed!(%d)\n",data, ret);
++ return;
++ }
++
++ printf("%s set value %d\n", data, value);
++ ret = voice_buffer_rtp_test_start(value);
++
++ printf("%s return ret=%d\n", data, ret);
++
++ }
++ else if(0 == strncmp(data, REQ_VOICE_BUFFER_RTP_TEST_STOP, strlen(REQ_VOICE_BUFFER_RTP_TEST_STOP))){
++ ret = voice_buffer_rtp_test_stop();
++ printf("%s return %d\n", data, ret);
++ }
++ else{
++ printf("Request unknow.\n");
++ printUsage(cmdstr);
++ }
++}
++
++void signal_handle_func(int sig)
++{
++ printf("sig(%d) signal_handle_func exit ",sig);
++ exit(0);
++}
++
++void signal_handle_func_term(int sig)
++{
++ printf("sig(%d) signal_handle_func exit ",sig);
++ voice_buffer_stream_loop_test_stop();
++ voice_buffer_stream_test_stop();
++ voice_buffer_rtp_test_stop();
++ exit(0);
++}
++
++
++int main(int argc, char **argv)
++{
++ char cmdstr[VOICE_CMD_MAX_LEN];
++ printf("voice_demo start\n");
++
++ signal(SIGINT, signal_handle_func);
++ signal(SIGQUIT, signal_handle_func);
++ signal(SIGTERM, signal_handle_func_term);
++ signal(SIGPIPE, signal_handle_func);
++
++ memset(&vbuf_rec,0,sizeof(vbuf_rec));
++
++ while(1){
++ memset(cmdstr, 0, VOICE_CMD_MAX_LEN);
++
++ printf("Please input an voice_demo command:\n");
++
++ if(NULL != fgets(cmdstr, VOICE_CMD_MAX_LEN - 1, stdin)){
++ if(0 == strcmp(EXIT_CMD_STOP, cmdstr) ||
++ 0 == strcmp(EXIT_CMD_Q, cmdstr) ||
++ 0 == strcmp(EXIT_CMD_EXIT, cmdstr)){
++ break;
++ }
++
++ printf("len:%d, cmdstr:%s\n", strlen(cmdstr), cmdstr);
++
++ if(1 >= strlen(cmdstr)){
++ continue;
++ }
++
++ voice_buffer_cmd_proc(cmdstr);
++ }
++ }
++
++ printf("voice_demo end\n");
++
++ return 0;
++}
++
diff --git a/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/makefile b/esdk/layers/meta-zxic-custom/recipes-lynq/lynq-vb-demo/files/makefile
new file mode 100755
index 0000000..6a6f960
@@ -1157,15 +1131,15 @@
--- a/upstream/pub/project/zx297520v3/include/drv/NvParam_drv.h
+++ b/upstream/pub/project/zx297520v3/include/drv/NvParam_drv.h
@@ -214,8 +214,10 @@ typedef struct _T_Audio_NvFlag
- UINT8 isUseTxDtmfDet;
- UINT8 isUseRxMixData;
- UINT8 isUseTxMixData;//12
-- UINT8 isUseEcall;
-- UINT8 reserved[19];//32-13
-+ UINT8 isUseEcall; //13
-+ UINT8 isUseVoiceBuffer; //14 0 not use,1 use
-+ UINT8 selVoiceBufferType; //15 0 single core, 1 dual core
-+ UINT8 reserved[17];//32-15
-
- } T_Audio_NvFlag;
-
+ UINT8 isUseTxDtmfDet;
+ UINT8 isUseRxMixData;
+ UINT8 isUseTxMixData;//12
+- UINT8 isUseEcall;
+- UINT8 reserved[19];//32-13
++ UINT8 isUseEcall; //13
++ UINT8 isUseVoiceBuffer; //14 0 not use,1 use
++ UINT8 selVoiceBufferType; //15 0 single core, 1 dual core
++ UINT8 reserved[17];//32-15
+
+ } T_Audio_NvFlag;
+
diff --git a/patch/15.11_15.11_rtp/code/new/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf b/patch/15.11_15.11_rtp/code/new/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
index 949c173..c1ff236 100755
--- a/patch/15.11_15.11_rtp/code/new/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
+++ b/patch/15.11_15.11_rtp/code/new/esdk/layers/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
@@ -317,13 +317,11 @@
lynq-wifi-demo \
lynq-adc-demo \
lynq-at-test \
- lynq-vb-demo \
lynq-monitor-demo \
"
zxic_app_open += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', 'rild', '', d)}"
zxic_app_open += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'BL', 'tel-svr', '', d)}"
-zxic_app_open += "${@bb.utils.contains('CONFIG_VB_TRANSMIT_INTF', 'NULL', 'vb-demo', '', d)}"
#开源应用及库
meta_app_open += "\
diff --git a/patch/15.11_15.11_rtp/code/new/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb b/patch/15.11_15.11_rtp/code/new/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb
deleted file mode 100755
index f15ad14..0000000
--- a/patch/15.11_15.11_rtp/code/new/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb
+++ /dev/null
@@ -1,273 +0,0 @@
-SUMMARY = "zxic normal image"
-IMAGE_LINGUAS = " "
-LICENSE = "zte"
-PV = "1.0.0"
-PR = "r0"
-
-inherit core-image extrausers ${@bb.utils.contains("DISTRO_FEATURES", "selinux", "selinux-image", "", d)}
-
-OPENWRT_FULL ="\
- packagegroup-openwrt-minimal \
- packagegroup-openwrt-base \
- packagegroup-openwrt-full \
- ugps \
- usbmode \
- urngd \
- mtd-utils-ubifs \
- fwtool \
- usign \
- swconfig \
- mtd-openwrt \
- opkg \
- cgi-io \
- "
-OPENWRT_RECOVERY ="\
- packagegroup-openwrt-minimal \
- mtd-utils-ubifs \
- mtd-openwrt \
- "
-
-
-OPENWRT_PACKAGE = "${@bb.utils.contains("BOOT_CTL", "recovery", "${OPENWRT_RECOVERY}", "${OPENWRT_FULL}", d)}"
-IS_OPENWRT = "${@bb.utils.contains('DISTRO_FEATURES', 'OPENWRT', 'true', 'false', d)}"
-ROOT_FS_NAME = "${@bb.utils.contains("BOOT_CTL", "recovery", "ap_recoveryfs.bin", "ap_caprootfs.img", d)}"
-USEDATA_FS_NAME = "${@bb.utils.contains("BOOT_CTL", "recovery", "ap_userdata_recovery.bin", "ap_capuserdata.img", d)}"
-OEMDATA_FS_NAME = "${@bb.utils.contains("BOOT_CTL", "recovery", "ap_oemdata_recovery.bin", "cap_oemdata.img", d)}"
-
-CORE_IMAGE_BASE_INSTALL = '\
- ${@bb.utils.contains("DISTRO_FEATURES", "OPENWRT", "${OPENWRT_PACKAGE}", "", d)} \
- packagegroup-core-boot-zxic \
- packagegroup-lynq-t106 \
- ${@bb.utils.contains("DISTRO_FEATURES", "selinux", "packagegroup-selinux-minimal", "", d)} \
- ${MACHINE_EXTRA_RDEPENDS} \
- ${CORE_IMAGE_EXTRA_INSTALL} \
- '
-
-# Include modules in rootfs
-IMAGE_INSTALL += "${CORE_IMAGE_BASE_INSTALL}"
-
-IMAGE_INSTALL += " \
- kernel-modules \
- ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'dpkg-start-stop', '', d)} \
- "
-
-#pub include
-include ${BSPDIR}/sources/meta-zxic/conf/pub.inc
-
-DEPENDS += "\
- u-boot-tools-native rsync-native \
- ${@bb.utils.contains("USERDATA_FSTYPE", "ubi", "mtd-utils-native", "", d)} \
- ${@bb.utils.contains('IMAGE_FSTYPES', 'squashfs', 'squashfskit-native', '', d)} \
- ${@bb.utils.contains('DISTRO_FEATURES','dm-verity','cryptsetup-native','',d)} \
- ${@bb.utils.contains('DISTRO_FEATURES','dm-verity','coreutils-native','',d)} \
- "
-
-# Add \ in front of $
-ROOT_PASSWD = "\$6\$GnJN6BAFj7TmbOS\$o4tptoaFJYZe79CWh2VzAgGhQGqfDHoraVUs0nr4TT2e9V2ubq.l.nLrF80ECrtfvPrJDL1J3fbR62nei9A3F1"
-#EXTRA_USERS_PARAMS += "usermod -p '${ROOT_PASSWD}' root;"
-EXTRA_USERS_PARAMS += "${@bb.utils.contains("DISTRO_FEATURES", "OPENWRT", "usermod -p '${ROOT_PASSWD}' root;", "", d)}"
-
-fakeroot distro_rootfs_files_systemd() {
- rm -rf ${IMAGE_ROOTFS}/boot
- cp -arfp ${FS-DIR}/fs/${BOOT_CTL}/rootfs/* ${IMAGE_ROOTFS}/
-}
-
-fakeroot distro_rootfs_files_fpga() {
- rm -rf ${IMAGE_ROOTFS}/boot
- rm -rf ${IMAGE_ROOTFS}/linuxrc
- rm -rf ${IMAGE_ROOTFS}/etc/systemd/system.conf
- cp -arfp ${FS-DIR}/fs/${BOOT_CTL}/rootfs/* ${IMAGE_ROOTFS}/
- chmod 644 ${IMAGE_ROOTFS}/etc/passwd
- chmod 644 ${IMAGE_ROOTFS}/etc/group
- chmod 644 ${IMAGE_ROOTFS}/etc/inittab
- chmod 400 ${IMAGE_ROOTFS}/etc/shadow
- chmod a+x ${IMAGE_ROOTFS}/etc/init.d/rcS
- chmod a+r ${IMAGE_ROOTFS}/etc/init.d/rcS
-}
-
-fakeroot distro_rootfs_files_sysvinit() {
- rm -rf ${IMAGE_ROOTFS}/boot
- cp -arfp ${FS-DIR}/fs/${BOOT_CTL}/rootfs/* ${IMAGE_ROOTFS}/
-
- rm -rf ${IMAGE_ROOTFS}/etc/rc[0-6].d
- rm -f ${IMAGE_ROOTFS}/etc/fstab
- rm -f ${IMAGE_ROOTFS}/etc/default/rcS
- chmod 644 ${IMAGE_ROOTFS}/etc/passwd
- chmod 644 ${IMAGE_ROOTFS}/etc/group
- chmod 644 ${IMAGE_ROOTFS}/etc/inittab
- chmod 400 ${IMAGE_ROOTFS}/etc/shadow
- chmod a+x ${IMAGE_ROOTFS}/etc/init.d/rcS
- find ${IMAGE_ROOTFS}/ -name '.gitkeep' -print0 | xargs -0 rm -fr
-}
-
-ROOTFS_POSTPROCESS_COMMAND += "\
- ${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "distro_rootfs_files_sysvinit;", "", d)} \
- ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "distro_rootfs_files_systemd;", "", d)} \
- "
-
-fakeroot do_cprootfs() {
- #rm -fv ${BINS-PATH}/${ROOT_FS_NAME}
- mkdir -p ${BINS-PATH} ${ELFS-PATH}
-
- if [ ${IMAGE_FSTYPES} = 'cpio.gz' ]; then
- cd ${IMAGE_ROOTFS} && find . | cpio -o -H newc | gzip -9 > ${IMAGE_ROOTFS}/ramdisk.image.gz
- mv ${IMAGE_ROOTFS}/ramdisk.image.gz ${BINS-PATH}/${ROOT_FS_NAME}
- if [ -d "${TMPDIR}/work/zx298501-zxic-linux-musl/linux-zxic/5.4.154-r0" ]; then
- cp -arfp ${THISDIR}/files/Makefile_dtb ${B}/Makefile
- cp -arfp ${THISDIR}/files/fix_rootfs_dts.sh ${B}/
- ${B}/fix_rootfs_dts.sh ${MACHINE}-${DISTRO} ${TMPDIR}/work-shared/zx298501/kernel-source ${BINS-PATH}
- oe_runmake -C ${B} S=${TMPDIR}/work/zx298501-zxic-linux-musl/linux-zxic/5.4.154-r0 BINS-PATH=${ELFS-PATH} DTB=${MACHINE}-${DISTRO}.dtb
- fi
- else
- #cp -v ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${IMAGE_FSTYPES} ${BINS-PATH}/${ROOT_FS_NAME}
- cp -v ${IMGDEPLOYDIR}/rootfs.tgz ${ELFS-PATH}/${ROOT_FS_NAME}.tgz
- fi
-}
-
-fakeroot do_cleanrootfs () {
- rm -fv ${BINS-PATH}/${ROOT_FS_NAME}
- rm -fv ${BINS-PATH}/${USEDATA_FS_NAME}
- rm -fv ${BINS-PATH}/*.img*
-}
-
-do_product_ini() {
- mkdir -p ${BINS-PATH}
- echo "[imagefs]" > ${BINS-PATH}/product.ini
- echo "mkfs_ubifs=${IMAGEFS_MKUBIFS_ARGS}" >> ${BINS-PATH}/product.ini
- echo "ubinize=${IMAGEFS_UBINIZE_ARGS}" >> ${BINS-PATH}/product.ini
-}
-
-do_all_flags_bin() {
- ${BSPDIR}/zxic_code/pub/tools/libflags/flags_tool -f ${BINS-PATH}/all_flags.bin ${FLAGS_ARGS}
-}
-
-fakeroot do_mkubifs(){
- if [ ${BOOT_CTL} = 'normal' ]; then
- cp -arfp ${THISDIR}/files/ubinize-cfg.sh ${B}
- cp -arfp ${BSPDIR}/sources/meta-zxic-custom/conf/distro/include/${USERDATA_UBINIZE_CFG} ${B}
- mkdir -p ${BINS-PATH}
- ${B}/ubinize-cfg.sh "${BINS-PATH}/${USEDATA_FS_NAME}" "${B}/${USERDATA_UBINIZE_CFG}" "${USERDATA_UBINIZE_ARGS}"
- mkdir -p ${IMAGE_ROOTFS}/etc_ro/
- cp -v "${BINS-PATH}/${USEDATA_FS_NAME}" ${IMAGE_ROOTFS}/etc_ro/
- fi
-}
-
-
-fakeroot do_rootfs_squashfs(){
- cp -arfp ${THISDIR}/files/ubinize-static.sh ${B}
- if ${@bb.utils.contains('DISTRO_FEATURES','dm-verity','true','false',d)}; then
- cp -arfp ${THISDIR}/files/squashfs_dm-verity.sh ${B}
- cp -arfp ${THISDIR}/files/zxic_generate_squashfs_verity ${B}
- fi
- if ${@bb.utils.contains('DISTRO_FEATURES','dm-verity','true','false',d)}; then
- touch ${IMAGE_ROOTFS}/etc_ro/dm-verity
- else
- rm -fv ${IMAGE_ROOTFS}/etc_ro/dm-verity
- fi
-
- rm -fv ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs_tmp
- mksquashfs4 ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs_tmp ${ROOTFS_SQUASHFS_ARGS}
- if ${@bb.utils.contains('DISTRO_FEATURES','dm-verity','true','false',d)}; then
- cp ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs_tmp ${S}/${ROOT_FS_NAME}.unsigned
- echo "veritysetup and ubinize in do_dm_verity() later ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}"
- else
- echo "rootfs squashfs need ubinize-image on nand flash"
- ${B}/ubinize-static.sh vol_rootfs "${BINS-PATH}/ap_caprootfs.img" ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs_tmp "${UBINIZE_ARGS}"
- fi
- cd ${IMAGE_ROOTFS}/../ && tar -czvf ${IMGDEPLOYDIR}/rootfs.tgz rootfs
-}
-
-fakeroot do_oemfs_squashfs(){
- cp -arfp ${THISDIR}/files/ubinize-static.sh ${B}
- cp -arfp ${FS-DIR}/fs/normal/oem/ ${S}/
- if ${@bb.utils.contains('DISTRO_FEATURES','dm-verity','true','false',d)}; then
- cp -arfp ${THISDIR}/files/squashfs_dm-verity.sh ${B}
- cp -arfp ${THISDIR}/files/zxic_generate_squashfs_verity ${B}
- fi
-
- rm -fv ${IMGDEPLOYDIR}/oem.squashfs_tmp
- mksquashfs4 ${S}/oem ${IMGDEPLOYDIR}/oem.squashfs_tmp ${ROOTFS_SQUASHFS_ARGS}
- if ${@bb.utils.contains('DISTRO_FEATURES','dm-verity','true','false',d)}; then
- cp ${IMGDEPLOYDIR}/oem.squashfs_tmp ${S}/cap_oem.img.unsigned
- echo "veritysetup and ubinize in do_dm_verity() later"
- else
- echo "oem squashfs need ubinize-image on nand flash"
- ${B}/ubinize-static.sh vol_oem "${BINS-PATH}/cap_oem.img" ${IMGDEPLOYDIR}/oem.squashfs_tmp "${UBINIZE_ARGS}"
- mkdir -p ${ELFS-PATH}
- rm -rf ${IMGDEPLOYDIR}/oem.squashfs_tmp
- fi
- mkdir -p ${ELFS-PATH}
- cd ${S}/oem/../ && tar -czvf ${ELFS-PATH}/oem.tgz oem
-
-}
-
-fakeroot do_oemfs_oemdata(){
- if [ ${BOOT_CTL} = 'normal' ]; then
- cp -arfp ${THISDIR}/files/ubinize-cfg.sh ${B}
- cp -arfp ${BSPDIR}/sources/meta-zxic-custom/conf/distro/include/${OEMDATA_UBINIZE_CFG} ${B}
- mkdir -p ${BINS-PATH}
- ${B}/ubinize-cfg.sh "${BINS-PATH}/${OEMDATA_FS_NAME}" "${B}/${OEMDATA_UBINIZE_CFG}" "${USERDATA_UBINIZE_ARGS}"
- mkdir -p ${IMAGE_ROOTFS}/etc_ro/
- cp -v "${BINS-PATH}/${OEMDATA_FS_NAME}" ${IMAGE_ROOTFS}/etc_ro/
- fi
-}
-
-ROOTFS_POSTPROCESS_COMMAND_remove += 'empty_var_volatile;'
-
-fakeroot do_postinstall(){
- if [ -f ${IMAGE_ROOTFS}/postinstall.sh ]; then
- cd ${IMAGE_ROOTFS} && sh postinstall.sh && rm -v ${IMAGE_ROOTFS}/postinstall.sh
- fi
-}
-
-fakeroot do_ln_musl_ld(){
- if [ ! -L ${IMAGE_ROOTFS}/lib/ld-linux-aarch64.so.1 ]; then
- if [ -L ${IMAGE_ROOTFS}/lib/ld-musl-aarch64.so.1 ]; then
- cd ${IMAGE_ROOTFS}/lib && ln -snf ld-musl-aarch64.so.1 ld-linux-aarch64.so.1
- fi
- fi
-}
-
-do_dm_verity(){
- if ${@bb.utils.contains('DISTRO_FEATURES','dm-verity','true','false',d)}; then
- rm -fv ${BINS-PATH}/ap_caprootfs.dm
- ${S}/squashfs_dm-verity.sh ${S}/${ROOT_FS_NAME}.unsigned ${S} \
- ${BINS-PATH}/ap_caprootfs.img.dm ${SIGNIMAGE_PRIVATE_KEY} ${BSPDIR}/tools/SignTool/SignImage
- ${S}/ubinize-static.sh vol_rootfs "${BINS-PATH}/ap_caprootfs.img" ${BINS-PATH}/ap_caprootfs.img.dm "${UBINIZE_ARGS}"
-
- if ${@bb.utils.contains('DISTRO_FEATURES','oemfs','true','false',d)}; then
- rm -fv ${BINS-PATH}/cap_oem.img.dm
- ${B}/squashfs_dm-verity.sh ${S}/cap_oem.img.unsigned ${B} \
- ${BINS-PATH}/cap_oem.img.dm ${SIGNIMAGE_PRIVATE_KEY} ${BSPDIR}/tools/SignTool/SignImage
- ${B}/ubinize-static.sh vol_oem "${BINS-PATH}/cap_oem.img" ${BINS-PATH}/cap_oem.img.dm "${UBINIZE_ARGS}"
- fi
- fi
-}
-
-IMAGE_POSTPROCESS_COMMAND_prepend = ' \
- do_postinstall; \
- ${@bb.utils.contains("TCLIBC", "musl", "do_ln_musl_ld;", "", d)} \
- ${@bb.utils.contains("DISTRO_FEATURES", "selinux", "selinux_set_labels ;", "", d)} \
- '
-
-IMAGE_POSTPROCESS_COMMAND += "\
- ${@bb.utils.contains("USERDATA_FSTYPE", "ubi", "do_mkubifs;", "", d)} \
- ${@bb.utils.contains("DISTRO_FEATURES", "oemfs", "do_oemfs_squashfs;", "", d)} \
- ${@bb.utils.contains("DISTRO_FEATURES", "oemfs", "do_oemfs_oemdata;", "", d)} \
- ${@bb.utils.contains("IMAGE_FSTYPES", "squashfs", "do_rootfs_squashfs;", "", d)} \
- "
-#xf.li@20240716 add start
-do_oem_config() {
- if [ "${MOBILETEK_LOG_ENCRYPT}" = "enable" ]; then
- touch ${IMAGE_ROOTFS}/etc/syslog_encrypt_flag
- else
- rm -rf ${IMAGE_ROOTFS}/etc/syslog_encrypt_flag
- touch ${IMAGE_ROOTFS}/etc/no_log_encrypt
- fi
-}
-addtask do_oem_config after do_rootfs before do_image
-#xf.li@20240716 add end
-addtask cprootfs after do_dm_verity before do_build
-addtask do_dm_verity after do_image_complete before do_build
-addtask cleanrootfs after do_clean before do_cleansstate
-
diff --git a/patch/15.11_15.11_rtp/code/old/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb b/patch/15.11_15.11_rtp/code/old/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb
deleted file mode 100755
index b86b882..0000000
--- a/patch/15.11_15.11_rtp/code/old/esdk/layers/meta-zxic-custom/recipes-core/images/zxic-image.bb
+++ /dev/null
@@ -1,274 +0,0 @@
-SUMMARY = "zxic normal image"
-IMAGE_LINGUAS = " "
-LICENSE = "zte"
-PV = "1.0.0"
-PR = "r0"
-
-inherit core-image extrausers ${@bb.utils.contains("DISTRO_FEATURES", "selinux", "selinux-image", "", d)}
-
-OPENWRT_FULL ="\
- packagegroup-openwrt-minimal \
- packagegroup-openwrt-base \
- packagegroup-openwrt-full \
- ugps \
- usbmode \
- urngd \
- mtd-utils-ubifs \
- fwtool \
- usign \
- swconfig \
- mtd-openwrt \
- opkg \
- cgi-io \
- "
-OPENWRT_RECOVERY ="\
- packagegroup-openwrt-minimal \
- mtd-utils-ubifs \
- mtd-openwrt \
- "
-
-
-OPENWRT_PACKAGE = "${@bb.utils.contains("BOOT_CTL", "recovery", "${OPENWRT_RECOVERY}", "${OPENWRT_FULL}", d)}"
-IS_OPENWRT = "${@bb.utils.contains('DISTRO_FEATURES', 'OPENWRT', 'true', 'false', d)}"
-ROOT_FS_NAME = "${@bb.utils.contains("BOOT_CTL", "recovery", "ap_recoveryfs.bin", "ap_caprootfs.img", d)}"
-USEDATA_FS_NAME = "${@bb.utils.contains("BOOT_CTL", "recovery", "ap_userdata_recovery.bin", "ap_capuserdata.img", d)}"
-OEMDATA_FS_NAME = "${@bb.utils.contains("BOOT_CTL", "recovery", "ap_oemdata_recovery.bin", "cap_oemdata.img", d)}"
-
-CORE_IMAGE_BASE_INSTALL = '\
- ${@bb.utils.contains("DISTRO_FEATURES", "OPENWRT", "${OPENWRT_PACKAGE}", "", d)} \
- packagegroup-core-boot-zxic \
- packagegroup-lynq-t106 \
- ${@bb.utils.contains("DISTRO_FEATURES", "selinux", "packagegroup-selinux-minimal", "", d)} \
- ${MACHINE_EXTRA_RDEPENDS} \
- ${CORE_IMAGE_EXTRA_INSTALL} \
- '
-
-# Include modules in rootfs
-IMAGE_INSTALL += "${CORE_IMAGE_BASE_INSTALL}"
-
-IMAGE_INSTALL += " \
- kernel-modules \
- ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'dpkg-start-stop', '', d)} \
- "
-
-#pub include
-include ${BSPDIR}/sources/meta-zxic/conf/pub.inc
-
-DEPENDS += "\
- u-boot-tools-native rsync-native \
- ${@bb.utils.contains("USERDATA_FSTYPE", "ubi", "mtd-utils-native", "", d)} \
- ${@bb.utils.contains('IMAGE_FSTYPES', 'squashfs', 'squashfskit-native', '', d)} \
- ${@bb.utils.contains('DISTRO_FEATURES','dm-verity','cryptsetup-native','',d)} \
- ${@bb.utils.contains('DISTRO_FEATURES','dm-verity','coreutils-native','',d)} \
- "
-
-# Add \ in front of $
-ROOT_PASSWD = "\$6\$GnJN6BAFj7TmbOS\$o4tptoaFJYZe79CWh2VzAgGhQGqfDHoraVUs0nr4TT2e9V2ubq.l.nLrF80ECrtfvPrJDL1J3fbR62nei9A3F1"
-#EXTRA_USERS_PARAMS += "usermod -p '${ROOT_PASSWD}' root;"
-EXTRA_USERS_PARAMS += "${@bb.utils.contains("DISTRO_FEATURES", "OPENWRT", "usermod -p '${ROOT_PASSWD}' root;", "", d)}"
-
-fakeroot distro_rootfs_files_systemd() {
- rm -rf ${IMAGE_ROOTFS}/boot
- cp -arfp ${FS-DIR}/fs/${BOOT_CTL}/rootfs/* ${IMAGE_ROOTFS}/
-}
-
-fakeroot distro_rootfs_files_fpga() {
- rm -rf ${IMAGE_ROOTFS}/boot
- rm -rf ${IMAGE_ROOTFS}/linuxrc
- rm -rf ${IMAGE_ROOTFS}/etc/systemd/system.conf
- cp -arfp ${FS-DIR}/fs/${BOOT_CTL}/rootfs/* ${IMAGE_ROOTFS}/
- chmod 644 ${IMAGE_ROOTFS}/etc/passwd
- chmod 644 ${IMAGE_ROOTFS}/etc/group
- chmod 644 ${IMAGE_ROOTFS}/etc/inittab
- chmod 400 ${IMAGE_ROOTFS}/etc/shadow
- chmod a+x ${IMAGE_ROOTFS}/etc/init.d/rcS
- chmod a+r ${IMAGE_ROOTFS}/etc/init.d/rcS
-}
-
-fakeroot distro_rootfs_files_sysvinit() {
- rm -rf ${IMAGE_ROOTFS}/boot
- cp -arfp ${FS-DIR}/fs/${BOOT_CTL}/rootfs/* ${IMAGE_ROOTFS}/
-
- rm -rf ${IMAGE_ROOTFS}/etc/rc[0-6].d
- rm -f ${IMAGE_ROOTFS}/etc/fstab
- rm -f ${IMAGE_ROOTFS}/etc/default/rcS
- chmod 644 ${IMAGE_ROOTFS}/etc/passwd
- chmod 644 ${IMAGE_ROOTFS}/etc/group
- chmod 644 ${IMAGE_ROOTFS}/etc/inittab
- chmod 400 ${IMAGE_ROOTFS}/etc/shadow
- chmod a+x ${IMAGE_ROOTFS}/etc/init.d/rcS
- find ${IMAGE_ROOTFS}/ -name '.gitkeep' -print0 | xargs -0 rm -fr
-}
-
-ROOTFS_POSTPROCESS_COMMAND += "\
- ${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "distro_rootfs_files_sysvinit;", "", d)} \
- ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "distro_rootfs_files_systemd;", "", d)} \
- "
-
-fakeroot do_cprootfs() {
- #rm -fv ${BINS-PATH}/${ROOT_FS_NAME}
- mkdir -p ${BINS-PATH} ${ELFS-PATH}
-
- if [ ${IMAGE_FSTYPES} = 'cpio.gz' ]; then
- cd ${IMAGE_ROOTFS} && find . | cpio -o -H newc | gzip -9 > ${IMAGE_ROOTFS}/ramdisk.image.gz
- mv ${IMAGE_ROOTFS}/ramdisk.image.gz ${BINS-PATH}/${ROOT_FS_NAME}
- if [ -d "${TMPDIR}/work/zx298501-zxic-linux-musl/linux-zxic/5.4.154-r0" ]; then
- cp -arfp ${THISDIR}/files/Makefile_dtb ${B}/Makefile
- cp -arfp ${THISDIR}/files/fix_rootfs_dts.sh ${B}/
- ${B}/fix_rootfs_dts.sh ${MACHINE}-${DISTRO} ${TMPDIR}/work-shared/zx298501/kernel-source ${BINS-PATH}
- oe_runmake -C ${B} S=${TMPDIR}/work/zx298501-zxic-linux-musl/linux-zxic/5.4.154-r0 BINS-PATH=${ELFS-PATH} DTB=${MACHINE}-${DISTRO}.dtb
- fi
- else
- #cp -v ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${IMAGE_FSTYPES} ${BINS-PATH}/${ROOT_FS_NAME}
- cp -v ${IMGDEPLOYDIR}/rootfs.tgz ${ELFS-PATH}/${ROOT_FS_NAME}.tgz
- fi
-}
-
-fakeroot do_cleanrootfs () {
- rm -fv ${BINS-PATH}/${ROOT_FS_NAME}
- rm -fv ${BINS-PATH}/${USEDATA_FS_NAME}
- rm -fv ${BINS-PATH}/*.img*
-}
-
-do_product_ini() {
- mkdir -p ${BINS-PATH}
- echo "[imagefs]" > ${BINS-PATH}/product.ini
- echo "mkfs_ubifs=${IMAGEFS_MKUBIFS_ARGS}" >> ${BINS-PATH}/product.ini
- echo "ubinize=${IMAGEFS_UBINIZE_ARGS}" >> ${BINS-PATH}/product.ini
-}
-
-do_all_flags_bin() {
- ${BSPDIR}/zxic_code/pub/tools/libflags/flags_tool -f ${BINS-PATH}/all_flags.bin ${FLAGS_ARGS}
-}
-
-fakeroot do_mkubifs(){
- if [ ${BOOT_CTL} = 'normal' ]; then
- cp -arfp ${THISDIR}/files/ubinize-cfg.sh ${B}
- cp -arfp ${BSPDIR}/sources/meta-zxic-custom/conf/distro/include/${USERDATA_UBINIZE_CFG} ${B}
- mkdir -p ${BINS-PATH}
- ${B}/ubinize-cfg.sh "${BINS-PATH}/${USEDATA_FS_NAME}" "${B}/${USERDATA_UBINIZE_CFG}" "${USERDATA_UBINIZE_ARGS}"
- mkdir -p ${IMAGE_ROOTFS}/etc_ro/
- cp -v "${BINS-PATH}/${USEDATA_FS_NAME}" ${IMAGE_ROOTFS}/etc_ro/
- fi
-}
-
-
-fakeroot do_rootfs_squashfs(){
- cp -arfp ${THISDIR}/files/ubinize-static.sh ${B}
- if ${@bb.utils.contains('DISTRO_FEATURES','dm-verity','true','false',d)}; then
- cp -arfp ${THISDIR}/files/squashfs_dm-verity.sh ${B}
- cp -arfp ${THISDIR}/files/zxic_generate_squashfs_verity ${B}
- fi
- if ${@bb.utils.contains('DISTRO_FEATURES','dm-verity','true','false',d)}; then
- touch ${IMAGE_ROOTFS}/etc_ro/dm-verity
- else
- rm -fv ${IMAGE_ROOTFS}/etc_ro/dm-verity
- fi
-
- rm -fv ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs_tmp
- mksquashfs4 ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs_tmp ${ROOTFS_SQUASHFS_ARGS}
- if ${@bb.utils.contains('DISTRO_FEATURES','dm-verity','true','false',d)}; then
- cp ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs_tmp ${S}/${ROOT_FS_NAME}.unsigned
- echo "veritysetup and ubinize in do_dm_verity() later ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}"
- else
- echo "rootfs squashfs need ubinize-image on nand flash"
- ${B}/ubinize-static.sh vol_rootfs "${BINS-PATH}/ap_caprootfs.img" ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs_tmp "${UBINIZE_ARGS}"
- fi
- cd ${IMAGE_ROOTFS}/../ && tar -czvf ${IMGDEPLOYDIR}/rootfs.tgz rootfs
-}
-
-fakeroot do_oemfs_squashfs(){
- cp -arfp ${THISDIR}/files/ubinize-static.sh ${B}
- cp -arfp ${FS-DIR}/fs/normal/oem/ ${S}/
- if ${@bb.utils.contains('DISTRO_FEATURES','dm-verity','true','false',d)}; then
- cp -arfp ${THISDIR}/files/squashfs_dm-verity.sh ${B}
- cp -arfp ${THISDIR}/files/zxic_generate_squashfs_verity ${B}
- fi
-
- rm -fv ${IMGDEPLOYDIR}/oem.squashfs_tmp
- mksquashfs4 ${S}/oem ${IMGDEPLOYDIR}/oem.squashfs_tmp ${ROOTFS_SQUASHFS_ARGS}
- if ${@bb.utils.contains('DISTRO_FEATURES','dm-verity','true','false',d)}; then
- cp ${IMGDEPLOYDIR}/oem.squashfs_tmp ${S}/cap_oem.img.unsigned
- echo "veritysetup and ubinize in do_dm_verity() later"
- else
- echo "oem squashfs need ubinize-image on nand flash"
- ${B}/ubinize-static.sh vol_oem "${BINS-PATH}/cap_oem.img" ${IMGDEPLOYDIR}/oem.squashfs_tmp "${UBINIZE_ARGS}"
- mkdir -p ${ELFS-PATH}
- rm -rf ${IMGDEPLOYDIR}/oem.squashfs_tmp
- fi
- mkdir -p ${ELFS-PATH}
- cd ${S}/oem/../ && tar -czvf ${ELFS-PATH}/oem.tgz oem
-
-}
-
-fakeroot do_oemfs_oemdata(){
- if [ ${BOOT_CTL} = 'normal' ]; then
- cp -arfp ${THISDIR}/files/ubinize-cfg.sh ${B}
- cp -arfp ${BSPDIR}/sources/meta-zxic-custom/conf/distro/include/${OEMDATA_UBINIZE_CFG} ${B}
- mkdir -p ${BINS-PATH}
- ${B}/ubinize-cfg.sh "${BINS-PATH}/${OEMDATA_FS_NAME}" "${B}/${OEMDATA_UBINIZE_CFG}" "${USERDATA_UBINIZE_ARGS}"
- mkdir -p ${IMAGE_ROOTFS}/etc_ro/
- cp -v "${BINS-PATH}/${OEMDATA_FS_NAME}" ${IMAGE_ROOTFS}/etc_ro/
- fi
-}
-
-ROOTFS_POSTPROCESS_COMMAND_remove += 'empty_var_volatile;'
-
-fakeroot do_postinstall(){
- if [ -f ${IMAGE_ROOTFS}/postinstall.sh ]; then
- cd ${IMAGE_ROOTFS} && sh postinstall.sh && rm -v ${IMAGE_ROOTFS}/postinstall.sh
- fi
-}
-
-fakeroot do_ln_musl_ld(){
- if [ ! -L ${IMAGE_ROOTFS}/lib/ld-linux-aarch64.so.1 ]; then
- if [ -L ${IMAGE_ROOTFS}/lib/ld-musl-aarch64.so.1 ]; then
- cd ${IMAGE_ROOTFS}/lib && ln -snf ld-musl-aarch64.so.1 ld-linux-aarch64.so.1
- fi
- fi
-}
-
-do_dm_verity(){
- if ${@bb.utils.contains('DISTRO_FEATURES','dm-verity','true','false',d)}; then
- rm -fv ${BINS-PATH}/ap_caprootfs.dm
- ${S}/squashfs_dm-verity.sh ${S}/${ROOT_FS_NAME}.unsigned ${S} \
- ${BINS-PATH}/ap_caprootfs.img.dm ${SIGNIMAGE_PRIVATE_KEY} ${BSPDIR}/tools/SignTool/SignImage
- ${S}/ubinize-static.sh vol_rootfs "${BINS-PATH}/ap_caprootfs.img" ${BINS-PATH}/ap_caprootfs.img.dm "${UBINIZE_ARGS}"
-
- if ${@bb.utils.contains('DISTRO_FEATURES','oemfs','true','false',d)}; then
- rm -fv ${BINS-PATH}/cap_oem.img.dm
- ${B}/squashfs_dm-verity.sh ${S}/cap_oem.img.unsigned ${B} \
- ${BINS-PATH}/cap_oem.img.dm ${SIGNIMAGE_PRIVATE_KEY} ${BSPDIR}/tools/SignTool/SignImage
- ${B}/ubinize-static.sh vol_oem "${BINS-PATH}/cap_oem.img" ${BINS-PATH}/cap_oem.img.dm "${UBINIZE_ARGS}"
- fi
- fi
-}
-
-IMAGE_POSTPROCESS_COMMAND_prepend = ' \
- do_postinstall; \
- ${@bb.utils.contains("TCLIBC", "musl", "do_ln_musl_ld;", "", d)} \
- ${@bb.utils.contains("DISTRO_FEATURES", "selinux", "selinux_set_labels ;", "", d)} \
- '
-
-IMAGE_POSTPROCESS_COMMAND += "\
- ${@bb.utils.contains("USERDATA_FSTYPE", "ubi", "do_mkubifs;", "", d)} \
- ${@bb.utils.contains("DISTRO_FEATURES", "oemfs", "do_oemfs_squashfs;", "", d)} \
- ${@bb.utils.contains("DISTRO_FEATURES", "oemfs", "do_oemfs_oemdata;", "", d)} \
- ${@bb.utils.contains("IMAGE_FSTYPES", "squashfs", "do_rootfs_squashfs;", "", d)} \
- "
-#xf.li@20240716 add start
-do_oem_config() {
- cp -R ${TOPDIR}/prebuilt/rootfs/* ${IMAGE_ROOTFS}/
- if [ "${MOBILETEK_LOG_ENCRYPT}" = "enable" ]; then
- touch ${IMAGE_ROOTFS}/etc/syslog_encrypt_flag
- else
- rm -rf ${IMAGE_ROOTFS}/etc/syslog_encrypt_flag
- touch ${IMAGE_ROOTFS}/etc/no_log_encrypt
- fi
-}
-addtask do_oem_config after do_rootfs before do_image
-#xf.li@20240716 add end
-addtask cprootfs after do_dm_verity before do_build
-addtask do_dm_verity after do_image_complete before do_build
-addtask cleanrootfs after do_clean before do_cleansstate
-