20180918_jeffrey - silenceuncrio/diary GitHub Wiki

0910

review

0940

不管是 MRouter 或是 579X firmware upgrade 最終都呼叫到 fwupgrade.sh

#!/bin/sh
################################################################################
#   File Name   : FwUpgrade.sh
#   Description : VR268 Upgrade Script
#   Write By    : Winston Chen                                  Date: 2014/09/11
#   Reference   : /etc/rc.d/invoke_upgrade.sh, /usr/sbin/vol_mgmt
################################################################################
syncconfig() {
        if [ -f /etc/release ]; then
                mkdir -p /mnt/data/etc/icos
                (cd /etc/icos; tar zcvf - . ) | \
                        (cd /mnt/data/etc/icos; tar zxvf -)
        else
                mkdir -p /mnt/data/icos
                (cd /etc/icos; tar zcvf - . ) | \
                        (cd /mnt/data/icos; tar zxvf -)
        fi
}
input=/tmp/upgrade.img
output=/mnt/data/upgrade.img
################################################################################
#   Check File Exist
################################################################################
if [ ! -s $input ]; then
        echo " Error: Upgrade File $input Not Exist"
        exit 1
fi

echo " Untar Upgrade Image ..."
mv $input $output

################################################################################
#   Upgrade Image
################################################################################
cd /tmp
for i in uImage rootfs.img firmware.img; do
        dd if=$output bs=64 skip=1 2> /dev/null | tar zxv $i
        [ -s "$i" ] || continue
        case "$i" in
                uImage)
                        echo " Upgrade Image 1/3 ..."
                        upgrade $i linux 0 0 1 > /dev/null 2>&1
                        ;;
                rootfs.img)
                        echo " Upgrade Image 2/3 ..."
                        upgrade rootfs.img rootfs 0 0 1 > /dev/null 2>&1
                        ;;
                firmware.img)
                        echo " Upgrade Image 3/3 ..."
                        upgrade firmware.img firmware 0 0 1 > /dev/null 2>&1
                        ;;
        esac
        [ ! -s "$i" ] || rm -f $i
done
[ -L /etc/icos -a -d /mnt/data/icos ] || \
        syncconfig > /dev/null 2>&1
echo " Upgrade Complete!"
rm -f $output
exit 0

又發現真正做事的是 upgrade

root@52XXZ:~# upgrade
Usage : upgrade file_name image_type expand_direction saveenv_copy [reboot]
ToolChain:4.8-linaro/0.9.33.2
Version:1.0.5

1100

讓了一圈結果剛剛問一下 winston 才發現 fullimage 直接拿來用就好了

root@52XXZ:/ramdisk/tmp# upgrade /tmp/fullimage.img full 0 0 1

Image Header --> Data Size = 10838152
 Image Name = VR9 Fullimage

Image Header --> Data Size = 8835072
 Image Name = LTQCPE RootFS
Image contains header with name [LTQCPE RootFS]
Volume ID 4, size 69 LEBs (8902656 bytes, 8.5 MiB), LEB size 129024 bytes (126.0 KiB), dynamic, name "rootfsB", alignment 1

Image Header --> Data Size = 1572800
 Image Name = MIPS LTQCPE Linux-2.6.32.42
Image contains header with name [MIPS LTQCPE Linux-2.6.32.42]
Volume ID 3, size 13 LEBs (1677312 bytes, 1.6 MiB), LEB size 129024 bytes (126.0 KiB), dynamic, name "kernelB", alignment 1
parameter f_kernel_sizeB is not existed
Erasing 128 Kibyte @ 20000 -- 100 % complete
parameter active_bank value changed from rootfs_id=1 to B
Erasing 128 Kibyte @ 20000 -- 100 % complete
parameter update_chk value changed from c=D071DAD8 to 1

Image Header --> Data Size = 430080
 Image Name = VR9 Firmware
Image contains header with name [VR9 Firmware]
Volume ID 5, size 4 LEBs (516096 bytes, 504.0 KiB), LEB size 129024 bytes (126.0 KiB), dynamic, name "firmwareB", alignment 1
Upgrade : successfully upgraded full
root@52XXZ:/ramdisk/tmp# 

和 winston 討論之後有一些待作的項目

  • fullimage.img 還要和 mcsv 還有 checksum 做打包
    • mcsv 會拿來做 upgrade 時的判斷和目標 device 的匹配性
    • checksum 拿來做檔案完整性的檢查
  • upgrade 之後要去設定 uboot 的環境變數讓它從另一個 partition 開機

另一個議題比較進階

M300 與 M360 都是把 mcsv 和 checksum 當作 file 再用 tar 壓成一包

假設這壓成一包的 tar 有 15 MB

上傳到 device 會佔掉 15 MB

解 tar 又至少佔掉另一個 15 MB

那做一次 15 MB 的 firmware upgrade 至少要預留 30 MB 以上的空間

如果 fullimage 和 mcsv 以及 checksum 有更好的打包方式的話

也許可以下這些空間

winston 另外 mail 給我一些相關訊息

5200Z U-boot Upgrade Image Proposal

upgrade.img:
    @echo -n $(MCSV)70746615 > tag.tmp
    md5sum image/fullimage.img > md5.tmp; dd if=md5.tmp of=md5.txt ibs=32 count=1; rm -f md5.tmp;
    cat md5.txt tag.tmp | md5sum > key.tmp;     dd if=key.tmp of=key.txt ibs=32 count=1; rm -f key.tmp;
    cat key.txt tag.tmp | md5sum > iv.tmp;      dd if=iv.tmp of=iv.txt  ibs=32 count=1; rm -f iv.tmp;
    rm -f tag.tmp
    @len=`wc -c image/fullimage.img | awk '{ printf $$1 }'`; \
    printf "%-8s%08X%-16s" "ZRV1.00" $$len $(MCSV) > head.txt; cat md5.txt >> head.txt;
    openssl enc -aes-128-cbc -nosalt -in image/fullimage.img -out out.img -K `cat key.txt` -iv `cat iv.txt`
    cat head.txt out.img > upgrade.img; rm -f out.img;
    @echo "MCSV=$(MCSV)";
    @echo "md5 =`cat md5.txt`";
    @echo "key =`cat key.txt`";
    @echo "iv  =`cat iv.txt`";
    rm -f md5.txt key.txt iv.txt


說明

AES Key  =MD5Sum( MD5Sum(Fullimage), MD5SUM(MCSV, 70756615)

AES IV(initial Vector)=MD5Sum( AES Key, MD5SUM(MCSV, 70756615)

Upgrade Image

(1) 32 Byte Header

        8 bytes string header "ZRV1.00"

        8 bytes string len

       16 bytes string MCSV

(2)AES(Fullimage)

winston 另外又 mail 了一份

52XXZ Check MCSV and dual image issue

(1)MCSV

   Model ID => Model Group ID ( 5213/5223/5243 => 5243)

   Custom ID => Custom Group ID ( 012/06 => 012)

User Model/Custom Group ID to check

// *********************************************************************************
// *   ParsorMCV()
// *********************************************************************************
int    ParsorMCV(char *pMCSV, int *pMid, int *pCid, int *pMig, int *pCig)
{ char szBuf[32];
    strcpy(szBuf, pMCSV);
*pMid=(Hex2Dec(pMCSV[0])<<12)+(Hex2Dec(pMCSV[1])<<8)+(Hex2Dec(pMCSV[2])<<4)+(Hex2Dec(pMCSV[3])<<0);
*pCid=(pMCSV[4]&0x0F)*1000+(pMCSV[5]&0x0F)*100+(pMCSV[6]&0x0F)*10+(pMCSV[7]&0x0F)*1;
    switch (*pMid) {
      case 5213:  // 5210Z
      case 5223:  // 5220Z
      case 5243:  // 5240Z
        *pMig=5243;
        break;
      default:
        *pMig=0;
        break;
    }

    switch (*pCid) {
      case 0:      // Generic
      case 1:      // Proscend
        *pCig=0;
        break;
      case 12:     // CTCU
      case 67:     // CTCU_2(_NETXONE)
        *pCig=12;
        break;
      case 53:     // Hytec
      case 64:     // Hytec_2
        *pCig=53;
        break;
      case 66:     // PI
        *pCig=66;
        break;
      default:
        *pCig=*pCid;
        break;
    }
    return 0;
}

這些資訊需要時間再消化

1125

ariel 表示

Dear Jeffrey and Aaron,

因Shin 周四要去測長距離的天線. 能否請兩位把 Saved PCI 從 M360P 搬到M300,搬完通知我整合測試一下後build image 給他. Many Thanks!

先做這個好了

1130

先接一台 M360 起來看一下

可以參考的 commit 如下

1310

先 pull 最新的 m300 develop branch

build image... ok

upgrade via mfgtool... ok

發現 M300 和 M360 不同的地方不只兩個

總計要按照下面的順序讓 M300 和 M360 同步

  1. change the word "Frequency" to "EARFCN" at the following web page:
  2. remove the 'resolve' and add the refreshing indicator at 'LTE / Engineer' web page:
  3. add 'Status' attribute to show 'Locked' or 'Unlocked' of 'Lock PCI'
  4. add functions to 'LTE / Engineer' web page:

1355

先整 change the word "Frequency" to "EARFCN" at the following web page:

commit 3baf07873491d23e1b63a632b9c7bb4946c2ebbe
Refs: [develop]
Author: jeffrey <[email protected]>
Date:   Tue Sep 18 14:06:02 2018 +0800

    change the word "Frequency" to "EARFCN" at the following web page:
    - 'Status': 'WAN LTE' panel
    - 'LTE / Engineer': 'Serving Cell' and 'Lock PCI' tabs

 proscend/prosrc/www/app/feature/engineer.html                  | 4 ++--
 proscend/prosrc/www/app/locale-en.json                         | 3 +++
 proscend/prosrc/www/app/locale-fr.json                         | 3 +++
 proscend/prosrc/www/app/locale-zh-tw.json                      | 3 +++
 proscend/prosrc/www/brand_advice/app/feature/status.html.src   | 4 ++--
 proscend/prosrc/www/brand_ctcu/app/feature/status.html.src     | 4 ++--
 proscend/prosrc/www/brand_cxr/app/feature/status.html.src      | 4 ++--
 proscend/prosrc/www/brand_digicomm/app/feature/status.html.src | 4 ++--
 proscend/prosrc/www/brand_hytec/app/feature/status.html.src    | 4 ++--
 proscend/prosrc/www/brand_nobrand/app/feature/status.html.src  | 4 ++--
 proscend/prosrc/www/brand_planet/app/feature/status.html.src   | 4 ++--
 proscend/prosrc/www/brand_xentino/app/feature/status.html.src  | 2 +-
 12 files changed, 26 insertions(+), 17 deletions(-)

1405

remove the 'resolve' and add the refreshing indicator at 'LTE / Engineer' web page:

重 build 個 image 來測... ok

upgrade image via mfgtool... ok

verify 整的結果... PASS

commit 9f11a8a685e29a42bfa4ff4bc093381c49fb2f4d
Refs: [develop]
Author: jeffrey <[email protected]>
Date:   Tue Sep 18 14:37:08 2018 +0800

    remove the 'resolve' and add the refreshing indicator at 'LTE / Engineer' web page:
    - the resolve here take some times, so we display the page first then use refreshing indicator

 proscend/prosrc/www/app/feature/engineer.html | 4 +++-
 proscend/prosrc/www/app/feature/engineer.js   | 5 -----
 2 files changed, 3 insertions(+), 6 deletions(-)

1440

add 'Status' attribute to show 'Locked' or 'Unlocked' of 'Lock PCI'

重新產生 image... ok

upgrade via mfgtool... ok

verify... PASS

commit 84f98f1ae6af93e2e16eb098813ba901441aa2be
Refs: [develop]
Author: jeffrey <[email protected]>
Date:   Tue Sep 18 15:00:05 2018 +0800

    add 'Status' attribute to show 'Locked' or 'Unlocked' of 'Lock PCI'

 proscend/prosrc/webcgi/lte.c                  |  1 +
 proscend/prosrc/www/app/feature/engineer.html |  4 ++++
 proscend/prosrc/www/app/feature/engineer.js   | 12 ++++++++++++
 proscend/prosrc/www/app/locale-en.json        |  3 +++
 proscend/prosrc/www/app/locale-fr.json        |  3 +++
 proscend/prosrc/www/app/locale-zh-tw.json     |  3 +++
 6 files changed, 26 insertions(+)

1500

最後一個 add functions to 'LTE / Engineer' web page:

build image... ok

upgrade via mfgtool... ok

verify... PASS

commit 07a004fb27d7ca9d77adb3365e72ba392a315e45
Refs: [develop]
Author: jeffrey <[email protected]>
Date:   Tue Sep 18 15:48:05 2018 +0800

    add functions to 'LTE / Engineer' web page:
    - user can save a entry at 'Lock PCI' tab
    - the saved PCI will display at tab 'Saved PCI'

 proscend/prosrc/webcgi/lte.c                     | 54 ++++++++++++++++++++++++
 proscend/prosrc/www/app/feature/engineer.html    | 48 ++++++++++++++++++++-
 proscend/prosrc/www/app/feature/engineer.js      | 39 +++++++++++++++++
 proscend/prosrc/www/app/locale-en.json           |  2 +
 proscend/prosrc/www/app/locale-fr.json           |  2 +
 proscend/prosrc/www/app/locale-zh-tw.json        |  2 +
 proscend/prosrc/www/app/services/icos.service.js |  7 ++-
 7 files changed, 151 insertions(+), 3 deletions(-)

上 code 吧

1550

再來處理 M360 DNS 的問題

先拉一版最新的 M360... ok

build image... ok

upgrade via uboot... ok

1650

經過 john 的解釋

我了解到目前 M360 上 DNS 的問題是這樣

使用者透過 LTE / DNS 設了一組 User Defined 的 DNS

image

不過 Status 頁面卻沒看到這筆 DNS

image

先等 John 和 ariel 協調一下再說吧