20181024_jeffrey - silenceuncrio/diary GitHub Wiki
0855
目前 CTCU 的 M300 device 不少被駭客攻擊
我先確保 M300 的 multi-user 只有一個
目前 M300 的 user 由 system
icos module 所負責
相關的結構定義如下
#define SYSTEM_USER_NUM 4
typedef struct
{
char szUsername[SYS_USERNAME_SIZE];
char szPassword[SYS_PASSWORD_SIZE]; // store in MD5 format
int userLevel; // level 1..3
} sSystemUser;
typedef struct
{
char szHostName[STRING64_SIZE];
char szDomain[STRING64_SIZE];
sSystemUser user[SYSTEM_USER_NUM];
int szTimeout;
int szRefreshPeriod;
int szAlwaysAdvancedSetup;
int sysCfgChanged;
} sSystemConfig;
system
icos module 初始化的流程如下
#define SYSTEM_FAC_CFG_FILE "/home/factory/icos/system/systemcfg.ini"
static int LoadDefault(sSystemConfig *pCfg)
{
...
if(0==SysParsorTextFile(SYSTEM_FAC_CFG_FILE, SystemCallBack,pCfg,sizeof(*pCfg)))
{
//return ICOS_SUCCESS;
}
...
return ICOS_SUCCESS;
}
static int InitSystem(char *pCfgStr)
{
...
LoadDefault(pCfg);
...
}
sIcosModule systemModule=
{
.szName = "system",
.Init = InitSystem,
.Exit = ExitSystem,
.Apply = ApplySystemSetting,
.GetSetting = GetSystemSetting,
.SetSetting = SetSystemSetting,
.VerifySetting = VerifySystemSetting,
.GetStatus = GetSystemInformation,
};
要理解 /home/factory/icos/system/systemcfg.ini
這個 file 要先盤一下 rootfs 的產出過程
先看一下 source code 內 proscend 下的 Makefile
BUILD_BASE := $(shell pwd)
...
CUSTOMER_FS_DIR := $(BUILD_BASE)/customer_fs
...
default all:
echo "PROSCEND BUILD"
@rm -rf deploy_fs
@cp -af base_fs deploy_fs
...
@make -C $(CUSTOMER_FS_DIR)
...
systemcfg.ini
會受 base_fs
以及 customer_fs
所影響
customer_fs
若有 systemcfg.ini
還會蓋掉 base_fs
內的 systemcfg.ini
先看到 base_fs
- proscend/base_fs/default/rootfs/home/factory/icos/system/systemcfg.ini
hostname=
timeout=300
alwaysadvancedsetup=0
user-id=1
username=root
password=$1$$2Dg0uARUa9gcTJ9I5/iKb/
level=3
再看到 customer_fs
這裡不只一個客戶
proscend/customer_fs/AZURETEC
proscend/customer_fs/AZURETEC_GPS
proscend/customer_fs/CTCU
proscend/customer_fs/CTCU_GPS
proscend/customer_fs/PLANET
proscend/customer_fs/PLANET_GPS
proscend/customer_fs/XENTINO
裏頭有 systemcfg.ini
有
proscend/customer_fs/CTCU/default/rootfs/home/factory/icos/system/systemcfg.ini
proscend/customer_fs/CTCU_GPS/default/rootfs/home/factory/icos/system/systemcfg.ini
proscend/customer_fs/PLANET/default/rootfs/home/factory/icos/system/systemcfg.ini
proscend/customer_fs/PLANET_GPS/default/rootfs/home/factory/icos/system/systemcfg.ini
內容如下
proscend/customer_fs/CTCU/default/rootfs/home/factory/icos/system/systemcfg.ini
hostname=
timeout=300
alwaysadvancedsetup=0
user-id=1
username=admin
password=$1$$qRPK7m23GJusamGpoGLby/
level=3
user-id=2
username=user
password=$1$$ex9cQFo.PV11eSLXJFZuj.
level=1
proscend/customer_fs/CTCU_GPS/default/rootfs/home/factory/icos/system/systemcfg.ini
hostname=
timeout=300
alwaysadvancedsetup=0
user-id=1
username=admin
password=$1$$qRPK7m23GJusamGpoGLby/
level=3
user-id=2
username=user
password=$1$$ex9cQFo.PV11eSLXJFZuj.
level=1
proscend/customer_fs/PLANET/default/rootfs/home/factory/icos/system/systemcfg.ini
hostname=Cellular Gateway
timeout=300
alwaysadvancedsetup=0
user-id=1
username=admin
password=$1$$CoERg7ynjYLsj2j4glJ34.
level=3
user-id=2
username=user
password=$1$$ex9cQFo.PV11eSLXJFZuj.
level=1
proscend/customer_fs/PLANET_GPS/default/rootfs/home/factory/icos/system/systemcfg.ini
hostname=
timeout=300
alwaysadvancedsetup=0
user-id=1
username=admin
password=$1$$CoERg7ynjYLsj2j4glJ34.
level=3
user-id=2
username=user
password=$1$$ex9cQFo.PV11eSLXJFZuj.
level=1
把 user-id=2
的部分刪掉
diff --git a/proscend/customer_fs/CTCU/default/rootfs/home/factory/icos/system/systemcfg.ini b/proscend/customer_fs/CTCU/default/rootfs/home/factory/icos/system/systemcfg.ini
index 31df307..e977e2c 100644
--- a/proscend/customer_fs/CTCU/default/rootfs/home/factory/icos/system/systemcfg.ini
+++ b/proscend/customer_fs/CTCU/default/rootfs/home/factory/icos/system/systemcfg.ini
@@ -6,8 +6,3 @@ user-id=1
username=admin
password=$1$$qRPK7m23GJusamGpoGLby/
level=3
-
-user-id=2
-username=user
-password=$1$$ex9cQFo.PV11eSLXJFZuj.
-level=1
diff --git a/proscend/customer_fs/CTCU_GPS/default/rootfs/home/factory/icos/system/systemcfg.ini b/proscend/customer_fs/CTCU_GPS/default/rootfs/home/factory/icos/system/systemcfg.ini
index 31df307..e977e2c 100644
--- a/proscend/customer_fs/CTCU_GPS/default/rootfs/home/factory/icos/system/systemcfg.ini
+++ b/proscend/customer_fs/CTCU_GPS/default/rootfs/home/factory/icos/system/systemcfg.ini
@@ -6,8 +6,3 @@ user-id=1
username=admin
password=$1$$qRPK7m23GJusamGpoGLby/
level=3
-
-user-id=2
-username=user
-password=$1$$ex9cQFo.PV11eSLXJFZuj.
-level=1
diff --git a/proscend/customer_fs/PLANET/default/rootfs/home/factory/icos/system/systemcfg.ini b/proscend/customer_fs/PLANET/default/rootfs/home/factory/icos/system/systemcfg.ini
index 120e9f5..4f29946 100644
--- a/proscend/customer_fs/PLANET/default/rootfs/home/factory/icos/system/systemcfg.ini
+++ b/proscend/customer_fs/PLANET/default/rootfs/home/factory/icos/system/systemcfg.ini
@@ -6,8 +6,3 @@ user-id=1
username=admin
password=$1$$CoERg7ynjYLsj2j4glJ34.
level=3
-
-user-id=2
-username=user
-password=$1$$ex9cQFo.PV11eSLXJFZuj.
-level=1
diff --git a/proscend/customer_fs/PLANET_GPS/default/rootfs/home/factory/icos/system/systemcfg.ini b/proscend/customer_fs/PLANET_GPS/default/rootfs/home/factory/icos/system/systemcfg.ini
index 53cfc07..6d04859 100644
--- a/proscend/customer_fs/PLANET_GPS/default/rootfs/home/factory/icos/system/systemcfg.ini
+++ b/proscend/customer_fs/PLANET_GPS/default/rootfs/home/factory/icos/system/systemcfg.ini
@@ -6,8 +6,3 @@ user-id=1
username=admin
password=$1$$CoERg7ynjYLsj2j4glJ34.
level=3
-
-user-id=2
-username=user
-password=$1$$ex9cQFo.PV11eSLXJFZuj.
-level=1
proscend 下 make distclean
再 make menuconfig
選擇 M300/4_CTCU
verify ok... 的確只剩一組 user
上 code 吧
commit efa65189413775247ee7501c7d62dba8d723076c
Refs: [release/v1.74], {origin/release/v1.74}
Author: jeffrey <[email protected]>
Date: Wed Oct 24 10:28:38 2018 +0800
remove the second user at default configuration at following customer_fs:
- CTCU
- CTCU_GPS
- PLANET
- PLANET_GPS
.../CTCU/default/rootfs/home/factory/icos/system/systemcfg.ini | 5 -----
.../CTCU_GPS/default/rootfs/home/factory/icos/system/systemcfg.ini | 5 -----
.../PLANET/default/rootfs/home/factory/icos/system/systemcfg.ini | 5 -----
.../PLANET_GPS/default/rootfs/home/factory/icos/system/systemcfg.ini | 5 -----
4 files changed, 20 deletions(-)
1040
盤一下目前每個客戶的 預設帳密
- nobrand - Name: root, default password: 2wsx#EDC
- advice - Name: root, default password: 2wsx#EDC
- Azerutec - Name: root, default password: 2wsx#EDC
- CTCU - Name: admin, default password:
- CXR - Name: root, default password: 2wsx#EDC
- Hytec - Name: root, default password: 2wsx#EDC
- Lite - Name: root, default password: 2wsx#EDC
- Nautilus - Name: root, default password: 2wsx#EDC
- Planet - Name: admin, default password: admin
- Telewell - Name: root, default password: 2wsx#EDC
- WIDE - Name: root, default password: 2wsx#EDC
- Xentino - Name: root, default password: 2wsx#EDC
看來就 CTCU 跟 Planet 最有風險
1045
試著讓 dual image 都吃同一份 config
先整理 nandflash 的部分
flash layout 的部分就保持不動 - 由 uboot 的 bootargs 裡的 mtdparts 所決定
索性連 emmc 一起整理
1315
nandflash 的部分修改如下
diff --git a/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local b/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local
index 53c4184..616b56e 100644
--- a/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local
+++ b/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local
@@ -50,7 +50,6 @@ app_a_mtdn=5
app_b_mtdn=10
app_1_mount_n="/mnt/config"
-app_2_mount_n="/tmp/app_2"
app_1_mount_d_data="/mnt/config/data"
app_1_mount_n_data="/mnt/data"
@@ -58,23 +57,15 @@ app_1_mount_n_data="/mnt/data"
app_1_mount_d_log="/mnt/config/log"
app_1_mount_n_log="/home/log"
-app_2_data="/tmp/app_2/data"
-
if df | grep rootfs_a
then
app_1_mtdn=$app_a_mtdn
app_1_mount_d="ubi1:config_a"
-
- app_2_mtdn=$app_b_mtdn
- app_2_mount_d="ubi2:config_b"
else
- app_1_mtdn=$app_b_mtdn
- app_1_mount_d="ubi1:config_b"
-
- app_2_mtdn=$app_a_mtdn
- app_2_mount_d="ubi2:config_a"
+ app_1_mtdn=$app_a_mtdn
+ app_1_mount_d="ubi1:config_a"
fi
@@ -87,9 +78,6 @@ sysinfo_backup_app_1_dir="$app_1_mount_n_data"
sysinfo_backup_app_1_file="sysinfo.txt"
sysinfo_backup_app_1_path="$sysinfo_backup_app_1_dir"/"$sysinfo_backup_app_1_file"
-sysinfo_backup_app_2_dir="$app_2_data"
-sysinfo_backup_app_2_file="sysinfo.txt"
-sysinfo_backup_app_2_path="$sysinfo_backup_app_2_dir"/"$sysinfo_backup_app_2_file"
# icos data storage
@@ -117,13 +105,6 @@ mkdir -p "$app_1_data_rtc"
-ubiattach -m $app_2_mtdn
-mkdir -p "$app_2_mount_n"
-mount -t ubifs "$app_2_mount_d" "$app_2_mount_n"
-mkdir -p "$app_2_data"
-
-
-
# get uboot_env_ver from uboot env
UBOOT_ENV_VER=$(fw_printenv uboot_env_ver 2>/dev/null | awk -F"=" '{ print $2 }')
if [ "$UBOOT_ENV_VER" = "" ]
@@ -222,7 +203,6 @@ core_uboot_env_loose_indicate 0
cp "$sysinfo_path" "$sysinfo_backup_app_1_path"
-cp "$sysinfo_path" "$sysinfo_backup_app_2_path"
diff --git a/proscend/memory_fs/nandflash/default/rootfs/usr/sbin/icos/FirmwareUpgrade.sh b/proscend/memory_fs/nandflash/default/rootfs/usr/sbin/icos/FirmwareUpgrade.sh
old mode 100755
new mode 100644
index 5b1fd0d..c38f0f4
--- a/proscend/memory_fs/nandflash/default/rootfs/usr/sbin/icos/FirmwareUpgrade.sh
+++ b/proscend/memory_fs/nandflash/default/rootfs/usr/sbin/icos/FirmwareUpgrade.sh
@@ -181,21 +181,6 @@ function burn_rootfs {
-# Synchronize the config MTD device
-function sync_config_mtd {
- log "\nSynchronize the config MTD device ..."
- progress_status "Synchronize the config MTD device ..."
-
- log "Remove target config before copy"
- rm -rf /tmp/app_2/data/*
-
- cp -r /mnt/data/* /tmp/app_2/data
-
- log "Synchronize the config MTD device succeeded"
- progress_status "Synchronize the config MTD device succeeded"
-}
-
-
function upgrade_nandflash_image {
log "\nUpgrading the firmware for 'NAND Flash' storage memory ..."
@@ -254,11 +239,6 @@ function upgrade_nandflash_image {
fi
fi
- progress=90
-
- progress_log "Synchronizing the system configuration" "$progress" "$proportion" "$progress_base"
- sync_config_mtd
-
progress=95
progress_log "Replacing the current primary application" "$progress" "$proportion" "$progress_base"
replace_primary_app
與 nandfalsh 以及 emmc 獨立的部分修改如下
diff --git a/proscend/prosrc/icos/icoslib/customize/customize.c b/proscend/prosrc/icos/icoslib/customize/customize.c
index 858749c..f9e7ea4 100644
--- a/proscend/prosrc/icos/icoslib/customize/customize.c
+++ b/proscend/prosrc/icos/icoslib/customize/customize.c
@@ -22,10 +22,8 @@
#ifdef PROSRC_EMMC
#define APP_1_DIR_NAME "/mnt/mmc/app_a/app"
-#define APP_2_DIR_NAME "/mnt/mmc/app_b/app"
#else
#define APP_1_DIR_NAME "/mnt/config/app"
-#define APP_2_DIR_NAME "/tmp/app_2/app"
#endif
@@ -36,13 +34,11 @@
#define CUSTOMIZE_ETC_DIR ICOS_DIR"/"CUSTOMIZE_DIR_NAME
#define CUSTOMIZE_APP_1_DIR APP_1_DIR_NAME"/"CUSTOMIZE_DIR_NAME
-#define CUSTOMIZE_APP_2_DIR APP_2_DIR_NAME"/"CUSTOMIZE_DIR_NAME
#define CUSTOMIZE_TMP_DIR TMPICOS_DIR"/"CUSTOMIZE_DIR_NAME
#define CUSTOMIZE_ETC_CFG_FILE CUSTOMIZE_ETC_DIR"/"CUSTOMIZE_CFG_NAME
#define CUSTOMIZE_APP_1_CFG_FILE CUSTOMIZE_APP_1_DIR"/"CUSTOMIZE_CFG_NAME
-#define CUSTOMIZE_APP_2_CFG_FILE CUSTOMIZE_APP_2_DIR"/"CUSTOMIZE_CFG_NAME
#define CUSTOMIZE_TMP_CFG_FILE CUSTOMIZE_TMP_DIR"/"CUSTOMIZE_CFG_NAME
#define CUSTOMIZE_FACTORY_CFG_FILE "/home/factory/icos/"CUSTOMIZE_DIR_NAME"/"CUSTOMIZE_CFG_NAME
@@ -151,21 +147,11 @@ static int _init(char *pCfgStr)
mkdir(APP_1_DIR_NAME, 0755);
}
- if (stat(APP_2_DIR_NAME, &st) < 0)
- {
- mkdir(APP_2_DIR_NAME, 0755);
- }
-
if (stat(CUSTOMIZE_APP_1_DIR, &st) < 0)
{
mkdir(CUSTOMIZE_APP_1_DIR, 0755);
}
- if (stat(CUSTOMIZE_APP_2_DIR, &st) < 0)
- {
- mkdir(CUSTOMIZE_APP_2_DIR, 0755);
- }
-
if (stat(CUSTOMIZE_TMP_DIR, &st) < 0)
{
mkdir(CUSTOMIZE_TMP_DIR, 0755);
@@ -397,7 +383,6 @@ static int _set_setting(int flag, int index, void* pStruct, int structSize)
json_object_to_file_ext(CUSTOMIZE_TMP_CFG_FILE, jobj, JSON_C_TO_STRING_PRETTY);
SysCopyFile(CUSTOMIZE_TMP_CFG_FILE, CUSTOMIZE_APP_1_CFG_FILE);
- SysCopyFile(CUSTOMIZE_TMP_CFG_FILE, CUSTOMIZE_APP_2_CFG_FILE);
return result;
}
diff --git a/proscend/prosrc/icos/script/FirmwareUpgradeAPI.sh b/proscend/prosrc/icos/script/FirmwareUpgradeAPI.sh
old mode 100755
new mode 100644
index 98ed916..10a0b7a
--- a/proscend/prosrc/icos/script/FirmwareUpgradeAPI.sh
+++ b/proscend/prosrc/icos/script/FirmwareUpgradeAPI.sh
@@ -456,9 +456,6 @@ function upgrade_cfile {
return 1
fi
- # cp the cfile to another dual image partition
- cp "$ICOS_CFILE_PATH" /tmp/app_2/data
-
return 0
}
emmc 的部分修改如下
diff --git a/proscend/memory_fs/emmc/default/rootfs/etc/rc.local b/proscend/memory_fs/emmc/default/rootfs/etc/rc.local
index a262d1d..4bfce27 100644
--- a/proscend/memory_fs/emmc/default/rootfs/etc/rc.local
+++ b/proscend/memory_fs/emmc/default/rootfs/etc/rc.local
@@ -46,11 +46,6 @@ mmc_mount_d_app_a_data="/mnt/mmc/app_a/data"
mmc_mount_d_app_a_log="/mnt/mmc/app_a/log"
mmc_mount_d_app_a_user_data="/mnt/mmc/app_a/user_data"
-mmc_mount_d_app_b="/mnt/mmc/app_b"
-mmc_mount_d_app_b_data="/mnt/mmc/app_b/data"
-mmc_mount_d_app_b_log="/mnt/mmc/app_b/log"
-mmc_mount_d_app_b_user_data="/mnt/mmc/app_b/user_data"
-
app_mount_n_data="/mnt/data"
app_mount_n_log="/home/log"
@@ -62,10 +57,6 @@ sysinfo_backup_app_a_dir="$mmc_mount_d_app_a_data"
sysinfo_backup_app_a_file="sysinfo.txt"
sysinfo_backup_app_a_path="$sysinfo_backup_app_a_dir"/"$sysinfo_backup_app_a_file"
-sysinfo_backup_app_b_dir="$mmc_mount_d_app_b_data"
-sysinfo_backup_app_b_file="sysinfo.txt"
-sysinfo_backup_app_b_path="$sysinfo_backup_app_b_dir"/"$sysinfo_backup_app_b_file"
-
# icos data storage
app_data_icos="$app_mount_n_data"/"icos"
@@ -82,9 +73,9 @@ then
sysinfo_backup_app_1_path=$sysinfo_backup_app_a_path
else
echo "running dual image is b"
- app_mount_d_data=$mmc_mount_d_app_b_data
- app_mount_d_log=$mmc_mount_d_app_b_log
- sysinfo_backup_app_1_path=$sysinfo_backup_app_b_path
+ app_mount_d_data=$mmc_mount_d_app_a_data
+ app_mount_d_log=$mmc_mount_d_app_a_data
+ sysinfo_backup_app_1_path=$sysinfo_backup_app_a_path
fi
@@ -97,10 +88,6 @@ mkdir -p "$mmc_mount_d_app_a_data"
mkdir -p "$mmc_mount_d_app_a_log"
mkdir -p "$mmc_mount_d_app_a_user_data"
-mkdir -p "$mmc_mount_d_app_b_data"
-mkdir -p "$mmc_mount_d_app_b_log"
-mkdir -p "$mmc_mount_d_app_b_user_data"
-
mkdir -p "$app_mount_n_data"
mkdir -p "$app_mount_n_log"
@@ -210,7 +197,6 @@ core_uboot_env_loose_indicate 0
cp "$sysinfo_path" "$sysinfo_backup_app_a_path"
-cp "$sysinfo_path" "$sysinfo_backup_app_b_path"
diff --git a/proscend/memory_fs/emmc/default/rootfs/usr/sbin/icos/FirmwareUpgrade.sh b/proscend/memory_fs/emmc/default/rootfs/usr/sbin/icos/FirmwareUpgrade.sh
old mode 100755
new mode 100644
index 33b2c18..bea4479
--- a/proscend/memory_fs/emmc/default/rootfs/usr/sbin/icos/FirmwareUpgrade.sh
+++ b/proscend/memory_fs/emmc/default/rootfs/usr/sbin/icos/FirmwareUpgrade.sh
@@ -65,13 +65,6 @@ rootfs_app_b_dir="$mmc_p3_mount_n"
-data_app_a_dir="/mnt/mmc/app_a/data"
-data_app_b_dir="/mnt/mmc/app_b/data"
-
-data_app_1_dir="/mnt/data/"
-
-
-
# Init the context for upgrading the firmware
function context_init {
log "\nInit the context for upgrading the firmware ..."
@@ -85,14 +78,12 @@ function context_init {
zImage_app_2_path="$zImage_app_b_path"
dtb_app_2_path="$dtb_app_b_path"
rootfs_app_2_path="$rootfs_app_b_dir"
- data_app_2_dir="$data_app_b_dir"
else
log "running dual image is b"
zImage_app_2_path="$zImage_app_a_path"
dtb_app_2_path="$dtb_app_a_path"
rootfs_app_2_path="$rootfs_app_a_dir"
- data_app_2_dir="$data_app_a_dir"
fi
@@ -190,22 +181,6 @@ function burn_rootfs_emmc {
-# Synchronize the app data
-function sync_app_data {
- log "\nSynchronize the app data ..."
- progress_status "Synchronize the app data ..."
-
- log "rm -rf $data_app_2_dir/*"
- rm -rf "$data_app_2_dir"/* > /dev/null 2>&1
-
- log "cp -r $data_app_1_dir/* $data_app_2_dir"
- cp -r "$data_app_1_dir"/* "$data_app_2_dir" > /dev/null 2>&1
-
- log "Synchronize the app data succeeded"
- progress_status "Synchronize the app data succeeded"
-}
-
-
# upgrade the firmware for 'eMMC' storage memory
function upgrade_emmc_image {
log "\nUpgrading the firmware for 'eMMC' storage memory ..."
@@ -266,10 +241,6 @@ function upgrade_emmc_image {
fi
fi
- progress=90
- progress_log "Synchronizing the system configuration" "$progress" "$proportion" "$progress_base"
- sync_app_data
-
progress=95
progress_log "Replacing the current primary application" "$progress" "$proportion" "$progress_base"
先 build 一版 nand flash 的試試 - M300/4_CTCU
... ok
mfgtool 燒錄... ok
實際測試
icosconfig bootinit
... PASS
cat /home/log/web.log
... PASS
check current partition... a
修改 WAN Priority
- from ETH First
to LTE Only
故意不完整開機兩次讓 device 切換 partition... ok
icosconfig bootinit
... PASS
cat /home/log/web.log
... PASS - 目前 log 也不分兩個 partition 了
check current partition... b
check WAN Priority
... LTE Only
接著來試 firmware upgrade
失敗了
從 log 可以看到
...
Burn the rootfs to NAND Flash ...
Erasing rootfs_a patition and format it - MTD device 4
Attach rootfs_a patition to UBI - MTD device 4
Error: ubiattach /dev/ubi_ctrl -m 4 failed
burn_rootfs done
...
ubiattach 會受到目前 ubi device 數目的影響
最安全的作法是不要把 rc.local 跟 config_b 相關的 ubiattach 拿掉
再重新修改一次
nandflash 的改動如下
diff --git a/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local b/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local
index 53c4184..7c1b097 100644
--- a/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local
+++ b/proscend/memory_fs/nandflash/default/rootfs/etc/rc.local
@@ -70,11 +70,11 @@ then
app_2_mtdn=$app_b_mtdn
app_2_mount_d="ubi2:config_b"
else
- app_1_mtdn=$app_b_mtdn
- app_1_mount_d="ubi1:config_b"
+ app_1_mtdn=$app_a_mtdn
+ app_1_mount_d="ubi1:config_a"
- app_2_mtdn=$app_a_mtdn
- app_2_mount_d="ubi2:config_a"
+ app_2_mtdn=$app_b_mtdn
+ app_2_mount_d="ubi2:config_b"
fi
diff --git a/proscend/memory_fs/nandflash/default/rootfs/usr/sbin/icos/FirmwareUpgrade.sh b/proscend/memory_fs/nandflash/default/rootfs/usr/sbin/icos/FirmwareUpgrade.sh
old mode 100755
new mode 100644
index 5b1fd0d..f712d1c
--- a/proscend/memory_fs/nandflash/default/rootfs/usr/sbin/icos/FirmwareUpgrade.sh
+++ b/proscend/memory_fs/nandflash/default/rootfs/usr/sbin/icos/FirmwareUpgrade.sh
@@ -254,11 +254,6 @@ function upgrade_nandflash_image {
fi
fi
- progress=90
-
- progress_log "Synchronizing the system configuration" "$progress" "$proportion" "$progress_base"
- sync_config_mtd
-
progress=95
progress_log "Replacing the current primary application" "$progress" "$proportion" "$progress_base"
replace_primary_app
emmc 的改動如下
diff --git a/proscend/memory_fs/emmc/default/rootfs/etc/rc.local b/proscend/memory_fs/emmc/default/rootfs/etc/rc.local
index a262d1d..f588bb0 100644
--- a/proscend/memory_fs/emmc/default/rootfs/etc/rc.local
+++ b/proscend/memory_fs/emmc/default/rootfs/etc/rc.local
@@ -82,9 +82,9 @@ then
sysinfo_backup_app_1_path=$sysinfo_backup_app_a_path
else
echo "running dual image is b"
- app_mount_d_data=$mmc_mount_d_app_b_data
- app_mount_d_log=$mmc_mount_d_app_b_log
- sysinfo_backup_app_1_path=$sysinfo_backup_app_b_path
+ app_mount_d_data=$mmc_mount_d_app_a_data
+ app_mount_d_log=$mmc_mount_d_app_a_log
+ sysinfo_backup_app_1_path=$sysinfo_backup_app_a_path
fi
diff --git a/proscend/memory_fs/emmc/default/rootfs/usr/sbin/icos/FirmwareUpgrade.sh b/proscend/memory_fs/emmc/default/rootfs/usr/sbin/icos/FirmwareUpgrade.sh
old mode 100755
new mode 100644
index 33b2c18..7333aa1
--- a/proscend/memory_fs/emmc/default/rootfs/usr/sbin/icos/FirmwareUpgrade.sh
+++ b/proscend/memory_fs/emmc/default/rootfs/usr/sbin/icos/FirmwareUpgrade.sh
@@ -266,10 +266,6 @@ function upgrade_emmc_image {
fi
fi
- progress=90
- progress_log "Synchronizing the system configuration" "$progress" "$proportion" "$progress_base"
- sync_app_data
-
progress=95
progress_log "Replacing the current primary application" "$progress" "$proportion" "$progress_base"
共通的部分改動如下
diff --git a/proscend/prosrc/icos/icoslib/customize/customize.c b/proscend/prosrc/icos/icoslib/customize/customize.c
index 858749c..f9e7ea4 100644
--- a/proscend/prosrc/icos/icoslib/customize/customize.c
+++ b/proscend/prosrc/icos/icoslib/customize/customize.c
@@ -22,10 +22,8 @@
#ifdef PROSRC_EMMC
#define APP_1_DIR_NAME "/mnt/mmc/app_a/app"
-#define APP_2_DIR_NAME "/mnt/mmc/app_b/app"
#else
#define APP_1_DIR_NAME "/mnt/config/app"
-#define APP_2_DIR_NAME "/tmp/app_2/app"
#endif
@@ -36,13 +34,11 @@
#define CUSTOMIZE_ETC_DIR ICOS_DIR"/"CUSTOMIZE_DIR_NAME
#define CUSTOMIZE_APP_1_DIR APP_1_DIR_NAME"/"CUSTOMIZE_DIR_NAME
-#define CUSTOMIZE_APP_2_DIR APP_2_DIR_NAME"/"CUSTOMIZE_DIR_NAME
#define CUSTOMIZE_TMP_DIR TMPICOS_DIR"/"CUSTOMIZE_DIR_NAME
#define CUSTOMIZE_ETC_CFG_FILE CUSTOMIZE_ETC_DIR"/"CUSTOMIZE_CFG_NAME
#define CUSTOMIZE_APP_1_CFG_FILE CUSTOMIZE_APP_1_DIR"/"CUSTOMIZE_CFG_NAME
-#define CUSTOMIZE_APP_2_CFG_FILE CUSTOMIZE_APP_2_DIR"/"CUSTOMIZE_CFG_NAME
#define CUSTOMIZE_TMP_CFG_FILE CUSTOMIZE_TMP_DIR"/"CUSTOMIZE_CFG_NAME
#define CUSTOMIZE_FACTORY_CFG_FILE "/home/factory/icos/"CUSTOMIZE_DIR_NAME"/"CUSTOMIZE_CFG_NAME
@@ -151,21 +147,11 @@ static int _init(char *pCfgStr)
mkdir(APP_1_DIR_NAME, 0755);
}
- if (stat(APP_2_DIR_NAME, &st) < 0)
- {
- mkdir(APP_2_DIR_NAME, 0755);
- }
-
if (stat(CUSTOMIZE_APP_1_DIR, &st) < 0)
{
mkdir(CUSTOMIZE_APP_1_DIR, 0755);
}
- if (stat(CUSTOMIZE_APP_2_DIR, &st) < 0)
- {
- mkdir(CUSTOMIZE_APP_2_DIR, 0755);
- }
-
if (stat(CUSTOMIZE_TMP_DIR, &st) < 0)
{
mkdir(CUSTOMIZE_TMP_DIR, 0755);
@@ -397,7 +383,6 @@ static int _set_setting(int flag, int index, void* pStruct, int structSize)
json_object_to_file_ext(CUSTOMIZE_TMP_CFG_FILE, jobj, JSON_C_TO_STRING_PRETTY);
SysCopyFile(CUSTOMIZE_TMP_CFG_FILE, CUSTOMIZE_APP_1_CFG_FILE);
- SysCopyFile(CUSTOMIZE_TMP_CFG_FILE, CUSTOMIZE_APP_2_CFG_FILE);
return result;
}
diff --git a/proscend/prosrc/icos/script/FirmwareUpgradeAPI.sh b/proscend/prosrc/icos/script/FirmwareUpgradeAPI.sh
old mode 100755
new mode 100644
index 98ed916..10a0b7a
--- a/proscend/prosrc/icos/script/FirmwareUpgradeAPI.sh
+++ b/proscend/prosrc/icos/script/FirmwareUpgradeAPI.sh
@@ -456,9 +456,6 @@ function upgrade_cfile {
return 1
fi
- # cp the cfile to another dual image partition
- cp "$ICOS_CFILE_PATH" /tmp/app_2/data
-
return 0
}
一樣 build 一版 nand flash 的試試 - M300/4_CTCU
... ok
mfgtool 燒錄... ok
實際測試
icosconfig bootinit
... PASS
cat /home/log/web.log
... PASS
check current partition... a
修改 WAN Priority
- from ETH First
to LTE First
故意不完整開機兩次讓 device 切換 partition... ok
icosconfig bootinit
... PASS
cat /home/log/web.log
... PASS - 目前 log 也不分兩個 partition 了
check current partition... b
check WAN Priority
... LTE First
來試 firmware upgrade... PASS
改 build 一版 emmc 的來試試
記得重新 source proenv.sh 一次 - source proenv.sh m300e proscend-m300e
進 proscend
make distclean
再 make menuconfig
選 M300E/1_GPS
build bimage.sh
... ok
mfgtoo 燒錄... ok
測試
icosconfig bootinit
... PASS
cat /home/log/web.log
... PASS
check current partition... 空白...
趕緊修一下
diff --git a/proscend/memory_fs/emmc/default/rootfs/etc/rc.local b/proscend/memory_fs/emmc/default/rootfs/etc/rc.local
index a262d1d..92eaf0a 100644
--- a/proscend/memory_fs/emmc/default/rootfs/etc/rc.local
+++ b/proscend/memory_fs/emmc/default/rootfs/etc/rc.local
@@ -192,7 +192,7 @@ fi
# get the app primary
-APP_PRIMARY=$(fw_printenv app_primary 2>/dev/null | awk -F"=" '{ print $2 }')
+APP_PRIMARY=$(fw_printenv app_1 2>/dev/null | awk -F"=" '{ print $2 }')
再 build 一次
省點時間 先手動編輯 /etc/rc.local
後再重開機看看
PASS
root@Hardened Cellular Router:~# cat /tmp/etc/sysinfo.txt
UBOOT_ENV_VER=emmc_v1.0
MAC=random
HW_MCSV=016800001732C320
SERIALNO=NA
APP_PRIMARY=a
一樣修改 WAN Priority
- from ETH First
to LTE Only
故意不完整開機兩次讓 device 切換 partition... ok
icosconfig bootinit
... PASS
cat /home/log/web.log
... PASS - 目前 log 也不分兩個 partition 了
check current partition... b
check WAN Priority
... LTE Only
... PASS
試 firmware upgrade... ok
上 code 吧
commit 3ec75d4c37cf2dbfd260bfcbea18e86f3aef79d1
Refs: [release/v1.74], {origin/release/v1.74}
Author: jeffrey <[email protected]>
Date: Wed Oct 24 16:38:08 2018 +0800
no matter which active image partition is, use the same configuratition area at nandflash or emmc
proscend/memory_fs/emmc/default/rootfs/etc/rc.local | 8 ++++----
.../emmc/default/rootfs/usr/sbin/icos/FirmwareUpgrade.sh | 4 ----
proscend/memory_fs/nandflash/default/rootfs/etc/rc.local | 8 ++++----
.../default/rootfs/usr/sbin/icos/FirmwareUpgrade.sh | 5 -----
proscend/prosrc/icos/icoslib/customize/customize.c | 15 ---------------
proscend/prosrc/icos/script/FirmwareUpgradeAPI.sh | 3 ---
6 files changed, 8 insertions(+), 35 deletions(-)
1640
先切回 M360 作一些小修改
pull the latest code of develop branch
build image... ok
upgrade via uboot... ok
commit b97794b51634ed783d1f8ff64171d0e270bcbd18
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date: Wed Oct 24 16:58:26 2018 +0800
- add 'Roaming' field at 'Status' web page
- remove 'ANY' option from 'LTE / Lock Bands' web page
proscend/prosrc/www/app/feature/lock_bands.html | 2 +-
proscend/prosrc/www/src/app/feature/status.html.src | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
1700
再度切回 M300
build 一版 nandflash 適用的... ok
mfgtool 燒錄... ok
lock band 和 lock pci web page 不用 login 應該是 catch 所導致
忽略該 issue