20171127_jeffrey - silenceuncrio/diary GitHub Wiki

0855

review

1010

關於 CTCU 的底圖大小目前還在等待回應

1100

修一下 Dual SIM 讓使用者用起來更好用

commit 75e7fc0b2e2142dbd8a8e5a87f8f04f3cf06a103
Author: jeffrey <[email protected]>
Date:   Mon Nov 27 10:59:53 2017 +0800

    fix mantis issue 573: (CTCU) [Dual SIM] "connect/disconnect" not effect, always show "connect"

 proscend/prosrc/www/app/feature/dualSim.js | 72 ++++++++++++++++++++++++++----
 1 file changed, 63 insertions(+), 9 deletions(-)

commit fda0d08a80ec070987e8a8f7bdf67105bae50946

1110

修一下 CTCU 給的底圖

讓他們的 世界地圖 底圖的顯示更顯眼一些

commit c4fe4a7239a9ac60ff73b0eee3adecf19705c0ca
Refs: [hotfix/v1.60-ctcu], {origin/hotfix/v1.60-ctcu}
Author: jeffrey <[email protected]>
Date:   Mon Nov 27 11:08:11 2017 +0800

    let backgroung png logo bigger in CTCU version

 proscend/prosrc/www/brand_ctcu/brand/body_bg.png | Bin 84777 -> 127328 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)

1140

回到 emmc 的進度

1315

參考 Building Image

先 setup a Proscend image for emmc

source proenv.sh m300e proscend-m300e

proscend folder 利用 make menuconfig 選擇 profile - M300E/0_GENERIC

先做一次 compile - source bimage

1345

先做 emmc 的 image generation for firmware upgrade 部分

1445

試著解析一下目前相關的架構

參考 commit - Use bitbake image type to generate M300 firmware

source proenv.sh m300 proscend-m300

  • setup a Proscend image for nandflash
  • machine configuration file = meta-proscend/conf/machine/m300.conf
  • distribution configuration file = meta-proscend/conf/distro/proscend-m300.conf

machine configuration file - meta-proscend/conf/machine/m300.conf

...

NANDFLASH_ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.tar.bz2"

NANDFLASH_ROOTFS_NAME = "rootfs.tar.bz2"

IMAGE_CLASSES += "image_types_proscend"

...

distribution configuration file - meta-proscend/conf/distro/proscend-m300.conf

include conf/distro/include/proscend-base.inc
include conf/distro/include/image_nandflash.inc

DISTRO = "proscend-m300"

meta-proscend/conf/distro/include/image_nandflash.inc

IMAGE_FSTYPES += "nandflash"
UBOOT_CONFIG = "nand"

meta-proscend/classed/image_types_proscend.bbclass

inherit image_types

IMAGE_BOOTLOADER ?= "u-boot"

# Handle u-boot suffixes
UBOOT_SUFFIX ?= "bin"
UBOOT_SUFFIX_SDCARD ?= "${UBOOT_SUFFIX}"
UBOOT_SUFFIX_NANDFLASH ?= "${UBOOT_SUFFIX}-nand"

#
# Handles i.MX mxs bootstream generation
#
MXSBOOT_NAND_ARGS ?= ""

FIRMWARE_DIR = "${DEPLOY_DIR_IMAGE}/firmware"

# IMX Bootlets Linux bootstream
IMAGE_DEPENDS_linux.sb = "elftosb-native:do_populate_sysroot \
                          imx-bootlets:do_deploy \
                          virtual/kernel:do_deploy"
IMAGE_LINK_NAME_linux.sb = ""
IMAGE_CMD_linux.sb () {
}

# Boot partition volume id
BOOTDD_VOLUME_ID ?= "Boot ${MACHINE}"

IMAGE_DEPENDS_nandflash = "parted-native:do_populate_sysroot \
                        dosfstools-native:do_populate_sysroot \
                        mtools-native:do_populate_sysroot \
                        virtual/kernel:do_deploy \
                        ${@d.getVar('IMAGE_BOOTLOADER', True) and d.getVar('IMAGE_BOOTLOADER', True) + ':do_deploy' or ''}"

NANDFLASH= "${MACHINE}.img"

NANDFLASH_GENERATION_COMMAND_mx6ul = "generate_imx_nandflash"

generate_imx_nandflash () {
    # clean up
    rm -rf ${FIRMWARE_DIR}
    rm -f `readlink ${DEPLOY_DIR_IMAGE}/${NANDFLASH}`
    rm -f ${DEPLOY_DIR_IMAGE}/${NANDFLASH}

    mkdir -p ${FIRMWARE_DIR}
    case "${IMAGE_BOOTLOADER}" in
        imx-bootlets)
            bberror "The imx-bootlets is not supported for i.MX based machines"
            exit 1
            ;;
        u-boot)
            cp ${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.${UBOOT_SUFFIX_NANDFLASH} ${FIRMWARE_DIR}
            ;;
        barebox)
            bberror "The imx-bootlets is not supported for i.MX based machines"
            exit 1
            ;;
        "")
            ;;
        *)
            bberror "Unknown IMAGE_BOOTLOADER value"
            exit 1
            ;;
    esac

    if [ -z "${NANDFLASH_ROOTFS_NAME}" ]; then
        bberror "NANDFLASH_ROOTFS_NAME is not defined. To use nandflash image from Proscend it needs to be defined."
        exit 1
    fi

    # Encrypt rootfs using triple DES in CBC mode with password(2wsx#EDC)
    echo "Encrypt rootfs using triple DES in CBC mode with password(2wsx#EDC)"
    openssl des3 -salt -in ${NANDFLASH_ROOTFS} -out ${FIRMWARE_DIR}/${NANDFLASH_ROOTFS_NAME}.enc -k 2wsx#EDC
    #cp ${NANDFLASH_ROOTFS} ${FIRMWARE_DIR}/${NANDFLASH_ROOTFS_NAME}
    if [ $? != 0 ]; then
        bberror "NANDFLASH_ROOTFS is not found. To use nandflash image from Proscend it needs to be generated."
        exit 1
    fi

    # Copy device tree file
    if test -n "${KERNEL_DEVICETREE}"; then
        for DTS_FILE in ${KERNEL_DEVICETREE}; do
            DTS_BASE_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
            if [ -e "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb" ]; then
                cp "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb" ${FIRMWARE_DIR}
            else
                bbfatal "${DTS_FILE} does not exist."
            fi
        done
    fi

    if [ -e "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin" ]; then
        cp "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin" ${FIRMWARE_DIR}/zImage
    fi

    # Encrypt proscend MCSV file using triple DES in CBC mode with password(2wsx#EDC)
    if [ -e "${DEPLOY_DIR_IMAGE}/mcsv" ]
    then
        openssl des3 -salt -in ${DEPLOY_DIR_IMAGE}/mcsv -out ${DEPLOY_DIR_IMAGE}/mcsv.enc -k 2wsx#EDC
        # Copy encryped MCSV - mcsv.enc
        cp ${DEPLOY_DIR_IMAGE}/mcsv.enc ${FIRMWARE_DIR}
    else
        bberror "MCSV is not found. To use nandflash image from Proscend it needs to be generated."
        exit 1
    fi

    # Print MD5 checksums for all images in the firmware folder into file `firmware.md5`
    cd ${FIRMWARE_DIR}
    md5sum * > firmware.md5
    cd -

    # Encrypt firmware_patch.sh file using triple DES in CBC mode with password(2wsx#EDC)
    if [ -e "${DEPLOY_DIR_IMAGE}/firmware_patch.sh" ]
    then
        openssl des3 -salt -in ${DEPLOY_DIR_IMAGE}/firmware_patch.sh -out ${DEPLOY_DIR_IMAGE}/firmware_patch.enc -k 2wsx#EDC
        # Copy encryped firmware_patch.sh - firmware_patch.enc
        cp ${DEPLOY_DIR_IMAGE}/firmware_patch.enc ${FIRMWARE_DIR}
    else
        bberror "firmware_patch.sh is not found. To use nandflash image from Proscend it needs to be generated."
        exit 1
    fi



    filename=$(date "+${MACHINE}_%Y%m%d%H%M%S.img")
    cd ${DEPLOY_DIR_IMAGE}
    tar -cf ${filename} firmware
    ln -s ${filename} ${NANDFLASH}
    cd -
}

IMAGE_CMD_nandflash () {
    if [ -z "${NANDFLASH_ROOTFS}" ]; then
        bberror "NANDFLASH_ROOTFS is undefined. To use nandflash image from Proscend it needs to be defined."
        exit 1
    fi

    ${NANDFLASH_GENERATION_COMMAND}
}

# The sdcard requires the rootfs filesystem to be built before using
# it so we must make this dependency explicit.
IMAGE_TYPEDEP_nandflash = "${@d.getVar('SDCARD_ROOTFS', 1).split('.')[-1]}"

1550

上禮拜五才 release v1.60 因為某種 神秘 的原因

今天還要 release v1.61

幫忙測試 Planet v1.61 版本

M300_PLANET_v1.61_012C000216129C77.img

  • upgrade 完先長按 RST 驅動 reset factory default
  • web ui 各個 entry point 都正常

M300_GPS_PLANET_v1.61_0136000216129C77.img

  • upgrade 完先長按 RST 驅動 reset factory default
  • web ui 各個 entry point 都正常

1645

產生 release v1.61 各版本相對應的 mfgtool

1655

繼續 emmc 的 image generation for firmware upgrade 部分

目前所做的修改如下

異動的 file 有

➜  classes git:(develop) ✗ git status
On branch develop
Your branch is up-to-date with 'origin/develop'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   image_types_proscend.bbclass
        modified:   ../conf/distro/include/image_emmc.inc
        modified:   ../conf/machine/m300e.conf
        modified:   ../../scripts/firmware_to_mfg_files.sh
...

先看 meta-proscend/conf/machine/m300e.conf

diff --git a/meta-proscend/conf/machine/m300e.conf b/meta-proscend/conf/machine/m300e.conf
index 7ecd33c..3f09ccf 100644
--- a/meta-proscend/conf/machine/m300e.conf
+++ b/meta-proscend/conf/machine/m300e.conf
@@ -12,6 +12,10 @@ NANDFLASH_ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.tar.bz2"

 NANDFLASH_ROOTFS_NAME = "rootfs.tar.bz2"

+EMMC_ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.tar.bz2"
+
+EMMC_ROOTFS_NAME = "rootfs.tar.bz2"
+
 IMAGE_CLASSES += "image_types_proscend"

 SOC_FAMILY = "mx6ul"

這裡多了兩個敘述

  • EMMC_ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.tar.bz2"
  • EMMC_ROOTFS_NAME = "rootfs.tar.bz2"

EMMC_ROOTFSEMMC_ROOTFS_NAME 這兩個定義待會會用到

再看 meta-proscend/conf/distro/include/image_emmc.inc

diff --git a/meta-proscend/conf/distro/include/image_emmc.inc b/meta-proscend/conf/distro/include/image_emmc.inc
index 344b579..098416b 100644
--- a/meta-proscend/conf/distro/include/image_emmc.inc
+++ b/meta-proscend/conf/distro/include/image_emmc.inc
@@ -1,3 +1,4 @@

+IMAGE_FSTYPES += "emmc"
 UBOOT_CONFIG = "sd"

多了 IMAGE_FSTYPES += "emmc" 這個敘述

待會我們會在 meta-proscend/classes/image_types_proscend.bbclass 裡看到 IMAGE_CMD_emmc 的定義

meta-proscend/classes/image_types_proscend.bbclass 新增了下述

diff --git a/meta-proscend/classes/image_types_proscend.bbclass b/meta-proscend/classes/image_types_proscend.bbcla
ss
index 4e5a788..2c9b846 100644
--- a/meta-proscend/classes/image_types_proscend.bbclass
+++ b/meta-proscend/classes/image_types_proscend.bbclass
@@ -140,3 +140,124 @@ IMAGE_CMD_nandflash () {
 # The sdcard requires the rootfs filesystem to be built before using
 # it so we must make this dependency explicit.
 IMAGE_TYPEDEP_nandflash = "${@d.getVar('SDCARD_ROOTFS', 1).split('.')[-1]}"
+
+
+
+
+
+
+EMMC= "${MACHINE}.img"
+
+EMMC_GENERATION_COMMAND_mx6ul = "generate_imx_emmc"
+
+
+
+generate_imx_emmc () {
+    # clean up
+    rm -rf ${FIRMWARE_DIR}
+    rm -f `readlink ${DEPLOY_DIR_IMAGE}/${EMMC}`
+    rm -f ${DEPLOY_DIR_IMAGE}/${EMMC}
+
+    mkdir -p ${FIRMWARE_DIR}
+    case "${IMAGE_BOOTLOADER}" in
+        imx-bootlets)
+            bberror "The imx-bootlets is not supported for i.MX based machines"
+            exit 1
+            ;;
+        u-boot)
+            cp ${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.${UBOOT_SUFFIX_SDCARD} ${FIRMWARE_DIR}
+            ;;
+        barebox)
+            bberror "The imx-bootlets is not supported for i.MX based machines"
+            exit 1
+            ;;
+        "")
+            ;;
+        *)
+            bberror "Unknown IMAGE_BOOTLOADER value"
+            exit 1
+            ;;
+    esac
+
+    if [ -z "${EMMC_ROOTFS_NAME}" ]; then
+        bberror "EMMC_ROOTFS_NAME is not defined. To use emmc image from Proscend it needs to be defined."
+        exit 1
+    fi
+
+    # Encrypt rootfs using triple DES in CBC mode with password(2wsx#EDC)
+    echo "Encrypt rootfs using triple DES in CBC mode with password(2wsx#EDC)"
+    openssl des3 -salt -in ${EMMC_ROOTFS} -out ${FIRMWARE_DIR}/${EMMC_ROOTFS_NAME}.enc -k 2wsx#EDC
+    #cp ${NANDFLASH_ROOTFS} ${FIRMWARE_DIR}/${NANDFLASH_ROOTFS_NAME}
+    if [ $? != 0 ]; then
+        bberror "EMMC_ROOTFS is not found. To use emmc image from Proscend it needs to be generated."
+        exit 1
+    fi
+
+    # Copy device tree file
+    if test -n "${KERNEL_DEVICETREE}"; then
+        for DTS_FILE in ${KERNEL_DEVICETREE}; do
+            DTS_BASE_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
+            if [ -e "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb" ]; then
+                cp "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_BASE_NAME}.dtb" ${FIRMWARE_DIR}
+            else
+                bbfatal "${DTS_FILE} does not exist."
+            fi
+        done
+    fi
+
+    if [ -e "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin" ]; then
+        cp "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin" ${FIRMWARE_DIR}/zImage
+    fi
+
+    # Encrypt proscend MCSV file using triple DES in CBC mode with password(2wsx#EDC)
+    if [ -e "${DEPLOY_DIR_IMAGE}/mcsv" ]
+    then
+        openssl des3 -salt -in ${DEPLOY_DIR_IMAGE}/mcsv -out ${DEPLOY_DIR_IMAGE}/mcsv.enc -k 2wsx#EDC
+        # Copy encryped MCSV - mcsv.enc
+        cp ${DEPLOY_DIR_IMAGE}/mcsv.enc ${FIRMWARE_DIR}
+    else
+        bberror "MCSV is not found. To use nandflash image from Proscend it needs to be generated."
+        exit 1
+    fi
+
+    # Print MD5 checksums for all images in the firmware folder into file `firmware.md5`
+    cd ${FIRMWARE_DIR}
+    md5sum * > firmware.md5
+    cd -
+
+    # Encrypt firmware_patch.sh file using triple DES in CBC mode with password(2wsx#EDC)
+    if [ -e "${DEPLOY_DIR_IMAGE}/firmware_patch.sh" ]
+    then
+        openssl des3 -salt -in ${DEPLOY_DIR_IMAGE}/firmware_patch.sh -out ${DEPLOY_DIR_IMAGE}/firmware_patch.enc -k 2wsx#EDC
+        # Copy encryped firmware_patch.sh - firmware_patch.enc
+        cp ${DEPLOY_DIR_IMAGE}/firmware_patch.enc ${FIRMWARE_DIR}
+    else
+        bberror "firmware_patch.sh is not found. To use emmc image from Proscend it needs to be generated."
+        exit 1
+    fi
+
+
+
+    filename=$(date "+${MACHINE}_%Y%m%d%H%M%S.img")
+    cd ${DEPLOY_DIR_IMAGE}
+    tar -cf ${filename} firmware
+    ln -s ${filename} ${EMMC}
+    cd -
+}
+
+
+
+IMAGE_CMD_emmc () {
+    if [ -z "${EMMC_ROOTFS}" ]; then
+        bberror "EMMC_ROOTFS is undefined. To use emmc image from Proscend it needs to be defined."
+        exit 1
+    fi
+
+    ${EMMC_GENERATION_COMMAND}
+}
+
+
+
+IMAGE_TYPEDEP_emmc = "${@d.getVar('SDCARD_ROOTFS', 1).split('.')[-1]}"
+
+

我們還需要修正 scripts/firmware_to_mfg_files.sh 以便同時相容 nandflah 與 emmc

diff --git a/scripts/firmware_to_mfg_files.sh b/scripts/firmware_to_mfg_files.sh
index 29c3e79..0939b0a 100755
--- a/scripts/firmware_to_mfg_files.sh
+++ b/scripts/firmware_to_mfg_files.sh
@@ -55,7 +55,7 @@ function main {
   get_rootfs
   mkdir -p ./mfg_files
   cp /tmp/firmware/rootfs.tar.bz2 ./mfg_files
-  cp /tmp/firmware/u-boot-m300.imx-nand ./mfg_files
+  cp /tmp/firmware/u-boot-* ./mfg_files
   cp /tmp/firmware/zImage ./mfg_files
   cp /tmp/firmware/zImage-imx6ul-14x14-evk.dtb ./mfg_files
 }

1730

目前 compile 完成後會看到 m300e_20171127085459.img

而且可以利用 firmware_to_mfg_files.sh 解出 mfgtool 需要的 files

build@2f192722794e:/var/m300/build_small$ ls -l mfg_files/
total 32380
-rw-rw-r-- 1 build build 27687041 Nov 27 09:30 rootfs.tar.bz2
-rwxr-xr-x 1 build build   363520 Nov 27 09:30 u-boot-m300e.imx
-rw-r--r-- 1 build build  5070144 Nov 27 09:30 zImage
-rw-r--r-- 1 build build    29152 Nov 27 09:30 zImage-imx6ul-14x14-evk.dtb

manufacturing_tool/emmc/mfgtools/Profiles/Linux/OS Firmware/ucl2.xml 要做出相對應的修改

diff --git a/manufacturing_tool/emmc/mfgtools/Profiles/Linux/OS Firmware/ucl2.xml b/manufacturing_tool/emmc/mfgtools/Profiles/Linux/OS Firmware/ucl2.xml
index ef6d9a7..12b41c9 100644
--- a/manufacturing_tool/emmc/mfgtools/Profiles/Linux/OS Firmware/ucl2.xml
+++ b/manufacturing_tool/emmc/mfgtools/Profiles/Linux/OS Firmware/ucl2.xml
@@ -64,7 +64,7 @@
     body="$ dd if=/dev/zero of=/dev/mmcblk%mmc% bs=1k seek=384 conv=fsync count=129">clear u-boot arg</CMD>
   <CMD state="Updater" type="push" body="$ echo 0 > /sys/block/mmcblk%mmc%boot0/force_ro">access boot partition 1</CMD>
   <CMD state="Updater" type="push"
-    body="send" file="files/u-boot-imx6ul%6uluboot%_sd.imx">Sending u-boot.bin</CMD>
+    body="send" file="files/u-boot-m300e.imx">Sending u-boot.bin</CMD>
   <CMD state="Updater" type="push"
     body="$ dd if=$FILE of=/dev/mmcblk1boot0 bs=512 seek=2">write U-Boot to sd card</CMD>
   <CMD state="Updater" type="push"
@@ -95,7 +95,7 @@

   <!-- burn dual dtb -->
   <CMD state="Updater" type="push"
-    body="send" file="files/imx6ul-%6uldtb%%ldo%.dtb">Sending Device Tree file</CMD>
+    body="send" file="files/zImage-imx6ul-14x14-evk.dtb">Sending Device Tree file</CMD>
   <CMD state="Updater" type="push"
     body="$ cp $FILE /mnt/mmcblk%mmc%p1/imx6ul-%6uldtb%_a.dtb">write device tree to partition - dtb_a</CMD>
   <CMD state="Updater" type="push"
@@ -122,12 +122,12 @@
     body="$ mount -t ext3 /dev/mmcblk%mmc%p3 /mnt/mmcblk%mmc%p3"/>

   <CMD state="Updater" type="push"
-    body="pipe tar -jxv -C /mnt/mmcblk%mmc%p2" file="files/rootfs_nogpu.tar.bz2">Sending and writting rootfs to partition 2</CMD>
+    body="pipe tar -jxv -C /mnt/mmcblk%mmc%p2" file="files/rootfs.tar.bz2">Sending and writting rootfs to partition 2</CMD>
   <CMD state="Updater" type="push"
     body="frf">Finishing rootfs write to partition 2</CMD>

   <CMD state="Updater" type="push"
-    body="pipe tar -jxv -C /mnt/mmcblk%mmc%p3" file="files/rootfs_nogpu.tar.bz2">Sending and writting rootfs to partition 3</CMD>
+    body="pipe tar -jxv -C /mnt/mmcblk%mmc%p3" file="files/rootfs.tar.bz2">Sending and writting rootfs to partition 3</CMD>
   <CMD state="Updater" type="push"
     body="frf">Finishing rootfs write to partition 3</CMD>

直接燒錄看看吧

開機成功

看來可以開始來做 firmware upgrade 的部分了

1750

來把今天的進度放到 git server 去

commit 5f042b74ac0320d0c1f86380f7176c358ac77b5d
Author: jeffrey <[email protected]>
Date:   Mon Nov 27 17:49:18 2017 +0800

    generate the firmware for emmc version

 .../mfgtools/Profiles/Linux/OS Firmware/ucl2.xml   |   8 +-
 meta-proscend/classes/image_types_proscend.bbclass | 121 +++++++++++++++++++++
 meta-proscend/conf/distro/include/image_emmc.inc   |   1 +
 meta-proscend/conf/machine/m300e.conf              |   4 +
 scripts/firmware_to_mfg_files.sh                   |   2 +-
 5 files changed, 131 insertions(+), 5 deletions(-)
⚠️ **GitHub.com Fallback** ⚠️