diff options
-rw-r--r-- | recipes-core/images/mlinux-factory-image.bb | 2 | ||||
-rw-r--r-- | recipes-core/images/mlinux-factory-test-image.bb | 2 | ||||
-rw-r--r-- | recipes-core/images/mlinux-minimal-image.bb | 2 | ||||
-rw-r--r-- | recipes-core/images/mlinux-mtcap-image.bb | 2 | ||||
-rw-r--r-- | recipes-core/images/mlinux-mtcap-test-image.bb | 6 | ||||
-rw-r--r-- | recipes-core/images/mlinux-mtr-image.bb | 8 | ||||
-rw-r--r-- | recipes-core/images/mlinux-mtrv1-image.bb | 2 | ||||
-rw-r--r-- | recipes-core/images/mlinux-rs9113-mtrv1-image.bb | 23 | ||||
-rwxr-xr-x | scripts/build-feed-extras.sh | 2 | ||||
-rwxr-xr-x | scripts/telit_radio_upgrade.sh | 181 |
10 files changed, 215 insertions, 15 deletions
diff --git a/recipes-core/images/mlinux-factory-image.bb b/recipes-core/images/mlinux-factory-image.bb index 49cab1f..19134c1 100644 --- a/recipes-core/images/mlinux-factory-image.bb +++ b/recipes-core/images/mlinux-factory-image.bb @@ -89,6 +89,6 @@ IMAGE_INSTALL_append = " pps-tools" IMAGE_INSTALL_append = " dnsmasq bluez5-pand bluez5-rfcomm" # When ntp is to use the GPS, gps-utils is required -IMAGE_INSTALL_append = " gpsd libgps ntp ntp-utils gpspipe gps-utils" +IMAGE_INSTALL_append = " gpsd gpsd-conf gpsd-gpsctl libgps ntp ntp-utils gpspipe gps-utils" IMAGE_INSTALL_append = " uxfp uvccapture" diff --git a/recipes-core/images/mlinux-factory-test-image.bb b/recipes-core/images/mlinux-factory-test-image.bb index e517734..e4d968c 100644 --- a/recipes-core/images/mlinux-factory-test-image.bb +++ b/recipes-core/images/mlinux-factory-test-image.bb @@ -3,6 +3,6 @@ LICENSE = "MIT" require mlinux-rs9113-factory-image.bb -IMAGE_INSTALL_append = " strace i2c-tools spitools devmem2" +IMAGE_INSTALL_append = " strace i2c-tools spitools devmem2 socat" #Open console for testing CONSOLE = "sysvinit-inittab-start-open" diff --git a/recipes-core/images/mlinux-minimal-image.bb b/recipes-core/images/mlinux-minimal-image.bb index d10210f..890b2ae 100644 --- a/recipes-core/images/mlinux-minimal-image.bb +++ b/recipes-core/images/mlinux-minimal-image.bb @@ -20,7 +20,7 @@ CORE_FEATURES_append = " \ bash procps \ openssh-sftp-server \ util-linux-mount util-linux-umount \ - start-stop-daemon \ + dpkg-start-stop \ sudo \ ${CORE_IMAGE_EXTRA_INSTALL} \ mlinux-feed-configs \ diff --git a/recipes-core/images/mlinux-mtcap-image.bb b/recipes-core/images/mlinux-mtcap-image.bb index 3fe349c..c298a86 100644 --- a/recipes-core/images/mlinux-mtcap-image.bb +++ b/recipes-core/images/mlinux-mtcap-image.bb @@ -63,7 +63,7 @@ IMAGE_INSTALL_append = " \ MISC_FEATURES = "minicom lrzsz nano uxfp" # Extra stuff to install -IMAGE_INSTALL_append = " gpsd libgps libgps24 ntp ntp-utils gpspipe gps-utils" +IMAGE_INSTALL_append = " gpsd gpsd-conf gpsd-gpsctl libgps ntp ntp-utils gpspipe gps-utils" IMAGE_INSTALL_append = " \ ${FILESYSTEM_FEATURES} \ diff --git a/recipes-core/images/mlinux-mtcap-test-image.bb b/recipes-core/images/mlinux-mtcap-test-image.bb index 57808cf..c2b83bb 100644 --- a/recipes-core/images/mlinux-mtcap-test-image.bb +++ b/recipes-core/images/mlinux-mtcap-test-image.bb @@ -13,6 +13,8 @@ IMAGE_INSTALL += "i2c-tools \ spitools \ strace \ devmem2 \ + battd-ml \ + socat \ " FILESYSTEM_FEATURES = "dosfstools \ @@ -76,6 +78,10 @@ MISC_FEATURES = "minicom lrzsz nano uxfp" # Someday add wifi features # ${WIFI_FEATURES} # +IMAGE_INSTALL_append = " gpsd gpsd-conf gpsd-gpsctl libgps ntp ntp-utils gpspipe gps-utils" + +IMAGE_INSTALL_append = " pps-tools" + IMAGE_INSTALL += " \ ${FILESYSTEM_FEATURES} \ ${TIME_FEATURES} \ diff --git a/recipes-core/images/mlinux-mtr-image.bb b/recipes-core/images/mlinux-mtr-image.bb index baa2aef..863e63d 100644 --- a/recipes-core/images/mlinux-mtr-image.bb +++ b/recipes-core/images/mlinux-mtr-image.bb @@ -3,6 +3,7 @@ DESCRIPTION = "mLinux base mtr image" LICENSE = "MIT" require mlinux-minimal-image.bb +MULTITECH_MTAC = "" CONSOLE = "sysvinit-inittab-start-open" @@ -18,6 +19,7 @@ FILESYSTEM_FEATURES = "dosfstools \ " NETWORKING_FEATURES_append = " bridge-utils \ + dnsmasq \ inetutils-ftp \ openssl \ rsync \ @@ -38,7 +40,7 @@ WIFI_FEATURES = " \ hostapd-cfg \ " -BLUETOOTH_FEATURES = "bluez5" +BLUETOOTH_FEATURES = "bluez5 bluez5-pand" # Add all timezones available # ntpdate will sync time every 30 min by default via cron @@ -66,6 +68,10 @@ MULTITECH_FEATURES_append = " \ MISC_FEATURES = "minicom lrzsz nano" # Extra stuff to install +IMAGE_INSTALL_append = " ti-wifi-utils wl12xx-firmware" +IMAGE_INSTALL_append = " gpsd gpsd-conf gpsd-gpsctl libgps ntp ntp-utils gpspipe gps-utils" +IMAGE_INSTALL_append = " uxfp" + IMAGE_INSTALL_append = " \ ${TEST_FEATURES} \ ${WIFI_FEATURES} \ diff --git a/recipes-core/images/mlinux-mtrv1-image.bb b/recipes-core/images/mlinux-mtrv1-image.bb index f72eb2d..15d7c0f 100644 --- a/recipes-core/images/mlinux-mtrv1-image.bb +++ b/recipes-core/images/mlinux-mtrv1-image.bb @@ -67,7 +67,7 @@ MISC_FEATURES = "minicom lrzsz nano pps-tools" # Extra stuff to install IMAGE_INSTALL_append = " kernel-module-rs9113 rs9113-util rs9113-autostart" -IMAGE_INSTALL_append = " gpsd libgps libgps24 ntp ntp-utils gpspipe gps-utils" +IMAGE_INSTALL_append = " gpsd gpsd-conf gpsd-gpsctl libgps ntp ntp-utils gpspipe gps-utils" IMAGE_INSTALL_append = " \ ${TEST_FEATURES} \ diff --git a/recipes-core/images/mlinux-rs9113-mtrv1-image.bb b/recipes-core/images/mlinux-rs9113-mtrv1-image.bb index da5632c..4d6e452 100644 --- a/recipes-core/images/mlinux-rs9113-mtrv1-image.bb +++ b/recipes-core/images/mlinux-rs9113-mtrv1-image.bb @@ -5,17 +5,24 @@ LICENSE = "MIT" require mlinux-minimal-image.bb MULTITECH_MTAC = "" +CONSOLE = "sysvinit-inittab-start-open" + +TEST_FEATURES = "i2c-tools \ + spitools \ + strace \ + devmem2 \ + " + FILESYSTEM_FEATURES = "dosfstools \ cifs-utils \ lsof \ " -NETWORKING_FEATURES += "bridge-utils \ +NETWORKING_FEATURES_append = " bridge-utils \ dnsmasq \ inetutils-ftp \ openssl \ rsync \ - iperf2 \ iperf3 \ mii-diag \ tcpdump \ @@ -50,7 +57,7 @@ TIME_FEATURES = "tzdata tzdata-africa tzdata-americas tzdata-antarctica tzdata-a # radio-cmd: supports cellular radio activation and other configuration commands # radio-query: queries cellular radio for common info (IMEI, RSSI, etc) # jsparser: command line tool to parse JSON files -MULTITECH_FEATURES += " \ +MULTITECH_FEATURES_append = " \ u-boot-linux-utils \ mlinux-scripts \ reset-handler \ @@ -61,12 +68,12 @@ MULTITECH_FEATURES += " \ MISC_FEATURES = "minicom lrzsz nano pps-tools" # Extra stuff to install -IMAGE_INSTALL += "kernel-module-rs9113 rs9113rf rs9113-util rs9113-utils-extra rs9113-misc rs9113-autostart" -IMAGE_INSTALL += "gpsd libgps libgps24 ntp ntp-utils gpspipe gps-utils" -IMAGE_INSTALL += "uxfp" -CONSOLE = "sysvinit-inittab-start-open" +IMAGE_INSTALL_append = " kernel-module-rs9113 rs9113rf rs9113-util rs9113-utils-extra rs9113-misc rs9113-autostart" +IMAGE_INSTALL_append = " gpsd gpsd-conf gpsd-gpsctl libgps ntp ntp-utils gpspipe gps-utils" +IMAGE_INSTALL_append = " uxfp" -IMAGE_INSTALL += " \ +IMAGE_INSTALL_append = " \ + ${TEST_FEATURES} \ ${WIFI_FEATURES} \ ${BLUETOOTH_FEATURES} \ ${FILESYSTEM_FEATURES} \ diff --git a/scripts/build-feed-extras.sh b/scripts/build-feed-extras.sh index 99b9e40..23fa803 100755 --- a/scripts/build-feed-extras.sh +++ b/scripts/build-feed-extras.sh @@ -6,6 +6,6 @@ NET_PACKAGES="wget netcat ipsec-tools openvpn iftop dnsmasq strongswan stunnel t RS9113TEST_PACKAGES="config-wifi-bt-ap rs9113rf" UTIL_PACKAGES="logrotate fatrace stressapptest gawk rsyslog zip gnupg rrdtool i2c-tools spitools memtester" DEV_PACKAGES="strace mono gdb git vim python-pip python3-pip python-pyopenssl python-pygobject openjdk-8 strace python-gatt-server python-cryptography" -SUP_PACKAGES="pps-tools setserial boost diffutils postgresql devmem2" +SUP_PACKAGES="pps-tools setserial boost diffutils postgresql devmem2 gpsd-test softdog-mon" bitbake linux-firmware $FS_PACKAGES $NET_PACKAGES $UTIL_PACKAGES $DEV_PACKAGES $SUP_PACKAGES $RS9113TEST_PACKAGES diff --git a/scripts/telit_radio_upgrade.sh b/scripts/telit_radio_upgrade.sh new file mode 100755 index 0000000..6073768 --- /dev/null +++ b/scripts/telit_radio_upgrade.sh @@ -0,0 +1,181 @@ +#!/bin/bash +###################################################################################### +# Definition of global constants. +###################################################################################### +# "Firmware check"-compatible error codes +ERROR_BAD_ARGS=91 +COMPONENT_NAME="radio_fw_upgrade" + +###################################################################################### + +function loginfo() { logger -s -p info -t $COMPONENT_NAME "$@" 1>&2 ; } +function logwarn() { logger -s -p warning -t $COMPONENT_NAME "$@" 1>&2 ; } +function logerror() { logger -s -p error -t $COMPONENT_NAME "$@" 1>&2 ; } + +###################################################################################### + +###################################################################################### +# Print current radio firmware upgrade status and exit the application immediately. +# Globals: +# COMPONENT_NAME - name of the component. +# Arguments: +# $1 - exit code for this application. +# Returns: +# None (exits the application) +###################################################################################### +function exitnow() { + loginfo "Radio firmware upgrade procedure exited with exit code [$1]" + #next_state "$UPGRADE_STATE_FINISHED" + exit "$1" +} + +###################################################################################### +# Parse command-line arguments for this application. +# Globals: +# FW_IMAGE_PATH - write-only, path to the upgrade image. +# Arguments: +# $@ - all command-line arguments of this application. +# Returns: +# 0 on success, 1 otherwise +###################################################################################### +function parse_arguments() { + if [ $# != 1 ]; then + logerror "Invalid number of arguments" + return 1 + fi + + if [ ! -f "$1" ]; then + logerror "Firmware file [$1] does not exist" + return 1 + fi + + FW_IMAGE_PATH="$1" + return 0 +} +###################################################################################### +# Determine TTY flash port for Telit radios. +# Logic ported from telit_flash. +# Globals: +# TELIT_FLASH_TTY - write-only, TTY port for flashing Telit radios +# Arguments: +# None +# Returns: +# 0 on success, 1 otherwise +###################################################################################### +function select_telit_flash_tty() { + loginfo "Setting up for LoRa USB card checks" + + # Check for LoRa USB cards. Depending on how many there are inserted, use + # ttyUSB0 or ttyUSB1 or ttyUSB2 + local port1=/sys/devices/platform/mts-io/ap1 + local port2=/sys/devices/platform/mts-io/ap2 + local hwversion="MTAC-LORA-1.0" + local lora_usb_count=0 + local usbtty + + loginfo "Checking for LoRa USB cards in AP1 and AP2" + + if [ -d $port1 ] && [[ $(cat $port1/hw-version) = $hwversion ]]; then + loginfo "Found USB LoRa card on AP1" + lora_usb_count=$((lora_usb_count + 1)) + loginfo "incremented lora_usb_count" + fi + loginfo "Past check on AP1" + if [ -d $port2 ] && [[ $(cat $port2/hw-version) = $hwversion ]]; then + loginfo "Found USB LoRa card on AP2" + lora_usb_count=$((lora_usb_count + 1)) + fi + loginfo "Past check on AP2" + + loginfo "lora_usb_count = $lora_usb_count" + + case $lora_usb_count in + 0) + usbtty="/dev/ttyUSB0" + ;; + 1) + usbtty="/dev/ttyUSB1" + ;; + 2) + usbtty="/dev/ttyUSB2" + ;; + *) + # maybe this should just bail here? + usbtty="/dev/ttyUSB0" + ;; + esac; + + loginfo "usbtty = $usbtty" + TELIT_FLASH_TTY="$usbtty" + + return 0 +} +###################################################################################### +# Flash telit device using uxfp utility. +# Logic ported from l4e1_flash. +# Globals: +# FW_IMAGE_PATH - read-only, path to the firmware image. +# TELIT_FLASH_TTY - read-only, TTY port for flashing Telit radios. +# UXFP_OPTIONS - read-only, options for uxfp flashing utility. +# Arguments: +# None +# Returns: +# 0 on success, 1 otherwise +###################################################################################### +function telit_flash_uxfp() { + if ! select_telit_flash_tty; then + logerror "Flashing radio modem failed" + return 1 + fi + + # cycle power to get module into boot mode + # this needs to be run in the background so the flashing can start + # as soon as the module is in boot mode + loginfo "Resetting radio modem" + + ## INFO: -1: ignore backoff timers in radio-reset + echo -1 >/sys/devices/platform/mts-io/radio-reset & + + # start flashing + loginfo "Starting flashing radio modem" + + ## INFO: We must catch up to the interface ttyUSBx (flashloader converter) before disconnected + local COUNTER=0 + local MAX=120 + + while [ $COUNTER -lt $MAX ]; do + loginfo "Flash Attempt $COUNTER" + + # Start uxfp and log to its output to syslog + if [ -c "$TELIT_FLASH_TTY" ] && uxfp --file "$FW_IMAGE_PATH" --port "$TELIT_FLASH_TTY" --debug; then + loginfo "Flashing radio modem successful, restarting telit module" + echo -1 >/sys/devices/platform/mts-io/radio-reset + loginfo "Done" + return 0 + fi + COUNTER=$((COUNTER+1)) + sleep 0.1 + done + + logerror "Flashing radio modem failed" + return 1 +} + + +###################################################################################### +# MAIN +###################################################################################### + +if ! parse_arguments "$@"; then + echo "I am here" + logerror "Usage: $0 <firmware_file>" + exitnow $ERROR_BAD_ARGS +fi + +function do_upgrade() { + local _RET=1 + telit_flash_uxfp >&2 + _RET=$? +} + +do_upgrade |