20190327_jeffrey - silenceuncrio/diary GitHub Wiki

0905

昨天下班前已經有一個 profile - 2_MANUFACTURE

application 部分已經全部 off

除了 PROSRC_CLI - 我們要透過 CLI 觀察板子的狀況

PROSRC_SWITH - 會 build 不過

以及觀察 modem 是否正常所需要的 PROSRC_LTE 以及 PROSRC_GOBINET

0940

直接修改 defconfig 是不好的

應該透過 make menuconfig 來修改

不然不會知道有那些 dependency

source code 的部分修改如下

diff --git a/proscend/prosrc/icos/clishell/cli.c b/proscend/prosrc/icos/clishell/cli.c
index 8859770..1b0f97f 100644
--- a/proscend/prosrc/icos/clishell/cli.c
+++ b/proscend/prosrc/icos/clishell/cli.c
@@ -54,9 +54,11 @@ sAttStringSet module_bin_mappings[] =
 sModuleInfo module_infos[] =
 {
     { MODULE_IPV6LAN, 0, 0, sizeof(ipv6_lan) },
+#ifdef PROSRC_CONNMGR
     { MODULE_CONNMGR, 0, 0, sizeof(WAN_CONN) },
     { MODULE_CONNMGR, ETHER_PING_HEALTH, 0, sizeof(ETH_HEALTH) },
     { MODULE_CONNMGR, CHG_WAN_NET, 0, sizeof(ALL_NET_MODE) },
+#endif
     { MODULE_DNS, 0, DNS_ENTRY_IDX_DHCP6C, sizeof(sDnsConfig) },
     { MODULE_DNS, 0, DNS_ENTRY_IDX_LTE, sizeof(sDnsConfig) },
     { MODULE_SNTP, 0, 0, sizeof(sSntpConfig) },
diff --git a/proscend/prosrc/icos/include/icos_shm.h b/proscend/prosrc/icos/include/icos_shm.h
index f7587a4..8bb415d 100644
--- a/proscend/prosrc/icos/include/icos_shm.h
+++ b/proscend/prosrc/icos/include/icos_shm.h
@@ -383,10 +383,8 @@ typedef struct _nd_np_ipinfo_
     signed short ndsts; //ETH_ND_STATE/LTE_ND_STATE/WWIFI_ND_STATE
     PROTOCOL_STATE npsts;
     PROTO4INFO_T ipinfo;
-#ifdef PROSRC_IPV6_FUNC
     PROTO6INFO_T ip6info;
     PROTOCOL_STATE npsts6;
-#endif
 } ND_NP_IP;

 typedef enum

目前 compile error 如下

...
=================================================================
build target default ...
=================================================================
/home/user/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-uclibc-gcc -std=c99 -Wall -fPIC -D_XOPEN_SOURCE=600 -D_GNU_SOURCE  -fno-stack-protector -I/home/user/proscend/prosrc/icos/include -I/home/user/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include -I/home/user/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include/glib-2.0 -I/home/user/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include/libxml2 -I/home/user/staging_dir/host/include -I/home/user/build_dir/linux-ar71xx_generic/linux-3.3.8 -I/home/user/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/include/ssdk -L/home/user/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/lib  -L/home/user/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib -L/home/user/proscend/rootfs/lib -L/home/user/proscend/rootfs/usr/lib -L/home/user/proscend/prosrc/icos -Wl,-rpath-link=/home/user/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib icospromsg.o queue.o -o icospromsg -licos -lcrypt -lpthread -lutil -lm -ljson-c  -lcurl  -lpolarssl -largp -lunqlite -lssdk_us_km
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `Gdo_recover_events'
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `Galarm_conf'
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `clear_output_event'
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `Ggroup'
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `clear_output_recover_event'
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `Gphonebook'
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `Gdo_output_events'
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `searchid'
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `conf_default6_gw'
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `output_sms_alarm'
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `Grecover_events_SMS'
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `team_new_sms'
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `Galarm_events_SMS'
collect2: ld returned 1 exit status
...

1015

追加修改

diff --git a/proscend/prosrc/icos/icoslib/lte/lte.c b/proscend/prosrc/icos/icoslib/lte/lte.c
index 6871aa3..f2ed075 100644
--- a/proscend/prosrc/icos/icoslib/lte/lte.c
+++ b/proscend/prosrc/icos/icoslib/lte/lte.c
@@ -2159,6 +2159,8 @@ void chg_sim_led_status(int sim1_led, int sim2_led)
 }


+
+#ifdef PROSRC_ALARM
 // Send Out Text SMS
 void send_out_sms()
 {
@@ -2223,6 +2225,8 @@ void send_out_sms()
     //}
     //CPRT("OUT\n");
 }
+#endif
+


 void update_rssi(int cur_sim_no)

error 剩下

...
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `Ggroup'
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `Gphonebook'
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `searchid'
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `conf_default6_gw'
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `team_new_sms'
...

追加

diff --git a/proscend/prosrc/icos/icoslib/lte_common/sms_cmd.c b/proscend/prosrc/icos/icoslib/lte_common/sms_cmd.c
index f3b026c..e8ad56d 100644
--- a/proscend/prosrc/icos/icoslib/lte_common/sms_cmd.c
+++ b/proscend/prosrc/icos/icoslib/lte_common/sms_cmd.c
@@ -2003,6 +2003,9 @@ static int trigger_sms_action(SMS_SINGLE *sms_data, int sms_action)
     return 1;
 }

+
+
+#ifdef PROSRC_ALARM
 int Is_Phone_on_duty(SMS_SINGLE *sms_data)
 {
     struct tm *ptm, TmRes;
@@ -2042,6 +2045,8 @@ int Is_Phone_on_duty(SMS_SINGLE *sms_data)
     CPRT("OUT: Not found\n");
     return 0;
 }
+#endif
+


 int action_sms(SMS_SINGLE *sms_data, SMS_ACTION_LIST *act_tbl)
@@ -2260,4 +2265,4 @@ int send_sms_act_q()
     CPRT("<<<OUT\n");
     return 1;
 }
-//---  sms_action.ini
\ No newline at end of file
+//---  sms_action.ini

error 剩下

/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `conf_default6_gw'
/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `team_new_sms'

繼續

diff --git a/proscend/prosrc/icos/icoslib/wan_connmgr/connmgr.c b/proscend/prosrc/icos/icoslib/wan_connmgr/connmgr.c
index 3869652..04a0239 100644
--- a/proscend/prosrc/icos/icoslib/wan_connmgr/connmgr.c
+++ b/proscend/prosrc/icos/icoslib/wan_connmgr/connmgr.c
@@ -1072,7 +1072,9 @@ static int SearchP6LTE(IPV6_CONN *P6c)

         ICOS_msg_sendto_opt(MODULE_CONNMGR, MODULE_DNS,  &(P6c->data_from[descide_idx].data),sizeof(PROTO6INFO_T), ICOS_WAN6_GATEWAY_UPDATE, P6c->data_from[descide_idx].module_id, 0);

+#ifdef PROSRC_IPV6_FUNC
         conf_default6_gw(&(P6c->data_from[descide_idx].data));
+#endif
         G_wan_vpn.default_gw_if6=LTE_IF;
         strncpy(G_wan_vpn.gw_ifname6, P6c->data_from[descide_idx].data.ifname, NETDEV_NAME_LEN);
         if (strstr(P6c->data_from[descide_idx].data.ifname,  APN2_PPP))
@@ -3258,7 +3260,9 @@ static int SearchP6ETH(IPV6_CONN *P6c)
         Del_GWV6_NOT_IF(P6c, P6c->data_from[descide_idx].data.ifname);

         ICOS_msg_sendto_opt(MODULE_CONNMGR, MODULE_DNS,  &(P6c->data_from[descide_idx].data),sizeof(PROTO6INFO_T), ICOS_WAN6_GATEWAY_UPDATE, P6c->data_from[descide_idx].module_id, 0);
+#ifdef PROSRC_IPV6_FUNC
         conf_default6_gw(&(P6c->data_from[descide_idx].data));
+#endif
         G_wan_vpn.default_gw_if6=ETH_IF;
         strncpy(G_wan_vpn.gw_ifname6, P6c->data_from[descide_idx].data.ifname, NETDEV_NAME_LEN);
         previous_lost_if = NONE_IF;
@@ -3475,4 +3479,4 @@ static int SearchP6WiFi(IPV6_CONN *P6c)
     int descide_idx=-1;
     return descide_idx;
 }
-//<===== Two Routing Table Functions End
\ No newline at end of file
+//<===== Two Routing Table Functions End

error 剩下

/home/user/proscend/rootfs/usr/lib/libicos.so: undefined reference to `team_new_sms'

修改

diff --git a/proscend/prosrc/icos/icoslib/lte_common/sms_cmd.c b/proscend/prosrc/icos/icoslib/lte_common/sms_cmd.c
index f3b026c..6a2d029 100644
--- a/proscend/prosrc/icos/icoslib/lte_common/sms_cmd.c
+++ b/proscend/prosrc/icos/icoslib/lte_common/sms_cmd.c
@@ -1140,8 +1140,10 @@ int Read_ALL_SMS_PDU(SMS_ALL *smsappP)
             memcpy(&(smsappP->sms_content[smsappP->alloc_num]), &one_sms, sizeof(SMS_SINGLE));
             smsappP->alloc_num++;
             //CPRT("alloc_num=%d  new_no=%d one_sms.state=%d\n", smsappP->alloc_num, new_no, one_sms.state);
+#ifdef PROSRC_ALARM
             if (one_sms.state==0)
             {
+
                 smsappP->new_sms++;
                 CPRT("--->smsappP->new_sms=%d ---> call team_new_sms()\n", smsappP->new_sms);

@@ -1153,6 +1155,7 @@ int Read_ALL_SMS_PDU(SMS_ALL *smsappP)
                     CPRT("action_sms_ret=%d\n", action_sms_ret);
                 }
             }
+#endif
         }
     }
 end_flag:
@@ -2003,6 +2006,9 @@ static int trigger_sms_action(SMS_SINGLE *sms_data, int sms_action)
     return 1;
 }

+
+
+#ifdef PROSRC_ALARM
 int Is_Phone_on_duty(SMS_SINGLE *sms_data)
 {
     struct tm *ptm, TmRes;
@@ -2042,6 +2048,8 @@ int Is_Phone_on_duty(SMS_SINGLE *sms_data)
     CPRT("OUT: Not found\n");
     return 0;
 }
+#endif
+


 int action_sms(SMS_SINGLE *sms_data, SMS_ACTION_LIST *act_tbl)
@@ -2260,4 +2268,4 @@ int send_sms_act_q()
     CPRT("<<<OUT\n");
     return 1;
 }
-//---  sms_action.ini
\ No newline at end of file
+//---  sms_action.ini

build 過了

1115

目前已經可以觀察到 SIM 卡的狀態

M330/status/sim# list
 status       = unknown
 operator     = Chunghwa Telecom
 access       = FDD LTE
 IMSI         = 466924196196795
 number       =
 band         = LTE BAND 7
 EARFCN       = 3050
 PLMN         = 46692
 roaming      = NO
 up-kbps      =
 down-kbps    =
 tx-rx-kbytes =
 tx-rx-drop   =
M330/status/sim#

先上 code

commit c4cdb3424cd2007f27bb72fccd2603df574ce713
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Mar 27 11:17:07 2019 +0800

    add a profile '2_MANUFATURE' for manufacture purpose:
    since this image will bve used at third party - yuncore,
    so we need take off our own application.

    the application open at this profile as following:
    PROSRC_CLI
    PROSRC_CONNMGR
    PROSRC_LTE
    PROSRC_GOBINET
    PROSRC_SWITCH
    PROSRC_2APN
    QUECTEL_SEL

    and currently we can see the following modem information:
    ```
    M330/status/sim# list
     status       = unknown
     operator     = Chunghwa Telecom
     access       = FDD LTE
     IMSI         = 466924196196795
     number       =
     band         = LTE BAND 7
     EARFCN       = 3050
     PLMN         = 46692
     roaming      = NO
     up-kbps      =
     down-kbps    =
     tx-rx-kbytes =
     tx-rx-drop   =
    ```

 .../mconfig/configs/M330/2_MANUFACTURE/defconfig   | 172 +++++++++++++++++++++
 proscend/prosrc/icos/clishell/cli.c                |   2 +
 proscend/prosrc/icos/icoslib/lte/lte.c             |   4 +
 proscend/prosrc/icos/icoslib/lte_common/sms_cmd.c  |  10 +-
 proscend/prosrc/icos/icoslib/wan_connmgr/connmgr.c |   6 +-
 proscend/prosrc/icos/include/icos_shm.h            |   2 -
 6 files changed, 192 insertions(+), 4 deletions(-)

'2_MANUFATURE' 這個 profile 預設就把 debug 打開

這樣才能在登入後直接使用 shell

commit 8b847c4369171e78bd9592b0d46bb98f11ea73c8
Author: jeffrey <[email protected]>
Date:   Wed Mar 27 11:34:25 2019 +0800

    turn on 'DEBUG' as default setting in profile '2_MANUFATURE'

 proscend/mconfig/configs/M330/2_MANUFACTURE/defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

1140

目前 2_MANUFACTURE 這 profile build 出來的 image 放一段時間後會被 wdog 重啟

root@M330:~#  icos: reboot by wdog...

我要想個方式讓 2_MANUFACTURE 這個 profile 有自己的 rc.local

先為了這個 profile 新增一個專屬的 compile flag 吧 -

commit ef4b0b9e634f908aff2e7fd5161ae789de360a47
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Mar 27 11:51:22 2019 +0800

    add PROSRC_LTE_PROSRC_YUNCORE_MANUFACTURE compiler flag:
    - only turn on at profile '2_MANUFACTURE'

 proscend/mconfig/Config.in                            | 1 +
 proscend/mconfig/configs/M330/0_GENERIC/defconfig     | 1 +
 proscend/mconfig/configs/M330/1_WIFI/defconfig        | 1 +
 proscend/mconfig/configs/M330/2_MANUFACTURE/defconfig | 1 +
 4 files changed, 4 insertions(+)

1400

commit db8b5bcf995afe880437fbe9f8de612b9076fe5b
Author: jeffrey <[email protected]>
Date:   Wed Mar 27 13:56:12 2019 +0800

    about the profile '2_MANUFACTURE':
    - login: root
    - Password: <anything>

    the purpose is that we do not want yuncore knows our password

 proscend/Makefile                        |  3 ++-
 proscend/yuncore_manufacture/icos_pam.sh | 38 ++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 1 deletion(-)

1440

commit 655bdd29466fe4dbb6a1322768355c01888a8745
Author: jeffrey <[email protected]>
Date:   Wed Mar 27 14:38:47 2019 +0800

    about the profile '2_MANUFACTURE':
    - remove the /www from rootfs

 proscend/Makefile | 1 +
 1 file changed, 1 insertion(+)

commit 285d212e4f75b047fdea76b68563f3f476493f41
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Mar 27 14:46:40 2019 +0800

    about the profile '2_MANUFACTURE':
    - do not init the web icos module

 proscend/prosrc/icos/icoslib/entry.c | 3 +++
 1 file changed, 3 insertions(+)
⚠️ **GitHub.com Fallback** ⚠️