20170608_jeffrey - silenceuncrio/diary GitHub Wiki

0905

昨天看到 iperf crosee compilier 提到

沒加上 ac_cv_func_malloc_0_nonnull=yes 會出現下面錯誤 undefined reference to `rpl_malloc'

先利用 bitbake keepalived -c devshell 進到 keepalived 的 source code 工作目錄

先讓 configure 吃到 ac_cv_func_realloc_0_nonnull=yesac_cv_func_malloc_0_nonnull=yes 這兩個變數

./configure --host=arm ac_cv_func_realloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes

compile 吧

make

成功啦

修改 keepalived_1.3.5.bb 如下

LICENSE = "GPL-2.0"
LIC_FILES_CHKSUM = "file://${WORKDIR}/git/COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
SRC_URI = "git://github.com/acassen/keepalived.git;protocl=https;tag=v1.3.5"

S = "${WORKDIR}/git"

do_configure() {
    export ac_cv_func_realloc_0_nonnull=yes
    export ac_cv_func_malloc_0_nonnull=yes
    ${S}/configure --host=arm
}

do_compile() {
    oe_runmake
}

正規的用 bitbake 來一次

bitbake keepalived -c clean
bitbake keepalived -c compile

do_fetch... ok do_configure... ok do_compile... ok

產生出來的執行檔資訊如下

root@2f192722794e:/var/m300/build_small/tmp/work/cortexa7hf-vfp-neon-poky-linux-gnueabi/keepalived/1.3.5-r0/git/bin# ls -al
total 268
drwxr-xr-x  2 1000 1000   4096 Jun  8 01:51 .
drwxr-xr-x 12 1000 1000   4096 Jun  8 01:51 ..
-rw-r--r--  1 1000 1000      0 Jun  8 01:51 .gitignore
-rwxr-xr-x  1 1000 1000  27064 Jun  8 01:51 genhash
-rwxr-xr-x  1 1000 1000 236308 Jun  8 01:51 keepalived
root@2f192722794e:/var/m300/build_small/tmp/work/cortexa7hf-vfp-neon-poky-linux-gnueabi/keepalived/1.3.5-r0/git/bin# file keepalived
keepalived: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=792ea240ccb99f7b9606b19a7a6a27fe267a02ca, stripped

1000

繼續修改 keepalived_1.3.5.bb

加上 do_install()

LICENSE = "GPL-2.0"
LIC_FILES_CHKSUM = "file://${WORKDIR}/git/COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
SRC_URI = "git://github.com/acassen/keepalived.git;protocl=https;tag=v1.3.5"

S = "${WORKDIR}/git"

do_configure() {
    export ac_cv_func_realloc_0_nonnull=yes
    export ac_cv_func_malloc_0_nonnull=yes
    ${S}/configure --host=arm
}

do_compile() {
    oe_runmake
}

do_install() {
    install -d ${D}${sbindir}
    install -m 755 ${S}/bin/keepalived ${D}${sbindir}
}

修改 prosrc_0.1.bbRDEPENDS_${PN}

新增 keepalived

diff --git a/meta-proscend/recipes-core/prosrc/prosrc_0.1.bb b/meta-proscend/recipes-core/prosrc/prosrc_0.1.bb
index b665291..e922c70 100644
--- a/meta-proscend/recipes-core/prosrc/prosrc_0.1.bb
+++ b/meta-proscend/recipes-core/prosrc/prosrc_0.1.bb
@@ -22,7 +22,7 @@ RDEPENDS_${PN} += "GobiNet-mod"
 RDEPENDS_${PN} += "8192du-mod wireless-tools rng-tools hostapd wpa-supplicant"
 # Ethx tool
 RDEPENDS_${PN} += "ethtool"
-RDEPENDS_${PN} += "ppp ppp-oe iptables iperf dnsmasq pptp-linux bridge-utils dhcp-server dhcp-client openvpn openssl openssl-conf iproute2 iproute2-tc procps socat strongswan cryptodev-module mtd-utils mtd-utils-ubifs imx-kobs tar bzip2 jq shadow libqmi net-snmp net-snmp-server-snmpd"
+RDEPENDS_${PN} += "ppp ppp-oe iptables iperf dnsmasq pptp-linux bridge-utils dhcp-server dhcp-client openvpn openssl openssl-conf iproute2 iproute2-tc procps socat strongswan cryptodev-module mtd-utils mtd-utils-ubifs imx-kobs tar bzip2 jq shadow libqmi net-snmp net-snmp-server-snmpd keepalived"
 # ======================================

 # Build dependence

試著 build image 吧

1015

...
Build Configuration:
BB_VERSION        = "1.28.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Ubuntu-14.04"
TARGET_SYS        = "arm-poky-linux-gnueabi"
MACHINE           = "m300"
DISTRO            = "proscend-m300"
DISTRO_VERSION    = "4.1.15-1.2.0"
TUNE_FEATURES     = "arm armv7a vfp neon callconvention-hard cortexa7"
TARGET_FPU        = "vfp-neon"
meta
meta-yocto        = "HEAD:dd0ba9ea4a11ab15348d4fe3574e4b28784db82f"
meta-oe
meta-multimedia   = "HEAD:ad6133a2e95f4b83b6b3ea413598e2cd5fb3fd90"
meta-fsl-arm      = "HEAD:35b8b9bd9863de208ab60e33b55f10ee43e2619b"
meta-fsl-arm-extra = "HEAD:e200df91b70da254461c59082ddd5db0a3c415a2"
meta-fsl-demos    = "HEAD:2231e946e7a94d096394f2b2477e8184c9bbde7b"
meta-bsp
meta-sdk          = "HEAD:dfbc90ee74624ce3be636c8bd2a47114fa2b71aa"
meta-browser      = "HEAD:b6d46d69a261fe6bd7c1e9811dc2a9bbd0b79aeb"
meta-qt5          = "HEAD:d5536e34ec985c82b621448ab4325e5cbba38560"
meta-networking
meta-python
meta-ruby
meta-filesystems
meta-gnome        = "HEAD:ad6133a2e95f4b83b6b3ea413598e2cd5fb3fd90"
meta-proscend     = "feature/vrrp:778ef03457e2ba2e75939d4c93943b5fd25ed6b0"

NOTE: Preparing RunQueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: prosrc: compiling from external source tree /var/m300/proscend
ERROR: QA Issue: File '/usr/sbin/keepalived' from keepalived was already stripped, this will prevent future debugg
ing! [already-stripped]
WARNING: QA Issue: keepalived rdepends on iptables, but it isn't a build dependency? [build-deps]
WARNING: QA Issue: keepalived rdepends on libcrypto, but it isn't a build dependency? [build-deps]
WARNING: QA Issue: keepalived rdepends on libssl, but it isn't a build dependency? [build-deps]
WARNING: File 'usr/lib/libicos.so' from prosrc was already stripped, this will prevent future debugging!
WARNING: File 'usr/lib/libcgi.so' from prosrc was already stripped, this will prevent future debugging!
WARNING: QA Issue: prosrc: /prosrc/usr/sbin/chronyd is owned by uid 1000, which is the same as the user running bi
tbake. This may be due to host contamination [host-user-contaminated]
WARNING: QA Issue: /www/cgi-bin/ipfilter.cgi_prosrc contained in package prosrc requires libcgi.so, but no provide
rs found in its RDEPENDS [file-rdeps]
NOTE: Tasks Summary: Attempted 2612 tasks of which 2594 didn't need to be rerun and all succeeded.

Summary: There were 7 WARNING messages shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
build@2f192722794e:/var/m300/build_small$

關於 already-stripped 這個 error 可以參考 Yocto Project Mega-Manual

1025

雖然出現 error 但是已經產生了 image

試著 upgrade 到 M300

/usr/sbin 目錄看到了 keepalived 執行檔

試著執行 keepalived -h 看看 help

root@Mobile Router:/usr/sbin# ./keepalived -h
Usage: ./keepalived [OPTION...]
  -f, --use-file=FILE          Use the specified configuration file
  -P, --vrrp                   Only run with VRRP subsystem
  -C, --check                  Only run with Health-checker subsystem
  -l, --log-console            Log messages to local console
  -D, --log-detail             Detailed log messages
  -S, --log-facility=[0-7]     Set syslog facility to LOG_LOCAL[0-7]
  -X, --release-vips           Drop VIP on transition from signal.
  -V, --dont-release-vrrp      Don't remove VRRP VIPs and VROUTEs on daemon stop
  -I, --dont-release-ipvs      Don't remove IPVS topology on daemon stop
  -R, --dont-respawn           Don't respawn child processes
  -n, --dont-fork              Don't fork the daemon process
  -d, --dump-conf              Dump the configuration data
  -p, --pid=FILE               Use specified pidfile for parent process
  -r, --vrrp_pid=FILE          Use specified pidfile for VRRP child process
  -c, --checkers_pid=FILE      Use specified pidfile for checkers child process
  -a, --address-monitoring     Report all address additions/deletions notified via netlink
  -s, --namespace=NAME         Run in network namespace NAME (overrides config)
  -m, --core-dump              Produce core dump if terminate abnormally
  -M, --core-dump-pattern=PATN Also set /proc/sys/kernel/core_pattern to PATN (default 'core')
  -i, --config_id id           Skip any configuration lines beginning '@' that don't match id
  -v, --version                Display the version number
  -h, --help                   Display this help message

太好了... 先 commit 吧

commit a23c20d23f970f781741c5dc530830f7871f0611
Author: jeffrey <[email protected]>
Date:   Thu Jun 8 10:27:46 2017 +0800

    Add 'keepalived' recipe for 'vrrp' function

diff --git a/meta-proscend/recipes-core/prosrc/prosrc_0.1.bb b/meta-proscend/recipes-core/prosrc/prosrc_0.1.bb
index b665291..e922c70 100644
--- a/meta-proscend/recipes-core/prosrc/prosrc_0.1.bb
+++ b/meta-proscend/recipes-core/prosrc/prosrc_0.1.bb
@@ -22,7 +22,7 @@ RDEPENDS_${PN} += "GobiNet-mod"
 RDEPENDS_${PN} += "8192du-mod wireless-tools rng-tools hostapd wpa-supplicant"
 # Ethx tool
 RDEPENDS_${PN} += "ethtool"
-RDEPENDS_${PN} += "ppp ppp-oe iptables iperf dnsmasq pptp-linux bridge-utils dhcp-server dhcp-client openvpn openssl openssl-conf iproute2 iproute2-tc procps socat strongswan cryptodev-module mtd-utils mtd-utils-ubifs imx-kobs tar bzip2 jq shadow libqmi net-snmp net-snmp-server-snmpd"
+RDEPENDS_${PN} += "ppp ppp-oe iptables iperf dnsmasq pptp-linux bridge-utils dhcp-server dhcp-client openvpn openssl openssl-conf iproute2 iproute2-tc procps socat strongswan cryptodev-module mtd-utils mtd-utils-ubifs imx-kobs tar bzip2 jq shadow libqmi net-snmp net-snmp-server-snmpd keepalived"
 # ======================================

 # Build dependence
diff --git a/meta-proscend/recipes-extended/keepalived/keepalived_1.3.5.bb b/meta-proscend/recipes-extended/keepalived/keepalived_1.3.5.bb
new file mode 100644
index 0000000..86c2abe
--- /dev/null
+++ b/meta-proscend/recipes-extended/keepalived/keepalived_1.3.5.bb
@@ -0,0 +1,22 @@
+LICENSE = "GPL-2.0"
+LIC_FILES_CHKSUM = "file://${WORKDIR}/git/COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+SRC_URI = "git://github.com/acassen/keepalived.git;protocl=https;tag=v1.3.5"
+
+S = "${WORKDIR}/git"
+
+do_configure() {
+    export ac_cv_func_realloc_0_nonnull=yes
+    export ac_cv_func_malloc_0_nonnull=yes
+    ${S}/configure --host=arm
+}
+
+do_compile() {
+    oe_runmake
+}
+
+do_install() {
+    install -d ${D}${sbindir}
+    install -m 755 ${S}/bin/keepalived ${D}${sbindir}
+}
+
+

1040

回到 monkeyjj

1325

...
Build Configuration:
BB_VERSION        = "1.28.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Ubuntu-14.04"
...
ERROR: QA Issue: File '/usr/sbin/keepalived' from keepalived was already stripped, this will prevent future debugg
ing! [already-stripped]
WARNING: QA Issue: keepalived rdepends on iptables, but it isn't a build dependency? [build-deps]
WARNING: QA Issue: keepalived rdepends on libcrypto, but it isn't a build dependency? [build-deps]
WARNING: QA Issue: keepalived rdepends on libssl, but it isn't a build dependency? [build-deps]
WARNING: File 'usr/lib/libicos.so' from prosrc was already stripped, this will prevent future debugging!
WARNING: File 'usr/lib/libcgi.so' from prosrc was already stripped, this will prevent future debugging!
...

先來解因為 keepalived 產生的 3 個 WARNING

參考我們自己的 prosrc recipe - prosrc_0.1.bb

#
# PROSCEND prosrc
# By Ariel Chang
# Date: 2016/6/2
DESCRIPTION = "Proscend own source code"
SECTION = "PROSCEND"
LICENSE = "CLOSED"
...
# ==========Runtime dependence==========
...
RDEPENDS_${PN} += "ppp ppp-oe iptables iperf dnsmasq pptp-linux bridge-utils dhcp-server dhcp-client openvpn openssl openssl-conf iproute2 iproute2-tc procps socat strongswan cryptodev-module mtd-utils mtd-utils-ubifs imx-kobs tar bzip2 jq shadow libqmi net-snmp net-snmp-server-snmpd"
# ======================================
# Build dependence
DEPENDS = "json-c rp-pppoe apr libxml2 libpcap sqlite3 xz libmodbus"
...

修改 keepalived_1.3.5.bb

LICENSE = "GPL-2.0"
LIC_FILES_CHKSUM = "file://${WORKDIR}/git/COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
SRC_URI = "git://github.com/acassen/keepalived.git;protocl=https;tag=v1.3.5"

# build-time dependencies
DEPENDS = "libcrypto libssl"

# runtime dependencies
RDEPENDS_${PN} += "iptables"

S = "${WORKDIR}/git"

do_configure() {
    export ac_cv_func_realloc_0_nonnull=yes
    export ac_cv_func_malloc_0_nonnull=yes
    ${S}/configure --host=arm
}

do_compile() {
    oe_runmake
}

do_install() {
    install -d ${D}${sbindir}
    install -m 755 ${S}/bin/keepalived ${D}${sbindir}
}

1450

ariel mail 給我關於 product ID for M300 Series

Product ID for M300 Series image

照著該表格來修改 FirmwareUpgrade.sh

diff --git a/proscend/prosrc/icos/script/FirmwareUpgrade.sh b/proscend/prosrc/icos/script/FirmwareUpgrade.sh
index f111fee..b98f201 100755
--- a/proscend/prosrc/icos/script/FirmwareUpgrade.sh
+++ b/proscend/prosrc/icos/script/FirmwareUpgrade.sh
@@ -168,13 +168,82 @@ function mcsv_check {
     hw_mcsv_cccc=$(echo ${hw_mcsv} | cut -c 5-8)
     log "hardware MCSV-CCCC: ${hw_mcsv_cccc}"

-    # Reject if the Upgrade Image with different Model ID with HW MCSV
-    if [ "${sw_mcsv_mmmm}" != "${hw_mcsv_mmmm}" ]; then
-      log "Error: Model ID not match, MCSV check failed"
-      progress_fail "Error: Model ID not match, MCSV check failed"
-      exit 1
+
+
+    # +---------------------------+--------------+----------------------------------+
+    # | Model Name | Product ID   | Firmware ID  | Description                      |
+    # +------------+--------------+--------------+----------------------------------+
+    # | M300       | 0300(0x012C) | 0300(0x012C) | LTE, 1 WAN, 1 LAN                |
+    # +------------+--------------+--------------+----------------------------------+
+    # | M301       | 0301(0x012D) | 0300(0x012C) | LTE, 1 WAN, 3 LAN                |
+    # +------------+--------------+--------------+----------------------------------+
+    # | M300G      | 0310(0x0136) | 0310(0x0136) | LTE, 1 WAN, 1 LAN, GPS           |
+    # +------------+--------------+--------------+----------------------------------+
+    # | M301G      | 0311(0x0137) | 0310(0x0136) | LTE, 1 WAN, 3 LAN, GPS           |
+    # +------------+--------------+--------------+----------------------------------+
+    # | M300GW     | 0320(0x0140) | 0320(0x0140) | LTE, 1 WAN, 1 LAN, GPS, WiFi     |
+    # +------------+--------------+--------------+----------------------------------+
+    # | M301GW     | 0321(0x0141) | 0320(0x0140) | LTE, 1 WAN, 3 LAN, GPS, WiFi     |
+    # +------------+--------------+--------------+----------------------------------+
+    # | M300PG     | 0330(0x014A) | 0310(0x0136) | LTE, 1 WAN(PD), 1 LAN, GPS       |
+    # +------------+--------------+--------------+----------------------------------+
+    # | M301PG     | 0331(0x014B) | 0310(0x0136) | LTE, 1 WAN(PD), 3 LAN, GPS       |
+    # +------------+--------------+--------------+----------------------------------+
+    # | M300PGW    | 0340(0x0154) | 0320(0x0140) | LTE, 1 WAN(PD), 1 LAN, GPS, WiFi |
+    # +------------+--------------+--------------+----------------------------------+
+    # | M301PGW    | 0341(0x0155) | 0320(0x0140) | LTE, 1 WAN(PD), 3 LAN, GPS, WiFi |
+    # +------------+--------------+--------------+----------------------------------+
+    if   [ "${hw_mcsv_mmmm}" == "012C" ] || [ "${hw_mcsv_mmmm}" == "012D" ]
+    then
+      # M300/M301 can use firmware with ID 0300(0x012C)
+      if [ "${sw_mcsv_mmmm}" != "012C" ]; then
+        log "Error: Model ID not match, MCSV check failed"
+        progress_fail "Error: Model ID not match, MCSV check failed"
+        exit 1
+      fi
+    elif [ "${hw_mcsv_mmmm}" == "0136" ] || [ "${hw_mcsv_mmmm}" == "0137" ]
+    then
+      # M300G/M301G can use firmware with ID 0310(0x0136)
+      if [ "${sw_mcsv_mmmm}" != "0136" ]; then
+        log "Error: Model ID not match, MCSV check failed"
+        progress_fail "Error: Model ID not match, MCSV check failed"
+        exit 1
+      fi
+    elif [ "${hw_mcsv_mmmm}" == "0140" ] || [ "${hw_mcsv_mmmm}" == "0141" ]
+    then
+      # M300GW/M301GW can use firmware with ID 0320(0x0140)
+      if [ "${sw_mcsv_mmmm}" != "0140" ]; then
+        log "Error: Model ID not match, MCSV check failed"
+        progress_fail "Error: Model ID not match, MCSV check failed"
+        exit 1
+      fi
+    elif [ "${hw_mcsv_mmmm}" == "014A" ] || [ "${hw_mcsv_mmmm}" == "014B" ]
+    then
+      # M300PG/M301PG can use firmware with ID 0310(0x0136)
+      if [ "${sw_mcsv_mmmm}" != "0136" ]; then
+        log "Error: Model ID not match, MCSV check failed"
+        progress_fail "Error: Model ID not match, MCSV check failed"
+        exit 1
+      fi
+    elif [ "${hw_mcsv_mmmm}" == "0154" ] || [ "${hw_mcsv_mmmm}" == "0155" ]
+    then
+      # M300PGW/M301PGW can use firmware with ID 0320(0x0140)
+      if [ "${sw_mcsv_mmmm}" != "0140" ]; then
+        log "Error: Model ID not match, MCSV check failed"
+        progress_fail "Error: Model ID not match, MCSV check failed"
+        exit 1
+      fi
+    else
+      # Default check - Reject if the Upgrade Image with different Model ID with HW MCSV
+      if [ "${sw_mcsv_mmmm}" != "${hw_mcsv_mmmm}" ]; then
+        log "Error: Model ID not match, MCSV check failed"
+        progress_fail "Error: Model ID not match, MCSV check failed"
+        exit 1
+      fi
     fi

+
+
     # - If HW MCSV<A1><A6>s and SW MCSV<A1><A6>s custom ID=0000/0001 (i.e. Proscend)
     #   - allow to upgrade the image with all custom ID
     # - If HW MCSV<A1><A6>s custom ID=0000/0001 (i.e. Proscend) and SW MCSV<A1><A6>s custom ID!=0000/0001

上 code 吧

➜  script git:(release/v1.50) git push
...

切回 feature branch feature/vrrp

➜  script git:(release/v1.50) git checkout feature/vrrp
Switched to branch 'feature/vrrp'
➜  script git:(feature/vrrp)
⚠️ **GitHub.com Fallback** ⚠️