diff --git a/README.md b/README.md index 924129067..54ab606b4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Digi Embedded Yocto (DEY) 2.0 -## Release 2.0-r4 +## Release 2.0-r5 This document provides information about Digi Embedded Yocto, Digi International's professional embedded Yocto development environment. @@ -64,6 +64,10 @@ Documentation is available online on the Digi documentation site: # Release Changelog +## 2.0-r5 + +* TBC + ## 2.0-r4 * Digi ConnectCore 6UL diff --git a/meta-digi-arm/classes/image_types_digi.bbclass b/meta-digi-arm/classes/image_types_digi.bbclass index 03dfd64e7..3210922b6 100644 --- a/meta-digi-arm/classes/image_types_digi.bbclass +++ b/meta-digi-arm/classes/image_types_digi.bbclass @@ -124,17 +124,76 @@ IMAGE_CMD_boot.ubifs() { rm -rf ${TMP_BOOTDIR} } -IMAGE_CMD_rootfs.initramfs() { +IMAGE_DEPENDS_recovery.vfat = "${RECOVERY_INITRAMFS_IMAGE}:do_rootfs" + +# The recovery vfat image requires the boot image to be built before +IMAGE_TYPEDEP_recovery.vfat = "${SDIMG_BOOTFS_TYPE}" + +IMAGE_CMD_recovery.vfat() { # - # Image generation code for image type 'rootfs.initramfs' + # Image generation code for image type 'recovery.vfat' # - mkimage -A ${TARGET_ARCH} -O linux -T ramdisk -C none -n ${IMAGE_NAME} -d ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.gz ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.initramfs + # Copy the boot.vfat image + cp ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.boot.vfat ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.recovery.vfat + + # Copy the recovery init script into the VFAT image + mcopy -o -i ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.recovery.vfat -s ${DEPLOY_DIR_IMAGE}/recovery.scr ::/boot.scr + + # Copy the recovery ramdisk into the VFAT image + mcopy -i ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.recovery.vfat -s ${DEPLOY_DIR_IMAGE}/${RECOVERY_INITRAMFS_IMAGE}-${MACHINE}.cpio.gz.u-boot.tf ::/uramdisk-recovery.img + # Create the symlink - if [ -n "${IMAGE_LINK_NAME}" ] && [ -e ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.initramfs ]; then - ln -s ${IMAGE_NAME}.rootfs.initramfs ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.initramfs + if [ -n "${IMAGE_LINK_NAME}" ] && [ -e ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.recovery.vfat ]; then + ln -s ${IMAGE_NAME}.recovery.vfat ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.recovery.vfat fi } -IMAGE_TYPEDEP_rootfs.initramfs = "cpio.gz" + +IMAGE_DEPENDS_recovery.ubifs = " \ + mtd-utils-native:do_populate_sysroot \ + u-boot:do_deploy \ + virtual/kernel:do_deploy \ + ${RECOVERY_INITRAMFS_IMAGE}:do_rootfs \ +" + +IMAGE_CMD_recovery.ubifs() { + # + # Image generation code for image type 'recovery.ubifs' + # + RECOVERYIMG_FILES_SYMLINK="${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${MACHINE}.bin" + if [ -n "${KERNEL_DEVICETREE}" ]; then + for DTB in ${KERNEL_DEVICETREE}; do + if [ -e "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB}" ]; then + RECOVERYIMG_FILES_SYMLINK="${RECOVERYIMG_FILES_SYMLINK} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB}" + fi + done + fi + + # Create temporary folder + TMP_RECOVERYDIR="$(mktemp -d ${DEPLOY_DIR_IMAGE}/recovery.XXXXXX)" + + # Hard-link RECOVERYIMG_FILES into the temporary folder with the symlink filename + for item in ${RECOVERYIMG_FILES_SYMLINK}; do + orig="$(readlink -e ${item})" + ln ${orig} ${TMP_RECOVERYDIR}/$(basename ${item}) + done + + # Copy the recovery init script. + cp ${DEPLOY_DIR_IMAGE}/recovery.scr ${TMP_RECOVERYDIR}/boot.scr + + # Copy the recovery ramdisk image. + cp ${DEPLOY_DIR_IMAGE}/${RECOVERY_INITRAMFS_IMAGE}-${MACHINE}.cpio.gz.u-boot.tf ${TMP_RECOVERYDIR}/uramdisk-recovery.img + + # Build UBIFS boot image out of temp folder + mkfs.ubifs -r ${TMP_RECOVERYDIR} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.recovery.ubifs ${MKUBIFS_BOOT_ARGS} + + # Create the symlink + if [ -n "${IMAGE_LINK_NAME}" ] && [ -e ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.recovery.ubifs ]; then + ln -s ${IMAGE_NAME}.recovery.ubifs ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.recovery.ubifs + fi + + # Remove the temporary folder + rm -rf ${TMP_RECOVERYDIR} +} IMAGE_CMD_cpio.gz.u-boot.tf() { # diff --git a/meta-digi-arm/conf/machine/ccimx6sbc.conf b/meta-digi-arm/conf/machine/ccimx6sbc.conf index 4b70319bb..38d494206 100644 --- a/meta-digi-arm/conf/machine/ccimx6sbc.conf +++ b/meta-digi-arm/conf/machine/ccimx6sbc.conf @@ -36,4 +36,4 @@ BT_TTY ?= "ttymxc1" BOOT_SCRIPTS = "boot.scr:boot.scr" # Flash image types -IMAGE_FSTYPES ?= "boot.vfat ext4 sdcard tar.bz2" +IMAGE_FSTYPES ?= "boot.vfat ext4 sdcard tar.bz2 recovery.vfat" diff --git a/meta-digi-arm/conf/machine/ccimx6ulsbc.conf b/meta-digi-arm/conf/machine/ccimx6ulsbc.conf index cefca191a..eb03ffb63 100644 --- a/meta-digi-arm/conf/machine/ccimx6ulsbc.conf +++ b/meta-digi-arm/conf/machine/ccimx6ulsbc.conf @@ -27,4 +27,4 @@ BT_TTY ?= "ttymxc0" BOOT_SCRIPTS = "boot.scr:boot.scr" # Flash image types -IMAGE_FSTYPES ?= "tar.bz2 ubifs boot.ubifs" +IMAGE_FSTYPES ?= "tar.bz2 ubifs boot.ubifs recovery.ubifs" diff --git a/meta-digi-arm/conf/machine/ccimx6ulstarter.conf b/meta-digi-arm/conf/machine/ccimx6ulstarter.conf index 6593173e4..81beaca28 100644 --- a/meta-digi-arm/conf/machine/ccimx6ulstarter.conf +++ b/meta-digi-arm/conf/machine/ccimx6ulstarter.conf @@ -25,4 +25,4 @@ BT_TTY ?= "ttymxc0" BOOT_SCRIPTS = "boot.scr:boot.scr" # Flash image types -IMAGE_FSTYPES ?= "tar.bz2 ubifs boot.ubifs" +IMAGE_FSTYPES ?= "tar.bz2 ubifs boot.ubifs recovery.ubifs" diff --git a/meta-digi-arm/conf/machine/include/ccardimx28.inc b/meta-digi-arm/conf/machine/include/ccardimx28.inc index 115fb2a86..b7198a6a6 100644 --- a/meta-digi-arm/conf/machine/include/ccardimx28.inc +++ b/meta-digi-arm/conf/machine/include/ccardimx28.inc @@ -15,7 +15,7 @@ UBOOT_SYMLINK = "u-boot-${MACHINE}.${UBOOT_SUFFIX}" # Wireless external module WIRELESS_MODULE ?= "" -WIRELESS_MODULE_append = "${@bb.utils.contains('MACHINE_FEATURES', 'wifi', 'kernel-module-atheros', '', d)}" +WIRELESS_MODULE_append = " ${@bb.utils.contains('MACHINE_FEATURES', 'wifi', 'kernel-module-atheros', '', d)}" # Firmware MACHINE_FIRMWARE ?= "" diff --git a/meta-digi-arm/conf/machine/include/ccimx6ul.inc b/meta-digi-arm/conf/machine/include/ccimx6ul.inc index ffaaeec3a..819cfb730 100644 --- a/meta-digi-arm/conf/machine/include/ccimx6ul.inc +++ b/meta-digi-arm/conf/machine/include/ccimx6ul.inc @@ -14,7 +14,7 @@ UBOOT_SYMLINK = "u-boot-${MACHINE}.${UBOOT_SUFFIX}" # Wireless external module WIRELESS_MODULE ?= "" -WIRELESS_MODULE_append = " ${@bb.utils.contains('MACHINE_FEATURES', 'wifi', 'kernel-module-qualcomm', '', d)}" +WIRELESS_MODULE_append = " ${@base_conditional('HAVE_WIFI', '1', 'kernel-module-qualcomm', '', d)}" # Firmware MACHINE_FIRMWARE ?= "" @@ -30,8 +30,8 @@ MACHINE_EXTRA_RRECOMMENDS += "fsl-alsa-plugins cryptodev-module" MACHINE_FEATURES += "wifi bluetooth" -MACHINE_FIRMWARE_append = " ${@bb.utils.contains('MACHINE_FEATURES', 'bluetooth', 'firmware-qualcomm-qca6564-bt', '', d)}" -MACHINE_FIRMWARE_append = " ${@bb.utils.contains('MACHINE_FEATURES', 'wifi', 'firmware-qualcomm-qca6564-wifi', '', d)}" +MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_BT', '1', 'firmware-qualcomm-qca6564-bt', '', d)}" +MACHINE_FIRMWARE_append = " ${@base_conditional('HAVE_WIFI', '1', 'firmware-qualcomm-qca6564-wifi', '', d)}" KERNEL_IMAGETYPE = "zImage" diff --git a/meta-digi-arm/conf/machine/include/digi-defaults.inc b/meta-digi-arm/conf/machine/include/digi-defaults.inc index 5fbfd1764..754a2a6e7 100644 --- a/meta-digi-arm/conf/machine/include/digi-defaults.inc +++ b/meta-digi-arm/conf/machine/include/digi-defaults.inc @@ -38,6 +38,8 @@ ETH1_STATIC_NETMASK ?= "255.255.255.0" WLAN0_MODE ?= "static" WLAN0_STATIC_IP ?= "192.168.43.30" WLAN0_STATIC_NETMASK ?= "255.255.255.0" +P2P0_STATIC_IP ?= "192.168.45.30" +P2P0_STATIC_NETMASK ?= "255.255.255.0" # Digi BSP default settings IMAGE_CLASSES = "image_types_digi" diff --git a/meta-digi-arm/conf/machine/include/imx-digi-base.inc b/meta-digi-arm/conf/machine/include/imx-digi-base.inc index 883273e87..151948418 100644 --- a/meta-digi-arm/conf/machine/include/imx-digi-base.inc +++ b/meta-digi-arm/conf/machine/include/imx-digi-base.inc @@ -40,6 +40,7 @@ MACHINE_EXTRA_RRECOMMENDS += "udev-extraconf udev-rules-imx" MACHINE_GSTREAMER_1_0_PLUGIN ?= "" MACHINE_GSTREAMER_1_0_PLUGIN_mx6q ?= "gst1.0-fsl-plugin gst1.0-fsl-plugin-gplay gst1.0-fsl-plugin-grecorder" MACHINE_GSTREAMER_1_0_PLUGIN_mx6dl ?= "gst1.0-fsl-plugin gst1.0-fsl-plugin-gplay gst1.0-fsl-plugin-grecorder" +MACHINE_GSTREAMER_1_0_PLUGIN_mx6ul ?= "gst1.0-fsl-plugin gst1.0-fsl-plugin-gplay gst1.0-fsl-plugin-grecorder" # Determines if the SoC has support for Vivante kernel driver SOC_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT = "0" diff --git a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state.bbappend b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state.bbappend index f58443d54..e21da25b4 100644 --- a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state.bbappend +++ b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state.bbappend @@ -2,7 +2,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" -SRC_URI += " \ +SRC_URI_append_ccimx6 = " \ file://asound.inline_play.state \ file://asound.inline.state \ file://asound.micro_play.state \ @@ -10,6 +10,20 @@ SRC_URI += " \ file://asound.play.state \ " -do_install_append() { +SRC_URI_append_ccardimx28 = " \ + file://asound.inline_play.state \ + file://asound.inline.state \ + file://asound.micro_play.state \ + file://asound.micro.state \ + file://asound.play.state \ +" + +SRC_URI_append_ccimx6ul = " file://asound.state" + +do_install_append_ccimx6() { + ln -sf asound.micro_play.state ${D}${localstatedir}/lib/alsa/asound.state +} + +do_install_append_ccardimx28() { ln -sf asound.micro_play.state ${D}${localstatedir}/lib/alsa/asound.state } diff --git a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.conf b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.conf index b39177ba8..11c4cbba0 100644 --- a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.conf +++ b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.conf @@ -1,43 +1,9 @@ -pcm.btheadset { - type plug - slave { - pcm { - type bluetooth - device 80:57:19:B2:A1:04 - profile "auto" - } - } - hint { - show on - description "BT Headset" - } +pcm.imxmax98088 { + type hw + card 0 } -ctl.btheadset { - type bluetooth -} - -pcm.btspeaker { - type plug - slave { - pcm { - type bluetooth - device A0:E9:DB:10:33:58 - profile "auto" - } - } - hint { - show on - description "BT Speaker" - } -} -ctl.btspeaker { - type bluetooth -} - -pcm.btspeaker_softvol -{ - type softvol - slave.pcm "btspeaker" - control.name "Bluetooth" - control.card 0 +ctl.imxmax98088 { + type hw + card 0 } +ctl.!default imxmax98088 diff --git a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.inline.state b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.inline.state deleted file mode 100644 index 0d9c9db6b..000000000 --- a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.inline.state +++ /dev/null @@ -1,127 +0,0 @@ -state.sgtl5000audio { - control.1 { - iface MIXER - name 'PCM Playback Volume' - value.0 144 - value.1 144 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 192' - } - } - control.2 { - iface MIXER - name 'Capture Volume' - value.0 12 - value.1 12 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 15' - } - } - control.3 { - iface MIXER - name 'Capture Attenuate Switch (-6dB)' - value 1 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 2' - dbmin -600 - dbmax 600 - dbvalue.0 0 - } - } - control.4 { - iface MIXER - name 'Capture ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.5 { - iface MIXER - name 'Headphone Playback Volume' - value.0 105 - value.1 105 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 127' - dbmin -5150 - dbmax 1200 - dbvalue.0 100 - dbvalue.1 100 - } - } - control.6 { - iface MIXER - name 'Headphone Playback ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.7 { - iface MIXER - name 'Mic Volume' - value 2 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 3' - dbmin 0 - dbmax 4000 - dbvalue.0 3000 - } - } - control.8 { - iface MIXER - name 'Headphone Mux' - value LINE_IN - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 DAC - item.1 LINE_IN - } - } - control.9 { - iface MIXER - name 'Capture Mux' - value LINE_IN - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 MIC_IN - item.1 LINE_IN - } - } -} - -state.imxhdmisoc { - control.1 { - iface MIXER - name 'IEC958 Playback Default' - value '0400220300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' - comment { - access 'read write volatile' - type IEC958 - count 1 - } - } -} diff --git a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.inline_play.state b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.inline_play.state deleted file mode 100644 index 05a69279e..000000000 --- a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.inline_play.state +++ /dev/null @@ -1,127 +0,0 @@ -state.sgtl5000audio { - control.1 { - iface MIXER - name 'PCM Playback Volume' - value.0 144 - value.1 144 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 192' - } - } - control.2 { - iface MIXER - name 'Capture Volume' - value.0 12 - value.1 12 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 15' - } - } - control.3 { - iface MIXER - name 'Capture Attenuate Switch (-6dB)' - value 1 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 2' - dbmin -600 - dbmax 600 - dbvalue.0 0 - } - } - control.4 { - iface MIXER - name 'Capture ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.5 { - iface MIXER - name 'Headphone Playback Volume' - value.0 105 - value.1 105 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 127' - dbmin -5150 - dbmax 1200 - dbvalue.0 100 - dbvalue.1 100 - } - } - control.6 { - iface MIXER - name 'Headphone Playback ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.7 { - iface MIXER - name 'Mic Volume' - value 2 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 3' - dbmin 0 - dbmax 4000 - dbvalue.0 3000 - } - } - control.8 { - iface MIXER - name 'Headphone Mux' - value DAC - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 DAC - item.1 LINE_IN - } - } - control.9 { - iface MIXER - name 'Capture Mux' - value LINE_IN - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 MIC_IN - item.1 LINE_IN - } - } -} - -state.imxhdmisoc { - control.1 { - iface MIXER - name 'IEC958 Playback Default' - value '0400220300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' - comment { - access 'read write volatile' - type IEC958 - count 1 - } - } -} diff --git a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.micro.state b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.micro.state deleted file mode 100644 index 4d55bc608..000000000 --- a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.micro.state +++ /dev/null @@ -1,127 +0,0 @@ -state.sgtl5000audio { - control.1 { - iface MIXER - name 'PCM Playback Volume' - value.0 144 - value.1 144 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 192' - } - } - control.2 { - iface MIXER - name 'Capture Volume' - value.0 12 - value.1 12 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 15' - } - } - control.3 { - iface MIXER - name 'Capture Attenuate Switch (-6dB)' - value 1 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 2' - dbmin -600 - dbmax 600 - dbvalue.0 0 - } - } - control.4 { - iface MIXER - name 'Capture ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.5 { - iface MIXER - name 'Headphone Playback Volume' - value.0 105 - value.1 105 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 127' - dbmin -5150 - dbmax 1200 - dbvalue.0 100 - dbvalue.1 100 - } - } - control.6 { - iface MIXER - name 'Headphone Playback ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.7 { - iface MIXER - name 'Mic Volume' - value 2 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 3' - dbmin 0 - dbmax 4000 - dbvalue.0 3000 - } - } - control.8 { - iface MIXER - name 'Headphone Mux' - value DAC - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 DAC - item.1 LINE_IN - } - } - control.9 { - iface MIXER - name 'Capture Mux' - value MIC_IN - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 MIC_IN - item.1 LINE_IN - } - } -} - -state.imxhdmisoc { - control.1 { - iface MIXER - name 'IEC958 Playback Default' - value '0400220300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' - comment { - access 'read write volatile' - type IEC958 - count 1 - } - } -} diff --git a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.micro_play.state b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.micro_play.state deleted file mode 100644 index 4d55bc608..000000000 --- a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.micro_play.state +++ /dev/null @@ -1,127 +0,0 @@ -state.sgtl5000audio { - control.1 { - iface MIXER - name 'PCM Playback Volume' - value.0 144 - value.1 144 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 192' - } - } - control.2 { - iface MIXER - name 'Capture Volume' - value.0 12 - value.1 12 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 15' - } - } - control.3 { - iface MIXER - name 'Capture Attenuate Switch (-6dB)' - value 1 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 2' - dbmin -600 - dbmax 600 - dbvalue.0 0 - } - } - control.4 { - iface MIXER - name 'Capture ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.5 { - iface MIXER - name 'Headphone Playback Volume' - value.0 105 - value.1 105 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 127' - dbmin -5150 - dbmax 1200 - dbvalue.0 100 - dbvalue.1 100 - } - } - control.6 { - iface MIXER - name 'Headphone Playback ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.7 { - iface MIXER - name 'Mic Volume' - value 2 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 3' - dbmin 0 - dbmax 4000 - dbvalue.0 3000 - } - } - control.8 { - iface MIXER - name 'Headphone Mux' - value DAC - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 DAC - item.1 LINE_IN - } - } - control.9 { - iface MIXER - name 'Capture Mux' - value MIC_IN - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 MIC_IN - item.1 LINE_IN - } - } -} - -state.imxhdmisoc { - control.1 { - iface MIXER - name 'IEC958 Playback Default' - value '0400220300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' - comment { - access 'read write volatile' - type IEC958 - count 1 - } - } -} diff --git a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.play.state b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.play.state deleted file mode 100644 index 4d55bc608..000000000 --- a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.play.state +++ /dev/null @@ -1,127 +0,0 @@ -state.sgtl5000audio { - control.1 { - iface MIXER - name 'PCM Playback Volume' - value.0 144 - value.1 144 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 192' - } - } - control.2 { - iface MIXER - name 'Capture Volume' - value.0 12 - value.1 12 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 15' - } - } - control.3 { - iface MIXER - name 'Capture Attenuate Switch (-6dB)' - value 1 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 2' - dbmin -600 - dbmax 600 - dbvalue.0 0 - } - } - control.4 { - iface MIXER - name 'Capture ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.5 { - iface MIXER - name 'Headphone Playback Volume' - value.0 105 - value.1 105 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 127' - dbmin -5150 - dbmax 1200 - dbvalue.0 100 - dbvalue.1 100 - } - } - control.6 { - iface MIXER - name 'Headphone Playback ZC Switch' - value true - comment { - access 'read write' - type BOOLEAN - count 1 - } - } - control.7 { - iface MIXER - name 'Mic Volume' - value 2 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 3' - dbmin 0 - dbmax 4000 - dbvalue.0 3000 - } - } - control.8 { - iface MIXER - name 'Headphone Mux' - value DAC - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 DAC - item.1 LINE_IN - } - } - control.9 { - iface MIXER - name 'Capture Mux' - value MIC_IN - comment { - access 'read write' - type ENUMERATED - count 1 - item.0 MIC_IN - item.1 LINE_IN - } - } -} - -state.imxhdmisoc { - control.1 { - iface MIXER - name 'IEC958 Playback Default' - value '0400220300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' - comment { - access 'read write volatile' - type IEC958 - count 1 - } - } -} diff --git a/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.state b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.state new file mode 100644 index 000000000..128bd3f30 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.state @@ -0,0 +1,1148 @@ +state.imxmax98088 { + control.1 { + iface MIXER + name 'Headphone Volume' + value.0 18 + value.1 18 + comment { + access 'read write' + type INTEGER + count 2 + range '0 - 31' + dbmin -6700 + dbmax 300 + dbvalue.0 -1100 + dbvalue.1 -1100 + } + } + control.2 { + iface MIXER + name 'Speaker Volume' + value.0 16 + value.1 16 + comment { + access 'read write' + type INTEGER + count 2 + range '0 - 31' + dbmin -6200 + dbmax 800 + dbvalue.0 -1000 + dbvalue.1 -1000 + } + } + control.3 { + iface MIXER + name 'Receiver Volume' + value.0 16 + value.1 16 + comment { + access 'read write' + type INTEGER + count 2 + range '0 - 31' + dbmin -6200 + dbmax 800 + dbvalue.0 -1000 + dbvalue.1 -1000 + } + } + control.4 { + iface MIXER + name 'Headphone Switch' + value.0 true + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.5 { + iface MIXER + name 'Speaker Switch' + value.0 true + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.6 { + iface MIXER + name 'Receiver Switch' + value.0 true + value.1 true + comment { + access 'read write' + type BOOLEAN + count 2 + } + } + control.7 { + iface MIXER + name 'MIC1 Volume' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 31' + } + } + control.8 { + iface MIXER + name 'MIC2 Volume' + value 15 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 31' + } + } + control.9 { + iface MIXER + name 'MIC1 Boost Volume' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 2' + dbmin 0 + dbmax 3000 + dbvalue.0 0 + } + } + control.10 { + iface MIXER + name 'MIC2 Boost Volume' + value 1 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 2' + dbmin 0 + dbmax 3000 + dbvalue.0 2000 + } + } + control.11 { + iface MIXER + name 'INA Volume' + value 4 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 7' + } + } + control.12 { + iface MIXER + name 'INB Volume' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 7' + } + } + control.13 { + iface MIXER + name 'ADCL Volume' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 15' + } + } + control.14 { + iface MIXER + name 'ADCR Volume' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 15' + } + } + control.15 { + iface MIXER + name 'ADCL Boost Volume' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 3' + } + } + control.16 { + iface MIXER + name 'ADCR Boost Volume' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 3' + } + } + control.17 { + iface MIXER + name 'EQ1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.18 { + iface MIXER + name 'EQ2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.19 { + iface MIXER + name 'EX Limiter Mode' + value Off + comment { + access 'read write' + type ENUMERATED + count 1 + item.0 Off + item.1 '100Hz' + item.2 '400Hz' + item.3 '600Hz' + item.4 '800Hz' + item.5 '1000Hz' + item.6 '200-400Hz' + item.7 '400-600Hz' + item.8 '400-800Hz' + } + } + control.20 { + iface MIXER + name 'EX Limiter Threshold' + value '0.6' + comment { + access 'read write' + type ENUMERATED + count 1 + item.0 '0.6' + item.1 '1.2' + item.2 '1.8' + item.3 '2.4' + item.4 '3.0' + item.5 '3.6' + item.6 '4.2' + item.7 '4.8' + } + } + control.21 { + iface MIXER + name 'DAI1 Filter Mode' + value Music + comment { + access 'read write' + type ENUMERATED + count 1 + item.0 Voice + item.1 Music + } + } + control.22 { + iface MIXER + name 'DAI1 DAC Filter' + value Off + comment { + access 'read write' + type ENUMERATED + count 1 + item.0 Off + item.1 'fc=258/fs=16k' + item.2 'fc=500/fs=16k' + item.3 'fc=258/fs=8k' + item.4 'fc=500/fs=8k' + item.5 'fc=200' + } + } + control.23 { + iface MIXER + name 'DAI1 ADC Filter' + value Off + comment { + access 'read write' + type ENUMERATED + count 1 + item.0 Off + item.1 'fc=258/fs=16k' + item.2 'fc=500/fs=16k' + item.3 'fc=258/fs=8k' + item.4 'fc=500/fs=8k' + item.5 'fc=200' + } + } + control.24 { + iface MIXER + name 'DAI2 DC Block Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.25 { + iface MIXER + name 'ALC Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.26 { + iface MIXER + name 'ALC Threshold' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 7' + } + } + control.27 { + iface MIXER + name 'ALC Multiband' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.28 { + iface MIXER + name 'ALC Release Time' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 7' + } + } + control.29 { + iface MIXER + name 'PWR Limiter Threshold' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 15' + } + } + control.30 { + iface MIXER + name 'PWR Limiter Weight' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 7' + } + } + control.31 { + iface MIXER + name 'PWR Limiter Time1' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 15' + } + } + control.32 { + iface MIXER + name 'PWR Limiter Time2' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 15' + } + } + control.33 { + iface MIXER + name 'THD Limiter Threshold' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 15' + } + } + control.34 { + iface MIXER + name 'THD Limiter Time' + value 0 + comment { + access 'read write' + type INTEGER + count 1 + range '0 - 7' + } + } + control.35 { + iface MIXER + name 'REC Output Mode' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.36 { + iface MIXER + name 'Right ADC Mixer MIC1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.37 { + iface MIXER + name 'Right ADC Mixer MIC2 Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.38 { + iface MIXER + name 'Right ADC Mixer INA1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.39 { + iface MIXER + name 'Right ADC Mixer INA2 Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.40 { + iface MIXER + name 'Right ADC Mixer INB1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.41 { + iface MIXER + name 'Right ADC Mixer INB2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.42 { + iface MIXER + name 'Left ADC Mixer MIC1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.43 { + iface MIXER + name 'Left ADC Mixer MIC2 Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.44 { + iface MIXER + name 'Left ADC Mixer INA1 Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.45 { + iface MIXER + name 'Left ADC Mixer INA2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.46 { + iface MIXER + name 'Left ADC Mixer INB1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.47 { + iface MIXER + name 'Left ADC Mixer INB2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.48 { + iface MIXER + name 'Right REC Mixer Left DAC1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.49 { + iface MIXER + name 'Right REC Mixer Right DAC1 Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.50 { + iface MIXER + name 'Right REC Mixer Left DAC2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.51 { + iface MIXER + name 'Right REC Mixer Right DAC2 Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.52 { + iface MIXER + name 'Right REC Mixer MIC1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.53 { + iface MIXER + name 'Right REC Mixer MIC2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.54 { + iface MIXER + name 'Right REC Mixer INA1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.55 { + iface MIXER + name 'Right REC Mixer INA2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.56 { + iface MIXER + name 'Right REC Mixer INB1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.57 { + iface MIXER + name 'Right REC Mixer INB2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.58 { + iface MIXER + name 'Left REC Mixer Left DAC1 Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.59 { + iface MIXER + name 'Left REC Mixer Right DAC1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.60 { + iface MIXER + name 'Left REC Mixer Left DAC2 Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.61 { + iface MIXER + name 'Left REC Mixer Right DAC2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.62 { + iface MIXER + name 'Left REC Mixer MIC1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.63 { + iface MIXER + name 'Left REC Mixer MIC2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.64 { + iface MIXER + name 'Left REC Mixer INA1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.65 { + iface MIXER + name 'Left REC Mixer INA2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.66 { + iface MIXER + name 'Left REC Mixer INB1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.67 { + iface MIXER + name 'Left REC Mixer INB2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.68 { + iface MIXER + name 'Right SPK Mixer Left DAC1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.69 { + iface MIXER + name 'Right SPK Mixer Right DAC1 Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.70 { + iface MIXER + name 'Right SPK Mixer Left DAC2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.71 { + iface MIXER + name 'Right SPK Mixer Right DAC2 Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.72 { + iface MIXER + name 'Right SPK Mixer MIC1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.73 { + iface MIXER + name 'Right SPK Mixer MIC2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.74 { + iface MIXER + name 'Right SPK Mixer INA1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.75 { + iface MIXER + name 'Right SPK Mixer INA2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.76 { + iface MIXER + name 'Right SPK Mixer INB1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.77 { + iface MIXER + name 'Right SPK Mixer INB2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.78 { + iface MIXER + name 'Left SPK Mixer Left DAC1 Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.79 { + iface MIXER + name 'Left SPK Mixer Right DAC1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.80 { + iface MIXER + name 'Left SPK Mixer Left DAC2 Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.81 { + iface MIXER + name 'Left SPK Mixer Right DAC2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.82 { + iface MIXER + name 'Left SPK Mixer MIC1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.83 { + iface MIXER + name 'Left SPK Mixer MIC2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.84 { + iface MIXER + name 'Left SPK Mixer INA1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.85 { + iface MIXER + name 'Left SPK Mixer INA2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.86 { + iface MIXER + name 'Left SPK Mixer INB1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.87 { + iface MIXER + name 'Left SPK Mixer INB2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.88 { + iface MIXER + name 'Right HP Mixer Left DAC1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.89 { + iface MIXER + name 'Right HP Mixer Right DAC1 Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.90 { + iface MIXER + name 'Right HP Mixer Left DAC2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.91 { + iface MIXER + name 'Right HP Mixer Right DAC2 Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.92 { + iface MIXER + name 'Right HP Mixer MIC1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.93 { + iface MIXER + name 'Right HP Mixer MIC2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.94 { + iface MIXER + name 'Right HP Mixer INA1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.95 { + iface MIXER + name 'Right HP Mixer INA2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.96 { + iface MIXER + name 'Right HP Mixer INB1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.97 { + iface MIXER + name 'Right HP Mixer INB2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.98 { + iface MIXER + name 'Left HP Mixer Left DAC1 Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.99 { + iface MIXER + name 'Left HP Mixer Right DAC1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.100 { + iface MIXER + name 'Left HP Mixer Left DAC2 Switch' + value true + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.101 { + iface MIXER + name 'Left HP Mixer Right DAC2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.102 { + iface MIXER + name 'Left HP Mixer MIC1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.103 { + iface MIXER + name 'Left HP Mixer MIC2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.104 { + iface MIXER + name 'Left HP Mixer INA1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.105 { + iface MIXER + name 'Left HP Mixer INA2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.106 { + iface MIXER + name 'Left HP Mixer INB1 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } + control.107 { + iface MIXER + name 'Left HP Mixer INB2 Switch' + value false + comment { + access 'read write' + type BOOLEAN + count 1 + } + } +} diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb index 8a4a37940..517869ccf 100644 --- a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb +++ b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb @@ -19,7 +19,6 @@ FW_QCA6564-WIFI = " \ file://otp30.bin \ file://qwlan30.bin \ file://utf30.bin \ - file://utfbd30.bin \ file://wlan/cfg.dat \ file://wlan/qcom_cfg.ini \ " @@ -50,7 +49,6 @@ do_install() { otp30.bin \ qwlan30.bin \ utf30.bin \ - utfbd30.bin \ ${D}${base_libdir}/firmware install -m 0644 \ wlan/cfg.dat \ diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/bdwlan30_US.bin b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/bdwlan30_US.bin index 0f583c713..fd6ffaeb3 100644 Binary files a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/bdwlan30_US.bin and b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/bdwlan30_US.bin differ diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/bdwlan30_World.bin b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/bdwlan30_World.bin index 4a3e0f66c..e3a4b0474 100644 Binary files a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/bdwlan30_World.bin and b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/bdwlan30_World.bin differ diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/utfbd30.bin b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/utfbd30.bin deleted file mode 100644 index dfd6a4634..000000000 Binary files a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/utfbd30.bin and /dev/null differ diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/wlan/qcom_cfg.ini b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/wlan/qcom_cfg.ini index fff4052f0..1aaa184f7 100644 --- a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/wlan/qcom_cfg.ini +++ b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/wlan/qcom_cfg.ini @@ -2,13 +2,38 @@ # defaults for the WLAN Driver +# Debug tracing bit values +# VOS tracing requires a debug build - see BUILD_DEBUG_VERSION + +# None = 0 +# Error +# Warn +# Info +# Info high +# Info med +# Info low +# Debug = 7 + +# Debug masks in decimal +# Default debug is Error and Warn 0x06 (6) +# All debug is 0xff (255) + +#vosTraceEnableTL=6 +#vosTraceEnableWDI=6 +#vosTraceEnableHDD=6 +#vosTraceEnableSME=6 +#vosTraceEnablePE=6 +#vosTraceEnablePMC=6 +#vosTraceEnableWDA=6 +#vosTraceEnableSYS=6 +#vosTraceEnableVOSS=6 +#vosTraceEnableSAP=6 +#vosTraceEnableHDDSAP=6 # Enable/Disable Idle Scan gEnableRxThread=1 -gEnableIdleScan=0 - # Increase sleep duration (seconds) during IMPS # 0 implies no periodic wake up from IMPS. Periodic wakeup is @@ -29,12 +54,10 @@ gEnableSuspend=3 # 7 = 11b only 8 = 11ac only. gDot11Mode=0 - # CSR Roaming Enable(1) Disable(0) gRoamingTime=0 - # Assigned MAC Addresses - This will be used until NV items are in place # Each byte of MAC address is represented in Hex format as XX @@ -103,19 +126,12 @@ gEnableDFSMasterCap=1 ImplicitQosIsEnabled=0 gNeighborLookupThreshold=76 -gNeighborReassocThreshold=81 #Check if the AP to which we are roaming is better than current AP in terms of RSSI. #Checking is disabled if set to Zero.Otherwise it will use this value as to how better #the RSSI of the new/roamable AP should be for roaming RoamRssiDiff=3 -# If the RSSI of any available candidate is better than currently associated -# AP by at least gImmediateRoamRssiDiff, then being to roam immediately (without -# registering for reassoc threshold). -# NOTE: Value of 0 means that we would register for reassoc threshold. -gImmediateRoamRssiDiff=10 - # SAP auto channel selection configuration # 0 = disable auto channel selection diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/install_linux_fw_sd.txt index 6b6cad2cd..828a4fff6 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/install_linux_fw_sd.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/install_linux_fw_sd.txt @@ -62,10 +62,11 @@ fi; setenv INSTALL_MMCDEV 1 setenv INSTALL_LINUX_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.boot.vfat +setenv INSTALL_RECOVERY_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.recovery.vfat setenv INSTALL_ROOTFS_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.ext4 # Check for presence of firmware files on the SD card -for install_f in ${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_ROOTFS_FILENAME}; do +for install_f in ${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_RECOVERY_FILENAME} ${INSTALL_ROOTFS_FILENAME}; do if test ! -e mmc ${INSTALL_MMCDEV}:1 ${install_f}; then echo "ERROR: Could not find file ${install_f}"; install_abort=1; @@ -105,8 +106,10 @@ fi # - Save the environment # - Partition the eMMC user data area for Linux # - Update the 'linux' partition +# - Update the 'recovery' partition # - Update the 'rootfs' partition -# - Reset the system and let it boot +# - Configure recovery to wipe 'update' partition +# - Run 'recovery' and let the system boot after setenv bootcmd " env default -a; saveenv; @@ -136,6 +139,18 @@ setenv bootcmd " fi; echo \"\"; echo \"\"; + echo \">> Installing recovery\"; + echo \"\"; + echo \"\"; + update recovery mmc ${INSTALL_MMCDEV} fat ${INSTALL_RECOVERY_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update recovery partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; + echo \"\"; + echo \"\"; echo \">> Installing Linux root file system\"; echo \"\"; echo \"\"; @@ -147,14 +162,12 @@ setenv bootcmd " exit; fi; echo \"\"; - echo \"#######################\"; - echo \"# Install complete! #\"; - echo \"#######################\"; - echo \"\"; + setenv boot_recovery yes + setenv recovery_command wipe_update + saveenv; + echo \">> Firmware installation complete. Booting into recovery for final deployment.\"; sleep 1; - echo \">> Restarting the system\"; - sleep 1; - reset; + run recoverycmd; " saveenv diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/recovery.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/recovery.txt new file mode 100644 index 000000000..7df232111 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6/recovery.txt @@ -0,0 +1,49 @@ +# +# U-Boot bootscript for EMMC/SD images created by Yocto. +# + +# +# Set device tree filename depending on the board ID (if defined) +# +if test -n "${board_id}"; then + setenv fdt_file uImage-${soc_family}-ccimx6sbc-id${board_id}.dtb +else + # + # Set device tree filename depending on the hardware variant + # + if test "${module_variant}" = "0x02"; then + setenv fdt_file uImage-imx6q-ccimx6sbc-wb.dtb + elif test "${module_variant}" = "0x03"; then + setenv fdt_file uImage-imx6q-ccimx6sbc-wb.dtb + elif test "${module_variant}" = "0x04"; then + setenv fdt_file uImage-imx6q-ccimx6sbc-wb.dtb + elif test "${module_variant}" = "0x05"; then + setenv fdt_file uImage-imx6q-ccimx6sbc-w.dtb + elif test "${module_variant}" = "0x06"; then + setenv fdt_file uImage-imx6q-ccimx6sbc-wb.dtb + elif test "${module_variant}" = "0x08"; then + setenv fdt_file uImage-imx6q-ccimx6sbc.dtb + elif test "${module_variant}" = "0x0a"; then + setenv fdt_file uImage-imx6dl-ccimx6sbc-w.dtb + elif test "${module_variant}" = "0x0b"; then + setenv fdt_file uImage-imx6dl-ccimx6sbc-wb.dtb + elif test "${module_variant}" = "0x0c"; then + setenv fdt_file uImage-imx6dl-ccimx6sbc.dtb + elif test "${module_variant}" = "0x0e"; then + setenv fdt_file uImage-imx6q-ccimx6sbc.dtb + elif test "${module_variant}" = "0x0f"; then + setenv fdt_file uImage-imx6q-ccimx6sbc.dtb + elif test "${module_variant}" = "0x11"; then + setenv fdt_file uImage-imx6q-ccimx6sbc-wb.dtb + elif test "${module_variant}" = "0x12"; then + setenv fdt_file uImage-imx6q-ccimx6sbc-wb.dtb + elif test "${module_variant}" = "0x13"; then + setenv fdt_file uImage-imx6dl-ccimx6sbc-wb.dtb + else + echo "------ Using default fdt_file" + fi +fi + +setenv boot_initrd true +setenv initrd_file uramdisk-recovery.img +dboot linux mmc ${mmcbootdev}:${mmcpart} diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulsbc/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulsbc/install_linux_fw_sd.txt index 91eedbc14..dd58604c7 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulsbc/install_linux_fw_sd.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulsbc/install_linux_fw_sd.txt @@ -22,10 +22,11 @@ fi setenv INSTALL_MMCDEV 0 setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6ulsbc.imx setenv INSTALL_LINUX_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6ulsbc.boot.ubifs +setenv INSTALL_RECOVERY_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6ulsbc.recovery.ubifs setenv INSTALL_ROOTFS_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6ulsbc.ubifs # Check for presence of firmware files on the SD card -for install_f in ${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_ROOTFS_FILENAME}; do +for install_f in ${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_RECOVERY_FILENAME} ${INSTALL_ROOTFS_FILENAME}; do if test ! -e mmc ${INSTALL_MMCDEV}:1 ${install_f}; then echo "ERROR: Could not find file ${install_f}"; install_abort=1; @@ -61,8 +62,10 @@ fi # - Reset environment to defaults # - Save the environment # - Update the 'linux' partition +# - Update the 'recovery' partition # - Update the 'rootfs' partition -# - Reset the system and let it boot +# - Configure recovery to wipe 'update' partition +# - Run 'recovery' and let the system boot after setenv bootcmd " env default -a; saveenv; @@ -71,6 +74,7 @@ setenv bootcmd " echo \">> Installing Linux kernel and device tree files\"; echo \"\"; echo \"\"; + nand erase.part linux update linux mmc ${INSTALL_MMCDEV} fat ${INSTALL_LINUX_FILENAME}; if test \$? -eq 1; then echo \"[ERROR] Failed to update linux partition!\"; @@ -80,9 +84,23 @@ setenv bootcmd " fi; echo \"\"; echo \"\"; + echo \">> Installing recovery\"; + echo \"\"; + echo \"\"; + nand erase.part recovery + update recovery mmc ${INSTALL_MMCDEV} fat ${INSTALL_RECOVERY_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update recovery partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; + echo \"\"; + echo \"\"; echo \">> Installing Linux root file system\"; echo \"\"; echo \"\"; + nand erase.part rootfs update rootfs mmc ${INSTALL_MMCDEV} fat ${INSTALL_ROOTFS_FILENAME}; if test \$? -eq 1; then echo \"[ERROR] Failed to update rootfs partition!\"; @@ -90,16 +108,13 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; + echo \"\"; + setenv boot_recovery yes + setenv recovery_command wipe_update saveenv; - echo \"\"; - echo \"#######################\"; - echo \"# Install complete! #\"; - echo \"#######################\"; - echo \"\"; + echo \">> Firmware installation complete. Booting into recovery for final deployment.\"; sleep 1; - echo \">> Restarting the system\"; - sleep 1; - reset; + run recoverycmd; " saveenv diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulsbc/recovery.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulsbc/recovery.txt new file mode 100644 index 000000000..877abe457 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulsbc/recovery.txt @@ -0,0 +1,25 @@ +# +# U-Boot bootscript for NAND images created by Yocto. +# + +# +# Set device tree filename depending on the board ID (if defined) +# +if test -n "${board_id}"; then + setenv fdt_file zImage-imx6ul-ccimx6ulsbc-id${board_id}.dtb +else + # + # Set device tree filename depending on the hardware variant + # + if test "${module_variant}" = "0x02"; then + setenv fdt_file zImage-imx6ul-ccimx6ulsbc-wb.dtb + elif test "${module_variant}" = "0x03"; then + setenv fdt_file zImage-imx6ul-ccimx6ulsbc.dtb + else + echo "------ Using default fdt_file: $fdt_file" + fi +fi + +setenv boot_initrd true +setenv initrd_file uramdisk-recovery.img +dboot linux nand ${mtdbootpart} diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/install_linux_fw_sd.txt index eaab7a62b..e6865bd11 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/install_linux_fw_sd.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/install_linux_fw_sd.txt @@ -22,10 +22,11 @@ fi setenv INSTALL_MMCDEV 0 setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6ulstarter.imx setenv INSTALL_LINUX_FILENAME core-image-base-ccimx6ulstarter.boot.ubifs +setenv INSTALL_RECOVERY_FILENAME core-image-base-ccimx6ulstarter.recovery.ubifs setenv INSTALL_ROOTFS_FILENAME core-image-base-ccimx6ulstarter.ubifs # Check for presence of firmware files on the SD card -for install_f in ${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_ROOTFS_FILENAME}; do +for install_f in ${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_RECOVERY_FILENAME} ${INSTALL_ROOTFS_FILENAME}; do if test ! -e mmc ${INSTALL_MMCDEV}:1 ${install_f}; then echo "ERROR: Could not find file ${install_f}"; install_abort=1; @@ -61,8 +62,10 @@ fi # - Reset environment to defaults # - Save the environment # - Update the 'linux' partition +# - Update the 'recovery' partition # - Update the 'rootfs' partition -# - Reset the system and let it boot +# - Configure recovery to wipe 'update' partition +# - Run 'recovery' and let the system boot after setenv bootcmd " env default -a; saveenv; @@ -71,6 +74,7 @@ setenv bootcmd " echo \">> Installing Linux kernel and device tree files\"; echo \"\"; echo \"\"; + nand erase.part linux update linux mmc ${INSTALL_MMCDEV} fat ${INSTALL_LINUX_FILENAME}; if test \$? -eq 1; then echo \"[ERROR] Failed to update linux partition!\"; @@ -80,9 +84,23 @@ setenv bootcmd " fi; echo \"\"; echo \"\"; + echo \">> Installing recovery\"; + echo \"\"; + echo \"\"; + nand erase.part recovery + update recovery mmc ${INSTALL_MMCDEV} fat ${INSTALL_RECOVERY_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update recovery partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; + echo \"\"; + echo \"\"; echo \">> Installing Linux root file system\"; echo \"\"; echo \"\"; + nand erase.part rootfs update rootfs mmc ${INSTALL_MMCDEV} fat ${INSTALL_ROOTFS_FILENAME}; if test \$? -eq 1; then echo \"[ERROR] Failed to update rootfs partition!\"; @@ -90,16 +108,13 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; + echo \"\"; + setenv boot_recovery yes + setenv recovery_command wipe_update saveenv; - echo \"\"; - echo \"#######################\"; - echo \"# Install complete! #\"; - echo \"#######################\"; - echo \"\"; + echo \">> Firmware installation complete. Booting into recovery for final deployment.\"; sleep 1; - echo \">> Restarting the system\"; - sleep 1; - reset; + run recoverycmd; " saveenv diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/recovery.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/recovery.txt new file mode 100644 index 000000000..2c75edf7a --- /dev/null +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/recovery.txt @@ -0,0 +1,25 @@ +# +# U-Boot bootscript for NAND images created by Yocto. +# + +# +# Set device tree filename depending on the board ID (if defined) +# +if test -n "${board_id}"; then + setenv fdt_file zImage-imx6ul-ccimx6ulstarter-id${board_id}.dtb +else + # + # Set device tree filename depending on the hardware variant + # + if test "${module_variant}" = "0x02"; then + setenv fdt_file zImage-imx6ul-ccimx6ulstarter-wb.dtb + elif test "${module_variant}" = "0x03"; then + setenv fdt_file zImage-imx6ul-ccimx6ulstarter.dtb + else + echo "------ Using default fdt_file: $fdt_file" + fi +fi + +setenv boot_initrd true +setenv initrd_file uramdisk-recovery.img +dboot linux nand ${mtdbootpart} diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2015.04.bb b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2015.04.bb index bf1909201..b28ac2344 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2015.04.bb +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2015.04.bb @@ -24,6 +24,7 @@ SRC_URI = " \ SRC_URI_append = " \ file://boot.txt \ file://install_linux_fw_sd.txt \ + file://recovery.txt \ " LOCALVERSION ?= "" @@ -150,12 +151,24 @@ do_deploy_append() { TMP_BOOTSCR="$(mktemp ${WORKDIR}/bootscr.XXXXXX)" sed -e "${TF_BOOTSCRIPT_SEDFILTER}" ${WORKDIR}/boot.txt > ${TMP_BOOTSCR} mkimage -T script -n bootscript -C none -d ${TMP_BOOTSCR} ${DEPLOYDIR}/boot.scr + + # Recovery boot script for DEY images + mkimage -T script -n bootscript -C none -d ${WORKDIR}/recovery.txt ${DEPLOYDIR}/recovery.scr + + # Sign the scripts if [ "${TRUSTFENCE_SIGN}" = "1" ]; then export CONFIG_SIGN_KEYS_PATH="${TRUSTFENCE_SIGN_KEYS_PATH}" [ -n "${TRUSTFENCE_KEY_INDEX}" ] && export CONFIG_KEY_INDEX="${TRUSTFENCE_KEY_INDEX}" [ -n "${TRUSTFENCE_DEK_PATH}" ] && [ "${TRUSTFENCE_DEK_PATH}" != "0" ] && export CONFIG_DEK_PATH="${TRUSTFENCE_DEK_PATH}" - "${STAGING_BINDIR_NATIVE}/trustfence-sign-kernel.sh" -p "${DIGI_FAMILY}" -b "${DEPLOYDIR}/boot.scr" "${DEPLOYDIR}/boot-signed.scr" - mv ${DEPLOYDIR}/boot-signed.scr ${DEPLOYDIR}/boot.scr + + # Sign boot script + TMP_SIGNED_BOOTSCR="$(mktemp ${WORKDIR}/bootscr-signed.XXXXXX)" + trustfence-sign-kernel.sh -p "${DIGI_FAMILY}" -b "${DEPLOYDIR}/boot.scr" "${TMP_SIGNED_BOOTSCR}" + mv "${TMP_SIGNED_BOOTSCR}" "${DEPLOYDIR}/boot.scr" + + # Sign recovery script + trustfence-sign-kernel.sh -p "${DIGI_FAMILY}" -b "${DEPLOYDIR}/recovery.scr" "${TMP_SIGNED_BOOTSCR}" + mv "${TMP_SIGNED_BOOTSCR}" "${DEPLOYDIR}/recovery.scr" fi rm -f ${TMP_BOOTSCR} } diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0002-fw_env-add-support-to-unlock-emmc-boot-partition.patch b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0002-fw_env-add-support-to-unlock-emmc-boot-partition.patch index f1c50aa56..2450ae412 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0002-fw_env-add-support-to-unlock-emmc-boot-partition.patch +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0002-fw_env-add-support-to-unlock-emmc-boot-partition.patch @@ -8,7 +8,7 @@ Signed-off-by: Javier Viguera 1 file changed, 33 insertions(+) diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c -index 09f06c874b17..ae6c69eca0ad 100644 +index 09f06c874b17..e4e242b35bd1 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -1218,6 +1218,27 @@ static int flash_read (int fd) @@ -18,7 +18,7 @@ index 09f06c874b17..ae6c69eca0ad 100644 +/* + * Set mmcboot partition read-write protection + */ -+static int sysfs_mmcboot_set_protection(char *device, int value) ++static int sysfs_mmcboot_set_protection(const char *device, int value) +{ + int fd; + char buf[64]; diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0004-Implement-U-Boot-environment-access-functions.patch b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0004-Implement-U-Boot-environment-access-functions.patch new file mode 100644 index 000000000..0a18c6598 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0004-Implement-U-Boot-environment-access-functions.patch @@ -0,0 +1,146 @@ +From: Javier Viguera +Date: Tue, 10 Jan 2017 19:34:26 +0100 +Subject: [PATCH] Implement U-Boot environment access functions + +Signed-off-by: Javier Viguera +--- + tools/env/Makefile | 2 +- + tools/env/ubootenv.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + tools/env/ubootenv.h | 46 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 109 insertions(+), 1 deletion(-) + create mode 100644 tools/env/ubootenv.c + create mode 100644 tools/env/ubootenv.h + +diff --git a/tools/env/Makefile b/tools/env/Makefile +index fa2a564bb357..b29dcea16fe8 100644 +--- a/tools/env/Makefile ++++ b/tools/env/Makefile +@@ -25,7 +25,7 @@ hostprogs-y := fw_printenv + + lib-y += fw_env.o \ + crc32.o ctype.o linux_string.o \ +- env_attr.o env_flags.o aes.o ../../lib/md5.o ++ env_attr.o env_flags.o aes.o ../../lib/md5.o ubootenv.o + + fw_printenv-objs := fw_env_main.o $(lib-y) + +diff --git a/tools/env/ubootenv.c b/tools/env/ubootenv.c +new file mode 100644 +index 000000000000..db789a55adaa +--- /dev/null ++++ b/tools/env/ubootenv.c +@@ -0,0 +1,62 @@ ++/* ++ * Copyright (c) 2017, Digi International Inc. ++ * ++ * This Source Code Form is subject to the terms of the Mozilla Public ++ * License, v. 2.0. If a copy of the MPL was not distributed with this ++ * file, you can obtain one at http://mozilla.org/MPL/2.0/. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ++ * ++ * Description: U-Boot environment get/set wrappers ++ * ++ */ ++ ++#include ++ ++#include "fw_env.h" ++ ++/* ++ * Function: uboot_getenv ++ * Description: get U-Boot's environment variable ++ */ ++int uboot_getenv(char *name, const char **value) ++{ ++ int ret = 0; ++ ++ ret = fw_env_open(); ++ if (ret) ++ goto err; ++ ++ *value = fw_getenv(name); ++ ++err: ++ return ret ? -1 : 0; ++} ++ ++/* ++ * Function: uboot_setenv ++ * Description: set U-Boot's environment variable ++ */ ++int uboot_setenv(char *name, char *value) ++{ ++ int ret = 0; ++ ++ ret = fw_env_open(); ++ if (ret) ++ goto err; ++ ++ ret = fw_env_write(name, value); ++ if (ret) ++ goto err; ++ ++ ret = fw_env_close(); ++ ++err: ++ return ret ? -1 : 0; ++} +diff --git a/tools/env/ubootenv.h b/tools/env/ubootenv.h +new file mode 100644 +index 000000000000..d4043db75372 +--- /dev/null ++++ b/tools/env/ubootenv.h +@@ -0,0 +1,46 @@ ++/* ++ * Copyright (c) 2017, Digi International Inc. ++ * ++ * This Source Code Form is subject to the terms of the Mozilla Public ++ * License, v. 2.0. If a copy of the MPL was not distributed with this ++ * file, you can obtain one at http://mozilla.org/MPL/2.0/. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ++ * ++ * Description: U-Boot environment get/set wrappers ++ * ++ */ ++ ++#ifndef UBOOTENV_H ++#define UBOOTENV_H ++ ++/* ++ * Get U-Boot's environment variable. ++ * ++ * Params: ++ * 'name' (input) Name of the environment variable ++ * 'value' (output) Pointer to the variable's value ++ * (NULL if not found) ++ * ++ * Return: 0 on sucess, -1 on failure ++ */ ++int uboot_getenv(char *name, const char **value); ++ ++/* ++ * Set U-Boot's environment variable. ++ * ++ * Params: ++ * 'name' (input) Name of the environment variable ++ * 'value' (input) Value of the environment variable ++ * ++ * Return: 0 on sucess, -1 on failure ++ */ ++int uboot_setenv(char *name, char *value); ++ ++#endif /* UBOOTENV_H */ diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/dey/0001-Allow-fw-env-tools-to-be-available-as-library.patch b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/dey/0001-Allow-fw-env-tools-to-be-available-as-library.patch new file mode 100644 index 000000000..527d16070 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/dey/0001-Allow-fw-env-tools-to-be-available-as-library.patch @@ -0,0 +1,27 @@ +From: Stefano Babic +Date: Mon, 22 Jun 2015 14:58:24 +0200 +Subject: [PATCH] Allow fw env tools to be available as library + +Signed-off-by: Stefano Babic +--- + tools/env/Makefile | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/tools/env/Makefile b/tools/env/Makefile +index de4766ddf8dd..fa2a564bb357 100644 +--- a/tools/env/Makefile ++++ b/tools/env/Makefile +@@ -23,10 +23,12 @@ endif + always := fw_printenv + hostprogs-y := fw_printenv + +-fw_printenv-objs := fw_env.o fw_env_main.o \ ++lib-y += fw_env.o \ + crc32.o ctype.o linux_string.o \ + env_attr.o env_flags.o aes.o ../../lib/md5.o + ++fw_printenv-objs := fw_env_main.o $(lib-y) ++ + quiet_cmd_crosstools_strip = STRIP $^ + cmd_crosstools_strip = $(STRIP) $^; touch $@ + diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend index e06cfdfc9..f584c707a 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend @@ -6,6 +6,7 @@ SRC_URI += " \ file://fw_env.config \ file://0001-tools-env-implement-support-for-environment-encrypti.patch \ " +SRC_URI_append = " file://0004-Implement-U-Boot-environment-access-functions.patch" SRC_URI_append_ccimx6 = " file://0002-fw_env-add-support-to-unlock-emmc-boot-partition.patch" # We do not have a platform defconfig in this version of u-boot, so just use the generic @@ -14,6 +15,8 @@ UBOOT_CONFIG = "sandbox" UBOOT_CONFIG[sandbox] = "sandbox_defconfig" do_install_append() { + install -d ${D}${includedir}/libubootenv + install -m 0644 ${S}/tools/env/ubootenv.h ${D}${includedir}/libubootenv/ install -m 0644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/ } diff --git a/meta-digi-arm/recipes-core/udev/udev-extraconf/automount.rules b/meta-digi-arm/recipes-core/udev/udev-extraconf/automount.rules index 8c1b63d48..3e8ee44c3 100644 --- a/meta-digi-arm/recipes-core/udev/udev-extraconf/automount.rules +++ b/meta-digi-arm/recipes-core/udev/udev-extraconf/automount.rules @@ -16,6 +16,10 @@ # Boot partitions SUBSYSTEM=="block", ENV{ID_PART_ENTRY_NAME}=="linux*", ACTION=="add", RUN+="/etc/udev/scripts/mount_bootparts.sh", GOTO="automount_rules_end" +# Update partition +SUBSYSTEM=="block", ENV{ID_PART_ENTRY_NAME}=="update*", ACTION=="add", RUN+="/etc/udev/scripts/mount_partition.sh 'update'", GOTO="automount_rules_end" +SUBSYSTEM=="mtd", ATTRS{name}=="update", ACTION=="add", RUN+="/etc/udev/scripts/mount_partition.sh 'update'", GOTO="automount_rules_end" + # Media automounting SUBSYSTEM=="block", ACTION=="add" RUN+="/etc/udev/scripts/mount.sh" SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh" diff --git a/meta-digi-arm/recipes-core/udev/udev-extraconf/mount_partition.sh b/meta-digi-arm/recipes-core/udev/udev-extraconf/mount_partition.sh new file mode 100644 index 000000000..05f719b18 --- /dev/null +++ b/meta-digi-arm/recipes-core/udev/udev-extraconf/mount_partition.sh @@ -0,0 +1,46 @@ +#!/bin/sh +#=============================================================================== +# +# mount_partition.sh +# +# Copyright (C) 2017 by Digi International Inc. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. +# +# !Description: Attempt to mount the partition triggered by udev +# +#=============================================================================== + +MOUNT="/bin/mount" +PARTITION_NAME="${1}" +MOUNTPOINT="/mnt/${PARTITION_NAME}" + +# Use 'silent' if util-linux's mount (busybox's does not support that option) +[ "$(readlink ${MOUNT})" = "/bin/mount.util-linux" ] && MOUNT="${MOUNT} -o silent" + +if mkdir -p "${MOUNTPOINT}" && ! mountpoint -q "${MOUNTPOINT}"; then + if [ "${SUBSYSTEM}" = "block" ]; then + FSTYPE="$(blkid ${DEVNAME} | sed -e 's,.*TYPE="\([^"]\+\)".*,\1,g')" + if ! mount ${FSTYPE:+-t ${FSTYPE}} "${DEVNAME}" "${MOUNTPOINT}"; then + logger -t udev "ERROR: Could not mount '${PARTITION_NAME}' partition" + rmdir --ignore-fail-on-non-empty ${MOUNTPOINT} + fi + elif [ "${SUBSYSTEM}" = "mtd" ]; then + # Attach and get UBI device number + dev_number="$(ubiattach -p ${DEVNAME} 2>/dev/null | sed -ne 's,.*device number \([0-9]\).*,\1,g;T;p' 2>/dev/null)" + # Check if volume exists. + if ubinfo "/dev/ubi${dev_number}" -N "${PARTITION_NAME}" >/dev/null 2>&1; then + # Mount the volume. + if ! mount -t ubifs "ubi${dev_number}:${PARTITION_NAME}" "${MOUNTPOINT}"; then + logger -t udev "ERROR: Could not mount '${PARTITION_NAME}' partition" + rmdir --ignore-fail-on-non-empty ${MOUNTPOINT} + fi + else + logger -t udev "ERROR: Could not mount '${PARTITION_NAME}' partition, volume not found" + rmdir --ignore-fail-on-non-empty ${MOUNTPOINT} + fi + fi +fi diff --git a/meta-digi-arm/recipes-core/udev/udev-extraconf_1.1.bbappend b/meta-digi-arm/recipes-core/udev/udev-extraconf_1.1.bbappend index 901ff61dd..662156665 100644 --- a/meta-digi-arm/recipes-core/udev/udev-extraconf_1.1.bbappend +++ b/meta-digi-arm/recipes-core/udev/udev-extraconf_1.1.bbappend @@ -2,10 +2,14 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" -SRC_URI += "file://mount_bootparts.sh" +SRC_URI += " \ + file://mount_bootparts.sh \ + file://mount_partition.sh \ +" do_install_append() { install -m 0755 ${WORKDIR}/mount_bootparts.sh ${D}${sysconfdir}/udev/scripts/ + install -m 0755 ${WORKDIR}/mount_partition.sh ${D}${sysconfdir}/udev/scripts/ # Bluetooth tty symlink if [ -n "${BT_TTY}" ]; then diff --git a/meta-digi-arm/recipes-digi/mca/mca-tool_1.0.bb b/meta-digi-arm/recipes-digi/mca/mca-tool_1.2.bb similarity index 67% rename from meta-digi-arm/recipes-digi/mca/mca-tool_1.0.bb rename to meta-digi-arm/recipes-digi/mca/mca-tool_1.2.bb index 0374451dc..803d231b7 100644 --- a/meta-digi-arm/recipes-digi/mca/mca-tool_1.0.bb +++ b/meta-digi-arm/recipes-digi/mca/mca-tool_1.2.bb @@ -7,8 +7,8 @@ LICENSE = "CLOSED" PKGNAME = "mca_tool" SRC_URI = "${DIGI_PKG_SRC}/${PKGNAME}-${PV}.tar.gz" -SRC_URI[md5sum] = "bee011ed0f1f2394c55bedaeda92f5cf" -SRC_URI[sha256sum] = "d6983fb0941a8b8c63c7369ef7285190be19ef446fc2a206e25a2c545a1ea671" +SRC_URI[md5sum] = "eb36b9e98c3ac30372343567c29f385d" +SRC_URI[sha256sum] = "864fdf42ce313e1a55caa654d53d9b9efa0073034914eb7b2e1ecc95f1a4fbf2" S = "${WORKDIR}/${PKGNAME}-${PV}" diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb index 17a2bdfbe..1ef977f14 100644 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb @@ -4,14 +4,11 @@ SUMMARY = "Qualcomm's wireless driver for qca6564" DESCRIPTION = "qcacld-2.0 module.bbclass mechanism." LICENSE = "ISC" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/ISC;md5=f3b90e78ea0cffb20bf5cca7947a896d" -DEPENDS = "virtual/kernel" - -inherit module CAF_MIRROR = "git://codeaurora.org/quic/la/platform/vendor/qcom-opensource/wlan/qcacld-2.0" -PV = "v4.2.74.63" +PV = "v4.2.79.63" SRCBRANCH = "caf-wlan/QCA6564_LE_1.0.3_LA.4.2.2.3" -SRCREV = "38f01638d75bdf3eb83ac428a4b6ec528b26f541" +SRCREV = "b0ae2aa45bbba54600b537e90cb1aca34f2d1a13" SRC_URI = " \ ${CAF_MIRROR};destsuffix=${PV};branch=${SRCBRANCH} \ @@ -29,16 +26,20 @@ SRC_URI = " \ file://0010-native_sdio-src-hif-Do-not-call-to-HIGH-SPEED-functi.patch \ file://0011-osdep_adf.h-fix-for-undefined-ath_sysctl_pktlog_size.patch \ file://0012-Kbuild-Add-compilation-flag-based-on-kernel-support.patch \ - file://0013-Kbuild-do-not-create-an-auxiliar-p2p-on-init.patch \ - file://0014-Kbuild-do-not-compile-the-DEBUG-version-inconditiona.patch \ - file://0015-Kbuild-Group-most-of-the-relevant-DEBUG-options.patch \ - file://0016-wlan_hdd_cfg80211-fix-missing-ifdef-clause.patch \ - file://0017-Add-.gitignore-rules.patch \ - file://0018-wlan_hdd_main-initialize-all-adapter-completion-vari.patch \ + file://0013-Kbuild-do-not-compile-the-DEBUG-version-inconditiona.patch \ + file://0014-Kbuild-Group-most-of-the-relevant-DEBUG-options.patch \ + file://0015-wlan_hdd_cfg80211-fix-missing-ifdef-clause.patch \ + file://0016-Add-.gitignore-rules.patch \ + file://0017-wlan_hdd_main-initialize-all-adapter-completion-vari.patch \ + file://0018-qcacld-Indicate-disconnect-event-to-upper-layers.patch \ + file://0019-wdd_hdd_main-Print-con_mode-to-clearly-see-if-in-FTM.patch \ + file://0020-Makefile-Pass-BUILD_DEBUG_VERSION-to-kbuild-system.patch \ " S = "${WORKDIR}/${PV}" +inherit module + EXTRA_OEMAKE += "CONFIG_CLD_HL_SDIO_CORE=y CONFIG_LINUX_QCMBR=y WLAN_OPEN_SOURCE=1" # Explicity state it is not a QC platform, if not the driver will try to remap # memory that is not allowed in ARMv6 (kernel commit @@ -48,7 +49,7 @@ EXTRA_OEMAKE += "CONFIG_NON_QC_PLATFORM=y" EXTRA_OEMAKE += "BUILD_DEBUG_VERSION=0" do_compile_prepend() { - export BUILD_VER=${PV} + export BUILD_VER=${PV} } do_install_append() { diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0014-Kbuild-do-not-compile-the-DEBUG-version-inconditiona.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0013-Kbuild-do-not-compile-the-DEBUG-version-inconditiona.patch similarity index 100% rename from meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0014-Kbuild-do-not-compile-the-DEBUG-version-inconditiona.patch rename to meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0013-Kbuild-do-not-compile-the-DEBUG-version-inconditiona.patch diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0013-Kbuild-do-not-create-an-auxiliar-p2p-on-init.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0013-Kbuild-do-not-create-an-auxiliar-p2p-on-init.patch deleted file mode 100644 index c8498dda3..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0013-Kbuild-do-not-create-an-auxiliar-p2p-on-init.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Isaac Hermida -Date: Mon, 27 Jun 2016 13:07:23 +0200 -Subject: [PATCH] Kbuild: do not create an auxiliar p2p on init - -Signed-off-by: Isaac Hermida ---- - Kbuild | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Kbuild b/Kbuild -index 339262874c94..b14417a558cd 100644 ---- a/Kbuild -+++ b/Kbuild -@@ -1254,7 +1254,7 @@ CDEFINES += -DQCA_HT_2040_COEX - else - - #Open P2P device interface only for non-Mobile router use cases --CDEFINES += -DWLAN_OPEN_P2P_INTERFACE -+# CDEFINES += -DWLAN_OPEN_P2P_INTERFACE - - #Enable 2.4 GHz social channels in 5 GHz only mode for p2p usage - CDEFINES += -DWLAN_ENABLE_SOCIAL_CHANNELS_5G_ONLY diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0015-Kbuild-Group-most-of-the-relevant-DEBUG-options.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0014-Kbuild-Group-most-of-the-relevant-DEBUG-options.patch similarity index 100% rename from meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0015-Kbuild-Group-most-of-the-relevant-DEBUG-options.patch rename to meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0014-Kbuild-Group-most-of-the-relevant-DEBUG-options.patch diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0016-wlan_hdd_cfg80211-fix-missing-ifdef-clause.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0015-wlan_hdd_cfg80211-fix-missing-ifdef-clause.patch similarity index 100% rename from meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0016-wlan_hdd_cfg80211-fix-missing-ifdef-clause.patch rename to meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0015-wlan_hdd_cfg80211-fix-missing-ifdef-clause.patch diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0017-Add-.gitignore-rules.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0016-Add-.gitignore-rules.patch similarity index 100% rename from meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0017-Add-.gitignore-rules.patch rename to meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0016-Add-.gitignore-rules.patch diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0018-wlan_hdd_main-initialize-all-adapter-completion-vari.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0017-wlan_hdd_main-initialize-all-adapter-completion-vari.patch similarity index 100% rename from meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0018-wlan_hdd_main-initialize-all-adapter-completion-vari.patch rename to meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0017-wlan_hdd_main-initialize-all-adapter-completion-vari.patch diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0018-qcacld-Indicate-disconnect-event-to-upper-layers.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0018-qcacld-Indicate-disconnect-event-to-upper-layers.patch new file mode 100644 index 000000000..4d55231dd --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0018-qcacld-Indicate-disconnect-event-to-upper-layers.patch @@ -0,0 +1,76 @@ +From: Alex Gonzalez +Date: Mon, 12 Dec 2016 16:19:48 +0100 +Subject: [PATCH] qcacld: Indicate disconnect event to upper layers. + +This is to avoid the following warning: + +------------[ cut here ]------------ +WARNING: CPU: 0 PID: 1120 at net/wireless/core.c:1140 cfg80211_netdev_notifier_call+0x3a0/0x574() +Modules linked in: wlan(O-) evbug [last unloaded: wlan] +CPU: 0 PID: 1120 Comm: rmmod Tainted: G O 4.1.15-95656-g4c5caa2cab98-dirty #11 +Hardware name: Freescale i.MX6 Ultralite (Device Tree) +[<80015ae4>] (unwind_backtrace) from [<8001269c>] (show_stack+0x10/0x14) +[<8001269c>] (show_stack) from [<80730464>] (dump_stack+0x84/0xc4) +[<80730464>] (dump_stack) from [<8002d220>] (warn_slowpath_common+0x80/0xb0) +[<8002d220>] (warn_slowpath_common) from [<8002d2ec>] (warn_slowpath_null+0x1c/0x24) +[<8002d2ec>] (warn_slowpath_null) from [<806bdad8>] (cfg80211_netdev_notifier_call+0x3a0/0x574) +[<806bdad8>] (cfg80211_netdev_notifier_call) from [<800462b8>] (notifier_call_chain+0x44/0x84) +[<800462b8>] (notifier_call_chain) from [<8004642c>] (raw_notifier_call_chain+0x18/0x20) +[<8004642c>] (raw_notifier_call_chain) from [<8057f8fc>] (rollback_registered_many+0x2a0/0x3a4) +[<8057f8fc>] (rollback_registered_many) from [<8057fa24>] (rollback_registered+0x24/0x38) +[<8057fa24>] (rollback_registered) from [<80581d24>] (unregister_netdevice_queue+0x54/0xb0) +[<80581d24>] (unregister_netdevice_queue) from [<80581d98>] (unregister_netdev+0x18/0x20) +[<80581d98>] (unregister_netdev) from [<7f02363c>] (hdd_close_all_adapters+0x7c/0xbc [wlan]) +[<7f02363c>] (hdd_close_all_adapters [wlan]) from [<7f025be4>] (hdd_wlan_exit+0x2e4/0x72c [wlan]) +[<7f025be4>] (hdd_wlan_exit [wlan]) from [<7f0260c8>] (__hdd_wlan_exit+0x9c/0xe4 [wlan]) +[<7f0260c8>] (__hdd_wlan_exit [wlan]) from [<7f1c3238>] (ath_hif_sdio_remove+0x54/0xfc [wlan]) +[<7f1c3238>] (ath_hif_sdio_remove [wlan]) from [<7f1c5de0>] (hifDeviceRemoved+0x7c/0x16c [wlan]) +[<7f1c5de0>] (hifDeviceRemoved [wlan]) from [<804e9c8c>] (sdio_bus_remove+0x30/0xf8) +[<804e9c8c>] (sdio_bus_remove) from [<8036f598>] (__device_release_driver+0x70/0xe4) +[<8036f598>] (__device_release_driver) from [<8036fd34>] (driver_detach+0xac/0xb0) +[<8036fd34>] (driver_detach) from [<8036f2f8>] (bus_remove_driver+0x4c/0xa0) +[<8036f2f8>] (bus_remove_driver) from [<7f1c53a8>] (HIFShutDownDevice+0xbc/0x17c [wlan]) +[<7f1c53a8>] (HIFShutDownDevice [wlan]) from [<7f1c36c4>] (hif_unregister_driver+0x28/0x48 [wlan]) +[<7f1c36c4>] (hif_unregister_driver [wlan]) from [<7f1d2fa8>] (hdd_module_exit+0x140/0x18c [wlan]) +[<7f1d2fa8>] (hdd_module_exit [wlan]) from [<8008ae18>] (SyS_delete_module+0x174/0x1b8) +[<8008ae18>] (SyS_delete_module) from [<8000f400>] (ret_fast_syscall+0x0/0x3c) +---[ end trace cb71790dd22e980e ]--- + +https://jira.digi.com/browse/DEL-3365 + +Signed-off-by: Alex Gonzalez +--- + CORE/HDD/src/wlan_hdd_cfg80211.c | 3 +++ + CORE/HDD/src/wlan_hdd_main.c | 5 +++++ + 2 files changed, 8 insertions(+) + +diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c +index 43543a9a473d..ae86c88fcfa5 100644 +--- a/CORE/HDD/src/wlan_hdd_cfg80211.c ++++ b/CORE/HDD/src/wlan_hdd_cfg80211.c +@@ -11038,6 +11038,9 @@ disconnected: + FL("Set HDD connState to eConnectionState_NotConnected")); + pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; + ++ /* indicate disconnected event to nl80211 */ ++ cfg80211_disconnected(pAdapter->dev, WLAN_REASON_UNSPECIFIED, NULL, 0, ++ GFP_KERNEL); + return 0; + } + +diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c +index df5b1065d463..f057f8c177b1 100755 +--- a/CORE/HDD/src/wlan_hdd_main.c ++++ b/CORE/HDD/src/wlan_hdd_main.c +@@ -9536,6 +9536,11 @@ VOS_STATUS hdd_stop_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter, + "%s: wait on disconnect_comp_var failed", + __func__); + } ++ else ++ { ++ cfg80211_disconnected(pAdapter->dev, WLAN_REASON_UNSPECIFIED, ++ NULL, 0, GFP_KERNEL); ++ } + } + else + { diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0019-wdd_hdd_main-Print-con_mode-to-clearly-see-if-in-FTM.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0019-wdd_hdd_main-Print-con_mode-to-clearly-see-if-in-FTM.patch new file mode 100644 index 000000000..7478b9ad3 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0019-wdd_hdd_main-Print-con_mode-to-clearly-see-if-in-FTM.patch @@ -0,0 +1,26 @@ +From: Alex Gonzalez +Date: Thu, 15 Dec 2016 13:31:12 +0100 +Subject: [PATCH] wdd_hdd_main: Print con_mode to clearly see if in FTM mode. + +We use FTM mode for RF testing. + +Signed-off-by: Alex Gonzalez +--- + CORE/HDD/src/wlan_hdd_main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c +index f057f8c177b1..d83602740b94 100755 +--- a/CORE/HDD/src/wlan_hdd_main.c ++++ b/CORE/HDD/src/wlan_hdd_main.c +@@ -12607,8 +12607,8 @@ static int hdd_driver_init( void) + #ifdef HDD_TRACE_RECORD + MTRACE(hddTraceInit()); + #endif +- pr_info("%s: loading driver v%s\n", WLAN_MODULE_NAME, +- QWLAN_VERSIONSTR TIMER_MANAGER_STR MEMORY_DEBUG_STR); ++ pr_info("%s: loading driver v%s in mode %d\n", WLAN_MODULE_NAME, ++ QWLAN_VERSIONSTR TIMER_MANAGER_STR MEMORY_DEBUG_STR, con_mode); + + do { + diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0020-Makefile-Pass-BUILD_DEBUG_VERSION-to-kbuild-system.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0020-Makefile-Pass-BUILD_DEBUG_VERSION-to-kbuild-system.patch new file mode 100644 index 000000000..cb1d3be24 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0020-Makefile-Pass-BUILD_DEBUG_VERSION-to-kbuild-system.patch @@ -0,0 +1,23 @@ +From: Alex Gonzalez +Date: Mon, 9 Jan 2017 16:51:17 +0100 +Subject: [PATCH] Makefile: Pass BUILD_DEBUG_VERSION to kbuild system. + +https://jira.digi.com/browse/DEL-3392 + +Signed-off-by: Alex Gonzalez +--- + Makefile | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Makefile b/Makefile +index c05b00f26c57..25cec85a0c1e 100644 +--- a/Makefile ++++ b/Makefile +@@ -16,6 +16,7 @@ KBUILD_OPTIONS += CONFIG_QCA_WIFI_ISOC=0 + KBUILD_OPTIONS += CONFIG_QCA_WIFI_2_0=1 + KBUILD_OPTIONS += $(WLAN_SELECT) + KBUILD_OPTIONS += WLAN_OPEN_SOURCE=$(WLAN_OPEN_SOURCE) ++KBUILD_OPTIONS += BUILD_DEBUG_VERSION=$(BUILD_DEBUG_VERSION) + KBUILD_OPTIONS += $(KBUILD_EXTRA) # Extra config if any + + all: diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm-pre-up b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm-pre-up index 60364501f..89efc7e75 100644 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm-pre-up +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm-pre-up @@ -15,7 +15,10 @@ # #=============================================================================== -[ "${IFACE}" != "wlan0" ] && exit 0 +[ "${IFACE}" != "wlan0" ] && [ "${IFACE}" != "p2p0" ] && exit 0 + +# If the qualcomm driver is already loaded exit +grep -qws 'wlan' /proc/modules && exit 0 FIRMWARE_DIR="/lib/firmware" MACFILE="${FIRMWARE_DIR}/wlan/wlan_mac.bin" @@ -68,7 +71,8 @@ case "${DTB_REGION_CODE}" in esac BDATA_LINK="${FIRMWARE_DIR}/bdwlan30.bin" -# Create a symbolic link to the FW file for the specific country region. +UTFBDATA_LINK="${FIRMWARE_DIR}/utfbd30.bin" +# Create a symbolic links to the FW files for the specific country region. BDATA_SOURCE="${FIRMWARE_DIR}/bdwlan30_US.bin" case "${REGULATORY_DOMAIN}" in ${US_CODE}) @@ -83,9 +87,10 @@ case "${REGULATORY_DOMAIN}" in esac # We don't want to rewrite NAND every time we boot so only -# change the link if it is wrong. +# change the links if they are wrong. if [ ! -e "${BDATA_LINK}" ] || ! cmp -s "${BDATA_LINK}" "${BDATA_SOURCE}"; then ln -sf "${BDATA_SOURCE}" "${BDATA_LINK}" + ln -sf "${BDATA_SOURCE}" "${UTFBDATA_LINK}" fi # Check the version of modprobe installed to compound the arguments. diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6ul/defconfig b/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6ul/defconfig index fba83f1be..d00b7da03 100644 --- a/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6ul/defconfig +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6ul/defconfig @@ -8,6 +8,9 @@ CONFIG_LOG_BUF_SHIFT=18 CONFIG_CGROUPS=y CONFIG_RELAY=y CONFIG_BLK_DEV_INITRD=y +# CONFIG_RD_LZMA is not set +# CONFIG_RD_XZ is not set +# CONFIG_RD_LZ4 is not set CONFIG_EXPERT=y CONFIG_KALLSYMS_ALL=y CONFIG_PERF_EVENTS=y @@ -19,9 +22,9 @@ CONFIG_MODVERSIONS=y CONFIG_MODULE_SRCVERSION_ALL=y # CONFIG_BLK_DEV_BSG is not set CONFIG_ARCH_MXC=y -CONFIG_SOC_IMX6Q=y CONFIG_SOC_IMX6UL=y # CONFIG_SWP_EMULATE is not set +CONFIG_ARM_ERRATA_764369=y CONFIG_SMP=y CONFIG_HAVE_ARM_ARCH_TIMER=y CONFIG_VMSPLIT_2G=y @@ -37,7 +40,6 @@ CONFIG_CPU_FREQ_GOV_USERSPACE=y CONFIG_CPU_FREQ_GOV_INTERACTIVE=y CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y CONFIG_ARM_IMX6Q_CPUFREQ=y -CONFIG_ARM_IMX7D_CPUFREQ=y CONFIG_CPU_IDLE=y CONFIG_VFP=y CONFIG_NEON=y @@ -59,7 +61,6 @@ CONFIG_VLAN_8021Q=y CONFIG_LLC2=y CONFIG_CAN=y CONFIG_CAN_FLEXCAN=y -CONFIG_CAN_M_CAN=y CONFIG_BT=y CONFIG_BT_RFCOMM=y CONFIG_BT_RFCOMM_TTY=y @@ -68,13 +69,12 @@ CONFIG_BT_BNEP_MC_FILTER=y CONFIG_BT_BNEP_PROTO_FILTER=y CONFIG_BT_HIDP=y CONFIG_BT_HCIUART=y +CONFIG_BT_HCIUART_ATH3K=y CONFIG_BT_HCIUART_IBS=y CONFIG_CFG80211=y CONFIG_CFG80211_CERTIFICATION_ONUS=y CONFIG_CFG80211_DEBUGFS=y CONFIG_CFG80211_WEXT=y -CONFIG_MAC80211=y -CONFIG_MAC80211_DEBUGFS=y CONFIG_RFKILL=y CONFIG_RFKILL_INPUT=y CONFIG_RFKILL_REGULATOR=y @@ -95,14 +95,8 @@ CONFIG_MTD_CFI_INTELEXT=y CONFIG_MTD_CFI_AMDSTD=y CONFIG_MTD_CFI_STAA=y CONFIG_MTD_PHYSMAP_OF=y -CONFIG_MTD_DATAFLASH=y -CONFIG_MTD_M25P80=y -CONFIG_MTD_SST25L=y CONFIG_MTD_NAND=y CONFIG_MTD_NAND_GPMI_NAND=y -CONFIG_MTD_NAND_MXC=y -CONFIG_MTD_SPI_NOR=y -CONFIG_SPI_FSL_QUADSPI=y CONFIG_MTD_UBI=y CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_RAM=y @@ -112,15 +106,11 @@ CONFIG_EEPROM_AT25=y CONFIG_SCSI=y # CONFIG_SCSI_PROC_FS is not set CONFIG_BLK_DEV_SD=y -CONFIG_SCSI_CONSTANTS=y -CONFIG_SCSI_LOGGING=y -CONFIG_SCSI_SCAN_ASYNC=y -# CONFIG_SCSI_LOWLEVEL is not set CONFIG_NETDEVICES=y # CONFIG_NET_VENDOR_ARC is not set +# CONFIG_NET_CADENCE is not set # CONFIG_NET_VENDOR_BROADCOM is not set -CONFIG_CS89x0=y -CONFIG_CS89x0_PLATFORM=y +# CONFIG_NET_VENDOR_CIRRUS is not set # CONFIG_NET_VENDOR_FARADAY is not set # CONFIG_NET_VENDOR_HISILICON is not set # CONFIG_NET_VENDOR_INTEL is not set @@ -128,11 +118,14 @@ CONFIG_CS89x0_PLATFORM=y # CONFIG_NET_VENDOR_MICREL is not set # CONFIG_NET_VENDOR_MICROCHIP is not set # CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_QUALCOMM is not set +# CONFIG_NET_VENDOR_ROCKER is not set +# CONFIG_NET_VENDOR_SAMSUNG is not set # CONFIG_NET_VENDOR_SEEQ is not set -CONFIG_SMC91X=y -CONFIG_SMC911X=y -CONFIG_SMSC911X=y +# CONFIG_NET_VENDOR_SMSC is not set # CONFIG_NET_VENDOR_STMICRO is not set +# CONFIG_NET_VENDOR_VIA is not set +# CONFIG_NET_VENDOR_WIZNET is not set CONFIG_SMSC_PHY=y CONFIG_USB_PEGASUS=m CONFIG_USB_RTL8150=m @@ -144,35 +137,28 @@ CONFIG_ATH_DEBUG=y CONFIG_HOSTAP=y CONFIG_HOSTAP_FIRMWARE=y CONFIG_HOSTAP_FIRMWARE_NVRAM=y -# CONFIG_RTL_CARDS is not set +CONFIG_INPUT_POLLDEV=y # CONFIG_INPUT_MOUSEDEV_PSAUX is not set CONFIG_INPUT_EVDEV=y CONFIG_INPUT_EVBUG=m CONFIG_KEYBOARD_GPIO=y CONFIG_KEYBOARD_IMX=y -CONFIG_MOUSE_PS2=m -CONFIG_MOUSE_PS2_ELANTECH=y +# CONFIG_INPUT_MOUSE is not set CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_ADS7846=y CONFIG_TOUCHSCREEN_FUSION_7_10=y CONFIG_TOUCHSCREEN_IMX6UL_TSC=y CONFIG_INPUT_MISC=y -CONFIG_INPUT_MMA8450=y -CONFIG_INPUT_MPL3115=y -CONFIG_SENSOR_FXLS8471=y -CONFIG_INPUT_ISL29023=y CONFIG_INPUT_MCA_CC6UL_PWRKEY=y CONFIG_SERIO_SERPORT=m # CONFIG_LEGACY_PTYS is not set # CONFIG_DEVKMEM is not set CONFIG_SERIAL_IMX=y CONFIG_SERIAL_IMX_CONSOLE=y -CONFIG_SERIAL_FSL_LPUART=y -CONFIG_SERIAL_FSL_LPUART_CONSOLE=y CONFIG_FSL_OTP=y # CONFIG_I2C_COMPAT is not set CONFIG_I2C_CHARDEV=y # CONFIG_I2C_HELPER_AUTO is not set +CONFIG_I2C_ALGOBIT=y CONFIG_I2C_ALGOPCF=m CONFIG_I2C_ALGOPCA=m CONFIG_I2C_IMX=y @@ -182,9 +168,6 @@ CONFIG_SPI_IMX=y CONFIG_SPI_SPIDEV=y CONFIG_GPIO_SYSFS=y CONFIG_GPIO_MCA_CC6UL=y -CONFIG_GPIO_MAX732X=y -CONFIG_GPIO_PCA953X=y -CONFIG_GPIO_74X164=y CONFIG_POWER_SUPPLY=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_SYSCON_POWEROFF=y @@ -197,12 +180,6 @@ CONFIG_WATCHDOG=y CONFIG_WATCHDOG_NOWAYOUT=y CONFIG_MCA_CC6UL_WATCHDOG=y CONFIG_IMX2_WDT=y -CONFIG_MFD_DA9052_I2C=y -CONFIG_MFD_MC13XXX_SPI=y -CONFIG_MFD_MC13XXX_I2C=y -CONFIG_MFD_MAX17135=y -CONFIG_MFD_SI476X_CORE=y -CONFIG_MFD_STMPE=y CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_REGULATOR_ANATOP=y @@ -213,30 +190,25 @@ CONFIG_MEDIA_CAMERA_SUPPORT=y CONFIG_V4L_PLATFORM_DRIVERS=y CONFIG_VIDEO_MXC_OUTPUT=y CONFIG_VIDEO_MXC_CAPTURE=y -CONFIG_MXC_CAMERA_OV5640=y -CONFIG_MXC_CAMERA_OV5642=y CONFIG_MXC_IPU_DEVICE_QUEUE_SDC=y +# CONFIG_MXC_IPU_PRP_ENC is not set CONFIG_VIDEO_MXC_PXP_V4L2=y CONFIG_VIDEO_MXC_CSI_CAMERA=y +CONFIG_MXC_SUBDEV_CAMERA_OV5640=y +CONFIG_MXC_SUBDEV_CAMERA_OV5642=y CONFIG_SOC_CAMERA=y CONFIG_V4L_MEM2MEM_DRIVERS=y CONFIG_VIDEO_CODA=y -CONFIG_SOC_CAMERA_OV2640=y -CONFIG_DRM=y CONFIG_FB=y +# CONFIG_FB_MX3 is not set CONFIG_FB_MXS=y CONFIG_FB_MXC_SYNC_PANEL=y -CONFIG_FB_MXC_MIPI_DSI_SAMSUNG=y -CONFIG_FB_MXC_TRULY_WVGA_SYNC_PANEL=y CONFIG_FB_MXC_LDB=y -CONFIG_FB_MXS_SII902X=y -CONFIG_FB_MXC_DCIC=m -CONFIG_HANNSTAR_CABC=y -CONFIG_FB_MXC_EINK_PANEL=y -CONFIG_FB_MXC_EINK_V2_PANEL=y +# CONFIG_FB_MXC_EDID is not set +CONFIG_BACKLIGHT_LCD_SUPPORT=y CONFIG_LCD_CLASS_DEVICE=y -CONFIG_LCD_L4F00242T03=y CONFIG_LCD_PLATFORM=y +CONFIG_BACKLIGHT_CLASS_DEVICE=y CONFIG_BACKLIGHT_PWM=y CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y @@ -247,14 +219,13 @@ CONFIG_FB_LOGO_CENTERED=y # CONFIG_LOGO_LINUX_CLUT224 is not set CONFIG_SOUND=y CONFIG_SND=y -CONFIG_SND_USB_AUDIO=m +# CONFIG_SND_SPI is not set +# CONFIG_SND_USB is not set CONFIG_SND_SOC=y CONFIG_SND_SOC_FSL_ASRC=y -CONFIG_SND_SOC_FSL_SAI=y -CONFIG_SND_SOC_FSL_SSI=y CONFIG_SND_SOC_FSL_ESAI=y -CONFIG_SND_SOC_IMX_AUDMUX=y CONFIG_SND_IMX_SOC=y +CONFIG_SND_SOC_IMX_MAX98088=y CONFIG_SND_SOC_IMX_SPDIF=y CONFIG_USB=y CONFIG_USB_OTG_WHITELIST=y @@ -323,28 +294,17 @@ CONFIG_STAGING_MEDIA=y # CONFIG_IOMMU_SUPPORT is not set CONFIG_IIO=y CONFIG_MCA_CC6UL_ADC=y +CONFIG_VF610_ADC=y CONFIG_TAMPER_MCA_CC6UL=y CONFIG_PWM=y CONFIG_PWM_IMX=y # CONFIG_RESET_GPIO is not set -CONFIG_EXT2_FS=y -CONFIG_EXT2_FS_XATTR=y -CONFIG_EXT2_FS_POSIX_ACL=y -CONFIG_EXT2_FS_SECURITY=y -CONFIG_EXT3_FS=y -CONFIG_EXT3_FS_POSIX_ACL=y -CONFIG_EXT3_FS_SECURITY=y CONFIG_EXT4_FS=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y -CONFIG_QUOTA=y -CONFIG_QUOTA_NETLINK_INTERFACE=y -# CONFIG_PRINT_QUOTA_WARNING is not set CONFIG_AUTOFS4_FS=y -CONFIG_FUSE_FS=y CONFIG_VFAT_FS=y CONFIG_TMPFS=y -CONFIG_JFFS2_FS=y CONFIG_UBIFS_FS=y CONFIG_NFS_FS=y CONFIG_NFS_V3_ACL=y @@ -361,13 +321,15 @@ CONFIG_MAGIC_SYSRQ=y # CONFIG_SCHED_DEBUG is not set # CONFIG_DEBUG_BUGVERBOSE is not set # CONFIG_FTRACE is not set -CONFIG_SECURITYFS=y CONFIG_CRYPTO_USER=y +CONFIG_CRYPTO_NULL=y CONFIG_CRYPTO_TEST=m CONFIG_CRYPTO_CBC=y +CONFIG_CRYPTO_CTR=y CONFIG_CRYPTO_CTS=y CONFIG_CRYPTO_LRW=y CONFIG_CRYPTO_XTS=y +CONFIG_CRYPTO_GHASH=y CONFIG_CRYPTO_MD4=y CONFIG_CRYPTO_MD5=y CONFIG_CRYPTO_RMD128=y diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey.inc b/meta-digi-arm/recipes-kernel/linux/linux-dey.inc index fc77b74c0..45990474e 100644 --- a/meta-digi-arm/recipes-kernel/linux/linux-dey.inc +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey.inc @@ -27,28 +27,34 @@ S = "${WORKDIR}/git" KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}" do_deploy_append() { - if [ "${TRUSTFENCE_SIGN}" = "1" ]; then - # Set environment variables for trustfence configuration - export CONFIG_SIGN_KEYS_PATH="${TRUSTFENCE_SIGN_KEYS_PATH}" - [ -n "${TRUSTFENCE_KEY_INDEX}" ] && export CONFIG_KEY_INDEX="${TRUSTFENCE_KEY_INDEX}" - [ -n "${TRUSTFENCE_DEK_PATH}" ] && [ "${TRUSTFENCE_DEK_PATH}" != "0" ] && export CONFIG_DEK_PATH="${TRUSTFENCE_DEK_PATH}" - - # Sign/encrypt the kernel image - "${STAGING_BINDIR_NATIVE}/trustfence-sign-kernel.sh" -p "${DIGI_FAMILY}" -l "${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin" "${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}-signed.bin" - mv "${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}-signed.bin" "${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin" - - # Sign/encrypt the device tree blobs - if [ -n "${KERNEL_DEVICETREE}" ]; then - for DTB_NAME in ${KERNEL_DEVICETREE}; do - DTB="${B}/arch/${ARCH}/boot/dts/${DTB_NAME}" - "${STAGING_BINDIR_NATIVE}/trustfence-sign-kernel.sh" -p "${DIGI_FAMILY}" -d "${DTB}" "${DTB}-signed" - mv "${DTB}-signed" "${DTB}" - done - fi - fi (cd ${DEPLOYDIR} && ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${KERNEL_IMAGE_SYMLINK_NAME}) } +do_deploy[postfuncs] += "${@base_conditional('TRUSTFENCE_SIGN', '1', 'trustfence_sign', '', d)}" + +trustfence_sign() { + # Set environment variables for trustfence configuration + export CONFIG_SIGN_KEYS_PATH="${TRUSTFENCE_SIGN_KEYS_PATH}" + [ -n "${TRUSTFENCE_KEY_INDEX}" ] && export CONFIG_KEY_INDEX="${TRUSTFENCE_KEY_INDEX}" + [ -n "${TRUSTFENCE_DEK_PATH}" ] && [ "${TRUSTFENCE_DEK_PATH}" != "0" ] && export CONFIG_DEK_PATH="${TRUSTFENCE_DEK_PATH}" + + # Sign/encrypt the kernel image + KERNEL_IMAGE="$(readlink -e ${DEPLOYDIR}/${KERNEL_IMAGE_SYMLINK_NAME})" + TMP_KERNEL_IMAGE_SIGNED="$(mktemp ${DEPLOYDIR}/${KERNEL_IMAGE_SYMLINK_NAME}-signed.XXXXXX)" + trustfence-sign-kernel.sh -p "${DIGI_FAMILY}" -l "${KERNEL_IMAGE}" "${TMP_KERNEL_IMAGE_SIGNED}" + mv "${TMP_KERNEL_IMAGE_SIGNED}" "${KERNEL_IMAGE}" + + # Sign/encrypt the device tree blobs + if [ -n "${KERNEL_DEVICETREE}" ]; then + for DTB_NAME in ${KERNEL_DEVICETREE}; do + DTB=$(readlink -e ${DEPLOYDIR}/${KERNEL_IMAGETYPE}-${DTB_NAME}) + TMP_DTB_SIGNED="$(mktemp ${DEPLOYDIR}/${KERNEL_IMAGETYPE}-${DTB_NAME}-signed.XXXXXX)" + trustfence-sign-kernel.sh -p "${DIGI_FAMILY}" -d "${DTB}" "${TMP_DTB_SIGNED}" + mv "${TMP_DTB_SIGNED}" "${DTB}" + done + fi +} + do_deploy[vardeps] += "TRUSTFENCE_SIGN_KEYS_PATH TRUSTFENCE_KEY_INDEX TRUSTFENCE_DEK_PATH" FILES_kernel-image += "/boot/config-${KERNEL_VERSION}" diff --git a/meta-digi-dey/conf/distro/dey.conf b/meta-digi-dey/conf/distro/dey.conf index db74c7149..3e73ee11b 100644 --- a/meta-digi-dey/conf/distro/dey.conf +++ b/meta-digi-dey/conf/distro/dey.conf @@ -1,6 +1,6 @@ DISTRO = "dey" DISTRO_NAME = "Digi Embedded Yocto" -DISTRO_VERSION = "2.0-r4" +DISTRO_VERSION = "2.0-r5" DISTRO_CODENAME = "jethro" SDK_VENDOR = "-deysdk" SDK_VERSION := "${@'${DISTRO_VERSION}'}" @@ -25,6 +25,9 @@ POKY_DEFAULT_DISTRO_FEATURES_remove = "ptest wayland" GRAPHICAL_BACKEND = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', 'fb', d)}" +# Recovery initramfs image name. +RECOVERY_INITRAMFS_IMAGE ?= "dey-image-recovery-initramfs" + # DEY image features (alphabetical order) FEATURE_PACKAGES_dey-audio = "packagegroup-dey-audio" FEATURE_PACKAGES_dey-bluetooth = "packagegroup-dey-bluetooth" @@ -50,6 +53,9 @@ PREFERRED_VERSION_linux-yocto_qemumips ?= "4.1%" PREFERRED_VERSION_linux-yocto_qemumips64 ?= "4.1%" PREFERRED_VERSION_linux-yocto_qemuppc ?= "4.1%" +# Use swupdate version 2016.10 +PREFERRED_VERSION_swupdate = "2016.10+git%" + SDK_NAME = "${DISTRO}-${TCLIBC}-${SDK_ARCH}-${IMAGE_BASENAME}-${TUNE_PKGARCH}" SDKPATH = "/opt/${DISTRO}/${SDK_VERSION}" diff --git a/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/ccimx6ul/wpa_supplicant_p2p.conf b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/ccimx6ul/wpa_supplicant_p2p.conf new file mode 100644 index 000000000..30a6699e6 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/ccimx6ul/wpa_supplicant_p2p.conf @@ -0,0 +1,8 @@ +ctrl_interface=/var/run/wpa_supplicant +update_config=1 +device_name=ccimx6ul-p2p +manufacturer=QCA +model_name=McK +device_type=1-0050F204-1 +config_methods=display keypad push_button +persistent_reconnect=1 diff --git a/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant_%.bbappend b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant_%.bbappend index 045b39c3e..28bb0c349 100644 --- a/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant_%.bbappend +++ b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant_%.bbappend @@ -4,4 +4,10 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" PACKAGECONFIG ?= "openssl" +SRC_URI_append_ccimx6ul = "file://wpa_supplicant_p2p.conf" + +do_install_append_ccimx6ul() { + install -m 600 ${WORKDIR}/wpa_supplicant_p2p.conf ${D}${sysconfdir}/wpa_supplicant_p2p.conf +} + PACKAGE_ARCH = "${MACHINE_ARCH}" diff --git a/meta-digi-dey/recipes-core/busybox/busybox-1.23.2/ccimx6ul/suspend b/meta-digi-dey/recipes-core/busybox/busybox-1.23.2/ccimx6ul/suspend index a87cdcd65..c89ed5ec1 100755 --- a/meta-digi-dey/recipes-core/busybox/busybox-1.23.2/ccimx6ul/suspend +++ b/meta-digi-dey/recipes-core/busybox/busybox-1.23.2/ccimx6ul/suspend @@ -27,18 +27,17 @@ usage() { suspend_interfaces() { if grep -qs '^wlan0' /var/run/ifstate; then - ifdown wlan0 && up_wlan_on_resume="1" && sleep 0.5 && rmmod wlan + ifdown wlan0 && up_wlan_on_resume="1" fi - if hcitool -i hci0 dev >/dev/null 2>&1; then - hciconfig hci0 down && up_hci0_on_resume="1" && sleep 0.5 + if grep -qs '^wlan' /proc/modules; then + rmmod wlan fi } resume_interfaces() { if ! grep -qs '^wlan0' /var/run/ifstate; then - [ -n "${up_wlan_on_resume}" ] && modprobe wlan && sleep 0.5 && ifup wlan0 + [ -n "${up_wlan_on_resume}" ] && ifup wlan0 fi - [ -n "${up_hci0_on_resume}" ] && hciconfig hci0 up } while getopts "h" c; do diff --git a/meta-digi-dey/recipes-core/images/dey-image-qt.bb b/meta-digi-dey/recipes-core/images/dey-image-qt.bb index 73b435b67..6cd4e2956 100644 --- a/meta-digi-dey/recipes-core/images/dey-image-qt.bb +++ b/meta-digi-dey/recipes-core/images/dey-image-qt.bb @@ -26,6 +26,11 @@ IMAGE_FEATURES += " \ ${@bb.utils.contains('MACHINE_FEATURES', 'wifi', 'dey-wireless', '', d)} \ " +# Separately add 'dey-gstreamer' to ccimx6ulsbc platform. +# This platform does not have 'accel-video' but we want gstreamer for using +# it with video/camera +IMAGE_FEATURES_append_ccimx6ulsbc = " dey-gstreamer" + # Remove some features to reduce the rootfs size to fit in the internal storage. IMAGE_FEATURES_remove_ccimx6ul = "package-management" diff --git a/meta-digi-dey/recipes-core/images/dey-image-recovery-initramfs.bb b/meta-digi-dey/recipes-core/images/dey-image-recovery-initramfs.bb new file mode 100644 index 000000000..42c91b785 --- /dev/null +++ b/meta-digi-dey/recipes-core/images/dey-image-recovery-initramfs.bb @@ -0,0 +1,34 @@ +# Copyright (C) 2016 Digi International. + +DESCRIPTION = "Recovery initramfs image" +LICENSE = "MIT" + +PACKAGE_INSTALL = " \ + busybox \ + psplash \ + recovery-initramfs \ + swupdate \ + trustfence-tool \ + u-boot-fw-utils \ + wipe \ +" + +PACKAGE_INSTALL_append_ccimx6 = " e2fsprogs-mke2fs parted" +PACKAGE_INSTALL_append_ccimx6ul = " mtd-utils-ubifs" + +# Do not pollute the initrd image with rootfs features +IMAGE_FEATURES = "" +IMAGE_LINGUAS = "" + +IMAGE_FSTYPES = "cpio.gz.u-boot.tf" +inherit core-image image_types_uboot + +IMAGE_ROOTFS_SIZE = "8192" + +# Remove some packages added via recommendations +BAD_RECOMMENDATIONS += " \ + busybox-syslog \ + openssl-conf \ +" + +export IMAGE_BASENAME = "dey-image-recovery-initramfs" diff --git a/meta-digi-dey/recipes-core/images/dey-image-tiny-initramfs.bb b/meta-digi-dey/recipes-core/images/dey-image-tiny-initramfs.bb index 0320a61ff..5219354ed 100644 --- a/meta-digi-dey/recipes-core/images/dey-image-tiny-initramfs.bb +++ b/meta-digi-dey/recipes-core/images/dey-image-tiny-initramfs.bb @@ -7,6 +7,5 @@ include dey-image-tiny.bb export IMAGE_BASENAME = "dey-image-tiny-initramfs" -IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}" -IMAGE_FSTYPES_append = " rootfs.initramfs" - +IMAGE_FSTYPES = "cpio.gz.u-boot.tf" +inherit image_types_uboot \ No newline at end of file diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.p2p b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.p2p new file mode 100644 index 000000000..18a4503cc --- /dev/null +++ b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.p2p @@ -0,0 +1,10 @@ + +# WiFi P2P interface +#auto ##WLAN_P2P_INTERFACE## +iface ##WLAN_P2P_INTERFACE## inet static + address ##P2P0_STATIC_IP## + netmask ##P2P0_STATIC_NETMASK## + gateway ##P2P0_STATIC_GATEWAY## + dns-nameservers ##P2P0_STATIC_DNS## + wpa-driver ##WPA_DRIVER## + wpa-conf /etc/wpa_supplicant_p2p.conf diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend index 06cd4c152..e6ad9edab 100644 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend +++ b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown_1.0.bbappend @@ -13,6 +13,7 @@ SRC_URI_append = " \ file://interfaces.eth1.dhcp \ file://interfaces.wlan0.static \ file://interfaces.wlan0.dhcp \ + file://interfaces.p2p \ file://interfaces.cellular \ file://resolv \ " @@ -26,7 +27,15 @@ do_install_append() { # Create 'interfaces' file dynamically cat ${WORKDIR}/interfaces.eth0.${ETH0_MODE} >> ${D}${sysconfdir}/network/interfaces [ -n "${HAVE_SECOND_ETH}" ] && cat ${WORKDIR}/interfaces.eth1.${ETH1_MODE} >> ${D}${sysconfdir}/network/interfaces - [ -n "${HAVE_WIFI}" ] && cat ${WORKDIR}/interfaces.wlan0.${WLAN0_MODE} >> ${D}${sysconfdir}/network/interfaces + + if [ -n "${HAVE_WIFI}" ]; then + cat ${WORKDIR}/interfaces.wlan0.${WLAN0_MODE} >> ${D}${sysconfdir}/network/interfaces + if [ -n "${WLAN_P2P_INTERFACE}" ]; then + cat ${WORKDIR}/interfaces.p2p >> ${D}${sysconfdir}/network/interfaces + [ -n "${WLAN_P2P_AUTO}" ] && sed -i -e 's/^#auto ##WLAN_P2P_INTERFACE##/auto ##WLAN_P2P_INTERFACE##/g' ${D}${sysconfdir}/network/interfaces + sed -i -e 's,##WLAN_P2P_INTERFACE##,${WLAN_P2P_INTERFACE},g' ${D}${sysconfdir}/network/interfaces + fi + fi cat ${WORKDIR}/interfaces.br0.example >> ${D}${sysconfdir}/network/interfaces # Remove config entries if corresponding variable is not defined @@ -42,6 +51,10 @@ do_install_append() { [ -z "${WLAN0_STATIC_GATEWAY}" ] && sed -i -e "/##WLAN0_STATIC_GATEWAY##/d" ${D}${sysconfdir}/network/interfaces [ -z "${WLAN0_STATIC_IP}" ] && sed -i -e "/##WLAN0_STATIC_IP##/d" ${D}${sysconfdir}/network/interfaces [ -z "${WLAN0_STATIC_NETMASK}" ] && sed -i -e "/##WLAN0_STATIC_NETMASK##/d" ${D}${sysconfdir}/network/interfaces + [ -z "${P2P0_STATIC_DNS}" ] && sed -i -e "/##P2P0_STATIC_DNS##/d" ${D}${sysconfdir}/network/interfaces + [ -z "${P2P0_STATIC_GATEWAY}" ] && sed -i -e "/##P2P0_STATIC_GATEWAY##/d" ${D}${sysconfdir}/network/interfaces + [ -z "${P2P0_STATIC_IP}" ] && sed -i -e "/##P2P0_STATIC_IP##/d" ${D}${sysconfdir}/network/interfaces + [ -z "${P2P0_STATIC_NETMASK}" ] && sed -i -e "/##P2P0_STATIC_NETMASK##/d" ${D}${sysconfdir}/network/interfaces # Cellular interface if [ -n "${@bb.utils.contains('DISTRO_FEATURES', 'cellular', '1', '', d)}" ] && [ -n "${CELLULAR_INTERFACE}" ]; then @@ -94,5 +107,9 @@ do_install_append() { sed -i -e "s,##WLAN0_STATIC_NETMASK##,${WLAN0_STATIC_NETMASK},g" ${D}${sysconfdir}/network/interfaces sed -i -e "s,##WLAN0_STATIC_GATEWAY##,${WLAN0_STATIC_GATEWAY},g" ${D}${sysconfdir}/network/interfaces sed -i -e "s,##WLAN0_STATIC_DNS##,${WLAN0_STATIC_DNS},g" ${D}${sysconfdir}/network/interfaces + sed -i -e "s,##P2P0_STATIC_IP##,${P2P0_STATIC_IP},g" ${D}${sysconfdir}/network/interfaces + sed -i -e "s,##P2P0_STATIC_NETMASK##,${P2P0_STATIC_NETMASK},g" ${D}${sysconfdir}/network/interfaces + sed -i -e "s,##P2P0_STATIC_GATEWAY##,${P2P0_STATIC_GATEWAY},g" ${D}${sysconfdir}/network/interfaces + sed -i -e "s,##P2P0_STATIC_DNS##,${P2P0_STATIC_DNS},g" ${D}${sysconfdir}/network/interfaces sed -i -e "s,##WPA_DRIVER##,${WPA_DRIVER},g" ${D}${sysconfdir}/network/interfaces } diff --git a/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb b/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb index 7b6c6baa7..d8201c7dd 100644 --- a/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb +++ b/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb @@ -32,6 +32,7 @@ RDEPENDS_${PN} = "\ busybox \ busybox-acpid \ busybox-static-nodes \ + cloudconnector \ ${@bb.utils.contains("MACHINE_FEATURES", "keyboard", "${VIRTUAL-RUNTIME_keymaps}", "", d)} \ ${@bb.utils.contains("MACHINE_FEATURES", "rtc", "busybox-hwclock", "", d)} \ ${@bb.utils.contains("MACHINE_FEATURES", "touchscreen", "${VIRTUAL-RUNTIME_touchscreen}", "",d)} \ @@ -39,6 +40,7 @@ RDEPENDS_${PN} = "\ modutils-initscripts \ netbase \ os-release \ + recovery-utils \ sysinfo \ usbutils \ ${VIRTUAL-RUNTIME_dev_manager} \ diff --git a/meta-digi-dey/recipes-core/psplash/files/0001-colors-modify-psplash-colors-to-match-Digi-scheme.patch b/meta-digi-dey/recipes-core/psplash/files/0001-colors-modify-psplash-colors-to-match-Digi-scheme.patch new file mode 100644 index 000000000..b7749273f --- /dev/null +++ b/meta-digi-dey/recipes-core/psplash/files/0001-colors-modify-psplash-colors-to-match-Digi-scheme.patch @@ -0,0 +1,33 @@ +From: David Escalona +Date: Thu, 29 Dec 2016 09:42:26 +0100 +Subject: [PATCH] colors: modify psplash colors to match Digi scheme + +Signed-off-by: David Escalona +--- + psplash-colors.h | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/psplash-colors.h b/psplash-colors.h +index d701089..0795409 100644 +--- a/psplash-colors.h ++++ b/psplash-colors.h +@@ -20,15 +20,15 @@ + #define _HAVE_PSPLASH_COLORS_H + + /* This is the overall background color */ +-#define PSPLASH_BACKGROUND_COLOR 0xec,0xec,0xe1 ++#define PSPLASH_BACKGROUND_COLOR 0x00,0x00,0x00 + + /* This is the color of any text output */ +-#define PSPLASH_TEXT_COLOR 0x6d,0x6d,0x70 ++#define PSPLASH_TEXT_COLOR 0xff,0xff,0xff + + /* This is the color of the progress bar indicator */ +-#define PSPLASH_BAR_COLOR 0x6d,0x6d,0x70 ++#define PSPLASH_BAR_COLOR 0xca,0xca,0xca + + /* This is the color of the progress bar background */ +-#define PSPLASH_BAR_BACKGROUND_COLOR 0xec,0xec,0xe1 ++#define PSPLASH_BAR_BACKGROUND_COLOR 0x00,0x00,0x00 + + #endif diff --git a/meta-digi-dey/recipes-core/psplash/files/0002-bar-replace-progress-bar-with-Digi-one.patch b/meta-digi-dey/recipes-core/psplash/files/0002-bar-replace-progress-bar-with-Digi-one.patch new file mode 100644 index 000000000..b231390b6 --- /dev/null +++ b/meta-digi-dey/recipes-core/psplash/files/0002-bar-replace-progress-bar-with-Digi-one.patch @@ -0,0 +1,104 @@ +From: David Escalona +Date: Thu, 29 Dec 2016 10:45:39 +0100 +Subject: [PATCH] bar: replace progress bar with Digi one + +Signed-off-by: David Escalona +--- + psplash-bar-img.h | 84 ++++++++++++++++++++++++++++--------------------------- + 1 file changed, 43 insertions(+), 41 deletions(-) + +diff --git a/psplash-bar-img.h b/psplash-bar-img.h +index c1c7626..28843cd 100644 +--- a/psplash-bar-img.h ++++ b/psplash-bar-img.h +@@ -1,47 +1,49 @@ + /* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */ + +-#define BAR_IMG_ROWSTRIDE (920) +-#define BAR_IMG_WIDTH (230) +-#define BAR_IMG_HEIGHT (28) ++#define BAR_IMG_ROWSTRIDE (1520) ++#define BAR_IMG_WIDTH (380) ++#define BAR_IMG_HEIGHT (30) + #define BAR_IMG_BYTES_PER_PIXEL (4) /* 3:RGB, 4:RGBA */ + #define BAR_IMG_RLE_PIXEL_DATA ((uint8*) \ +- "\203\354\354\341\377\4\326\326\315\377\236\236\233\377\200\200\201\377" \ +- "nnq\377\377mmp\377\331mmp\377\4nnq\377\200\200\201\377\236\236\233\377" \ +- "\326\326\315\377\205\354\354\341\377\2\260\260\253\377oor\377\377mmp" \ +- "\377\337mmp\377\2oor\377\260\260\253\377\203\354\354\341\377\1\262\262" \ +- "\256\377\377mmp\377\343mmp\377\4\262\262\256\377\354\354\341\377\332" \ +- "\332\321\377pps\377\377mmp\377\343mmp\377\3pps\377\332\332\321\377\244" \ +- "\244\241\377\204mmp\377\1\205\205\205\377\377\354\354\341\377\333\354" \ +- "\354\341\377\1\205\205\205\377\204mmp\377\2\244\244\241\377\210\210\210" \ +- "\377\203mmp\377\2\203\203\203\377\351\351\336\377\377\354\354\341\377" \ +- "\333\354\354\341\377\2\351\351\336\377\203\203\203\377\203mmp\377\2\210" \ +- "\210\210\377qqs\377\203mmp\377\1\255\255\251\377\377\354\354\341\377" \ +- "\335\354\354\341\377\1\255\255\251\377\203mmp\377\1qqs\377\204mmp\377" \ +- "\1\270\270\262\377\377\354\354\341\377\336\354\354\341\377\210mmp\377" \ +- "\1\270\270\262\377\377\354\354\341\377\336\354\354\341\377\210mmp\377" \ +- "\1\270\270\262\377\377\354\354\341\377\336\354\354\341\377\210mmp\377" \ +- "\1\270\270\262\377\377\354\354\341\377\336\354\354\341\377\210mmp\377" \ +- "\1\270\270\262\377\377\354\354\341\377\336\354\354\341\377\210mmp\377" \ +- "\1\270\270\262\377\377\354\354\341\377\336\354\354\341\377\210mmp\377" \ +- "\1\270\270\262\377\377\354\354\341\377\336\354\354\341\377\210mmp\377" \ +- "\1\270\270\262\377\377\354\354\341\377\336\354\354\341\377\210mmp\377" \ +- "\1\270\270\262\377\377\354\354\341\377\336\354\354\341\377\210mmp\377" \ +- "\1\270\270\262\377\377\354\354\341\377\336\354\354\341\377\210mmp\377" \ +- "\1\270\270\262\377\377\354\354\341\377\336\354\354\341\377\210mmp\377" \ +- "\1\270\270\262\377\377\354\354\341\377\336\354\354\341\377\210mmp\377" \ +- "\1\270\270\262\377\377\354\354\341\377\336\354\354\341\377\210mmp\377" \ +- "\1\270\270\262\377\377\354\354\341\377\336\354\354\341\377\204mmp\377" \ +- "\1qqs\377\203mmp\377\1\255\255\251\377\377\354\354\341\377\335\354\354" \ +- "\341\377\1\255\255\251\377\203mmp\377\2qqs\377\210\210\210\377\203mm" \ +- "p\377\2\203\203\203\377\351\351\336\377\377\354\354\341\377\333\354\354" \ +- "\341\377\2\351\351\336\377\203\203\203\377\203mmp\377\2\210\210\210\377" \ +- "\244\244\241\377\204mmp\377\1\205\205\205\377\377\354\354\341\377\333" \ +- "\354\354\341\377\1\205\205\205\377\204mmp\377\3\244\244\241\377\332\332" \ +- "\321\377pps\377\377mmp\377\343mmp\377\4pps\377\332\332\321\377\354\354" \ +- "\341\377\262\262\256\377\377mmp\377\343mmp\377\1\262\262\256\377\203" \ +- "\354\354\341\377\2\260\260\253\377oor\377\377mmp\377\337mmp\377\2oor" \ +- "\377\260\260\253\377\205\354\354\341\377\4\326\326\315\377\236\236\233" \ +- "\377\200\200\201\377nnq\377\377mmp\377\331mmp\377\4nnq\377\200\200\201" \ +- "\377\236\236\233\377\326\326\315\377\203\354\354\341\377") ++ "\377\312\312\312\377\377\312\312\312\377\377\312\312\312\377\377\312\312" \ ++ "\312\377\377\312\312\312\377\377\312\312\312\377\377\377\377\377\0\377" \ ++ "\377\377\377\0\372\377\377\377\0\204\312\312\312\377\377\377\377\377" \ ++ "\0\377\377\377\377\0\372\377\377\377\0\204\312\312\312\377\377\377\377" \ ++ "\377\0\377\377\377\377\0\372\377\377\377\0\204\312\312\312\377\377\377" \ ++ "\377\377\0\377\377\377\377\0\372\377\377\377\0\204\312\312\312\377\377" \ ++ "\377\377\377\0\377\377\377\377\0\372\377\377\377\0\204\312\312\312\377" \ ++ "\377\377\377\377\0\377\377\377\377\0\372\377\377\377\0\204\312\312\312" \ ++ "\377\377\377\377\377\0\377\377\377\377\0\372\377\377\377\0\204\312\312" \ ++ "\312\377\377\377\377\377\0\377\377\377\377\0\372\377\377\377\0\204\312" \ ++ "\312\312\377\377\377\377\377\0\377\377\377\377\0\372\377\377\377\0\204" \ ++ "\312\312\312\377\377\377\377\377\0\377\377\377\377\0\372\377\377\377" \ ++ "\0\204\312\312\312\377\377\377\377\377\0\377\377\377\377\0\372\377\377" \ ++ "\377\0\202\312\312\312\377\2\312\312\312\373\312\312\312\377\377\377" \ ++ "\377\377\0\377\377\377\377\0\372\377\377\377\0\1\312\312\312\377\202" \ ++ "\312\312\312\373\1\312\312\312\377\377\377\377\377\0\377\377\377\377" \ ++ "\0\372\377\377\377\0\1\312\312\312\377\202\312\312\312\373\1\312\312" \ ++ "\312\377\377\377\377\377\0\377\377\377\377\0\372\377\377\377\0\1\312" \ ++ "\312\312\377\202\312\312\312\373\1\312\312\312\377\377\377\377\377\0" \ ++ "\377\377\377\377\0\372\377\377\377\0\1\312\312\312\377\202\312\312\312" \ ++ "\373\1\312\312\312\377\377\377\377\377\0\377\377\377\377\0\372\377\377" \ ++ "\377\0\1\312\312\312\377\202\312\312\312\373\1\312\312\312\377\377\377" \ ++ "\377\377\0\377\377\377\377\0\372\377\377\377\0\1\312\312\312\377\202" \ ++ "\312\312\312\373\1\312\312\312\377\377\377\377\377\0\377\377\377\377" \ ++ "\0\372\377\377\377\0\1\312\312\312\377\202\312\312\312\373\1\312\312" \ ++ "\312\377\377\377\377\377\0\377\377\377\377\0\372\377\377\377\0\1\312" \ ++ "\312\312\377\202\312\312\312\373\1\312\312\312\377\377\377\377\377\0" \ ++ "\377\377\377\377\0\372\377\377\377\0\1\312\312\312\377\202\312\312\312" \ ++ "\373\1\312\312\312\377\377\377\377\377\0\377\377\377\377\0\372\377\377" \ ++ "\377\0\1\312\312\312\377\202\312\312\312\373\1\312\312\312\377\377\377" \ ++ "\377\377\0\377\377\377\377\0\372\377\377\377\0\1\312\312\312\377\202" \ ++ "\312\312\312\373\1\312\312\312\377\377\377\377\377\0\377\377\377\377" \ ++ "\0\372\377\377\377\0\1\312\312\312\377\202\312\312\312\373\1\312\312" \ ++ "\312\377\377\377\377\377\0\377\377\377\377\0\372\377\377\377\0\1\312" \ ++ "\312\312\377\202\312\312\312\373\1\312\312\312\377\377\377\377\377\0" \ ++ "\377\377\377\377\0\372\377\377\377\0\1\312\312\312\377\202\312\312\312" \ ++ "\373\1\312\312\312\377\377\377\377\377\0\377\377\377\377\0\372\377\377" \ ++ "\377\0\1\312\312\312\377\202\312\312\312\373\377\312\312\312\377\377" \ ++ "\312\312\312\377\374\312\312\312\377\202\312\312\312\373\377\312\312" \ ++ "\312\377\377\312\312\312\377\374\312\312\312\377\1\312\312\312\373") + + diff --git a/meta-digi-dey/recipes-core/psplash/files/psplash-init b/meta-digi-dey/recipes-core/psplash/files/psplash-init new file mode 100755 index 000000000..d3364d371 --- /dev/null +++ b/meta-digi-dey/recipes-core/psplash/files/psplash-init @@ -0,0 +1,31 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: psplash +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +### END INIT INFO + +read CMDLINE < /proc/cmdline +for x in $CMDLINE; do + case $x in + psplash=false) + echo "Boot splashscreen disabled" + exit 0; + ;; + esac +done + +export TMPDIR=/mnt/.psplash +mount tmpfs -t tmpfs $TMPDIR -o,size=40k + +rotation=0 +if [ -e /etc/rotation ]; then + read rotation < /etc/rotation +fi + +if [ -c "${FBDEV:-/dev/fb0}" ]; then + /usr/bin/psplash --angle $rotation & +fi + diff --git a/meta-digi-dey/recipes-core/psplash/files/psplash-poky-img.h b/meta-digi-dey/recipes-core/psplash/files/psplash-poky-img.h new file mode 100644 index 000000000..15b0c82c6 --- /dev/null +++ b/meta-digi-dey/recipes-core/psplash/files/psplash-poky-img.h @@ -0,0 +1,718 @@ +/* GdkPixbuf RGB C-Source image dump 1-byte-run-length-encoded */ + +#define POKY_IMG_ROWSTRIDE (1350) +#define POKY_IMG_WIDTH (450) +#define POKY_IMG_HEIGHT (200) +#define POKY_IMG_BYTES_PER_PIXEL (3) /* 3:RGB, 4:RGBA */ +#define POKY_IMG_RLE_PIXEL_DATA ((uint8*) \ + "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0" \ + "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0" \ + "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0" \ + "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" \ + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" \ + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" \ + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" \ + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" \ + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" \ + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" \ + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" \ + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" \ + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" \ + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" \ + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" \ + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" \ + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\312" \ + "\0\0\0\14\15\15\15\37\37\37""555VVV}}}\235\235\235\265\265\265\311\311" \ + "\311\325\325\325\341\341\341\350\350\350\360\360\360\213\374\374\374" \ + "\20\360\360\360\350\350\350\337\337\337\325\325\325\317\317\317\302\302" \ + "\302\271\271\271\235\235\235\227\227\227}}}YYYQQQ;;;\37\37\37\12\12\12" \ + "\3\3\3\377\0\0\0\312\0\0\0\1\37\37\37\265\40\40\40\6\37\37\37\22\22\22" \ + "\21\21\21\22\22\22\16\16\16\6\6\6\276\0\0\0\2\11\11\11\37\37\37\227\40" \ + "\40\40\2###\25\25\25\270\0\0\0\7\16\16\16(((VVV\204\204\204\241\241\241" \ + "\305\305\305\352\352\352\242\377\377\377\12\350\350\350\300\300\300\253" \ + "\253\253\225\225\225\177\177\177\\\\\\999+++\25\25\25\6\6\6\252\0\0\0" \ + "\1\5\5\5\230\40\40\40\2###\32\32\32\240\0\0\0\2\7\13\5\21\32\15\332\21" \ + "\30\14\2\21\32\15\327\327\327\265\342\342\342\1\341\341\341\202\322\322" \ + "\322\12\325\325\325\314\314\314\265\265\265\243\243\243\211\211\211t" \ + "ttYYY555\22\22\22\5\5\5\267\0\0\0\2EEE\337\337\337\227\342\342\342\3" \ + "\344\344\344\241\241\241\5\5\5\263\0\0\0\7\5\5\5'''\\\\\\\223\223\223" \ + "\313\313\313\347\347\347\373\373\373\253\377\377\377\13\376\376\376\360" \ + "\360\360\350\350\350\327\327\327\266\266\266\217\217\217qqqQQQ(((\22" \ + "\22\22\5\5\5\244\0\0\0\1###\230\342\342\342\2\344\344\344\273\273\273" \ + "\240\0\0\0\2""9T*v\256V\332u\255V\2x\261X\373\373\373\277\377\377\377" \ + "\6\360\360\360\331\331\331\262\262\262{{{EEE\15\15\15\264\0\0\0\1KKK" \ + "\231\377\377\377\2\265\265\265\3\3\3\261\0\0\0\4'''iii\260\260\260\350" \ + "\350\350\270\377\377\377\7\354\354\354\331\331\331\257\257\257\201\201" \ + "\201YYY555\16\16\16\240\0\0\0\1'''\231\377\377\377\1\331\331\331\240" \ + "\0\0\0\1>\\.\333\204\303a\2d\223I\363\363\363\303\377\377\377\5\371\371" \ + "\371\327\327\327\230\230\230CCC\21\21\21\261\0\0\0\2HHH\371\371\371\230" \ + "\377\377\377\2\260\260\260\3\3\3\256\0\0\0\4\22\22\22UUU\262\262\262" \ + "\347\347\347\300\377\377\377\3\360\360\360\320\320\320%%%\237\0\0\0\1" \ + "%%%\231\377\377\377\1\322\322\322\240\0\0\0\1/dev/null)\"" +} + +#------------------------------------------------------------------------------ +# Function - psplash_message +# +# Shows the given message in the psplash screen. +# +# @param ${1} - Message to show. +#------------------------------------------------------------------------------ +psplash_message() { + echo "MSG ${1}" > /tmp/psplash_fifo + sleep 0.2 +} + +#------------------------------------------------------------------------------ +# Function - psplash_progress +# +# Sets the psplash progress bar percentage to the given one. +# +# @param ${1} - Progress percentage. +#------------------------------------------------------------------------------ +psplash_progress() { + echo "PROGRESS ${1}" > /tmp/psplash_fifo + sleep 0.2 +} + +#------------------------------------------------------------------------------ +# Function - reboot_system +# +# Reboots the system. +#------------------------------------------------------------------------------ +reboot_system() { + sync && reboot -f +} + +#------------------------------------------------------------------------------ +# Function - quit_with_error +# +# Ends the recovery process with the given error message. +# +# @param ${1} - Error message. +#------------------------------------------------------------------------------ +quit_with_error() { + clear_uboot_vars + log_error "${1}" + log "The system will now reboot in ${REBOOT_TIME} seconds" + sleep "${REBOOT_TIME}" + reboot_system +} + +#------------------------------------------------------------------------------ +# Function - is_nand +# +# Verifies if the system is running in a NAND flash. +# +# @return - "yes" if the system is running in NAND, "no" otherwise +#------------------------------------------------------------------------------ +is_nand() { + if [ -f /proc/mtd ] && grep -qs mtd /proc/mtd; then + echo "yes" + else + echo "no" + fi +} + +#------------------------------------------------------------------------------ +# Function - mount_external_disks +# +# Mounts all available external disks. +#------------------------------------------------------------------------------ +mount_external_disks() { + local devices=$(ls -1 /dev/sd? 2>/dev/null) + for device in ${devices}; do + for i in ${device}?; do + local dev_name=$(basename "${i}") + local mount_dir="${USB_MOUNT_DIR}/${dev_name}" + mkdir -p "${mount_dir}" + FSTYPE="$(blkid /dev/${dev_name} | sed -e 's,.*TYPE="\([^"]\+\)".*,\1,g')" + mount -r ${FSTYPE:+-t ${FSTYPE}} "/dev/${dev_name}" "${mount_dir}" + done + done +} + +#------------------------------------------------------------------------------ +# Function - mount_partition +# +# Mounts the given partition. +# +# @param ${1} - Partition name to mount. +# @param ${2} - Mount point. +#------------------------------------------------------------------------------ +mount_partition() { + if [ "$(is_nand)" = "yes" ]; then + mount_ubi_volume "${1}" "${2}" + else + mount_emmc_block "${1}" "${2}" + fi +} + +#------------------------------------------------------------------------------ +# Function - mount_ubi_volume +# +# Mounts the given UBI volume. +# +# @param ${1} - UBI Volume name to mount. +# @param ${2} - Mount point. +#------------------------------------------------------------------------------ +mount_ubi_volume() { + # Find the MTD partition. + local mtd_num="$(sed -ne "s/mtd\([0-9]\+\):.*\<${1}\>.*/\1/g;T;p" /proc/mtd 2>/dev/null)" + if [ -z "${mtd_num}" ]; then + log_warning "Could not find MTD partition for volume '${1}'" + else + # Attach and get UBI device number + local dev_number="$(ubiattach -p /dev/mtd${mtd_num} 2>/dev/null | sed -ne 's,.*device number \([0-9]\).*,\1,g;T;p' 2>/dev/null)" + # Check if volume exists. + ubinfo "/dev/ubi${dev_number}" -N "${1}" >/dev/null 2>&1 + if [ "$?" = "0" ]; then + # Mount the volume. + mkdir -p "${2}" + mount -t ubifs "ubi${dev_number}:${1}" "${2}" >/dev/null 2>&1 + if [ "$?" != "0" ]; then + log_warning "Could not mount '${1}' partition" + fi + else + log_warning "Could not mount '${1}' partition, volume not found" + fi + fi +} + +#------------------------------------------------------------------------------ +# Function - mount_emmc_block +# +# Mounts the given emmc partition block name. +# +# @param ${1} - Partition name to mount. +# @param ${2} - Mount point. +#------------------------------------------------------------------------------ +mount_emmc_block() { + # Find partition block number. + local partition_block="/dev/mmcblk0p$(parted -s /dev/mmcblk0 print | sed -ne "s,^[^0-9]*\([0-9]\+\).*\<${1}\>.*,\1,g;T;p")" + # Mount the volume. + mkdir -p "${2}" + FSTYPE="$(blkid ${partition_block} | sed -e 's,.*TYPE="\([^"]\+\)".*,\1,g')" + mount -r ${FSTYPE:+-t ${FSTYPE}} "${partition_block}" "${2}" + if [ "$?" != "0" ]; then + log_warning "Could not mount '${1}' partition (${partition_block})" + fi +} + +#------------------------------------------------------------------------------ +# Function - format_partition +# +# Formats the given partition. +# +# @param ${1} - Partition name to format. +#------------------------------------------------------------------------------ +format_partition() { + if [ "$(is_nand)" = "yes" ]; then + format_ubi_volume "${1}" + else + format_emmc_block "${1}" + fi +} + +#------------------------------------------------------------------------------ +# Function - format_ubi_volume +# +# Formats and re-creates the given UBI volume. +# +# @param ${1} - UBI Volume name to format. +#------------------------------------------------------------------------------ +format_ubi_volume() { + # Find the MTD partition. + local mtd_num="$(sed -ne "s/mtd\([0-9]\+\):.*\<${1}\>.*/\1/g;T;p" /proc/mtd 2>/dev/null)" + if [ -z "${mtd_num}" ]; then + quit_with_error "Could not find MTD partition for volume '${1}'" + else + # Umount in case partition is mounted, ignore errors. + if grep -qs "${1}" /proc/mounts; then + local path="$(sed -ne "s/.*:${1} \(.*\) ubifs.*/\1/g;T;p" /proc/mounts 2>/dev/null)" + umount "${path}" >/dev/null 2>&1 + ubidetach -p "/dev/mtd${mtd_num}" >/dev/null 2>&1 + fi + # Format MTD partition. + if ! ubiformat "/dev/mtd${mtd_num}" -q -y; then + quit_with_error "Error erasing '/dev/mtd${mtd_num}' block" + fi + psplash_progress "50" + # Attach and get UBI device number + local dev_number="$(ubiattach -p /dev/mtd${mtd_num} 2>/dev/null | sed -ne 's,.*device number \([0-9]\).*,\1,g;T;p' 2>/dev/null)" + # Create UBI Vol. + ubimkvol "/dev/ubi${dev_number}" -m -N "${1}" >/dev/null 2>&1 + if [ "$?" = "0" ]; then + # Configure the empty UBIFS partition to use ZLIB + volid="$(ubinfo "/dev/ubi${dev_number}" -N "${1}" | sed -ne 's,Volume ID:[[:blank:]]\+\([0-9]\+\)[[:blank:]]\+.*,\1,g;T;p')" + mkfs.ubifs -x zlib -F /dev/ubi${dev_number}_${volid} + psplash_progress "100" + log "Partition '${1}' successfully erased!" + # Detach MTD partition. + ubidetach -p "/dev/mtd${mtd_num}" >/dev/null 2>&1 + else + quit_with_error "Error creating '${1}' UBI volume" + fi + fi +} + +#------------------------------------------------------------------------------ +# Function - format_emmc_block +# +# Formats the given emmc partition block name. +# +# @param ${1} - Partition name to format. +#------------------------------------------------------------------------------ +format_emmc_block() { + # Find partition block number. + local partition_block="/dev/mmcblk0p$(parted -s /dev/mmcblk0 print | sed -ne "s,^[^0-9]*\([0-9]\+\).*\<${1}\>.*,\1,g;T;p")" + if [ -b "${partition_block}" ]; then + # Umount in case partition is mounted, ignore errors. + if grep -qs "${partition_block}" /proc/mounts; then + umount "${partition_block}" >/dev/null 2>&1 + fi + # Format emmc block. + mkfs.ext4 "${partition_block}" >/dev/null 2>&1 + if [ "$?" = "0" ]; then + psplash_progress "100" + log "Partition '${1}' successfully erased!" + else + quit_with_error "Error erasing '${1}' partition" + fi + else + quit_with_error "Could not find partition block for '${1}'" + fi +} + +#------------------------------------------------------------------------------ +# Function - swu_package_path +# +# Get absolute path of update package searching in local media +# +# @param ${1} - SWU package name +#------------------------------------------------------------------------------ +swu_package_path() { + for i in ${UPDATE_MOUNT_DIR} $(echo ${USB_MOUNT_DIR}/*); do + echo $i | grep -qs "${USB_MOUNT_DIR}/\*" && continue + if [ -f "${i}/${1}" ]; then + swu_abspath="${i}/${1}" + break + fi + done + + if [ -n "${swu_abspath}" ]; then + echo "${swu_abspath}" + else + quit_with_error "Unable to find update package '${1}'" + fi +} + +# Main +#------------------------------------------------------------------------------ +# Setup the environment. +export PATH=/bin:/sbin:/usr/bin:/usr/sbin + +# Mount virtual file system. +mkdir -p /proc /sys /dev /tmp +mount -t proc proc /proc +mount -t sysfs sysfs /sys +mount -t devtmpfs devtmpfs /dev +mount -t tmpfs tmpfs /tmp + +# Setup fw_printenv. +mkdir -p /var/lock + +# Set kernel console loglevel. +sysctl -q -w kernel.printk=4 + +# Start psplash. +psplash & + +# Parse the kernel command line. +for arg in $(cat /proc/cmdline); do + case "${arg}" in + rescue=1) eval "${arg}";; + esac +done + +# Jump to a rescue shell if requested. +if [ -n "${rescue}" ]; then + # Expand console and respawn if exited + while true; do + setsid cttyhack sh -l + sleep 1 + done +fi + +log "Starting recovery..." +psplash_message "Starting recovery..." + +# Read the recovery command. +read_uboot_var "${ENV_RECOVERY_COMMAND}" COMMAND + +# Check if there is any command. +if [ -z "${COMMAND}" ]; then + quit_with_error "No command found" +fi + +# Parse the recovery command. +for arg in ${COMMAND}; do + case "${arg}" in + wipe_update) + wipe_update_bool=true;; + encryption_key=*) + encryption_key_bool=true; + eval "${arg}";; + update_package=*) + update_package_bool=true; + eval "${arg}";; + *) + # Not supported command + quit_with_error "Unknown recovery command '${arg}'";; + esac +done + +# Check if wipe update patition command is configured. +if [ -n "${wipe_update_bool}" ]; then + log "Wipe 'update' partition requested" + psplash_message "Erasing update partition..." + format_partition update +fi + +# Check if encryption key command is configured. +if [ -n "${encryption_key_bool}" ]; then + log "Trustfence encryption key setup requested (new key: ${encryption_key:-random})" + psplash_message "Configuring new encryption key..." + trustfence-tool "--newkey${encryption_key:+=${encryption_key}}" + if [ "$?" = "0" ]; then + psplash_progress "100" + log "Trustfence encryption key setup succeed!" + else + quit_with_error "Error configuring trustfence encryption key" + fi +fi + +# Check if update package command is configured. +if [ -n "${update_package_bool}" ]; then + log "Firmware update requested" + psplash_message "Updating firmware..." + if [ -z "${update_package}" ]; then + quit_with_error "Firmware update package not specified" + else + # Give some time for the devices to settle down + sleep 5 + mount_external_disks + mount_partition update "${UPDATE_MOUNT_DIR}" + + # Check whether the package is local and get the absolute path + if echo "${update_package}" | grep -qs '^file://'; then + update_package="$(swu_package_path $(basename ${update_package}))" + fi + + log "Update package location: ${update_package}" + # Execute the progress binary. + progress -wp & + # Execute the software update. + swupdate -f "${SW_CONFIG}" -i "${update_package}" + if [ "$?" = "0" ]; then + log "Firmware update process succeed!" + else + quit_with_error "Error executing the firmware update" + fi + fi +fi + +# End the recovery process. +clear_uboot_vars +reboot_system diff --git a/meta-digi-dey/recipes-core/recovery/recovery-initramfs/swupdate.cfg b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/swupdate.cfg new file mode 100644 index 000000000..2a63bee87 --- /dev/null +++ b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/swupdate.cfg @@ -0,0 +1,7 @@ +globals : +{ + verbose = true; + loglevel = 5; + syslog = true; + mtd-blacklist = "0 1 2"; +}; diff --git a/meta-digi-dey/recipes-core/recovery/recovery-utils.bb b/meta-digi-dey/recipes-core/recovery/recovery-utils.bb new file mode 100644 index 000000000..d8e2f0009 --- /dev/null +++ b/meta-digi-dey/recipes-core/recovery/recovery-utils.bb @@ -0,0 +1,17 @@ +# Copyright (C) 2017 Digi International + +SUMMARY = "Recovery reboot utilities" +LICENSE = "MPL-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" + +DEPENDS = "u-boot-fw-utils" + +PV = "0.1" + +SRC_URI = "file://${BPN}" + +S = "${WORKDIR}/${BPN}" + +do_install() { + oe_runmake DESTDIR=${D} install +} diff --git a/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/Makefile b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/Makefile new file mode 100644 index 000000000..1fbf05f6a --- /dev/null +++ b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/Makefile @@ -0,0 +1,29 @@ +# +# Copyright (c) 2017, Digi International Inc. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at http://mozilla.org/MPL/2.0/. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +SUBDIRS := lib recovery-reboot + +all: $(SUBDIRS) + +recovery-reboot: lib + +.PHONY: $(SUBDIRS) +$(SUBDIRS): + $(MAKE) -C $@ + +.PHONY: clean install +clean install: + for a in $(SUBDIRS); do $(MAKE) -C $$a $@; done diff --git a/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/README.md b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/README.md new file mode 100644 index 000000000..013bd2e1c --- /dev/null +++ b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/README.md @@ -0,0 +1,13 @@ +Recovery utils +============== + +**recovery-utils** allows to configure recovery commands and reboot into +recovery mode. + +Provides: +* **librecovery** static library which implements the supported recovery +commands. +* **recovery-reboot** command line example application to configure and +reboot into recovery mode. +* **update-firmware** command supporting only the firmware update recovery +command. diff --git a/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/include/recovery.h b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/include/recovery.h new file mode 100644 index 000000000..4f7dfddb3 --- /dev/null +++ b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/include/recovery.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2017, Digi International Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, you can obtain one at http://mozilla.org/MPL/2.0/. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Description: Recovery boot library + * + */ + +#ifndef RECOVERY_H +#define RECOVERY_H + +/* + * Configure recovery commands to update the firmware. + * + * Params: + * 'swu_path' (input) Path to the update package + * + * Return: 0 on sucess, -1 on failure + */ +int update_firmware(const char *swu_path); + +/* + * Reboot into recovery mode. + * + * Params: + * 'reboot_timeout' (input) Timeout to perform the reboot + * + * Return: -1 on failure, otherwise it does not return + */ +int reboot_recovery(unsigned int reboot_timeout); + +/* + * Configure recovery commands to format 'update' partition. + * + * Return: 0 on sucess, -1 on failure + */ +int wipe_update_partition(void); + +#endif /* RECOVERY_H */ diff --git a/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/lib/Makefile b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/lib/Makefile new file mode 100644 index 000000000..dc2f89823 --- /dev/null +++ b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/lib/Makefile @@ -0,0 +1,35 @@ +# +# Copyright (c) 2017, Digi International Inc. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at http://mozilla.org/MPL/2.0/. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +LIBRECOVERY_AR = librecovery.a + +CFLAGS += -Wall + +all: $(LIBRECOVERY_AR) + +$(LIBRECOVERY_AR): recovery.o + $(AR) -rcs $@ $^ + +.PHONY: install +install: $(LIBRECOVERY_AR) + install -d $(DESTDIR)/usr/lib/pkgconfig $(DESTDIR)/usr/include/librecovery + install -m 0644 $(LIBRECOVERY_AR) $(DESTDIR)/usr/lib/ + install -m 0644 recovery.pc $(DESTDIR)/usr/lib/pkgconfig/ + install -m 0644 ../include/recovery.h $(DESTDIR)/usr/include/librecovery/ + +.PHONY: clean +clean: + -rm -f *.o $(LIBRECOVERY_AR) diff --git a/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/lib/recovery.c b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/lib/recovery.c new file mode 100644 index 000000000..6f0e232b5 --- /dev/null +++ b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/lib/recovery.c @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2017, Digi International Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, you can obtain one at http://mozilla.org/MPL/2.0/. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Description: Recovery boot library + * + */ + +#define _GNU_SOURCE /* For GNU version of basename */ + +#include +#include +#include +#include +#include + +#include + +#define FILE_PREFIX "file://" + +/* + * Function: append_recovery_command + * Description: append configuration to the 'recovery_command' variable + */ +static int append_recovery_command(const char *value) +{ + const char *old_recovery_cmd; + char *new_recovery_cmd; + int rcvr_cmd_len; + int ret = 0; + + ret = uboot_getenv("recovery_command", &old_recovery_cmd); + if (ret) { + fprintf(stderr, "Error: getenv 'recovery_command'\n"); + goto err; + } + + /* Length of old recovery command (+1 for the space) */ + rcvr_cmd_len = (old_recovery_cmd) ? (strlen(old_recovery_cmd) + 1) : 0; + + /* Add new value's length + '\0' */ + rcvr_cmd_len += strlen(value) + 1; + + new_recovery_cmd = calloc(1, rcvr_cmd_len); + if (!new_recovery_cmd) { + fprintf(stderr, "Error: calloc 'new_recovery_cmd'\n"); + goto err; + } + + /* Set new recovery command appending to previous value */ + if (old_recovery_cmd) { + strcpy(new_recovery_cmd, old_recovery_cmd); + strcat(new_recovery_cmd, " "); + } + strcat(new_recovery_cmd, value); + + ret = uboot_setenv("recovery_command", new_recovery_cmd); + if (ret) + fprintf(stderr, "Error: setenv 'recovery_command'\n"); + + free(new_recovery_cmd); + +err: + return ret ? -1 : 0; +} + +/* + * Function: update_firmware + * Description: configure recovery commands to update the firmware + */ +int update_firmware(const char *swu_path) +{ + char *fwupdate_cmd; + int file_prefix_len = 0; + int ret = -1; + + /* Verify input parameter */ + if (!swu_path) { + fprintf(stderr, "Error: NULL 'swu_path'\n"); + goto err; + } + + /* If file is local reset the path */ + if (!access(swu_path, F_OK)) { + file_prefix_len = strlen(FILE_PREFIX); + swu_path = basename(swu_path); + } + + fwupdate_cmd = + calloc(1, + strlen("update_package=") + file_prefix_len + + strlen(swu_path) + 1); + if (!fwupdate_cmd) { + fprintf(stderr, "Error: calloc 'fwupdate_cmd'\n"); + goto err; + } + + sprintf(fwupdate_cmd, "update_package=%s%s", + file_prefix_len ? FILE_PREFIX : "", swu_path); + + ret = append_recovery_command(fwupdate_cmd); + + free(fwupdate_cmd); + +err: + return ret ? -1 : 0; +} + +/* + * Function: reboot_recovery + * Description: reboot into recovery mode + */ +int reboot_recovery(unsigned int reboot_timeout) +{ + int ret = 0; + + sync(); + + /* Configure system to boot into recovery mode */ + ret = uboot_setenv("boot_recovery", "yes"); + if (ret) { + fprintf(stderr, "Error: setenv 'boot_recovery'\n"); + goto err; + } + + printf("\nThe recovery commands have been properly configured and " + "the system will reboot into recovery mode in %d seconds " + "(^C to cancel).\n\n", reboot_timeout); + fflush(stdout); + sleep(reboot_timeout); + reboot(RB_AUTOBOOT); + +err: + return ret; +} + +/* + * Function: wipe_update_partition + * Description: configure recovery commands to format 'update' partition + */ +int wipe_update_partition(void) +{ + return append_recovery_command("wipe_update"); +} diff --git a/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/lib/recovery.pc b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/lib/recovery.pc new file mode 100644 index 000000000..f5e8cc36b --- /dev/null +++ b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/lib/recovery.pc @@ -0,0 +1,13 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: recovery +Description: recovery functionality library +Version:1.0 + +Requires: +Libs: -L${libdir} -lrecovery +Libs.private: -lubootenv +Cflags: -I${includedir}/librecovery -I${includedir} diff --git a/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/recovery-reboot/Makefile b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/recovery-reboot/Makefile new file mode 100644 index 000000000..fbb89852d --- /dev/null +++ b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/recovery-reboot/Makefile @@ -0,0 +1,47 @@ +# +# Copyright (c) 2017, Digi International Inc. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at http://mozilla.org/MPL/2.0/. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +PROGRAM := recovery-reboot + +GIT_REVISION := $(shell git rev-parse --verify --short=7 HEAD 2>/dev/null) + +CFLAGS += -Wall -DGIT_REVISION=\"$(if $(GIT_REVISION),-g$(GIT_REVISION))\" + +# +# In general, when a library is installed in the toolchain the correct way to +# set the flags would be: +# +# CFLAGS += $(shell pkg-config --cflags recovery) +# LDLIBS += $(shell pkg-config --libs --static recovery) +# +# But in this case as we want to use the library not installed and from the +# local build directory, we adjust manually the flags. +# +CFLAGS += -I../include +LDFLAGS += -L../lib +LDLIBS += -lrecovery -lubootenv + +all: $(PROGRAM) + +.PHONY: install +install: $(PROGRAM) + install -d $(DESTDIR)/usr/bin + install -m 0755 $(PROGRAM) $(DESTDIR)/usr/bin/ + ln -sf $(PROGRAM) $(DESTDIR)/usr/bin/update-firmware + +.PHONY: clean +clean: + -rm -f *.o $(PROGRAM) diff --git a/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/recovery-reboot/recovery-reboot.c b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/recovery-reboot/recovery-reboot.c new file mode 100644 index 000000000..d1e49bd44 --- /dev/null +++ b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/recovery-reboot/recovery-reboot.c @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2017, Digi International Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, you can obtain one at http://mozilla.org/MPL/2.0/. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Description: Reboot into recovery mode setting recovery commands + * + */ + +#define _GNU_SOURCE /* For GNU version of basename */ + +#include +#include +#include +#include + +#include + +#define VERSION "0.1" GIT_REVISION + +#define REBOOT_TIMEOUT 10 + +#define CMD_RECOVERY "recovery-reboot" +#define CMD_UPDATEFW "update-firmware" + +#define RECOVERY_USAGE \ + "Reboot into recovery mode setting recovery commands.\n" \ + "Copyright(c) Digi International Inc.\n" \ + "\n" \ + "Version: %s\n" \ + "\n" \ + "Usage: %s [options] []\n\n" \ + " -u --update-firmware Perform firmware update\n" \ + " -w --wipe-update-partition Wipe 'update' partition\n" \ + " -T --reboot-timeout= Reboot after N seconds (default %d)\n" \ + " --help Print help and exit\n" \ + "\n" \ + " Absolute path to the firmware update package\n" \ + "\n" + +#define UPDATEFW_USAGE \ + "Update the firmware using the recovery reboot.\n" \ + "Copyright(c) Digi International Inc.\n" \ + "\n" \ + "Version: %s\n" \ + "\n" \ + "Usage: %s [options] \n\n" \ + " -T --reboot-timeout= Reboot after N seconds (default %d)\n" \ + " --help Print help and exit\n" \ + "\n" \ + " Absolute path to the firmware update package\n" \ + "\n" + +/* Check if application was called as update-firmware */ +#define IS_UPDATEFW(cmd) (!strcmp(cmd, CMD_UPDATEFW)) + +/* Actual command name */ +static char *cmd_name; + +/* Command line options */ +static char *swu_package; +static int wipe_update; +static int update_fw; +static int reboot_timeout = REBOOT_TIMEOUT; + +/* + * Function: usage_and_exit + * Description: show usage information and exit with 'exitval' return value + */ +static void usage_and_exit(int exitval) +{ + if (IS_UPDATEFW(cmd_name)) + fprintf(stdout, UPDATEFW_USAGE, VERSION, CMD_UPDATEFW, + REBOOT_TIMEOUT); + else + fprintf(stdout, RECOVERY_USAGE, VERSION, CMD_RECOVERY, + REBOOT_TIMEOUT); + + exit(exitval); +} + +/* + * Function: parse_options + * Description: parse command line options + */ +static void parse_options(int argc, char *argv[]) +{ + static int opt_index, opt; + static const char *short_options = "uwT:"; + static const struct option long_options[] = { + {"update-firmware", no_argument, NULL, 'u'}, + {"wipe-update-partition", no_argument, NULL, 'w'}, + {"reboot-timeout", required_argument, NULL, 'T'}, + {"help", no_argument, NULL, 'h'}, + {NULL, 0, NULL, 0} + }; + char *endptr; + + if (argc == 1) + usage_and_exit(EXIT_SUCCESS); + + while (1) { + opt = + getopt_long(argc, argv, short_options, long_options, + &opt_index); + if (opt == -1) + break; + + switch (opt) { + case 'u': + update_fw = 1; + break; + case 'w': + wipe_update = 1; + break; + case 'T': + reboot_timeout = (int)strtol(optarg, &endptr, 10); + if (*endptr) { + printf("Error: incorrect timeout argument\n"); + exit(EXIT_FAILURE); + } + break; + case 'h': + usage_and_exit(EXIT_SUCCESS); + break; + default: + usage_and_exit(EXIT_FAILURE); + break; + } + } + + /* If command is 'update-firmware' reset the options */ + if (IS_UPDATEFW(cmd_name)) { + update_fw = 1; + wipe_update = 0; + } + + if (update_fw) { + if (argc == (optind + 1)) { + swu_package = argv[optind]; + } else { + printf("Error: missing SWU package argument\n"); + exit(EXIT_FAILURE); + } + } +} + +int main(int argc, char *argv[]) +{ + int ret = 0; + + cmd_name = basename(argv[0]); + if (!cmd_name) { + printf("Error: basename command\n"); + goto out; + } + + /* Read and parse command line */ + parse_options(argc, argv); + + if (swu_package) { + /* Configure recovery commands to update the firmware */ + ret = update_firmware(swu_package); + if (ret) { + printf("Error: update_firmware\n"); + goto out; + } + } + + if (wipe_update) { + /* Configure recovery commands to format 'update' partition */ + ret = wipe_update_partition(); + if (ret) { + printf("Error: wipe_update_partition\n"); + goto out; + } + } + + /* Reboot to recovery */ + ret = reboot_recovery(reboot_timeout); + if (ret) { + printf("Error: reboot_recovery\n"); + goto out; + } + +out: + return ret; +} diff --git a/meta-digi-dey/recipes-core/trustfence/trustfence-tool-2.0/ccimx6/trustfence-tool b/meta-digi-dey/recipes-core/trustfence/trustfence-tool-2.0/ccimx6/trustfence-tool deleted file mode 100755 index 79c9c2fac..000000000 Binary files a/meta-digi-dey/recipes-core/trustfence/trustfence-tool-2.0/ccimx6/trustfence-tool and /dev/null differ diff --git a/meta-digi-dey/recipes-core/trustfence/trustfence-tool-2.0/ccimx6ul/trustfence-tool b/meta-digi-dey/recipes-core/trustfence/trustfence-tool-2.0/ccimx6ul/trustfence-tool deleted file mode 100755 index 763c67201..000000000 Binary files a/meta-digi-dey/recipes-core/trustfence/trustfence-tool-2.0/ccimx6ul/trustfence-tool and /dev/null differ diff --git a/meta-digi-dey/recipes-core/trustfence/trustfence-tool_2.0.bb b/meta-digi-dey/recipes-core/trustfence/trustfence-tool_2.0.bb index 885203ae6..ad6b63fcb 100644 --- a/meta-digi-dey/recipes-core/trustfence/trustfence-tool_2.0.bb +++ b/meta-digi-dey/recipes-core/trustfence/trustfence-tool_2.0.bb @@ -4,19 +4,9 @@ SUMMARY = "Trustfence command line tool" SECTION = "console/tools" LICENSE = "CLOSED" -SRC_URI = "file://trustfence-tool" +SRC_URI = "${DIGI_PKG_SRC}/${BP}.tar.gz" -S = "${WORKDIR}" +SRC_URI[md5sum] = "dfbe0f7a5c2d16c5abafae14eb33d592" +SRC_URI[sha256sum] = "e335fc7080fb35ad198319c06ec31c77d9d2fe63219b9adc1ffc1e686e1534ae" -INSANE_SKIP_${PN} = "already-stripped" - -do_configure[noexec] = "1" -do_compile[noexec] = "1" - -do_install() { - install -d ${D}${base_sbindir} - install -m 0755 trustfence-tool ${D}${base_sbindir} -} - -PACKAGE_ARCH = "${MACHINE_ARCH}" -COMPATIBLE_MACHINE = "(ccimx6|ccimx6ul)" +inherit bin_package diff --git a/meta-digi-dey/recipes-digi/cloudconnector/cloudconnector_1.0.bb b/meta-digi-dey/recipes-digi/cloudconnector/cloudconnector_1.0.bb new file mode 100644 index 000000000..0a777f821 --- /dev/null +++ b/meta-digi-dey/recipes-digi/cloudconnector/cloudconnector_1.0.bb @@ -0,0 +1,29 @@ +# Copyright (C) 2017, Digi International Inc. + +SUMMARY = "Digi's device cloud connector" +SECTION = "libs" +LICENSE = "MPL-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" + +DEPENDS = "confuse openssl recovery-utils zlib" + +SRC_URI = "${DIGI_PKG_SRC}/${BP}.tar.gz" + +SRC_URI[md5sum] = "db366b0358c1b47f6380080ce75d91e4" +SRC_URI[sha256sum] = "5ecd4b1830fea7746e005465b6eef30f118302147861eb4074cf717fffbdf9d5" + +S = "${WORKDIR}/${PN}-${PV}" + +inherit pkgconfig + +do_install() { + oe_runmake DESTDIR=${D} install +} + +PACKAGES =+ "${PN}-cert" + +FILES_${PN}-cert = "${sysconfdir}/ssl/certs/Digi_Int-ca-cert-public.crt" + +CONFFILES_${PN} += "${sysconfdir}/cc.conf" + +RDEPENDS_${PN} = "${PN}-cert" diff --git a/meta-digi-dey/recipes-digi/cloudconnector/cloudconnector_git.bb b/meta-digi-dey/recipes-digi/cloudconnector/cloudconnector_git.bb new file mode 100644 index 000000000..32afcc5f4 --- /dev/null +++ b/meta-digi-dey/recipes-digi/cloudconnector/cloudconnector_git.bb @@ -0,0 +1,31 @@ +# Copyright (C) 2017, Digi International Inc. + +SUMMARY = "Digi's device cloud connector" +SECTION = "libs" +LICENSE = "MPL-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" + +DEPENDS = "confuse openssl recovery-utils zlib" + +SRCBRANCH = "master" +SRCREV = "${AUTOREV}" + +SRC_URI = "gitsm://git@stash.digi.com/cc/cc_dey.git;protocol=ssh;branch=${SRCBRANCH}" + +S = "${WORKDIR}/git" + +inherit pkgconfig + +do_install() { + oe_runmake DESTDIR=${D} install +} + +PACKAGES =+ "${PN}-cert" + +FILES_${PN}-cert = "${sysconfdir}/ssl/certs/Digi_Int-ca-cert-public.crt" + +CONFFILES_${PN} += "${sysconfdir}/cc.conf" + +RDEPENDS_${PN} = "${PN}-cert" + +DEFAULT_PREFERENCE = "-1" diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-adc.bb b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-adc.bb new file mode 100644 index 000000000..4067bdbac --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-adc.bb @@ -0,0 +1,16 @@ +SUMMARY = "DEY examples: ADC test application" +SECTION = "examples" +LICENSE = "GPL-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" + +SRC_URI = "file://adc_sample" + +S = "${WORKDIR}/adc_sample" + +do_install() { + install -d ${D}${bindir} + install -m 0755 adc_sample ${D}${bindir} +} + +PACKAGE_ARCH = "${MACHINE_ARCH}" +COMPATIBLE_MACHINE = "(ccimx6ul)" diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-cloudconnector.bb b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-cloudconnector.bb new file mode 100644 index 000000000..e08939826 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-cloudconnector.bb @@ -0,0 +1,20 @@ +SUMMARY = "DEY examples: Device cloud test applications" +SECTION = "examples" +LICENSE = "MPL-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" + +DEPENDS = "cloudconnector" + +SRC_URI = "file://cloudconnector_test" + +S = "${WORKDIR}/cloudconnector_test" + +inherit pkgconfig + +do_install() { + oe_runmake DESTDIR=${D} install +} + +RDEPENDS_${PN} = "cloudconnector-cert" + +COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul)" diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/adc_sample/Makefile b/meta-digi-dey/recipes-digi/dey-examples/files/adc_sample/Makefile new file mode 100644 index 000000000..c4193844b --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/adc_sample/Makefile @@ -0,0 +1,11 @@ +CFLAGS = -Wall -g -D_GNU_SOURCE + +all: adc_sample + +adc_sample: adc_sample.o iio_utils.o + +%.o: %.c iio_utils.h + +.PHONY: clean +clean: + rm -f *.o adc_sample diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/adc_sample/adc_sample.c b/meta-digi-dey/recipes-digi/dey-examples/files/adc_sample/adc_sample.c new file mode 100644 index 000000000..a0dbfef07 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/adc_sample/adc_sample.c @@ -0,0 +1,337 @@ +/* + * ConnectCore 6UL ADC sample application. + * + * Copyright (c) 2016 Digi International Inc. + * All rights reserved. + * + * Partially based on iio_event_monitor.c from the tools/iio directory, of the + * linux kernel. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "iio_utils.h" + +#define ARRAY_SIZE(v) (sizeof(v) / sizeof((v)[0])) +#define BUFFER_LEN 20 + +#define ADC_SAMPLE_USAGE \ + "Usage:\n" \ + "adc_sample -t ADC_type -c channel [options]\n\n" + +#define ADC_SAMPLE_FULL_USAGE \ + "Usage:\n" \ + "adc_sample -t ADC_type -c channel [options]\n\n" \ + "Options:\n" \ + " -t : ADC_type ('MX6UL', 'MCA')\n" \ + " -c : channel number to read from\n" \ + " -n : Number of samples (default: 1)\n" \ + " -d : Delay (in ms) between samples (default: 1000)\n" \ + " -v : Show output in V (otherwise raw ADC value is shown)\n" \ + " -h : help\n\n" + +enum adc_type { + ADC_TYPE_UNKNOWN, + ADC_TYPE_MX6UL, + ADC_TYPE_MCA +}; + +struct adc_data { + enum adc_type type; + const char *name; + const char *dev_name; + unsigned int nbits; +}; + +struct adc_data adc_list[] = { + { + .type = ADC_TYPE_MX6UL, + .name = "MX6UL", + .dev_name = "2198000.adc", + .nbits = 12, + }, { + .type = ADC_TYPE_MCA, + .name = "MCA", + .dev_name = "mca-cc6ul-adc", + .nbits = 12, + } +}; + +typedef struct adc { + struct adc_data *data; + char *chrdev_name; + char *sysfs_file; + char *sysfs_dir; + int dev_num; + unsigned long channel; + double voltage_scale; +} adc_t; + +static void show_usage(int full) +{ + fprintf(stdout, "%s", full ? + ADC_SAMPLE_FULL_USAGE : ADC_SAMPLE_USAGE); +} + +static struct adc_data *get_adc_data(const char *type_str) +{ + struct adc_data *data = NULL; + int i; + + for (i = 0; i < ARRAY_SIZE(adc_list); i++) { + if (!strcmp(adc_list[i].name, type_str)) { + data = &adc_list[i]; + break; + } + } + + return data; +} + +static int read_adc_sample_sysfs(adc_t *adc, long int *val) +{ + int fd, ret; + char buffer[BUFFER_LEN]; + + fd = open(adc->sysfs_file, O_RDONLY); + if (fd < 0) { + fprintf(stdout, "%s: failed to open %s\n", + __func__, adc->sysfs_file); + ret = fd; + goto just_ret; + } + + ret = read(fd, buffer, BUFFER_LEN); + if (ret < 0) { + fprintf(stdout, "%s: failed to read ADC sample from %s (%d)\n", + __func__, adc->sysfs_file, ret); + goto close_ret; + } + + if (ret == 0) { + fprintf(stdout, "%s: no data available in %s\n", + __func__, adc->sysfs_file); + ret = -ENODATA; + goto close_ret; + } + + *val = strtol(buffer, NULL, 10); + ret = 0; + +close_ret: + close(fd); +just_ret: + return ret; +} + +static int read_voltage_scale(adc_t *adc, double *val) +{ + int fd, ret; + char buffer[BUFFER_LEN]; + char *temp; + + /* Read the voltage scale from the sysfs */ + ret = asprintf(&temp, "%s/in_voltage_scale", adc->sysfs_dir); + if (ret < 0) { + fprintf(stdout, "%s: failed to allocate memory\n", __func__); + return -ENOMEM; + } + + fd = open(temp, O_RDONLY); + if (fd < 0) { + fprintf(stdout, "%s: failed to open %s\n", __func__, temp); + ret = fd; + goto free_temp; + } + + ret = read(fd, buffer, BUFFER_LEN); + if (ret < 0) { + fprintf(stdout, "%s: failed to voltage scale from %s (%d)\n", + __func__, temp, ret); + goto close_fd; + } + + if (ret == 0) { + fprintf(stdout, "%s: no data available in %s\n", __func__, temp); + ret = -ENODATA; + goto close_fd; + } + + *val = atof(buffer); + +close_fd: + close(fd); +free_temp: + free(temp); + return ret; +} + +int main(int argc, char **argv) +{ + adc_t *adc; + unsigned long nsamples = 1; + unsigned long delay_ms = 1000; + long sample_val; + bool raw = true; + int ret, opt, i; + + if (argc <= 2) { + show_usage(0); + return EXIT_FAILURE; + } + + adc = malloc(sizeof(adc_t)); + if (!adc) { + fprintf(stdout, "Failed to allocate memory\n"); + ret = -ENOMEM; + goto error_ret; + } + memset(adc, 0, sizeof(adc_t)); + + adc->channel = ~0; + + while ((opt = getopt(argc, argv, "t:n:d:c:vh")) > 0) { + switch (opt) { + case 't': + adc->data = get_adc_data(optarg); + if (!adc->data) { + fprintf(stdout, "Unknown ADC type %s\n", optarg); + show_usage(0); + ret = EXIT_FAILURE; + goto error_ret2; + } + break; + + case 'n': + nsamples = strtoul(optarg, NULL, 10); + if (!nsamples) { + fprintf(stdout, + "Invalid number of samples parameter (%s)\n", + optarg); + show_usage(0); + ret = EXIT_FAILURE; + goto error_ret2; + } + break; + + case 'd': + delay_ms = strtoul(optarg, NULL, 10); + if (!delay_ms) { + fprintf(stdout, + "Invalid inter sample delay parameter (%s)\n", + optarg); + show_usage(0); + ret = EXIT_FAILURE; + goto error_ret2; + } + break; + + case 'c': + adc->channel = strtoul(optarg, NULL, 10); + break; + + case 'v': + raw = false; + break; + + case 'h': + show_usage(1); + return EXIT_SUCCESS; + + default: + show_usage(0); + return EXIT_FAILURE; + } + } + + /* Check that the application params provide what we need */ + if (!adc->data || adc->data->type == ADC_TYPE_UNKNOWN) { + fprintf(stdout, "ADC type must be provided\n"); + show_usage(1); + ret = EXIT_FAILURE; + goto error_ret2; + } + + if (adc->channel == ~0) { + fprintf(stdout, "ADC channel must be provided\n"); + show_usage(1); + ret = EXIT_FAILURE; + goto error_ret2; + } + + adc->dev_num = find_type_by_name(adc->data->dev_name, "iio:device"); + if (adc->dev_num < 0) { + fprintf(stdout, "Failed to find iio:device for %s\n", + adc->data->dev_name); + ret = -ENODEV; + goto error_ret2; + } + ret = asprintf(&adc->chrdev_name, "/dev/iio:device%d", adc->dev_num); + if (ret < 0) { + fprintf(stdout, "Failed to allocate memory\n"); + ret = -ENOMEM; + goto error_ret2; + } + + ret = asprintf(&adc->sysfs_dir, "/sys/bus/iio/devices/iio:device%d", + adc->dev_num); + if (ret < 0) { + fprintf(stdout, "Failed to allocate memory\n"); + ret = -ENOMEM; + goto error_ret3; + } + + ret = asprintf(&adc->sysfs_file, "%s/in_voltage%lu_raw", + adc->sysfs_dir, adc->channel); + if (ret < 0) { + fprintf(stdout, "Failed to allocate memory\n"); + ret = -ENOMEM; + goto error_ret4; + } + + if (!raw) { + ret = read_voltage_scale(adc, &adc->voltage_scale); + if (ret < 0) { + goto error_ret5; + } + } + + for (i = 0; i < nsamples; i++) { + ret = read_adc_sample_sysfs(adc, &sample_val); + if (ret) + break; + + if (raw) { + fprintf(stdout, "Sample %i: 0x%04x\n", + i, (unsigned int)sample_val); + } else { + fprintf(stdout, "Sample %i: %.2f V\n", + i, sample_val * adc->voltage_scale / 1000); + } + + usleep(delay_ms * 1000); + } + +error_ret5: + free(adc->sysfs_file); +error_ret4: + free(adc->sysfs_dir); +error_ret3: + free(adc->chrdev_name); +error_ret2: + free(adc); +error_ret: + return ret; +} diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/adc_sample/iio_utils.c b/meta-digi-dey/recipes-digi/dey-examples/files/adc_sample/iio_utils.c new file mode 100644 index 000000000..6f6452167 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/adc_sample/iio_utils.c @@ -0,0 +1,669 @@ +/* IIO - useful set of util functionality + * + * Copyright (c) 2008 Jonathan Cameron + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ +#ifndef _IIO_UTILS_H +#define _IIO_UTILS_H + +#include +#include +#include +#include +#include +#include +#include +#include "iio_utils.h" + +const char *iio_dir = "/sys/bus/iio/devices/"; + +static char * const iio_direction[] = { + "in", + "out", +}; + +/** + * iioutils_break_up_name() - extract generic name from full channel name + * @full_name: the full channel name + * @generic_name: the output generic channel name + **/ +int iioutils_break_up_name(const char *full_name, + char **generic_name) +{ + char *current; + char *w, *r; + char *working, *prefix = ""; + int i; + + for (i = 0; i < sizeof(iio_direction) / sizeof(iio_direction[0]); i++) + if (!strncmp(full_name, iio_direction[i], + strlen(iio_direction[i]))) { + prefix = iio_direction[i]; + break; + } + + current = strdup(full_name + strlen(prefix) + 1); + working = strtok(current, "_\0"); + + w = working; + r = working; + + while (*r != '\0') { + if (!isdigit(*r)) { + *w = *r; + w++; + } + r++; + } + *w = '\0'; + asprintf(generic_name, "%s_%s", prefix, working); + free(current); + + return 0; +} + +/** + * iioutils_get_type() - find and process _type attribute data + * @is_signed: output whether channel is signed + * @bytes: output how many bytes the channel storage occupies + * @mask: output a bit mask for the raw data + * @be: big endian + * @device_dir: the iio device directory + * @name: the channel name + * @generic_name: the channel type name + **/ +int iioutils_get_type(unsigned *is_signed, + unsigned *bytes, + unsigned *bits_used, + unsigned *shift, + uint64_t *mask, + unsigned *be, + const char *device_dir, + const char *name, + const char *generic_name) +{ + FILE *sysfsfp; + int ret; + DIR *dp; + char *scan_el_dir, *builtname, *builtname_generic, *filename = 0; + char signchar, endianchar; + unsigned padint; + const struct dirent *ent; + + ret = asprintf(&scan_el_dir, FORMAT_SCAN_ELEMENTS_DIR, device_dir); + if (ret < 0) { + ret = -ENOMEM; + goto error_ret; + } + ret = asprintf(&builtname, FORMAT_TYPE_FILE, name); + if (ret < 0) { + ret = -ENOMEM; + goto error_free_scan_el_dir; + } + ret = asprintf(&builtname_generic, FORMAT_TYPE_FILE, generic_name); + if (ret < 0) { + ret = -ENOMEM; + goto error_free_builtname; + } + + dp = opendir(scan_el_dir); + if (dp == NULL) { + ret = -errno; + goto error_free_builtname_generic; + } + while (ent = readdir(dp), ent != NULL) + /* + * Do we allow devices to override a generic name with + * a specific one? + */ + if ((strcmp(builtname, ent->d_name) == 0) || + (strcmp(builtname_generic, ent->d_name) == 0)) { + ret = asprintf(&filename, + "%s/%s", scan_el_dir, ent->d_name); + if (ret < 0) { + ret = -ENOMEM; + goto error_closedir; + } + sysfsfp = fopen(filename, "r"); + if (sysfsfp == NULL) { + printf("failed to open %s\n", filename); + ret = -errno; + goto error_free_filename; + } + + ret = fscanf(sysfsfp, + "%ce:%c%u/%u>>%u", + &endianchar, + &signchar, + bits_used, + &padint, shift); + if (ret < 0) { + printf("failed to pass scan type description\n"); + ret = -errno; + goto error_close_sysfsfp; + } + *be = (endianchar == 'b'); + *bytes = padint / 8; + if (*bits_used == 64) + *mask = ~0; + else + *mask = (1 << *bits_used) - 1; + if (signchar == 's') + *is_signed = 1; + else + *is_signed = 0; + fclose(sysfsfp); + free(filename); + + filename = 0; + sysfsfp = 0; + } +error_close_sysfsfp: + if (sysfsfp) + fclose(sysfsfp); +error_free_filename: + if (filename) + free(filename); +error_closedir: + closedir(dp); +error_free_builtname_generic: + free(builtname_generic); +error_free_builtname: + free(builtname); +error_free_scan_el_dir: + free(scan_el_dir); +error_ret: + return ret; +} + +int iioutils_get_param_float(float *output, + const char *param_name, + const char *device_dir, + const char *name, + const char *generic_name) +{ + FILE *sysfsfp; + int ret; + DIR *dp; + char *builtname, *builtname_generic; + char *filename = NULL; + const struct dirent *ent; + + ret = asprintf(&builtname, "%s_%s", name, param_name); + if (ret < 0) { + ret = -ENOMEM; + goto error_ret; + } + ret = asprintf(&builtname_generic, + "%s_%s", generic_name, param_name); + if (ret < 0) { + ret = -ENOMEM; + goto error_free_builtname; + } + dp = opendir(device_dir); + if (dp == NULL) { + ret = -errno; + goto error_free_builtname_generic; + } + while (ent = readdir(dp), ent != NULL) + if ((strcmp(builtname, ent->d_name) == 0) || + (strcmp(builtname_generic, ent->d_name) == 0)) { + ret = asprintf(&filename, + "%s/%s", device_dir, ent->d_name); + if (ret < 0) { + ret = -ENOMEM; + goto error_closedir; + } + sysfsfp = fopen(filename, "r"); + if (!sysfsfp) { + ret = -errno; + goto error_free_filename; + } + fscanf(sysfsfp, "%f", output); + break; + } +error_free_filename: + if (filename) + free(filename); +error_closedir: + closedir(dp); +error_free_builtname_generic: + free(builtname_generic); +error_free_builtname: + free(builtname); +error_ret: + return ret; +} + +/** + * bsort_channel_array_by_index() - reorder so that the array is in index order + * + **/ + +void bsort_channel_array_by_index(struct iio_channel_info **ci_array, + int cnt) +{ + + struct iio_channel_info temp; + int x, y; + + for (x = 0; x < cnt; x++) + for (y = 0; y < (cnt - 1); y++) + if ((*ci_array)[y].index > (*ci_array)[y+1].index) { + temp = (*ci_array)[y + 1]; + (*ci_array)[y + 1] = (*ci_array)[y]; + (*ci_array)[y] = temp; + } +} + +/** + * build_channel_array() - function to figure out what channels are present + * @device_dir: the IIO device directory in sysfs + * @ + **/ +int build_channel_array(const char *device_dir, + struct iio_channel_info **ci_array, + int *counter) +{ + DIR *dp; + FILE *sysfsfp; + int count, i; + struct iio_channel_info *current; + int ret; + const struct dirent *ent; + char *scan_el_dir; + char *filename; + + *counter = 0; + ret = asprintf(&scan_el_dir, FORMAT_SCAN_ELEMENTS_DIR, device_dir); + if (ret < 0) { + ret = -ENOMEM; + goto error_ret; + } + dp = opendir(scan_el_dir); + if (dp == NULL) { + ret = -errno; + goto error_free_name; + } + while (ent = readdir(dp), ent != NULL) + if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), + "_en") == 0) { + ret = asprintf(&filename, + "%s/%s", scan_el_dir, ent->d_name); + if (ret < 0) { + ret = -ENOMEM; + goto error_close_dir; + } + sysfsfp = fopen(filename, "r"); + if (sysfsfp == NULL) { + ret = -errno; + free(filename); + goto error_close_dir; + } + fscanf(sysfsfp, "%i", &ret); + if (ret == 1) + (*counter)++; + fclose(sysfsfp); + free(filename); + } + *ci_array = malloc(sizeof(**ci_array) * (*counter)); + if (*ci_array == NULL) { + ret = -ENOMEM; + goto error_close_dir; + } + seekdir(dp, 0); + count = 0; + while (ent = readdir(dp), ent != NULL) { + if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), + "_en") == 0) { + int current_enabled = 0; + + current = &(*ci_array)[count++]; + ret = asprintf(&filename, + "%s/%s", scan_el_dir, ent->d_name); + if (ret < 0) { + ret = -ENOMEM; + /* decrement count to avoid freeing name */ + count--; + goto error_cleanup_array; + } + sysfsfp = fopen(filename, "r"); + if (sysfsfp == NULL) { + free(filename); + ret = -errno; + goto error_cleanup_array; + } + fscanf(sysfsfp, "%i", ¤t_enabled); + fclose(sysfsfp); + + if (!current_enabled) { + free(filename); + count--; + continue; + } + + current->scale = 1.0; + current->offset = 0; + current->name = strndup(ent->d_name, + strlen(ent->d_name) - + strlen("_en")); + if (current->name == NULL) { + free(filename); + ret = -ENOMEM; + goto error_cleanup_array; + } + /* Get the generic and specific name elements */ + ret = iioutils_break_up_name(current->name, + ¤t->generic_name); + if (ret) { + free(filename); + goto error_cleanup_array; + } + ret = asprintf(&filename, + "%s/%s_index", + scan_el_dir, + current->name); + if (ret < 0) { + free(filename); + ret = -ENOMEM; + goto error_cleanup_array; + } + sysfsfp = fopen(filename, "r"); + fscanf(sysfsfp, "%u", ¤t->index); + fclose(sysfsfp); + free(filename); + /* Find the scale */ + ret = iioutils_get_param_float(¤t->scale, + "scale", + device_dir, + current->name, + current->generic_name); + if (ret < 0) + goto error_cleanup_array; + ret = iioutils_get_param_float(¤t->offset, + "offset", + device_dir, + current->name, + current->generic_name); + if (ret < 0) + goto error_cleanup_array; + ret = iioutils_get_type(¤t->is_signed, + ¤t->bytes, + ¤t->bits_used, + ¤t->shift, + ¤t->mask, + ¤t->be, + device_dir, + current->name, + current->generic_name); + } + } + + closedir(dp); + /* reorder so that the array is in index order */ + bsort_channel_array_by_index(ci_array, *counter); + + return 0; + +error_cleanup_array: + for (i = count - 1; i >= 0; i--) + free((*ci_array)[i].name); + free(*ci_array); +error_close_dir: + closedir(dp); +error_free_name: + free(scan_el_dir); +error_ret: + return ret; +} + +/** + * find_type_by_name() - function to match top level types by name + * @name: top level type instance name + * @type: the type of top level instance being sort + * + * Typical types this is used for are device and trigger. + **/ +int find_type_by_name(const char *name, const char *type) +{ + const struct dirent *ent; + int number, numstrlen; + + FILE *nameFile; + DIR *dp; + char thisname[IIO_MAX_NAME_LENGTH]; + char *filename; + + dp = opendir(iio_dir); + if (dp == NULL) { + printf("No industrialio devices available\n"); + return -ENODEV; + } + + while (ent = readdir(dp), ent != NULL) { + if (strcmp(ent->d_name, ".") != 0 && + strcmp(ent->d_name, "..") != 0 && + strlen(ent->d_name) > strlen(type) && + strncmp(ent->d_name, type, strlen(type)) == 0) { + numstrlen = sscanf(ent->d_name + strlen(type), + "%d", + &number); + /* verify the next character is not a colon */ + if (strncmp(ent->d_name + strlen(type) + numstrlen, + ":", + 1) != 0) { + filename = malloc(strlen(iio_dir) + + strlen(type) + + numstrlen + + 6); + if (filename == NULL) { + closedir(dp); + return -ENOMEM; + } + sprintf(filename, "%s%s%d/name", + iio_dir, + type, + number); + nameFile = fopen(filename, "r"); + if (!nameFile) { + free(filename); + continue; + } + free(filename); + fscanf(nameFile, "%s", thisname); + fclose(nameFile); + if (strcmp(name, thisname) == 0) { + closedir(dp); + return number; + } + } + } + } + closedir(dp); + return -ENODEV; +} + +int _write_sysfs_int(char *filename, char *basedir, int val, int verify) +{ + int ret = 0; + FILE *sysfsfp; + int test; + char *temp = malloc(strlen(basedir) + strlen(filename) + 2); + + if (temp == NULL) + return -ENOMEM; + sprintf(temp, "%s/%s", basedir, filename); + sysfsfp = fopen(temp, "w"); + if (sysfsfp == NULL) { + printf("failed to open %s\n", temp); + ret = -errno; + goto error_free; + } + fprintf(sysfsfp, "%d", val); + fclose(sysfsfp); + if (verify) { + sysfsfp = fopen(temp, "r"); + if (sysfsfp == NULL) { + printf("failed to open %s\n", temp); + ret = -errno; + goto error_free; + } + fscanf(sysfsfp, "%d", &test); + fclose(sysfsfp); + if (test != val) { + printf("Possible failure in int write %d to %s%s\n", + val, + basedir, + filename); + ret = -1; + } + } +error_free: + free(temp); + return ret; +} + +int write_sysfs_int(char *filename, char *basedir, int val) +{ + return _write_sysfs_int(filename, basedir, val, 0); +} + +int write_sysfs_int_and_verify(char *filename, char *basedir, int val) +{ + return _write_sysfs_int(filename, basedir, val, 1); +} + +int _write_sysfs_string(char *filename, char *basedir, char *val, int verify) +{ + int ret = 0; + FILE *sysfsfp; + char *temp = malloc(strlen(basedir) + strlen(filename) + 2); + + if (temp == NULL) { + printf("Memory allocation failed\n"); + return -ENOMEM; + } + sprintf(temp, "%s/%s", basedir, filename); + sysfsfp = fopen(temp, "w"); + if (sysfsfp == NULL) { + printf("Could not open %s\n", temp); + ret = -errno; + goto error_free; + } + fprintf(sysfsfp, "%s", val); + fclose(sysfsfp); + if (verify) { + sysfsfp = fopen(temp, "r"); + if (sysfsfp == NULL) { + printf("could not open file to verify\n"); + ret = -errno; + goto error_free; + } + fscanf(sysfsfp, "%s", temp); + fclose(sysfsfp); + if (strcmp(temp, val) != 0) { + printf("Possible failure in string write of %s " + "Should be %s " + "written to %s\%s\n", + temp, + val, + basedir, + filename); + ret = -1; + } + } +error_free: + free(temp); + + return ret; +} + +/** + * write_sysfs_string_and_verify() - string write, readback and verify + * @filename: name of file to write to + * @basedir: the sysfs directory in which the file is to be found + * @val: the string to write + **/ +int write_sysfs_string_and_verify(char *filename, char *basedir, char *val) +{ + return _write_sysfs_string(filename, basedir, val, 1); +} + +int write_sysfs_string(char *filename, char *basedir, char *val) +{ + return _write_sysfs_string(filename, basedir, val, 0); +} + +int read_sysfs_posint(char *filename, char *basedir) +{ + int ret; + FILE *sysfsfp; + char *temp = malloc(strlen(basedir) + strlen(filename) + 2); + + if (temp == NULL) { + printf("Memory allocation failed"); + return -ENOMEM; + } + sprintf(temp, "%s/%s", basedir, filename); + sysfsfp = fopen(temp, "r"); + if (sysfsfp == NULL) { + ret = -errno; + goto error_free; + } + fscanf(sysfsfp, "%d\n", &ret); + fclose(sysfsfp); +error_free: + free(temp); + return ret; +} + +int read_sysfs_float(char *filename, char *basedir, float *val) +{ + int ret = 0; + FILE *sysfsfp; + char *temp = malloc(strlen(basedir) + strlen(filename) + 2); + + if (temp == NULL) { + printf("Memory allocation failed"); + return -ENOMEM; + } + sprintf(temp, "%s/%s", basedir, filename); + sysfsfp = fopen(temp, "r"); + if (sysfsfp == NULL) { + ret = -errno; + goto error_free; + } + fscanf(sysfsfp, "%f\n", val); + fclose(sysfsfp); +error_free: + free(temp); + return ret; +} + +int read_sysfs_string(const char *filename, const char *basedir, char *str) +{ + int ret = 0; + FILE *sysfsfp; + char *temp = malloc(strlen(basedir) + strlen(filename) + 2); + + if (temp == NULL) { + printf("Memory allocation failed"); + return -ENOMEM; + } + sprintf(temp, "%s/%s", basedir, filename); + sysfsfp = fopen(temp, "r"); + if (sysfsfp == NULL) { + ret = -errno; + goto error_free; + } + fscanf(sysfsfp, "%s\n", str); + fclose(sysfsfp); +error_free: + free(temp); + return ret; +} + +#endif /* _IIO_UTILS_H */ diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/adc_sample/iio_utils.h b/meta-digi-dey/recipes-digi/dey-examples/files/adc_sample/iio_utils.h new file mode 100644 index 000000000..1bc837b2d --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/adc_sample/iio_utils.h @@ -0,0 +1,71 @@ +#ifndef _IIO_UTILS_H_ +#define _IIO_UTILS_H_ + +/* IIO - useful set of util functionality + * + * Copyright (c) 2008 Jonathan Cameron + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + */ + +#include + +/* Made up value to limit allocation sizes */ +#define IIO_MAX_NAME_LENGTH 30 + +#define FORMAT_SCAN_ELEMENTS_DIR "%s/scan_elements" +#define FORMAT_TYPE_FILE "%s_type" + +extern const char *iio_dir; + +/** + * struct iio_channel_info - information about a given channel + * @name: channel name + * @generic_name: general name for channel type + * @scale: scale factor to be applied for conversion to si units + * @offset: offset to be applied for conversion to si units + * @index: the channel index in the buffer output + * @bytes: number of bytes occupied in buffer output + * @mask: a bit mask for the raw output + * @is_signed: is the raw value stored signed + * @enabled: is this channel enabled + **/ +struct iio_channel_info { + char *name; + char *generic_name; + float scale; + float offset; + unsigned index; + unsigned bytes; + unsigned bits_used; + unsigned shift; + uint64_t mask; + unsigned be; + unsigned is_signed; + unsigned location; +}; + +int iioutils_break_up_name(const char *full_name, char **generic_name); +int iioutils_get_type(unsigned *is_signed, unsigned *bytes, + unsigned *bits_used, unsigned *shift, + uint64_t *mask, unsigned *be, + const char *device_dir, const char *name, + const char *generic_name); +int iioutils_get_param_float(float *output, const char *param_name, + const char *device_dir, const char *name, + const char *generic_name); +void bsort_channel_array_by_index(struct iio_channel_info **ci_array, int cnt); +int build_channel_array(const char *device_dir, + struct iio_channel_info **ci_array, int *counter); +int find_type_by_name(const char *name, const char *type); +int write_sysfs_int(char *filename, char *basedir, int val); +int write_sysfs_int_and_verify(char *filename, char *basedir, int val); +int write_sysfs_string_and_verify(char *filename, char *basedir, char *val); +int write_sysfs_string(char *filename, char *basedir, char *val); +int read_sysfs_posint(char *filename, char *basedir); +int read_sysfs_float(char *filename, char *basedir, float *val); +int read_sysfs_string(const char *filename, const char *basedir, char *str); + +#endif /* _IIO_UTILS_H_ */ diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/Makefile b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/Makefile new file mode 100644 index 000000000..989acb8a6 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/Makefile @@ -0,0 +1,27 @@ +# +# Copyright (c) 2017, Digi International Inc. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at http://mozilla.org/MPL/2.0/. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +SUBDIRS := device_request_listener upload_data_points upload_file + +all: $(SUBDIRS) + +.PHONY: $(SUBDIRS) +$(SUBDIRS): + $(MAKE) -C $@ + +.PHONY: clean install +clean install: + for a in $(SUBDIRS); do $(MAKE) -C $$a $@; done diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/Makefile b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/Makefile new file mode 100644 index 000000000..ac22dafcb --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/Makefile @@ -0,0 +1,38 @@ +# +# Copyright (c) 2017, Digi International Inc. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at http://mozilla.org/MPL/2.0/. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +PROGRAM := device_request_listener + +CFLAGS += -Wall + +CFLAGS += $(shell pkg-config --cflags cloudconnector) +LDLIBS += $(shell pkg-config --libs --static cloudconnector) + +all: $(PROGRAM) + +OBJS = device_request.o main.o + +$(PROGRAM): $(OBJS) + $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ + +.PHONY: install +install: $(PROGRAM) + install -d $(DESTDIR)/usr/bin + install -m 0755 $(PROGRAM) $(DESTDIR)/usr/bin/ + +.PHONY: clean +clean: + -rm -f *.o $(PROGRAM) diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/device_request.c b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/device_request.c new file mode 100644 index 000000000..cf74e209e --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/device_request.c @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2017 Digi International Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 + * ======================================================================= + */ + +#include +#include +#include +#include + +#include "device_request.h" + +#define MAX_RESPONSE_SIZE 256 + +#if !(defined UNUSED_ARGUMENT) +#define UNUSED_ARGUMENT(a) (void)(a) +#endif + +/* + * get_time_cb() - Data callback for 'get_time' device requests + * + * @target: Target ID of the device request (get_time). + * @transport: Communication transport used by the device request. + * @request_buffer_info: Buffer containing the device request. + * @response_buffer_info: Buffer to store the answer of the request. + * + * Logs information about the received request and executes the corresponding + * command. + */ +void get_time_cb(char const *const target, + ccapi_transport_t const transport, + ccapi_buffer_info_t const *const request_buffer_info, + ccapi_buffer_info_t *const response_buffer_info) +{ + UNUSED_ARGUMENT(request_buffer_info); + log_debug("get_time_cb(): target='%s' - transport='%d'", target, transport); + + response_buffer_info->buffer = malloc(sizeof(char) * MAX_RESPONSE_SIZE + 1); + if (response_buffer_info->buffer == NULL) { + log_error("%s\n", "get_time_cb(): response_buffer_info malloc error"); + return; + } + + time_t t = time(NULL); + response_buffer_info->length = snprintf(response_buffer_info->buffer, + MAX_RESPONSE_SIZE, "Time: %s", ctime(&t)); +} + +/* + * get_time_status_cb() - Status callback for 'get_time' device requests + * + * @target: Target ID of the device request (get_time) + * @transport: Communication transport used by the device request. + * @response_buffer_info: Buffer containing the response data. + * @receive_error: The error status of the receive process. + * + * This callback is executed when the response process has finished. It doesn't + * matter if everything worked or there was an error during the process. + * + * Cleans and frees the response buffer. + */ +void get_time_status_cb(char const *const target, + ccapi_transport_t const transport, + ccapi_buffer_info_t *const response_buffer_info, + ccapi_receive_error_t receive_error) +{ + log_debug( + "get_time_status_cb(): target='%s' - transport='%d' - error='%d'", + target, transport, receive_error); + + /* Free the response buffer */ + if (response_buffer_info != NULL) + free(response_buffer_info->buffer); +} diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/device_request.h b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/device_request.h new file mode 100644 index 000000000..26951204f --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/device_request.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2017 Digi International Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 + * ======================================================================= + */ + +#ifndef DEVICE_REQUEST_H_ +#define DEVICE_REQUEST_H_ + +#include + +#define TARGET_GET_TIME "get_time" + +void get_time_cb(char const *const target, ccapi_transport_t const transport, + ccapi_buffer_info_t const *const request_buffer_info, + ccapi_buffer_info_t *const response_buffer_info); +void get_time_status_cb(char const *const target, + ccapi_transport_t const transport, + ccapi_buffer_info_t *const response_buffer_info, + ccapi_receive_error_t receive_error); + +#endif /* DEVICE_REQUEST_H_ */ diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/main.c b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/main.c new file mode 100644 index 000000000..f2aee82f5 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/main.c @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2017 Digi International Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 + * ======================================================================= + */ +#include +#include +#include +#include +#include + +#include "device_request.h" + +static void sigint_handler(int signum) +{ + log_debug("sigint_handler(): received signal %d to close Cloud connection.\n", signum); + + exit(0); +} + +static void graceful_shutdown(void) +{ + stop_cloud_connection(); + wait_for_ccimp_threads(); +} + +static void add_sigkill_signal(void) +{ + struct sigaction new_action; + struct sigaction old_action; + + atexit(graceful_shutdown); + + /* Setup signal hander. */ + new_action.sa_handler = sigint_handler; + sigemptyset(&new_action.sa_mask); + new_action.sa_flags = 0; + sigaction(SIGINT, NULL, &old_action); + if (old_action.sa_handler != SIG_IGN) + sigaction(SIGINT, &new_action, NULL); +} + + +/* + * Use the following SCI request to test this example (insert your Device ID): + * + * + * + * + * + * + * + * + * + * + * + * + */ + +int main(void) +{ + cc_init_error_t init_error; + cc_start_error_t start_error; + ccapi_receive_error_t receive_error; + + add_sigkill_signal(); + + init_error = init_cloud_connection(NULL); + if (init_error != CC_INIT_ERROR_NONE) { + log_error("Cannot initialize cloud connection, error %d\n", init_error); + return EXIT_FAILURE; + } + + start_error = start_cloud_connection(); + if (start_error != CC_START_ERROR_NONE) { + log_error("Cannot start cloud connection, error %d\n", start_error); + return EXIT_FAILURE; + } + + receive_error = ccapi_receive_add_target(TARGET_GET_TIME, get_time_cb, + get_time_status_cb, 0); + if (receive_error != CCAPI_RECEIVE_ERROR_NONE) { + log_error("Cannot register target '%s', error %d\n", TARGET_GET_TIME, + receive_error); + return EXIT_FAILURE; + } + + printf("Waiting for Device Cloud request...\n"); + printf("Press a key to exit\n"); + getchar(); + + return EXIT_SUCCESS; +} diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/Makefile b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/Makefile new file mode 100644 index 000000000..f30697238 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/Makefile @@ -0,0 +1,38 @@ +# +# Copyright (c) 2017, Digi International Inc. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at http://mozilla.org/MPL/2.0/. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +PROGRAM := upload_data_points + +CFLAGS += -Wall + +CFLAGS += $(shell pkg-config --cflags cloudconnector) +LDLIBS += $(shell pkg-config --libs --static cloudconnector) + +all: $(PROGRAM) + +OBJS = data_point.o main.o + +$(PROGRAM): $(OBJS) + $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ + +.PHONY: install +install: $(PROGRAM) + install -d $(DESTDIR)/usr/bin + install -m 0755 $(PROGRAM) $(DESTDIR)/usr/bin/ + +.PHONY: clean +clean: + -rm -f *.o $(PROGRAM) diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/data_point.c b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/data_point.c new file mode 100644 index 000000000..b5f9428c9 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/data_point.c @@ -0,0 +1,143 @@ + /* + * Copyright (c) 2017 Digi International Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 + * ======================================================================= + */ + +#include +#include +#include + +#include "data_point.h" + +#define STREAM_NAME "incremental" + +/* + * get_incremental() - Retrieves an incremental value each time + */ +static int get_incremental(void) +{ + static int incremental = -1; + + if (incremental == INT_MAX) + incremental = 0; + else + incremental++; + + log_debug("Incremental = %d\n", incremental); + + return incremental; +} + +/* + * get_timestamp() - Get the current timestamp of the system + * + * Return: The timestamp of the system. + */ +static ccapi_timestamp_t *get_timestamp(void) +{ + ccapi_timestamp_t *timestamp = NULL; + size_t len = strlen("2016-09-27T07:07:09.546Z") + 1; + char *date = NULL; + time_t now; + + timestamp = (ccapi_timestamp_t*) malloc(sizeof(ccapi_timestamp_t)); + if (timestamp == NULL) + return NULL; + + date = (char*) malloc(sizeof(char) * len); + if (date == NULL) { + free(timestamp); + return NULL; + } + + time(&now); + if (strftime(date, len, "%FT%TZ", gmtime(&now)) > 0) { + timestamp->iso8601 = date; + } else { + free(date); + timestamp->iso8601 = NULL; + } + + return timestamp; +} + +ccapi_dp_error_t init_data_stream(ccapi_dp_collection_handle_t *dp_collection) +{ + ccapi_dp_collection_handle_t collection; + ccapi_dp_error_t dp_error; + + dp_error = ccapi_dp_create_collection(&collection); + if (dp_error != CCAPI_DP_ERROR_NONE) { + log_error("ccapi_dp_create_collection() error %d\n", dp_error); + return dp_error; + } else { + *dp_collection = collection; + } + + dp_error = ccapi_dp_add_data_stream_to_collection_extra(collection, + STREAM_NAME, "int32 ts_iso", "counts", NULL); + if (dp_error != CCAPI_DP_ERROR_NONE) { + log_error("ccapi_dp_add_data_stream_to_collection_extra() error %d\n", + dp_error); + free(collection); + } + + return dp_error; +} + +ccapi_dp_error_t add_data_point(ccapi_dp_collection_handle_t dp_collection) +{ + ccapi_dp_error_t dp_error; + + ccapi_timestamp_t *timestamp = get_timestamp(); + + dp_error = ccapi_dp_add(dp_collection, STREAM_NAME, get_incremental(), timestamp); + if (dp_error != CCAPI_DP_ERROR_NONE) { + log_error("ccapi_dp_add() failed with error: %d\n", dp_error); + } + + if (timestamp != NULL) { + if (timestamp->iso8601 != NULL) { + free((char *) timestamp->iso8601); + timestamp->iso8601 = NULL; + } + free(timestamp); + timestamp = NULL; + } + + return dp_error; +} + +ccapi_dp_error_t send_data_stream(ccapi_dp_collection_handle_t dp_collection) +{ + ccapi_dp_error_t dp_error; + + log_debug("%s", "Sending Data Stream with new incremental value\n"); + + dp_error = ccapi_dp_send_collection(CCAPI_TRANSPORT_TCP, dp_collection); + if (dp_error != CCAPI_DP_ERROR_NONE) { + log_error("ccapi_dp_send_collection() error %d\n", dp_error); + } + + return dp_error; +} + +ccapi_dp_error_t destroy_data_stream(ccapi_dp_collection_handle_t dp_collection) +{ + log_debug("%s", "Destroying Data Stream\n"); + return ccapi_dp_destroy_collection(dp_collection); +} diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/data_point.h b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/data_point.h new file mode 100644 index 000000000..5b66bb181 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/data_point.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2017 Digi International Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 + * ======================================================================= + */ + +#ifndef DATA_POINT_H_ +#define DATA_POINT_H_ + +#include + +ccapi_dp_error_t init_data_stream(ccapi_dp_collection_handle_t *dp_collection); +ccapi_dp_error_t add_data_point(ccapi_dp_collection_handle_t dp_collection); +ccapi_dp_error_t send_data_stream(ccapi_dp_collection_handle_t dp_collection); +ccapi_dp_error_t destroy_data_stream(ccapi_dp_collection_handle_t dp_collection); + +#endif /* DATA_POINT_H_ */ diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/main.c b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/main.c new file mode 100644 index 000000000..857b07b49 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/main.c @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2017 Digi International Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 + * ======================================================================= + */ +#include +#include +#include +#include + +#include "data_point.h" + +#define DP_SLEEP_TIME 5 +#define DP_NUMBER 10 + +static int running = 1; +static ccapi_dp_collection_handle_t dp_collection; + +static void sigint_handler(int signum) +{ + log_debug("sigint_handler(): received signal %d to close Cloud connection.\n", signum); + + exit(0); +} + +static void graceful_shutdown(void) +{ + if (running == 1) { + destroy_data_stream(dp_collection); + } + + running = 0; + stop_cloud_connection(); + wait_for_ccimp_threads(); +} + +static void add_sigkill_signal(void) +{ + struct sigaction new_action; + struct sigaction old_action; + + atexit(graceful_shutdown); + + /* Setup signal hander. */ + new_action.sa_handler = sigint_handler; + sigemptyset(&new_action.sa_mask); + new_action.sa_flags = 0; + sigaction(SIGINT, NULL, &old_action); + if (old_action.sa_handler != SIG_IGN) + sigaction(SIGINT, &new_action, NULL); +} + + +int main(void) +{ + cc_init_error_t init_error; + cc_start_error_t start_error; + ccapi_dp_error_t dp_error; + int i; + + add_sigkill_signal(); + + init_error = init_cloud_connection(NULL); + if (init_error != CC_INIT_ERROR_NONE) { + log_error("Cannot initialize cloud connection, error %d\n", init_error); + return EXIT_FAILURE; + } + + start_error = start_cloud_connection(); + if (start_error != CC_START_ERROR_NONE) { + log_error("Cannot start cloud connection, error %d\n", start_error); + return EXIT_FAILURE; + } + + dp_error = init_data_stream(&dp_collection); + if (dp_error != CCAPI_DP_ERROR_NONE) { + log_error("Cannot initialize data stream, error %d\n", start_error); + return EXIT_FAILURE; + } + + running = CCAPI_TRUE; + while (running != CCAPI_FALSE) { + + /* Collect DP_NUMBER data points sampled each DP_SLEEP_TIME seconds */ + for (i = 0; i < DP_NUMBER; i++) { + dp_error = add_data_point(dp_collection); + + if (dp_error != CCAPI_DP_ERROR_NONE) { + log_error("Cannot add data point, error %d\n", start_error); + i--; + } + + sleep(DP_SLEEP_TIME); + } + + /* Send the block of collected data points */ + dp_error = send_data_stream(dp_collection); + if (dp_error != CCAPI_DP_ERROR_NONE) + log_error("Cannot send data stream, error %d\n", start_error); + } + + return EXIT_SUCCESS; +} diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_file/Makefile b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_file/Makefile new file mode 100644 index 000000000..eed50f3e1 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_file/Makefile @@ -0,0 +1,38 @@ +# +# Copyright (c) 2017, Digi International Inc. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at http://mozilla.org/MPL/2.0/. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +PROGRAM := upload_file + +CFLAGS += -Wall + +CFLAGS += $(shell pkg-config --cflags cloudconnector) +LDLIBS += $(shell pkg-config --libs --static cloudconnector) + +all: $(PROGRAM) + +OBJS = main.o + +$(PROGRAM): $(OBJS) + $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ + +.PHONY: install +install: $(PROGRAM) + install -d $(DESTDIR)/usr/bin + install -m 0755 $(PROGRAM) $(DESTDIR)/usr/bin/ + +.PHONY: clean +clean: + -rm -f *.o $(PROGRAM) diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_file/main.c b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_file/main.c new file mode 100644 index 000000000..0f49d2c02 --- /dev/null +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_file/main.c @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2017 Digi International Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 + * ======================================================================= + */ +#include +#include +#include +#include + +#define UNUSED_ARGUMENT(a) (void)(a) + +#define STREAM_NAME "examples/uploaded_file" +#define UPLOAD_FILE "/etc/build" + +static void sigint_handler(int signum) +{ + log_debug("sigint_handler(): received signal %d to close Cloud connection.\n", signum); + + exit(0); +} + +static void graceful_shutdown(void) +{ + stop_cloud_connection(); + wait_for_ccimp_threads(); +} + +static void add_sigkill_signal(void) +{ + struct sigaction new_action; + struct sigaction old_action; + + atexit(graceful_shutdown); + + /* Setup signal hander. */ + new_action.sa_handler = sigint_handler; + sigemptyset(&new_action.sa_mask); + new_action.sa_flags = 0; + sigaction(SIGINT, NULL, &old_action); + if (old_action.sa_handler != SIG_IGN) + sigaction(SIGINT, &new_action, NULL); +} + +int main(int argc, char *argv[]) +{ + cc_init_error_t init_error; + cc_start_error_t start_error; + ccapi_dp_b_error_t send_error; + + UNUSED_ARGUMENT(argc); + + add_sigkill_signal(); + + init_error = init_cloud_connection(NULL); + if (init_error != CC_INIT_ERROR_NONE) { + log_error("Cannot initialize cloud connection, error %d\n", init_error); + return EXIT_FAILURE; + } + + start_error = start_cloud_connection(); + if (start_error != CC_START_ERROR_NONE) { + log_error("Cannot start cloud connection, error %d\n", start_error); + return EXIT_FAILURE; + } + + send_error = ccapi_dp_binary_send_file(CCAPI_TRANSPORT_TCP, UPLOAD_FILE, STREAM_NAME); + if (send_error != CCAPI_DP_B_ERROR_NONE) { + log_error("ccapi_dp_binary_send_file() failed, error %d\n", send_error); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-examples.bb b/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-examples.bb index 51e45b619..5df5449fb 100644 --- a/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-examples.bb +++ b/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-examples.bb @@ -30,6 +30,7 @@ RDEPENDS_${PN}_append_ccimx6 = "\ ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-bt", "", d)} \ ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-btconfig", "", d)} \ dey-examples-can \ + dey-examples-cloudconnector \ ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-hdp", "", d)} \ ${@bb.utils.contains("MACHINE_FEATURES", "accel-graphics", "dey-examples-opengles", "", d)} \ dey-examples-v4l2 \ @@ -38,7 +39,9 @@ RDEPENDS_${PN}_append_ccimx6 = "\ RDEPENDS_${PN}_append_ccimx6ul = "\ ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-bt", "", d)} \ ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-btconfig", "", d)} \ + dey-examples-adc \ dey-examples-can \ + dey-examples-cloudconnector \ ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-hdp", "", d)} \ dey-examples-tamper \ " diff --git a/meta-digi-dey/recipes-digi/swu-images/core-image-base-swu.bb b/meta-digi-dey/recipes-digi/swu-images/core-image-base-swu.bb new file mode 100644 index 000000000..fbfb9f967 --- /dev/null +++ b/meta-digi-dey/recipes-digi/swu-images/core-image-base-swu.bb @@ -0,0 +1,33 @@ +# Copyright (C) 2016 Digi International. +SUMMARY = "Generate update package for SWUpdate" +SECTION = "base" +LICENSE = "GPL-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" + +SRC_URI = "file://sw-description" + +inherit swupdate + +IMAGE_DEPENDS = "core-image-base" + +SWUPDATE_IMAGES = "core-image-base" + +SOFTWARE_VERSION ?= "0.0.1" + +BOOTFS_EXT ?= ".boot.vfat" +BOOTFS_EXT_ccimx6ul ?= ".boot.ubifs" +ROOTFS_EXT ?= ".ext4" +ROOTFS_EXT_ccimx6ul ?= ".ubifs" + +python () { + img_fstypes = d.getVar('BOOTFS_EXT', True) + " " + d.getVar('ROOTFS_EXT', True) + d.setVarFlag("SWUPDATE_IMAGES_FSTYPES", "core-image-base", img_fstypes) +} + +do_unpack[postfuncs] += "fill_description" + +fill_description() { + sed -i -e "s,##BOOTIMG_NAME##,core-image-base-${MACHINE}${BOOTFS_EXT},g" "${WORKDIR}/sw-description" + sed -i -e "s,##ROOTIMG_NAME##,core-image-base-${MACHINE}${ROOTFS_EXT},g" "${WORKDIR}/sw-description" + sed -i -e "s,##SW_VERSION##,${SOFTWARE_VERSION},g" "${WORKDIR}/sw-description" +} diff --git a/meta-digi-dey/recipes-digi/swu-images/dey-image-qt-swu.bb b/meta-digi-dey/recipes-digi/swu-images/dey-image-qt-swu.bb new file mode 100644 index 000000000..7932c1949 --- /dev/null +++ b/meta-digi-dey/recipes-digi/swu-images/dey-image-qt-swu.bb @@ -0,0 +1,33 @@ +# Copyright (C) 2016 Digi International. +SUMMARY = "Generate update package for SWUpdate" +SECTION = "base" +LICENSE = "GPL-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" + +SRC_URI = "file://sw-description" + +inherit swupdate + +IMAGE_DEPENDS = "dey-image-qt" + +SWUPDATE_IMAGES = "dey-image-qt-${GRAPHICAL_BACKEND}" + +SOFTWARE_VERSION ?= "0.0.1" + +BOOTFS_EXT ?= ".boot.vfat" +BOOTFS_EXT_ccimx6ul ?= ".boot.ubifs" +ROOTFS_EXT ?= ".ext4" +ROOTFS_EXT_ccimx6ul ?= ".ubifs" + +python () { + img_fstypes = d.getVar('BOOTFS_EXT', True) + " " + d.getVar('ROOTFS_EXT', True) + d.setVarFlag("SWUPDATE_IMAGES_FSTYPES", "dey-image-qt-" + d.getVar('GRAPHICAL_BACKEND', True), img_fstypes) +} + +do_unpack[postfuncs] += "fill_description" + +fill_description() { + sed -i -e "s,##BOOTIMG_NAME##,dey-image-qt-${GRAPHICAL_BACKEND}-${MACHINE}${BOOTFS_EXT},g" "${WORKDIR}/sw-description" + sed -i -e "s,##ROOTIMG_NAME##,dey-image-qt-${GRAPHICAL_BACKEND}-${MACHINE}${ROOTFS_EXT},g" "${WORKDIR}/sw-description" + sed -i -e "s,##SW_VERSION##,${SOFTWARE_VERSION},g" "${WORKDIR}/sw-description" +} diff --git a/meta-digi-dey/recipes-digi/swu-images/files/ccimx6/sw-description b/meta-digi-dey/recipes-digi/swu-images/files/ccimx6/sw-description new file mode 100644 index 000000000..6dc163358 --- /dev/null +++ b/meta-digi-dey/recipes-digi/swu-images/files/ccimx6/sw-description @@ -0,0 +1,17 @@ +software = +{ + version = "##SW_VERSION##"; + + images: ( + { + filename = "##BOOTIMG_NAME##"; + device = "/dev/mmcblk0p1"; + type = "raw"; + }, + { + filename = "##ROOTIMG_NAME##"; + device = "/dev/mmcblk0p3"; + type = "raw"; + } + ); +} diff --git a/meta-digi-dey/recipes-digi/swu-images/files/ccimx6ul/sw-description b/meta-digi-dey/recipes-digi/swu-images/files/ccimx6ul/sw-description new file mode 100644 index 000000000..46002c6d0 --- /dev/null +++ b/meta-digi-dey/recipes-digi/swu-images/files/ccimx6ul/sw-description @@ -0,0 +1,17 @@ +software = +{ + version = "##SW_VERSION##"; + + images: ( + { + filename = "##BOOTIMG_NAME##"; + volume = "linux"; + type = "ubivol" + }, + { + filename = "##ROOTIMG_NAME##"; + volume = "rootfs"; + type = "ubivol" + } + ); +} diff --git a/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo b/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo index 541f3b574..046fa4fef 100755 --- a/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo +++ b/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo @@ -3,7 +3,7 @@ # # sysinfo # -# Copyright (C) 2016 by Digi International Inc. +# Copyright (C) 2016,2017 by Digi International Inc. # All rights reserved. # # This program is free software; you can redistribute it and/or modify it @@ -263,7 +263,7 @@ printf "\n\n" echo "-------------------------------------" echo "" - echo "||*Component*|*Version*" + echo "||*Component*||*Version*" echo "|| DUT | SN-${BOARD_SN}, ${MACHINE} ${BOARD_VARIANT} SBCv${BOARD_VERSION} board_ID=${BOARD_ID}." echo "|| U-Boot | ${UBOOT_VERSION}" echo "|| Firmware | ${DISTRO}-${DEY_VERSION}-$(cat /etc/version)" diff --git a/meta-digi-dey/recipes-multimedia/alsa/card-detect.bb b/meta-digi-dey/recipes-multimedia/alsa/card-detect.bb new file mode 100644 index 000000000..b6d44f59a --- /dev/null +++ b/meta-digi-dey/recipes-multimedia/alsa/card-detect.bb @@ -0,0 +1,21 @@ +# Copyright (C) 2017 Digi International. + +SUMMARY = "DEY sound card detection app" +SECTION = "multimedia" +LICENSE = "MPL-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" + +DEPENDS = "alsa-lib" + +SRC_URI = "file://card-detect.c" + +S = "${WORKDIR}" + +do_compile() { + ${CC} -O2 -Wall card-detect.c -o card-detect -lasound +} + +do_install() { + install -d ${D}${bindir} + install -m 0755 card-detect ${D}${bindir} +} diff --git a/meta-digi-dey/recipes-multimedia/alsa/card-detect/card-detect.c b/meta-digi-dey/recipes-multimedia/alsa/card-detect/card-detect.c new file mode 100644 index 000000000..7ead91235 --- /dev/null +++ b/meta-digi-dey/recipes-multimedia/alsa/card-detect/card-detect.c @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2017 Digi International Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include + +int main(int argc, char *argv[]) +{ + int len, ret = EXIT_SUCCESS; + snd_pcm_t *handle; + char *device; + + if (argc < 2) { + printf("Usage: %s [CARD NUMBER]\n", argv[0]); + return EXIT_FAILURE; + } + + len = strlen("hw:") + strlen(argv[1]) + 1; + device = calloc(1, len); + snprintf(device, len, "hw:%s", argv[1]); + + /* Open the PCM-device in playback mode */ + if (snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0) < 0) { + printf("Could't open PCM '%s'\n", device); + ret = EXIT_FAILURE; + } else { + printf("Device %s opened successfully\n", device); + snd_pcm_close(handle); + } + + free(device); + return ret; +} diff --git a/meta-digi-dey/recipes-multimedia/gstreamer/gst1.0-fsl-plugin-4.0.8/0001-gstimxv4l2-map-dev-video1-to-dev-fb0.patch b/meta-digi-dey/recipes-multimedia/gstreamer/gst1.0-fsl-plugin-4.0.8/0001-gstimxv4l2-map-dev-video1-to-dev-fb0.patch new file mode 100644 index 000000000..7f562f8b5 --- /dev/null +++ b/meta-digi-dey/recipes-multimedia/gstreamer/gst1.0-fsl-plugin-4.0.8/0001-gstimxv4l2-map-dev-video1-to-dev-fb0.patch @@ -0,0 +1,30 @@ +From: Hector Palacios +Date: Wed, 21 Dec 2016 16:28:05 +0100 +Subject: [PATCH] gstimxv4l2: map /dev/video1 to /dev/fb0 + +On the i.MX6UL, the CSI camera is probed before the video PXP device. +In this case the camera is registered as /dev/video0 and the video device +is registered as /dev/video1. + +In the mappings for video devices we must map /dev/video1 to /dev/fb0 so +that the imxv4l2sink can work with it. + +Signed-off-by: Hector Palacios + +https://jira.digi.com/browse/DEL-3399 +--- + libs/v4l2_core/gstimxv4l2.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libs/v4l2_core/gstimxv4l2.c b/libs/v4l2_core/gstimxv4l2.c +index 02cf68d9cddc..3ec3d6a41e18 100755 +--- a/libs/v4l2_core/gstimxv4l2.c ++++ b/libs/v4l2_core/gstimxv4l2.c +@@ -208,6 +208,7 @@ static guint g_camera_format_PXP[] = { + + static IMXV4l2DeviceMap g_device_maps[] = { + {"/dev/video0", FALSE, "/dev/fb0"}, ++ {"/dev/video1", FALSE, "/dev/fb0"}, + {"/dev/video16", TRUE, "/dev/fb0"}, + {"/dev/video17", FALSE, "/dev/fb0"}, + {"/dev/video18", TRUE, "/dev/fb2"}, diff --git a/meta-digi-dey/recipes-multimedia/gstreamer/gst1.0-fsl-plugin_4.0.8.bbappend b/meta-digi-dey/recipes-multimedia/gstreamer/gst1.0-fsl-plugin_4.0.8.bbappend new file mode 100644 index 000000000..833800cae --- /dev/null +++ b/meta-digi-dey/recipes-multimedia/gstreamer/gst1.0-fsl-plugin_4.0.8.bbappend @@ -0,0 +1,5 @@ +# Copyright (C) 2016 Digi International + +FILESEXTRAPATHS_prepend := "${THISDIR}/${BP}:" + +SRC_URI += "file://0001-gstimxv4l2-map-dev-video1-to-dev-fb0.patch" diff --git a/meta-digi-dey/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.4.5.bbappend b/meta-digi-dey/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.4.5.bbappend index e88f07949..76d926783 100644 --- a/meta-digi-dey/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.4.5.bbappend +++ b/meta-digi-dey/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.4.5.bbappend @@ -3,3 +3,5 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BP}:" SRC_URI += "file://aacparse-Fix-aacparse-error-tolerance-issue.patch" + +PACKAGECONFIG_append = " vpx" diff --git a/meta-digi-dey/recipes-multimedia/packagegroups/packagegroup-dey-audio.bb b/meta-digi-dey/recipes-multimedia/packagegroups/packagegroup-dey-audio.bb index 220a0b433..3d29fdea6 100644 --- a/meta-digi-dey/recipes-multimedia/packagegroups/packagegroup-dey-audio.bb +++ b/meta-digi-dey/recipes-multimedia/packagegroups/packagegroup-dey-audio.bb @@ -22,3 +22,5 @@ RDEPENDS_${PN} = "\ alsa-states \ ${ALSA_UTILS_PKGS} \ " + +RDEPENDS_${PN}_append_ccimx6sbc = " card-detect" diff --git a/meta-digi-dey/recipes-multimedia/packagegroups/packagegroup-dey-gstreamer.bb b/meta-digi-dey/recipes-multimedia/packagegroups/packagegroup-dey-gstreamer.bb index e6840982f..b8bd34829 100644 --- a/meta-digi-dey/recipes-multimedia/packagegroups/packagegroup-dey-gstreamer.bb +++ b/meta-digi-dey/recipes-multimedia/packagegroups/packagegroup-dey-gstreamer.bb @@ -9,15 +9,17 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" inherit packagegroup MACHINE_GSTREAMER_1_0_EXTRA_INSTALL ?= "" -MACHINE_GSTREAMER_1_0_EXTRA_INSTALL_mx6 ?= "gstreamer1.0-rtsp-server-examples" +MACHINE_GSTREAMER_1_0_EXTRA_INSTALL_mx6 ?= " \ + gstreamer1.0-plugins-bad-meta \ + gstreamer1.0-plugins-ugly-meta \ + gstreamer1.0-rtsp-server-examples \ +" RDEPENDS_${PN} = " \ gstreamer1.0-meta-audio \ gstreamer1.0-meta-video \ gstreamer1.0-plugins-base-meta \ gstreamer1.0-plugins-good-meta \ - gstreamer1.0-plugins-ugly-meta \ - gstreamer1.0-plugins-bad-meta \ ${MACHINE_GSTREAMER_1_0_EXTRA_INSTALL} \ ${MACHINE_GSTREAMER_1_0_PLUGIN} \ " diff --git a/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio/0001-pulseaudio-keep-headphones-volume-in-platforms-witho.patch b/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio/0001-pulseaudio-keep-headphones-volume-in-platforms-witho.patch new file mode 100644 index 000000000..3652af0e4 --- /dev/null +++ b/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio/0001-pulseaudio-keep-headphones-volume-in-platforms-witho.patch @@ -0,0 +1,41 @@ +From: Hector Palacios +Date: Mon, 2 Jan 2017 13:11:02 +0100 +Subject: [PATCH] pulseaudio: keep headphones volume in platforms without jack + detection + +Signed-off-by: Hector Palacios +--- + src/modules/alsa/mixer/paths/analog-output-headphones.conf | 4 ++-- + src/modules/alsa/mixer/paths/analog-output-speaker.conf | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/modules/alsa/mixer/paths/analog-output-headphones.conf b/src/modules/alsa/mixer/paths/analog-output-headphones.conf +index b6ee70ba84c5..ddc0918d3a12 100644 +--- a/src/modules/alsa/mixer/paths/analog-output-headphones.conf ++++ b/src/modules/alsa/mixer/paths/analog-output-headphones.conf +@@ -81,8 +81,8 @@ override-map.2 = all-left,all-right + + [Element Headphone] + required-any = any +-switch = mute +-volume = merge ++switch = on ++volume = ignore + override-map.1 = all + override-map.2 = all-left,all-right + +diff --git a/src/modules/alsa/mixer/paths/analog-output-speaker.conf b/src/modules/alsa/mixer/paths/analog-output-speaker.conf +index 39193dd8851e..5183be2bbe4f 100644 +--- a/src/modules/alsa/mixer/paths/analog-output-speaker.conf ++++ b/src/modules/alsa/mixer/paths/analog-output-speaker.conf +@@ -73,8 +73,8 @@ volume = off + ; This profile path is intended to control the speaker, let's mute headphones + ; else there will be a spike when plugging in headphones + [Element Headphone] +-switch = off +-volume = off ++switch = on ++volume = ignore + + [Element Headphone2] + switch = off diff --git a/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio/dey-audio-hdmi.conf b/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio/dey-audio-hdmi.conf new file mode 100644 index 000000000..6ae671021 --- /dev/null +++ b/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio/dey-audio-hdmi.conf @@ -0,0 +1,35 @@ +# This file is part of PulseAudio. +# +# PulseAudio is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of the +# License, or (at your option) any later version. +# +# PulseAudio is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with PulseAudio; if not, see . + +; Audio profile for Digi ConnectCore 6 HDMI sound card +; +; Copyright (C) 2017 by Digi International Inc. +; +; This device has only one output (analog stereo) +; +; See default.conf for an explanation on the directives used here. + +[General] +auto-profiles = no + +[Mapping analog-stereo] +description = Analog Stereo +device-strings = hw:%f +channel-map = left,right +direction = output + +[Profile output:analog-stereo] +description = Analog Stereo Output +output-mappings = analog-stereo diff --git a/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio/dey-audio-sgtl5000.conf b/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio/dey-audio-sgtl5000.conf new file mode 100644 index 000000000..7c219776e --- /dev/null +++ b/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio/dey-audio-sgtl5000.conf @@ -0,0 +1,69 @@ +# This file is part of PulseAudio. +# +# PulseAudio is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of the +# License, or (at your option) any later version. +# +# PulseAudio is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with PulseAudio; if not, see . + +; Audio profile for Digi ConnectCore 6 SBC SGTL5000 sound card +; +; Copyright (C) 2017 by Digi International Inc. +; +; This device can operate in either mono or stereo for output, input or duplex +; +; Profile probing is skipped to save time during loading +; +; See default.conf for an explanation on the directives used here. + +[General] +auto-profiles = no + +[Mapping analog-mono] +description = Analog Mono +device-strings = hw:%f +channel-map = mono + +[Mapping analog-stereo] +description = Analog Stereo +device-strings = hw:%f +channel-map = left,right + +[Profile input:analog-mono] +description = Analog Mono Input +input-mappings = analog-mono +skip-probe = yes + +[Profile input:analog-stereo] +description = Analog Stereo Input +input-mappings = analog-stereo +skip-probe = yes + +[Profile output:analog-mono] +description = Analog Mono Output +output-mappings = analog-mono +skip-probe = yes + +[Profile output:analog-mono+input:analog-mono] +description = Analog Mono Duplex +output-mappings = analog-mono +input-mappings = analog-mono +skip-probe = yes + +[Profile output:analog-stereo] +description = Analog Stereo Output +output-mappings = analog-stereo +skip-probe = yes + +[Profile output:analog-stereo+input:analog-stereo] +description = Analog Stereo Duplex +output-mappings = analog-stereo +input-mappings = analog-stereo +skip-probe = yes diff --git a/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio/hdmi_hotplug.sh b/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio/hdmi_hotplug.sh new file mode 100644 index 000000000..8c9726003 --- /dev/null +++ b/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio/hdmi_hotplug.sh @@ -0,0 +1,36 @@ +#!/bin/sh +#=============================================================================== +# +# hdmi_hotplug.sh +# +# Copyright (C) 2017 by Digi International Inc. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. +# +# +# !Description: HDMI hotplug script called from udev on HDMI plug/unplug event +# +#=============================================================================== + +# Find HDMI card number +for card in /sys/class/sound/card*; do + if readlink "${card}/device" | grep -qs hdmi; then + HDMI_CARD="${card##/sys/class/sound/card}" + break + fi +done + +# On HDMI plugin event, if the sink has not been loaded yet, load the +# HDMI audio sink from ALSA +if [ "${EVENT}" = "plugin" ]; then + if ! pactl list sinks | grep -qs "imx-hdmi-soc"; then + card-detect "${HDMI_CARD}" + + # Set HDMI as default sink + pactl set-default-sink "$(pactl list sinks | grep -i 'Name:.*hdmi' | cut -d ' ' -f2)" + fi +fi + diff --git a/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio_%.bbappend b/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio_%.bbappend new file mode 100644 index 000000000..9ebc49186 --- /dev/null +++ b/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio_%.bbappend @@ -0,0 +1,36 @@ +# Copyright (C) 2017 Digi International + +FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" + +SRC_URI_append_ccimx6ulsbc = " file://0001-pulseaudio-keep-headphones-volume-in-platforms-witho.patch" +SRC_URI_append_ccimx6sbc = " \ + file://hdmi_hotplug.sh \ + file://dey-audio-hdmi.conf \ + file://dey-audio-sgtl5000.conf \ +" + +do_install_append_ccimx6sbc() { + install -d ${D}${sysconfdir}/udev/scripts + install -m 0755 ${WORKDIR}/hdmi_hotplug.sh ${D}${sysconfdir}/udev/scripts + + install -d ${D}${datadir}/pulseaudio/alsa-mixer/profile-sets + install -m 0644 ${WORKDIR}/dey-audio-hdmi.conf ${D}${datadir}/pulseaudio/alsa-mixer/profile-sets + install -m 0644 ${WORKDIR}/dey-audio-sgtl5000.conf ${D}${datadir}/pulseaudio/alsa-mixer/profile-sets + + sed -i -e '/load-module module-suspend-on-idle/{s,$, timeout=0,g}' ${D}${sysconfdir}/pulse/default.pa + + cat >> ${D}${base_libdir}/udev/rules.d/90-pulseaudio.rules <<-_EOL_ + + # Digi ConnectCore 6 SBC HDMI + ATTRS{id}=="imxhdmisoc", ENV{PULSE_PROFILE_SET}="dey-audio-hdmi.conf" + # Digi ConnectCore 6 SBC SGTL5000 + ATTRS{id}=="sgtl5000audio", ENV{PULSE_PROFILE_SET}="dey-audio-sgtl5000.conf" + + SUBSYSTEM=="platform", KERNEL=="*hdmi_video", ACTION=="change", RUN+="/etc/udev/scripts/hdmi_hotplug.sh" + _EOL_ +} + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +# The card-detect binary is only necessary for the HDMI hotplug to work on the ccimx6sbc +RDEPENDS_${PN}_append_ccimx6sbc = " card-detect" diff --git a/meta-digi-dey/recipes-support/confuse/confuse_3.0.bb b/meta-digi-dey/recipes-support/confuse/confuse_3.0.bb new file mode 100644 index 000000000..c6fe89eda --- /dev/null +++ b/meta-digi-dey/recipes-support/confuse/confuse_3.0.bb @@ -0,0 +1,12 @@ +# Copyright (C) 2017, Digi International Inc. + +SUMMARY = "Configuration file parser library" +SECTION = "libs" +LICENSE = "ISC" +LIC_FILES_CHKSUM = "file://LICENSE;md5=ef0220292b0cce0a53f5faff0d1f102a" + +SRC_URI = "https://github.com/martinh/libconfuse/releases/download/v${PV}/confuse-${PV}.tar.gz" +SRC_URI[md5sum] = "bf03099ef213647451c70e54ad4b6e81" +SRC_URI[sha256sum] = "f1f326d9443103036d19c32d3f3efec3a85c3b081d99534463668d29992c4648" + +inherit autotools gettext diff --git a/meta-digi-dey/recipes-support/swupdate/swupdate/0001-progress_client-add-command-line-parameter.patch b/meta-digi-dey/recipes-support/swupdate/swupdate/0001-progress_client-add-command-line-parameter.patch new file mode 100644 index 000000000..a45429c2f --- /dev/null +++ b/meta-digi-dey/recipes-support/swupdate/swupdate/0001-progress_client-add-command-line-parameter.patch @@ -0,0 +1,133 @@ +From: Stefano Babic +Date: Wed, 30 Nov 2016 18:04:21 +0100 +Subject: [PATCH] progress_client: add command line parameter + +Add command lin eparameter to: +- waiting forever for a connection with SWUpdate +- make psplash optional + +Signed-off-by: Stefano Babic +Signed-off-by: David Escalona +--- + progress_client/progress.c | 67 +++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 60 insertions(+), 7 deletions(-) + +diff --git a/progress_client/progress.c b/progress_client/progress.c +index b057a8f..c587dd6 100644 +--- a/progress_client/progress.c ++++ b/progress_client/progress.c +@@ -34,11 +34,30 @@ + #include + #include + #include ++#include + + #include + + #define PSPLASH_MSG_SIZE 64 + ++static struct option long_options[] = { ++ {"psplash", no_argument, NULL, 'p'}, ++ {"wait", no_argument, NULL, 'w'}, ++ {NULL, 0, NULL, 0} ++}; ++ ++static void usage(char *programname) ++{ ++ fprintf(stdout, "%s (compiled %s)\n", programname, __DATE__); ++ fprintf(stdout, "Usage %s [OPTION]\n", ++ programname); ++ fprintf(stdout, ++ " -w, --wait : wait for a connection with SWUpdate\n" ++ " -p, --psplash : send info to the psplash process\n" ++ " -h, --help : print this help and exit\n" ++ ); ++} ++ + static int psplash_init(char *pipe) + { + int psplash_pipe_fd; +@@ -123,7 +142,8 @@ static void psplash_progress(char *pipe, struct progress_msg *pmsg) + free(buf); + } + +-int main(void) { ++int main(int argc, char **argv) ++{ + int connfd; + struct sockaddr_un servaddr; + struct progress_msg msg; +@@ -135,7 +155,31 @@ int main(void) { + int percent = 0; + char bar[60]; + int filled_len; ++ int opt_w = 0; ++ int opt_p = 0; ++ int c; + ++ /* Process options with getopt */ ++ while ((c = getopt_long(argc, argv, "wph", ++ long_options, NULL)) != EOF) { ++ switch (c) { ++ case 'w': ++ opt_w = 1; ++ break; ++ case 'p': ++ opt_p = 1; ++ break; ++ case 'h': ++ usage(argv[0]); ++ exit(0); ++ break; ++ default: ++ usage(argv[0]); ++ exit(1); ++ break; ++ } ++ } ++ + tmpdir = getenv("TMPDIR"); + if (!tmpdir) + tmpdir = "/tmp"; +@@ -150,10 +194,18 @@ int main(void) { + servaddr.sun_family = AF_LOCAL; + strcpy(servaddr.sun_path, SOCKET_PROGRESS_PATH); + +- ret = connect(connfd, (struct sockaddr *) &servaddr, sizeof(servaddr)); +- if (ret < 0) { +- fprintf(stderr, "no communication with swupdate\n"); +- } ++ /* Connection to SWUpdate */ ++ do { ++ ret = connect(connfd, (struct sockaddr *) &servaddr, sizeof(servaddr)); ++ if (ret == 0) ++ break; ++ if (!opt_w) { ++ fprintf(stderr, "no communication with swupdate\n"); ++ exit(1); ++ } ++ ++ sleep(1); ++ } while (1); + + while (1) { + ret = read(connfd, &msg, sizeof(msg)); +@@ -161,7 +213,7 @@ int main(void) { + close(connfd); + exit(1); + } +- if (!psplash_ok) { ++ if (!psplash_ok && opt_p) { + psplash_ok = psplash_init(psplash_pipe_path); + } + +@@ -193,7 +245,8 @@ int main(void) { + fprintf(stdout, "\n\n%s !\n", msg.status == SUCCESS + ? "SUCCESS" + : "FAILURE"); +- psplash_progress(psplash_pipe_path, &msg); ++ if (psplash_ok) ++ psplash_progress(psplash_pipe_path, &msg); + psplash_ok = 0; + break; + case DONE: diff --git a/meta-digi-dey/recipes-support/swupdate/swupdate/defconfig b/meta-digi-dey/recipes-support/swupdate/swupdate/defconfig new file mode 100644 index 000000000..009cfaf4c --- /dev/null +++ b/meta-digi-dey/recipes-support/swupdate/swupdate/defconfig @@ -0,0 +1,83 @@ +# +# Automatically generated file; DO NOT EDIT. +# Swupdate Configuration +# +CONFIG_HAVE_DOT_CONFIG=y + +# +# Swupdate Settings +# + +# +# General Configuration +# +CONFIG_SCRIPTS=y +# CONFIG_HW_COMPATIBILITY is not set +CONFIG_SW_VERSIONS_FILE="/etc/sw-versions" +CONFIG_MTD=y +# CONFIG_LUA is not set +# CONFIG_FEATURE_SYSLOG is not set + +# +# Build Options +# +# CONFIG_STATIC is not set +CONFIG_CROSS_COMPILE="" +CONFIG_SYSROOT="" +CONFIG_EXTRA_CFLAGS="" +CONFIG_EXTRA_LDFLAGS="" +CONFIG_EXTRA_LDLIBS="" + +# +# Debugging Options +# +# CONFIG_DEBUG is not set +# CONFIG_WERROR is not set +# CONFIG_NOCLEANUP is not set +# CONFIG_DOWNLOAD is not set +# CONFIG_HASH_VERIFY is not set +# CONFIG_SIGNED_IMAGES is not set +# CONFIG_ENCRYPTED_IMAGES is not set +# CONFIG_SURICATTA is not set + +# +# Suricatta +# + +# +# Server +# +CONFIG_SURICATTA_SERVER_NONE=y + +# +# hawkBit support needs libcurl and CONFIG_JSON=y +# +# CONFIG_WEBSERVER is not set + +# +# Archival Features +# +CONFIG_GUNZIP=y + +# +# Parser Features +# +CONFIG_LIBCONFIG=y +CONFIG_LIBCONFIGROOT="" +# CONFIG_JSON is not set +# CONFIG_SETSWDESCRIPTION is not set + +# +# Image Handlers +# +CONFIG_UBIVOL=y +CONFIG_UBIBLACKLIST="" +CONFIG_UBIVIDOFFSET=0 +# CONFIG_CFI is not set +# CONFIG_CFIHAMMING1 is not set +CONFIG_RAW=y +CONFIG_SHELLSCRIPTHANDLER=y +# CONFIG_ARCHIVE is not set +# CONFIG_REMOTE_HANDLER is not set +CONFIG_UBOOT=y +CONFIG_UBOOT_FWENV="/etc/fw_env.config" diff --git a/meta-digi-dey/recipes-support/swupdate/swupdate_git.bbappend b/meta-digi-dey/recipes-support/swupdate/swupdate_git.bbappend new file mode 100644 index 000000000..f973e1df0 --- /dev/null +++ b/meta-digi-dey/recipes-support/swupdate/swupdate_git.bbappend @@ -0,0 +1,17 @@ +# Copyright (C) 2016 Digi International + +FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" + +# Version 2016.10 +SRCREV = "edd6559728d2e234ebdc03ba1d5444449ae2b92b" +PV = "2016.10+git${SRCPV}" + +SRC_URI += "file://0001-progress_client-add-command-line-parameter.patch" + +do_install_append() { + # The 'progress' command is new starting in version '2016.10', but we + # don't need to do a version check here because the bbappend is version + # specific (PV hardcoded above) + install -d ${D}${bindir}/ + install -m 0755 progress ${D}${bindir}/ +} diff --git a/sdk/build-github.sh b/sdk/build-github.sh index a61e472ac..d2f16f66e 100755 --- a/sdk/build-github.sh +++ b/sdk/build-github.sh @@ -92,6 +92,17 @@ purge_sstate() { bitbake -k -c cleansstate ${PURGE_PKGS} >/dev/null 2>&1 || true } +# +# For a given image recipe print the SWU recipe (if it exists) +# +# $1: image recipe +# +swu_recipe_name() { + if [ -n "$(find ${YOCTO_INST_DIR}/sources/meta-digi -type f -name "${1}-swu.bb")" ]; then + printf "${1}-swu" + fi +} + # Sanity checks (Jenkins environment) [ -z "${DY_REVISION}" ] && error "DY_REVISION not specified" [ -z "${WORKSPACE}" ] && error "WORKSPACE not specified" @@ -164,7 +175,7 @@ for platform in ${DY_PLATFORMS}; do fi for target in ${platform_targets}; do printf "\n[INFO] Building the ${target} target.\n" - time bitbake ${target} + time bitbake ${target} $(swu_recipe_name ${target}) done purge_sstate ) diff --git a/sdk/build.sh b/sdk/build.sh index 91109fc94..a39856427 100755 --- a/sdk/build.sh +++ b/sdk/build.sh @@ -110,6 +110,17 @@ purge_sstate() { bitbake -k -c cleansstate ${PURGE_PKGS} >/dev/null 2>&1 || true } +# +# For a given image recipe print the SWU recipe (if it exists) +# +# $1: image recipe +# +swu_recipe_name() { + if [ -n "$(find ${YOCTO_INST_DIR}/sources/meta-digi -type f -name "${1}-swu.bb")" ]; then + printf "${1}-swu" + fi +} + # Sanity check (Jenkins environment) [ -z "${DY_PLATFORMS}" ] && error "DY_PLATFORMS not specified" [ -z "${DY_REVISION}" ] && error "DY_REVISION not specified" @@ -237,7 +248,7 @@ for platform in ${DY_PLATFORMS}; do fi for target in ${platform_targets}; do printf "\n[INFO] Building the ${target} target.\n" - time bitbake ${target} + time bitbake ${target} $(swu_recipe_name ${target}) # Build the toolchain for DEY images if [ "${DY_BUILD_TCHAIN}" = "true" ] && echo "${target}" | grep -qs '^\(core\|dey\)-image-[^-]\+$'; then printf "\n[INFO] Building the toolchain for ${target}.\n" diff --git a/sdk/config/ccimx6sbc/bblayers.conf.sample b/sdk/config/ccimx6sbc/bblayers.conf.sample index 0647c0d8d..5d78bd456 100644 --- a/sdk/config/ccimx6sbc/bblayers.conf.sample +++ b/sdk/config/ccimx6sbc/bblayers.conf.sample @@ -14,6 +14,7 @@ BBLAYERS ?= " \ ##DIGIBASE##/meta-openembedded/meta-networking \ ##DIGIBASE##/meta-openembedded/meta-webserver \ ##DIGIBASE##/meta-qt5 \ + ##DIGIBASE##/meta-swupdate \ ##DIGIBASE##/meta-fsl-arm \ ##DIGIBASE##/meta-fsl-demos \ ##DIGIBASE##/meta-digi/meta-digi-arm \ diff --git a/sdk/config/ccimx6ulsbc/bblayers.conf.sample b/sdk/config/ccimx6ulsbc/bblayers.conf.sample index 0647c0d8d..5d78bd456 100644 --- a/sdk/config/ccimx6ulsbc/bblayers.conf.sample +++ b/sdk/config/ccimx6ulsbc/bblayers.conf.sample @@ -14,6 +14,7 @@ BBLAYERS ?= " \ ##DIGIBASE##/meta-openembedded/meta-networking \ ##DIGIBASE##/meta-openembedded/meta-webserver \ ##DIGIBASE##/meta-qt5 \ + ##DIGIBASE##/meta-swupdate \ ##DIGIBASE##/meta-fsl-arm \ ##DIGIBASE##/meta-fsl-demos \ ##DIGIBASE##/meta-digi/meta-digi-arm \ diff --git a/sdk/config/ccimx6ulstarter/bblayers.conf.sample b/sdk/config/ccimx6ulstarter/bblayers.conf.sample index 0647c0d8d..5d78bd456 100644 --- a/sdk/config/ccimx6ulstarter/bblayers.conf.sample +++ b/sdk/config/ccimx6ulstarter/bblayers.conf.sample @@ -14,6 +14,7 @@ BBLAYERS ?= " \ ##DIGIBASE##/meta-openembedded/meta-networking \ ##DIGIBASE##/meta-openembedded/meta-webserver \ ##DIGIBASE##/meta-qt5 \ + ##DIGIBASE##/meta-swupdate \ ##DIGIBASE##/meta-fsl-arm \ ##DIGIBASE##/meta-fsl-demos \ ##DIGIBASE##/meta-digi/meta-digi-arm \