diff options
10 files changed, 119 insertions, 19 deletions
diff --git a/classes/mlinux-image.bbclass b/classes/mlinux-image.bbclass index 3f49a94..13cacb5 100644 --- a/classes/mlinux-image.bbclass +++ b/classes/mlinux-image.bbclass @@ -12,6 +12,24 @@ mlinux_set_root_password () { } ROOTFS_POSTPROCESS_COMMAND += "mlinux_set_root_password;" +# set custom product sw version to /etc/issue file if $FIRMWARE_PRODUCT_VER is set +mlinux_set_product_version () { + if [ -n "${FIRMWARE_PRODUCT_VER}" ]; then + # set issue + if cat ${IMAGE_ROOTFS}/etc/issue | grep "Version: " > /dev/null 2>&1 ; then + # replace + sed -i "s/^Version: .*$/Version: $FIRMWARE_PRODUCT_VER/g" ${IMAGE_ROOTFS}/etc/issue + sed -i "s/^Date: .*$/Date: $FIRMWARE_PRODUCT_DATE/g" ${IMAGE_ROOTFS}/etc/issue + else + # add + echo "" >> ${IMAGE_ROOTFS}/etc/issue + echo "Version: ${FIRMWARE_PRODUCT_VER}" >> ${IMAGE_ROOTFS}/etc/issue + echo "Date: $(date +%Y-%m-%dT%H:%M:%S)" >> ${IMAGE_ROOTFS}/etc/issue + fi + fi +} +ROOTFS_POSTPROCESS_COMMAND += "mlinux_set_product_version;" + # generate upgrade.bin files -- provides single file for upgrades do_firmware () { cd ${DEPLOY_DIR_IMAGE} diff --git a/recipes-connectivity/lora/lora-gateway/ln-lora-spi-dev.sh b/recipes-connectivity/lora/lora-gateway/ln-lora-spi-dev.sh new file mode 100644 index 0000000..c350fff --- /dev/null +++ b/recipes-connectivity/lora/lora-gateway/ln-lora-spi-dev.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +port1=/sys/devices/platform/mts-io/ap1 +port2=/sys/devices/platform/mts-io/ap2 + +lora_hw=$(mts-io-sysfs show lora/hw-version 2> /dev/null) + +if [ -d $port1 ] && [[ $(cat $port1/hw-version) = $lora_hw ]]; then + ln -sf /dev/spidev32766.2 /dev/spidev0.0 +elif [ -d $port2 ] && [[ $(cat $port2/hw-version) = $lora_hw ]]; then + ln -sf /dev/spidev32765.2 /dev/spidev0.0 +fi diff --git a/recipes-connectivity/lora/lora-gateway_4.0.1.bb b/recipes-connectivity/lora/lora-gateway_4.0.1.bb index e353670..7eac73e 100644 --- a/recipes-connectivity/lora/lora-gateway_4.0.1.bb +++ b/recipes-connectivity/lora/lora-gateway_4.0.1.bb @@ -6,13 +6,14 @@ SECTION = "console/utils" LICENSE = "SEMTECH" LIC_FILES_CHKSUM = "file://LICENSE;md5=a2bdef95625509f821ba00460e3ae0eb" DEPENDS = "" -PR = "r5" +PR = "r6" SRCREV = "v${PV}" SRC_URI = "git://github.com/Lora-net/lora_gateway.git;protocol=git \ file://lora-gateway-add-fpga-version-28.patch \ file://library_4.0.cfg \ file://lora-gateway-add-spi-path-function.patch \ + file://ln-lora-spi-dev.sh \ " SRC_URI[md5sum] = "9e06a3733a9fea39a3d61f77b412badf" @@ -37,7 +38,10 @@ do_install() { install -m 0644 libloragw/libloragw.a ${D}${libdir}/lora install -m 0644 libloragw/library.cfg ${D}${libdir}/lora install -m 0644 libloragw/inc/* ${D}${includedir}/lora - install -m 0644 libloragw/readme.md ${D}${libdir}/lora + install -m 0644 libloragw/readme.md ${D}${libdir}/lora/lora-gw-readme.md + + install -d ${D}/opt/lora/ + install -m 0755 ${WORKDIR}/ln-lora-spi-dev.sh ${D}/opt/lora/ install -d ${D}/opt/lora/gateway-utils install -m 0755 libloragw/test_* ${D}/opt/lora/gateway-utils/ @@ -50,8 +54,9 @@ do_install() { PACKAGES += "${PN}-utils ${PN}-utils-dbg" -FILES_${PN}-utils = "/opt/lora/gateway-utils/*" -FILES_${PN}-utils-dbg = "/opt/lora/gateway-utils/.debug" +FILES_${PN} = "${libdir}/lora/lora-gw-readme.md" +FILES_${PN}-utils = "/opt/lora/gateway-utils/* /opt/lora/ln-lora-spi-dev.sh" +FILES_${PN}-utils-dbg = "/opt/lora/gateway-utils/.debug /opt/lora/ln-lora-spi-dev.sh" FILES_${PN}-dev = "${includedir}/lora ${libdir}/lora/library.cfg" FILES_${PN}-staticdev = "${libdir}/lora/libloragw.a" diff --git a/recipes-connectivity/lora/lora-network-server/lora-network-server.init b/recipes-connectivity/lora/lora-network-server/lora-network-server.init index 7a72b34..75b753c 100755 --- a/recipes-connectivity/lora/lora-network-server/lora-network-server.init +++ b/recipes-connectivity/lora/lora-network-server/lora-network-server.init @@ -30,9 +30,8 @@ port2=/sys/devices/platform/mts-io/ap2 lora_us_id="MTAC-LORA-915" lora_eu_id="MTAC-LORA-868" -lora_usb_hw="MTAC-LORA-1.0" -lora_spi_hw="MTAC-LORA-1.1" -lora_h_hw="MTAC-LORA-1.5" +lora_1_0_hw="MTAC-LORA-1.0" +lora_1_5_h_hw="MTAC-LORA-1.5" read_card_info() { @@ -52,13 +51,13 @@ card_found() { ln -sf /dev/spidev32765.2 /dev/spidev0.0 fi - if [ "$lora_id" = "$lora_us_id" ] || [ "$lora_id" = "$lora_eu_id" ]; then - if [ "$lora_hw" = "$lora_spi_hw" ] || [ "$lora_hw" = "$lora_h_hw" ]; then - ln -sf /opt/lora/lora_pkt_fwd $pkt_fwd - return 0 - elif [ "$lora_hw" = "$lora_usb_hw" ]; then + if [[ "$lora_id" =~ "$lora_us_id" ]] || [[ "$lora_id" =~ "$lora_eu_id" ]]; then + if [ "$lora_hw" = "$lora_hw" ] && [[ ! "$lora_id" =~ .*-SPI ]]; then ln -sf /opt/lora/basic_pkt_fwd-usb $pkt_fwd return 0 + elif [ "$lora_hw" = "$lora_1_0_hw" ] || [ "$lora_hw" = "$lora_1_5_h_hw" ]; then + ln -sf /opt/lora/lora_pkt_fwd $pkt_fwd + return 0 else return 1 fi diff --git a/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb b/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb index 8042d50..3f5be37 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb +++ b/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb @@ -38,9 +38,10 @@ do_install() { install -m 755 ${WORKDIR}/global_conf.json.3.0.0.PCB_E336.EU868.basic.clksrc0 ${D}${LORA_DIR}/global_conf.json install -m 755 ${WORKDIR}/local_conf.json ${D}${LORA_DIR}/ - install -m 755 util_sink/util_sink ${D}${LORA_DIR}/ - install -m 755 util_ack/util_ack ${D}${LORA_DIR}/ - install -m 755 util_tx_test/util_tx_test ${D}${LORA_DIR}/ + install -d ${D}${LORA_DIR}/forwarder-utils + install -m 755 util_sink/util_sink ${D}${LORA_DIR}/forwarder-utils/ + install -m 755 util_ack/util_ack ${D}${LORA_DIR}/forwarder-utils/ + install -m 755 util_tx_test/util_tx_test ${D}${LORA_DIR}/forwarder-utils/ install -m 755 ${WORKDIR}/README.md ${D}${LORA_DIR}/ } @@ -52,7 +53,7 @@ do_install_append_mtp() { } FILES_${PN} += "${LORA_DIR}" -FILES_${PN}-dbg += "${LORA_DIR}/.debug" +FILES_${PN}-dbg += "${LORA_DIR}/.debug ${LORA_DIR}/forwarder-utils/.debug" # disable this on purpose for dev purposes do_rm_work() { diff --git a/recipes-connectivity/ppp/ppp-2.4.7/ip-up b/recipes-connectivity/ppp/ppp-2.4.7/ip-up index fc2fae9..b78e688 100755 --- a/recipes-connectivity/ppp/ppp-2.4.7/ip-up +++ b/recipes-connectivity/ppp/ppp-2.4.7/ip-up @@ -41,4 +41,9 @@ export PPP_TTYNAME run-parts /etc/ppp/ip-up.d +# save timestamp +linkuptime=$(cat /proc/uptime) +linkuptime=${linkuptime%%.*} +echo "$linkuptime" > /var/run/pppisup-$PPP_IFACE.sec + # last line diff --git a/recipes-connectivity/ppp/ppp_2.4.7.bb b/recipes-connectivity/ppp/ppp_2.4.7.bb index 8a94318..881c40e 100644 --- a/recipes-connectivity/ppp/ppp_2.4.7.bb +++ b/recipes-connectivity/ppp/ppp_2.4.7.bb @@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://pppd/ccp.c;beginline=1;endline=29;md5=e2c43fe6e81ff77 file://pppd/plugins/passprompt.c;beginline=1;endline=10;md5=3bcbcdbf0e369c9a3e0b8c8275b065d8 \ file://pppd/tdb.c;beginline=1;endline=27;md5=4ca3a9991b011038d085d6675ae7c4e6 \ file://chat/chat.c;beginline=1;endline=15;md5=0d374b8545ee5c62d7aff1acbd38add2" -PR = "r7" +PR = "r8" SRC_URI = "http://ppp.samba.org/ftp/ppp/ppp-${PV}.tar.gz \ file://makefile.patch \ diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.0.inc b/recipes-core/mlinux-scripts/mlinux-scripts-1.0.inc index fd75904..979fc4c 100644 --- a/recipes-core/mlinux-scripts/mlinux-scripts-1.0.inc +++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.0.inc @@ -6,7 +6,9 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda SRC_URI = "file://mlinux-wifi-ap \ file://mlinux-dhcpd \ file://mlinux-set-apn \ - file://mlinux-cell-router" + file://mlinux-cell-router \ + file://mlinux-firmware-upgrade \ +" do_install() { @@ -15,4 +17,5 @@ do_install() { install -m 755 ${WORKDIR}/mlinux-dhcpd ${D}${sbindir} install -m 755 ${WORKDIR}/mlinux-set-apn ${D}${sbindir} install -m 755 ${WORKDIR}/mlinux-cell-router ${D}${sbindir} + install -m 755 ${WORKDIR}/mlinux-firmware-upgrade ${D}${sbindir} } diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.0/mlinux-firmware-upgrade b/recipes-core/mlinux-scripts/mlinux-scripts-1.0/mlinux-firmware-upgrade new file mode 100755 index 0000000..94027d5 --- /dev/null +++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.0/mlinux-firmware-upgrade @@ -0,0 +1,57 @@ +#!/bin/bash + +if [ $# != 1 ]; then + echo "Usage: $0 upgrade.bin" + exit 1 +fi + +set -e +upgrade=$1 + +mkdir -p /var/volatile +cd /var/volatile + +# make sure firmware is for this device +hw_version=$(cat /sys/devices/platform/mts-io/hw-version) +firmware_model=$(tar -xO -f $upgrade model) +shopt -s nocasematch +if [[ ! "$hw_version" =~ ^$firmware_model- ]]; then + logger -s -t firmware_upgrade "Wrong firmware for this hardware" + logger -s -t firmware_upgrade "hw version: $hw_version" + logger -s -t firmware_upgrade "firmware model: $firmware_model" + exit 1 +fi + +files=(bstrap.bin uboot.bin uImage.bin config.jffs2 oem.jffs2 rootfs.jffs2) + +tobeflashed=0 +# verify all MD5 sums +for (( i = 0; i < ${#files[@]}; i++ )); do + file=${files[i]} + # if the file is in the tar, md5sum it + if tar -t -f $upgrade | grep -F -q "$file"; then + logger -s -t firmware_upgrade "Checking MD5 for $file..." + if ! tar -x -f $upgrade $file.md5; then + logger -s -t firmware_upgrade "MD5 is not found for the $file, upgrade aborted" + exit 1 + fi + if ! tar -xO -f $upgrade $file | md5sum -c $file.md5; then + logger -s -t firmware_upgrade "MD5 check failed, upgrade aborted" + exit 1 + fi + tobeflashed=1 + fi +done + +if (( $tobeflashed )); then + mkdir -p /var/volatile/flash-upgrade + mv -f $upgrade /var/volatile/flash-upgrade/upgrade.bin + touch /var/volatile/do_flash_upgrade + logger -s -t firmware_upgrade "Rebooting" + sleep 1 + reboot + exit 0 +else + logger -s -t firmware_upgrade "Nothing to be flashed!" + exit 1 +fi diff --git a/recipes-core/mlinux-scripts/mlinux-scripts_1.0.bb b/recipes-core/mlinux-scripts/mlinux-scripts_1.0.bb index 6b0d37f..9fb8fbd 100644 --- a/recipes-core/mlinux-scripts/mlinux-scripts_1.0.bb +++ b/recipes-core/mlinux-scripts/mlinux-scripts_1.0.bb @@ -2,6 +2,6 @@ DESCRIPTION = "Scripts to easily get started with common mLinux use cases" require mlinux-scripts-1.0.inc -PR = "r4" +PR = "r5" S = "${WORKDIR}/mlinux-scripts-${PV}" |