diff --git a/meta-digi-arm/classes/image_types_digi.bbclass b/meta-digi-arm/classes/image_types_digi.bbclass index 51716b9e5..1805de6e7 100644 --- a/meta-digi-arm/classes/image_types_digi.bbclass +++ b/meta-digi-arm/classes/image_types_digi.bbclass @@ -1,10 +1,15 @@ inherit image_types +def TRUSTFENCE_BOOTIMAGE_DEPENDS(d): + tf_initramfs = d.getVar('TRUSTFENCE_INITRAMFS_IMAGE',True) or "" + return "%s:do_rootfs" % tf_initramfs if tf_initramfs else "" + IMAGE_DEPENDS_boot.vfat = " \ dosfstools-native:do_populate_sysroot \ mtools-native:do_populate_sysroot \ u-boot:do_deploy \ virtual/kernel:do_deploy \ + ${@TRUSTFENCE_BOOTIMAGE_DEPENDS(d)} \ " IMAGE_CMD_boot.vfat() { @@ -22,6 +27,12 @@ IMAGE_CMD_boot.vfat() { done fi + # Add Trustfence initramfs if enabled + if [ -n "${TRUSTFENCE_INITRAMFS_IMAGE}" ]; then + BOOTIMG_FILES="${BOOTIMG_FILES} $(readlink -e ${DEPLOY_DIR_IMAGE}/${TRUSTFENCE_INITRAMFS_IMAGE}-${MACHINE}.cpio.gz.u-boot)" + BOOTIMG_FILES_SYMLINK="${BOOTIMG_FILES_SYMLINK} ${DEPLOY_DIR_IMAGE}/${TRUSTFENCE_INITRAMFS_IMAGE}-${MACHINE}.cpio.gz.u-boot" + fi + # Size of kernel and device tree + 10% extra space (in bytes) BOOTIMG_FILES_SIZE="$(expr $(du -bc ${BOOTIMG_FILES} | tail -n1 | cut -f1) \* \( 100 + 10 \) / 100)" @@ -60,6 +71,53 @@ IMAGE_CMD_boot.vfat() { fi } +IMAGE_DEPENDS_boot.ubifs = " \ + mtd-utils-native:do_populate_sysroot \ + u-boot:do_deploy \ + virtual/kernel:do_deploy \ +" + +IMAGE_CMD_boot.ubifs() { + # + # Image generation code for image type 'boot.ubifs' + # + BOOTIMG_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 + BOOTIMG_FILES_SYMLINK="${BOOTIMG_FILES_SYMLINK} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB}" + fi + done + fi + + # Create temporary folder + TMP_BOOTDIR="$(mktemp -d ${DEPLOY_DIR_IMAGE}/boot.XXXXXX)" + + # Hard-link BOOTIMG_FILES into the temporary folder with the symlink filename + for item in ${BOOTIMG_FILES_SYMLINK}; do + orig="$(readlink -e ${item})" + ln ${orig} ${TMP_BOOTDIR}/$(basename ${item}) + done + + # Hard-link boot scripts into the temporary folder + for item in ${BOOT_SCRIPTS}; do + src="$(echo ${item} | awk -F':' '{ print $1 }')" + dst="$(echo ${item} | awk -F':' '{ print $2 }')" + ln ${DEPLOY_DIR_IMAGE}/${src} ${TMP_BOOTDIR}/${dst} + done + + # Build UBIFS boot image out of temp folder + mkfs.ubifs -r ${TMP_BOOTDIR} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.boot.ubifs ${MKUBIFS_BOOT_ARGS} + + # Create the symlink + if [ -n "${IMAGE_LINK_NAME}" ] && [ -e ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.boot.ubifs ]; then + ln -s ${IMAGE_NAME}.boot.ubifs ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.boot.ubifs + fi + + # Remove the temporary folder + rm -rf ${TMP_BOOTDIR} +} + IMAGE_CMD_rootfs.initramfs() { # # Image generation code for image type 'rootfs.initramfs' diff --git a/meta-digi-arm/conf/machine/ccimx6sbc.conf b/meta-digi-arm/conf/machine/ccimx6sbc.conf index 31804f96e..4b70319bb 100644 --- a/meta-digi-arm/conf/machine/ccimx6sbc.conf +++ b/meta-digi-arm/conf/machine/ccimx6sbc.conf @@ -27,7 +27,7 @@ KERNEL_DEVICETREE ?= " \ imx6dl-ccimx6sbc-id131.dtb \ " -SERIAL_CONSOLES = "115200;ttymxc3" +SERIAL_CONSOLES ?= "115200;ttymxc3" # Bluetooth tty BT_TTY ?= "ttymxc1" diff --git a/meta-digi-arm/conf/machine/ccimx6ulstarter.conf b/meta-digi-arm/conf/machine/ccimx6ulstarter.conf new file mode 100644 index 000000000..6593173e4 --- /dev/null +++ b/meta-digi-arm/conf/machine/ccimx6ulstarter.conf @@ -0,0 +1,28 @@ +#@TYPE: Machine +#@NAME: Starter Board for ConnectCore for i.MX6UL +#@DESCRIPTION: Machine configuration for Digi's ConnectCore 6UL Starter Board. + +# Include the machine configuration for Digi's ConnectCore 6UL. +include conf/machine/include/ccimx6ul.inc + +# U-Boot configurations +# Last one is the default (the one the symlinks point at) +UBOOT_CONFIG ??= "ccimx6ulstarter" +UBOOT_CONFIG[ccimx6ulstarter] = "ccimx6ulstarter_defconfig" + +KERNEL_DEVICETREE ?= " \ + imx6ul-ccimx6ulstarter.dtb \ + imx6ul-ccimx6ulstarter-wb.dtb \ + imx6ul-ccimx6ulstarter-id129.dtb \ +" + +SERIAL_CONSOLES = "115200;ttymxc4" + +# Bluetooth tty +BT_TTY ?= "ttymxc0" + +# U-Boot script to be copied to the boot image +BOOT_SCRIPTS = "boot.scr:boot.scr" + +# Flash image types +IMAGE_FSTYPES ?= "tar.bz2 ubifs boot.ubifs" diff --git a/meta-digi-arm/conf/machine/include/ccardimx28.inc b/meta-digi-arm/conf/machine/include/ccardimx28.inc index a153bf32e..e9a6af2fe 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 = "${@base_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/ccimx6.inc b/meta-digi-arm/conf/machine/include/ccimx6.inc index b5a22f3aa..b0d4e2a7c 100644 --- a/meta-digi-arm/conf/machine/include/ccimx6.inc +++ b/meta-digi-arm/conf/machine/include/ccimx6.inc @@ -30,6 +30,6 @@ MACHINE_EXTRA_RDEPENDS += " \ u-boot-fw-utils \ " MACHINE_EXTRA_RRECOMMENDS += "${MACHINE_FIRMWARE} ${WIRELESS_MODULE}" -MACHINE_EXTRA_RRECOMMENDS += "fsl-alsa-plugins" +MACHINE_EXTRA_RRECOMMENDS += "fsl-alsa-plugins cryptodev-module rng-tools" MACHINE_FEATURES += "accel-graphics accel-video wifi bluetooth" diff --git a/meta-digi-arm/conf/machine/include/ccimx6ul.inc b/meta-digi-arm/conf/machine/include/ccimx6ul.inc new file mode 100644 index 000000000..e8aa9ce89 --- /dev/null +++ b/meta-digi-arm/conf/machine/include/ccimx6ul.inc @@ -0,0 +1,41 @@ +#@TYPE: Machine +#@NAME: ConnectCore for i.MX6UL. +#@DESCRIPTION: Machine configuration for Digi's ConnectCore 6UL. + +include conf/machine/include/imx-digi-base.inc +include conf/machine/include/tune-cortexa7.inc + +DIGI_FAMILY = "ccimx6ul" +SOC_FAMILY = "mx6ul:${DIGI_FAMILY}" + +# Platform u-boot settings +UBOOT_SUFFIX = "imx" +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)}" + +# Firmware +MACHINE_FIRMWARE ?= "" + +MACHINE_EXTRA_RDEPENDS += " \ + imx-kobs \ + mtd-utils-ubifs \ + u-boot-fw-utils \ +" +MACHINE_EXTRA_RRECOMMENDS += "${MACHINE_FIRMWARE} ${WIRELESS_MODULE}" +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)}" + +KERNEL_IMAGETYPE = "zImage" + +# mkfs.ubifs parameters for boot partition (the one holding kernel and device tree files) +MKUBIFS_BOOT_ARGS ?= "-m 2048 -e 126976 -c 127" + +# mkfs.ubifs parameters for rootfs partition +MKUBIFS_ARGS ?= "-m 2048 -e 126976 -c 2047" diff --git a/meta-digi-arm/conf/machine/include/digi-defaults.inc b/meta-digi-arm/conf/machine/include/digi-defaults.inc index ea23756f6..fd77702be 100644 --- a/meta-digi-arm/conf/machine/include/digi-defaults.inc +++ b/meta-digi-arm/conf/machine/include/digi-defaults.inc @@ -12,15 +12,16 @@ PREFERRED_PROVIDER_virtual/xserver = "xserver-xorg" # ------------------------------------------------- # ccardimx28 3.10 2013.01 # ccimx6 3.14 2015.04 +# ccimx6ul 4.1 2015.04 # # Help variables used in recipes -HAVE_WIFI = "${@base_contains('MACHINE_FEATURES', 'wifi', '1', '', d)}" -HAVE_EXT_ETH = "${@base_contains('MACHINE_FEATURES', 'ext-eth', '1', '', d)}" -HAVE_BT = "${@base_contains('MACHINE_FEATURES', 'bluetooth', '1', '', d)}" -HAVE_1WIRE = "${@base_contains('MACHINE_FEATURES', '1-wire', '1', '', d)}" -HAVE_GUI = "${@base_contains('DISTRO_FEATURES', 'x11', '1', '', d)}" -HAVE_EXAMPLE = "${@base_contains('IMAGE_FEATURES', 'dey-examples', '1', '', d)}" +HAVE_WIFI = "${@bb.utils.contains('MACHINE_FEATURES', 'wifi', '1', '', d)}" +HAVE_EXT_ETH = "${@bb.utils.contains('MACHINE_FEATURES', 'ext-eth', '1', '', d)}" +HAVE_BT = "${@bb.utils.contains('MACHINE_FEATURES', 'bluetooth', '1', '', d)}" +HAVE_1WIRE = "${@bb.utils.contains('MACHINE_FEATURES', '1-wire', '1', '', d)}" +HAVE_GUI = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '1', '', d)}" +HAVE_EXAMPLE = "${@bb.utils.contains('IMAGE_FEATURES', 'dey-examples', '1', '', d)}" # # Ethernet configuration used in recipes 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 new file mode 100644 index 000000000..b39177ba8 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.conf @@ -0,0 +1,43 @@ +pcm.btheadset { + type plug + slave { + pcm { + type bluetooth + device 80:57:19:B2:A1:04 + profile "auto" + } + } + hint { + show on + description "BT Headset" + } +} +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 +} 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 new file mode 100644 index 000000000..0d9c9db6b --- /dev/null +++ b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.inline.state @@ -0,0 +1,127 @@ +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 new file mode 100644 index 000000000..05a69279e --- /dev/null +++ b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.inline_play.state @@ -0,0 +1,127 @@ +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 new file mode 100644 index 000000000..4d55bc608 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.micro.state @@ -0,0 +1,127 @@ +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 new file mode 100644 index 000000000..4d55bc608 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.micro_play.state @@ -0,0 +1,127 @@ +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 new file mode 100644 index 000000000..4d55bc608 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/alsa-state/alsa-state/ccimx6ul/asound.play.state @@ -0,0 +1,127 @@ +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/firmware-atheros/firmware-atheros.bb b/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros.bb index b9311c6cb..c039dc191 100644 --- a/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros.bb +++ b/meta-digi-arm/recipes-bsp/firmware-atheros/firmware-atheros.bb @@ -82,4 +82,4 @@ FILES_${PN}-ar3k = "/lib/firmware/ar3k" FILES_${PN}-ath6kl = "/lib/firmware/ath6k" PACKAGE_ARCH = "${MACHINE_ARCH}" -COMPATIBLE_MACHINE = "(ccardimx28|ccimx6)" +COMPATIBLE_MACHINE = "(ccardimx28|ccimx6$)" diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb new file mode 100644 index 000000000..8a4a37940 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm.bb @@ -0,0 +1,68 @@ +# Copyright (C) 2016 Digi International. + +SUMMARY = "Qualcomm firmware files for Digi's platforms." +SECTION = "base" +LICENSE = "Proprietary" +LIC_FILES_CHKSUM = "file://${DIGI_EULA_FILE};md5=4c0991cfde5c8a92338cbfe0f4f9a5c6" + +FW_QCA6564-BT = " \ + file://qca/nvm_tlv_3.0.bin \ + file://qca/nvm_tlv_3.2.bin \ + file://qca/rampatch_tlv_3.0.tlv \ + file://qca/rampatch_tlv_3.2.tlv \ +" + +FW_QCA6564-WIFI = " \ + file://bdwlan30_US.bin \ + file://bdwlan30_World.bin \ + file://LICENCE.atheros_firmware \ + file://otp30.bin \ + file://qwlan30.bin \ + file://utf30.bin \ + file://utfbd30.bin \ + file://wlan/cfg.dat \ + file://wlan/qcom_cfg.ini \ +" + +SRC_URI = " \ + ${FW_QCA6564-BT} \ + ${FW_QCA6564-WIFI} \ +" + +S = "${WORKDIR}" + +do_install() { + # BT firmware + install -d ${D}${base_libdir}/firmware/qca + install -m 0644 \ + qca/nvm_tlv_3.0.bin \ + qca/nvm_tlv_3.2.bin \ + qca/rampatch_tlv_3.0.tlv \ + qca/rampatch_tlv_3.2.tlv \ + ${D}${base_libdir}/firmware/qca + + # Wifi firmware + install -d ${D}${base_libdir}/firmware/wlan + install -m 0644 \ + bdwlan30_US.bin \ + bdwlan30_World.bin \ + LICENCE.atheros_firmware \ + otp30.bin \ + qwlan30.bin \ + utf30.bin \ + utfbd30.bin \ + ${D}${base_libdir}/firmware + install -m 0644 \ + wlan/cfg.dat \ + wlan/qcom_cfg.ini \ + ${D}${base_libdir}/firmware/wlan +} + +# Do not create empty debug and development packages (PN-dbg PN-dev PN-staticdev) +PACKAGES = "${PN}-qca6564-bt ${PN}-qca6564-wifi" + +FILES_${PN}-qca6564-bt = "/lib/firmware/qca" +FILES_${PN}-qca6564-wifi = "/lib/firmware" + +PACKAGE_ARCH = "${MACHINE_ARCH}" +COMPATIBLE_MACHINE = "(ccimx6ul)" diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/LICENCE.atheros_firmware b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/LICENCE.atheros_firmware new file mode 100644 index 000000000..e0ebdacdd --- /dev/null +++ b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/LICENCE.atheros_firmware @@ -0,0 +1,38 @@ +Copyright (c) 2008-2010, Atheros Communications, Inc. +All rights reserved. + +Redistribution. Redistribution and use in binary form, without +modification, are permitted provided that the following conditions are +met: + +* Redistributions must reproduce the above copyright notice and the + following disclaimer in the documentation and/or other materials + provided with the distribution. + +* Neither the name of Atheros Communications, Inc. nor the names of + its suppliers may be used to endorse or promote products derived + from this software without specific prior written permission. + +* No reverse engineering, decompilation, or disassembly of this + software is permitted. + +Limited patent license. Atheros Communications, Inc. grants a +world-wide, royalty-free, non-exclusive license under patents it +now or hereafter owns or controls to make, have made, use, import, +offer to sell and sell ("Utilize") this software, but solely to +the extent that any such patent is necessary to Utilize the software +in conjunction with an Atheros Chipset. The patent license shall not +apply to any other combinations which include this software. No +hardware per se is licensed hereunder. + +DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 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 new file mode 100644 index 000000000..a46e19861 Binary files /dev/null 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 new file mode 100755 index 000000000..7fe4abdd1 Binary files /dev/null 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/otp30.bin b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/otp30.bin new file mode 100644 index 000000000..552c7633b Binary files /dev/null and b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/otp30.bin differ diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/nvm_tlv_3.0.bin b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/nvm_tlv_3.0.bin new file mode 100644 index 000000000..d026ea190 Binary files /dev/null and b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/nvm_tlv_3.0.bin differ diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/nvm_tlv_3.2.bin b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/nvm_tlv_3.2.bin new file mode 100644 index 000000000..bc99f83bf Binary files /dev/null and b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/nvm_tlv_3.2.bin differ diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/rampatch_tlv_3.0.tlv b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/rampatch_tlv_3.0.tlv new file mode 100644 index 000000000..25d79c24b Binary files /dev/null and b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/rampatch_tlv_3.0.tlv differ diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/rampatch_tlv_3.2.tlv b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/rampatch_tlv_3.2.tlv new file mode 100644 index 000000000..37e22432b Binary files /dev/null and b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qca/rampatch_tlv_3.2.tlv differ diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qwlan30.bin b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qwlan30.bin new file mode 100644 index 000000000..e463d68fe Binary files /dev/null and b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/qwlan30.bin differ diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/utf30.bin b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/utf30.bin new file mode 100644 index 000000000..54c114772 Binary files /dev/null and b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/utf30.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 new file mode 100644 index 000000000..dfd6a4634 Binary files /dev/null and b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/utfbd30.bin differ diff --git a/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/wlan/cfg.dat b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/wlan/cfg.dat new file mode 100644 index 000000000..3860af48e Binary files /dev/null and b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/wlan/cfg.dat 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 new file mode 100644 index 000000000..da41d3e05 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/firmware-qualcomm/firmware-qualcomm/wlan/qcom_cfg.ini @@ -0,0 +1,357 @@ +# This file allows user to override the factory + +# defaults for the WLAN Driver + + +# 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 +# unnecessary if Idle Scan is disabled. +gImpsModSleepTime=0 + + +# Enable suspend or not + +# 1: Enable standby, 2: Enable Deep sleep, 3: Enable Mcast/Bcast Filter + +gEnableSuspend=3 + + +# Phy Mode (auto, b, g, n, etc) +# Valid values are 0-9, with 0 = Auto, 4 = 11n, 9 = 11ac +# 1 = 11abg, 2 = 11b, 3 = 11g, 5 = 11g only, 6 = 11n only +# 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 + +Intf0MacAddress=000AF58989FF +Intf1MacAddress=000AF58989FE +Intf2MacAddress=000AF58989FD + +Intf3MacAddress=000AF58989FC + + +# UAPSD service interval for VO,VI, BE, BK traffic + +InfraUapsdVoSrvIntv=0 + +InfraUapsdViSrvIntv=0 + +InfraUapsdBeSrvIntv=0 + +InfraUapsdBkSrvIntv=0 + +# Flag to allow STA send AddTspec even when ACM is Off +gAddTSWhenACMIsOff=1 + +# Make 1x1 the default antenna configuration + +gNumRxAnt=1 + + +# Beacon filtering frequency (unit in beacon intervals) + +gNthBeaconFilter=50 + + +# Flags to filter Mcast abd Bcast RX packets. + +# Value 0: No filtering, 1: Filter all Multicast. + +# 2: Filter all Broadcast. 3: Filter all Mcast abd Bcast + +McastBcastFilter=3 + + +#Flag to enable HostARPOffload feature or not + +hostArpOffload=1 + +#Flag to enable HostNSOffload feature or not + +hostNSOffload=1 + +#Enable OBSS protection + +gEnableApOBSSProt=1 + + +# RTS threshold + +RTSThreshold=1048576 + + +# DFS Master Capability +gEnableDFSMasterCap=1 + +# fast transition +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 + +# 1 = enable auto channel selection, channel provided by supplicant will be ignored + +gApAutoChannelSelection=0 + + +# Listen Energy Detect Mode Configuration + +# Valid values 0-128 + +# 128 means disable Energy Detect feature + +# 0-9 are threshold code and 7 is recommended value from system if feature is to be enabled. + +# 10-128 are reserved. + +# The EDET threshold mapping is as follows in 3dB step: + +# 0 = -60 dBm + +# 1 = -63 dBm + +# 2 = -66 dBm + +# ... + +# 7 = -81 dBm + +# 8 = -84 dBm + +# 9 = -87 dBm + +# Note: Any of these settings are valid. Setting 0 would yield the highest power saving (in a noisy environment) at the cost of more range. The range impact is approximately #calculated as: + +# + +# Range Loss (dB) = EDET threshold level (dBm) + 97 dBm. + +# + +gEnablePhyAgcListenMode=128 + + +#SOFTAP Channel Range selection + +gAPChannelSelectStartChannel=1 + +gAPChannelSelectEndChannel=11 + + +#SOFTAP Channel Range selection Operating band + +# 0:2.4GHZ 1: LOW-5GHZ 2:MID-5GHZ 3:HIGH-5GHZ 4: 4.9HZ BAND + +gAPChannelSelectOperatingBand=0 + + +#Channel Bonding +gChannelBondingMode5GHz=1 + + +#Enable Keep alive with non-zero period value + +gStaKeepAlivePeriod = 30 + +#Say gGoKeepAlivePeriod(5 seconds) and gGoLinkMonitorPeriod(10 seconds). +#For every 10 seconds DUT send Qos Null frame(i.e., Keep Alive frame if link is idle for last 10 seconds.) +#For both active and power save clients. + +#Power save clients: DUT set TIM bit from 10th second onwards and till client honors TIM bit. +#If doesn't honor for 5 seconds then DUT remove client. + +#Active clients: DUT send Qos Null frame for 10th seconds onwards if it is not success still we try on +#11th second if not tries on 12th and so on till 15th second. Hence before disconnection DUT will send 5 NULL frames. +#Hence in any case DUT will detect client got removed in (10+5) seconds. i.e., (gGoKeepAlivePeriod + gGoLinkMonitorPeriod).. + +#gGoLinkMonitorPeriod/ gApLinkMonitorPeriod is period where link is idle and it is period +#where we send NULL frame. + +#gApLinkMonitorPeriod = 10 + +#gGoLinkMonitorPeriod = 10 + +#gGoKeepAlivePeriod/gApKeepAlivePeriod is time to spend to check whether frame are succeed to send or not. +#Hence total effective detection time is gGoLinkMonitorPeriod+ gGoKeepAlivePeriod/gApLinkMonitorPeriod+ gApKeepAlivePeriod. + + +gGoKeepAlivePeriod = 20 + +gApKeepAlivePeriod = 20 + + +gEnableLogp=1 + + +# 0 for OLPC 1 for CLPC and SCPC +gEnableCloseLoop=1 + +#Data Inactivity Timeout when in powersave (in ms) +gDataInactivityTimeout=200 + +# VHT Tx/Rx MCS values +# Valid values are 0,1,2. If commented out, the default value is 0. +# 0=MCS0-7, 1=MCS0-8, 2=MCS0-9 +gVhtRxMCS=2 +gVhtTxMCS=2 + +# VHT Tx/Rx MCS values for 2x2 +# Valid values are 0,1,2. If commented out, the default value is 0. +# 0=MCS0-7, 1=MCS0-8, 2=MCS0-9 +gEnable2x2=0 +gVhtRxMCS2x2=2 +gVhtTxMCS2x2=2 + +# Set txchainmask and rxchainmask +# These parameters are used only if gEnable2x2 is 0 +# Valid values are 1,2 +# Set gSetTxChainmask1x1=1 or gSetRxChainmask1x1=1 to select chain0. +# Set gSetTxChainmask1x1=2 or gSetRxChainmask1x1=2 to select chain1. +gSetTxChainmask1x1=1 +gSetRxChainmask1x1=1 + +# 1=enable STBC; 0=disable STBC +gEnableRXSTBC=1 + +# 1=enable tx STBC; 0=disable +gEnableTXSTBC=1 + +# 1=enable rx LDPC; 0=disable +gEnableRXLDPC=1 + +#Enable Scan Results Aging based on timer +#Timer value is in seconds +#If Set to 0 it will not enable the feature +gScanAgingTime=0 + +#Enable Scan Results Aging based on number of scans +gScanResultAgeCount=1 + +#Enable thermal mitigation +gThermalMitigationEnable=0 + +#Thermal Mitigation Levels +gThermalTempMinLevel0=0 +gThermalTempMaxLevel0=107 +gThermalTempMinLevel1=105 +gThermalTempMaxLevel1=117 +gThermalTempMinLevel2=110 +gThermalTempMaxLevel2=127 +gThermalTempMinLevel3=115 +gThermalTempMaxLevel3=0 + +#Maxium Channel time in msec +gMaxMediumTime = 6000 + +# 802.11K support +gRrmEnable=1 +gRrmOperChanMax=8 +gRrmNonOperChanMax=8 + +#Scan offload +gEnableDirectedScanOffload=1 + +#Enable Power Save offload +gEnablePowerSaveOffload=1 + +#Enable firmware log +gEnablefwlog=1 + +#P2P Listen offload +gEnableP2pListenOffload=1 + +# Maximum Receive AMPDU size (VHT only. Valid values: 0->8k 1->16k 2->32k 3->64k 4->128k) +gVhtAmpduLenExponent=7 + +# Maximum MPDU length (VHT only. Valid values: 0->3895 octets, 1->7991 octets, 2->11454 octets) +gVhtMpduLen=2 + +# Maximum number of wow filters required +#gMaxWoWFilters=22 + +# WOW Enable/Disable. +# 0 - Disable both magic pattern match and pattern byte match. +# 1 - Enable magic pattern match on all interfaces. +# 2 - Enable pattern byte match on all interfaces. +# 3 - Enable both magic patter and pattern byte match on all interfaces. +# Default value of gEnableWoW is 3. +# gEnableWoW=0 + +#Enable or Disable p2p device address administered +isP2pDeviceAddrAdministrated=0 + +# Set Thermal Power limit +TxPower2g=10 +TxPower5g=10 + +#Enable VHT on 2.4Ghz +gEnableVhtFor24GHzBand=1 + +#Enable or Disable 5G early beacon termination +gEnable5gEBT=1 + +ssdp = 0 + +#Enable Hysteretic mode +gEnableHystereticMode=1 + +# Bus bandwidth compute timeout value in ms +gBusBandwidthComputeInterval=2000 + +# Regulatory Setting; 0=STRICT; 1=CUSTOM +gRegulatoryChangeCountry=1 + +# Enable/Disable RX full reorder offload +gReorderOffloadSupported=1 + +#Set SAP max peer to 16 which allows 10 WEP connection +gSoftApMaxPeers=16 + +# Whether userspace country code setting shld have priority +gCountryCodePriority=1 + +# Enable(1)/Disable(0) SIFS burst +gEnableSifsBurst=1 + +# Enable or Disable Multi-user MIMO +# 1=Enable (default), 0=Disable +gEnableMuBformee=1 + +# Inactivity time (in ms) to end TX Service Period while in IBSS power save mode +gIbssTxSpEndInactivityTime=10 + +END + +# Note: Configuration parser would not read anything past the END marker + diff --git a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/0001-gen_auth_encrypted_data-reuse-existing-DEK-file.patch b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/0001-gen_auth_encrypted_data-reuse-existing-DEK-file.patch new file mode 100644 index 000000000..881a77761 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/0001-gen_auth_encrypted_data-reuse-existing-DEK-file.patch @@ -0,0 +1,29 @@ +From: "Diaz de Grenu, Jose" +Date: Thu, 30 Jun 2016 16:42:42 +0200 +Subject: [PATCH] gen_auth_encrypted_data: reuse existing DEK file + +In order to be able to encrypt several artifacts with the same DEK, it is +needed to allow the CST to reuse an existing DEK file. + +Previous to this patch, the DEK is generated on the fly and placed on the +specified path. After this patch, the DEK is taken from the specified path. + +https://jira.digi.com/browse/DUB-608 + +Signed-off-by: Diaz de Grenu, Jose +--- + code/back_end/src/adapt_layer_openssl.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/code/back_end/src/adapt_layer_openssl.c b/code/back_end/src/adapt_layer_openssl.c +index 8513046269ea..ce6e370f2c6a 100644 +--- a/code/back_end/src/adapt_layer_openssl.c ++++ b/code/back_end/src/adapt_layer_openssl.c +@@ -945,6 +945,7 @@ int32_t gen_auth_encrypted_data(const char* in_file, + } + printf("\n"); + #endif ++ reuse_dek = 1; + if (reuse_dek) { + fh = fopen(key_file, "rb"); + if (fh == NULL) { diff --git a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/0002-hab4_pki_tree.sh-automate-script.patch b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/0002-hab4_pki_tree.sh-automate-script.patch new file mode 100644 index 000000000..a6686f9ee --- /dev/null +++ b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/0002-hab4_pki_tree.sh-automate-script.patch @@ -0,0 +1,521 @@ +From: "Diaz de Grenu, Jose" +Date: Mon, 18 Jul 2016 13:21:11 +0200 +Subject: [PATCH] hab4_pki_tree.sh: automate script + +Signed-off-by: Diaz de Grenu, Jose +--- + keys/hab4_pki_tree.sh | 347 ++++++++++++++++---------------------------------- + 1 file changed, 107 insertions(+), 240 deletions(-) + +diff --git a/keys/hab4_pki_tree.sh b/keys/hab4_pki_tree.sh +index 7dd67f68c8df..b2c6b71b604e 100755 +--- a/keys/hab4_pki_tree.sh ++++ b/keys/hab4_pki_tree.sh +@@ -42,84 +42,40 @@ + # + #----------------------------------------------------------------------------- + +-printf "\n" +-printf " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" +-printf " This script is a part of the Code signing tools for Freescale's\n" +-printf " High Assurance Boot. It generates a basic PKI tree. The PKI\n" +-printf " tree consists of one or more Super Root Keys (SRK), with each\n" +-printf " SRK having two subordinate keys: \n" +-printf " + a Command Sequence File (CSF) key \n" +-printf " + Image key. \n" +-printf " Additional keys can be added to the PKI tree but a separate \n" +-printf " script is available for this. This this script assumes openssl\n" +-printf " is installed on your system and is included in your search \n" +-printf " path. Finally, the private keys generated are password \n" +-printf " protectedwith the password provided by the file key_pass.txt.\n" +-printf " The format of the file is the password repeated twice:\n" +-printf " my_password\n" +-printf " my_password\n" +-printf " All private keys in the PKI tree are in PKCS #8 format will be\n" +-printf " protected by the same password.\n\n" +-printf " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" +- +-stty erase  +- +-printf "Do you want to use an existing CA key (y/n)?: \b" +-read existing_ca +-if [ $existing_ca = "y" ] +-then +- printf "Enter CA key name: \b" +- read ca_key +- printf "Enter CA certificate name: \b" +- read ca_cert ++SCRIPT_BASEDIR="$(cd $(dirname ${0}) && pwd)" ++CSF_PATH="${1}" ++if [ ! -d "${CSF_PATH}" ]; then ++ echo "Invalid CSF_PATH: ${CSF_PATH}" ++ exit 1 + fi + +-printf "Do you want to use Elliptic Curve Cryptography (y/n)?: \b" +-read use_ecc +-if [ $use_ecc = "y" ] +-then +- printf "Enter length for elliptic curve to be used for PKI tree:\n" +- printf "Possible values p192, p256, p521: \b" +- read kl +- +- # Confirm that a valid key length has been entered +- case $kl in +- p192) +- cn="secp112r1" ;; +- p256) +- cn="prime256v1" ;; +- p521) +- cn="secp521r1" ;; +- *) +- echo Invalid key length. Supported key lengths: 192, 256, 521 +- exit 1 ;; +- esac +-else +- printf "Enter key length in bits for PKI tree: \b" +- read kl +- +- # Confirm that a valid key length has been entered +- case $kl in +- 1024) ;; +- 2048) ;; +- 3072) ;; +- 4096) ;; +- *) +- echo Invalid key length. Supported key lengths: 1024, 2048, 3072, 4096 +- exit 1 ;; +- esac +-fi ++cd "${CSF_PATH}" ++ ++[ -d crts ] || mkdir crts ++[ -d keys ] || mkdir keys + ++cd keys + ++existing_ca="n" ++kl="4096" + +-printf "Enter PKI tree duration (years): \b" +-read duration ++# Confirm that a valid key length has been entered ++case $kl in ++ 1024) ;; ++ 2048) ;; ++ 3072) ;; ++ 4096) ;; ++ *) ++ echo Invalid key length. Supported key lengths: 1024, 2048, 3072, 4096 ++ exit 1 ;; ++esac ++ ++duration="10" + + # Compute validity period + val_period=$((duration*365)) + +-printf "How many Super Root Keys should be generated? \b" +-read num_srk ++num_srk="4" + + # Check that 0 < num_srk <= 4 (Max. number of SRKs) + if [ $num_srk -lt 1 ] || [ $num_srk -gt 4 ] +@@ -128,10 +84,7 @@ then + exit 1 + fi + +-# Check if SRKs should be generated as CA certs or user certs +-printf "Do you want the SRK certificates to have the CA flag set? (y/n)?: \b" +-read srk_ca +- ++srk_ca="y" + # Check that the file "serial" is present, if not create it: + if [ ! -f serial ] + then +@@ -154,6 +107,9 @@ echo "unique_subject = no" > index.txt.attr + + if [ $existing_ca = "n" ] + then ++ ca_key=./CA1_sha256_${kl}_65537_v3_ca_key ++ ca_cert=../crts/CA1_sha256_${kl}_65537_v3_ca_crt ++ + # Generate CA key and certificate + # ------------------------------- + echo +@@ -161,31 +117,12 @@ then + echo + Generating CA key and certificate + + echo +++++++++++++++++++++++++++++++++++++ + echo +- +- if [ $use_ecc = 'n' ] +- then +- ca_key=./CA1_sha256_${kl}_65537_v3_ca_key +- ca_cert=../crts/CA1_sha256_${kl}_65537_v3_ca_crt +- ca_subj_req=/CN=CA1_sha256_${kl}_65537_v3_ca/ +- ca_key_type=rsa:${kl} +- else +- +- # Generate Elliptic Curve parameters: +- eck='ec-'$cn'.pem' +- openssl ecparam -out $eck -name $cn +- +- ca_key=./CA1_sha256_${cn}_v3_ca_key +- ca_cert=../crts/CA1_sha256_${cn}_v3_ca_crt +- ca_subj_req=/CN=CA1_sha256_${cn}_v3_ca/ +- ca_key_type=ec:${eck} +- fi +- +- openssl req -newkey ${ca_key_type} -passout file:./key_pass.txt \ +- -subj ${ca_subj_req} \ +- -x509 -extensions v3_ca \ +- -keyout temp_ca.pem \ +- -out ${ca_cert}.pem \ +- -days ${val_period} -config ../ca/openssl.cnf ++ openssl req -newkey rsa:${kl} -passout file:./key_pass.txt \ ++ -subj /CN=CA1_sha256_${kl}_65537_v3_ca/ \ ++ -x509 -extensions v3_ca \ ++ -keyout temp_ca.pem \ ++ -out ${ca_cert}.pem \ ++ -days ${val_period} -config "${SCRIPT_BASEDIR}/openssl.cnf" + + # Generate CA key in PKCS #8 format - both PEM and DER + openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \ +@@ -202,7 +139,7 @@ then + openssl x509 -inform PEM -outform DER -in ${ca_cert}.pem -out ${ca_cert}.der + + # Cleanup +- \rm temp_ca.pem ++ rm temp_ca.pem + fi + + +@@ -219,64 +156,48 @@ then + echo + Generating SRK key and certificate $i + + echo ++++++++++++++++++++++++++++++++++++++++ + echo +- if [ $use_ecc = 'n' ] +- then +- # Generate SRK key +- openssl genrsa -des3 -passout file:./key_pass.txt -f4 \ +- -out ./temp_srk.pem ${kl} +- +- srk_subj_req=/CN=SRK${i}_sha256_${kl}_65537_v3_usr/ +- srk_crt=../crts/SRK${i}_sha256_${kl}_65537_v3_usr_crt +- srk_key=./SRK${i}_sha256_${kl}_65537_v3_usr_key +- else +- # Generate Elliptic Curve parameters: +- openssl ecparam -out ./temp_srk.pem -name ${cn} -genkey +- # Generate SRK key +- openssl ec -in ./temp_srk.pem -des3 -passout file:./key_pass.txt \ +- -out ./temp_srk.pem +- +- srk_subj_req=/CN=SRK${i}_sha256_${cn}_v3_usr/ +- srk_crt=../crts/SRK${i}_sha256_${cn}_v3_usr_crt +- srk_key=./SRK${i}_sha256_${cn}_v3_usr_key +- fi ++ ++ # Generate SRK key ++ openssl genrsa -des3 -passout file:./key_pass.txt -f4 \ ++ -out ./temp_srk.pem ${kl} + + # Generate SRK certificate signing request + openssl req -new -batch -passin file:./key_pass.txt \ +- -subj ${srk_subj_req} \ ++ -subj /CN=SRK${i}_sha256_${kl}_65537_v3_usr/ \ + -key ./temp_srk.pem \ + -out ./temp_srk_req.pem + + # Generate SRK certificate (this is a CA cert) +- openssl ca -batch -passin file:./key_pass.txt \ +- -md sha256 -outdir ./ \ +- -in ./temp_srk_req.pem \ +- -cert ${ca_cert}.pem \ ++ openssl ca -batch -passin file:./key_pass.txt \ ++ -md sha256 -outdir ./ \ ++ -in ./temp_srk_req.pem \ ++ -cert ${ca_cert}.pem \ + -keyfile ${ca_key}.pem \ +- -extfile ../ca/v3_usr.cnf \ +- -out ${srk_crt}.pem \ +- -days ${val_period} \ +- -config ../ca/openssl.cnf ++ -extfile "${SCRIPT_BASEDIR}/v3_usr.cnf" \ ++ -out ../crts/SRK${i}_sha256_${kl}_65537_v3_usr_crt.pem \ ++ -days ${val_period} \ ++ -config "${SCRIPT_BASEDIR}/openssl.cnf" + + # Convert SRK Certificate to DER format + openssl x509 -inform PEM -outform DER \ +- -in ${srk_crt}.pem \ +- -out ${srk_crt}.der ++ -in ../crts/SRK${i}_sha256_${kl}_65537_v3_usr_crt.pem \ ++ -out ../crts/SRK${i}_sha256_${kl}_65537_v3_usr_crt.der + + # Generate SRK key in PKCS #8 format - both PEM and DER + openssl pkcs8 -passin file:./key_pass.txt \ + -passout file:./key_pass.txt \ + -topk8 -inform PEM -outform DER -v2 des3 \ + -in temp_srk.pem \ +- -out ${srk_key}.der ++ -out ./SRK${i}_sha256_${kl}_65537_v3_usr_key.der + + openssl pkcs8 -passin file:./key_pass.txt \ + -passout file:./key_pass.txt \ + -topk8 -inform PEM -outform PEM -v2 des3 \ + -in temp_srk.pem \ +- -out ${srk_key}.pem ++ -out ./SRK${i}_sha256_${kl}_65537_v3_usr_key.pem + + # Cleanup +- \rm ./temp_srk.pem ./temp_srk_req.pem ++ rm ./temp_srk.pem ./temp_srk_req.pem + i=$((i+1)) + done + else +@@ -293,98 +214,60 @@ do + echo ++++++++++++++++++++++++++++++++++++++++ + echo + +- if [ $use_ecc = 'n' ] +- then +- # Generate SRK key +- openssl genrsa -des3 -passout file:./key_pass.txt -f4 \ +- -out ./temp_srk.pem ${kl} +- +- srk_subj_req=/CN=SRK${i}_sha256_${kl}_65537_v3_ca/ +- srk_crt=../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt +- srk_key=./SRK${i}_sha256_${kl}_65537_v3_ca_key +- else +- # Generate Elliptic Curve parameters: +- openssl ecparam -out ./temp_srk.pem -name ${cn} -genkey +- # Generate SRK key +- openssl ec -in ./temp_srk.pem -des3 -passout file:./key_pass.txt \ +- -out ./temp_srk.pem +- +- srk_subj_req=/CN=SRK${i}_sha256_${cn}_v3_ca/ +- srk_crt=../crts/SRK${i}_sha256_${cn}_v3_ca_crt +- srk_key=./SRK${i}_sha256_${cn}_v3_ca_key +- fi ++ # Generate SRK key ++ openssl genrsa -des3 -passout file:./key_pass.txt -f4 \ ++ -out ./temp_srk.pem ${kl} ++ + # Generate SRK certificate signing request +- openssl req -new -batch -passin file:./key_pass.txt \ +- -subj ${srk_subj_req} \ +- -key ./temp_srk.pem \ +- -out ./temp_srk_req.pem ++ openssl req -new -batch -passin file:./key_pass.txt \ ++ -subj /CN=SRK${i}_sha256_${kl}_65537_v3_ca/ \ ++ -key ./temp_srk.pem \ ++ -out ./temp_srk_req.pem + + # Generate SRK certificate (this is a CA cert) +- openssl ca -batch -passin file:./key_pass.txt \ +- -md sha256 -outdir ./ \ +- -in ./temp_srk_req.pem \ +- -cert ${ca_cert}.pem \ +- -keyfile ${ca_key}.pem \ +- -extfile ../ca/v3_ca.cnf \ +- -out ${srk_crt}.pem \ +- -days ${val_period} \ +- -config ../ca/openssl.cnf ++ openssl ca -batch -passin file:./key_pass.txt \ ++ -md sha256 -outdir ./ \ ++ -in ./temp_srk_req.pem \ ++ -cert ${ca_cert}.pem \ ++ -keyfile ${ca_key}.pem \ ++ -extfile "${SCRIPT_BASEDIR}/v3_ca.cnf" \ ++ -out ../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt.pem \ ++ -days ${val_period} \ ++ -config "${SCRIPT_BASEDIR}/openssl.cnf" + + # Convert SRK Certificate to DER format + openssl x509 -inform PEM -outform DER \ +- -in ${srk_crt}.pem \ +- -out ${srk_crt}.der ++ -in ../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt.pem \ ++ -out ../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt.der + + # Generate SRK key in PKCS #8 format - both PEM and DER +- openssl pkcs8 -passin file:./key_pass.txt \ +- -passout file:./key_pass.txt \ ++ openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \ + -topk8 -inform PEM -outform DER -v2 des3 \ + -in temp_srk.pem \ +- -out ${srk_key}.der ++ -out ./SRK${i}_sha256_${kl}_65537_v3_ca_key.der + +- openssl pkcs8 -passin file:./key_pass.txt \ +- -passout file:./key_pass.txt \ ++ openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \ + -topk8 -inform PEM -outform PEM -v2 des3 \ + -in temp_srk.pem \ +- -out ${srk_key}.pem ++ -out ./SRK${i}_sha256_${kl}_65537_v3_ca_key.pem + + # Cleanup + \rm ./temp_srk.pem ./temp_srk_req.pem + ++ + echo + echo ++++++++++++++++++++++++++++++++++++++++ + echo + Generating CSF key and certificate $i + + echo ++++++++++++++++++++++++++++++++++++++++ + echo + +- if [ $use_ecc = 'n' ] +- then +- srk_crt_i=../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt.pem +- srk_key_i=./SRK${i}_sha256_${kl}_65537_v3_ca_key.pem +- # Generate key +- openssl genrsa -des3 -passout file:./key_pass.txt -f4 \ +- -out ./temp_csf.pem ${kl} +- +- csf_subj_req=/CN=CSF${i}_1_sha256_${kl}_65537_v3_usr/ +- csf_crt=../crts/CSF${i}_1_sha256_${kl}_65537_v3_usr_crt +- csf_key=./CSF${i}_1_sha256_${kl}_65537_v3_usr_key +- else +- srk_crt_i=../crts/SRK${i}_sha256_${cn}_v3_ca_crt.pem +- srk_key_i=./SRK${i}_sha256_${cn}_v3_ca_key.pem +- # Generate Elliptic Curve parameters: +- openssl ecparam -out ./temp_csf.pem -name ${cn} -genkey +- # Generate key +- openssl ec -in ./temp_csf.pem -des3 -passout file:./key_pass.txt \ +- -out ./temp_csf.pem +- +- csf_subj_req=/CN=CSF${i}_1_sha256_${cn}_v3_usr/ +- csf_crt=../crts/CSF${i}_1_sha256_${cn}_v3_usr_crt +- csf_key=./CSF${i}_1_sha256_${cn}_v3_usr_key +- fi ++ # Generate key ++ openssl genrsa -des3 -passout file:./key_pass.txt \ ++ -f4 -out ./temp_csf.pem ${kl} + + # Generate CSF certificate signing request + openssl req -new -batch -passin file:./key_pass.txt \ +- -subj ${csf_subj_req} \ ++ -subj /CN=CSF${i}_1_sha256_${kl}_65537_v3_usr/ \ + -key ./temp_csf.pem \ + -out ./temp_csf_req.pem + +@@ -392,31 +275,31 @@ do + openssl ca -batch -md sha256 -outdir ./ \ + -passin file:./key_pass.txt \ + -in ./temp_csf_req.pem \ +- -cert ${srk_crt_i} \ +- -keyfile ${srk_key_i} \ +- -extfile ../ca/v3_usr.cnf \ +- -out ${csf_crt}.pem \ ++ -cert ../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt.pem \ ++ -keyfile ./SRK${i}_sha256_${kl}_65537_v3_ca_key.pem \ ++ -extfile "${SCRIPT_BASEDIR}/v3_usr.cnf" \ ++ -out ../crts/CSF${i}_1_sha256_${kl}_65537_v3_usr_crt.pem \ + -days ${val_period} \ +- -config ../ca/openssl.cnf ++ -config "${SCRIPT_BASEDIR}/openssl.cnf" + + # Convert CSF Certificate to DER format + openssl x509 -inform PEM -outform DER \ +- -in ${csf_crt}.pem \ +- -out ${csf_crt}.der ++ -in ../crts/CSF${i}_1_sha256_${kl}_65537_v3_usr_crt.pem \ ++ -out ../crts/CSF${i}_1_sha256_${kl}_65537_v3_usr_crt.der + + # Generate CSF key in PKCS #8 format - both PEM and DER + openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \ + -topk8 -inform PEM -outform DER -v2 des3 \ + -in temp_csf.pem \ +- -out ${csf_key}.der ++ -out ./CSF${i}_1_sha256_${kl}_65537_v3_usr_key.der + + openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \ + -topk8 -inform PEM -outform PEM -v2 des3 \ + -in temp_csf.pem \ +- -out ${csf_key}.pem ++ -out ./CSF${i}_1_sha256_${kl}_65537_v3_usr_key.pem + + # Cleanup +- \rm ./temp_csf.pem ./temp_csf_req.pem ++ rm ./temp_csf.pem ./temp_csf_req.pem + + echo + echo ++++++++++++++++++++++++++++++++++++++++ +@@ -424,61 +307,45 @@ do + echo ++++++++++++++++++++++++++++++++++++++++ + echo + +- if [ $use_ecc = 'n' ] +- then +- # Generate key +- openssl genrsa -des3 -passout file:./key_pass.txt -f4 \ +- -out ./temp_img.pem ${kl} +- +- img_subj_req=/CN=IMG${i}_1_sha256_${kl}_65537_v3_usr/ +- img_crt=../crts/IMG${i}_1_sha256_${kl}_65537_v3_usr_crt +- img_key=./IMG${i}_1_sha256_${kl}_65537_v3_usr_key +- else +- # Generate Elliptic Curve parameters: +- openssl ecparam -out ./temp_img.pem -name ${cn} -genkey +- # Generate key +- openssl ec -in ./temp_img.pem -des3 -passout file:./key_pass.txt \ +- -out ./temp_img.pem +- +- img_subj_req=/CN=IMG${i}_1_sha256_${cn}_v3_usr/ +- img_crt=../crts/IMG${i}_1_sha256_${cn}_v3_usr_crt +- img_key=./IMG${i}_1_sha256_${cn}_v3_usr_key +- fi ++ # Generate key ++ openssl genrsa -des3 -passout file:./key_pass.txt \ ++ -f4 -out ./temp_img.pem ${kl} + + # Generate IMG certificate signing request + openssl req -new -batch -passin file:./key_pass.txt \ +- -subj ${img_subj_req} \ ++ -subj /CN=IMG${i}_1_sha256_${kl}_65537_v3_usr/ \ + -key ./temp_img.pem \ + -out ./temp_img_req.pem + + openssl ca -batch -md sha256 -outdir ./ \ + -passin file:./key_pass.txt \ + -in ./temp_img_req.pem \ +- -cert ${srk_crt_i} \ +- -keyfile ${srk_key_i} \ +- -extfile ../ca/v3_usr.cnf \ +- -out ${img_crt}.pem \ ++ -cert ../crts/SRK${i}_sha256_${kl}_65537_v3_ca_crt.pem \ ++ -keyfile ./SRK${i}_sha256_${kl}_65537_v3_ca_key.pem \ ++ -extfile "${SCRIPT_BASEDIR}/v3_usr.cnf" \ ++ -out ../crts/IMG${i}_1_sha256_${kl}_65537_v3_usr_crt.pem \ + -days ${val_period} \ +- -config ../ca/openssl.cnf ++ -config "${SCRIPT_BASEDIR}/openssl.cnf" + + # Convert IMG Certificate to DER format + openssl x509 -inform PEM -outform DER \ +- -in ${img_crt}.pem \ +- -out ${img_crt}.der ++ -in ../crts/IMG${i}_1_sha256_${kl}_65537_v3_usr_crt.pem \ ++ -out ../crts/IMG${i}_1_sha256_${kl}_65537_v3_usr_crt.der + + # Generate IMG key in PKCS #8 format - both PEM and DER + openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \ + -topk8 -inform PEM -outform DER -v2 des3 \ + -in temp_img.pem \ +- -out ${img_key}.der ++ -out ./IMG${i}_1_sha256_${kl}_65537_v3_usr_key.der + + openssl pkcs8 -passin file:./key_pass.txt -passout file:./key_pass.txt \ + -topk8 -inform PEM -outform PEM -v2 des3 \ + -in temp_img.pem \ +- -out ${img_key}.pem ++ -out ./IMG${i}_1_sha256_${kl}_65537_v3_usr_key.pem + + # Cleanup +- \rm ./temp_img.pem ./temp_img_req.pem ++ rm ./temp_img.pem ./temp_img_req.pem ++ + + i=$((i+1)) + done diff --git a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/0003-openssl_helper-use-dev-urandom-as-seed-source.patch b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/0003-openssl_helper-use-dev-urandom-as-seed-source.patch new file mode 100644 index 000000000..24dcbd229 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/0003-openssl_helper-use-dev-urandom-as-seed-source.patch @@ -0,0 +1,22 @@ +From: "Diaz de Grenu, Jose" +Date: Tue, 12 Jul 2016 17:47:24 +0200 +Subject: [PATCH] openssl_helper: use /dev/urandom as seed source + +This is needed in order to avoid indefinitely blocking. + +Signed-off-by: Diaz de Grenu, Jose +--- + code/back_end/src/openssl_helper.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/code/back_end/src/openssl_helper.c b/code/back_end/src/openssl_helper.c +index 3c9c779092c5..f0cd4e06f0dd 100644 +--- a/code/back_end/src/openssl_helper.c ++++ b/code/back_end/src/openssl_helper.c +@@ -486,7 +486,7 @@ void print_version(void) + ---------------------------*/ + uint32_t seed_prng(uint32_t bytes) + { +- return RAND_load_file("/dev/random", bytes); ++ return RAND_load_file("/dev/urandom", bytes); + } diff --git a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/Makefile b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/Makefile new file mode 100644 index 000000000..f443ef3d1 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst-2.3.2/Makefile @@ -0,0 +1,24 @@ +TARGET = linux64/cst +LIBS = -lfrontend -lcrypto +CC = gcc +CFLAGS = -g -Wall + +.PHONY: default all clean + +default: $(TARGET) +all: default + +OBJECTS = code/back_end/src/*.c +HEADERS = code/back_end/hdr +LIBS_PATH = linux64/lib + +%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +.PRECIOUS: $(TARGET) $(OBJECTS) + +$(TARGET): $(OBJECTS) + $(CC) $(OBJECTS) $(CFLAGS) -L $(LIBS_PATH) $(LIBS) -I $(HEADERS) -o $@ + +clean: + -rm -f *.o $(TARGET) diff --git a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst_2.3.2.bb b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst_2.3.2.bb new file mode 100644 index 000000000..eb5fd5f39 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst_2.3.2.bb @@ -0,0 +1,36 @@ +SUMMARY = "NXP Code signing Tool for the High Assurance Boot library" +DESCRIPTION = "Provides software code signing support designed for use with i.MX processors that integrate the HAB library in the internal boot ROM." +HOMEPAGE = "https://www.nxp.com/webapp/Download?colCode=IMX_CST_TOOL" +LICENSE = "CLOSED" + +DEPENDS = "openssl" + +S= "${WORKDIR}/cst-${PV}" + +SRC_URI = " \ + ${@base_conditional('TRUSTFENCE_SIGN', '1', 'file://cst-${PV}.tar.gz', '', d)} \ + file://0001-gen_auth_encrypted_data-reuse-existing-DEK-file.patch \ + file://0002-hab4_pki_tree.sh-automate-script.patch \ + file://0003-openssl_helper-use-dev-urandom-as-seed-source.patch \ + file://Makefile \ +" + +do_configure() { + cp -f ${WORKDIR}/Makefile . +} + +do_compile () { + oe_runmake clean && oe_runmake +} + +do_install () { + install -d ${D}${bindir} + install -m 0755 linux64/cst ${D}${bindir}/cst + install -m 0755 linux64/srktool ${D}${bindir}/srktool + install -m 0755 keys/hab4_pki_tree.sh ${D}${bindir}/trustfence-gen-pki.sh + install -m 0755 ca/openssl.cnf ${D}${bindir}/openssl.cnf + install -m 0755 ca/v3_ca.cnf ${D}${bindir}/v3_ca.cnf + install -m 0755 ca/v3_usr.cnf ${D}${bindir}/v3_usr.cnf +} + +BBCLASSEXTEND = "native" 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 fd87f4990..6b6cad2cd 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 @@ -60,14 +60,15 @@ else exit; fi; +setenv INSTALL_MMCDEV 1 setenv INSTALL_LINUX_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.boot.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 - if test ! -e mmc 1:1 ${install_f}; then + if test ! -e mmc ${INSTALL_MMCDEV}:1 ${install_f}; then echo "ERROR: Could not find file ${install_f}"; - install_abort=1 + install_abort=1; fi; done if test -n "${install_abort}"; then @@ -88,10 +89,10 @@ setenv mmcdev 0 # Update U-Boot echo "" echo "" -echo ">> Installing U-Boot boot loader (target will reset)"; +echo ">> Installing U-Boot boot loader (target will reset)" echo "" echo "" -update uboot mmc 1 fat ${INSTALL_UBOOT_FILENAME} +update uboot mmc ${INSTALL_MMCDEV} fat ${INSTALL_UBOOT_FILENAME} if test $? -eq 1; then echo "[ERROR] Failed to update U-Boot boot loader!"; echo ""; @@ -106,58 +107,55 @@ fi # - Update the 'linux' partition # - Update the 'rootfs' partition # - Reset the system and let it boot -setenv bootcmd ' +setenv bootcmd " env default -a; saveenv; - setenv mmcdev 0; - setenv INSTALL_LINUX_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.boot.vfat - setenv INSTALL_ROOTFS_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.ext4 - echo ""; - echo ""; - echo ">> Creating Linux partition table on the eMMC"; - echo ""; - echo ""; + echo \"\"; + echo \"\"; + echo \">> Creating Linux partition table on the eMMC\"; + echo \"\"; + echo \"\"; run partition_mmc_linux; - if test $? -eq 1; then - echo "[ERROR] Failed to create Linux partition table!"; - echo ""; - echo "Aborted."; + if test \$? -eq 1; then + echo \"[ERROR] Failed to create Linux partition table!\"; + echo \"\"; + echo \"Aborted.\"; exit; fi; - echo ""; - echo ""; - echo ">> Installing Linux kernel and device tree files"; - echo ""; - echo ""; - update linux mmc 1 fat ${INSTALL_LINUX_FILENAME}; - if test $? -eq 1; then - echo "[ERROR] Failed to update linux partition!"; - echo ""; - echo "Aborted."; + echo \"\"; + echo \"\"; + echo \">> Installing Linux kernel and device tree files\"; + echo \"\"; + echo \"\"; + update linux mmc ${INSTALL_MMCDEV} fat ${INSTALL_LINUX_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update linux partition!\"; + echo \"\"; + echo \"Aborted.\"; exit; fi; - echo ""; - echo ""; - echo ">> Installing Linux root file system"; - echo ""; - echo ""; - update rootfs mmc 1 fat ${INSTALL_ROOTFS_FILENAME}; - if test $? -eq 1; then - echo "[ERROR] Failed to update rootfs partition!"; - echo ""; - echo "Aborted."; + echo \"\"; + echo \"\"; + echo \">> Installing Linux root file system\"; + echo \"\"; + echo \"\"; + update rootfs mmc ${INSTALL_MMCDEV} fat ${INSTALL_ROOTFS_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update rootfs partition!\"; + echo \"\"; + echo \"Aborted.\"; exit; fi; - echo ""; - echo "#######################"; - echo "# Install complete! #"; - echo "#######################"; - echo ""; + echo \"\"; + echo \"#######################\"; + echo \"# Install complete! #\"; + echo \"#######################\"; + echo \"\"; sleep 1; - echo ">> Restarting the system"; + echo \">> Restarting the system\"; sleep 1; reset; -' +" saveenv reset diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/boot.txt new file mode 100644 index 000000000..86f18aadb --- /dev/null +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/boot.txt @@ -0,0 +1,23 @@ +# +# 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 + +dboot linux nand 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 new file mode 100644 index 000000000..1729975f2 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-2015.04/ccimx6ulstarter/install_linux_fw_sd.txt @@ -0,0 +1,105 @@ +# +# U-Boot script for installing Linux images created by Yocto from the micro SD +# card into the NAND +# + +echo "############################################################" +echo "# Linux firmware install from micro SD #" +echo "############################################################" +echo "" +echo " This process will erase your NAND and will install a new" +echo " U-Boot and Linux firmware images on the NAND." +echo "" +echo " Press CTRL+C now if you wish to abort or wait 10 seconds" +echo " to continue." + +sleep 10 +if test $? -eq 1; then + echo "Aborted by user."; + exit; +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_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 + if test ! -e mmc ${INSTALL_MMCDEV}:1 ${install_f}; then + echo "ERROR: Could not find file ${install_f}"; + install_abort=1; + fi; +done +if test -n "${install_abort}"; then + echo "Aborted."; + exit; +fi + +# Skip user confirmation for U-Boot update +setenv forced_update 1 + +# Set bootdelay to zero so that firmware update is run immediately after +# the first reset. +setenv bootdelay 0 + +# Update U-Boot +echo "" +echo "" +echo ">> Installing U-Boot boot loader (target will reset)" +echo "" +echo "" +update uboot mmc ${INSTALL_MMCDEV} fat ${INSTALL_UBOOT_FILENAME} +if test $? -eq 1; then + echo "[ERROR] Failed to update U-Boot boot loader!"; + echo ""; + echo "Aborted."; + exit; +fi + +# Set 'bootcmd' to the second part of the script that will +# - Reset environment to defaults +# - Save the environment +# - Update the 'linux' partition +# - Update the 'rootfs' partition +# - Reset the system and let it boot +setenv bootcmd " + env default -a; + saveenv; + echo \"\"; + echo \"\"; + echo \">> Installing Linux kernel and device tree files\"; + echo \"\"; + echo \"\"; + update linux mmc ${INSTALL_MMCDEV} fat ${INSTALL_LINUX_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update linux partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; + echo \"\"; + echo \"\"; + echo \">> Installing Linux root file system\"; + echo \"\"; + echo \"\"; + update rootfs mmc ${INSTALL_MMCDEV} fat ${INSTALL_ROOTFS_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update rootfs partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; + echo \"\"; + echo \"#######################\"; + echo \"# Install complete! #\"; + echo \"#######################\"; + echo \"\"; + sleep 1; + echo \">> Restarting the system\"; + sleep 1; + reset; +" + +saveenv +reset 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 816082c23..1abe6a6ea 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 @@ -1,16 +1,18 @@ # Copyright (C) 2012-2015 Digi International -require recipes-bsp/u-boot/u-boot.inc +require u-boot.inc DESCRIPTION = "Bootloader for Digi platforms" LICENSE = "GPLv2+" LIC_FILES_CHKSUM = "file://Licenses/README;md5=c7383a594871c03da76b3707929d2919" DEPENDS += "dtc-native u-boot-mkimage-native" +DEPENDS += "${@base_conditional('TRUSTFENCE_SIGN', '1', 'trustfence-cst-native', '', d)}" PROVIDES += "u-boot" -SRCBRANCH = "v2015.04/maint" +SRCBRANCH = "v2015.04/master" +SRCBRANCH_ccimx6ul = "v2015.04/master" SRCREV = "${AUTOREV}" # Select internal or Github U-Boot repo @@ -18,6 +20,9 @@ UBOOT_GIT_URI = "${@base_conditional('DIGI_INTERNAL_GIT', '1' , '${DIGI_GIT}u-bo SRC_URI = " \ ${UBOOT_GIT_URI};branch=${SRCBRANCH} \ +" + +SRC_URI_append = " \ file://boot.txt \ file://install_linux_fw_sd.txt \ " @@ -27,6 +32,81 @@ inherit fsl-u-boot-localversion EXTRA_OEMAKE_append = " KCFLAGS=-fgnu89-inline" +UBOOT_EXTRA_CONF ?= "" + +python __anonymous() { + if (d.getVar("TRUSTFENCE_DEK_PATH", True) not in ["0", None]) and (d.getVar("TRUSTFENCE_SIGN", True) != "1"): + bb.fatal("Only signed U-Boot images can be encrypted. Generate signed images (TRUSTFENCE_SIGN=1) or remove encryption (TRUSTFENCE_DEK_PATH = 0)") + if (d.getVar("TRUSTFENCE_UBOOT_ENV_DEK", True) not in [None, "0"]): + if (d.getVar("TRUSTFENCE_DEK_PATH", True) in [None, "0"]): + bb.warn("It is strongly recommended to encrypt the U-Boot image when using environment encryption. Consider removing TRUSTFENCE_DEK_PATH = 0") + if (len(d.getVar("TRUSTFENCE_UBOOT_ENV_DEK", True)) != 32): + bb.fatal("Invalid TRUSTFENCE_UBOOT_ENV_DEK length. Define a string formed by 32 hexadecimal characters") +} + +do_compile () { + if [ "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then + sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' config.mk + fi + + unset LDFLAGS + unset CFLAGS + unset CPPFLAGS + + if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ] + then + echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion + echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion + fi + + if [ "x${UBOOT_CONFIG}" != "x" ] + then + for config in ${UBOOT_MACHINE}; do + i=`expr $i + 1`; + for type in ${UBOOT_CONFIG}; do + j=`expr $j + 1`; + if [ $j -eq $i ] + then + oe_runmake O=build_${config} ${config} + for var in ${UBOOT_EXTRA_CONF}; do + echo "${var}" >> build_${config}/.config + done + oe_runmake O=build_${config} oldconfig + oe_runmake O=build_${config} ${UBOOT_MAKE_TARGET} + cp ${S}/build_${config}/${UBOOT_BINARY} ${S}/build_${config}/u-boot-${type}.${UBOOT_SUFFIX} + + # Secure boot artifacts + if [ "${TRUSTFENCE_SIGN}" = "1" ] + then + cp ${S}/build_${config}/u-boot-signed.imx ${S}/build_${config}/u-boot-signed-${type}.${UBOOT_SUFFIX} + if [ "${TRUSTFENCE_DEK_PATH}" != "0" ] + then + cp ${S}/build_${config}/u-boot-encrypted.imx ${S}/build_${config}/u-boot-encrypted-${type}.${UBOOT_SUFFIX} + fi + fi + fi + done + unset j + done + unset i + else + oe_runmake ${UBOOT_MACHINE} + for var in ${UBOOT_EXTRA_CONF}; do + echo "${var}" >> .config + done + oe_runmake oldconfig + oe_runmake ${UBOOT_MAKE_TARGET} + fi + +} + +TF_BOOTSCRIPT_SEDFILTER = "" +TF_BOOTSCRIPT_SEDFILTER_ccimx6 = "${@tf_bootscript_sedfilter(d)}" + +def tf_bootscript_sedfilter(d): + tf_initramfs = d.getVar('TRUSTFENCE_INITRAMFS_IMAGE',True) or "" + return "/^dboot linux/i\setenv boot_initrd true\\nsetenv initrd_file %s-${MACHINE}.cpio.gz.u-boot" % tf_initramfs if tf_initramfs else "" + do_deploy_append() { # Remove canonical U-Boot symlinks for ${UBOOT_CONFIG} currently in the form: # u-boot-.imx- @@ -42,6 +122,20 @@ do_deploy_append() { cd ${DEPLOYDIR} rm -r ${UBOOT_BINARY}-${type} ${UBOOT_SYMLINK}-${type} ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} u-boot-${type}.${UBOOT_SUFFIX} + if [ "${TRUSTFENCE_SIGN}" = "1" ] + then + install ${S}/build_${config}/SRK_efuses.bin SRK_efuses-${PV}-${PR}.bin + ln -sf SRK_efuses-${PV}-${PR}.bin SRK_efuses.bin + + install ${S}/build_${config}/u-boot-signed-${type}.${UBOOT_SUFFIX} u-boot-signed-${type}-${PV}-${PR}.${UBOOT_SUFFIX} + ln -sf u-boot-signed-${type}-${PV}-${PR}.${UBOOT_SUFFIX} u-boot-signed-${type}.${UBOOT_SUFFIX} + + if [ "${TRUSTFENCE_DEK_PATH}" != "0" ] + then + install ${S}/build_${config}/u-boot-encrypted-${type}.${UBOOT_SUFFIX} u-boot-encrypted-${type}-${PV}-${PR}.${UBOOT_SUFFIX} + ln -sf u-boot-encrypted-${type}-${PV}-${PR}.${UBOOT_SUFFIX} u-boot-encrypted-${type}.${UBOOT_SUFFIX} + fi + fi fi done unset j @@ -53,8 +147,11 @@ do_deploy_append() { sed -i -e 's,##GRAPHICAL_BACKEND##,${GRAPHICAL_BACKEND},g' ${WORKDIR}/install_linux_fw_sd.txt mkimage -T script -n "DEY firmware install script" -C none -d ${WORKDIR}/install_linux_fw_sd.txt ${DEPLOYDIR}/install_linux_fw_sd.scr - # Boot script for DEY images - mkimage -T script -n bootscript -C none -d ${WORKDIR}/boot.txt ${DEPLOYDIR}/boot.scr + # Boot script for DEY images (reconfigure on-the-fly if TRUSTFENCE is enabled) + 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 + rm -f ${TMP_BOOTSCR} } -COMPATIBLE_MACHINE = "(ccimx6)" +COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul)" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/ccimx6ul/fw_env.config b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/ccimx6ul/fw_env.config new file mode 100644 index 000000000..be29acc2f --- /dev/null +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/ccimx6ul/fw_env.config @@ -0,0 +1,7 @@ +# Configuration file for fw_(printenv/setenv) utility. +# Up to two entries are valid, in this case the redundant +# environment sector is assumed present. + +# Device name Offset Size +/dev/mtd1 0x0 0x20000 +/dev/mtd1 0x20000 0x20000 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 ca253e736..89240d47b 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 @@ -2,12 +2,10 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" -SRC_URI += " \ - file://0002-fw_env-add-support-to-unlock-emmc-boot-partition.patch \ - file://fw_env.config \ -" +SRC_URI += "file://fw_env.config" +SRC_URI_append_ccimx6 = " file://0002-fw_env-add-support-to-unlock-emmc-boot-partition.patch" -# We do not have a CC6 defconfig in this version of u-boot, so just use the generic +# We do not have a platform defconfig in this version of u-boot, so just use the generic # sandbox defconfig, which is enough to build the Linux user-space tool (fw_printenv) UBOOT_CONFIG = "sandbox" UBOOT_CONFIG[sandbox] = "sandbox_defconfig" @@ -16,7 +14,7 @@ do_install_append() { install -m 0644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/ } -pkg_postinst_${PN}() { +pkg_postinst_${PN}_ccimx6() { # run the postinst script on first boot if [ x"$D" != "x" ]; then exit 1 @@ -27,4 +25,4 @@ pkg_postinst_${PN}() { fi } -COMPATIBLE_MACHINE = "(ccimx6)" +COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul)" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot.inc b/meta-digi-arm/recipes-bsp/u-boot/u-boot.inc new file mode 100644 index 000000000..544c8a2e0 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot.inc @@ -0,0 +1,290 @@ +SUMMARY = "Universal Boot Loader for embedded devices" +HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome" +SECTION = "bootloaders" +PROVIDES = "virtual/bootloader" + +LICENSE = "GPLv2+" +LIC_FILES_CHKSUM = "file://Licenses/README;md5=0507cd7da8e7ad6d6701926ec9b84c95" + +SRC_URI = "git://git.denx.de/u-boot.git;branch=master" + +S = "${WORKDIR}/git" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit uboot-config deploy + +EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}" V=1' +EXTRA_OEMAKE += 'HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}"' + +PACKAGECONFIG ??= "openssl" +# u-boot will compile its own tools during the build, with specific +# configurations (aka when CONFIG_FIT_SIGNATURE is enabled) openssl is needed as +# a host build dependency. +PACKAGECONFIG[openssl] = ",,openssl-native" + +# Allow setting an additional version string that will be picked up by the +# u-boot build system and appended to the u-boot version. If the .scmversion +# file already exists it will not be overwritten. +UBOOT_LOCALVERSION ?= "" + +# Some versions of u-boot use .bin and others use .img. By default use .bin +# but enable individual recipes to change this value. +UBOOT_SUFFIX ??= "bin" +UBOOT_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}" +UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}" +UBOOT_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_SUFFIX}" +UBOOT_MAKE_TARGET ?= "all" + +# Output the ELF generated. Some platforms can use the ELF file and directly +# load it (JTAG booting, QEMU) additionally the ELF can be used for debugging +# purposes. +UBOOT_ELF ?= "" +UBOOT_ELF_SUFFIX ?= "elf" +UBOOT_ELF_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}" +UBOOT_ELF_BINARY ?= "u-boot.${UBOOT_ELF_SUFFIX}" +UBOOT_ELF_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_ELF_SUFFIX}" + +# Some versions of u-boot build an SPL (Second Program Loader) image that +# should be packaged along with the u-boot binary as well as placed in the +# deploy directory. For those versions they can set the following variables +# to allow packaging the SPL. +SPL_BINARY ?= "" +SPL_IMAGE ?= "${SPL_BINARY}-${MACHINE}-${PV}-${PR}" +SPL_SYMLINK ?= "${SPL_BINARY}-${MACHINE}" + +# Additional environment variables or a script can be installed alongside +# u-boot to be used automatically on boot. This file, typically 'uEnv.txt' +# or 'boot.scr', should be packaged along with u-boot as well as placed in the +# deploy directory. Machine configurations needing one of these files should +# include it in the SRC_URI and set the UBOOT_ENV parameter. +UBOOT_ENV_SUFFIX ?= "txt" +UBOOT_ENV ?= "" +UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}" +UBOOT_ENV_IMAGE ?= "${UBOOT_ENV}-${MACHINE}-${PV}-${PR}.${UBOOT_ENV_SUFFIX}" +UBOOT_ENV_SYMLINK ?= "${UBOOT_ENV}-${MACHINE}.${UBOOT_ENV_SUFFIX}" + +do_compile () { + if [ "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then + sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' config.mk + fi + + unset LDFLAGS + unset CFLAGS + unset CPPFLAGS + + if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ] + then + echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion + echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion + fi + + if [ "x${UBOOT_CONFIG}" != "x" ] + then + for config in ${UBOOT_MACHINE}; do + i=`expr $i + 1`; + for type in ${UBOOT_CONFIG}; do + j=`expr $j + 1`; + if [ $j -eq $i ] + then + oe_runmake O=build_${config} ${config} + oe_runmake O=build_${config} ${UBOOT_MAKE_TARGET} + cp ${S}/build_${config}/${UBOOT_BINARY} ${S}/buidl_${config}/u-boot-${type}.${UBOOT_SUFFIX} + fi + done + unset j + done + unset i + else + oe_runmake ${UBOOT_MACHINE} + oe_runmake ${UBOOT_MAKE_TARGET} + fi + +} + +do_install () { + if [ "x${UBOOT_CONFIG}" != "x" ] + then + for config in ${UBOOT_MACHINE}; do + i=`expr $i + 1`; + for type in ${UBOOT_CONFIG}; do + j=`expr $j + 1`; + if [ $j -eq $i ] + then + install -d ${D}/boot + install ${S}/build_${config}/u-boot-${type}.${UBOOT_SUFFIX} ${D}/boot/u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY} + fi + done + unset j + done + unset i + else + install -d ${D}/boot + install ${S}/${UBOOT_BINARY} ${D}/boot/${UBOOT_IMAGE} + ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY} + fi + + if [ "x${UBOOT_ELF}" != "x" ] + then + if [ "x${UBOOT_CONFIG}" != "x" ] + then + for config in ${UBOOT_MACHINE}; do + i=`expr $i + 1`; + for type in ${UBOOT_CONFIG}; do + j=`expr $j + 1`; + if [ $j -eq $i ] + then + install ${S}/build_${config}/${UBOOT_ELF} ${D}/boot/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY} + fi + done + unset j + done + unset i + else + install ${S}/${UBOOT_ELF} ${D}/boot/${UBOOT_ELF_IMAGE} + ln -sf ${UBOOT_ELF_IMAGE} ${D}/boot/${UBOOT_ELF_BINARY} + fi + fi + + if [ -e ${WORKDIR}/fw_env.config ] ; then + install -d ${D}${sysconfdir} + install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config + fi + + if [ "x${SPL_BINARY}" != "x" ] + then + if [ "x${UBOOT_CONFIG}" != "x" ] + then + for config in ${UBOOT_MACHINE}; do + i=`expr $i + 1`; + for type in ${UBOOT_CONFIG}; do + j=`expr $j + 1`; + if [ $j -eq $i ] + then + install ${S}/build_${config}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}-${type}-${PV}-${PR} + ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARY}-${type} + ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARY} + fi + done + unset j + done + unset i + else + install ${S}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE} + ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARY} + fi + fi + + if [ "x${UBOOT_ENV}" != "x" ] + then + install ${WORKDIR}/${UBOOT_ENV_BINARY} ${D}/boot/${UBOOT_ENV_IMAGE} + ln -sf ${UBOOT_ENV_IMAGE} ${D}/boot/${UBOOT_ENV_BINARY} + fi +} + +FILES_${PN} = "/boot ${sysconfdir}" +# Ensure the split debug part of any elf files are put into dbg +FILES_${PN}-dbg += "/boot/.debug" + +do_deploy () { + if [ "x${UBOOT_CONFIG}" != "x" ] + then + for config in ${UBOOT_MACHINE}; do + i=`expr $i + 1`; + for type in ${UBOOT_CONFIG}; do + j=`expr $j + 1`; + if [ $j -eq $i ] + then + install -d ${DEPLOYDIR} + install ${S}/build_${config}/u-boot-${type}.${UBOOT_SUFFIX} ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} + cd ${DEPLOYDIR} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK}-${type} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY}-${type} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY} + fi + done + unset j + done + unset i + else + install -d ${DEPLOYDIR} + install ${S}/${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE} + cd ${DEPLOYDIR} + rm -f ${UBOOT_BINARY} ${UBOOT_SYMLINK} + ln -sf ${UBOOT_IMAGE} ${UBOOT_SYMLINK} + ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY} + fi + + if [ "x${UBOOT_ELF}" != "x" ] + then + if [ "x${UBOOT_CONFIG}" != "x" ] + then + for config in ${UBOOT_MACHINE}; do + i=`expr $i + 1`; + for type in ${UBOOT_CONFIG}; do + j=`expr $j + 1`; + if [ $j -eq $i ] + then + install ${S}/build_${config}/${UBOOT_ELF} ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}-${type} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}-${type} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK} + fi + done + unset j + done + unset i + else + install ${S}/${UBOOT_ELF} ${DEPLOYDIR}/${UBOOT_ELF_IMAGE} + ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_BINARY} + ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK} + fi + fi + + + if [ "x${SPL_BINARY}" != "x" ] + then + if [ "x${UBOOT_CONFIG}" != "x" ] + then + for config in ${UBOOT_MACHINE}; do + i=`expr $i + 1`; + for type in ${UBOOT_CONFIG}; do + j=`expr $j + 1`; + if [ $j -eq $i ] + then + install ${S}/build_${config}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}-${type}-${PV}-${PR} + rm -f ${DEPLOYDIR}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_SYMLINK}-${type} + ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_BINARY}-${type} + ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_BINARY} + ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK}-${type} + ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK} + fi + done + unset j + done + unset i + else + install ${S}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE} + rm -f ${DEPLOYDIR}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_SYMLINK} + ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_BINARY} + ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_SYMLINK} + fi + fi + + + if [ "x${UBOOT_ENV}" != "x" ] + then + install ${WORKDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_IMAGE} + rm -f ${DEPLOYDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK} + ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_BINARY} + ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK} + fi +} + +addtask deploy before do_build after do_compile diff --git a/meta-digi-arm/recipes-kernel/cryptodev/cryptodev-module_%.bbappend b/meta-digi-arm/recipes-kernel/cryptodev/cryptodev-module_%.bbappend new file mode 100644 index 000000000..087f298e1 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/cryptodev/cryptodev-module_%.bbappend @@ -0,0 +1,3 @@ +# Copyright (C) 2016 Digi International. + +KERNEL_MODULE_AUTOLOAD = "cryptodev" 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 new file mode 100644 index 000000000..c59fe3693 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb @@ -0,0 +1,63 @@ +# Copyright (C) 2016 Digi International. + +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" +SRCBRANCH = "caf-wlan/QCA6564_LE_1.0.3_LA.4.2.2.3" +SRCREV = "38f01638d75bdf3eb83ac428a4b6ec528b26f541" + +SRC_URI = " \ + ${CAF_MIRROR};destsuffix=${PV};branch=${SRCBRANCH} \ + file://qualcomm-pre-up \ + file://modprobe-qualcomm.conf \ + file://0001-qcacld-Fix-compiling-errors-when-BUILD_DEBUG_VERSION.patch \ + file://0002-Update-cfg80211_vendor_event_alloc-call-for-newer-ke.patch \ + file://0003-wlan_hdd_main-Update-cfg80211_ap_stopped-to-nl80211_.patch \ + file://0004-qcacld-2.0-remove-unused-code.patch \ + file://0005-Including-header-file-for-regulatory_hint_user.patch \ + file://0006-Updating-calls-to-alloc_netdev_mq.patch \ + file://0007-wlan_hdd_cfg80211-update-cfg80211_inform_bss-params-.patch \ + file://0008-wlan_hdd_p2p-Update-call-to-cfg80211_rx_mgmt-for-dif.patch \ + file://0009-linux_ac-Fix-for-f_dentry.patch \ + 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 \ +" + +S = "${WORKDIR}/${PV}" + +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 +# 309caa9cc6ff39d261264ec4ff10e29489afc8f8) +EXTRA_OEMAKE += "CONFIG_NON_QC_PLATFORM=y" +# Flag to compile the debug version (1 - enabled, rest of values - disabled) +EXTRA_OEMAKE += "BUILD_DEBUG_VERSION=0" + +do_compile_prepend() { + export BUILD_VER=${PV} +} + +do_install_append() { + install -d ${D}${sysconfdir}/network/if-pre-up.d + install -m 0755 ${WORKDIR}/qualcomm-pre-up ${D}${sysconfdir}/network/if-pre-up.d/qualcomm + install -d ${D}${sysconfdir}/modprobe.d + install -m 0644 ${WORKDIR}/modprobe-qualcomm.conf ${D}${sysconfdir}/modprobe.d/qualcomm.conf +} + +FILES_${PN} += " \ + ${sysconfdir}/network/if-pre-up.d/qualcomm \ + ${sysconfdir}/modprobe.d/qualcomm.conf \ +" + +COMPATIBLE_MACHINE = "(ccimx6ul)" diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0001-qcacld-Fix-compiling-errors-when-BUILD_DEBUG_VERSION.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0001-qcacld-Fix-compiling-errors-when-BUILD_DEBUG_VERSION.patch new file mode 100644 index 000000000..63847821a --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0001-qcacld-Fix-compiling-errors-when-BUILD_DEBUG_VERSION.patch @@ -0,0 +1,64 @@ +From: Yi Chen +Date: Fri, 28 Aug 2015 19:24:45 +0800 +Subject: [PATCH] qcacld: Fix compiling errors when BUILD_DEBUG_VERSION := 0. + +This is a compiling issue when BUILD_DEBUG_VERSION := 0 is set in Kbuild. + +Change-Id: Iaee98eb91d66990dfa4989a7c07cb5592f8a6079 +CRs-Fixed: 898366 +(cherry picked from commit d0258ff1dcf19236e4cfa69e45f75b72a1334609) +--- + CORE/UTILS/FWLOG/dbglog_host.c | 4 ++-- + Kbuild | 8 ++++---- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/CORE/UTILS/FWLOG/dbglog_host.c b/CORE/UTILS/FWLOG/dbglog_host.c +index 2dfa45983a87..63fc742259fc 100644 +--- a/CORE/UTILS/FWLOG/dbglog_host.c ++++ b/CORE/UTILS/FWLOG/dbglog_host.c +@@ -55,8 +55,6 @@ + #include + #define FWLOG_DEBUG ATH_DEBUG_MAKE_MODULE_MASK(0) + +-#if defined(DEBUG) +- + static bool appstarted = FALSE; + static bool senddriverstatus = FALSE; + static bool kd_nl_init = FALSE; +@@ -64,6 +62,8 @@ static int cnss_diag_pid = INVALID_PID; + static int get_version = 0; + static int gprint_limiter = 0; + ++#if defined(DEBUG) ++ + static ATH_DEBUG_MASK_DESCRIPTION g_fwlogDebugDescription[] = { + {FWLOG_DEBUG,"fwlog"}, + }; +diff --git a/Kbuild b/Kbuild +index 04461cfb7945..b248eee28bf0 100644 +--- a/Kbuild ++++ b/Kbuild +@@ -882,7 +882,6 @@ CDEFINES := -DANI_LITTLE_BYTE_ENDIAN \ + -DWLAN_PERF \ + -DPTT_SOCK_SVC_ENABLE \ + -Wall\ +- -Werror\ + -D__linux__ \ + -DHAL_SELF_STA_PER_BSS=1 \ + -DWLAN_FEATURE_VOWIFI_11R \ +@@ -966,11 +965,12 @@ CDEFINES += -DWCN_PRONTO + CDEFINES += -DWCN_PRONTO_V1 + endif + ++CDEFINES += -DTRACE_RECORD \ ++ -DLIM_TRACE_RECORD \ ++ -DSME_TRACE_RECORD ++ + ifeq ($(BUILD_DEBUG_VERSION),1) + CDEFINES += -DWLAN_DEBUG \ +- -DTRACE_RECORD \ +- -DLIM_TRACE_RECORD \ +- -DSME_TRACE_RECORD \ + -DPE_DEBUG_LOGW \ + -DPE_DEBUG_LOGE \ + -DDEBUG diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0002-Update-cfg80211_vendor_event_alloc-call-for-newer-ke.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0002-Update-cfg80211_vendor_event_alloc-call-for-newer-ke.patch new file mode 100644 index 000000000..221547159 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0002-Update-cfg80211_vendor_event_alloc-call-for-newer-ke.patch @@ -0,0 +1,57 @@ +From: Isaac Hermida +Date: Mon, 18 Apr 2016 08:48:14 +0200 +Subject: [PATCH] Update cfg80211_vendor_event_alloc call for newer kernel + versions + +Current compilation fails with next error. + +> wlan_hdd_cfg80211.h:995:9: error: too few arguments to function 'cfg80211_vendor_event_alloc' + +This function has been updated starting with kernel 3.15 + +Signed-off-by: Isaac Hermida +--- + CORE/HDD/inc/wlan_hdd_cfg80211.h | 2 +- + CORE/HDD/src/wlan_hdd_assoc.c | 8 ++++++++ + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/CORE/HDD/inc/wlan_hdd_cfg80211.h b/CORE/HDD/inc/wlan_hdd_cfg80211.h +index 7602f1d3874b..a40c55144bc5 100644 +--- a/CORE/HDD/inc/wlan_hdd_cfg80211.h ++++ b/CORE/HDD/inc/wlan_hdd_cfg80211.h +@@ -992,7 +992,7 @@ backported_cfg80211_vendor_event_alloc(struct wiphy *wiphy, + int approxlen, + int event_idx, gfp_t gfp) + { +- return cfg80211_vendor_event_alloc(wiphy, approxlen, event_idx, gfp); ++ return cfg80211_vendor_event_alloc(wiphy, wdev, approxlen, event_idx, gfp); + } + #define cfg80211_vendor_event_alloc backported_cfg80211_vendor_event_alloc + #endif +diff --git a/CORE/HDD/src/wlan_hdd_assoc.c b/CORE/HDD/src/wlan_hdd_assoc.c +index bc3e15009d97..5dc882fa8f83 100644 +--- a/CORE/HDD/src/wlan_hdd_assoc.c ++++ b/CORE/HDD/src/wlan_hdd_assoc.c +@@ -2027,6 +2027,8 @@ static void hdd_RoamIbssIndicationHandler( hdd_adapter_t *pAdapter, + eRoamCmdStatus roamStatus, + eCsrRoamResult roamResult ) + { ++ struct ieee80211_channel *chann; ++ + hddLog(VOS_TRACE_LEVEL_INFO, "%s: %s: id %d, status %d, result %d", + __func__, pAdapter->dev->name, roamId, roamStatus, roamResult); + +@@ -2082,7 +2084,13 @@ static void hdd_RoamIbssIndicationHandler( hdd_adapter_t *pAdapter, + return; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) ++ chann = ieee80211_get_channel(pAdapter->wdev.wiphy, ++ (int)pRoamInfo->pBssDesc->channelId); ++ cfg80211_ibss_joined(pAdapter->dev, bss->bssid, chann, GFP_KERNEL); ++#else + cfg80211_ibss_joined(pAdapter->dev, bss->bssid, GFP_KERNEL); ++#endif + cfg80211_put_bss( + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) || defined(WITH_BACKPORTS) + pHddCtx->wiphy, diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0003-wlan_hdd_main-Update-cfg80211_ap_stopped-to-nl80211_.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0003-wlan_hdd_main-Update-cfg80211_ap_stopped-to-nl80211_.patch new file mode 100644 index 000000000..86c6a4ca7 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0003-wlan_hdd_main-Update-cfg80211_ap_stopped-to-nl80211_.patch @@ -0,0 +1,30 @@ +From: Isaac Hermida +Date: Thu, 21 Apr 2016 10:30:51 +0200 +Subject: [PATCH] wlan_hdd_main: Update cfg80211_ap_stopped to + nl80211_send_ap_stopped + +Use nl80211_send_ap_stopped instead of cfg80211_ap_stopped for newer +kernel versions + +Signed-off-by: Isaac Hermida +--- + CORE/HDD/src/wlan_hdd_main.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c +index 5e4e95aaaee4..0ff3f31b9863 100755 +--- a/CORE/HDD/src/wlan_hdd_main.c ++++ b/CORE/HDD/src/wlan_hdd_main.c +@@ -9929,8 +9929,12 @@ VOS_STATUS hdd_start_all_adapters( hdd_context_t *pHddCtx ) + #if defined(MSM_PLATFORM) && !defined(WITH_BACKPORTS) + hddLog(VOS_TRACE_LEVEL_ERROR, "%s [SSR] send stop ap to supplicant", + __func__); ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)) + cfg80211_ap_stopped(pAdapter->dev, GFP_KERNEL); + #else ++ nl80211_send_ap_stopped(pAdapter->dev->ieee80211_ptr); ++#endif ++#else + hddLog(VOS_TRACE_LEVEL_ERROR, "%s [SSR] send restart supplicant", + __func__); + /* event supplicant to restart */ diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0004-qcacld-2.0-remove-unused-code.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0004-qcacld-2.0-remove-unused-code.patch new file mode 100644 index 000000000..09b3ee892 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0004-qcacld-2.0-remove-unused-code.patch @@ -0,0 +1,215 @@ +From: Karthick S +Date: Fri, 14 Aug 2015 14:52:23 +0530 +Subject: [PATCH] qcacld-2.0: remove unused code + +Removed unused code from ReinitSDIO. Also removed mmcbusmode and it's +related references in the code. + +Change-Id: Idaa40f31cc830c0e2fa5d6fbda8c78c9f434bdaf +CRs-Fixed: 890630 +(cherry picked from commit acca7f817db52580a985de2804f30973b2ed9cb7) + +Signed-off-by: Isaac Hermida +(cherry picked from commit d63533a6cc46671141ac31290e4f020c236298ee) +--- + CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c | 165 +-------------------- + 1 file changed, 2 insertions(+), 163 deletions(-) + +diff --git a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c +index 31641c94351c..b3afed2a8d7c 100644 +--- a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c ++++ b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c +@@ -57,11 +57,6 @@ + + #define MAX_HIF_DEVICES 2 + +-unsigned int mmcbusmode = 0; +-module_param(mmcbusmode, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); +-MODULE_PARM_DESC(mmcbusmode, "Set MMC driver Bus Mode: 1-SDR12, 2-SDR25, 3-SDR50, 4-DDR50, 5-SDR104"); +-EXPORT_SYMBOL(mmcbusmode); +- + unsigned int mmcbuswidth = 0; + module_param(mmcbuswidth, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + MODULE_PARM_DESC(mmcbuswidth, "Set MMC driver Bus Width: 1-1Bit, 4-4Bit, 8-8Bit"); +@@ -689,98 +684,6 @@ A_STATUS ReinitSDIO(HIF_DEVICE *device) + sdio_claim_host(func); + + do { +- /* 2.6.32 kernel does part of the SDIO initalization upon resume */ +- A_BOOL lt_2_6_32 = (LINUX_VERSION_CODEocr_avail) - 1; +- /* emulate the mmc_power_up(...) */ +- host->ios.vdd = bit; +- host->ios.chip_select = MMC_CS_DONTCARE; +- host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN; +- host->ios.power_mode = MMC_POWER_UP; +- host->ios.bus_width = MMC_BUS_WIDTH_1; +- host->ios.timing = MMC_TIMING_LEGACY; +- host->ops->set_ios(host, &host->ios); +- /* +- * This delay should be sufficient to allow the power supply +- * to reach the minimum voltage. +- */ +- msleep(2); +- +- host->ios.clock = host->f_min; +- host->ios.power_mode = MMC_POWER_ON; +- host->ops->set_ios(host, &host->ios); +- +- /* +- * This delay must be at least 74 clock sizes, or 1 ms, or the +- * time required to reach a stable voltage. +- */ +- msleep(2); +- +- /* Issue CMD0. Goto idle state */ +- host->ios.chip_select = MMC_CS_HIGH; +- host->ops->set_ios(host, &host->ios); +- msleep(1); +- err = IssueSDCommand(device, MMC_GO_IDLE_STATE, 0, (MMC_RSP_NONE | MMC_CMD_BC), NULL); +- host->ios.chip_select = MMC_CS_DONTCARE; +- host->ops->set_ios(host, &host->ios); +- msleep(1); +- host->use_spi_crc = 0; +- +- if (err) { +- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD0 failed : %d \n",err)); +- break; +- } +- +- if (!host->ocr) { +- /* Issue CMD5, arg = 0 */ +- err = IssueSDCommand(device, SD_IO_SEND_OP_COND, 0, (MMC_RSP_R4 | MMC_CMD_BCR), &resp); +- if (err) { +- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD5 failed : %d \n",err)); +- break; +- } +- host->ocr = resp; +- } +- +- /* Issue CMD5, arg = ocr. Wait till card is ready */ +- for (i=0;i<100;i++) { +- err = IssueSDCommand(device, SD_IO_SEND_OP_COND, host->ocr, (MMC_RSP_R4 | MMC_CMD_BCR), &resp); +- if (err) { +- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD5 failed : %d \n",err)); +- break; +- } +- if (resp & MMC_CARD_BUSY) { +- break; +- } +- msleep(10); +- } +- +- if ((i == 100) || (err)) { +- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: card in not ready : %d %d \n",i,err)); +- break; +- } +- +- /* Issue CMD3, get RCA */ +- err = IssueSDCommand(device, SD_SEND_RELATIVE_ADDR, 0, MMC_RSP_R6 | MMC_CMD_BCR, &resp); +- if (err) { +- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD3 failed : %d \n",err)); +- break; +- } +- rca = resp >> 16; +- host->ios.bus_mode = MMC_BUSMODE_PUSHPULL; +- host->ops->set_ios(host, &host->ios); +- +- /* Issue CMD7, select card */ +- err = IssueSDCommand(device, MMC_SELECT_CARD, (rca << 16), MMC_RSP_R1 | MMC_CMD_AC, NULL); +- if (err) { +- AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD7 failed : %d \n",err)); +- break; +- } +- } +- + /* Enable high speed */ + if (card->host->caps & MMC_CAP_SD_HIGHSPEED) { + AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("ReinitSDIO: Set high speed mode\n")); +@@ -1212,10 +1115,7 @@ TODO: MMC SDIO3.0 Setting should also be modified in ReInit() function when Powe + */ + { + A_UINT32 clock, clock_set = 12500000; +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0) +- unsigned int bus_speed = 0, timing = 0; +- unsigned char speed = 0; +-#endif ++ + sdio_claim_host(func); + if (writecccr1) { + A_UINT32 err = Func0_CMD52WriteByte(func->card, +@@ -1352,69 +1252,8 @@ TODO: MMC SDIO3.0 Setting should also be modified in ReInit() function when Powe + if (debugcccr) { + HIFDumpCCCR(device); + } +- // Set MMC Bus Mode: 1-SDR12, 2-SDR25, 3-SDR50, 4-DDR50, 5-SDR104 +- if (mmcbusmode > 0) { +- printk("host caps:0x%08X, card_sd3_bus_mode:0x%08X\n", (unsigned int)func->card->host->caps, (unsigned int)func->card->sw_caps.sd3_bus_mode); +- if (mmcbusmode == 5 && (func->card->host->caps & MMC_CAP_UHS_SDR104) && +- ((func->card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR104) || forcecard)) { +- bus_speed = SDIO_SPEED_SDR104; +- timing = MMC_TIMING_UHS_SDR104; +- func->card->sw_caps.uhs_max_dtr = UHS_SDR104_MAX_DTR; +- AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("%s: Set MMC bus mode to SDR104. \n", __func__)); +- } else if (mmcbusmode == 4 && (func->card->host->caps & MMC_CAP_UHS_DDR50) && +- ((func->card->sw_caps.sd3_bus_mode & SD_MODE_UHS_DDR50) || forcecard)) { +- bus_speed = SDIO_SPEED_DDR50; +- timing = MMC_TIMING_UHS_DDR50; +- func->card->sw_caps.uhs_max_dtr = UHS_DDR50_MAX_DTR; +- AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("%s: Set MMC bus mode to DDR50. \n", __func__)); +- } else if (mmcbusmode == 3 && (func->card->host->caps & (MMC_CAP_UHS_SDR104 | MMC_CAP_UHS_SDR50)) && +- ((func->card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR50) || forcecard)) { +- bus_speed = SDIO_SPEED_SDR50; +- timing = MMC_TIMING_UHS_SDR50; +- func->card->sw_caps.uhs_max_dtr = UHS_SDR50_MAX_DTR; +- AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("%s: Set MMC bus mode to SDR50. \n", __func__)); +- } else if (mmcbusmode == 2 && (func->card->host->caps & +- (MMC_CAP_UHS_SDR104 | MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR25)) && +- ((func->card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR25) || forcecard)) { +- bus_speed = SDIO_SPEED_SDR25; +- timing = MMC_TIMING_UHS_SDR25; +- func->card->sw_caps.uhs_max_dtr = UHS_SDR25_MAX_DTR; +- AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("%s: Set MMC bus mode to SDR25. \n", __func__)); +- } else if (mmcbusmode == 1 && (func->card->host->caps & (MMC_CAP_UHS_SDR104 | MMC_CAP_UHS_SDR50 | +- MMC_CAP_UHS_SDR25 | MMC_CAP_UHS_SDR12)) && +- ((func->card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR12) || forcecard)) { +- bus_speed = SDIO_SPEED_SDR12; +- timing = MMC_TIMING_UHS_SDR12; +- func->card->sw_caps.uhs_max_dtr = UHS_SDR12_MAX_DTR; +- AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("%s: Set MMC bus mode to SDR12. \n", __func__)); +- } else { +- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: MMC bus mode %d not supported. \n", __func__, mmcbusmode)); +- return ret = -1; +- } +- +- ret = Func0_CMD52ReadByte(func->card, SDIO_CCCR_SPEED, &speed); +- if (ret){ +- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: CMD52 to get CCCR SPEED failed: %d, cap_uhs: %lu, sd3_bus_mode: %x \n", __func__, ret, (long unsigned int)(func->card->host->caps & (MMC_CAP_UHS_SDR104 | MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR25 | MMC_CAP_UHS_SDR12)), func->card->sw_caps.sd3_bus_mode)); +- return ret; +- } +- +- speed &= ~SDIO_SPEED_BSS_MASK; +- speed |= bus_speed; +- ret = Func0_CMD52WriteByte(func->card, SDIO_CCCR_SPEED, speed); +- if (ret){ +- AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s: CMD52 to set CCCR SPPED failed: %d \n", __func__, ret)); +- return ret; +- } +- +- if (bus_speed) { +- device->host->ios.timing = timing; +- device->host->ops->set_ios(device->host, &device->host->ios); +- // mmc_set_clock(func->card->host, func->card->sw_caps.uhs_max_dtr); +- } +- } +- +-#endif //#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0) */ + sdio_release_host(func); + } + diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0005-Including-header-file-for-regulatory_hint_user.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0005-Including-header-file-for-regulatory_hint_user.patch new file mode 100644 index 000000000..750db8f12 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0005-Including-header-file-for-regulatory_hint_user.patch @@ -0,0 +1,28 @@ +From: Isaac Hermida +Date: Thu, 21 Apr 2016 13:19:10 +0200 +Subject: [PATCH] Including header file for "regulatory_hint_user" + +The function "regulatory_hint_user" has been moved from +include/net/cfg80211.h to net/wireless/reg.h. + +Signed-off-by: Isaac Hermida +(cherry picked from commit db944bc907127c191b1bbdcc58d3aecedcf44a8c) +--- + CORE/VOSS/src/vos_nvitem.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/CORE/VOSS/src/vos_nvitem.c b/CORE/VOSS/src/vos_nvitem.c +index d79ae2871e4b..47290c9d1744 100644 +--- a/CORE/VOSS/src/vos_nvitem.c ++++ b/CORE/VOSS/src/vos_nvitem.c +@@ -53,6 +53,10 @@ + #include "regdomain.h" + #include "regdomain_common.h" + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) ++#include <../net/wireless/reg.h> ++#endif ++ + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)) && !defined(WITH_BACKPORTS) + #define IEEE80211_CHAN_NO_80MHZ 1<<7 + #endif diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0006-Updating-calls-to-alloc_netdev_mq.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0006-Updating-calls-to-alloc_netdev_mq.patch new file mode 100644 index 000000000..644edbf66 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0006-Updating-calls-to-alloc_netdev_mq.patch @@ -0,0 +1,75 @@ +From: Isaac Hermida +Date: Thu, 21 Apr 2016 13:52:18 +0200 +Subject: [PATCH] Updating calls to "alloc_netdev_mq" + +Signed-off-by: Isaac Hermida +--- + CORE/EPPING/src/epping_txrx.c | 6 ++++++ + CORE/HDD/src/wlan_hdd_hostapd.c | 4 ++++ + CORE/HDD/src/wlan_hdd_main.c | 10 +++++++--- + 3 files changed, 17 insertions(+), 3 deletions(-) + +diff --git a/CORE/EPPING/src/epping_txrx.c b/CORE/EPPING/src/epping_txrx.c +index 678d58e0cfae..0985e362f94a 100644 +--- a/CORE/EPPING/src/epping_txrx.c ++++ b/CORE/EPPING/src/epping_txrx.c +@@ -355,7 +355,13 @@ epping_adapter_t *epping_add_adapter(epping_context_t *pEpping_ctx, + struct net_device *dev; + epping_adapter_t *pAdapter; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0) ++ dev = alloc_netdev(sizeof(epping_adapter_t), "wifi%d", NET_NAME_UNKNOWN, ether_setup); ++#else + dev = alloc_netdev(sizeof(epping_adapter_t), "wifi%d", ether_setup); ++#endif ++ ++ + if (dev == NULL) { + EPPING_LOG(VOS_TRACE_LEVEL_FATAL, + "%s: Cannot allocate epping_adapter_t\n", __func__); +diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c +index 6251224c11df..8a80d26f355a 100644 +--- a/CORE/HDD/src/wlan_hdd_hostapd.c ++++ b/CORE/HDD/src/wlan_hdd_hostapd.c +@@ -5447,7 +5447,11 @@ hdd_adapter_t* hdd_wlan_create_ap_dev( hdd_context_t *pHddCtx, tSirMacAddr macAd + + hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: iface_name = %s", __func__, iface_name); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0) ++ pWlanHostapdDev = alloc_netdev_mq(sizeof(hdd_adapter_t), iface_name, NET_NAME_UNKNOWN, ether_setup, NUM_TX_QUEUES); ++#else + pWlanHostapdDev = alloc_netdev_mq(sizeof(hdd_adapter_t), iface_name, ether_setup, NUM_TX_QUEUES); ++#endif + + if (pWlanHostapdDev != NULL) + { +diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c +index 0ff3f31b9863..a10da2a9b164 100755 +--- a/CORE/HDD/src/wlan_hdd_main.c ++++ b/CORE/HDD/src/wlan_hdd_main.c +@@ -8226,7 +8226,11 @@ static hdd_adapter_t* hdd_alloc_station_adapter( hdd_context_t *pHddCtx, tSirMac + /* + * cfg80211 initialization and registration.... + */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0) ++ pWlanDev = alloc_netdev_mq(sizeof( hdd_adapter_t ), name, NET_NAME_UNKNOWN, ether_setup, NUM_TX_QUEUES); ++#else + pWlanDev = alloc_netdev_mq(sizeof( hdd_adapter_t ), name, ether_setup, NUM_TX_QUEUES); ++#endif + + if(pWlanDev != NULL) + { +@@ -9929,10 +9933,10 @@ VOS_STATUS hdd_start_all_adapters( hdd_context_t *pHddCtx ) + #if defined(MSM_PLATFORM) && !defined(WITH_BACKPORTS) + hddLog(VOS_TRACE_LEVEL_ERROR, "%s [SSR] send stop ap to supplicant", + __func__); +-#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)) +- cfg80211_ap_stopped(pAdapter->dev, GFP_KERNEL); +-#else ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)) + nl80211_send_ap_stopped(pAdapter->dev->ieee80211_ptr); ++#else ++ cfg80211_ap_stopped(pAdapter->dev, GFP_KERNEL); + #endif + #else + hddLog(VOS_TRACE_LEVEL_ERROR, "%s [SSR] send restart supplicant", diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0007-wlan_hdd_cfg80211-update-cfg80211_inform_bss-params-.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0007-wlan_hdd_cfg80211-update-cfg80211_inform_bss-params-.patch new file mode 100644 index 000000000..58df7fd70 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0007-wlan_hdd_cfg80211-update-cfg80211_inform_bss-params-.patch @@ -0,0 +1,28 @@ +From: Isaac Hermida +Date: Thu, 21 Apr 2016 13:56:15 +0200 +Subject: [PATCH] wlan_hdd_cfg80211: update "cfg80211_inform_bss" params for + kernel version + +Signed-off-by: Isaac Hermida +--- + CORE/HDD/src/wlan_hdd_cfg80211.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c +index c09ac0304852..c6c79552a9d0 100644 +--- a/CORE/HDD/src/wlan_hdd_cfg80211.c ++++ b/CORE/HDD/src/wlan_hdd_cfg80211.c +@@ -8460,8 +8460,11 @@ static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( + WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); + if (bss == NULL) { + rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; +- +- return (cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId, ++ return (cfg80211_inform_bss(wiphy, chan, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) ++ CFG80211_BSS_FTYPE_BEACON, ++#endif ++ pBssDesc->bssId, + le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), + pBssDesc->capabilityInfo, + pBssDesc->beaconInterval, ie, ie_length, diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0008-wlan_hdd_p2p-Update-call-to-cfg80211_rx_mgmt-for-dif.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0008-wlan_hdd_p2p-Update-call-to-cfg80211_rx_mgmt-for-dif.patch new file mode 100644 index 000000000..773706b5c --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0008-wlan_hdd_p2p-Update-call-to-cfg80211_rx_mgmt-for-dif.patch @@ -0,0 +1,45 @@ +From: Isaac Hermida +Date: Thu, 21 Apr 2016 13:57:03 +0200 +Subject: [PATCH] wlan_hdd_p2p: Update call to "cfg80211_rx_mgmt" for different + kernel versions + +Signed-off-by: Isaac Hermida +--- + CORE/HDD/src/wlan_hdd_p2p.c | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/CORE/HDD/src/wlan_hdd_p2p.c b/CORE/HDD/src/wlan_hdd_p2p.c +index 0c6645f077f1..476b456e165c 100644 +--- a/CORE/HDD/src/wlan_hdd_p2p.c ++++ b/CORE/HDD/src/wlan_hdd_p2p.c +@@ -826,7 +826,16 @@ void hdd_remainChanReadyHandler( hdd_adapter_t *pAdapter ) + // Check for cached action frame + if(pRemainChanCtx->action_pkt_buff.frame_length != 0) + { +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) || defined(WITH_BACKPORTS) ++ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) ++ cfg80211_rx_mgmt(pAdapter->dev->ieee80211_ptr, ++ pRemainChanCtx->action_pkt_buff.freq, 0, ++ pRemainChanCtx->action_pkt_buff.frame_ptr, ++ pRemainChanCtx->action_pkt_buff.frame_length, ++ NL80211_RXMGMT_FLAG_ANSWERED); ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) || defined(WITH_BACKPORTS) ++ ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) || defined(WITH_BACKPORTS) + cfg80211_rx_mgmt(pAdapter->dev->ieee80211_ptr, + pRemainChanCtx->action_pkt_buff.freq, 0, + pRemainChanCtx->action_pkt_buff.frame_ptr, +@@ -2340,7 +2349,11 @@ void hdd_indicateMgmtFrame( hdd_adapter_t *pAdapter, + + //Indicate Frame Over Normal Interface + hddLog( LOG1, FL("Indicate Frame over NL80211 Interface")); +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) || defined(WITH_BACKPORTS) ++ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) ++ cfg80211_rx_mgmt(pAdapter->dev->ieee80211_ptr, freq, 0, pbFrames, ++ nFrameLength, NL80211_RXMGMT_FLAG_ANSWERED); ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) || defined(WITH_BACKPORTS) + cfg80211_rx_mgmt(pAdapter->dev->ieee80211_ptr, freq, 0, pbFrames, + nFrameLength, NL80211_RXMGMT_FLAG_ANSWERED, GFP_ATOMIC); + #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0009-linux_ac-Fix-for-f_dentry.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0009-linux_ac-Fix-for-f_dentry.patch new file mode 100644 index 000000000..f3bbd3bfa --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0009-linux_ac-Fix-for-f_dentry.patch @@ -0,0 +1,43 @@ +From: Isaac Hermida +Date: Thu, 21 Apr 2016 13:58:29 +0200 +Subject: [PATCH] =?UTF-8?q?linux=5Fac:=20Fix=20for=20=E2=80=98f=5Fdentry?= + =?UTF-8?q?=E2=80=99?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +https://communities.vmware.com/thread/499483?start=0&tstart=0 + +Signed-off-by: Isaac Hermida +--- + CORE/UTILS/PKTLOG/linux_ac.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/CORE/UTILS/PKTLOG/linux_ac.c b/CORE/UTILS/PKTLOG/linux_ac.c +index b1969ad5d2ba..8d45d7365b2b 100644 +--- a/CORE/UTILS/PKTLOG/linux_ac.c ++++ b/CORE/UTILS/PKTLOG/linux_ac.c +@@ -576,7 +576,10 @@ pktlog_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos) + int rem_len; + int start_offset, end_offset; + int fold_offset, ppos_data, cur_rd_offset; +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) ++ struct ath_pktlog_info *pl_info = (struct ath_pktlog_info *) ++ PDE_DATA(file_inode(file)); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) + struct ath_pktlog_info *pl_info = (struct ath_pktlog_info *) + PDE_DATA(file->f_dentry->d_inode); + #else +@@ -817,7 +820,10 @@ static struct vm_operations_struct pktlog_vmops = { + + static int pktlog_mmap(struct file *file, struct vm_area_struct *vma) + { +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) ++ struct ath_pktlog_info *pl_info = (struct ath_pktlog_info *) ++ PDE_DATA(file_inode(file)); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) + struct ath_pktlog_info *pl_info = (struct ath_pktlog_info *) + PDE_DATA(file->f_dentry->d_inode); + #else diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0010-native_sdio-src-hif-Do-not-call-to-HIGH-SPEED-functi.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0010-native_sdio-src-hif-Do-not-call-to-HIGH-SPEED-functi.patch new file mode 100644 index 000000000..a2a7ce05e --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0010-native_sdio-src-hif-Do-not-call-to-HIGH-SPEED-functi.patch @@ -0,0 +1,70 @@ +From: Isaac Hermida +Date: Thu, 21 Apr 2016 14:00:59 +0200 +Subject: [PATCH] native_sdio/src/hif: Do not call to HIGH SPEED functions for + newer kernels + +Signed-off-by: Isaac Hermida +--- + CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c +index b3afed2a8d7c..1a1e51eff8c7 100644 +--- a/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c ++++ b/CORE/SERVICES/HIF/sdio/linux/native_sdio/src/hif.c +@@ -690,7 +690,9 @@ A_STATUS ReinitSDIO(HIF_DEVICE *device) + err = Func0_CMD52ReadByte(card, SDIO_CCCR_SPEED, &cmd52_resp); + if (err) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD52 read to CCCR speed register failed : %d \n",err)); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) + card->state &= ~MMC_STATE_HIGHSPEED; ++#endif + /* no need to break */ + } else { + err = Func0_CMD52WriteByte(card, SDIO_CCCR_SPEED, (cmd52_resp | SDIO_SPEED_EHS)); +@@ -698,14 +700,20 @@ A_STATUS ReinitSDIO(HIF_DEVICE *device) + AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("ReinitSDIO: CMD52 write to CCCR speed register failed : %d \n",err)); + break; + } ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) + mmc_card_set_highspeed(card); ++#endif + host->ios.timing = MMC_TIMING_SD_HS; + host->ops->set_ios(host, &host->ios); + } + } + + /* Set clock */ +- if (mmc_card_highspeed(card)) { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) ++ if (mmc_card_highspeed(card)) { ++#else ++ if (mmc_card_hs(card)) { ++#endif + clock = 50000000; + } else { + clock = card->cis.max_dtr; +@@ -1181,7 +1189,11 @@ TODO: MMC SDIO3.0 Setting should also be modified in ReInit() function when Powe + if (mmcclock > 0){ + clock_set = mmcclock; + } ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) + if (mmc_card_highspeed(func->card)){ ++#else ++ if (mmc_card_hs(func->card)){ ++#endif + clock = 50000000; + } else { + clock = func->card->cis.max_dtr; +@@ -2000,7 +2012,11 @@ addHifDevice(struct sdio_func *func) + hifdevice->func = func; + hifdevice->powerConfig = HIF_DEVICE_POWER_UP; + hifdevice->DeviceState = HIF_DEVICE_STATE_ON; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) + ret = sdio_set_drvdata(func, hifdevice); ++#else ++ sdio_set_drvdata(func, hifdevice); ++#endif + + EXIT("status %d", ret); + return hifdevice; diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0011-osdep_adf.h-fix-for-undefined-ath_sysctl_pktlog_size.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0011-osdep_adf.h-fix-for-undefined-ath_sysctl_pktlog_size.patch new file mode 100644 index 000000000..53fc1fb07 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0011-osdep_adf.h-fix-for-undefined-ath_sysctl_pktlog_size.patch @@ -0,0 +1,24 @@ +From: Isaac Hermida +Date: Thu, 21 Apr 2016 14:32:57 +0200 +Subject: [PATCH] osdep_adf.h: fix for undefined ath_sysctl_pktlog_size + +Signed-off-by: Isaac Hermida +--- + CORE/SERVICES/COMMON/osdep_adf.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/CORE/SERVICES/COMMON/osdep_adf.h b/CORE/SERVICES/COMMON/osdep_adf.h +index 708b6f89fa03..48ca78618840 100644 +--- a/CORE/SERVICES/COMMON/osdep_adf.h ++++ b/CORE/SERVICES/COMMON/osdep_adf.h +@@ -168,6 +168,10 @@ typedef unsigned long TQUEUE_ARG; + #define ATH_SYSCTL_PROC_DOSTRING(ctl, write, filp, buffer, lenp, ppos) \ + proc_dostring(ctl, write, filp, buffer, lenp, ppos) + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0) ++typedef struct ctl_table ctl_table; ++#endif ++ + /* + * Byte Order stuff + */ diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0012-Kbuild-Add-compilation-flag-based-on-kernel-support.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0012-Kbuild-Add-compilation-flag-based-on-kernel-support.patch new file mode 100644 index 000000000..de5ce9002 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0012-Kbuild-Add-compilation-flag-based-on-kernel-support.patch @@ -0,0 +1,37 @@ +From: Isaac Hermida +Date: Thu, 19 May 2016 12:28:39 +0200 +Subject: [PATCH] Kbuild: Add compilation flag based on kernel support + +The option WLAN_NL80211_TESTMODE was inconditionally added to the compilation +but it does required the specific kernel support. + +https://jira.digi.com/browse/DEL-2567 + +Signed-off-by: Isaac Hermida +--- + Kbuild | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/Kbuild b/Kbuild +index b248eee28bf0..339262874c94 100644 +--- a/Kbuild ++++ b/Kbuild +@@ -908,7 +908,6 @@ CDEFINES := -DANI_LITTLE_BYTE_ENDIAN \ + -DWLAN_WAKEUP_EVENTS \ + -DFEATURE_WLAN_RA_FILTERING\ + -DWLAN_KD_READY_NOTIFIER \ +- -DWLAN_NL80211_TESTMODE \ + -DFEATURE_WLAN_BATCH_SCAN \ + -DFEATURE_WLAN_LPHB \ + -DFEATURE_WLAN_PAL_TIMER_DISABLE \ +@@ -948,6 +947,10 @@ CDEFINES += -DDFS_MASTER_OFFLOAD_IND_SUPPORT + endif + endif + ++ifeq ($(CONFIG_NL80211_TESTMODE), y) ++CDEFINES += -DWLAN_NL80211_TESTMODE ++endif ++ + ifeq ($(CONFIG_ARCH_MSM), y) + CDEFINES += -DMSM_PLATFORM + endif 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 new file mode 100644 index 000000000..c8498dda3 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0013-Kbuild-do-not-create-an-auxiliar-p2p-on-init.patch @@ -0,0 +1,22 @@ +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/0014-Kbuild-do-not-compile-the-DEBUG-version-inconditiona.patch b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0014-Kbuild-do-not-compile-the-DEBUG-version-inconditiona.patch new file mode 100644 index 000000000..98eb059b5 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0014-Kbuild-do-not-compile-the-DEBUG-version-inconditiona.patch @@ -0,0 +1,25 @@ +From: Isaac Hermida +Date: Tue, 5 Jul 2016 17:57:07 +0200 +Subject: [PATCH] Kbuild: do not compile the DEBUG version inconditionally + +Do not compile the DEBUG version inconditionally by adding the posibility to +define the DEBUG version as a flag parameter. + +Signed-off-by: Isaac Hermida +--- + Kbuild | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Kbuild b/Kbuild +index b14417a558cd..a0e203ce5493 100644 +--- a/Kbuild ++++ b/Kbuild +@@ -121,7 +121,7 @@ endif + # Feature flags which are not (currently) configurable via Kconfig + + #Whether to build debug version +-BUILD_DEBUG_VERSION := 1 ++BUILD_DEBUG_VERSION ?= 1 + + #Enable this flag to build driver in diag version + BUILD_DIAG_VERSION := 1 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/0015-Kbuild-Group-most-of-the-relevant-DEBUG-options.patch new file mode 100644 index 000000000..0c9c91943 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/0015-Kbuild-Group-most-of-the-relevant-DEBUG-options.patch @@ -0,0 +1,48 @@ +From: Isaac Hermida +Date: Tue, 5 Jul 2016 17:52:44 +0200 +Subject: [PATCH] Kbuild: Group most of the relevant DEBUG options + +The value of BUILD_DEBUG_VERSION will be used to compile the driver with most +of the relevant DEBUG flags. Use that variable to compile the debug version. + +Signed-off-by: Isaac Hermida +--- + Kbuild | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/Kbuild b/Kbuild +index a0e203ce5493..e5f2e8ebd4ad 100644 +--- a/Kbuild ++++ b/Kbuild +@@ -896,9 +896,7 @@ CDEFINES := -DANI_LITTLE_BYTE_ENDIAN \ + -DWLAN_FEATURE_PACKET_FILTERING \ + -DWLAN_FEATURE_VOWIFI \ + -DWLAN_FEATURE_11AC \ +- -DWLAN_FEATURE_P2P_DEBUG \ + -DWLAN_ENABLE_AGEIE_ON_SCAN_RESULTS \ +- -DWLANTL_DEBUG\ + -DWLAN_NS_OFFLOAD \ + -DWLAN_ACTIVEMODE_OFFLOAD_FEATURE \ + -DWLAN_FEATURE_HOLD_RX_WAKELOCK \ +@@ -936,8 +934,7 @@ CDEFINES += -DCONFIG_HL_SUPPORT \ + -DSDIO_3_0 \ + -DHIF_SDIO \ + -DCONFIG_ATH_PROCFS_DIAG_SUPPORT \ +- -DFEATURE_HL_GROUP_CREDIT_FLOW_CONTROL \ +- -DDEBUG_HL_LOGGING ++ -DFEATURE_HL_GROUP_CREDIT_FLOW_CONTROL + endif + + ifeq ($(CONFIG_QCA_WIFI_SDIO), 1) +@@ -974,8 +971,11 @@ CDEFINES += -DTRACE_RECORD \ + + ifeq ($(BUILD_DEBUG_VERSION),1) + CDEFINES += -DWLAN_DEBUG \ ++ -DWLAN_FEATURE_P2P_DEBUG \ ++ -DWLANTL_DEBUG\ + -DPE_DEBUG_LOGW \ + -DPE_DEBUG_LOGE \ ++ -DDEBUG_HL_LOGGING \ + -DDEBUG + endif + diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/modprobe-qualcomm.conf b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/modprobe-qualcomm.conf new file mode 100644 index 000000000..313d88b5c --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/modprobe-qualcomm.conf @@ -0,0 +1,5 @@ +install wlan true +# Load the wlan module with values for SDIO3.0. +options wlan asyncintdelay=0x2 writecccr1=0xf2 writecccr1value=0xf \ + writecccr2=0xf1 writecccr2value=0xa8 writecccr3=0xf0 \ + writecccr3value=0xa1 writecccr4=0x15 writecccr4value=0x30 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 new file mode 100644 index 000000000..922b0ce17 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm-pre-up @@ -0,0 +1,102 @@ +#!/bin/sh +#=============================================================================== +# +# qualcomm-pre-up +# +# Copyright (C) 2016 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: Load Qualcomm' wireless driver +# +#=============================================================================== + +[ "${IFACE}" != "wlan0" ] && exit 0 + +FIRMWARE_DIR="/lib/firmware" +MACFILE="${FIRMWARE_DIR}/wlan/wlan_mac.bin" +TMP_MACFILE="$(mktemp -t wlan_mac.XXXXXX)" + +# Read the MACs from DeviceTree. We can have up to four wireless interfaces +# The only required one is wlan0 that is mapped with device tree mac address +# without suffix. +for index in $(seq 0 3); do + DT_WLANx_MAC="/proc/device-tree/wireless/mac-address" + if [ "${index}" = "0" ]; then + # Set a default MAC for wlan0 + MAC_ADDR="00:04:F3:FF:FF:FB" + else + # Add the interface suffix for the device tree node + DT_WLANx_MAC=${DT_WLANx_MAC}${index} + MAC_ADDR="" + fi + + if [ -f "${DT_WLANx_MAC}" ]; then + MAC_ADDR="$(hexdump -ve '1/1 "%02X" ":"' ${DT_WLANx_MAC} | sed 's/:$//g')" + fi + + # Dump the MAC address in a file with the expected firmware format. + # example: Intf0MacAddress=0004f3fffffb + echo "Intf${index}MacAddress=${MAC_ADDR}" | sed s/://g >> ${TMP_MACFILE} +done + +# Override the MAC firmware file only if the MAC file has changed. +if ! cmp -s ${TMP_MACFILE} ${MACFILE}; then + cp ${TMP_MACFILE} ${MACFILE} +fi +rm -f ${TMP_MACFILE} + +OTP_REGION_CODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null)" +DTB_REGION_CODE="$(cat /proc/device-tree/wireless/regulatory-domain 2>/dev/null)" +US_CODE="0x0" +WW_CODE="0x1" +JP_CODE="0x2" +# Check if the DTB_REGION_CODE is in the list of valid codes, +# if not use the OTP programmed value. +case "${DTB_REGION_CODE}" in + ${US_CODE}|${WW_CODE}|${JP_CODE}) + REGULATORY_DOMAIN=${DTB_REGION_CODE};; + *) + logger -t qca6564 "[ERROR] Invalid region code in device tree, using OTP value" + REGULATORY_DOMAIN=${OTP_REGION_CODE};; +esac + +BDATA_LINK="${FIRMWARE_DIR}/bdwlan30.bin" +# Create a symbolic link to the FW file for the specific country region. +BDATA_SOURCE="${FIRMWARE_DIR}/bdwlan30_US.bin" +case "${REGULATORY_DOMAIN}" in + ${US_CODE}) + logger -t qca6564 "Setting US wireless region";; + ${WW_CODE}|${JP_CODE}) + logger -t qca6564 "Setting WW (world wide) wireless region" + BDATA_SOURCE="${FIRMWARE_DIR}/bdwlan30_World.bin";; + "") + logger -t qca6564 "[WARN] region code not found, using US";; + *) + logger -t qca6564 "[WARN] Invalid region code, using US";; +esac + +# We don't want to rewrite NAND every time we boot so only +# change the link if it is wrong. +if [ ! -e "${BDATA_LINK}" ] || ! cmp -s "${BDATA_LINK}" "${BDATA_SOURCE}"; then + ln -sf "${BDATA_SOURCE}" "${BDATA_LINK}" +fi + +# Check the version of modprobe installed to compound the arguments. +if readlink -f $(which modprobe) | grep -qs kmod; then + MODPROBE_ARGS="-i" +fi +# Load the wireless module with the params defined in modprobe.d/qualcomm.conf +modprobe ${MODPROBE_ARGS} wlan + +# Validate that firmware was loaded by checking if the interface is present. +if [ -d "/sys/class/net/${IFACE}" ]; then + echo "Loading qca6564 module: [OK]" +else + echo "Loading qca6564 module: [FAILED]" + exit 1 +fi diff --git a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv/0001-mxc-gpu-use-recommended-values-for-minimum-GPU-frequ.patch b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv/0001-mxc-gpu-use-recommended-values-for-minimum-GPU-frequ.patch index 99dee10a2..72a2f6582 100644 --- a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv/0001-mxc-gpu-use-recommended-values-for-minimum-GPU-frequ.patch +++ b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv/0001-mxc-gpu-use-recommended-values-for-minimum-GPU-frequ.patch @@ -56,10 +56,10 @@ index 4a29f0e776e2..69a2d483b2cd 100644 if (!ret) diff --git a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6q14.c b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6q14.c -index a12579d44723..c2a54b7d072d 100644 +index a5473bb926a2..d08479fa43b7 100644 --- a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6q14.c +++ b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6q14.c -@@ -103,7 +103,7 @@ extern int unregister_thermal_notifier(struct notifier_block *nb); +@@ -108,7 +108,7 @@ extern int unregister_thermal_notifier(struct notifier_block *nb); #define UNREG_THERMAL_NOTIFIER(a) unregister_thermal_notifier(a); #endif diff --git a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv/0002-Use-busfreq-imx6.h-up-to-3.15-kernel.patch b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv/0002-Use-busfreq-imx6.h-up-to-3.15-kernel.patch index 19fb57e55..3b7ad712d 100644 --- a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv/0002-Use-busfreq-imx6.h-up-to-3.15-kernel.patch +++ b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-imx-gpu-viv/0002-Use-busfreq-imx6.h-up-to-3.15-kernel.patch @@ -1,4 +1,3 @@ -From 07ca37302306e764adaeaa8f2a8e4ef1b40cd395 Mon Sep 17 00:00:00 2001 From: Hector Palacios Date: Tue, 1 Dec 2015 11:36:24 +0100 Subject: [PATCH] Use busfreq-imx6.h up to 3.15 kernel @@ -13,7 +12,7 @@ Signed-off-by: Hector Palacios 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6q14.c b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6q14.c -index a12579d44723..8f7bb281aa74 100644 +index d08479fa43b7..4a9b72ce2297 100644 --- a/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6q14.c +++ b/kernel-module-imx-gpu-viv-src/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6q14.c @@ -74,7 +74,7 @@ diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey-3.14/ccimx6sbc/defconfig b/meta-digi-arm/recipes-kernel/linux/linux-dey-3.14/ccimx6sbc/defconfig index 33fe2f75d..97a9c5f61 100644 --- a/meta-digi-arm/recipes-kernel/linux/linux-dey-3.14/ccimx6sbc/defconfig +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey-3.14/ccimx6sbc/defconfig @@ -22,6 +22,9 @@ CONFIG_SOC_IMX53=y CONFIG_SOC_IMX6Q=y CONFIG_SOC_IMX6SL=y CONFIG_SOC_IMX6SX=y +CONFIG_SOC_IMX6UL=y +CONFIG_SOC_IMX7D=y +CONFIG_SOC_VF610=y CONFIG_PCI=y CONFIG_PCI_MSI=y CONFIG_PCI_IMX6=y @@ -40,6 +43,7 @@ CONFIG_CPU_FREQ_GOV_USERSPACE=y CONFIG_CPU_FREQ_GOV_ONDEMAND=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 @@ -73,6 +77,7 @@ CONFIG_BT_HIDP=y CONFIG_BT_HCIUART=y CONFIG_BT_HCIUART_ATH3K=y CONFIG_CFG80211=y +CONFIG_CFG80211_CERTIFICATION_ONUS=y CONFIG_CFG80211_WEXT=y CONFIG_RFKILL=y CONFIG_RFKILL_INPUT=y @@ -81,7 +86,8 @@ CONFIG_DEVTMPFS_MOUNT=y # CONFIG_STANDALONE is not set # CONFIG_FW_LOADER_USER_HELPER is not set CONFIG_DMA_CMA=y -CONFIG_CMA_SIZE_MBYTES=320 +CONFIG_CMA_SIZE_PERCENTAGE=40 +CONFIG_CMA_SIZE_SEL_PERCENTAGE=y CONFIG_IMX_WEIM=y CONFIG_CONNECTOR=y CONFIG_PROC_DEVICETREE=y @@ -101,6 +107,9 @@ CONFIG_ATA=y CONFIG_SATA_AHCI_PLATFORM=y CONFIG_AHCI_IMX=y CONFIG_PATA_IMX=y +CONFIG_MD=y +CONFIG_BLK_DEV_DM=y +CONFIG_DM_CRYPT=y CONFIG_NETDEVICES=y # CONFIG_NET_CADENCE is not set # CONFIG_NET_VENDOR_BROADCOM is not set @@ -129,6 +138,8 @@ CONFIG_USB_SIERRA_NET=y CONFIG_ATH_CARDS=y CONFIG_ATH6KL=m CONFIG_ATH6KL_SDIO=m +CONFIG_ATH6KL_DEBUG=y +CONFIG_ATH6KL_REGDOMAIN=y CONFIG_INPUT_EVDEV=y CONFIG_KEYBOARD_GPIO=y CONFIG_KEYBOARD_IMX=y @@ -147,7 +158,6 @@ CONFIG_SERIAL_IMX_CONSOLE=y CONFIG_SERIAL_FSL_LPUART=y CONFIG_SERIAL_FSL_LPUART_CONSOLE=y CONFIG_FSL_OTP=y -CONFIG_HW_RANDOM=y # CONFIG_I2C_COMPAT is not set CONFIG_I2C_CHARDEV=y # CONFIG_I2C_HELPER_AUTO is not set @@ -298,8 +308,13 @@ CONFIG_DEBUG_FS=y # CONFIG_FTRACE is not set # CONFIG_ARM_UNWIND is not set CONFIG_SECURITYFS=y +# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set +CONFIG_CRYPTO_TEST=m +CONFIG_CRYPTO_XTS=y CONFIG_CRYPTO_DEFLATE=y CONFIG_CRYPTO_LZO=y # CONFIG_CRYPTO_ANSI_CPRNG is not set -# CONFIG_CRYPTO_HW is not set +CONFIG_CRYPTO_USER_API_HASH=y +CONFIG_CRYPTO_USER_API_SKCIPHER=y +CONFIG_CRYPTO_DEV_FSL_CAAM=y CONFIG_FONTS=y 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 new file mode 100644 index 000000000..78a7376f7 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey-4.1/ccimx6ul/defconfig @@ -0,0 +1,392 @@ +CONFIG_KERNEL_LZO=y +CONFIG_SYSVIPC=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=18 +CONFIG_CGROUPS=y +CONFIG_RELAY=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_EXPERT=y +CONFIG_KALLSYMS_ALL=y +CONFIG_PERF_EVENTS=y +# CONFIG_SLUB_DEBUG is not set +# CONFIG_COMPAT_BRK is not set +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +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_SMP=y +CONFIG_HAVE_ARM_ARCH_TIMER=y +CONFIG_VMSPLIT_2G=y +CONFIG_PREEMPT=y +CONFIG_AEABI=y +CONFIG_HIGHMEM=y +CONFIG_CMA=y +CONFIG_CMDLINE="noinitrd console=ttymxc0,115200" +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +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 +CONFIG_BINFMT_MISC=m +CONFIG_PM_DEBUG=y +CONFIG_PM_TEST_SUSPEND=y +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_INET=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_LRO is not set +CONFIG_IPV6=y +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 +CONFIG_BT_BNEP=y +CONFIG_BT_BNEP_MC_FILTER=y +CONFIG_BT_BNEP_PROTO_FILTER=y +CONFIG_BT_HIDP=y +CONFIG_BT_HCIUART=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_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +# CONFIG_STANDALONE is not set +CONFIG_DMA_CMA=y +CONFIG_CMA_SIZE_MBYTES=0 +CONFIG_IMX_WEIM=y +CONFIG_CONNECTOR=y +CONFIG_MTD=y +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_BLOCK=y +CONFIG_MTD_CFI=y +CONFIG_MTD_JEDECPROBE=y +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 +CONFIG_BLK_DEV_RAM_SIZE=65536 +CONFIG_EEPROM_AT24=y +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_VENDOR_BROADCOM is not set +CONFIG_CS89x0=y +CONFIG_CS89x0_PLATFORM=y +# CONFIG_NET_VENDOR_FARADAY is not set +# CONFIG_NET_VENDOR_HISILICON is not set +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_SEEQ is not set +CONFIG_SMC91X=y +CONFIG_SMC911X=y +CONFIG_SMSC911X=y +# CONFIG_NET_VENDOR_STMICRO is not set +CONFIG_SMSC_PHY=y +CONFIG_USB_PEGASUS=m +CONFIG_USB_RTL8150=m +CONFIG_USB_RTL8152=m +CONFIG_USB_USBNET=m +CONFIG_USB_NET_CDC_EEM=m +CONFIG_ATH_CARDS=m +CONFIG_ATH_DEBUG=y +CONFIG_HOSTAP=y +CONFIG_HOSTAP_FIRMWARE=y +CONFIG_HOSTAP_FIRMWARE_NVRAM=y +# CONFIG_RTL_CARDS is not set +# 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_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_ADS7846=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_ALGOPCF=m +CONFIG_I2C_ALGOPCA=m +CONFIG_I2C_IMX=y +CONFIG_SPI=y +CONFIG_SPI_GPIO=y +CONFIG_SPI_IMX=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 +# CONFIG_MXC_MMA8451 is not set +CONFIG_THERMAL=y +CONFIG_CPU_THERMAL=y +CONFIG_IMX_THERMAL=y +CONFIG_DEVICE_THERMAL=y +CONFIG_WATCHDOG=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 +CONFIG_REGULATOR_GPIO=y +CONFIG_REGULATOR_PFUZE100=y +CONFIG_MEDIA_SUPPORT=y +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_VIDEO_MXC_PXP_V4L2=y +CONFIG_VIDEO_MXC_CSI_CAMERA=y +CONFIG_SOC_CAMERA=y +CONFIG_V4L_MEM2MEM_DRIVERS=y +CONFIG_VIDEO_CODA=y +CONFIG_SOC_CAMERA_OV2640=y +CONFIG_DRM=y +CONFIG_DRM_VIVANTE=y +CONFIG_FB=y +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_LCD_CLASS_DEVICE=y +CONFIG_LCD_L4F00242T03=y +CONFIG_LCD_PLATFORM=y +CONFIG_BACKLIGHT_PWM=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +CONFIG_LOGO=y +CONFIG_SOUND=y +CONFIG_SND=y +CONFIG_SND_USB_AUDIO=m +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_SPDIF=y +CONFIG_USB=y +CONFIG_USB_OTG_WHITELIST=y +CONFIG_USB_OTG_FSM=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_MXC=y +CONFIG_USB_HCD_TEST_MODE=y +CONFIG_USB_ACM=m +CONFIG_USB_STORAGE=y +CONFIG_USB_CHIPIDEA=y +CONFIG_USB_CHIPIDEA_UDC=y +CONFIG_USB_CHIPIDEA_HOST=y +CONFIG_USB_SERIAL=m +CONFIG_USB_SERIAL_GENERIC=y +CONFIG_USB_SERIAL_FTDI_SIO=m +CONFIG_USB_SERIAL_OPTION=m +CONFIG_USB_EHSET_TEST_FIXTURE=y +CONFIG_NOP_USB_XCEIV=y +CONFIG_USB_MXS_PHY=y +CONFIG_USB_GADGET=y +CONFIG_USB_CONFIGFS=m +CONFIG_USB_CONFIGFS_SERIAL=y +CONFIG_USB_CONFIGFS_ACM=y +CONFIG_USB_CONFIGFS_OBEX=y +CONFIG_USB_CONFIGFS_NCM=y +CONFIG_USB_CONFIGFS_ECM=y +CONFIG_USB_CONFIGFS_ECM_SUBSET=y +CONFIG_USB_CONFIGFS_RNDIS=y +CONFIG_USB_CONFIGFS_EEM=y +CONFIG_USB_CONFIGFS_MASS_STORAGE=y +CONFIG_USB_CONFIGFS_F_LB_SS=y +CONFIG_USB_CONFIGFS_F_FS=y +CONFIG_USB_ZERO=m +CONFIG_USB_ETH=m +CONFIG_USB_G_NCM=m +CONFIG_USB_GADGETFS=m +CONFIG_USB_MASS_STORAGE=m +CONFIG_USB_G_SERIAL=m +CONFIG_MMC=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_SDHCI_ESDHC_IMX=y +CONFIG_MXC_IPU=y +CONFIG_MXC_SIM=y +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_GPIO=y +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_BACKLIGHT=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_INTF_DEV_UIE_EMUL=y +CONFIG_RTC_DRV_MCA_CC6UL=y +CONFIG_RTC_DRV_MXC=y +CONFIG_RTC_DRV_SNVS=y +CONFIG_DMADEVICES=y +CONFIG_MXC_PXP_V2=y +CONFIG_MXC_PXP_V3=y +CONFIG_IMX_SDMA=y +CONFIG_MXS_DMA=y +CONFIG_DMATEST=m +CONFIG_STAGING=y +CONFIG_STAGING_MEDIA=y +# CONFIG_IOMMU_SUPPORT is not set +CONFIG_IIO=y +CONFIG_MCA_CC6UL_ADC=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_ISO9660_FS=m +CONFIG_JOLIET=y +CONFIG_ZISOFS=y +CONFIG_UDF_FS=m +CONFIG_MSDOS_FS=m +CONFIG_VFAT_FS=y +CONFIG_TMPFS=y +CONFIG_JFFS2_FS=y +CONFIG_UBIFS_FS=y +CONFIG_NFS_FS=y +CONFIG_NFS_V3_ACL=y +CONFIG_NFS_V4=y +CONFIG_ROOT_NFS=y +CONFIG_NLS_DEFAULT="cp437" +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NLS_ISO8859_15=m +CONFIG_NLS_UTF8=y +CONFIG_DEBUG_FS=y +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_TEST=m +CONFIG_CRYPTO_CBC=y +CONFIG_CRYPTO_CTS=y +CONFIG_CRYPTO_LRW=y +CONFIG_CRYPTO_XTS=y +CONFIG_CRYPTO_MD4=y +CONFIG_CRYPTO_MD5=y +CONFIG_CRYPTO_RMD128=y +CONFIG_CRYPTO_RMD160=y +CONFIG_CRYPTO_RMD256=y +CONFIG_CRYPTO_RMD320=y +CONFIG_CRYPTO_SHA1=y +CONFIG_CRYPTO_SHA512=y +CONFIG_CRYPTO_TGR192=y +CONFIG_CRYPTO_WP512=y +CONFIG_CRYPTO_BLOWFISH=y +CONFIG_CRYPTO_CAMELLIA=y +CONFIG_CRYPTO_DES=y +CONFIG_CRYPTO_TWOFISH=y +# CONFIG_CRYPTO_ANSI_CPRNG is not set +CONFIG_CRYPTO_DEV_FSL_CAAM=y +CONFIG_CRYPTO_DEV_FSL_CAAM_SM=y +CONFIG_CRYPTO_DEV_FSL_CAAM_SM_TEST=y +CONFIG_CRYPTO_DEV_FSL_CAAM_SECVIO=y +CONFIG_CRC_CCITT=m +CONFIG_CRC_T10DIF=y +CONFIG_CRC7=m +CONFIG_LIBCRC32C=m +CONFIG_FONTS=y +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +CONFIG_VIRTUALIZATION=y diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey.inc b/meta-digi-arm/recipes-kernel/linux/linux-dey.inc index f663f0d8e..19c71f113 100644 --- a/meta-digi-arm/recipes-kernel/linux/linux-dey.inc +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey.inc @@ -5,6 +5,7 @@ LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7" DEPENDS += "lzop-native bc-native" +DEPENDS += "${@base_conditional('TRUSTFENCE_SIGN', '1', 'trustfence-cst-native', '', d)}" inherit kernel fsl-kernel-localversion @@ -24,7 +25,22 @@ S = "${WORKDIR}/git" # machine, with different entry points KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}" +# In order to sign and encrypt the uImage, we need to know the address +# in which U-Boot loads the uImage. This is CONFIG_LOADADDR in U-Boot +# configuration file. +UBOOT_CONFIG_LOADADDR = "" +UBOOT_CONFIG_LOADADDR_ccimx6 = "0x12000000" +UBOOT_CONFIG_LOADADDR_ccimx6ul = "0x80800000" + do_deploy_append() { + if [ "${TRUSTFENCE_SIGN}" = "1" ]; then + export CONFIG_SIGN_KEYS_PATH="${TRUSTFENCE_SIGN_KEYS_PATH}" + export CONFIG_UIMAGE_LOADADDR="${UBOOT_CONFIG_LOADADDR}" + [ -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}" + "${THISDIR}/../../scripts/trustfence-sign-uimage.sh" "${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" + fi (cd ${DEPLOYDIR} && ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${KERNEL_IMAGE_SYMLINK_NAME}) } diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey_3.14.bb b/meta-digi-arm/recipes-kernel/linux/linux-dey_3.14.bb index 023241b1b..7f2aa8fc5 100644 --- a/meta-digi-arm/recipes-kernel/linux/linux-dey_3.14.bb +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey_3.14.bb @@ -5,7 +5,7 @@ require recipes-kernel/linux/linux-dtb.inc inherit fsl-vivante-kernel-driver-handler -SRCBRANCH = "v3.14/dey-2.0/maint" +SRCBRANCH = "v3.14/master" SRCREV = "${AUTOREV}" -COMPATIBLE_MACHINE = "(ccimx6)" +COMPATIBLE_MACHINE = "(ccimx6$)" diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey_4.1.bb b/meta-digi-arm/recipes-kernel/linux/linux-dey_4.1.bb new file mode 100644 index 000000000..96399f669 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey_4.1.bb @@ -0,0 +1,9 @@ +# Copyright (C) 2016 Digi International + +require recipes-kernel/linux/linux-dey.inc +require recipes-kernel/linux/linux-dtb.inc + +SRCBRANCH = "v4.1.15/master" +SRCREV = "${AUTOREV}" + +COMPATIBLE_MACHINE = "(ccimx6ul)" diff --git a/meta-digi-arm/scripts/templates/encrypt_uimage b/meta-digi-arm/scripts/templates/encrypt_uimage new file mode 100644 index 000000000..3c8e682f4 --- /dev/null +++ b/meta-digi-arm/scripts/templates/encrypt_uimage @@ -0,0 +1,48 @@ +# The syntax for this file is documented in the HAB Code-Signing Tool +# User's Guide which is included in the CST package distributed by NXP +[Header] + Version = 4.1 + Hash Algorithm = sha256 + Engine Configuration = 0 + Certificate Format = X509 + Signature Format = CMS + Engine = CAAM + +[Install SRK] + File = "%srk_table%" + Source index = %key_index% + +[Install CSFK] + File = "%cert_csf%" + +[Authenticate CSF] + +[Install Key] + Verification index = 0 + Target index = 2 + File = "%cert_img%" + +[Authenticate Data] + Verification index = 2 + Blocks = %ivt_ram_start% %ivt_uimage_start% %ivt_size% "%uimage_path%" + +[Authenticate Data] + Verification index = 2 + Blocks = %entrypoint_ram_start% %entrypoint_uimage_offset% %entrypoint_size% "%uimage_path%" + +[Authenticate Data] + Verification index = 2 + Blocks = %header_ram_start% %header_uimage_offset% %header_size% "%uimage_path%" + +[Install Secret Key] + Verification index = 0 + Target index = 0 + Key = "%dek_path%" + Key Length = %dek_len% + Blob address = %dek_offset% + +[Decrypt Data] + Verification index = 0 + Mac Bytes = 16 + Blocks = %r1_ram_start% %r1_uimage_offset% %r1_size% "%uimage_path%", \ + %r2_ram_start% %r2_uimage_offset% %r2_size% "%uimage_path%" diff --git a/meta-digi-arm/scripts/templates/sign_uimage b/meta-digi-arm/scripts/templates/sign_uimage new file mode 100644 index 000000000..c30420a9f --- /dev/null +++ b/meta-digi-arm/scripts/templates/sign_uimage @@ -0,0 +1,31 @@ +# The syntax for this file is documented in the HAB Code Signing Tool +# User's Guid which is included in the CST package distributed by NXP +[Header] + Version = 4.0 + Hash Algorithm = sha256 + Engine Configuration = 0 + Certificate Format = X509 + Signature Format = CMS + +[Install SRK] + File = "%srk_table%" + Source index = %key_index% + + +[Install CSFK] + File = "%cert_csf%" + +[Authenticate CSF] + +[Unlock] + Engine = CAAM + Features = RNG + +[Install Key] + Verification index = 0 + Target index = 2 + File = "%cert_img%" + +[Authenticate Data] + Verification index = 2 + Blocks = %ram_start% %image_offset% %auth_len% "%uimage_path%" diff --git a/meta-digi-arm/scripts/trustfence-sign-uimage.sh b/meta-digi-arm/scripts/trustfence-sign-uimage.sh new file mode 100755 index 000000000..12beb31b8 --- /dev/null +++ b/meta-digi-arm/scripts/trustfence-sign-uimage.sh @@ -0,0 +1,195 @@ +#!/bin/bash +#=============================================================================== +# +# trustfence_sign_uimage.sh +# +# Copyright (C) 2016 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: +# Script for building signed and encrypted kernel uImages using NXP CST. +# +# The following environment variables define the script behaviour: +# CONFIG_SIGN_KEYS_PATH: (mandatory) path to the CST folder by NXP with keys generated. +# CONFIG_UIMAGE_LOADADDR: (mandatory) memory address in which U-Boot loads the uImage +# CONFIG_KEY_INDEX: (optional) key index to use for signing. Default is 0. +# CONFIG_DEK_PATH: (optional) Path to keyfile. Define it to generate +# encrypted images +# +#=============================================================================== + +# Negative offset with respect to CONFIG_UIMAGE_LOADADDR in which U-Boot +# copies the DEK blob. +DEK_BLOB_OFFSET="0x100" +CONFIG_CSF_SIZE="0x4000" + +UIMAGE_PATH="$(readlink -e ${1})" +TARGET="$(readlink -m ${2})" +SCRIPT_BASEDIR="$(cd $(dirname ${0}) && pwd)" + +# Check arguments +if [ -z "${CONFIG_SIGN_KEYS_PATH}" ]; then + echo "Undefined CONFIG_SIGN_KEYS_PATH"; + exit 1 +fi +[ -d "${CONFIG_SIGN_KEYS_PATH}" ] || mkdir "${CONFIG_SIGN_KEYS_PATH}" + +if [ -n "${CONFIG_DEK_PATH}" ]; then + if [ ! -f "${CONFIG_DEK_PATH}" ]; then + echo "DEK not found. Generating random 256 bit DEK." + [ -d $(dirname ${CONFIG_DEK_PATH}) ] || mkdir -p $(dirname ${CONFIG_DEK_PATH}) + dd if=/dev/urandom of="${CONFIG_DEK_PATH}" bs=32 count=1 + fi + dek_size="$((8 * $(stat -L -c %s ${CONFIG_DEK_PATH})))" + if [ "${dek_size}" != "128" ] && [ "${dek_size}" != "192" ] && [ "${dek_size}" != "256" ]; then + echo "Invalid DEK size: ${dek_size} bits. Valid sizes are 128, 192 and 256 bits" + exit 1 + fi + ENCRYPT="true" +fi +if [ -z "${CONFIG_UIMAGE_LOADADDR}" ]; then + echo "Undefined CONFIG_UIMAGE_LOADADDR" + exit 1 +fi + +# Default values +[ -z "${CONFIG_KEY_INDEX}" ] && CONFIG_KEY_INDEX="0" +CONFIG_KEY_INDEX_1="$((CONFIG_KEY_INDEX + 1))" +[ -z "${CONFIG_DEK_SIZE}" ] && CONFIG_DEK_SIZE="128" + +SRK_KEYS="$(echo ${CONFIG_SIGN_KEYS_PATH}/crts/SRK*crt.pem | sed s/\ /\,/g)" +CERT_CSF="$(echo ${CONFIG_SIGN_KEYS_PATH}/crts/CSF${CONFIG_KEY_INDEX_1}*crt.pem)" +CERT_IMG="$(echo ${CONFIG_SIGN_KEYS_PATH}/crts/IMG${CONFIG_KEY_INDEX_1}*crt.pem)" + +n_commas="$(echo ${SRK_KEYS} | grep -o "," | wc -l)" + +if [ "${n_commas}" -eq 3 ] && [ -f "${CERT_CSF}" ] && [ -f "${CERT_IMG}" ]; then + # PKI tree already exists. + echo "Using existing PKI tree" +elif [ "${n_commas}" -eq 0 ] || [ ! -f "${CERT_CSF}" ] || [ ! -f "${CERT_IMG}" ]; then + # Generate PKI + trustfence-gen-pki.sh "${CONFIG_SIGN_KEYS_PATH}" + + SRK_KEYS="$(echo ${CONFIG_SIGN_KEYS_PATH}/crts/SRK*crt.pem | sed s/\ /\,/g)" + CERT_CSF="$(echo ${CONFIG_SIGN_KEYS_PATH}/crts/CSF${CONFIG_KEY_INDEX_1}*crt.pem)" + CERT_IMG="$(echo ${CONFIG_SIGN_KEYS_PATH}/crts/IMG${CONFIG_KEY_INDEX_1}*crt.pem)" +else + echo "Inconsistent CST folder." + exit 1 +fi + +SRK_TABLE="$(pwd)/SRK_table.bin" + +# Other constants +GAP_FILLER="0x00" + +# Compute dek blob size in bytes: +# header (8) + 256-bit AES key (32) + MAC (16) + custom key size in bytes +dek_blob_size="$((8 + 32 + 16 + CONFIG_DEK_SIZE/8))" +dek_blob_offset="$((CONFIG_UIMAGE_LOADADDR - DEK_BLOB_OFFSET))" + +# Compute the layout: sizes and offsets. +uimage_size="$(stat -L -c %s ${UIMAGE_PATH})" +uimage_offset="0x0" +pad_len="$((uimage_size - uimage_size % 0x1000 + 0x1000))" +auth_len="$((pad_len + 0x20))" +sig_len="$((auth_len + CONFIG_CSF_SIZE))" + +ivt_uimage_start="$((auth_len - 0x20))" +ivt_ram_start="$((CONFIG_UIMAGE_LOADADDR + ivt_uimage_start))" +ivt_size="0x20" +csf_ram_start="$((ivt_ram_start + ivt_size))" +entrypoint_uimage_offset="0x1000" +entrypoint_ram_start="$((CONFIG_UIMAGE_LOADADDR + entrypoint_uimage_offset))" +entrypoint_size="0x20" +header_uimage_offset="0x0" +header_ram_start="${CONFIG_UIMAGE_LOADADDR}" +header_size="0x40" + +r1_uimage_offset="${header_size}" +r1_ram_start="$((CONFIG_UIMAGE_LOADADDR + r1_uimage_offset))" +r1_size="$((entrypoint_uimage_offset - header_size ))" +r2_uimage_offset="$((entrypoint_uimage_offset + entrypoint_size))" +r2_ram_start="$((CONFIG_UIMAGE_LOADADDR + r2_uimage_offset))" +r2_size="$((ivt_uimage_start - (entrypoint_uimage_offset + entrypoint_size)))" + +# Generate actual CSF descriptor file from template +if [ "${ENCRYPT}" = "true" ]; then + sed -e "s,%ram_start%,${CONFIG_UIMAGE_LOADADDR},g" \ + -e "s,%srk_table%,${SRK_TABLE},g " \ + -e "s,%cert_csf%,${CERT_CSF},g" \ + -e "s,%cert_img%,${CERT_IMG},g" \ + -e "s,%uimage_path%,${TARGET},g" \ + -e "s,%key_index%,${CONFIG_KEY_INDEX},g" \ + -e "s,%dek_len%,${dek_size},g" \ + -e "s,%dek_path%,${CONFIG_DEK_PATH},g" \ + -e "s,%dek_offset%,${dek_blob_offset},g" \ + -e "s,%ivt_uimage_start%,${ivt_uimage_start},g" \ + -e "s,%ivt_ram_start%,${ivt_ram_start},g" \ + -e "s,%ivt_size%,${ivt_size},g" \ + -e "s,%entrypoint_uimage_offset%,${entrypoint_uimage_offset},g" \ + -e "s,%entrypoint_ram_start%,${entrypoint_ram_start},g" \ + -e "s,%entrypoint_size%,${entrypoint_size},g" \ + -e "s,%header_uimage_offset%,${header_uimage_offset},g" \ + -e "s,%header_ram_start%,${header_ram_start},g" \ + -e "s,%header_size%,${header_size},g" \ + -e "s,%r1_uimage_offset%,${r1_uimage_offset},g" \ + -e "s,%r1_ram_start%,${r1_ram_start},g" \ + -e "s,%r1_size%,${r1_size},g" \ + -e "s,%r2_uimage_offset%,${r2_uimage_offset},g" \ + -e "s,%r2_ram_start%,${r2_ram_start},g" \ + -e "s,%r2_size%,${r2_size},g" \ + "${SCRIPT_BASEDIR}/templates/encrypt_uimage" > csf_descriptor +else + sed -e "s,%ram_start%,${CONFIG_UIMAGE_LOADADDR},g" \ + -e "s,%srk_table%,${SRK_TABLE},g" \ + -e "s,%image_offset%,${uimage_offset},g" \ + -e "s,%auth_len%,${auth_len},g" \ + -e "s,%cert_csf%,${CERT_CSF},g" \ + -e "s,%cert_img%,${CERT_IMG},g" \ + -e "s,%uimage_path%,${TARGET},g" \ + -e "s,%key_index%,${CONFIG_KEY_INDEX},g" \ + "${SCRIPT_BASEDIR}/templates/sign_uimage" > csf_descriptor +fi + +# Generate SRK tables +srktool --hab_ver 4 --certs "${SRK_KEYS}" --table "${SRK_TABLE}" --efuses /dev/null --digest sha256 +if [ $? -ne 0 ]; then + echo "[ERROR] Could not generate SRK tables" + exit 1 +fi + +# Pad to IVT +objcopy -I binary -O binary --pad-to "${pad_len}" --gap-fill="${GAP_FILLER}" "${UIMAGE_PATH}" "${TARGET}" + +# Generate and attach IVT +# Fields: header, jump location, reserved (0), DCD pointer (null) +# boot data (null), self pointer, CSF pointer, reserved (0) +IVT_HEADER="0x402000D1" +printf "0: %.8x" ${IVT_HEADER} | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd -r -g0 > ivt +printf "0: %.8x" "${entrypoint_ram_start}" | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd -r -g0 >> ivt +printf "0: %.8x" 0 | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd -r -g0 >> ivt +printf "0: %.8x" 0 | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd -r -g0 >> ivt +printf "0: %.8x" 0 | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd -r -g0 >> ivt +printf "0: %.8x" "${ivt_ram_start}" | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd -r -g0 >> ivt +printf "0: %.8x" "${csf_ram_start}" | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd -r -g0 >> ivt +printf "0: %.8x" 0 | sed -E 's/0: (..)(..)(..)(..)/0: \4\3\2\1/' | xxd -r -g0 >> ivt +cat ivt >> "${TARGET}" + +CURRENT_PATH="$(pwd)" +cst -o "${CURRENT_PATH}/csf.bin" -i "${CURRENT_PATH}/csf_descriptor" +if [ $? -ne 0 ]; then + echo "[ERROR] Could not generate CSF" + exit 1 +fi + +cat csf.bin >> "${TARGET}" + +objcopy -I binary -O binary --pad-to "${sig_len}" --gap-fill="${GAP_FILLER}" "${TARGET}" +echo "Signed uImage at ${TARGET}" +rm -f "${SRK_TABLE}" csf_descriptor csf.bin ivt 2> /dev/null diff --git a/meta-digi-dey/classes/trustfence.bbclass b/meta-digi-dey/classes/trustfence.bbclass new file mode 100644 index 000000000..6530f01ef --- /dev/null +++ b/meta-digi-dey/classes/trustfence.bbclass @@ -0,0 +1,68 @@ +# Adds TrustFence configuration +# +# To use it add the following line to conf/local.conf: +# +# INHERIT += "trustfence" +# +# Inheriting this class enables the following default TrustFence configuration: +# +# * Disabled console +# + +# Default secure console configuration +TRUSTFENCE_CONSOLE_DISABLE ?= "1" + +# Uncomment to enable the console with the specified passphrase +#TRUSTFENCE_CONSOLE_PASSPHRASE_ENABLE = "my_secure_passphrase" + +# Alternatively, uncommment to enable the console with the specified GPIO +#TRUSTFENCE_CONSOLE_GPIO_ENABLE = "4" + +# Default secure boot configuration +TRUSTFENCE_SIGN ?= "1" +TRUSTFENCE_SIGN_KEYS_PATH ?= "default" +TRUSTFENCE_DEK_PATH ?= "default" +TRUSTFENCE_UBOOT_ENV_DEK ?= "gen_random" + +# Trustfence initramfs image recipe +TRUSTFENCE_INITRAMFS_IMAGE ?= "dey-image-trustfence-initramfs" + +IMAGE_FEATURES += "dey-trustfence" + +UBOOT_EXTRA_CONF = "" + +python () { + import binascii + import hashlib + import os + + # Secure console configuration + if (d.getVar("TRUSTFENCE_CONSOLE_DISABLE", True) == "1"): + d.appendVar("UBOOT_EXTRA_CONF", "CONFIG_CONSOLE_DISABLE=y ") + if d.getVar("TRUSTFENCE_CONSOLE_PASSPHRASE_ENABLE", True): + passphrase_hash = hashlib.sha256(d.getVar("TRUSTFENCE_CONSOLE_PASSPHRASE_ENABLE")).hexdigest() + d.appendVar("UBOOT_EXTRA_CONF", 'CONFIG_CONSOLE_ENABLE_PASSPHRASE=y CONFIG_CONSOLE_ENABLE_PASSPHRASE_KEY=\\"%s\\" ' % passphrase_hash) + elif d.getVar("TRUSTFENCE_CONSOLE_GPIO_ENABLE", True): + d.appendVar("UBOOT_EXTRA_CONF", " CONFIG_CONSOLE_ENABLE_GPIO=y CONFIG_CONSOLE_ENABLE_GPIO_NR=%s " % d.getVar("TRUSTFENCE_CONSOLE_GPIO_ENABLE")) + + # Secure boot configuration + if (d.getVar("TRUSTFENCE_UBOOT_ENV_DEK") == "gen_random"): + d.setVar("TRUSTFENCE_UBOOT_ENV_DEK", str(binascii.hexlify(os.urandom(16)).decode())) + + if (d.getVar("TRUSTFENCE_SIGN_KEYS_PATH") == "default"): + d.setVar("TRUSTFENCE_SIGN_KEYS_PATH", d.getVar("TOPDIR") + "/trustfence"); + + if (d.getVar("TRUSTFENCE_DEK_PATH") == "default"): + d.setVar("TRUSTFENCE_DEK_PATH", d.getVar("TRUSTFENCE_SIGN_KEYS_PATH") + "/dek.bin"); + + if (d.getVar("TRUSTFENCE_SIGN", True) == "1"): + d.appendVar("UBOOT_EXTRA_CONF", "CONFIG_SIGN_IMAGE=y ") + if d.getVar("TRUSTFENCE_SIGN_KEYS_PATH", True): + d.appendVar("UBOOT_EXTRA_CONF", 'CONFIG_SIGN_KEYS_PATH=\\"%s\\" ' % d.getVar("TRUSTFENCE_SIGN_KEYS_PATH")) + if d.getVar("TRUSTFENCE_KEY_INDEX", True): + d.appendVar("UBOOT_EXTRA_CONF", "CONFIG_KEY_INDEX=%s " % d.getVar("TRUSTFENCE_KEY_INDEX")) + if (d.getVar("TRUSTFENCE_DEK_PATH", True) not in [None, "0"]): + d.appendVar("UBOOT_EXTRA_CONF", 'CONFIG_DEK_PATH=\\"%s\\" ' % d.getVar("TRUSTFENCE_DEK_PATH")) + if (d.getVar("TRUSTFENCE_UBOOT_ENV_DEK", True) not in [None, "0"]): + d.appendVar("UBOOT_EXTRA_CONF", 'CONFIG_ENV_AES=y CONFIG_ENV_AES_KEY=\\"%s\\"' % d.getVar("TRUSTFENCE_UBOOT_ENV_DEK")) +} diff --git a/meta-digi-dey/conf/distro/dey.conf b/meta-digi-dey/conf/distro/dey.conf index f550fb473..8e0fbfbe0 100644 --- a/meta-digi-dey/conf/distro/dey.conf +++ b/meta-digi-dey/conf/distro/dey.conf @@ -23,7 +23,7 @@ DISTRO_FEATURES ?= "${DISTRO_FEATURES_DEFAULT} ${DISTRO_FEATURES_LIBC} ${POKY_DE # 'ptest' -> fails to build QT5 toolchain POKY_DEFAULT_DISTRO_FEATURES_remove = "ptest wayland" -GRAPHICAL_BACKEND = "${@base_contains('DISTRO_FEATURES', 'x11', 'x11', 'fb', d)}" +GRAPHICAL_BACKEND = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', 'fb', d)}" # DEY image features (alphabetical order) FEATURE_PACKAGES_dey-audio = "packagegroup-dey-audio" @@ -33,6 +33,7 @@ FEATURE_PACKAGES_dey-examples = "packagegroup-dey-examples" FEATURE_PACKAGES_dey-gstreamer = "packagegroup-dey-gstreamer" FEATURE_PACKAGES_dey-network = "packagegroup-dey-network" FEATURE_PACKAGES_dey-qt = "packagegroup-dey-qt" +FEATURE_PACKAGES_dey-trustfence = "packagegroup-dey-trustfence" FEATURE_PACKAGES_dey-wireless = "packagegroup-dey-wireless" # Set the PREFERRED_PROVIDER for jpeg functionality based on the MACHINE @@ -91,9 +92,7 @@ https://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \n" # the variable to be empty. # Git example url: git://git.yoctoproject.org/yocto-firewall-test;protocol=git;rev=master -CONNECTIVITY_CHECK_URIS ?= " \ - https://eula-downloads.yoctoproject.org/index.php \ - http://bugzilla.yoctoproject.org/report.cgi" +CONNECTIVITY_CHECK_URIS ?= "https://www.example.com/" SANITY_TESTED_DISTROS ?= " \ poky-1.7 \n \ diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/0021-hcitool-do-not-show-unsupported-refresh-option.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/0021-hcitool-do-not-show-unsupported-refresh-option.patch new file mode 100644 index 000000000..0d0375dad --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/0021-hcitool-do-not-show-unsupported-refresh-option.patch @@ -0,0 +1,22 @@ +From: Isaac Hermida +Date: Fri, 8 Jul 2016 12:19:33 +0200 +Subject: [PATCH] hcitool: do not show unsupported refresh option + +Signed-off-by: Isaac Hermida +--- + tools/hcitool.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/hcitool.c b/tools/hcitool.c +index 02c4ebe1b71b..229c22c49909 100644 +--- a/tools/hcitool.c ++++ b/tools/hcitool.c +@@ -568,7 +568,7 @@ static struct option scan_options[] = { + + static const char *scan_help = + "Usage:\n" +- "\tscan [--length=N] [--numrsp=N] [--iac=lap] [--flush] [--class] [--info] [--oui] [--refresh]\n"; ++ "\tscan [--length=N] [--numrsp=N] [--iac=lap] [--flush] [--class] [--info] [--oui]\n"; + + static void cmd_scan(int dev_id, int argc, char **argv) + { diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/0022-hcitool-increase-the-shown-connection-limit-to-20.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/0022-hcitool-increase-the-shown-connection-limit-to-20.patch new file mode 100644 index 000000000..fd81a1960 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/0022-hcitool-increase-the-shown-connection-limit-to-20.patch @@ -0,0 +1,57 @@ +From: Isaac Hermida +Date: Fri, 8 Jul 2016 10:42:57 +0200 +Subject: [PATCH] hcitool: increase the shown connection limit to 20 + +Created a variable to set the number of connections to shown and increase that +value so we can list more current LE connections. + +https://jira.digi.com/browse/DEL-2735 + +Signed-off-by: Isaac Hermida +--- + tools/hcitool.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/tools/hcitool.c b/tools/hcitool.c +index 229c22c49909..ae70c9c0d3b4 100644 +--- a/tools/hcitool.c ++++ b/tools/hcitool.c +@@ -69,6 +69,8 @@ + #define EIR_TX_POWER 0x0A /* transmit power level */ + #define EIR_DEVICE_ID 0x10 /* device ID */ + ++#define MAX_CONNECTIONS_SHOWN 20 /* Max number of "hcitool conn" items to shown */ ++ + #define for_each_opt(opt, long, short) while ((opt=getopt_long(argc, argv, short ? short:"+", long, NULL)) != -1) + + static volatile int signal_received = 0; +@@ -156,12 +158,12 @@ static int conn_list(int s, int dev_id, long arg) + if (id != -1 && dev_id != id) + return 0; + +- if (!(cl = malloc(10 * sizeof(*ci) + sizeof(*cl)))) { ++ if (!(cl = malloc(MAX_CONNECTIONS_SHOWN * sizeof(*ci) + sizeof(*cl)))) { + perror("Can't allocate memory"); + exit(1); + } + cl->dev_id = dev_id; +- cl->conn_num = 10; ++ cl->conn_num = MAX_CONNECTIONS_SHOWN; + ci = cl->conn_info; + + if (ioctl(s, HCIGETCONNLIST, (void *) cl)) { +@@ -190,12 +192,12 @@ static int find_conn(int s, int dev_id, long arg) + struct hci_conn_info *ci; + int i; + +- if (!(cl = malloc(10 * sizeof(*ci) + sizeof(*cl)))) { ++ if (!(cl = malloc(MAX_CONNECTIONS_SHOWN * sizeof(*ci) + sizeof(*cl)))) { + perror("Can't allocate memory"); + exit(1); + } + cl->dev_id = dev_id; +- cl->conn_num = 10; ++ cl->conn_num = MAX_CONNECTIONS_SHOWN; + ci = cl->conn_info; + + if (ioctl(s, HCIGETCONNLIST, (void *) cl)) { diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/bluez-init b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/bluez-init new file mode 100755 index 000000000..7458716a2 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/bluez-init @@ -0,0 +1,174 @@ +#!/bin/sh +#=============================================================================== +# +# bluez +# +# Copyright (C) 2012-2014 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: Configure Bluetooth +# +#=============================================================================== + +set -e + +if [ "${1}" != "start" ]; then + exit 0 +fi + +SCRIPTNAME="$(basename "${0}")" +LOGFILE="/var/log/bluetoothd.log" + +bt_init_qca6564() { + MOD_VERSION="$(($(cat /proc/device-tree/digi,hwid,hv 2>/dev/null || true)))" + + # Reset the BT_EN line + BT_EN_QCA_GPIO_NR="137" + BT_EN_L="/sys/class/gpio/gpio${BT_EN_QCA_GPIO_NR}" + [ -d "${BT_EN_L}" ] || printf "%s" ${BT_EN_QCA_GPIO_NR} > /sys/class/gpio/export + printf out > ${BT_EN_L}/direction && sleep .1 + printf 0 > ${BT_EN_L}/value && sleep .1 + printf 1 > ${BT_EN_L}/value && sleep .1 + [ -d "${BT_EN_L}" ] && printf "%s" ${BT_EN_QCA_GPIO_NR} > /sys/class/gpio/unexport + + # Module version older than revision 4 has swapped TX and RX lines + if [ "${MOD_VERSION}" -lt "4" ]; then + # Workaround to ignore the CTS flow control line + BT_CTS_QCA_GPIO_NR="18" + BT_CTS_L="/sys/class/gpio/gpio${BT_CTS_QCA_GPIO_NR}" + [ -d "${BT_CTS_L}" ] || printf "%s" ${BT_CTS_QCA_GPIO_NR} > /sys/class/gpio/export + printf out > ${BT_CTS_L}/direction && sleep .1 + printf 0 > ${BT_CTS_L}/value && sleep .1 + [ -d "${BT_CTS_L}" ] && printf "%s" ${BT_CTS_QCA_GPIO_NR} > /sys/class/gpio/unexport + # Reduce the rate to avoid the need for HW flow control + BT_RATE="115200" + BT_FLOW="noflow" + fi + + if hciattach -t120 ttyBt qca ${BT_RATE:-3000000} ${BT_FLOW:-flow} 2>${LOGFILE}; then + : # No-op + else + echo "${SCRIPTNAME}: FAILED (hciattach)" + exit + fi + + # Convert the BT address to the hcitool command format. + # Example: "00:04:F3:11:22:33" coverted to "33 22 11 F3 04 00" + HCI_BTADDR="$(echo ${BTADDR} | tr ':' '\n' | tac | tr '\n' ' ' | sed -e 's/ $//g')" + + # Up the interface to be able to send hci commands + if ! hciconfig hci0 up; then + echo "${SCRIPTNAME}: FAILED (hci0 up)" + exit + fi + + # Set the MAC address + if ! hcitool -i hci0 cmd 3F 000B 01 02 06 ${HCI_BTADDR} > /dev/null; then + echo "${SCRIPTNAME}: FAILED (hci set MAC)" + exit + fi + + # HCI Reset + if ! hcitool -i hci0 cmd 03 0003 00 > /dev/null; then + echo "${SCRIPTNAME}: FAILED (hci reset)" + exit + fi + + # Down and up the interface to load the new MAC address + if ! hciconfig hci0 down; then + echo "${SCRIPTNAME}: FAILED (hci0 down)" + exit + fi + + hciconfig hci0 up && echo "${SCRIPTNAME}: OK" || echo "${SCRIPTNAME}: FAILED" +} + +bt_init_ar3k() { + if grep -qs '\' /proc/device-tree/compatible; then + BT_PWR_GPIO_NR="21" + elif grep -qs '\' /proc/device-tree/compatible; then + BT_PWR_GPIO_NR="244" + fi + + # Use a sub-shell here to change to firmware directory + ( + cd /lib/firmware/ar3k/1020200 + + # Update the MAC address file only if it has changed. + FW_MAC="ar3kbdaddr.pst" + [ -f "${FW_MAC}" ] && [ "$(cat ${FW_MAC})" = "${BTADDR}" ] || echo ${BTADDR} > ${FW_MAC} + + JPN_REGCODE="0x2" + REGCODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null)" + BT_CLASS_LINK="PS_ASIC.pst" + BT_CLASS_FILE="PS_ASIC_class_1.pst" + if [ -n "${REGCODE}" ] && [ "${JPN_REGCODE}" = "${REGCODE}" ]; then + BT_CLASS_FILE="PS_ASIC_class_2.pst" + fi + + # Replace the configuration file if different + if ! cmp -s ${BT_CLASS_FILE} ${BT_CLASS_LINK}; then + ln -sf ${BT_CLASS_FILE} ${BT_CLASS_LINK} + fi + # Remove not used configuration and readme files + # -- Do not quote the subcommand to avoid leading/trailing whitespace + # -- being part of the file name. + rm -f $(echo PS_ASIC_class_?.pst | sed -e "s,${BT_CLASS_FILE},,g") readme.txt + ) + + # Start the Bluetooth driver and daemon (D-BUS must already be running) + RETRIES="5" + while [ "${RETRIES}" -gt "0" ]; do + hciattach ttyBt ath3k 4000000 1>${LOGFILE} && break + if [ -n "${BT_PWR_GPIO_NR}" ]; then + # + # If hciattach fails try to recover it by toggling the BT power GPIO + # + BT_PWR_L="/sys/class/gpio/gpio${BT_PWR_GPIO_NR}" + [ -d "${BT_PWR_L}" ] || printf "%s" ${BT_PWR_GPIO_NR} > /sys/class/gpio/export + printf out > ${BT_PWR_L}/direction && sleep .2 + printf 0 > ${BT_PWR_L}/value && sleep .2 + printf 1 > ${BT_PWR_L}/value && sleep .2 + [ -d "${BT_PWR_L}" ] && printf "%s" ${BT_PWR_GPIO_NR} > /sys/class/gpio/unexport + else + sleep .5 + fi + RETRIES="$((RETRIES - 1))" + done + if [ "${RETRIES}" -eq "0" ]; then + echo "${SCRIPTNAME}: FAILED (hciattach)" + exit + fi + if hciconfig hci0 up; then + : # No-op + else + echo "${SCRIPTNAME}: FAILED" + exit + fi +} + +# Check if this hardware does support Bluetooth +if [ -d "/proc/device-tree/bluetooth" ]; then + # Get MAC address from device tree. Use a default value if it has not been set. + if [ -f "/proc/device-tree/bluetooth/mac-address" ]; then + BTADDR="$(hexdump -ve '1/1 "%02X" ":"' /proc/device-tree/bluetooth/mac-address | sed 's/:$//g')" + fi + if [ -z "${BTADDR}" ] || [ "${BTADDR}" = "00:00:00:00:00:00" ]; then + BTADDR="00:04:F3:FF:FF:BB" + fi + + # Initialize for the specific bluetooth chip + if grep -qs '\' /proc/device-tree/compatible; then + bt_init_qca6564 + else + bt_init_ar3k + fi +fi + +echo "Starting bluetooth services." +start-stop-daemon -S --background --exec /usr/lib/bluez5/bluetooth/bluetoothd diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0001-bluetooth-Add-bluetooth-support-for-QCA6174-chip.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0001-bluetooth-Add-bluetooth-support-for-QCA6174-chip.patch new file mode 100644 index 000000000..4a446da5d --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0001-bluetooth-Add-bluetooth-support-for-QCA6174-chip.patch @@ -0,0 +1,2066 @@ +From: Anantha Krishnan +Date: Tue, 19 Aug 2014 20:23:01 +0530 +Subject: [PATCH] bluetooth : Add bluetooth support for QCA6174 chip. + +Register the QCA6174 initialization routine with hciattach for +downloading firmware patches to the bluetooth controller. +Add optional support 'f' to control installation of line +discipline driver. Invoke hciattach from command line and +download the firmware patches: + hciattach /dev/ttyHS0 qca 3000000 -t120 flow -f0 + +Change-Id: I87f2927d7096904071a02d73d3afef0dc34db414 +Signed-off-by: Rupesh Tatiya +--- + Makefile.tools | 3 +- + tools/hciattach.c | 25 +- + tools/hciattach.h | 6 +- + tools/hciattach_rome.c | 1578 ++++++++++++++++++++++++++++++++++++++++++++++++ + tools/hciattach_rome.h | 317 ++++++++++ + 5 files changed, 1925 insertions(+), 4 deletions(-) + create mode 100644 tools/hciattach_rome.c + create mode 100644 tools/hciattach_rome.h + +diff --git a/Makefile.tools b/Makefile.tools +index e193be9f33aa..52c8581b5b58 100644 +--- a/Makefile.tools ++++ b/Makefile.tools +@@ -159,7 +159,8 @@ tools_hciattach_SOURCES = tools/hciattach.c tools/hciattach.h \ + tools/hciattach_ath3k.c \ + tools/hciattach_qualcomm.c \ + tools/hciattach_intel.c \ +- tools/hciattach_bcm43xx.c ++ tools/hciattach_bcm43xx.c \ ++ tools/hciattach_rome.c tools/hciattach_rome.h + tools_hciattach_LDADD = lib/libbluetooth-internal.la + + tools_hciconfig_SOURCES = tools/hciconfig.c tools/csr.h tools/csr.c +diff --git a/tools/hciattach.c b/tools/hciattach.c +index 4dc5be5635c7..d3917a0d503e 100644 +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -67,6 +67,8 @@ struct uart_t { + #define ENABLE_PM 1 + #define DISABLE_PM 0 + ++int line_disp = 1; ++ + static volatile sig_atomic_t __io_canceled = 0; + + static void sig_hup(int sig) +@@ -317,6 +319,12 @@ static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti) + return ath3k_post(fd, u->pm); + } + ++static int qca(int fd, struct uart_t *u, struct termios *ti) ++{ ++ fprintf(stderr,"qca\n"); ++ return qca_soc_init(fd, u->bdaddr); ++} ++ + static int qualcomm(int fd, struct uart_t *u, struct termios *ti) + { + return qualcomm_init(fd, u->speed, ti, u->bdaddr); +@@ -1147,6 +1155,10 @@ struct uart_t uart[] = { + { "ath3k", 0x0000, 0x0000, HCI_UART_ATH3K, 115200, 115200, + FLOW_CTL, DISABLE_PM, NULL, ath3k_ps, ath3k_pm }, + ++ /* QCA ROME */ ++ { "qca", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, ++ FLOW_CTL, DISABLE_PM, NULL, qca, NULL }, ++ + /* QUALCOMM BTS */ + { "qualcomm", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, + FLOW_CTL, DISABLE_PM, NULL, qualcomm, NULL }, +@@ -1249,6 +1261,7 @@ static int init_uart(char *dev, struct uart_t *u, int send_break, int raw) + goto fail; + } + ++if (line_disp) { + /* Set TTY to N_HCI line discipline */ + i = N_HCI; + if (ioctl(fd, TIOCSETD, &i) < 0) { +@@ -1265,6 +1278,7 @@ static int init_uart(char *dev, struct uart_t *u, int send_break, int raw) + perror("Can't set device"); + goto fail; + } ++} + + if (u->post && u->post(fd, u, &ti) < 0) + goto fail; +@@ -1303,7 +1317,7 @@ int main(int argc, char *argv[]) + printpid = 0; + raw = 0; + +- while ((opt=getopt(argc, argv, "bnpt:s:lr")) != EOF) { ++ while ((opt=getopt(argc, argv, "bnpt:s:lrf:")) != EOF) { + switch(opt) { + case 'b': + send_break = 1; +@@ -1336,6 +1350,11 @@ int main(int argc, char *argv[]) + raw = 1; + break; + ++ case 'f': ++ line_disp = atoi(optarg); ++ fprintf(stderr, "Line_disp val : %d\n", line_disp); ++ break; ++ + default: + usage(); + exit(1); +@@ -1398,6 +1417,7 @@ int main(int argc, char *argv[]) + case 5: + u->bdaddr = argv[optind]; + break; ++ + } + } + +@@ -1474,12 +1494,15 @@ int main(int argc, char *argv[]) + break; + } + ++if (line_disp) { + /* Restore TTY line discipline */ ++ fprintf(stderr, "Restoring the Line Discipline driver\n"); + ld = N_TTY; + if (ioctl(n, TIOCSETD, &ld) < 0) { + perror("Can't restore line discipline"); + exit(1); + } ++} + + return 0; + } +diff --git a/tools/hciattach.h b/tools/hciattach.h +index 909ada871df2..2021c33a9824 100644 +--- a/tools/hciattach.h ++++ b/tools/hciattach.h +@@ -39,8 +39,9 @@ + #define HCI_UART_H4DS 3 + #define HCI_UART_LL 4 + #define HCI_UART_ATH3K 5 +-#define HCI_UART_INTEL 6 +-#define HCI_UART_BCM 7 ++#define HCI_UART_IBS 6 ++#define HCI_UART_INTEL 7 ++#define HCI_UART_BCM 8 + + #define HCI_UART_RAW_DEVICE 0 + #define HCI_UART_RESET_ON_INIT 1 +@@ -62,6 +63,7 @@ int ath3k_init(int fd, int speed, int init_speed, char *bdaddr, + struct termios *ti); + int ath3k_post(int fd, int pm); + int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr); ++int qca_soc_init(int fd, char *bdaddr); + int intel_init(int fd, int init_speed, int *speed, struct termios *ti); + int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti, + const char *bdaddr); +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +new file mode 100644 +index 000000000000..f31be43c09e4 +--- /dev/null ++++ b/tools/hciattach_rome.c +@@ -0,0 +1,1578 @@ ++/* ++ * ++ * Copyright (c) 2013, The Linux Foundation. All rights reserved. ++ * Not a Contribution. ++ * ++ * Copyright 2012 The Android Open Source Project ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); you ++ * may not use this file except in compliance with the License. You may ++ * obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ++ * implied. See the License for the specific language governing ++ * permissions and limitations under the License. ++ * ++ */ ++ ++/****************************************************************************** ++ * ++ * Filename: hciattach_rome.c ++ * ++ * Description: Contains controller-specific functions, like ++ * firmware patch download ++ * low power mode operations ++ * ++ ******************************************************************************/ ++ ++#define LOG_TAG "bt_vendor" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "hciattach_rome.h" ++#include "hciattach.h" ++ ++#ifdef __cplusplus ++} ++#endif ++ ++ ++/****************************************************************************** ++** Variables ++******************************************************************************/ ++FILE *file; ++unsigned char *phdr_buffer; ++unsigned char *pdata_buffer = NULL; ++patch_info rampatch_patch_info; ++int rome_ver = ROME_VER_UNKNOWN; ++unsigned char gTlv_type; ++char *rampatch_file_path; ++char *nvm_file_path; ++vnd_userial_cb_t vnd_userial; ++/****************************************************************************** ++** Extern variables ++******************************************************************************/ ++//extern unsigned char vnd_local_bd_addr[6]; ++ ++/***************************************************************************** ++** Functions ++*****************************************************************************/ ++ ++/******************************************************************************* ++** ++** Function userial_to_tcio_baud ++** ++** Description helper function converts USERIAL baud rates into TCIO ++** conforming baud rates ++** ++** Returns TRUE/FALSE ++** ++*******************************************************************************/ ++unsigned char userial_to_tcio_baud(unsigned char cfg_baud, unsigned int *baud) ++{ ++ if (cfg_baud == USERIAL_BAUD_115200) ++ *baud = B115200; ++ else if (cfg_baud == USERIAL_BAUD_4M) ++ *baud = B4000000; ++ else if (cfg_baud == USERIAL_BAUD_3M) ++ *baud = B3000000; ++ else if (cfg_baud == USERIAL_BAUD_2M) ++ *baud = B2000000; ++ else if (cfg_baud == USERIAL_BAUD_1M) ++ *baud = B1000000; ++ else if (cfg_baud == USERIAL_BAUD_921600) ++ *baud = B921600; ++ else if (cfg_baud == USERIAL_BAUD_460800) ++ *baud = B460800; ++ else if (cfg_baud == USERIAL_BAUD_230400) ++ *baud = B230400; ++ else if (cfg_baud == USERIAL_BAUD_57600) ++ *baud = B57600; ++ else if (cfg_baud == USERIAL_BAUD_19200) ++ *baud = B19200; ++ else if (cfg_baud == USERIAL_BAUD_9600) ++ *baud = B9600; ++ else if (cfg_baud == USERIAL_BAUD_1200) ++ *baud = B1200; ++ else if (cfg_baud == USERIAL_BAUD_600) ++ *baud = B600; ++ else ++ { ++ fprintf(stderr, "userial vendor open: unsupported baud idx %i\n", cfg_baud); ++ *baud = B115200; ++ return FALSE; ++ } ++ ++ return TRUE; ++} ++ ++ ++/******************************************************************************* ++** ++** Function userial_vendor_set_baud ++** ++** Description Set new baud rate ++** ++** Returns None ++** ++*******************************************************************************/ ++void userial_vendor_set_baud(unsigned char userial_baud) ++{ ++ unsigned int tcio_baud; ++ fprintf(stderr, "## userial_vendor_set_baud: %d\n", userial_baud); ++ ++ userial_to_tcio_baud(userial_baud, &tcio_baud); ++ ++ cfsetospeed(&vnd_userial.termios, tcio_baud); ++ cfsetispeed(&vnd_userial.termios, tcio_baud); ++ tcsetattr(vnd_userial.fd, TCSADRAIN, &vnd_userial.termios); /* don't change speed until last write done */ ++ ++} ++ ++ ++/******************************************************************************* ++** ++** Function userial_vendor_ioctl ++** ++** Description ioctl inteface ++** ++** Returns None ++** ++*******************************************************************************/ ++int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data) ++{ ++ int err = -1; ++ struct termios ti; ++ ++ if (tcgetattr(fd, &ti) < 0) { ++ perror("Can't get port settings"); ++ return -1; ++ } ++ cfmakeraw(&ti); ++ ti.c_cflag |= CLOCAL; ++ ++ switch(op) ++ { ++#if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) ++ case USERIAL_OP_ASSERT_BT_WAKE: ++ VNDUSERIALDBG("## userial_vendor_ioctl: Asserting BT_Wake ##"); ++ err = ioctl(fd, USERIAL_IOCTL_BT_WAKE_ASSERT, NULL); ++ break; ++ ++ case USERIAL_OP_DEASSERT_BT_WAKE: ++ VNDUSERIALDBG("## userial_vendor_ioctl: De-asserting BT_Wake ##"); ++ err = ioctl(fd, USERIAL_IOCTL_BT_WAKE_DEASSERT, NULL); ++ break; ++ ++ case USERIAL_OP_GET_BT_WAKE_STATE: ++ err = ioctl(fd, USERIAL_IOCTL_BT_WAKE_GET_ST, p_data); ++ break; ++#endif // (BT_WAKE_VIA_USERIAL_IOCTL==TRUE) ++ case USERIAL_OP_FLOW_ON: ++ fprintf(stderr, "## userial_vendor_ioctl: UART Flow On\n "); ++ ti.c_cflag |= CRTSCTS; ++ ++ if (err = tcsetattr(fd, TCSANOW, &ti) < 0) { ++ perror("Can't set port settings"); ++ return -1; ++ } ++ ++ break; ++ ++ case USERIAL_OP_FLOW_OFF: ++ fprintf(stderr, "## userial_vendor_ioctl: UART Flow Off\n "); ++ ti.c_cflag &= ~CRTSCTS; ++ if (err = tcsetattr(fd, TCSANOW, &ti) < 0) { ++ fprintf(stderr, "Can't set port settings"); ++ return -1; ++ } ++ break; ++ ++ default: ++ break; ++ } ++ ++ return err; ++} ++ ++ ++int get_vs_hci_event(unsigned char *rsp) ++{ ++ int err = 0, soc_id =0; ++ unsigned char paramlen = 0; ++ ++ if( (rsp[EVENTCODE_OFFSET] == VSEVENT_CODE) || (rsp[EVENTCODE_OFFSET] == EVT_CMD_COMPLETE)) ++ fprintf(stderr, "%s: Received HCI-Vendor Specific event\n", __FUNCTION__); ++ else { ++ fprintf(stderr, "%s: Failed to receive HCI-Vendor Specific event\n", __FUNCTION__); ++ err = -EIO; ++ goto failed; ++ } ++ ++ fprintf(stderr, "%s: Parameter Length: 0x%x\n", __FUNCTION__, paramlen = rsp[EVT_PLEN]); ++ fprintf(stderr, "%s: Command response: 0x%x\n", __FUNCTION__, rsp[CMD_RSP_OFFSET]); ++ fprintf(stderr, "%s: Response type : 0x%x\n", __FUNCTION__, rsp[RSP_TYPE_OFFSET]); ++ ++ /* Check the status of the operation */ ++ switch ( rsp[CMD_RSP_OFFSET] ) ++ { ++ case EDL_CMD_REQ_RES_EVT: ++ fprintf(stderr, "%s: Command Request Response\n", __FUNCTION__); ++ switch(rsp[RSP_TYPE_OFFSET]) ++ { ++ case EDL_PATCH_VER_RES_EVT: ++ case EDL_APP_VER_RES_EVT: ++ fprintf(stderr, "\t Current Product ID\t\t: 0x%08x\n", ++ (unsigned int)(rsp[PATCH_PROD_ID_OFFSET +3] << 24 | ++ rsp[PATCH_PROD_ID_OFFSET+2] << 16 | ++ rsp[PATCH_PROD_ID_OFFSET+1] << 8 | ++ rsp[PATCH_PROD_ID_OFFSET] )); ++ ++ /* Patch Version indicates FW patch version */ ++ fprintf(stderr, "\t Current Patch Version\t\t: 0x%04x\n", ++ (unsigned short)(rsp[PATCH_PATCH_VER_OFFSET + 1] << 8 | ++ rsp[PATCH_PATCH_VER_OFFSET] )); ++ ++ /* ROM Build Version indicates ROM build version like 1.0/1.1/2.0 */ ++ fprintf(stderr, "\t Current ROM Build Version\t: 0x%04x\n", rome_ver = ++ (int)(rsp[PATCH_ROM_BUILD_VER_OFFSET + 1] << 8 | ++ rsp[PATCH_ROM_BUILD_VER_OFFSET] )); ++ ++ /* In case rome 1.0/1.1, there is no SOC ID version available */ ++ if (paramlen - 10) ++ { ++ fprintf(stderr, "\t Current SOC Version\t\t: 0x%08x\n", soc_id = ++ (unsigned int)(rsp[PATCH_SOC_VER_OFFSET +3] << 24 | ++ rsp[PATCH_SOC_VER_OFFSET+2] << 16 | ++ rsp[PATCH_SOC_VER_OFFSET+1] << 8 | ++ rsp[PATCH_SOC_VER_OFFSET] )); ++ } ++ ++ /* Rome Chipset Version can be decided by Patch version and SOC version, ++ Upper 2 bytes will be used for Patch version and Lower 2 bytes will be ++ used for SOC as combination for BT host driver */ ++ rome_ver = (rome_ver << 16) | (soc_id & 0x0000ffff); ++ break; ++ case EDL_TVL_DNLD_RES_EVT: ++ case EDL_CMD_EXE_STATUS_EVT: ++ switch (err = rsp[CMD_STATUS_OFFSET]) ++ { ++ case HCI_CMD_SUCCESS: ++ fprintf(stderr, "%s: Download Packet successfully!\n", __FUNCTION__); ++ break; ++ case PATCH_LEN_ERROR: ++ fprintf(stderr, "%s: Invalid patch length argument passed for EDL PATCH " ++ "SET REQ cmd\n", __FUNCTION__); ++ break; ++ case PATCH_VER_ERROR: ++ fprintf(stderr, "%s: Invalid patch version argument passed for EDL PATCH " ++ "SET REQ cmd\n", __FUNCTION__); ++ break; ++ case PATCH_CRC_ERROR: ++ fprintf(stderr, "%s: CRC check of patch failed!!!\n", __FUNCTION__); ++ break; ++ case PATCH_NOT_FOUND: ++ fprintf(stderr, "%s: Invalid patch data!!!\n", __FUNCTION__); ++ break; ++ case TLV_TYPE_ERROR: ++ fprintf(stderr, "%s: TLV Type Error !!!\n", __FUNCTION__); ++ break; ++ default: ++ fprintf(stderr, "%s: Undefined error (0x%x)", __FUNCTION__, err); ++ break; ++ } ++ break; ++ } ++ break; ++ ++ case NVM_ACCESS_CODE: ++ fprintf(stderr, "%s: NVM Access Code!!!\n", __FUNCTION__); ++ err = HCI_CMD_SUCCESS; ++ break; ++ case EDL_SET_BAUDRATE_RSP_EVT: ++ /* Rome 1.1 has bug with the response, so it should ignore it. */ ++ if (rsp[BAUDRATE_RSP_STATUS_OFFSET] != BAUDRATE_CHANGE_SUCCESS) ++ { ++ fprintf(stderr, "%s: Set Baudrate request failed - 0x%x\n", __FUNCTION__, ++ rsp[CMD_STATUS_OFFSET]); ++ err = -1; ++ } ++ break; ++ default: ++ fprintf(stderr, "%s: Not a valid status!!!\n", __FUNCTION__); ++ err = -1; ++ break; ++ } ++ ++failed: ++ return err; ++} ++ ++ ++/* ++ * Read an VS HCI event from the given file descriptor. ++ */ ++int read_vs_hci_event(int fd, unsigned char* buf, int size) ++{ ++ int remain, r; ++ int count = 0; ++ ++ if (size <= 0) { ++ fprintf(stderr, "Invalid size arguement!\n"); ++ return -1; ++ } ++ ++ fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n", __FUNCTION__); ++ ++ /* The first byte identifies the packet type. For HCI event packets, it ++ * should be 0x04, so we read until we get to the 0x04. */ ++ /* It will keep reading until find 0x04 byte */ ++ while (1) { ++ r = read(fd, buf, 1); ++ if (r <= 0) ++ return -1; ++ if (buf[0] == 0x04) ++ break; ++ } ++ count++; ++ ++ fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, buf[0] - 0x%x\n", __FUNCTION__, buf[0]); ++ /* The next two bytes are the event code and parameter total length. */ ++ while (count < 3) { ++ r = read(fd, buf + count, 3 - count); ++ if ((r <= 0) || (buf[1] != 0xFF )) { ++ fprintf(stderr, "It is not VS event !!\n"); ++ return -1; ++ } ++ count += r; ++ } ++ ++ fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, buf[1] - 0x%x\n", __FUNCTION__, buf[1]); ++ /* Now we read the parameters. */ ++ if (buf[2] < (size - 3)) ++ remain = buf[2]; ++ else ++ remain = size - 3; ++ ++ while ((count - 3) < remain) { ++ r = read(fd, buf + count, remain - (count - 3)); ++ if (r <= 0) ++ return -1; ++ count += r; ++ } ++ ++ /* Check if the set patch command is successful or not */ ++ if(get_vs_hci_event(buf) != HCI_CMD_SUCCESS) ++ return -1; ++ ++ fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, count - 0x%x\n", __FUNCTION__, count); ++ return count; ++} ++ ++ ++int hci_send_vs_cmd(int fd, unsigned char *cmd, unsigned char *rsp, int size) ++{ ++ int ret = 0; ++ ++ /* Send the HCI command packet to UART for transmission */ ++ ret = write(fd, cmd, size); ++ if (ret != size) { ++ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, ret); ++ goto failed; ++ } ++ ++ /* Check for response from the Controller */ ++ if (read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE) < 0) { ++ ret = -ETIMEDOUT; ++ fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); ++ goto failed; ++ } ++ ++ fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); ++failed: ++ return ret; ++} ++ ++void frame_hci_cmd_pkt( ++ unsigned char *cmd, ++ int edl_cmd, unsigned int p_base_addr, ++ int segtNo, int size ++ ) ++{ ++ int offset = 0; ++ hci_command_hdr *cmd_hdr; ++ ++ memset(cmd, 0x0, HCI_MAX_CMD_SIZE); ++ ++ cmd_hdr = (void *) (cmd + 1); ++ ++ cmd[0] = HCI_COMMAND_PKT; ++ cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, HCI_PATCH_CMD_OCF); ++ cmd_hdr->plen = size; ++ cmd[4] = edl_cmd; ++ ++ switch (edl_cmd) ++ { ++ case EDL_PATCH_SET_REQ_CMD: ++ /* Copy the patch header info as CMD params */ ++ memcpy(&cmd[5], phdr_buffer, PATCH_HDR_LEN); ++ fprintf(stderr, "%s: Sending EDL_PATCH_SET_REQ_CMD\n", __FUNCTION__); ++ fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); ++ break; ++ case EDL_PATCH_DLD_REQ_CMD: ++ offset = ((segtNo - 1) * MAX_DATA_PER_SEGMENT); ++ p_base_addr += offset; ++ cmd_hdr->plen = (size + 6); ++ cmd[5] = (size + 4); ++ cmd[6] = EXTRACT_BYTE(p_base_addr, 0); ++ cmd[7] = EXTRACT_BYTE(p_base_addr, 1); ++ cmd[8] = EXTRACT_BYTE(p_base_addr, 2); ++ cmd[9] = EXTRACT_BYTE(p_base_addr, 3); ++ memcpy(&cmd[10], (pdata_buffer + offset), size); ++ ++ fprintf(stderr, "%s: Sending EDL_PATCH_DLD_REQ_CMD: size: %d bytes\n", ++ __FUNCTION__, size); ++ fprintf(stderr, "HCI-CMD %d:\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t" ++ "0x%x\t0x%x\t0x%x\t\n", segtNo, cmd[0], cmd[1], cmd[2], ++ cmd[3], cmd[4], cmd[5], cmd[6], cmd[7], cmd[8], cmd[9]); ++ break; ++ case EDL_PATCH_ATCH_REQ_CMD: ++ fprintf(stderr, "%s: Sending EDL_PATCH_ATTACH_REQ_CMD\n", __FUNCTION__); ++ fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); ++ break; ++ case EDL_PATCH_RST_REQ_CMD: ++ fprintf(stderr, "%s: Sending EDL_PATCH_RESET_REQ_CMD\n", __FUNCTION__); ++ fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); ++ break; ++ case EDL_PATCH_VER_REQ_CMD: ++ fprintf(stderr, "%s: Sending EDL_PATCH_VER_REQ_CMD\n", __FUNCTION__); ++ fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]); ++ break; ++ case EDL_PATCH_TLV_REQ_CMD: ++ fprintf(stderr, "%s: Sending EDL_PATCH_TLV_REQ_CMD\n", __FUNCTION__); ++ /* Parameter Total Length */ ++ cmd[3] = size +2; ++ ++ /* TLV Segment Length */ ++ cmd[5] = size; ++ fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n", ++ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5]); ++ offset = (segtNo * MAX_SIZE_PER_TLV_SEGMENT); ++ memcpy(&cmd[6], (pdata_buffer + offset), size); ++ break; ++ default: ++ fprintf(stderr, "%s: Unknown EDL CMD !!!\n", __FUNCTION__); ++ } ++} ++ ++void rome_extract_patch_header_info(unsigned char *buf) ++{ ++ int index; ++ ++ /* Extract patch id */ ++ for (index = 0; index < 4; index++) ++ rampatch_patch_info.patch_id |= ++ (LSH(buf[index + P_ID_OFFSET], (index * 8))); ++ ++ /* Extract (ROM and BUILD) version information */ ++ for (index = 0; index < 2; index++) ++ rampatch_patch_info.patch_ver.rom_version |= ++ (LSH(buf[index + P_ROME_VER_OFFSET], (index * 8))); ++ ++ for (index = 0; index < 2; index++) ++ rampatch_patch_info.patch_ver.build_version |= ++ (LSH(buf[index + P_BUILD_VER_OFFSET], (index * 8))); ++ ++ /* Extract patch base and entry addresses */ ++ for (index = 0; index < 4; index++) ++ rampatch_patch_info.patch_base_addr |= ++ (LSH(buf[index + P_BASE_ADDR_OFFSET], (index * 8))); ++ ++ /* Patch BASE & ENTRY addresses are same */ ++ rampatch_patch_info.patch_entry_addr = rampatch_patch_info.patch_base_addr; ++ ++ /* Extract total length of the patch payload */ ++ for (index = 0; index < 4; index++) ++ rampatch_patch_info.patch_length |= ++ (LSH(buf[index + P_LEN_OFFSET], (index * 8))); ++ ++ /* Extract the CRC checksum of the patch payload */ ++ for (index = 0; index < 4; index++) ++ rampatch_patch_info.patch_crc |= ++ (LSH(buf[index + P_CRC_OFFSET], (index * 8))); ++ ++ /* Extract patch control value */ ++ for (index = 0; index < 4; index++) ++ rampatch_patch_info.patch_ctrl |= ++ (LSH(buf[index + P_CONTROL_OFFSET], (index * 8))); ++ ++ fprintf(stderr, "PATCH_ID\t : 0x%x\n", rampatch_patch_info.patch_id); ++ fprintf(stderr, "ROM_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.rom_version); ++ fprintf(stderr, "BUILD_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.build_version); ++ fprintf(stderr, "PATCH_LENGTH\t : 0x%x\n", rampatch_patch_info.patch_length); ++ fprintf(stderr, "PATCH_CRC\t : 0x%x\n", rampatch_patch_info.patch_crc); ++ fprintf(stderr, "PATCH_CONTROL\t : 0x%x\n", rampatch_patch_info.patch_ctrl); ++ fprintf(stderr, "PATCH_BASE_ADDR\t : 0x%x\n", rampatch_patch_info.patch_base_addr); ++ ++} ++ ++int rome_edl_set_patch_request(int fd) ++{ ++ int size, err; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ ++ /* Frame the HCI CMD to be sent to the Controller */ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_SET_REQ_CMD, 0, ++ -1, PATCH_HDR_LEN + 1); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); ++ if ( err != size) { ++ fprintf(stderr, "Failed to set the patch info to the Controller!\n"); ++ goto error; ++ } ++ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); ++ goto error; ++ } ++ fprintf(stderr, "%s: Successfully set patch info on the Controller\n", __FUNCTION__); ++error: ++ return err; ++} ++ ++int rome_edl_patch_download_request(int fd) ++{ ++ int no_of_patch_segment; ++ int index = 1, err = 0, size = 0; ++ unsigned int p_base_addr; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ ++ no_of_patch_segment = (rampatch_patch_info.patch_length / ++ MAX_DATA_PER_SEGMENT); ++ fprintf(stderr, "%s: %d patch segments to be d'loaded from patch base addr: 0x%x\n", ++ __FUNCTION__, no_of_patch_segment, ++ rampatch_patch_info.patch_base_addr); ++ ++ /* Initialize the patch base address from the one read from bin file */ ++ p_base_addr = rampatch_patch_info.patch_base_addr; ++ ++ /* ++ * Depending upon size of the patch payload, download the patches in ++ * segments with a max. size of 239 bytes ++ */ ++ for (index = 1; index <= no_of_patch_segment; index++) { ++ ++ fprintf(stderr, "%s: Downloading patch segment: %d\n", __FUNCTION__, index); ++ ++ /* Frame the HCI CMD PKT to be sent to Controller*/ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_DLD_REQ_CMD, p_base_addr, ++ index, MAX_DATA_PER_SEGMENT); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ ++ /* Initialize the RSP packet everytime to 0 */ ++ memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); ++ ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); ++ if ( err != size) { ++ fprintf(stderr, "Failed to send the patch payload to the Controller!\n"); ++ goto error; ++ } ++ ++ /* Read Command Complete Event */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to downlaod patch segment: %d!\n", ++ __FUNCTION__, index); ++ goto error; ++ } ++ fprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", ++ __FUNCTION__, index); ++ } ++ ++ /* Check if any pending patch data to be sent */ ++ size = (rampatch_patch_info.patch_length < MAX_DATA_PER_SEGMENT) ? ++ rampatch_patch_info.patch_length : ++ (rampatch_patch_info.patch_length % MAX_DATA_PER_SEGMENT); ++ ++ if (size) ++ { ++ /* Frame the HCI CMD PKT to be sent to Controller*/ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_DLD_REQ_CMD, p_base_addr, index, size); ++ ++ /* Initialize the RSP packet everytime to 0 */ ++ memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); ++ if ( err != size) { ++ fprintf(stderr, "Failed to send the patch payload to the Controller!\n"); ++ goto error; ++ } ++ ++ /* Read Command Complete Event */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to downlaod patch segment: %d!\n", ++ __FUNCTION__, index); ++ goto error; ++ } ++ ++ fprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", ++ __FUNCTION__, index); ++ } ++ ++error: ++ return err; ++} ++ ++static int rome_download_rampatch(int fd) ++{ ++ int c, size, index, ret = -1; ++ ++ fprintf(stderr, "%s:\n", __FUNCTION__); ++ ++ /* Get handle to the RAMPATCH binary file */ ++ fprintf(stderr, "%s: Getting handle to the RAMPATCH binary file from %s\n", __FUNCTION__, ROME_FW_PATH); ++ file = fopen(ROME_FW_PATH, "r"); ++ if (file == NULL) { ++ fprintf(stderr, "%s: Failed to get handle to the RAMPATCH bin file!\n", ++ __FUNCTION__); ++ return -ENFILE; ++ } ++ ++ /* Allocate memory for the patch headder info */ ++ fprintf(stderr, "%s: Allocating memory for the patch header\n", __FUNCTION__); ++ phdr_buffer = (unsigned char *) malloc(PATCH_HDR_LEN + 1); ++ if (phdr_buffer == NULL) { ++ fprintf(stderr, "%s: Failed to allocate memory for patch header\n", ++ __FUNCTION__); ++ goto phdr_alloc_failed; ++ } ++ for (index = 0; index < PATCH_HDR_LEN + 1; index++) ++ phdr_buffer[index] = 0x0; ++ ++ /* Read 28 bytes of patch header information */ ++ fprintf(stderr, "%s: Reading patch header info\n", __FUNCTION__); ++ index = 0; ++ do { ++ c = fgetc (file); ++ phdr_buffer[index++] = (unsigned char)c; ++ } while (index != PATCH_HDR_LEN); ++ ++ /* Save the patch header info into local structure */ ++ fprintf(stderr, "%s: Saving patch hdr. info\n", __FUNCTION__); ++ rome_extract_patch_header_info((unsigned char *)phdr_buffer); ++ ++ /* Set the patch header info onto the Controller */ ++ ret = rome_edl_set_patch_request(fd); ++ if (ret < 0) { ++ fprintf(stderr, "%s: Error setting the patchheader info!\n", __FUNCTION__); ++ goto pdata_alloc_failed; ++ } ++ ++ /* Allocate memory for the patch payload */ ++ fprintf(stderr, "%s: Allocating memory for patch payload\n", __FUNCTION__); ++ size = rampatch_patch_info.patch_length; ++ pdata_buffer = (unsigned char *) malloc(size+1); ++ if (pdata_buffer == NULL) { ++ fprintf(stderr, "%s: Failed to allocate memory for patch payload\n", ++ __FUNCTION__); ++ goto pdata_alloc_failed; ++ } ++ for (index = 0; index < size+1; index++) ++ pdata_buffer[index] = 0x0; ++ ++ /* Read the patch data from Rampatch binary image */ ++ fprintf(stderr, "%s: Reading patch payload from RAMPATCH file\n", __FUNCTION__); ++ index = 0; ++ do { ++ c = fgetc (file); ++ pdata_buffer[index++] = (unsigned char)c; ++ } while (c != EOF); ++ ++ /* Downloading patches in segments to controller */ ++ ret = rome_edl_patch_download_request(fd); ++ if (ret < 0) { ++ fprintf(stderr, "%s: Error downloading patch segments!\n", __FUNCTION__); ++ goto cleanup; ++ } ++cleanup: ++ free(pdata_buffer); ++pdata_alloc_failed: ++ free(phdr_buffer); ++phdr_alloc_failed: ++ fclose(file); ++ ++ return ret; ++} ++ ++int rome_attach_rampatch(int fd) ++{ ++ int size, err; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ ++ /* Frame the HCI CMD to be sent to the Controller */ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_ATCH_REQ_CMD, 0, ++ -1, EDL_PATCH_CMD_LEN); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); ++ if ( err != size) { ++ fprintf(stderr, "Failed to attach the patch payload to the Controller!\n"); ++ goto error; ++ } ++ ++ /* Read Command Complete Event */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to attach the patch segment(s)\n", __FUNCTION__); ++ goto error; ++ } ++error: ++ return err; ++} ++ ++int rome_rampatch_reset(int fd) ++{ ++ int size, err = 0; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ struct timespec tm = { 0, 100*1000*1000 }; /* 100 ms */ ++ ++ /* Frame the HCI CMD to be sent to the Controller */ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_RST_REQ_CMD, 0, ++ -1, EDL_PATCH_CMD_LEN); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); ++ ++ /* Send HCI Command packet to Controller */ ++ err = write(fd, cmd, size); ++ if (err != size) { ++ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); ++ goto error; ++ } ++ ++ /* ++ * Controller doesn't sends any response for the patch reset ++ * command. HOST has to wait for 100ms before proceeding. ++ */ ++ nanosleep(&tm, NULL); ++ ++error: ++ return err; ++} ++ ++int rome_get_tlv_file(char *file_path) ++{ ++ FILE * pFile; ++ long fileSize; ++ int readSize, nvm_length, nvm_index, i; ++ unsigned short nvm_tag_len; ++ tlv_patch_info *ptlv_header; ++ tlv_nvm_hdr *nvm_ptr; ++ unsigned char data_buf[PRINT_BUF_SIZE]={0,}; ++ unsigned char *nvm_byte_ptr; ++ ++ fprintf(stderr, "File Open (%s)\n", file_path); ++ pFile = fopen ( file_path , "r" ); ++ if (pFile==NULL) {; ++ fprintf(stderr, "%s File Open Fail\n", file_path); ++ return -1; ++ } ++ ++ /* Get File Size */ ++ fseek (pFile , 0 , SEEK_END); ++ fileSize = ftell (pFile); ++ rewind (pFile); ++ ++ pdata_buffer = (unsigned char*) malloc (sizeof(char)*fileSize); ++ if (pdata_buffer == NULL) { ++ fprintf(stderr, "Allocated Memory failed\n"); ++ fclose (pFile); ++ return -1; ++ } ++ ++ /* Copy file into allocated buffer */ ++ readSize = fread (pdata_buffer,1,fileSize,pFile); ++ ++ /* File Close */ ++ fclose (pFile); ++ ++ if (readSize != fileSize) { ++ fprintf(stderr, "Read file size(%d) not matched with actual file size (%ld bytes)\n",readSize,fileSize); ++ return -1; ++ } ++ ++ ptlv_header = (tlv_patch_info *) pdata_buffer; ++ ++ /* To handle different event between rampatch and NVM */ ++ gTlv_type = ptlv_header->tlv_type; ++ ++ if(ptlv_header->tlv_type == TLV_TYPE_PATCH){ ++ fprintf(stderr, "====================================================\n"); ++ fprintf(stderr, "TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type); ++ fprintf(stderr, "Length\t\t\t : %d bytes\n", (ptlv_header->tlv_length1) | ++ (ptlv_header->tlv_length2 << 8) | ++ (ptlv_header->tlv_length3 << 16)); ++ fprintf(stderr, "Total Length\t\t\t : %d bytes\n", ptlv_header->tlv_data_len); ++ fprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv_patch_data_len); ++ fprintf(stderr, "Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver); ++ fprintf(stderr, "Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm); ++ fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1); ++ fprintf(stderr, "Product ID\t\t\t : 0x%04x\n", ptlv_header->tlv.patch.prod_id); ++ fprintf(stderr, "Rom Build Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.build_ver); ++ fprintf(stderr, "Patch Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.patch_ver); ++ fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved2); ++ fprintf(stderr, "Patch Entry Address\t\t : 0x%x\n", (ptlv_header->tlv.patch.patch_entry_addr)); ++ fprintf(stderr, "====================================================\n"); ++ ++ } else if(ptlv_header->tlv_type == TLV_TYPE_NVM) { ++ fprintf(stderr, "====================================================\n"); ++ fprintf(stderr, "TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type); ++ fprintf(stderr, "Length\t\t\t : %d bytes\n", nvm_length = (ptlv_header->tlv_length1) | ++ (ptlv_header->tlv_length2 << 8) | ++ (ptlv_header->tlv_length3 << 16)); ++ ++ if(nvm_length <= 0) ++ return readSize; ++ ++ for(nvm_byte_ptr=(unsigned char *)(nvm_ptr = &(ptlv_header->tlv.nvm)), nvm_index=0; ++ nvm_index < nvm_length ; nvm_ptr = (tlv_nvm_hdr *) nvm_byte_ptr) ++ { ++ fprintf(stderr, "TAG ID\t\t\t : %d\n", nvm_ptr->tag_id); ++ fprintf(stderr, "TAG Length\t\t\t : %d\n", nvm_tag_len = nvm_ptr->tag_len); ++ fprintf(stderr, "TAG Pointer\t\t\t : %d\n", nvm_ptr->tag_ptr); ++ fprintf(stderr, "TAG Extended Flag\t\t : %d\n", nvm_ptr->tag_ex_flag); ++ ++ /* Increase nvm_index to NVM data */ ++ nvm_index+=sizeof(tlv_nvm_hdr); ++ nvm_byte_ptr+=sizeof(tlv_nvm_hdr); ++ ++ /* Write BD Address */ ++ if(nvm_ptr->tag_id == TAG_NUM_2){ ++ memcpy(nvm_byte_ptr, vnd_local_bd_addr, 6); ++ fprintf(stderr, "BD Address: %.02x:%.02x:%.02x:%.02x:%.02x:%.02x\n", ++ *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2), ++ *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5)); ++ } ++ ++ for(i =0;(itag_len && (i*3 + 2) tag_len; ++ nvm_byte_ptr +=nvm_ptr->tag_len; ++ } ++ ++ fprintf(stderr, "====================================================\n"); ++ ++ } else { ++ fprintf(stderr, "TLV Header type is unknown (%d) \n", ptlv_header->tlv_type); ++ } ++ ++ return readSize; ++} ++ ++int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc_evt) ++{ ++ int size=0, err = -1; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ ++ fprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d\n", __FUNCTION__, index, seg_size); ++ ++ /* Frame the HCI CMD PKT to be sent to Controller*/ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_TLV_REQ_CMD, 0, index, seg_size); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ ++ /* Initialize the RSP packet everytime to 0 */ ++ memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); ++ ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); ++ if ( err != size) { ++ fprintf(stderr, "Failed to send the patch payload to the Controller! 0x%x\n", err); ++ return err; ++ } ++ ++ if(wait_cc_evt) { ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to downlaod patch segment: %d!\n", __FUNCTION__, index); ++ return err; ++ } ++ } ++ ++ fprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", __FUNCTION__, index); ++ return err; ++} ++ ++int rome_tlv_dnld_req(int fd, int tlv_size) ++{ ++ int total_segment, remain_size, i, err = -1; ++ unsigned char wait_cc_evt; ++ ++ total_segment = tlv_size/MAX_SIZE_PER_TLV_SEGMENT; ++ remain_size = (tlv_size < MAX_SIZE_PER_TLV_SEGMENT)?\ ++ tlv_size: (tlv_size%MAX_SIZE_PER_TLV_SEGMENT); ++ ++ fprintf(stderr, "%s: TLV size: %d, Total Seg num: %d, remain size: %d\n", ++ __FUNCTION__,tlv_size, total_segment, remain_size); ++ ++ for(i=0;i= ROME_VER_1_1) && (gTlv_type == TLV_TYPE_PATCH ) ++ && !remain_size && ((i+1) == total_segment))? FALSE: TRUE; ++ if((err = rome_tlv_dnld_segment(fd, i, MAX_SIZE_PER_TLV_SEGMENT, wait_cc_evt )) < 0) ++ goto error; ++ } ++ ++ /* In case remain data still remain, last rampatch segment command will not wait ++ for command complete event here */ ++ wait_cc_evt = ((rome_ver >= ROME_VER_1_1) && (gTlv_type == TLV_TYPE_PATCH ) ++ && remain_size )? FALSE:TRUE; ++ ++ if(remain_size) err =rome_tlv_dnld_segment(fd, i, remain_size, wait_cc_evt); ++ ++error: ++ return err; ++} ++ ++int rome_download_tlv_file(int fd) ++{ ++ int tlv_size, err = -1; ++ ++ /* Rampatch TLV file Downloading */ ++ pdata_buffer = NULL; ++ ++ if((tlv_size = rome_get_tlv_file(rampatch_file_path)) < 0) ++ goto error; ++ ++ if((err =rome_tlv_dnld_req(fd, tlv_size)) <0 ) ++ goto error; ++ ++ if (pdata_buffer != NULL){ ++ free (pdata_buffer); ++ pdata_buffer = NULL; ++ } ++ ++ /* NVM TLV file Downloading */ ++ if((tlv_size = rome_get_tlv_file(nvm_file_path)) < 0) ++ goto error; ++ ++ if((err =rome_tlv_dnld_req(fd, tlv_size)) <0 ) ++ goto error; ++ ++error: ++ if (pdata_buffer != NULL) ++ free (pdata_buffer); ++ ++ return err; ++} ++ ++int rome_1_0_nvm_tag_dnld(int fd) ++{ ++ int i, size, err = 0; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ ++#if (NVM_VERSION >= ROME_1_0_100019) ++ unsigned char cmds[MAX_TAG_CMD][HCI_MAX_CMD_SIZE] = ++ { ++ /* Tag 2 */ /* BD Address */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 9, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 2, ++ /* Tag Len */ 6, ++ /* Tag Value */ 0x77,0x78,0x23,0x01,0x56,0x22 ++ }, ++ /* Tag 6 */ /* Bluetooth Support Features */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 11, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 6, ++ /* Tag Len */ 8, ++ /* Tag Value */ 0xFF,0xFE,0x8B,0xFE,0xD8,0x3F,0x5B,0x8B ++ }, ++ /* Tag 17 */ /* HCI Transport Layer Setting */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 11, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 17, ++ /* Tag Len */ 8, ++ /* Tag Value */ 0x82,0x01,0x0E,0x08,0x04,0x32,0x0A,0x00 ++ }, ++ /* Tag 35 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 58, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 35, ++ /* Tag Len */ 55, ++ /* Tag Value */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x58, 0x59, ++ 0x0E, 0x0E, 0x16, 0x16, 0x16, 0x1E, 0x26, 0x5F, 0x2F, 0x5F, ++ 0x0E, 0x0E, 0x16, 0x16, 0x16, 0x1E, 0x26, 0x5F, 0x2F, 0x5F, ++ 0x0C, 0x18, 0x14, 0x24, 0x40, 0x4C, 0x70, 0x80, 0x80, 0x80, ++ 0x0C, 0x18, 0x14, 0x24, 0x40, 0x4C, 0x70, 0x80, 0x80, 0x80, ++ 0x1B, 0x14, 0x01, 0x04, 0x48 ++ }, ++ /* Tag 36 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 15, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 36, ++ /* Tag Len */ 12, ++ /* Tag Value */ 0x0F,0x00,0x03,0x03,0x03,0x03,0x00,0x00,0x03,0x03,0x04,0x00 ++ }, ++ /* Tag 39 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 7, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 39, ++ /* Tag Len */ 4, ++ /* Tag Value */ 0x12,0x00,0x00,0x00 ++ }, ++ /* Tag 41 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 91, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 41, ++ /* Tag Len */ 88, ++ /* Tag Value */ 0x15, 0x00, 0x00, 0x00, 0xF6, 0x02, 0x00, 0x00, 0x76, 0x00, ++ 0x1E, 0x00, 0x29, 0x02, 0x1F, 0x00, 0x61, 0x00, 0x1A, 0x00, ++ 0x76, 0x00, 0x1E, 0x00, 0x7D, 0x00, 0x40, 0x00, 0x91, 0x00, ++ 0x06, 0x00, 0x92, 0x00, 0x03, 0x00, 0xA6, 0x01, 0x50, 0x00, ++ 0xAA, 0x01, 0x15, 0x00, 0xAB, 0x01, 0x0A, 0x00, 0xAC, 0x01, ++ 0x00, 0x00, 0xB0, 0x01, 0xC5, 0x00, 0xB3, 0x01, 0x03, 0x00, ++ 0xB4, 0x01, 0x13, 0x00, 0xB5, 0x01, 0x0C, 0x00, 0xC5, 0x01, ++ 0x0D, 0x00, 0xC6, 0x01, 0x10, 0x00, 0xCA, 0x01, 0x2B, 0x00, ++ 0xCB, 0x01, 0x5F, 0x00, 0xCC, 0x01, 0x48, 0x00 ++ }, ++ /* Tag 42 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 63, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 42, ++ /* Tag Len */ 60, ++ /* Tag Value */ 0xD7, 0xC0, 0x00, 0x00, 0x8F, 0x5C, 0x02, 0x00, 0x80, 0x47, ++ 0x60, 0x0C, 0x70, 0x4C, 0x00, 0x00, 0x00, 0x01, 0x1F, 0x01, ++ 0x42, 0x01, 0x69, 0x01, 0x95, 0x01, 0xC7, 0x01, 0xFE, 0x01, ++ 0x3D, 0x02, 0x83, 0x02, 0xD1, 0x02, 0x29, 0x03, 0x00, 0x0A, ++ 0x10, 0x00, 0x1F, 0x00, 0x3F, 0x00, 0x7F, 0x00, 0xFD, 0x00, ++ 0xF9, 0x01, 0xF1, 0x03, 0xDE, 0x07, 0x00, 0x00, 0x9A, 0x01 ++ }, ++ /* Tag 84 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 153, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 84, ++ /* Tag Len */ 150, ++ /* Tag Value */ 0x7C, 0x6A, 0x59, 0x47, 0x19, 0x36, 0x35, 0x25, 0x25, 0x28, ++ 0x2C, 0x2B, 0x2B, 0x28, 0x2C, 0x28, 0x29, 0x28, 0x29, 0x28, ++ 0x29, 0x29, 0x2C, 0x29, 0x2C, 0x29, 0x2C, 0x28, 0x29, 0x28, ++ 0x29, 0x28, 0x29, 0x2A, 0x00, 0x00, 0x2C, 0x2A, 0x2C, 0x18, ++ 0x98, 0x98, 0x98, 0x98, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, ++ 0x1E, 0x13, 0x1E, 0x1E, 0x1E, 0x1E, 0x13, 0x13, 0x11, 0x13, ++ 0x1E, 0x1E, 0x13, 0x12, 0x12, 0x12, 0x11, 0x12, 0x1F, 0x12, ++ 0x12, 0x12, 0x10, 0x0C, 0x18, 0x0D, 0x01, 0x01, 0x01, 0x01, ++ 0x01, 0x01, 0x01, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x0D, 0x0D, ++ 0x0E, 0x0D, 0x01, 0x01, 0x0D, 0x0D, 0x0D, 0x0D, 0x0F, 0x0D, ++ 0x10, 0x0D, 0x0D, 0x0D, 0x0D, 0x10, 0x05, 0x10, 0x03, 0x00, ++ 0x7E, 0x7B, 0x7B, 0x72, 0x71, 0x50, 0x50, 0x50, 0x00, 0x40, ++ 0x60, 0x60, 0x30, 0x08, 0x02, 0x0F, 0x00, 0x01, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x08, 0x16, 0x16, 0x08, 0x08, 0x00, ++ 0x00, 0x00, 0x1E, 0x34, 0x2B, 0x1B, 0x23, 0x2B, 0x15, 0x0D ++ }, ++ /* Tag 85 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 119, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 85, ++ /* Tag Len */ 116, ++ /* Tag Value */ 0x03, 0x00, 0x38, 0x00, 0x45, 0x77, 0x00, 0xE8, 0x00, 0x59, ++ 0x01, 0xCA, 0x01, 0x3B, 0x02, 0xAC, 0x02, 0x1D, 0x03, 0x8E, ++ 0x03, 0x00, 0x89, 0x01, 0x0E, 0x02, 0x5C, 0x02, 0xD7, 0x02, ++ 0xF8, 0x08, 0x01, 0x00, 0x1F, 0x00, 0x0A, 0x02, 0x55, 0x02, ++ 0x00, 0x35, 0x00, 0x00, 0x00, 0x00, 0x2A, 0xD7, 0x00, 0x00, ++ 0x00, 0x1E, 0xDE, 0x00, 0x00, 0x00, 0x14, 0x0F, 0x0A, 0x0F, ++ 0x0A, 0x0C, 0x0C, 0x0C, 0x0C, 0x04, 0x04, 0x04, 0x0C, 0x0C, ++ 0x0C, 0x0C, 0x06, 0x06, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, ++ 0x01, 0x00, 0x02, 0x02, 0x02, 0x02, 0x01, 0x00, 0x00, 0x00, ++ 0x06, 0x0F, 0x14, 0x05, 0x47, 0xCF, 0x77, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0xAC, 0x7C, 0xFF, 0x40, 0x00, 0x00, 0x00, ++ 0x12, 0x04, 0x04, 0x01, 0x04, 0x03 ++ }, ++ {TAG_END} ++ }; ++#elif (NVM_VERSION == ROME_1_0_6002) ++ unsigned char cmds[MAX_TAG_CMD][HCI_MAX_CMD_SIZE] = ++ { ++ /* Tag 2 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 9, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 2, ++ /* Tag Len */ 6, ++ /* Tag Value */ 0x77,0x78,0x23,0x01,0x56,0x22 /* BD Address */ ++ }, ++ /* Tag 6 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 11, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 6, ++ /* Tag Len */ 8, ++ /* Tag Value */ 0xFF,0xFE,0x8B,0xFE,0xD8,0x3F,0x5B,0x8B ++ }, ++ /* Tag 17 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 11, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 17, ++ /* Tag Len */ 8, ++ /* Tag Value */ 0x82,0x01,0x0E,0x08,0x04,0x32,0x0A,0x00 ++ }, ++ /* Tag 36 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 15, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 36, ++ /* Tag Len */ 12, ++ /* Tag Value */ 0x0F,0x00,0x03,0x03,0x03,0x03,0x00,0x00,0x03,0x03,0x04,0x00 ++ }, ++ ++ /* Tag 39 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 7, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 39, ++ /* Tag Len */ 4, ++ /* Tag Value */ 0x12,0x00,0x00,0x00 ++ }, ++ ++ /* Tag 41 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 199, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 41, ++ /* Tag Len */ 196, ++ /* Tag Value */ 0x30,0x00,0x00,0x00,0xD5,0x00,0x0E,0x00,0xD6,0x00,0x0E,0x00, ++ 0xD7,0x00,0x16,0x00,0xD8,0x00,0x16,0x00,0xD9,0x00,0x16,0x00, ++ 0xDA,0x00,0x1E,0x00,0xDB,0x00,0x26,0x00,0xDC,0x00,0x5F,0x00, ++ 0xDD,0x00,0x2F,0x00,0xDE,0x00,0x5F,0x00,0xE0,0x00,0x0E,0x00, ++ 0xE1,0x00,0x0E,0x00,0xE2,0x00,0x16,0x00,0xE3,0x00,0x16,0x00, ++ 0xE4,0x00,0x16,0x00,0xE5,0x00,0x1E,0x00,0xE6,0x00,0x26,0x00, ++ 0xE7,0x00,0x5F,0x00,0xE8,0x00,0x2F,0x00,0xE9,0x00,0x5F,0x00, ++ 0xEC,0x00,0x0C,0x00,0xED,0x00,0x08,0x00,0xEE,0x00,0x14,0x00, ++ 0xEF,0x00,0x24,0x00,0xF0,0x00,0x40,0x00,0xF1,0x00,0x4C,0x00, ++ 0xF2,0x00,0x70,0x00,0xF3,0x00,0x80,0x00,0xF4,0x00,0x80,0x00, ++ 0xF5,0x00,0x80,0x00,0xF8,0x00,0x0C,0x00,0xF9,0x00,0x18,0x00, ++ 0xFA,0x00,0x14,0x00,0xFB,0x00,0x24,0x00,0xFC,0x00,0x40,0x00, ++ 0xFD,0x00,0x4C,0x00,0xFE,0x00,0x70,0x00,0xFF,0x00,0x80,0x00, ++ 0x00,0x01,0x80,0x00,0x01,0x01,0x80,0x00,0x04,0x01,0x1B,0x00, ++ 0x05,0x01,0x14,0x00,0x06,0x01,0x01,0x00,0x07,0x01,0x04,0x00, ++ 0x08,0x01,0x00,0x00,0x09,0x01,0x00,0x00,0x0A,0x01,0x03,0x00, ++ 0x0B,0x01,0x03,0x00 ++ }, ++ ++ /* Tag 44 */ ++ { /* Packet Type */HCI_COMMAND_PKT, ++ /* Opcode */ 0x0b,0xfc, ++ /* Total Len */ 44, ++ /* NVM CMD */ NVM_ACCESS_SET, ++ /* Tag Num */ 44, ++ /* Tag Len */ 41, ++ /* Tag Value */ 0x6F,0x0A,0x00,0x00,0x00,0x00,0x00,0x50,0xFF,0x10,0x02,0x02, ++ 0x01,0x00,0x14,0x01,0x06,0x28,0xA0,0x62,0x03,0x64,0x01,0x01, ++ 0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0xFF,0x10,0x02,0x01, ++ 0x00,0x14,0x01,0x02,0x03 ++ }, ++ {TAG_END} ++ }; ++#endif ++ ++ fprintf(stderr, "%s: Start sending NVM Tags (ver: 0x%x)\n", __FUNCTION__, (unsigned int) NVM_VERSION); ++ ++ for (i=0; (i < MAX_TAG_CMD) && (cmds[i][0] != TAG_END); i++) ++ { ++ /* Write BD Address */ ++ if(cmds[i][TAG_NUM_OFFSET] == TAG_NUM_2){ ++ memcpy(&cmds[i][TAG_BDADDR_OFFSET], vnd_local_bd_addr, 6); ++ fprintf(stderr, "BD Address: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", ++ cmds[i][TAG_BDADDR_OFFSET ], cmds[i][TAG_BDADDR_OFFSET + 1], ++ cmds[i][TAG_BDADDR_OFFSET + 2], cmds[i][TAG_BDADDR_OFFSET + 3], ++ cmds[i][TAG_BDADDR_OFFSET + 4], cmds[i][TAG_BDADDR_OFFSET + 5]); ++ } ++ size = cmds[i][3] + HCI_COMMAND_HDR_SIZE + 1; ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)&cmds[i][0], rsp, size); ++ if ( err != size) { ++ fprintf(stderr, "Failed to attach the patch payload to the Controller!\n"); ++ goto error; ++ } ++ ++ /* Read Command Complete Event - This is extra routine for ROME 1.0. From ROM 2.0, it should be removed. */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to get patch version(s)\n", __FUNCTION__); ++ goto error; ++ } ++ } ++ ++error: ++ return err; ++} ++ ++ ++ ++int rome_patch_ver_req(int fd) ++{ ++ int size, err = 0; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ ++ /* Frame the HCI CMD to be sent to the Controller */ ++ frame_hci_cmd_pkt(cmd, EDL_PATCH_VER_REQ_CMD, 0, ++ -1, EDL_PATCH_CMD_LEN); ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); ++ ++ /* Send HCI Command packet to Controller */ ++ err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); ++ if ( err != size) { ++ fprintf(stderr, "Failed to attach the patch payload to the Controller!\n"); ++ goto error; ++ } ++ ++ /* Read Command Complete Event - This is extra routine for ROME 1.0. From ROM 2.0, it should be removed. */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to get patch version(s)\n", __FUNCTION__); ++ goto error; ++ } ++error: ++ return err; ++ ++} ++ ++int rome_disable_sleep(int fd) ++{ ++ int size, err = 0; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ hci_command_hdr *cmd_hdr; ++ int flags; ++ ++ memset(cmd, 0x0, HCI_MAX_CMD_SIZE); ++ ++ cmd_hdr = (void *) (cmd + 1); ++ cmd[0] = HCI_COMMAND_PKT; ++ cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, NVM_ACCESS_CODE); ++ cmd_hdr->plen = VSC_DISABLE_IBS_LEN; ++ cmd[4] = 0x01; ++ cmd[5] = 0x1B; ++ cmd[6] = 0x01; ++ cmd[7] = 0x00; ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_DISABLE_IBS_LEN); ++ /* Send the HCI command packet to UART for transmission */ ++ fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7]) ; ++ err = write(fd, cmd, size); ++ if (err != size) { ++ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); ++ goto error; ++ } ++ ++ /* Check for response from the Controller */ ++ if ((err =read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) { ++ fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); ++ goto error; ++ } ++ ++ fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); ++ ++ /* Wait for command complete event */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); ++ goto error; ++ } ++ fprintf(stderr, "%s\n", __FUNCTION__); ++error: ++ return err; ++ ++} ++ ++int rome_set_baudrate_req(int fd) ++{ ++ int size, err = 0; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ hci_command_hdr *cmd_hdr; ++ int flags; ++ ++ memset(cmd, 0x0, HCI_MAX_CMD_SIZE); ++ ++ cmd_hdr = (void *) (cmd + 1); ++ cmd[0] = HCI_COMMAND_PKT; ++ cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, EDL_SET_BAUDRATE_CMD_OCF); ++ cmd_hdr->plen = VSC_SET_BAUDRATE_REQ_LEN; ++ cmd[4] = BAUDRATE_115200; ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_SET_BAUDRATE_REQ_LEN); ++ /* Send the HCI command packet to UART for transmission */ ++ fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3],cmd[4]) ; ++ err = write(fd, cmd, size); ++ if (err != size) { ++ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); ++ goto error; ++ } ++ ++ /* Check for response from the Controller */ ++ if ((err =read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) { ++ fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); ++ goto error; ++ } ++ ++ fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); ++ ++ /* Wait for command complete event */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); ++ goto error; ++ } ++ fprintf(stderr, "%s\n", __FUNCTION__); ++error: ++ return err; ++ ++} ++ ++ ++int rome_hci_reset_req(int fd) ++{ ++ int size, err = 0; ++ unsigned char cmd[HCI_MAX_CMD_SIZE]; ++ unsigned char rsp[HCI_MAX_EVENT_SIZE]; ++ hci_command_hdr *cmd_hdr; ++ int flags; ++ ++ fprintf(stderr, "%s: HCI RESET \n", __FUNCTION__); ++ ++ memset(cmd, 0x0, HCI_MAX_CMD_SIZE); ++ ++ cmd_hdr = (void *) (cmd + 1); ++ cmd[0] = HCI_COMMAND_PKT; ++ cmd_hdr->opcode = HCI_RESET; ++ cmd_hdr->plen = 0; ++ ++ /* Total length of the packet to be sent to the Controller */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE); ++ ++ /* Send the HCI command packet to UART for transmission */ ++ fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]); ++ err = write(fd, cmd, size); ++ if (err != size) { ++ fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); ++ goto error; ++ } ++ ++ /* Wait for command complete event */ ++ err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); ++ if ( err < 0) { ++ fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); ++ goto error; ++ } ++ ++error: ++ return err; ++ ++} ++ ++ ++int qca_soc_init(int fd, char *bdaddr) ++{ ++ int err = -1; ++ int size; ++ ++ fprintf(stderr, " %s \n", __FUNCTION__); ++ vnd_userial.fd = fd; ++ /* Get Rome version information */ ++ if((err = rome_patch_ver_req(fd)) <0){ ++ fprintf(stderr, "%s: Fail to get Rome Version (0x%x)\n", __FUNCTION__, err); ++ goto error; ++ } ++ ++ fprintf(stderr, "%s: Rome Version (0x%08x)\n", __FUNCTION__, rome_ver); ++ ++ switch (rome_ver){ ++ case ROME_VER_1_0: ++ { ++ /* Set and Download the RAMPATCH */ ++ fprintf(stderr, "%s: Setting Patch Header & Downloading Patches\n", __FUNCTION__); ++ err = rome_download_rampatch(fd); ++ if (err < 0) { ++ fprintf(stderr, "%s: DOWNLOAD RAMPATCH failed!\n", __FUNCTION__); ++ goto error; ++ } ++ fprintf(stderr, "%s: DOWNLOAD RAMPTACH complete\n", __FUNCTION__); ++ ++ /* Attach the RAMPATCH */ ++ fprintf(stderr, "%s: Attaching the patches\n", __FUNCTION__); ++ err = rome_attach_rampatch(fd); ++ if (err < 0) { ++ fprintf(stderr, "%s: ATTACH RAMPATCH failed!\n", __FUNCTION__); ++ goto error; ++ } ++ fprintf(stderr, "%s: ATTACH RAMPTACH complete\n", __FUNCTION__); ++ ++ /* Send Reset */ ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); ++ err = rome_rampatch_reset(fd); ++ if ( err < 0 ) { ++ fprintf(stderr, "Failed to RESET after RAMPATCH upgrade!\n"); ++ goto error; ++ } ++ ++ /* NVM download */ ++ fprintf(stderr, "%s: Downloading NVM\n", __FUNCTION__); ++ err = rome_1_0_nvm_tag_dnld(fd); ++ if ( err <0 ) { ++ fprintf(stderr, "Downloading NVM Failed !!\n"); ++ goto error; ++ } ++ ++ /* Change baud rate 115.2 kbps to 3Mbps*/ ++ err = rome_hci_reset_req(fd); ++ if ( err <0 ) { ++ fprintf(stderr, "HCI Reset Failed !!\n"); ++ goto error; ++ } ++ ++ fprintf(stderr, "HCI Reset is done\n"); ++ } ++ break; ++ case ROME_VER_1_1: ++ rampatch_file_path = ROME_RAMPATCH_TLV_PATH; ++ nvm_file_path = ROME_NVM_TLV_PATH; ++ goto download; ++ case ROME_VER_1_3: ++ rampatch_file_path = ROME_RAMPATCH_TLV_1_0_3_PATH; ++ nvm_file_path = ROME_NVM_TLV_1_0_3_PATH; ++ goto download; ++ case ROME_VER_2_1: ++ rampatch_file_path = ROME_RAMPATCH_TLV_2_0_1_PATH; ++ nvm_file_path = ROME_NVM_TLV_2_0_1_PATH; ++ goto download; ++ case ROME_VER_3_0: ++ case TUFELLO_VER_1_0: ++ rampatch_file_path = ROME_RAMPATCH_TLV_3_0_0_PATH; ++ nvm_file_path = ROME_NVM_TLV_3_0_0_PATH; ++ ++download: ++ /* Donwload TLV files (rampatch, NVM) */ ++ err = rome_download_tlv_file(fd); ++ if (err < 0) { ++ fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__); ++ goto error; ++ } ++ fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__); ++ ++ /* Change baud rate back to user requested */ ++ fprintf(stderr, "Changing baud rate back from 3M --> 115K\n"); ++ err = rome_set_baudrate_req(fd); ++ if (err < 0) { ++ fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); ++ goto error; ++ } ++ fprintf(stderr, "%s: Baud rate changed successfully \n", __FUNCTION__); ++ ++ fprintf(stderr, "%s: Disabling In Band Sleep functionality\n", __FUNCTION__); ++ err = rome_disable_sleep(fd); ++ if (err < 0) { ++ fprintf(stderr, "%s: Failed to disable IBS!\n", __FUNCTION__); ++ goto error; ++ } ++ fprintf(stderr, "%s: IBS disabled successfully \n", __FUNCTION__); ++ ++ /* Perform HCI reset here*/ ++ err = rome_hci_reset_req(fd); ++ if ( err <0 ) { ++ fprintf(stderr, "HCI Reset Failed !!!\n"); ++ goto error; ++ } ++ fprintf(stderr, "HCI Reset is done\n"); ++ ++ break; ++ case ROME_VER_UNKNOWN: ++ default: ++ fprintf(stderr, "%s: Detected unknown ROME version\n", __FUNCTION__); ++ err = -1; ++ break; ++ } ++ ++error: ++ return err; ++} +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +new file mode 100644 +index 000000000000..aa59965643ec +--- /dev/null ++++ b/tools/hciattach_rome.h +@@ -0,0 +1,317 @@ ++/* ++ * Copyright 2012 The Android Open Source Project ++ * Copyright (c) 2013, The Linux Foundation. All rights reserved. ++ * Not a Contribution. ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++#ifndef HW_ROME_H ++#define HW_ROME_H ++ ++/****************************************************************************** ++** Constants & Macros ++******************************************************************************/ ++#define HCI_MAX_CMD_SIZE 260 ++#define HCI_MAX_EVENT_SIZE 260 ++#define PRINT_BUF_SIZE ((HCI_MAX_CMD_SIZE * 3) + 2) ++/* HCI Command/Event Opcode */ ++#define HCI_RESET 0x0C03 ++#define EVT_CMD_COMPLETE 0x0E ++/* HCI Packet types */ ++#define HCI_COMMAND_PKT 0x01 ++#define HCI_ACLDATA_PKT 0x02 ++#define HCI_SCODATA_PKT 0x03 ++#define HCI_EVENT_PKT 0x04 ++#define HCI_VENDOR_PKT 0xff ++#define cmd_opcode_pack(ogf, ocf) (unsigned short)((ocf & 0x03ff)|(ogf << 10)) ++unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; ++typedef enum { ++ USERIAL_OP_FLOW_ON, ++ USERIAL_OP_FLOW_OFF, ++ USERIAL_OP_NOP, ++} userial_vendor_ioctl_op_t; ++ ++ ++/* vendor serial control block */ ++typedef struct ++{ ++ int fd; /* fd to Bluetooth device */ ++ struct termios termios; /* serial terminal of BT port */ ++ char port_name[256]; ++} vnd_userial_cb_t; ++ ++/**** baud rates ****/ ++#define USERIAL_BAUD_300 0 ++#define USERIAL_BAUD_600 1 ++#define USERIAL_BAUD_1200 2 ++#define USERIAL_BAUD_2400 3 ++#define USERIAL_BAUD_9600 4 ++#define USERIAL_BAUD_19200 5 ++#define USERIAL_BAUD_57600 6 ++#define USERIAL_BAUD_115200 7 ++#define USERIAL_BAUD_230400 8 ++#define USERIAL_BAUD_460800 9 ++#define USERIAL_BAUD_921600 10 ++#define USERIAL_BAUD_1M 11 ++#define USERIAL_BAUD_1_5M 12 ++#define USERIAL_BAUD_2M 13 ++#define USERIAL_BAUD_3M 14 ++#define USERIAL_BAUD_4M 15 ++#define USERIAL_BAUD_AUTO 16 ++ ++#ifndef FALSE ++#define FALSE 0 ++#endif ++ ++#ifndef TRUE ++#define TRUE (!FALSE) ++#endif ++ ++#define HCI_CHG_BAUD_CMD_OCF 0x0C ++#define HCI_VENDOR_CMD_OGF 0x3F ++#define WRITE_BDADDR_CMD_LEN 14 ++#define WRITE_BAUD_CMD_LEN 6 ++#define MAX_CMD_LEN WRITE_BDADDR_CMD_LEN ++#define GET_VERSION_OCF 0x1E ++ ++#define PS_HDR_LEN 4 ++#define HCI_VENDOR_CMD_OGF 0x3F ++#define HCI_PS_CMD_OCF 0x0B ++ ++#define HCI_COMMAND_HDR_SIZE 3 ++#define EVT_CMD_COMPLETE_SIZE 3 ++#define EVT_CMD_STATUS 0x0F ++#define EVT_CMD_STATUS_SIZE 4 ++#define HCI_EVENT_HDR_SIZE 2 ++#define HCI_EV_SUCCESS 0x00 ++/* HCI Socket options */ ++#define HCI_DATA_DIR 1 ++#define HCI_FILTER 2 ++#define HCI_TIME_STAMP 3 ++ ++#define P_ID_OFFSET (0) ++#define HCI_CMD_IND (1) ++#define EVENTCODE_OFFSET (1) ++#define EVT_PLEN (2) ++#define PLEN (3) ++#define CMD_RSP_OFFSET (3) ++#define RSP_TYPE_OFFSET (4) ++#define BAUDRATE_RSP_STATUS_OFFSET (4) ++#define CMD_STATUS_OFFSET (5) ++#define P_ROME_VER_OFFSET (4) ++#define P_BUILD_VER_OFFSET (6) ++#define P_BASE_ADDR_OFFSET (8) ++#define P_ENTRY_ADDR_OFFSET (12) ++#define P_LEN_OFFSET (16) ++#define P_CRC_OFFSET (20) ++#define P_CONTROL_OFFSET (24) ++#define PATCH_HDR_LEN (28) ++#define MAX_DATA_PER_SEGMENT (239) ++#define VSEVENT_CODE (0xFF) ++#define HC_VS_MAX_CMD_EVENT (0xFF) ++#define PATCH_PROD_ID_OFFSET (5) ++#define PATCH_PATCH_VER_OFFSET (9) ++#define PATCH_ROM_BUILD_VER_OFFSET (11) ++#define PATCH_SOC_VER_OFFSET (13) ++#define MAX_SIZE_PER_TLV_SEGMENT (243) ++ ++/* VS Opcode */ ++#define HCI_PATCH_CMD_OCF (0) ++#define EDL_SET_BAUDRATE_CMD_OCF (0x48) ++ ++/* VS Commands */ ++#define VSC_SET_BAUDRATE_REQ_LEN (1) ++#define EDL_PATCH_CMD_LEN (1) ++#define EDL_PATCH_CMD_REQ_LEN (1) ++#define EDL_PATCH_DLD_REQ_CMD (0x01) ++#define EDL_PATCH_RST_REQ_CMD (0x05) ++#define EDL_PATCH_SET_REQ_CMD (0x16) ++#define EDL_PATCH_ATCH_REQ_CMD (0x17) ++#define EDL_PATCH_VER_REQ_CMD (0x19) ++#define EDL_PATCH_TLV_REQ_CMD (0x1E) ++#define VSC_DISABLE_IBS_LEN (0x04) ++ ++/* VS Event */ ++#define EDL_CMD_REQ_RES_EVT (0x00) ++#define EDL_CMD_EXE_STATUS_EVT (0x00) ++#define EDL_SET_BAUDRATE_RSP_EVT (0x92) ++#define EDL_PATCH_VER_RES_EVT (0x19) ++#define EDL_TVL_DNLD_RES_EVT (0x04) ++#define EDL_APP_VER_RES_EVT (0x02) ++ ++ ++/* Status Codes of HCI CMD execution*/ ++#define HCI_CMD_SUCCESS (0x0) ++#define PATCH_LEN_ERROR (0x1) ++#define PATCH_VER_ERROR (0x2) ++#define PATCH_CRC_ERROR (0x3) ++#define PATCH_NOT_FOUND (0x4) ++#define TLV_TYPE_ERROR (0x10) ++#define NVM_ACCESS_CODE (0x0B) ++#define BAUDRATE_CHANGE_SUCCESS (1) ++ ++/* TLV_TYPE */ ++#define TLV_TYPE_PATCH (1) ++#define TLV_TYPE_NVM (2) ++ ++/* NVM */ ++#define MAX_TAG_CMD 30 ++#define TAG_END 0xFF ++#define NVM_ACCESS_SET 0x01 ++#define TAG_NUM_OFFSET 5 ++#define TAG_NUM_2 2 ++#define TAG_BDADDR_OFFSET 7 ++ ++/* NVM Tags specifically used for ROME 1.0 */ ++#define ROME_1_0_100022_1 0x101000221 ++#define ROME_1_0_100019 0x101000190 ++#define ROME_1_0_6002 0x100600200 ++ ++/* Default NVM Version setting for ROME 1.0 */ ++#define NVM_VERSION ROME_1_0_100022_1 ++ ++ ++#define LSH(val, n) ((unsigned int)(val) << (n)) ++#define EXTRACT_BYTE(val, pos) (char) (((val) >> (8 * (pos))) & 0xFF) ++#define CALC_SEG_SIZE(len, max) ((plen) % (max))?((plen/max)+1) : ((plen) / (max)) ++ ++#define ROME_FW_PATH "/lib/firmware/rampatch.img" ++#define ROME_RAMPATCH_TLV_PATH "/lib/firmware/rampatch_tlv.img" ++#define ROME_NVM_TLV_PATH "/lib/firmware/nvm_tlv.bin" ++#define ROME_RAMPATCH_TLV_1_0_3_PATH "/lib/firmware/rampatch_tlv_1.3.tlv" ++#define ROME_NVM_TLV_1_0_3_PATH "/lib/firmware/nvm_tlv_1.3.bin" ++#define ROME_RAMPATCH_TLV_2_0_1_PATH "/lib/firmware/rampatch_tlv_2.1.tlv" ++#define ROME_NVM_TLV_2_0_1_PATH "/lib/firmware/nvm_tlv_2.1.bin" ++#define ROME_RAMPATCH_TLV_3_0_0_PATH "/lib/firmware/qca/rampatch_tlv_3.0.tlv" ++#define ROME_NVM_TLV_3_0_0_PATH "/lib/firmware/qca/nvm_tlv_3.0.bin" ++ ++ ++/****************************************************************************** ++** Local type definitions ++******************************************************************************/ ++ ++typedef struct { ++ unsigned char ncmd; ++ unsigned short opcode; ++} __attribute__ ((packed)) evt_cmd_complete; ++ ++typedef struct { ++ unsigned char status; ++ unsigned char ncmd; ++ unsigned short opcode; ++} __attribute__ ((packed)) evt_cmd_status; ++ ++typedef struct { ++ unsigned short opcode; ++ unsigned char plen; ++} __attribute__ ((packed)) hci_command_hdr; ++ ++typedef struct { ++ unsigned char evt; ++ unsigned char plen; ++} __attribute__ ((packed)) hci_event_hdr; ++typedef struct { ++ unsigned short rom_version; ++ unsigned short build_version; ++} __attribute__ ((packed)) patch_version; ++ ++typedef struct { ++ unsigned int patch_id; ++ patch_version patch_ver; ++ unsigned int patch_base_addr; ++ unsigned int patch_entry_addr; ++ unsigned short patch_length; ++ int patch_crc; ++ unsigned short patch_ctrl; ++} __attribute__ ((packed)) patch_info; ++ ++typedef struct { ++ unsigned char sign_ver; ++ unsigned char sign_algorithm; ++ unsigned short reserved1; ++ unsigned short prod_id; ++ unsigned short build_ver; ++ unsigned short patch_ver; ++ unsigned short reserved2; ++ unsigned int patch_entry_addr; ++} __attribute__ ((packed)) tlv_patch_hdr; ++ ++typedef struct { ++ unsigned short tag_id; ++ unsigned short tag_len; ++ unsigned int tag_ptr; ++ unsigned int tag_ex_flag; ++} __attribute__ ((packed)) tlv_nvm_hdr; ++ ++typedef struct { ++ unsigned char tlv_type; ++ unsigned char tlv_length1; ++ unsigned char tlv_length2; ++ unsigned char tlv_length3; ++ unsigned int tlv_data_len; ++ unsigned int tlv_patch_data_len; ++ ++ union{ ++ tlv_patch_hdr patch; ++ tlv_nvm_hdr nvm; ++ }tlv; ++} __attribute__ ((packed)) tlv_patch_info; ++ ++enum{ ++ BAUDRATE_115200 = 0x00, ++ BAUDRATE_57600 = 0x01, ++ BAUDRATE_38400 = 0x02, ++ BAUDRATE_19200 = 0x03, ++ BAUDRATE_9600 = 0x04, ++ BAUDRATE_230400 = 0x05, ++ BAUDRATE_250000 = 0x06, ++ BAUDRATE_460800 = 0x07, ++ BAUDRATE_500000 = 0x08, ++ BAUDRATE_720000 = 0x09, ++ BAUDRATE_921600 = 0x0A, ++ BAUDRATE_1000000 = 0x0B, ++ BAUDRATE_1250000 = 0x0C, ++ BAUDRATE_2000000 = 0x0D, ++ BAUDRATE_3000000 = 0x0E, ++ BAUDRATE_4000000 = 0x0F, ++ BAUDRATE_1600000 = 0x10, ++ BAUDRATE_3200000 = 0x11, ++ BAUDRATE_3500000 = 0x12, ++ BAUDRATE_AUTO = 0xFE, ++ BAUDRATE_Reserved = 0xFF ++}; ++ ++enum{ ++ ROME_PATCH_VER_0100 = 0x0100, ++ ROME_PATCH_VER_0101 = 0x0101, ++ ROME_PATCH_VER_0200 = 0x0200, ++ ROME_PATCH_VER_0300 = 0x0300 ++ }; ++ ++enum{ ++ ROME_SOC_ID_00 = 0x00000000, ++ ROME_SOC_ID_11 = 0x00000011, ++ ROME_SOC_ID_13 = 0x00000013, ++ ROME_SOC_ID_22 = 0x00000022, ++}; ++ ++enum{ ++ ROME_VER_UNKNOWN = 0, ++ ROME_VER_1_0 = ((ROME_PATCH_VER_0100 << 16 ) | ROME_SOC_ID_00 ), ++ ROME_VER_1_1 = ((ROME_PATCH_VER_0101 << 16 ) | ROME_SOC_ID_00 ), ++ ROME_VER_1_3 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_00 ), ++ ROME_VER_2_1 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_11 ), ++ ROME_VER_3_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_22 ), ++ TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 ) ++}; ++#endif /* HW_ROME_H */ diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0002-bluetooth-Enable-bluetooth-low-power-mode-functional.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0002-bluetooth-Enable-bluetooth-low-power-mode-functional.patch new file mode 100644 index 000000000..b0368d0e8 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0002-bluetooth-Enable-bluetooth-low-power-mode-functional.patch @@ -0,0 +1,28 @@ +From: Anantha Krishnan +Date: Thu, 11 Sep 2014 19:20:02 +0530 +Subject: [PATCH] bluetooth: Enable bluetooth low power mode functionality + +During periods of inactivity the bluetooth controller and the +application processor will indicate each other to enter into +low power mode and signal each other when they have data to be +exchanged, thereby saving considerable amount of power. + +Change-Id: I9e0d579ac8a9d61a2ebde78b031f4101cb6bc443 +Signed-off-by: Rupesh Tatiya +--- + tools/hciattach.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/hciattach.c b/tools/hciattach.c +index d3917a0d503e..3041e28ff82a 100644 +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -1156,7 +1156,7 @@ struct uart_t uart[] = { + FLOW_CTL, DISABLE_PM, NULL, ath3k_ps, ath3k_pm }, + + /* QCA ROME */ +- { "qca", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, ++ { "qca", 0x0000, 0x0000, HCI_UART_IBS, 115200, 115200, + FLOW_CTL, DISABLE_PM, NULL, qca, NULL }, + + /* QUALCOMM BTS */ diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0003-bluetooth-Fix-bug-in-firmware-parsing-mechanism.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0003-bluetooth-Fix-bug-in-firmware-parsing-mechanism.patch new file mode 100644 index 000000000..21b57dde3 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0003-bluetooth-Fix-bug-in-firmware-parsing-mechanism.patch @@ -0,0 +1,51 @@ +From: Anantha Krishnan +Date: Thu, 11 Sep 2014 18:57:45 +0530 +Subject: [PATCH] bluetooth: Fix bug in firmware parsing mechanism + +Reorganize the RAMPATCH members to be present as part of the +RAMPATCH header structre instead of the main firmware structure + +Change-Id: If523e1bb20edcd52b7c6f623c07af492e6305bd0 +Signed-off-by: Rupesh Tatiya +--- + tools/hciattach_rome.c | 4 ++-- + tools/hciattach_rome.h | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index f31be43c09e4..122a0f4b89bc 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -851,8 +851,8 @@ int rome_get_tlv_file(char *file_path) + fprintf(stderr, "Length\t\t\t : %d bytes\n", (ptlv_header->tlv_length1) | + (ptlv_header->tlv_length2 << 8) | + (ptlv_header->tlv_length3 << 16)); +- fprintf(stderr, "Total Length\t\t\t : %d bytes\n", ptlv_header->tlv_data_len); +- fprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv_patch_data_len); ++ fprintf(stderr, "Total Length\t\t\t : %d bytes\n", ptlv_header->tlv.patch.tlv_data_len); ++ fprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv.patch.tlv_patch_data_len); + fprintf(stderr, "Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver); + fprintf(stderr, "Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm); + fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1); +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index aa59965643ec..07127f30a70a 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -236,6 +236,8 @@ typedef struct { + } __attribute__ ((packed)) patch_info; + + typedef struct { ++ unsigned int tlv_data_len; ++ unsigned int tlv_patch_data_len; + unsigned char sign_ver; + unsigned char sign_algorithm; + unsigned short reserved1; +@@ -258,8 +260,6 @@ typedef struct { + unsigned char tlv_length1; + unsigned char tlv_length2; + unsigned char tlv_length3; +- unsigned int tlv_data_len; +- unsigned int tlv_patch_data_len; + + union{ + tlv_patch_hdr patch; diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0004-bluetooth-Configure-BD-Address.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0004-bluetooth-Configure-BD-Address.patch new file mode 100644 index 000000000..d39d8d0a0 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0004-bluetooth-Configure-BD-Address.patch @@ -0,0 +1,114 @@ +From: Anantha Krishnan +Date: Mon, 8 Sep 2014 15:11:02 +0530 +Subject: [PATCH] bluetooth: Configure BD Address + +Read the BD Address programmed by user from persist location. +If there is no user programmed BD address then use the default +BD address present in the firmware file. + +Change-Id: Id702d1476bae765dfd23f88542bfd5a8a1f26056 +Signed-off-by: Rupesh Tatiya +--- + tools/hciattach_rome.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++--- + tools/hciattach_rome.h | 7 +++++++ + 2 files changed, 60 insertions(+), 3 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 122a0f4b89bc..947e1abb96c4 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -809,6 +809,7 @@ int rome_get_tlv_file(char *file_path) + tlv_nvm_hdr *nvm_ptr; + unsigned char data_buf[PRINT_BUF_SIZE]={0,}; + unsigned char *nvm_byte_ptr; ++ unsigned char bdaddr[6]; + + fprintf(stderr, "File Open (%s)\n", file_path); + pFile = fopen ( file_path , "r" ); +@@ -886,9 +887,10 @@ int rome_get_tlv_file(char *file_path) + nvm_byte_ptr+=sizeof(tlv_nvm_hdr); + + /* Write BD Address */ +- if(nvm_ptr->tag_id == TAG_NUM_2){ +- memcpy(nvm_byte_ptr, vnd_local_bd_addr, 6); +- fprintf(stderr, "BD Address: %.02x:%.02x:%.02x:%.02x:%.02x:%.02x\n", ++ if(nvm_ptr->tag_id == TAG_NUM_2 && read_bd_address(&bdaddr) == 0) { ++ memcpy(nvm_byte_ptr, bdaddr, 6); ++ fprintf(stderr, "Overriding default BD ADDR with user" ++ " programmed BD Address: %02x:%02x:%02x:%02x:%02x:%02x\n", + *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2), + *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5)); + } +@@ -1451,6 +1453,54 @@ error: + + } + ++int read_bd_address(unsigned char *bdaddr) ++{ ++ int fd = -1; ++ int readPtr = 0; ++ unsigned char data[BD_ADDR_LEN]; ++ ++ /* Open the persist file for reading device address*/ ++ fd = open("/etc/bluetooth/.bt_nv.bin", O_RDONLY); ++ if(fd < 0) ++ { ++ fprintf(stderr, "%s: Open failed: Programming default BD ADDR\n", __func__); ++ return -1; ++ } ++ ++ /* Read the NVM Header : fp will be advanced by readPtr number of bytes */ ++ readPtr = read(fd, data, PERSIST_HEADER_LEN); ++ if (readPtr > 0) ++ fprintf(stderr, "%s: Persist header data: %02x \t %02x \t %02x\n", __func__, ++ data[NVITEM], data[RDWR_PROT], data[NVITEM_SIZE]); ++ else { ++ fprintf(stderr, "%s: Read from persist memory failed : Programming default" ++ " BD ADDR\n"); ++ close(fd); ++ return -1; ++ } ++ ++ /* Check for BD ADDR length before programming */ ++ if(data[NVITEM_SIZE] != BD_ADDR_LEN) { ++ fprintf(stderr, "Invalid BD ADDR: Programming default BD ADDR!\n"); ++ close(fd); ++ return -1; ++ } ++ ++ /* Read the BD ADDR info */ ++ readPtr = read(fd, data, BD_ADDR_LEN); ++ if (readPtr > 0) ++ fprintf(stderr, "BD-ADDR: ==> %02x:%02x:%02x:%02x:%02x:%02x\n", data[0], ++ data[1], data[2], data[3], data[4], data[5]); ++ else { ++ fprintf(stderr, "%s: Read from persist memory failed : Programming default" ++ " BD ADDR\n"); ++ close(fd); ++ return -1; ++ } ++ memcpy(bdaddr, data, BD_ADDR_LEN); ++ close(fd); ++ return 0; ++} + + int qca_soc_init(int fd, char *bdaddr) + { +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 07127f30a70a..a4abe9f73080 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -34,6 +34,13 @@ + #define HCI_EVENT_PKT 0x04 + #define HCI_VENDOR_PKT 0xff + #define cmd_opcode_pack(ogf, ocf) (unsigned short)((ocf & 0x03ff)|(ogf << 10)) ++ ++#define NVITEM 0 ++#define RDWR_PROT 1 ++#define NVITEM_SIZE 2 ++#define PERSIST_HEADER_LEN 3 ++#define BD_ADDR_LEN 6 ++ + unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + typedef enum { + USERIAL_OP_FLOW_ON, diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0005-bluetooth-Remove-unused-functions-in-the-firmware-do.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0005-bluetooth-Remove-unused-functions-in-the-firmware-do.patch new file mode 100644 index 000000000..604efb2e4 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0005-bluetooth-Remove-unused-functions-in-the-firmware-do.patch @@ -0,0 +1,73 @@ +From: Anantha Krishnan +Date: Mon, 8 Sep 2014 14:33:24 +0530 +Subject: [PATCH] bluetooth: Remove unused functions in the firmware download + process + +rome_disable_sleep() function is not used anywhere in the code and +hence remove it. + +Change-Id: Iec1f9b1478850af3023ff297493693283a5338d7 +Signed-off-by: Rupesh Tatiya +--- + tools/hciattach_rome.c | 48 ------------------------------------------------ + 1 file changed, 48 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 947e1abb96c4..4fcbdf2ab82a 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -1317,54 +1317,6 @@ error: + + } + +-int rome_disable_sleep(int fd) +-{ +- int size, err = 0; +- unsigned char cmd[HCI_MAX_CMD_SIZE]; +- unsigned char rsp[HCI_MAX_EVENT_SIZE]; +- hci_command_hdr *cmd_hdr; +- int flags; +- +- memset(cmd, 0x0, HCI_MAX_CMD_SIZE); +- +- cmd_hdr = (void *) (cmd + 1); +- cmd[0] = HCI_COMMAND_PKT; +- cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, NVM_ACCESS_CODE); +- cmd_hdr->plen = VSC_DISABLE_IBS_LEN; +- cmd[4] = 0x01; +- cmd[5] = 0x1B; +- cmd[6] = 0x01; +- cmd[7] = 0x00; +- +- /* Total length of the packet to be sent to the Controller */ +- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_DISABLE_IBS_LEN); +- /* Send the HCI command packet to UART for transmission */ +- fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7]) ; +- err = write(fd, cmd, size); +- if (err != size) { +- fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); +- goto error; +- } +- +- /* Check for response from the Controller */ +- if ((err =read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) { +- fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); +- goto error; +- } +- +- fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); +- +- /* Wait for command complete event */ +- err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); +- if ( err < 0) { +- fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__); +- goto error; +- } +- fprintf(stderr, "%s\n", __FUNCTION__); +-error: +- return err; +- +-} + + int rome_set_baudrate_req(int fd) + { diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0006-bluetooth-Enable-3Mbps-baud-rate-support.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0006-bluetooth-Enable-3Mbps-baud-rate-support.patch new file mode 100644 index 000000000..a4f15ead0 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0006-bluetooth-Enable-3Mbps-baud-rate-support.patch @@ -0,0 +1,150 @@ +From: Anantha Krishnan +Date: Mon, 8 Sep 2014 14:31:18 +0530 +Subject: [PATCH] bluetooth: Enable 3Mbps baud rate support + +Allow APPS PROC and BT Controller to operate at 3Mbps baud rate +for faster exchange of commands, events and data between the two + +Change-Id: I55651633027ea60a762b11abea84fe1abd6574a9 +Signed-off-by: Rupesh Tatiya +--- + tools/hciattach_rome.c | 63 ++++++++++++++++++++++++++++++++++++++------------ + 1 file changed, 48 insertions(+), 15 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 4fcbdf2ab82a..d0e2935b9997 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -166,6 +166,7 @@ int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data) + } + cfmakeraw(&ti); + ti.c_cflag |= CLOCAL; ++ ti.c_cflag |= CREAD; + + switch(op) + { +@@ -332,6 +333,8 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size) + { + int remain, r; + int count = 0; ++ fd_set infids; ++ struct timeval timeout; + + if (size <= 0) { + fprintf(stderr, "Invalid size arguement!\n"); +@@ -340,6 +343,16 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size) + + fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n", __FUNCTION__); + ++ FD_ZERO (&infids); ++ FD_SET (fd, &infids); ++ timeout.tv_sec = 3; ++ timeout.tv_usec = 0; /* half second is a long time at 115.2 Kbps */ ++ ++ if (select (fd + 1, &infids, NULL, NULL, &timeout) < 1) ++ fprintf(stderr, "%s: Timing out on select for 3 secs.\n", __FUNCTION__); ++ else ++ fprintf(stderr, "%s: Data available in TTY Serial buffer\n", __FUNCTION__); ++ + /* The first byte identifies the packet type. For HCI event packets, it + * should be 0x04, so we read until we get to the 0x04. */ + /* It will keep reading until find 0x04 byte */ +@@ -1332,10 +1345,16 @@ int rome_set_baudrate_req(int fd) + cmd[0] = HCI_COMMAND_PKT; + cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, EDL_SET_BAUDRATE_CMD_OCF); + cmd_hdr->plen = VSC_SET_BAUDRATE_REQ_LEN; +- cmd[4] = BAUDRATE_115200; ++ cmd[4] = BAUDRATE_3000000; + + /* Total length of the packet to be sent to the Controller */ + size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_SET_BAUDRATE_REQ_LEN); ++ /* Flow off during baudrate change */ ++ if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_OFF , &flags)) < 0) ++ { ++ fprintf(stderr, "%s: HW Flow-off error: 0x%x\n", __FUNCTION__, err); ++ goto error; ++ } + /* Send the HCI command packet to UART for transmission */ + fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3],cmd[4]) ; + err = write(fd, cmd, size); +@@ -1343,7 +1362,15 @@ int rome_set_baudrate_req(int fd) + fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err); + goto error; + } ++ /* Change Local UART baudrate to high speed UART */ ++ userial_vendor_set_baud(USERIAL_BAUD_3M); + ++ /* Flow on after changing local uart baudrate */ ++ if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_ON , &flags)) < 0) ++ { ++ fprintf(stderr, "%s: HW Flow-on error: 0x%x \n", __FUNCTION__, err); ++ return err; ++ } + /* Check for response from the Controller */ + if ((err =read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) { + fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); +@@ -1385,6 +1412,12 @@ int rome_hci_reset_req(int fd) + /* Total length of the packet to be sent to the Controller */ + size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE); + ++ /* Flow off during baudrate change */ ++ if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_OFF , &flags)) < 0) ++ { ++ fprintf(stderr, "%s: HW Flow-off error: 0x%x\n", __FUNCTION__, err); ++ goto error; ++ } + /* Send the HCI command packet to UART for transmission */ + fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]); + err = write(fd, cmd, size); +@@ -1393,6 +1426,15 @@ int rome_hci_reset_req(int fd) + goto error; + } + ++ /* Change Local UART baudrate to high speed UART */ ++ userial_vendor_set_baud(USERIAL_BAUD_3M); ++ ++ /* Flow on after changing local uart baudrate */ ++ if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_ON , &flags)) < 0) ++ { ++ fprintf(stderr, "%s: HW Flow-on error: 0x%x \n", __FUNCTION__, err); ++ return err; ++ } + /* Wait for command complete event */ + err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); + if ( err < 0) { +@@ -1534,16 +1576,7 @@ int qca_soc_init(int fd, char *bdaddr) + nvm_file_path = ROME_NVM_TLV_3_0_0_PATH; + + download: +- /* Donwload TLV files (rampatch, NVM) */ +- err = rome_download_tlv_file(fd); +- if (err < 0) { +- fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__); +- goto error; +- } +- fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__); +- +- /* Change baud rate back to user requested */ +- fprintf(stderr, "Changing baud rate back from 3M --> 115K\n"); ++ /* Change baud rate 115.2 kbps to 3Mbps*/ + err = rome_set_baudrate_req(fd); + if (err < 0) { + fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); +@@ -1551,13 +1584,13 @@ download: + } + fprintf(stderr, "%s: Baud rate changed successfully \n", __FUNCTION__); + +- fprintf(stderr, "%s: Disabling In Band Sleep functionality\n", __FUNCTION__); +- err = rome_disable_sleep(fd); ++ /* Donwload TLV files (rampatch, NVM) */ ++ err = rome_download_tlv_file(fd); + if (err < 0) { +- fprintf(stderr, "%s: Failed to disable IBS!\n", __FUNCTION__); ++ fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__); + goto error; + } +- fprintf(stderr, "%s: IBS disabled successfully \n", __FUNCTION__); ++ fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__); + + /* Perform HCI reset here*/ + err = rome_hci_reset_req(fd); diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0007-bluetooth-Check-TTY-buffer-for-data-availability-bef.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0007-bluetooth-Check-TTY-buffer-for-data-availability-bef.patch new file mode 100644 index 000000000..d92dbfcce --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0007-bluetooth-Check-TTY-buffer-for-data-availability-bef.patch @@ -0,0 +1,189 @@ +From: Anantha Krishnan +Date: Tue, 30 Sep 2014 12:13:00 +0530 +Subject: [PATCH] bluetooth: Check TTY buffer for data availability before + reading + +When operating at higher baud rates check the TTY buffer for +availability of data before proceeding to read. Call select() with +a 3 sec timeout value to check for the availablitiy of data. +select() will return once data is available in the TTY buffers +and will allow read() to fetch the data. If data is not available +in the TTY buffer until the timeout valueexpires, do not proceed +to read the data from the TTY buffers as there is none. + +Occasionally corrupt data is received on UART lines while we wait +for vendor specific event from Controller. Expected vendor specific +events are received after the corrupt data. But we do not retry +and exit and this causes firmware download failures. So, retry once +if we did not get HCI event. + +Change-Id: I3b672a7762403690f8b934ca216492f16285e8da +Signed-off-by: Rupesh Tatiya +--- + tools/hciattach.c | 20 ++++++++++++- + tools/hciattach_rome.c | 77 +++++++++++++++++++++++++++++++++++++++----------- + tools/hciattach_rome.h | 3 ++ + 3 files changed, 83 insertions(+), 17 deletions(-) + +diff --git a/tools/hciattach.c b/tools/hciattach.c +index 3041e28ff82a..13f073325c43 100644 +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -163,16 +163,34 @@ int read_hci_event(int fd, unsigned char* buf, int size) + { + int remain, r; + int count = 0; ++ fd_set infids; ++ struct timeval timeout; + + if (size <= 0) + return -1; + ++ FD_ZERO (&infids); ++ FD_SET (fd, &infids); ++ timeout.tv_sec = 3; ++ timeout.tv_usec = 0; ++ ++ /* Check whether data is available in TTY buffer before calling read() */ ++ if (select (fd + 1, &infids, NULL, NULL, &timeout) < 1) { ++ fprintf(stderr, "%s: Timing out on select for 3 secs.\n", __FUNCTION__); ++ return -1; ++ } ++ else ++ fprintf(stderr, "%s: Data(HCI-CMD-COMP-EVENT) available in TTY Serial buffer\n", __FUNCTION__); ++ + /* The first byte identifies the packet type. For HCI event packets, it + * should be 0x04, so we read until we get to the 0x04. */ + while (1) { + r = read(fd, buf, 1); +- if (r <= 0) ++ if (r <= 0) { ++ fprintf(stderr, "%s: read() failed with return value: %d\n", ++ __FUNCTION__, r); + return -1; ++ } + if (buf[0] == 0x04) + break; + } +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index d0e2935b9997..d2687b1ef01a 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -326,42 +326,87 @@ failed: + } + + ++int wait_for_data(int fd, int maxTimeOut) ++{ ++ fd_set infids; ++ struct timeval timeout; ++ ++ if (maxTimeOut <= 0) { ++ fprintf(stderr, "%s: Invalid timeout value specified", __func__); ++ return -EINVAL; ++ } ++ ++ FD_ZERO (&infids); ++ FD_SET (fd, &infids); ++ timeout.tv_sec = maxTimeOut; ++ timeout.tv_usec = 0; ++ ++ /* Check whether data is available in TTY buffer before calling read() */ ++ if (select (fd + 1, &infids, NULL, NULL, &timeout) < 1) { ++ fprintf(stderr, "%s: Timing out on select for %d secs.\n", __FUNCTION__, maxTimeOut); ++ return -1; ++ } ++ else ++ fprintf(stderr, "%s: HCI-VS-EVENT available in TTY Serial buffer\n", ++ __FUNCTION__); ++ ++ return 1; ++} ++ + /* + * Read an VS HCI event from the given file descriptor. + */ + int read_vs_hci_event(int fd, unsigned char* buf, int size) + { +- int remain, r; ++ int remain, r, retry = 0; + int count = 0; +- fd_set infids; +- struct timeval timeout; + + if (size <= 0) { + fprintf(stderr, "Invalid size arguement!\n"); + return -1; + } + +- fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n", __FUNCTION__); +- +- FD_ZERO (&infids); +- FD_SET (fd, &infids); +- timeout.tv_sec = 3; +- timeout.tv_usec = 0; /* half second is a long time at 115.2 Kbps */ ++ fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n", ++ __FUNCTION__); + +- if (select (fd + 1, &infids, NULL, NULL, &timeout) < 1) +- fprintf(stderr, "%s: Timing out on select for 3 secs.\n", __FUNCTION__); +- else +- fprintf(stderr, "%s: Data available in TTY Serial buffer\n", __FUNCTION__); ++ /* Check whether data is available in TTY buffer before calling read() */ ++ if (wait_for_data(fd, SELECT_TIMEOUT) < 1) ++ return -1; + + /* The first byte identifies the packet type. For HCI event packets, it + * should be 0x04, so we read until we get to the 0x04. */ + /* It will keep reading until find 0x04 byte */ + while (1) { ++ /* Read UART Buffer for HCI-DATA */ + r = read(fd, buf, 1); +- if (r <= 0) +- return -1; +- if (buf[0] == 0x04) ++ if (r <= 0) { ++ fprintf(stderr, "%s: read() failed. error: %d\n", ++ __FUNCTION__, r); ++ return -1; ++ } ++ ++ /* Check if received data is HCI-DATA or not. ++ * If not HCI-DATA, then retry reading the UART Buffer once. ++ * Sometimes there could be corruption on the UART lines and to ++ * avoid that retry once reading the UART Buffer for HCI-DATA. ++ */ ++ if (buf[0] == 0x04) { /* Recvd. HCI DATA */ ++ retry = 0; + break; ++ } ++ else if (retry < MAX_RETRY_CNT){ /* Retry mechanism */ ++ retry++; ++ fprintf(stderr, "%s: Not an HCI-VS-Event! buf[0]: %d", ++ __FUNCTION__, buf[0]); ++ if (wait_for_data(fd, SELECT_TIMEOUT) < 1) ++ return -1; ++ else /* Data available in UART Buffer: Continue to read */ ++ continue; ++ } ++ else { /* RETRY failed : Exiting with failure */ ++ fprintf(stderr, "%s: RETRY failed!", __FUNCTION__); ++ return -1; ++ } + } + count++; + +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index a4abe9f73080..3efb71995c45 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -179,6 +179,9 @@ typedef struct + #define TAG_NUM_2 2 + #define TAG_BDADDR_OFFSET 7 + ++#define MAX_RETRY_CNT 1 ++#define SELECT_TIMEOUT 3 ++ + /* NVM Tags specifically used for ROME 1.0 */ + #define ROME_1_0_100022_1 0x101000221 + #define ROME_1_0_100019 0x101000190 diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0008-bluetooth-Add-support-for-TUFEELO-firmware-download.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0008-bluetooth-Add-support-for-TUFEELO-firmware-download.patch new file mode 100644 index 000000000..e8f2f8dcc --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0008-bluetooth-Add-support-for-TUFEELO-firmware-download.patch @@ -0,0 +1,44 @@ +From: Anantha Krishnan +Date: Wed, 20 Aug 2014 12:13:19 +0530 +Subject: [PATCH] bluetooth : Add support for TUFEELO firmware download + +Add TUFELLO chip version to allow firmware download. + +Change-Id: Ie3760fa64e8345bf9a84b2f047fde0ac1003b393 +--- + tools/hciattach_rome.c | 5 ++++- + tools/hciattach_rome.h | 3 ++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index d2687b1ef01a..84dfc97b5140 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -1616,9 +1616,12 @@ int qca_soc_init(int fd, char *bdaddr) + nvm_file_path = ROME_NVM_TLV_2_0_1_PATH; + goto download; + case ROME_VER_3_0: +- case TUFELLO_VER_1_0: + rampatch_file_path = ROME_RAMPATCH_TLV_3_0_0_PATH; + nvm_file_path = ROME_NVM_TLV_3_0_0_PATH; ++ goto download; ++ case TUFELLO_VER_1_0: ++ rampatch_file_path = TF_RAMPATCH_TLV_1_0_0_PATH; ++ nvm_file_path = TF_NVM_TLV_1_0_0_PATH; + + download: + /* Change baud rate 115.2 kbps to 3Mbps*/ +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 3efb71995c45..9d18c576fcae 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -204,7 +204,8 @@ typedef struct + #define ROME_NVM_TLV_2_0_1_PATH "/lib/firmware/nvm_tlv_2.1.bin" + #define ROME_RAMPATCH_TLV_3_0_0_PATH "/lib/firmware/qca/rampatch_tlv_3.0.tlv" + #define ROME_NVM_TLV_3_0_0_PATH "/lib/firmware/qca/nvm_tlv_3.0.bin" +- ++#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/rampatch_tlv_tf_1.0.tlv" ++#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/nvm_tlv_tf_1.0.bin" + + /****************************************************************************** + ** Local type definitions diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0009-bluetooth-Add-support-for-ROME-3.2-SOC.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0009-bluetooth-Add-support-for-ROME-3.2-SOC.patch new file mode 100644 index 000000000..5cc72bde2 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0009-bluetooth-Add-support-for-ROME-3.2-SOC.patch @@ -0,0 +1,236 @@ +From: Anantha Krishnan +Date: Mon, 8 Dec 2014 14:52:16 +0530 +Subject: [PATCH] bluetooth: Add support for ROME 3.2 SOC. + +Add firmware download support for ROME 3.2 version. As part +of this, the Bluetooth on time is optimized based on event +handling while downloading rampatch files.From ROME 3.2 onwards, +the VS and command complete events will be sent depending the flag +indication present in the header. HOST can wait for VS and command +complete events only if specified in the header info. This greatly +reduces the time spent by HOST in waiting for 2 events from the +Controller before downloading each segment of the RAMPATCH file + +Change-Id: I9c4227a7a529455f4d120b2c9d065f3ec6b439e9 +--- + tools/hciattach_rome.c | 104 ++++++++++++++++++++++++++++++++++++++++++------- + tools/hciattach_rome.h | 16 +++++++- + 2 files changed, 103 insertions(+), 17 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 84dfc97b5140..c6d528f118e1 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -62,9 +62,11 @@ unsigned char *pdata_buffer = NULL; + patch_info rampatch_patch_info; + int rome_ver = ROME_VER_UNKNOWN; + unsigned char gTlv_type; ++unsigned char gtlv_dwndcfg; + char *rampatch_file_path; + char *nvm_file_path; + vnd_userial_cb_t vnd_userial; ++unsigned char wait_vsc_evt = TRUE; + /****************************************************************************** + ** Extern variables + ******************************************************************************/ +@@ -455,14 +457,16 @@ int hci_send_vs_cmd(int fd, unsigned char *cmd, unsigned char *rsp, int size) + goto failed; + } + +- /* Check for response from the Controller */ +- if (read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE) < 0) { +- ret = -ETIMEDOUT; +- fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); +- goto failed; ++ if (wait_vsc_evt) { ++ /* Check for response from the Controller */ ++ if (read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE) < 0) { ++ ret = -ETIMEDOUT; ++ fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); ++ goto failed; ++ } ++ fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); + } + +- fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__); + failed: + return ret; + } +@@ -903,6 +907,7 @@ int rome_get_tlv_file(char *file_path) + + /* To handle different event between rampatch and NVM */ + gTlv_type = ptlv_header->tlv_type; ++ gtlv_dwndcfg = ptlv_header->tlv.patch.dwnd_cfg; + + if(ptlv_header->tlv_type == TLV_TYPE_PATCH){ + fprintf(stderr, "====================================================\n"); +@@ -914,6 +919,7 @@ int rome_get_tlv_file(char *file_path) + fprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv.patch.tlv_patch_data_len); + fprintf(stderr, "Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver); + fprintf(stderr, "Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm); ++ fprintf(stderr, "Event Handling\t\t\t : 0x%x", ptlv_header->tlv.patch.dwnd_cfg); + fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1); + fprintf(stderr, "Product ID\t\t\t : 0x%04x\n", ptlv_header->tlv.patch.prod_id); + fprintf(stderr, "Rom Build Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.build_ver); +@@ -1023,19 +1029,83 @@ int rome_tlv_dnld_req(int fd, int tlv_size) + fprintf(stderr, "%s: TLV size: %d, Total Seg num: %d, remain size: %d\n", + __FUNCTION__,tlv_size, total_segment, remain_size); + +- for(i=0;i= ROME_VER_1_1) && (gTlv_type == TLV_TYPE_PATCH ) +- && !remain_size && ((i+1) == total_segment))? FALSE: TRUE; ++ if (gTlv_type == TLV_TYPE_PATCH) { ++ /* Prior to Rome version 3.2(including inital few rampatch release of ++ * Rome 3.2), the event handling mechanism is ROME_SKIP_EVT_NONE. After ++ * few release of rampatch for Rome 3.2, the mechamism is changed to ++ * ROME_SKIP_EVT_VSE_CC. Rest of the mechanism is not used for now ++ */ ++ switch(gtlv_dwndcfg) ++ { ++ case ROME_SKIP_EVT_NONE: ++ wait_vsc_evt = TRUE; ++ wait_cc_evt = TRUE; ++ fprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_NONE", __func__); ++ break; ++ case ROME_SKIP_EVT_VSE_CC: ++ wait_vsc_evt = FALSE; ++ wait_cc_evt = FALSE; ++ fprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_VSE_CC", __func__); ++ break; ++ /* Not handled for now */ ++ case ROME_SKIP_EVT_VSE: ++ case ROME_SKIP_EVT_CC: ++ default: ++ fprintf(stderr, "%s: Unsupported Event handling: %d", __func__, gtlv_dwndcfg); ++ break; ++ } ++ } else { ++ wait_vsc_evt = TRUE; ++ wait_cc_evt = TRUE; ++ } ++ ++ for(i = 0; i < total_segment; i++) { ++ if((i+1) == total_segment) { ++ if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) && ++ (gTlv_type == TLV_TYPE_PATCH)) { ++ /* If the Rome version is from 1.1 to 3.1 ++ * 1. No CCE for the last command segment but all other segment ++ * 2. All the command segments get VSE including the last one ++ */ ++ wait_cc_evt = !remain_size ? FALSE: TRUE; ++ } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) { ++ /* If the Rome version is 3.2 ++ * 1. None of the command segments receive CCE ++ * 2. No command segments receive VSE except the last one ++ * 3. If gtlv_dwndcfg is ROME_SKIP_EVT_NONE then the logic is ++ * same as Rome 2.1, 2.2, 3.0 ++ */ ++ if (gtlv_dwndcfg == ROME_SKIP_EVT_NONE) { ++ wait_cc_evt = !remain_size ? FALSE: TRUE; ++ } else if (gtlv_dwndcfg == ROME_SKIP_EVT_VSE_CC) { ++ wait_vsc_evt = !remain_size ? TRUE: FALSE; ++ } ++ } ++ } ++ + if((err = rome_tlv_dnld_segment(fd, i, MAX_SIZE_PER_TLV_SEGMENT, wait_cc_evt )) < 0) + goto error; + } + +- /* In case remain data still remain, last rampatch segment command will not wait +- for command complete event here */ +- wait_cc_evt = ((rome_ver >= ROME_VER_1_1) && (gTlv_type == TLV_TYPE_PATCH ) +- && remain_size )? FALSE:TRUE; ++ if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) { ++ /* If the Rome version is from 1.1 to 3.1 ++ * 1. No CCE for the last command segment but all other segment ++ * 2. All the command segments get VSE including the last one ++ */ ++ wait_cc_evt = remain_size ? FALSE: TRUE; ++ } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) { ++ /* If the Rome version is 3.2 ++ * 1. None of the command segments receive CCE ++ * 2. No command segments receive VSE except the last one ++ * 3. If gtlv_dwndcfg is ROME_SKIP_EVT_NONE then the logic is ++ * same as Rome 2.1, 2.2, 3.0 ++ */ ++ if (gtlv_dwndcfg == ROME_SKIP_EVT_NONE) { ++ wait_cc_evt = remain_size ? FALSE: TRUE; ++ } else if (gtlv_dwndcfg == ROME_SKIP_EVT_VSE_CC) { ++ wait_vsc_evt = remain_size ? TRUE: FALSE; ++ } ++ } + + if(remain_size) err =rome_tlv_dnld_segment(fd, i, remain_size, wait_cc_evt); + +@@ -1619,6 +1689,10 @@ int qca_soc_init(int fd, char *bdaddr) + rampatch_file_path = ROME_RAMPATCH_TLV_3_0_0_PATH; + nvm_file_path = ROME_NVM_TLV_3_0_0_PATH; + goto download; ++ case ROME_VER_3_2: ++ rampatch_file_path = ROME_RAMPATCH_TLV_3_0_2_PATH; ++ nvm_file_path = ROME_NVM_TLV_3_0_2_PATH; ++ goto download; + case TUFELLO_VER_1_0: + rampatch_file_path = TF_RAMPATCH_TLV_1_0_0_PATH; + nvm_file_path = TF_NVM_TLV_1_0_0_PATH; +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 9d18c576fcae..77e85e7e7b19 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -204,9 +204,17 @@ typedef struct + #define ROME_NVM_TLV_2_0_1_PATH "/lib/firmware/nvm_tlv_2.1.bin" + #define ROME_RAMPATCH_TLV_3_0_0_PATH "/lib/firmware/qca/rampatch_tlv_3.0.tlv" + #define ROME_NVM_TLV_3_0_0_PATH "/lib/firmware/qca/nvm_tlv_3.0.bin" ++#define ROME_RAMPATCH_TLV_3_0_2_PATH "/lib/firmware/qca/rampatch_tlv_3.2.tlv" ++#define ROME_NVM_TLV_3_0_2_PATH "/lib/firmware/qca/nvm_tlv_3.2.bin" + #define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/rampatch_tlv_tf_1.0.tlv" + #define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/nvm_tlv_tf_1.0.bin" + ++/* This header value in rampatch file decides event handling mechanism in the HOST */ ++#define ROME_SKIP_EVT_NONE 0x00 ++#define ROME_SKIP_EVT_VSE 0x01 ++#define ROME_SKIP_EVT_CC 0x02 ++#define ROME_SKIP_EVT_VSE_CC 0x03 ++ + /****************************************************************************** + ** Local type definitions + ******************************************************************************/ +@@ -251,7 +259,8 @@ typedef struct { + unsigned int tlv_patch_data_len; + unsigned char sign_ver; + unsigned char sign_algorithm; +- unsigned short reserved1; ++ unsigned char dwnd_cfg; ++ unsigned char reserved1; + unsigned short prod_id; + unsigned short build_ver; + unsigned short patch_ver; +@@ -306,7 +315,8 @@ enum{ + ROME_PATCH_VER_0100 = 0x0100, + ROME_PATCH_VER_0101 = 0x0101, + ROME_PATCH_VER_0200 = 0x0200, +- ROME_PATCH_VER_0300 = 0x0300 ++ ROME_PATCH_VER_0300 = 0x0300, ++ ROME_PATCH_VER_0302 = 0x0302 + }; + + enum{ +@@ -314,6 +324,7 @@ enum{ + ROME_SOC_ID_11 = 0x00000011, + ROME_SOC_ID_13 = 0x00000013, + ROME_SOC_ID_22 = 0x00000022, ++ ROME_SOC_ID_44 = 0x00000044 + }; + + enum{ +@@ -323,6 +334,7 @@ enum{ + ROME_VER_1_3 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_00 ), + ROME_VER_2_1 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_11 ), + ROME_VER_3_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_22 ), ++ ROME_VER_3_2 = ((ROME_PATCH_VER_0302 << 16 ) | ROME_SOC_ID_44 ), + TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 ) + }; + #endif /* HW_ROME_H */ diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0010-bluetooth-Use-correct-TTY-ioctl-calls-for-flow-contr.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0010-bluetooth-Use-correct-TTY-ioctl-calls-for-flow-contr.patch new file mode 100644 index 000000000..b48e915e2 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0010-bluetooth-Use-correct-TTY-ioctl-calls-for-flow-contr.patch @@ -0,0 +1,189 @@ +From: Anantha Krishnan +Date: Thu, 4 Dec 2014 17:23:58 +0530 +Subject: [PATCH] bluetooth: Use correct TTY ioctl calls for flow control + operations + +BT firmware download application is using incorrect APIs for +performing flow off and flow on operations. As a result, the local +UART Controller is detecting breaks errors on the UART HW lines. + +Appliaction should use TIOCMGET and TIOCMSET ioctl()'s for flow +control operations instead of the tcsetattr() call. Also, the +application should set the value of "number of bits per character" +value to 8 and not as 5. + +Due to incorrect APIs used for flow control operation and wrong +value configured for CSIZE parameter, the local UART Controller +detected break errors on the UART HW lines. This caused the +firmware download operation to fail and resulted in BT ON failure. + +Change-Id: Id0ac1276609eceb528163860cc87267aaa50fede +--- + tools/hciattach_rome.c | 67 +++++++++++++++++++++++++++++++++----------------- + tools/hciattach_rome.h | 6 +++-- + 2 files changed, 49 insertions(+), 24 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index c6d528f118e1..1e689273b851 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -1,6 +1,6 @@ + /* + * +- * Copyright (c) 2013, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. + * Not a Contribution. + * + * Copyright 2012 The Android Open Source Project +@@ -31,6 +31,7 @@ + + #define LOG_TAG "bt_vendor" + #include ++#include + #include + #include + #include +@@ -139,6 +140,16 @@ void userial_vendor_set_baud(unsigned char userial_baud) + unsigned int tcio_baud; + fprintf(stderr, "## userial_vendor_set_baud: %d\n", userial_baud); + ++ if (tcgetattr(vnd_userial.fd, &vnd_userial.termios) < 0) { ++ perror("Can't get port settings"); ++ return; ++ } ++ cfmakeraw(&vnd_userial.termios); ++ vnd_userial.termios.c_cflag |= CLOCAL; ++ vnd_userial.termios.c_cflag |= CREAD; ++ vnd_userial.termios.c_cflag |= CS8; ++ tcsetattr(vnd_userial.fd, TCSANOW, &vnd_userial.termios); ++ + userial_to_tcio_baud(userial_baud, &tcio_baud); + + cfsetospeed(&vnd_userial.termios, tcio_baud); +@@ -169,6 +180,7 @@ int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data) + cfmakeraw(&ti); + ti.c_cflag |= CLOCAL; + ti.c_cflag |= CREAD; ++ ti.c_cflag |= CS8; + + switch(op) + { +@@ -1445,6 +1457,29 @@ error: + + } + ++static void flow_control(int fd, int opt) ++{ ++ struct termios c_opt; ++ ++ ioctl(fd, TIOCMGET, &c_opt); ++ c_opt.c_cc[VTIME] = 0; /* inter-character timer unused */ ++ c_opt.c_cc[VMIN] = 0; /* blocking read until 8 chars received */ ++ c_opt.c_cflag &= ~CSIZE; ++ c_opt.c_cflag |= (CS8 | CLOCAL | CREAD); ++ if (MSM_ENABLE_FLOW_CTRL) ++ c_opt.c_cflag |= CRTSCTS; ++ else if (MSM_DISABLE_FLOW_CTRL) ++ c_opt.c_cflag |= ~CRTSCTS; ++ else { ++ fprintf(stderr, "%s: Incorrect option passed for TIOCMSET\n", __func__); ++ return; ++ } ++ c_opt.c_iflag = IGNPAR; ++ c_opt.c_oflag = 0; ++ c_opt.c_lflag = 0; ++ ioctl(fd, TIOCMSET, &c_opt); ++} ++ + + int rome_set_baudrate_req(int fd) + { +@@ -1464,12 +1499,10 @@ int rome_set_baudrate_req(int fd) + + /* Total length of the packet to be sent to the Controller */ + size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_SET_BAUDRATE_REQ_LEN); ++ + /* Flow off during baudrate change */ +- if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_OFF , &flags)) < 0) +- { +- fprintf(stderr, "%s: HW Flow-off error: 0x%x\n", __FUNCTION__, err); +- goto error; +- } ++ flow_control(fd, MSM_DISABLE_FLOW_CTRL); ++ + /* Send the HCI command packet to UART for transmission */ + fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3],cmd[4]) ; + err = write(fd, cmd, size); +@@ -1481,11 +1514,8 @@ int rome_set_baudrate_req(int fd) + userial_vendor_set_baud(USERIAL_BAUD_3M); + + /* Flow on after changing local uart baudrate */ +- if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_ON , &flags)) < 0) +- { +- fprintf(stderr, "%s: HW Flow-on error: 0x%x \n", __FUNCTION__, err); +- return err; +- } ++ flow_control(fd, MSM_ENABLE_FLOW_CTRL); ++ + /* Check for response from the Controller */ + if ((err =read_vs_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE)) < 0) { + fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__); +@@ -1528,11 +1558,8 @@ int rome_hci_reset_req(int fd) + size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE); + + /* Flow off during baudrate change */ +- if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_OFF , &flags)) < 0) +- { +- fprintf(stderr, "%s: HW Flow-off error: 0x%x\n", __FUNCTION__, err); +- goto error; +- } ++ flow_control(fd, MSM_DISABLE_FLOW_CTRL); ++ + /* Send the HCI command packet to UART for transmission */ + fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]); + err = write(fd, cmd, size); +@@ -1545,11 +1572,8 @@ int rome_hci_reset_req(int fd) + userial_vendor_set_baud(USERIAL_BAUD_3M); + + /* Flow on after changing local uart baudrate */ +- if ((err = userial_vendor_ioctl(fd, USERIAL_OP_FLOW_ON , &flags)) < 0) +- { +- fprintf(stderr, "%s: HW Flow-on error: 0x%x \n", __FUNCTION__, err); +- return err; +- } ++ flow_control(fd, MSM_ENABLE_FLOW_CTRL); ++ + /* Wait for command complete event */ + err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE); + if ( err < 0) { +@@ -1616,7 +1640,6 @@ int qca_soc_init(int fd, char *bdaddr) + int err = -1; + int size; + +- fprintf(stderr, " %s \n", __FUNCTION__); + vnd_userial.fd = fd; + /* Get Rome version information */ + if((err = rome_patch_ver_req(fd)) <0){ +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 77e85e7e7b19..ef3647e6a69b 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -1,7 +1,7 @@ + /* +- * Copyright 2012 The Android Open Source Project +- * Copyright (c) 2013, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. + * Not a Contribution. ++ * Copyright 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. +@@ -40,6 +40,8 @@ + #define NVITEM_SIZE 2 + #define PERSIST_HEADER_LEN 3 + #define BD_ADDR_LEN 6 ++#define MSM_ENABLE_FLOW_CTRL 16 ++#define MSM_DISABLE_FLOW_CTRL 17 + + unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + typedef enum { diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0011-bluetooth-Add-support-for-multi-baud-rate.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0011-bluetooth-Add-support-for-multi-baud-rate.patch new file mode 100644 index 000000000..05a06061e --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0011-bluetooth-Add-support-for-multi-baud-rate.patch @@ -0,0 +1,256 @@ +From: Anantha Krishnan +Date: Tue, 20 Jan 2015 12:43:20 +0530 +Subject: [PATCH] bluetooth: Add support for multi baud rate + +Currently BT operates only at 3M baud rate. Provide option +to configure the pre-defined baud rate values as supported by the +target platform. + +Change-Id: I4bbaf7db01ffb983c38dca7c4a4a56f579c678a8 +--- + tools/hciattach.c | 2 +- + tools/hciattach.h | 2 +- + tools/hciattach_rome.c | 109 ++++++++++++++++++++++++++++++++++++++++++------- + tools/hciattach_rome.h | 23 +++++++++++ + 4 files changed, 119 insertions(+), 17 deletions(-) + +diff --git a/tools/hciattach.c b/tools/hciattach.c +index 13f073325c43..6de4129dfd8f 100644 +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -340,7 +340,7 @@ static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti) + static int qca(int fd, struct uart_t *u, struct termios *ti) + { + fprintf(stderr,"qca\n"); +- return qca_soc_init(fd, u->bdaddr); ++ return qca_soc_init(fd, u->speed, u->bdaddr); + } + + static int qualcomm(int fd, struct uart_t *u, struct termios *ti) +diff --git a/tools/hciattach.h b/tools/hciattach.h +index 2021c33a9824..c5aa495ac3ee 100644 +--- a/tools/hciattach.h ++++ b/tools/hciattach.h +@@ -63,7 +63,7 @@ int ath3k_init(int fd, int speed, int init_speed, char *bdaddr, + struct termios *ti); + int ath3k_post(int fd, int pm); + int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr); +-int qca_soc_init(int fd, char *bdaddr); ++int qca_soc_init(int fd, int speed, char *bdaddr); + int intel_init(int fd, int init_speed, int *speed, struct termios *ti); + int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti, + const char *bdaddr); +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 1e689273b851..37974290ae0a 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -1481,7 +1481,7 @@ static void flow_control(int fd, int opt) + } + + +-int rome_set_baudrate_req(int fd) ++int rome_set_baudrate_req(int fd, int local_baud_rate, int controller_baud_rate) + { + int size, err = 0; + unsigned char cmd[HCI_MAX_CMD_SIZE]; +@@ -1495,7 +1495,7 @@ int rome_set_baudrate_req(int fd) + cmd[0] = HCI_COMMAND_PKT; + cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, EDL_SET_BAUDRATE_CMD_OCF); + cmd_hdr->plen = VSC_SET_BAUDRATE_REQ_LEN; +- cmd[4] = BAUDRATE_3000000; ++ cmd[4] = controller_baud_rate; + + /* Total length of the packet to be sent to the Controller */ + size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + VSC_SET_BAUDRATE_REQ_LEN); +@@ -1511,7 +1511,7 @@ int rome_set_baudrate_req(int fd) + goto error; + } + /* Change Local UART baudrate to high speed UART */ +- userial_vendor_set_baud(USERIAL_BAUD_3M); ++ userial_vendor_set_baud(local_baud_rate); + + /* Flow on after changing local uart baudrate */ + flow_control(fd, MSM_ENABLE_FLOW_CTRL); +@@ -1537,7 +1537,7 @@ error: + } + + +-int rome_hci_reset_req(int fd) ++int rome_hci_reset_req(int fd, char baud) + { + int size, err = 0; + unsigned char cmd[HCI_MAX_CMD_SIZE]; +@@ -1569,7 +1569,7 @@ int rome_hci_reset_req(int fd) + } + + /* Change Local UART baudrate to high speed UART */ +- userial_vendor_set_baud(USERIAL_BAUD_3M); ++ userial_vendor_set_baud(baud); + + /* Flow on after changing local uart baudrate */ + flow_control(fd, MSM_ENABLE_FLOW_CTRL); +@@ -1635,10 +1635,69 @@ int read_bd_address(unsigned char *bdaddr) + return 0; + } + +-int qca_soc_init(int fd, char *bdaddr) ++int isSpeedValid(int speed, int *local_baud_rate, int *controller_baud_rate) ++{ ++ switch(speed) { ++ case 9600: ++ *local_baud_rate = USERIAL_BAUD_9600; ++ *controller_baud_rate = BAUDRATE_9600; ++ break; ++ case 19200: ++ *local_baud_rate = USERIAL_BAUD_19200; ++ *controller_baud_rate = BAUDRATE_19200; ++ break; ++ case 57600: ++ *local_baud_rate = USERIAL_BAUD_57600; ++ *controller_baud_rate = BAUDRATE_57600; ++ break; ++ case 115200: ++ *local_baud_rate = USERIAL_BAUD_115200; ++ *controller_baud_rate = BAUDRATE_115200; ++ break; ++ case 230400: ++ *local_baud_rate = USERIAL_BAUD_230400; ++ *controller_baud_rate = BAUDRATE_230400; ++ break; ++ case 460800: ++ *local_baud_rate = USERIAL_BAUD_460800; ++ *controller_baud_rate = BAUDRATE_460800; ++ break; ++ case 921600: ++ *local_baud_rate = USERIAL_BAUD_921600; ++ *controller_baud_rate = BAUDRATE_921600; ++ break; ++ case 1000000: ++ *local_baud_rate = USERIAL_BAUD_1M; ++ *controller_baud_rate = BAUDRATE_1000000; ++ break; ++ case 2000000: ++ *local_baud_rate = USERIAL_BAUD_2M; ++ *controller_baud_rate = BAUDRATE_2000000; ++ break; ++ case 3000000: ++ *local_baud_rate = USERIAL_BAUD_3M; ++ *controller_baud_rate = BAUDRATE_3000000; ++ break; ++ case 4000000: ++ *local_baud_rate = USERIAL_BAUD_4M; ++ *controller_baud_rate = BAUDRATE_4000000; ++ break; ++ case 300: ++ case 600: ++ case 1200: ++ case 2400: ++ default: ++ fprintf(stderr, "Invalid baud rate passed!\n"); ++ *local_baud_rate = *controller_baud_rate = -1; ++ break; ++ } ++ return -1; ++} ++ ++int qca_soc_init(int fd, int speed, char *bdaddr) + { + int err = -1; +- int size; ++ int size, local_baud_rate = 0, controller_baud_rate = 0; + + vnd_userial.fd = fd; + /* Get Rome version information */ +@@ -1687,7 +1746,7 @@ int qca_soc_init(int fd, char *bdaddr) + } + + /* Change baud rate 115.2 kbps to 3Mbps*/ +- err = rome_hci_reset_req(fd); ++ err = rome_hci_reset_req(fd, local_baud_rate); + if ( err <0 ) { + fprintf(stderr, "HCI Reset Failed !!\n"); + goto error; +@@ -1721,13 +1780,23 @@ int qca_soc_init(int fd, char *bdaddr) + nvm_file_path = TF_NVM_TLV_1_0_0_PATH; + + download: +- /* Change baud rate 115.2 kbps to 3Mbps*/ +- err = rome_set_baudrate_req(fd); +- if (err < 0) { +- fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); +- goto error; ++ /* Check if user requested for 115200 kbps */ ++ if (speed == 115200) { ++ local_baud_rate = USERIAL_BAUD_115200; ++ controller_baud_rate = BAUDRATE_115200; + } +- fprintf(stderr, "%s: Baud rate changed successfully \n", __FUNCTION__); ++ else { ++ /* Change only if baud rate requested is valid or not */ ++ isSpeedValid(speed, &local_baud_rate, &controller_baud_rate); ++ if (local_baud_rate < 0 || controller_baud_rate < 0) ++ goto error; ++ ++ err = rome_set_baudrate_req(fd, local_baud_rate, controller_baud_rate); ++ if (err < 0) { ++ fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); ++ goto error; ++ } ++ } + + /* Donwload TLV files (rampatch, NVM) */ + err = rome_download_tlv_file(fd); +@@ -1737,8 +1806,18 @@ download: + } + fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__); + ++ /* ++ * Overriding the baud rate value in NVM file with the user ++ * requested baud rate, since default baud rate in NVM file is 3M. ++ */ ++ err = rome_set_baudrate_req(fd, local_baud_rate, controller_baud_rate); ++ if (err < 0) { ++ fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__); ++ goto error; ++ } ++ + /* Perform HCI reset here*/ +- err = rome_hci_reset_req(fd); ++ err = rome_hci_reset_req(fd, local_baud_rate); + if ( err <0 ) { + fprintf(stderr, "HCI Reset Failed !!!\n"); + goto error; +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index ef3647e6a69b..1500ddd3a79f 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -78,6 +78,29 @@ typedef struct + #define USERIAL_BAUD_4M 15 + #define USERIAL_BAUD_AUTO 16 + ++/* Vendor specific baud rate values */ ++#define UART_Baud_Rate_Baud_9600 4 ++#define UART_Baud_Rate_Baud_19200 3 ++#define UART_Baud_Rate_Baud_57600 1 ++#define UART_Baud_Rate_Baud_115200 0 ++#define UART_Baud_Rate_Baud_230400 5 ++#define UART_Baud_Rate_Baud_460800 7 ++#define UART_Baud_Rate_Baud_921600 10 ++#define UART_Baud_Rate_Baud_1000000 11 ++#define UART_Baud_Rate_Baud_2000000 13 ++#define UART_Baud_Rate_Baud_3000000 14 ++#define UART_Baud_Rate_Baud_4000000 15 ++ ++#define UART_Baud_Rate_Baud_250000 6 ++#define UART_Baud_Rate_Baud_500000 8 ++#define UART_Baud_Rate_Baud_720000 9 ++#define UART_Baud_Rate_Baud_125000 12 ++#define UART_Baud_Rate_Baud_1600000 16 ++#define UART_Baud_Rate_Baud_3200000 17 ++#define UART_Baud_Rate_Baud_3500000 18 ++ ++ ++ + #ifndef FALSE + #define FALSE 0 + #endif diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0012-Override-PCM-Settings-by-reading-configuration-file.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0012-Override-PCM-Settings-by-reading-configuration-file.patch new file mode 100644 index 000000000..c86dee8e7 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0012-Override-PCM-Settings-by-reading-configuration-file.patch @@ -0,0 +1,144 @@ +From: Kamal Negi +Date: Tue, 30 Dec 2014 19:15:08 +0530 +Subject: [PATCH] Override PCM Settings by reading configuration file + +Configure the PCM role as master or slave depending upon +the platform's support. This configuration is provided +in the config file which is read during the firmware +download process and the default PCM configuration is +overwritten with this value. + +Change-Id: If0eae58b4cd32d75b3bcb669bc73dca67652473c +Signed-off-by: Kamal Negi +--- + tools/hciattach_rome.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++--- + tools/hciattach_rome.h | 8 ++++++ + 2 files changed, 71 insertions(+), 4 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 37974290ae0a..99866e23e99e 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -1,6 +1,6 @@ + /* + * +- * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. + * Not a Contribution. + * + * Copyright 2012 The Android Open Source Project +@@ -873,6 +873,44 @@ error: + return err; + } + ++int get_value_from_config(char *file_path,char *param) ++{ ++ FILE *pfile = NULL; ++ char *line = NULL; ++ char *pch = NULL; ++ char param_str[20]; ++ int bytes_read = 0, position; ++ int ret = -1; ++ ++ if (!file_path || !param) { ++ fprintf(stderr,"Invalid arguments\n"); ++ return -EINVAL; ++ } ++ ++ pfile = fopen(file_path, "r" ); ++ if (!pfile) { ++ fprintf(stderr, "Failed to open %s\n", file_path); ++ return ret; ++ } ++ ++ while (getline(&line, &bytes_read, pfile) > 0 ) { ++ if (line[0] != '#' && line[0] != '\n') { ++ pch = memchr(line, '=', strlen(line)); ++ if (pch != NULL) { ++ position = pch - line; ++ strncpy(param_str, line, position); ++ if (strncmp(param_str, param, position) == 0) { ++ ret = atoi(pch + 1); ++ break; ++ } ++ } ++ } ++ } ++ free(line); ++ fclose(pfile); ++ return ret; ++} ++ + int rome_get_tlv_file(char *file_path) + { + FILE * pFile; +@@ -884,7 +922,7 @@ int rome_get_tlv_file(char *file_path) + unsigned char data_buf[PRINT_BUF_SIZE]={0,}; + unsigned char *nvm_byte_ptr; + unsigned char bdaddr[6]; +- ++ unsigned short pcm_value; + fprintf(stderr, "File Open (%s)\n", file_path); + pFile = fopen ( file_path , "r" ); + if (pFile==NULL) {; +@@ -970,9 +1008,30 @@ int rome_get_tlv_file(char *file_path) + *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2), + *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5)); + } ++ /* Read from file and check what PCM Configuration is required: ++ * Master = 0 /Slave = 1 */ ++ /* Override PCM configuration */ ++ if (nvm_ptr->tag_id == TAG_NUM_44) { ++ if ((pcm_value = ++ get_value_from_config(PCM_CONFIG_FILE_PATH, "PCM")) >= 0) { ++ ++ if (pcm_value == PCM_SLAVE) { ++ nvm_byte_ptr[PCM_MS_OFFSET_1] |= ++ (1 << PCM_ROLE_BIT_OFFSET); ++ nvm_byte_ptr[PCM_MS_OFFSET_2] |= ++ (1 << PCM_ROLE_BIT_OFFSET); ++ } else if (pcm_value == PCM_MASTER) { ++ nvm_byte_ptr[PCM_MS_OFFSET_1] &= ++ (~(1 << PCM_ROLE_BIT_OFFSET)); ++ nvm_byte_ptr[PCM_MS_OFFSET_2] &= ++ (~(1 << PCM_ROLE_BIT_OFFSET)); ++ } ++ } ++ } + +- for(i =0;(itag_len && (i*3 + 2) tag_len && (i*3 + 2) < PRINT_BUF_SIZE);i++) ++ snprintf((char *) data_buf, PRINT_BUF_SIZE, "%s%.02x ", ++ (char *)data_buf, *(nvm_byte_ptr + i)); + + fprintf(stderr, "TAG Data\t\t\t : %s\n", data_buf); + +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 1500ddd3a79f..f591c10e4f2b 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -202,8 +202,15 @@ typedef struct + #define NVM_ACCESS_SET 0x01 + #define TAG_NUM_OFFSET 5 + #define TAG_NUM_2 2 ++#define TAG_NUM_44 44 + #define TAG_BDADDR_OFFSET 7 + ++#define PCM_MS_OFFSET_1 9 ++#define PCM_MS_OFFSET_2 33 ++ ++#define PCM_SLAVE 1 ++#define PCM_MASTER 0 ++#define PCM_ROLE_BIT_OFFSET 4 + #define MAX_RETRY_CNT 1 + #define SELECT_TIMEOUT 3 + +@@ -240,6 +247,7 @@ typedef struct + #define ROME_SKIP_EVT_CC 0x02 + #define ROME_SKIP_EVT_VSE_CC 0x03 + ++#define PCM_CONFIG_FILE_PATH "/etc/bluetooth/pcm.conf" + /****************************************************************************** + ** Local type definitions + ******************************************************************************/ diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0013-Add-support-for-Tufello-1.1-SOC.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0013-Add-support-for-Tufello-1.1-SOC.patch new file mode 100644 index 000000000..f47a9d47e --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0013-Add-support-for-Tufello-1.1-SOC.patch @@ -0,0 +1,169 @@ +From: Rupesh Tatiya +Date: Thu, 29 Jan 2015 15:36:27 +0530 +Subject: [PATCH] Add support for Tufello 1.1 SOC + +Enable mechanism to download firmware for Tufello 1.1 SOC. +Also, use correct firmware file path for Tufello 1.0. + +Change-Id: I915e48023e45de9e2550336a3de9a07f2b788189 +Signed-off-by: Rupesh Tatiya +--- + tools/hciattach_rome.c | 29 ++++++++++++++++++----------- + tools/hciattach_rome.h | 10 +++++++--- + 2 files changed, 25 insertions(+), 14 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 99866e23e99e..fee36f904e04 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -621,7 +621,7 @@ int rome_edl_set_patch_request(int fd) + -1, PATCH_HDR_LEN + 1); + + /* Total length of the packet to be sent to the Controller */ +- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); + + /* Send HCI Command packet to Controller */ + err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); +@@ -670,7 +670,7 @@ int rome_edl_patch_download_request(int fd) + index, MAX_DATA_PER_SEGMENT); + + /* Total length of the packet to be sent to the Controller */ +- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); + + /* Initialize the RSP packet everytime to 0 */ + memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); +@@ -707,7 +707,7 @@ int rome_edl_patch_download_request(int fd) + memset(rsp, 0x0, HCI_MAX_EVENT_SIZE); + + /* Total length of the packet to be sent to the Controller */ +- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); + + /* Send HCI Command packet to Controller */ + err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); +@@ -824,7 +824,7 @@ int rome_attach_rampatch(int fd) + -1, EDL_PATCH_CMD_LEN); + + /* Total length of the packet to be sent to the Controller */ +- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]); + + /* Send HCI Command packet to Controller */ + err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size); +@@ -854,7 +854,7 @@ int rome_rampatch_reset(int fd) + -1, EDL_PATCH_CMD_LEN); + + /* Total length of the packet to be sent to the Controller */ +- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); ++ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN); + + /* Send HCI Command packet to Controller */ + err = write(fd, cmd, size); +@@ -1058,7 +1058,7 @@ int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc + unsigned char cmd[HCI_MAX_CMD_SIZE]; + unsigned char rsp[HCI_MAX_EVENT_SIZE]; + +- fprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d\n", __FUNCTION__, index, seg_size); ++ fprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d wait_cc_evt = 0x%x\n", __FUNCTION__, index, seg_size, wait_cc_evt); + + /* Frame the HCI CMD PKT to be sent to Controller*/ + frame_hci_cmd_pkt(cmd, EDL_PATCH_TLV_REQ_CMD, 0, index, seg_size); +@@ -1092,6 +1092,7 @@ int rome_tlv_dnld_req(int fd, int tlv_size) + { + int total_segment, remain_size, i, err = -1; + unsigned char wait_cc_evt; ++ unsigned int rom = rome_ver >> 16; + + total_segment = tlv_size/MAX_SIZE_PER_TLV_SEGMENT; + remain_size = (tlv_size < MAX_SIZE_PER_TLV_SEGMENT)?\ +@@ -1132,14 +1133,15 @@ int rome_tlv_dnld_req(int fd, int tlv_size) + + for(i = 0; i < total_segment; i++) { + if((i+1) == total_segment) { +- if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) && ++ if ((rom >= ROME_PATCH_VER_0100) && (rom < ROME_PATCH_VER_0302) && + (gTlv_type == TLV_TYPE_PATCH)) { + /* If the Rome version is from 1.1 to 3.1 + * 1. No CCE for the last command segment but all other segment + * 2. All the command segments get VSE including the last one + */ + wait_cc_evt = !remain_size ? FALSE: TRUE; +- } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) { ++ } else if ((rom == ROME_PATCH_VER_0302) && ++ (gTlv_type == TLV_TYPE_PATCH)) { + /* If the Rome version is 3.2 + * 1. None of the command segments receive CCE + * 2. No command segments receive VSE except the last one +@@ -1158,13 +1160,14 @@ int rome_tlv_dnld_req(int fd, int tlv_size) + goto error; + } + +- if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) { ++ if ((rom >= ROME_PATCH_VER_0100) && (rom < ROME_PATCH_VER_0302) && ++ (gTlv_type == TLV_TYPE_PATCH)) { + /* If the Rome version is from 1.1 to 3.1 + * 1. No CCE for the last command segment but all other segment + * 2. All the command segments get VSE including the last one + */ + wait_cc_evt = remain_size ? FALSE: TRUE; +- } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) { ++ } else if ((rom == ROME_PATCH_VER_0302) && (gTlv_type == TLV_TYPE_PATCH)) { + /* If the Rome version is 3.2 + * 1. None of the command segments receive CCE + * 2. No command segments receive VSE except the last one +@@ -1837,6 +1840,10 @@ int qca_soc_init(int fd, int speed, char *bdaddr) + case TUFELLO_VER_1_0: + rampatch_file_path = TF_RAMPATCH_TLV_1_0_0_PATH; + nvm_file_path = TF_NVM_TLV_1_0_0_PATH; ++ goto download; ++ case TUFELLO_VER_1_1: ++ rampatch_file_path = TF_RAMPATCH_TLV_1_0_1_PATH; ++ nvm_file_path = TF_NVM_TLV_1_0_1_PATH; + + download: + /* Check if user requested for 115200 kbps */ +@@ -1881,7 +1888,7 @@ download: + fprintf(stderr, "HCI Reset Failed !!!\n"); + goto error; + } +- fprintf(stderr, "HCI Reset is done\n"); ++ fprintf(stderr, "HCI Reset is done\n"); + + break; + case ROME_VER_UNKNOWN: +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index f591c10e4f2b..95d5f1e8a5c2 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -238,8 +238,10 @@ typedef struct + #define ROME_NVM_TLV_3_0_0_PATH "/lib/firmware/qca/nvm_tlv_3.0.bin" + #define ROME_RAMPATCH_TLV_3_0_2_PATH "/lib/firmware/qca/rampatch_tlv_3.2.tlv" + #define ROME_NVM_TLV_3_0_2_PATH "/lib/firmware/qca/nvm_tlv_3.2.bin" +-#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/rampatch_tlv_tf_1.0.tlv" +-#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/nvm_tlv_tf_1.0.bin" ++#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/qca/rampatch_tlv_tf_1.0.tlv" ++#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/qca/nvm_tlv_tf_1.0.bin" ++#define TF_RAMPATCH_TLV_1_0_1_PATH "/lib/firmware/qca/rampatch_tlv_tf_1.1.tlv" ++#define TF_NVM_TLV_1_0_1_PATH "/lib/firmware/qca/nvm_tlv_tf_1.1.bin" + + /* This header value in rampatch file decides event handling mechanism in the HOST */ + #define ROME_SKIP_EVT_NONE 0x00 +@@ -357,6 +359,7 @@ enum{ + ROME_SOC_ID_11 = 0x00000011, + ROME_SOC_ID_13 = 0x00000013, + ROME_SOC_ID_22 = 0x00000022, ++ ROME_SOC_ID_23 = 0x00000023, + ROME_SOC_ID_44 = 0x00000044 + }; + +@@ -368,6 +371,7 @@ enum{ + ROME_VER_2_1 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_11 ), + ROME_VER_3_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_22 ), + ROME_VER_3_2 = ((ROME_PATCH_VER_0302 << 16 ) | ROME_SOC_ID_44 ), +- TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 ) ++ TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 ), ++ TUFELLO_VER_1_1 = ((ROME_PATCH_VER_0302 << 16 ) | ROME_SOC_ID_23 ) + }; + #endif /* HW_ROME_H */ diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0014-bluetooth-Vote-UART-CLK-ON-prior-to-firmware-downloa.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0014-bluetooth-Vote-UART-CLK-ON-prior-to-firmware-downloa.patch new file mode 100644 index 000000000..ffb182062 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0014-bluetooth-Vote-UART-CLK-ON-prior-to-firmware-downloa.patch @@ -0,0 +1,74 @@ +From: Anantha Krishnan +Date: Wed, 4 Feb 2015 12:29:07 +0530 +Subject: [PATCH] bluetooth: Vote UART CLK ON prior to firmware download + process + +Before starting the firmware download process, vote UART CLK ON +to avoid triggering the dynamic suspend of UART driver. Post +firmware download and in error scenarios vote UART CLK OFF. + +As per design, the UART driver enters into dynamic suspend if +there are no activity on the UART lines for 100ms. Depending upon +the rampatch size, the BT Controller takes time to apply the +downloaded rampatch segments and in sending the vendor specific +event. If the BT Controller takes > 100ms time in sending the +vendor specific event, the UART driver enters into suspend state. + +As a result, UART driver fails to process the last vendor specific +event sent by the BT Controller. The VSE sent by BT Controller +wakes up the UART driver, but the data is not processed causing +firmware download failures. + +Hence, vote UART CLK ON prior to firmware download process and +vote UART CLK OFF post firmware download proess and in error +scenarios. + +Change-Id: I447ded33ad1cfaa020b491effce368fbfe41f894 +--- + tools/hciattach_rome.c | 13 +++++++++++++ + tools/hciattach_rome.h | 2 ++ + 2 files changed, 15 insertions(+) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index fee36f904e04..574ceac6c750 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -1762,6 +1762,14 @@ int qca_soc_init(int fd, int speed, char *bdaddr) + int size, local_baud_rate = 0, controller_baud_rate = 0; + + vnd_userial.fd = fd; ++ ++ /* Vote for UART CLK prior to FW download */ ++ err = ioctl(fd, USERIAL_OP_CLK_ON); ++ if (err < 0) { ++ fprintf(stderr, "%s: Failed to vote UART CLK ON\n", __func__); ++ return -1; ++ } ++ + /* Get Rome version information */ + if((err = rome_patch_ver_req(fd)) <0){ + fprintf(stderr, "%s: Fail to get Rome Version (0x%x)\n", __FUNCTION__, err); +@@ -1899,5 +1907,10 @@ download: + } + + error: ++ /* Vote UART CLK OFF post to FW download */ ++ err = ioctl(fd, USERIAL_OP_CLK_OFF); ++ if (err < 0) ++ fprintf(stderr, "%s: Failed to vote UART CLK OFF!!!\n", __func__); ++ + return err; + } +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 95d5f1e8a5c2..20264f9978d9 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -42,6 +42,8 @@ + #define BD_ADDR_LEN 6 + #define MSM_ENABLE_FLOW_CTRL 16 + #define MSM_DISABLE_FLOW_CTRL 17 ++#define USERIAL_OP_CLK_ON 0x5441 ++#define USERIAL_OP_CLK_OFF 0x5442 + + unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + typedef enum { diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0015-Override-IBS-settings-by-reading-configuration-file.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0015-Override-IBS-settings-by-reading-configuration-file.patch new file mode 100644 index 000000000..0a1e865ba --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0015-Override-IBS-settings-by-reading-configuration-file.patch @@ -0,0 +1,127 @@ +From: Kamal Negi +Date: Thu, 30 Apr 2015 15:53:06 +0530 +Subject: [PATCH] Override IBS settings by reading configuration file + +Configure the IBS value in Firmware by reading the +configuration file.This configuration value is +provided in the config file which is read during +the firmware download process and the default +configuration value is overwritten with this value. + +Change-Id: I47992a573b3137ac9bfb80538727981f56b328c4 +Signed-off-by: Kamal Negi +--- + tools/hciattach_rome.c | 42 +++++++++++++++++++++++++++++------------- + tools/hciattach_rome.h | 24 ++++++++++++++++-------- + 2 files changed, 45 insertions(+), 21 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 574ceac6c750..6a3f33867c12 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -922,7 +922,8 @@ int rome_get_tlv_file(char *file_path) + unsigned char data_buf[PRINT_BUF_SIZE]={0,}; + unsigned char *nvm_byte_ptr; + unsigned char bdaddr[6]; +- unsigned short pcm_value; ++ unsigned short pcm_value, ibs_value; ++ + fprintf(stderr, "File Open (%s)\n", file_path); + pFile = fopen ( file_path , "r" ); + if (pFile==NULL) {; +@@ -1008,23 +1009,38 @@ int rome_get_tlv_file(char *file_path) + *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2), + *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5)); + } ++ ++ if (nvm_ptr->tag_id == TAG_NUM_17) { ++ if ((ibs_value = ++ get_value_from_config(FW_CONFIG_FILE_PATH, "IBS")) >= 0) { ++ if (ibs_value == FWCONF_IBS_DISABLE) { ++ nvm_byte_ptr[FWCONF_IBS_VAL_OFFSET] &= ++ (~(FWCONF_IBS_ENABLE << ++ FWCONF_IBS_VAL_BIT)); ++ } else if (ibs_value == FWCONF_IBS_ENABLE) { ++ nvm_byte_ptr[FWCONF_IBS_VAL_OFFSET] |= ++ (FWCONF_IBS_ENABLE << ++ FWCONF_IBS_VAL_BIT); ++ } ++ } ++ } + /* Read from file and check what PCM Configuration is required: + * Master = 0 /Slave = 1 */ + /* Override PCM configuration */ + if (nvm_ptr->tag_id == TAG_NUM_44) { + if ((pcm_value = +- get_value_from_config(PCM_CONFIG_FILE_PATH, "PCM")) >= 0) { +- +- if (pcm_value == PCM_SLAVE) { +- nvm_byte_ptr[PCM_MS_OFFSET_1] |= +- (1 << PCM_ROLE_BIT_OFFSET); +- nvm_byte_ptr[PCM_MS_OFFSET_2] |= +- (1 << PCM_ROLE_BIT_OFFSET); +- } else if (pcm_value == PCM_MASTER) { +- nvm_byte_ptr[PCM_MS_OFFSET_1] &= +- (~(1 << PCM_ROLE_BIT_OFFSET)); +- nvm_byte_ptr[PCM_MS_OFFSET_2] &= +- (~(1 << PCM_ROLE_BIT_OFFSET)); ++ get_value_from_config(FW_CONFIG_FILE_PATH, "PCM")) >= 0) { ++ ++ if (pcm_value == FWCONF_PCM_SLAVE) { ++ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_1] |= ++ (1 << FWCONF_PCM_ROLE_BIT_OFFSET); ++ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_2] |= ++ (1 << FWCONF_PCM_ROLE_BIT_OFFSET); ++ } else if (pcm_value == FWCONF_PCM_MASTER) { ++ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_1] &= ++ (~(1 << FWCONF_PCM_ROLE_BIT_OFFSET)); ++ nvm_byte_ptr[FWCONF_PCM_MS_OFFSET_2] &= ++ (~(1 << FWCONF_PCM_ROLE_BIT_OFFSET)); + } + } + } +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 20264f9978d9..8eaeeed8bc96 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -203,16 +203,24 @@ typedef struct + #define TAG_END 0xFF + #define NVM_ACCESS_SET 0x01 + #define TAG_NUM_OFFSET 5 +-#define TAG_NUM_2 2 +-#define TAG_NUM_44 44 ++#define TAG_NUM_2 2 ++#define TAG_NUM_17 (17) ++#define TAG_NUM_44 44 + #define TAG_BDADDR_OFFSET 7 + +-#define PCM_MS_OFFSET_1 9 +-#define PCM_MS_OFFSET_2 33 ++/* FW PCM Configuration */ ++#define FWCONF_PCM_MS_OFFSET_1 9 ++#define FWCONF_PCM_MS_OFFSET_2 33 ++#define FWCONF_PCM_SLAVE 1 ++#define FWCONF_PCM_MASTER 0 ++#define FWCONF_PCM_ROLE_BIT_OFFSET 4 ++ ++/* FW IBS Configuration */ ++#define FWCONF_IBS_DISABLE (0) ++#define FWCONF_IBS_ENABLE (1) ++#define FWCONF_IBS_VAL_BIT (7) ++#define FWCONF_IBS_VAL_OFFSET (0) + +-#define PCM_SLAVE 1 +-#define PCM_MASTER 0 +-#define PCM_ROLE_BIT_OFFSET 4 + #define MAX_RETRY_CNT 1 + #define SELECT_TIMEOUT 3 + +@@ -251,7 +259,7 @@ typedef struct + #define ROME_SKIP_EVT_CC 0x02 + #define ROME_SKIP_EVT_VSE_CC 0x03 + +-#define PCM_CONFIG_FILE_PATH "/etc/bluetooth/pcm.conf" ++#define FW_CONFIG_FILE_PATH "/etc/bluetooth/firmware.conf" + /****************************************************************************** + ** Local type definitions + ******************************************************************************/ diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0016-Handle-NULL-Pointer-derefrencing-in-AVRCP-Target-rol.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0016-Handle-NULL-Pointer-derefrencing-in-AVRCP-Target-rol.patch new file mode 100644 index 000000000..19bd40406 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0016-Handle-NULL-Pointer-derefrencing-in-AVRCP-Target-rol.patch @@ -0,0 +1,79 @@ +From: Kamal Negi +Date: Fri, 8 May 2015 15:01:02 +0530 +Subject: [PATCH] Handle NULL Pointer derefrencing in AVRCP Target role + +Check NULL pointer to AVRCP controller role initialized or not. +If remote device don't support the AVRCP target role, then HOST dont +initialize AVRCP controller role and directly dereference the controller +role and segfault happens. + +Change-Id: Ibbb9452f17a576c3a79a53ea72e0211982752144 +Signed-off-by: Kamal Negi +--- + profiles/audio/avrcp.c | 27 ++++++++++++++++++++++----- + 1 file changed, 22 insertions(+), 5 deletions(-) + +diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c +index d66f67032624..9fa939d9548b 100644 +--- a/profiles/audio/avrcp.c ++++ b/profiles/audio/avrcp.c +@@ -1808,13 +1808,19 @@ static gboolean avrcp_get_play_status_rsp(struct avctp *conn, + void *user_data) + { + struct avrcp *session = user_data; +- struct avrcp_player *player = session->controller->player; +- struct media_player *mp = player->user_data; ++ struct avrcp_player *player; ++ struct media_player *mp; + struct avrcp_header *pdu = (void *) operands; + uint32_t duration; + uint32_t position; + uint8_t status; + ++ if (!session || !session->controller) ++ return FALSE; ++ ++ player = session->controller->player; ++ mp = player->user_data; ++ + if (pdu == NULL || code == AVC_CTYPE_REJECTED || + ntohs(pdu->params_len) != 9) + return FALSE; +@@ -1872,12 +1878,18 @@ static gboolean avrcp_player_value_rsp(struct avctp *conn, + void *user_data) + { + struct avrcp *session = user_data; +- struct avrcp_player *player = session->controller->player; +- struct media_player *mp = player->user_data; ++ struct avrcp_player *player; ++ struct media_player *mp; + struct avrcp_header *pdu = (void *) operands; + uint8_t count; + int i; + ++ if (!session || !session->controller) ++ return FALSE; ++ ++ player = session->controller->player; ++ mp = player->user_data; ++ + if (pdu == NULL) { + media_player_set_setting(mp, "Error", "Timeout"); + return FALSE; +@@ -2028,10 +2040,15 @@ static gboolean avrcp_get_element_attributes_rsp(struct avctp *conn, + void *user_data) + { + struct avrcp *session = user_data; +- struct avrcp_player *player = session->controller->player; ++ struct avrcp_player *player; + struct avrcp_header *pdu = (void *) operands; + uint8_t count; + ++ if (!session || !session->controller) ++ return FALSE; ++ ++ player = session->controller->player; ++ + if (code == AVC_CTYPE_REJECTED) + return FALSE; + diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0017-bluetooth-Fix-flow-control-operation.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0017-bluetooth-Fix-flow-control-operation.patch new file mode 100644 index 000000000..ce05c2928 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0017-bluetooth-Fix-flow-control-operation.patch @@ -0,0 +1,52 @@ +From: Dibyendu Roy +Date: Fri, 22 May 2015 18:57:05 +0530 +Subject: [PATCH] bluetooth: Fix flow control operation + +Flow off operation was not actually happening at the UART line level, +since the argument passed was not being used correctly. As a result, +sometimes command complete and VS event were sent by BT SOC even +before the local UART Controller could change its baud rate to the +newer one(3 Mbps). This led to VS event being processed +incorrectly which in turn causes baud rate change to fail. + +CRs-Fixed: 844730 +Change-Id: I06d8c4ed7807aa47dd5498642c7a23c9189a1cff +Signed-off-by: Dibyendu Roy +--- + tools/hciattach_rome.c | 6 +++--- + tools/hciattach_rome.h | 4 ++-- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 6a3f33867c12..0d7014f1d2f6 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -1544,10 +1544,10 @@ static void flow_control(int fd, int opt) + c_opt.c_cc[VMIN] = 0; /* blocking read until 8 chars received */ + c_opt.c_cflag &= ~CSIZE; + c_opt.c_cflag |= (CS8 | CLOCAL | CREAD); +- if (MSM_ENABLE_FLOW_CTRL) ++ if (opt == MSM_ENABLE_FLOW_CTRL) + c_opt.c_cflag |= CRTSCTS; +- else if (MSM_DISABLE_FLOW_CTRL) +- c_opt.c_cflag |= ~CRTSCTS; ++ else if (opt == MSM_DISABLE_FLOW_CTRL) ++ c_opt.c_cflag &= ~CRTSCTS; + else { + fprintf(stderr, "%s: Incorrect option passed for TIOCMSET\n", __func__); + return; +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 8eaeeed8bc96..3fdaf208e522 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -40,8 +40,8 @@ + #define NVITEM_SIZE 2 + #define PERSIST_HEADER_LEN 3 + #define BD_ADDR_LEN 6 +-#define MSM_ENABLE_FLOW_CTRL 16 +-#define MSM_DISABLE_FLOW_CTRL 17 ++#define MSM_DISABLE_FLOW_CTRL 0 ++#define MSM_ENABLE_FLOW_CTRL 1 + #define USERIAL_OP_CLK_ON 0x5441 + #define USERIAL_OP_CLK_OFF 0x5442 + diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0018-Adding-MDM-specific-code-under-_PLATFORM_MDM_.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0018-Adding-MDM-specific-code-under-_PLATFORM_MDM_.patch new file mode 100644 index 000000000..c2987d399 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0018-Adding-MDM-specific-code-under-_PLATFORM_MDM_.patch @@ -0,0 +1,65 @@ +From: Dibyendu Roy +Date: Thu, 11 Jun 2015 12:07:43 +0530 +Subject: [PATCH] Adding MDM specific code under _PLATFORM_MDM_ + +This patch is added to comment out the commit +84cc0e12983b5761c67789ef93fd6fb164c7314d in x86 as +dynamic suspend feature is not available in x86. However, +this code shall be active for MDM platform due to +dynamic suspend feature. + +Change-Id: I998f0521b4a5f9744412db40f2c2d3bff2ac3d11 +--- + tools/hciattach_rome.c | 5 ++++- + tools/hciattach_rome.h | 3 +++ + 2 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 0d7014f1d2f6..1891de24e21a 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -1779,13 +1779,14 @@ int qca_soc_init(int fd, int speed, char *bdaddr) + + vnd_userial.fd = fd; + ++#ifdef _PLATFORM_MDM_ + /* Vote for UART CLK prior to FW download */ + err = ioctl(fd, USERIAL_OP_CLK_ON); + if (err < 0) { + fprintf(stderr, "%s: Failed to vote UART CLK ON\n", __func__); + return -1; + } +- ++#endif + /* Get Rome version information */ + if((err = rome_patch_ver_req(fd)) <0){ + fprintf(stderr, "%s: Fail to get Rome Version (0x%x)\n", __FUNCTION__, err); +@@ -1923,10 +1924,12 @@ download: + } + + error: ++#ifdef _PLATFORM_MDM_ + /* Vote UART CLK OFF post to FW download */ + err = ioctl(fd, USERIAL_OP_CLK_OFF); + if (err < 0) + fprintf(stderr, "%s: Failed to vote UART CLK OFF!!!\n", __func__); ++#endif + + return err; + } +diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h +index 3fdaf208e522..89f7db3bef86 100644 +--- a/tools/hciattach_rome.h ++++ b/tools/hciattach_rome.h +@@ -42,8 +42,11 @@ + #define BD_ADDR_LEN 6 + #define MSM_DISABLE_FLOW_CTRL 0 + #define MSM_ENABLE_FLOW_CTRL 1 ++ ++#ifdef _PLATFORM_MDM_ + #define USERIAL_OP_CLK_ON 0x5441 + #define USERIAL_OP_CLK_OFF 0x5442 ++#endif + + unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + typedef enum { diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0019-Bluetooth-Fix-static-analysis-issues.patch b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0019-Bluetooth-Fix-static-analysis-issues.patch new file mode 100644 index 000000000..2b382a68e --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.33/ccimx6ul/0019-Bluetooth-Fix-static-analysis-issues.patch @@ -0,0 +1,58 @@ +From: Dibyendu Roy +Date: Mon, 6 Jul 2015 13:30:53 +0530 +Subject: [PATCH] Bluetooth: Fix static analysis issues + +Change-Id: Ida91f012544c39a8aaa6e7db23f1d5b68d3bec08 +--- + tools/hciattach.c | 9 ++++++++- + tools/hciattach_rome.c | 10 ++++++++-- + 2 files changed, 16 insertions(+), 3 deletions(-) + +diff --git a/tools/hciattach.c b/tools/hciattach.c +index 6de4129dfd8f..c9a5feffca2b 100644 +--- a/tools/hciattach.c ++++ b/tools/hciattach.c +@@ -1395,7 +1395,14 @@ int main(int argc, char *argv[]) + dev[0] = 0; + if (!strchr(opt, '/')) + strcpy(dev, "/dev/"); +- strcat(dev, opt); ++ ++ if (strlen(opt) + 1 > sizeof(dev) - strlen(dev)) { ++ fprintf(stderr, "error: string truncated\n"); ++ exit(1); ++ } ++ ++ strncat(dev, opt, sizeof(dev) - strlen(dev) - 1); ++ + break; + + case 1: +diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c +index 1891de24e21a..59bdc16e4e8f 100644 +--- a/tools/hciattach_rome.c ++++ b/tools/hciattach_rome.c +@@ -933,7 +933,13 @@ int rome_get_tlv_file(char *file_path) + + /* Get File Size */ + fseek (pFile , 0 , SEEK_END); +- fileSize = ftell (pFile); ++ ++ if((fileSize = ftell(pFile)) < 0) { ++ fprintf(stderr, "%s: fail to get current file position\n", file_path); ++ fclose (pFile); ++ return -1; ++ } ++ + rewind (pFile); + + pdata_buffer = (unsigned char*) malloc (sizeof(char)*fileSize); +@@ -1107,7 +1113,7 @@ int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc + int rome_tlv_dnld_req(int fd, int tlv_size) + { + int total_segment, remain_size, i, err = -1; +- unsigned char wait_cc_evt; ++ unsigned char wait_cc_evt = FALSE; + unsigned int rom = rome_ver >> 16; + + total_segment = tlv_size/MAX_SIZE_PER_TLV_SEGMENT; diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5/bluez-init b/meta-digi-dey/recipes-connectivity/bluez/bluez5/bluez-init deleted file mode 100755 index 8e42e5b26..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5/bluez-init +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/sh -#=============================================================================== -# -# bluez -# -# Copyright (C) 2012-2014 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: Configure Bluetooth -# -#=============================================================================== - -set -e - -if [ "${1}" != "start" ]; then - exit 0 -fi - -SCRIPTNAME="$(basename "${0}")" - -bt_init() { - if grep -qs '\' /proc/device-tree/compatible; then - BT_PWR_GPIO_NR="21" - elif grep -qs '\' /proc/device-tree/compatible; then - BT_PWR_GPIO_NR="244" - fi - - # Use a sub-shell here to change to firmware directory - ( - cd /lib/firmware/ar3k/1020200 - - # Get MAC address from device tree or NVRAM. Use a default value it it has not been set. - if [ -f "/proc/device-tree/bluetooth/mac-address" ]; then - BTADDR="$(hexdump -ve '1/1 "%02X" ":"' /proc/device-tree/bluetooth/mac-address | sed 's/:$//g')" - else - BTADDR="$(sed -ne 's,^.*btaddr1=\([^[:blank:]]\+\)[:blank:]*.*,\1,g;T;p' /proc/cmdline)" - fi - if [ -z "${BTADDR}" ] || [ "${BTADDR}" = "00:00:00:00:00:00" ]; then - BTADDR="00:04:F3:FF:FF:BB" - fi - - # Update the MAC address file only if it has changed. - FW_MAC="ar3kbdaddr.pst" - [ -f "${FW_MAC}" ] && [ "$(cat ${FW_MAC})" = "${BTADDR}" ] || echo ${BTADDR} > ${FW_MAC} - - JPN_REGCODE="0x2" - REGCODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null)" - BT_CLASS_LINK="PS_ASIC.pst" - BT_CLASS_FILE="PS_ASIC_class_1.pst" - if [ -n "${REGCODE}" ] && [ "${JPN_REGCODE}" = "${REGCODE}" ]; then - BT_CLASS_FILE="PS_ASIC_class_2.pst" - fi - - # Replace the configuration file if different - if ! cmp -s ${BT_CLASS_FILE} ${BT_CLASS_LINK}; then - ln -sf ${BT_CLASS_FILE} ${BT_CLASS_LINK} - fi - # Remove not used configuration and readme files - # -- Do not quote the subcommand to avoid leading/trailing whitespace - # -- being part of the file name. - rm -f $(echo PS_ASIC_class_?.pst | sed -e "s,${BT_CLASS_FILE},,g") readme.txt - ) - - # Start the Bluetooth driver and daemon (D-BUS must already be running) - RETRIES="5" - while [ "${RETRIES}" -gt "0" ]; do - hciattach ttyBt ath3k 4000000 1>/dev/null && break - if [ -n "${BT_PWR_GPIO_NR}" ]; then - # - # If hciattach fails try to recover it by toggling the BT power GPIO - # - BT_PWR_L="/sys/class/gpio/gpio${BT_PWR_GPIO_NR}" - [ -d "${BT_PWR_L}" ] || printf "%s" ${BT_PWR_GPIO_NR} > /sys/class/gpio/export - printf out > ${BT_PWR_L}/direction && sleep .2 - printf 0 > ${BT_PWR_L}/value && sleep .2 - printf 1 > ${BT_PWR_L}/value && sleep .2 - [ -d "${BT_PWR_L}" ] && printf "%s" ${BT_PWR_GPIO_NR} > /sys/class/gpio/unexport - else - sleep .5 - fi - RETRIES="$((RETRIES - 1))" - done - if [ "${RETRIES}" -eq "0" ]; then - echo "${SCRIPTNAME}: FAILED (hciattach)" - exit - fi - if hciconfig hci0 up; then - : # No-op - else - echo "${SCRIPTNAME}: FAILED" - exit - fi -} - -# Check if this hardware does support Bluetooth -[ -d "/proc/device-tree/bluetooth" ] && bt_init - -echo "Starting bluetooth services." -start-stop-daemon -S --background --exec /usr/lib/bluez5/bluetooth/bluetoothd diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5_%.bbappend b/meta-digi-dey/recipes-connectivity/bluez/bluez5_%.bbappend deleted file mode 100644 index abb8f84be..000000000 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5_%.bbappend +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2015 Digi International. - -FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" -SRC_URI += "file://bluez-init" - -inherit update-rc.d - -PACKAGECONFIG_append = " experimental" - -do_install_append() { - install -d ${D}${sysconfdir}/init.d/ - install -m 0755 ${WORKDIR}/bluez-init ${D}${sysconfdir}/init.d/bluez -} - -INITSCRIPT_NAME = "bluez" -INITSCRIPT_PARAMS = "start 10 5 ." diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5_5.33.bbappend b/meta-digi-dey/recipes-connectivity/bluez/bluez5_5.33.bbappend new file mode 100644 index 000000000..ea0c71714 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5_5.33.bbappend @@ -0,0 +1,45 @@ +# Copyright (C) 2015 Digi International. + +FILESEXTRAPATHS_prepend := "${THISDIR}/${BP}:" + +SRC_URI += " \ + file://bluez-init \ + file://0021-hcitool-do-not-show-unsupported-refresh-option.patch \ + file://0022-hcitool-increase-the-shown-connection-limit-to-20.patch \ +" + +SRC_URI_append_ccimx6ul = " \ + file://0001-bluetooth-Add-bluetooth-support-for-QCA6174-chip.patch \ + file://0002-bluetooth-Enable-bluetooth-low-power-mode-functional.patch \ + file://0003-bluetooth-Fix-bug-in-firmware-parsing-mechanism.patch \ + file://0004-bluetooth-Configure-BD-Address.patch \ + file://0005-bluetooth-Remove-unused-functions-in-the-firmware-do.patch \ + file://0006-bluetooth-Enable-3Mbps-baud-rate-support.patch \ + file://0007-bluetooth-Check-TTY-buffer-for-data-availability-bef.patch \ + file://0008-bluetooth-Add-support-for-TUFEELO-firmware-download.patch \ + file://0009-bluetooth-Add-support-for-ROME-3.2-SOC.patch \ + file://0010-bluetooth-Use-correct-TTY-ioctl-calls-for-flow-contr.patch \ + file://0011-bluetooth-Add-support-for-multi-baud-rate.patch \ + file://0012-Override-PCM-Settings-by-reading-configuration-file.patch \ + file://0013-Add-support-for-Tufello-1.1-SOC.patch \ + file://0014-bluetooth-Vote-UART-CLK-ON-prior-to-firmware-downloa.patch \ + file://0015-Override-IBS-settings-by-reading-configuration-file.patch \ + file://0016-Handle-NULL-Pointer-derefrencing-in-AVRCP-Target-rol.patch \ + file://0017-bluetooth-Fix-flow-control-operation.patch \ + file://0018-Adding-MDM-specific-code-under-_PLATFORM_MDM_.patch \ + file://0019-Bluetooth-Fix-static-analysis-issues.patch \ +" + +inherit update-rc.d + +PACKAGECONFIG_append = " experimental" + +do_install_append() { + install -d ${D}${sysconfdir}/init.d/ + install -m 0755 ${WORKDIR}/bluez-init ${D}${sysconfdir}/init.d/bluez +} + +INITSCRIPT_NAME = "bluez" +INITSCRIPT_PARAMS = "start 10 5 ." + +PACKAGE_ARCH = "${MACHINE_ARCH}" diff --git a/meta-digi-dey/recipes-connectivity/hostapd/hostapd-2.4/ccimx6ul/fix_num_probereq_cb_clearing.patch b/meta-digi-dey/recipes-connectivity/hostapd/hostapd-2.4/ccimx6ul/fix_num_probereq_cb_clearing.patch new file mode 100644 index 000000000..df48d5f99 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/hostapd/hostapd-2.4/ccimx6ul/fix_num_probereq_cb_clearing.patch @@ -0,0 +1,38 @@ +From 24fd20438f00a6f1bdeb6f23358ef60c2696b488 Mon Sep 17 00:00:00 2001 +From: "Chen, Yi" +Date: Wed, 2 Sep 2015 21:25:01 +0530 +Subject: WPS: Fix num_probereq_cb clearing on DISABLE to avoid segfault + +Reset hapd->num_probereq_cb to 0 on an interface deinit to avoid +unexpected behavior if the same interface is enabled again without fully +freeing the data structures. hostapd_register_probereq_cb() increments +hapd->num_probereq_cb by one and leaves all old values unchanged. In +this deinit+init case, that would result in the first entry in the list +having an uninitialized pointer and the next Probe Request frame +processing would likely cause the process to terminate on segmentation +fault. + +This issue could be hit when hostapd was used with WPS enabled (non-zero +wps_state configuration parameter) and control interface command DISABLE +and ENABLE were used. + +Signed-off-by: Jouni Malinen +--- + src/ap/hostapd.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c +index e4d7bfc..c09c17a 100644 +--- a/src/ap/hostapd.c ++++ b/src/ap/hostapd.c +@@ -261,6 +261,7 @@ static void hostapd_free_hapd_data(struct hostapd_data *hapd) + { + os_free(hapd->probereq_cb); + hapd->probereq_cb = NULL; ++ hapd->num_probereq_cb = 0; + + #ifdef CONFIG_P2P + wpabuf_free(hapd->p2p_beacon_ie); +-- +cgit v0.12 + diff --git a/meta-digi-dey/recipes-connectivity/hostapd/hostapd_2.4.bbappend b/meta-digi-dey/recipes-connectivity/hostapd/hostapd_2.4.bbappend new file mode 100644 index 000000000..8d98fa93c --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/hostapd/hostapd_2.4.bbappend @@ -0,0 +1,9 @@ +# Copyright (C) 2016 Digi International. + +FILESEXTRAPATHS_prepend := "${THISDIR}/${BP}:" + +# The recipe uses a different "$S" directory so point the patch to the hostapd +# tarball directory. +SRC_URI_append_ccimx6ul = " file://fix_num_probereq_cb_clearing.patch;patchdir=.." + +PACKAGE_ARCH = "${MACHINE_ARCH}" diff --git a/meta-digi-dey/recipes-connectivity/openssl/openssl/0001-cryptodev-Fix-issue-with-signature-generation.patch b/meta-digi-dey/recipes-connectivity/openssl/openssl/0001-cryptodev-Fix-issue-with-signature-generation.patch new file mode 100644 index 000000000..53b45b1ad --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/openssl/openssl/0001-cryptodev-Fix-issue-with-signature-generation.patch @@ -0,0 +1,449 @@ +From: Nikos Mavrogiannopoulos +Date: Wed, 11 May 2016 12:07:15 +0200 +Subject: [PATCH] cryptodev: Fix issue with signature generation + +That patch also enables support for SHA2 hashes, and removes support +for hashes that were never supported by cryptodev. + +Forward port of patch from: +https://rt.openssl.org/Ticket/Display.html?id=2770&user=guest&pass=guest + +Signed-off-by: Javier Viguera +--- + crypto/engine/eng_cryptodev.c | 197 +++++++++++++++++++++++++++++++----------- + 1 file changed, 147 insertions(+), 50 deletions(-) + +diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c +index 926d95c0d7fc..d3554b4eaecd 100644 +--- a/crypto/engine/eng_cryptodev.c ++++ b/crypto/engine/eng_cryptodev.c +@@ -2,6 +2,7 @@ + * Copyright (c) 2002 Bob Beck + * Copyright (c) 2002 Theo de Raadt + * Copyright (c) 2002 Markus Friedl ++ * Copyright (c) 2012 Nikos Mavrogiannopoulos + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without +@@ -72,7 +73,6 @@ struct dev_crypto_state { + struct session_op d_sess; + int d_fd; + # ifdef USE_CRYPTODEV_DIGESTS +- char dummy_mac_key[HASH_MAX_LEN]; + unsigned char digest_res[HASH_MAX_LEN]; + char *mac_data; + int mac_len; +@@ -189,8 +189,10 @@ static struct { + static struct { + int id; + int nid; +- int keylen; ++ int digestlen; + } digests[] = { ++#if 0 ++ /* HMAC is not supported */ + { + CRYPTO_MD5_HMAC, NID_hmacWithMD5, 16 + }, +@@ -198,15 +200,15 @@ static struct { + CRYPTO_SHA1_HMAC, NID_hmacWithSHA1, 20 + }, + { +- CRYPTO_RIPEMD160_HMAC, NID_ripemd160, 16 +- /* ? */ ++ CRYPTO_SHA2_256_HMAC, NID_hmacWithSHA256, 32 + }, + { +- CRYPTO_MD5_KPDK, NID_undef, 0 ++ CRYPTO_SHA2_384_HMAC, NID_hmacWithSHA384, 48 + }, + { +- CRYPTO_SHA1_KPDK, NID_undef, 0 ++ CRYPTO_SHA2_512_HMAC, NID_hmacWithSHA512, 64 + }, ++#endif + { + CRYPTO_MD5, NID_md5, 16 + }, +@@ -214,6 +216,15 @@ static struct { + CRYPTO_SHA1, NID_sha1, 20 + }, + { ++ CRYPTO_SHA2_256, NID_sha256, 32 ++ }, ++ { ++ CRYPTO_SHA2_384, NID_sha384, 48 ++ }, ++ { ++ CRYPTO_SHA2_512, NID_sha512, 64 ++ }, ++ { + 0, NID_undef, 0 + }, + }; +@@ -288,13 +299,14 @@ static int get_cryptodev_ciphers(const int **cnids) + static int nids[CRYPTO_ALGORITHM_MAX]; + struct session_op sess; + int fd, i, count = 0; ++ unsigned char fake_key[CRYPTO_CIPHER_MAX_KEY_LEN]; + + if ((fd = get_dev_crypto()) < 0) { + *cnids = NULL; + return (0); + } + memset(&sess, 0, sizeof(sess)); +- sess.key = (caddr_t) "123456789abcdefghijklmno"; ++ sess.key = (void*)fake_key; + + for (i = 0; ciphers[i].id && count < CRYPTO_ALGORITHM_MAX; i++) { + if (ciphers[i].nid == NID_undef) +@@ -325,6 +337,7 @@ static int get_cryptodev_ciphers(const int **cnids) + static int get_cryptodev_digests(const int **cnids) + { + static int nids[CRYPTO_ALGORITHM_MAX]; ++ unsigned char fake_key[CRYPTO_CIPHER_MAX_KEY_LEN]; + struct session_op sess; + int fd, i, count = 0; + +@@ -333,12 +346,12 @@ static int get_cryptodev_digests(const int **cnids) + return (0); + } + memset(&sess, 0, sizeof(sess)); +- sess.mackey = (caddr_t) "123456789abcdefghijklmno"; ++ sess.mackey = fake_key; + for (i = 0; digests[i].id && count < CRYPTO_ALGORITHM_MAX; i++) { + if (digests[i].nid == NID_undef) + continue; + sess.mac = digests[i].id; +- sess.mackeylen = digests[i].keylen; ++ sess.mackeylen = 8; + sess.cipher = 0; + if (ioctl(fd, CIOCGSESSION, &sess) != -1 && + ioctl(fd, CIOCFSESSION, &sess.ses) != -1) +@@ -424,14 +437,14 @@ cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, + cryp.ses = sess->ses; + cryp.flags = 0; + cryp.len = inl; +- cryp.src = (caddr_t) in; +- cryp.dst = (caddr_t) out; ++ cryp.src = (void*) in; ++ cryp.dst = (void*) out; + cryp.mac = 0; + + cryp.op = ctx->encrypt ? COP_ENCRYPT : COP_DECRYPT; + + if (ctx->cipher->iv_len) { +- cryp.iv = (caddr_t) ctx->iv; ++ cryp.iv = (void*) ctx->iv; + if (!ctx->encrypt) { + iiv = in + inl - ctx->cipher->iv_len; + memcpy(save_iv, iiv, ctx->cipher->iv_len); +@@ -483,7 +496,7 @@ cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, + if ((state->d_fd = get_dev_crypto()) < 0) + return (0); + +- sess->key = (caddr_t) key; ++ sess->key = (void*)key; + sess->keylen = ctx->key_len; + sess->cipher = cipher; + +@@ -749,16 +762,6 @@ static int digest_nid_to_cryptodev(int nid) + return (0); + } + +-static int digest_key_length(int nid) +-{ +- int i; +- +- for (i = 0; digests[i].id; i++) +- if (digests[i].nid == nid) +- return digests[i].keylen; +- return (0); +-} +- + static int cryptodev_digest_init(EVP_MD_CTX *ctx) + { + struct dev_crypto_state *state = ctx->md_data; +@@ -769,7 +772,6 @@ static int cryptodev_digest_init(EVP_MD_CTX *ctx) + printf("cryptodev_digest_init: Can't get digest \n"); + return (0); + } +- + memset(state, 0, sizeof(struct dev_crypto_state)); + + if ((state->d_fd = get_dev_crypto()) < 0) { +@@ -777,8 +779,8 @@ static int cryptodev_digest_init(EVP_MD_CTX *ctx) + return (0); + } + +- sess->mackey = state->dummy_mac_key; +- sess->mackeylen = digest_key_length(ctx->digest->type); ++ sess->mackey = NULL; ++ sess->mackeylen = 0; + sess->mac = digest; + + if (ioctl(state->d_fd, CIOCGSESSION, sess) < 0) { +@@ -794,8 +796,8 @@ static int cryptodev_digest_init(EVP_MD_CTX *ctx) + static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data, + size_t count) + { +- struct crypt_op cryp; + struct dev_crypto_state *state = ctx->md_data; ++ struct crypt_op cryp; + struct session_op *sess = &state->d_sess; + + if (!data || state->d_fd < 0) { +@@ -804,7 +806,7 @@ static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data, + } + + if (!count) { +- return (0); ++ return (1); + } + + if (!(ctx->flags & EVP_MD_CTX_FLAG_ONESHOT)) { +@@ -828,9 +830,9 @@ static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data, + cryp.ses = sess->ses; + cryp.flags = 0; + cryp.len = count; +- cryp.src = (caddr_t) data; ++ cryp.src = (void*) data; + cryp.dst = NULL; +- cryp.mac = (caddr_t) state->digest_res; ++ cryp.mac = (void*) state->digest_res; + if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) { + printf("cryptodev_digest_update: digest failed\n"); + return (0); +@@ -844,8 +846,6 @@ static int cryptodev_digest_final(EVP_MD_CTX *ctx, unsigned char *md) + struct dev_crypto_state *state = ctx->md_data; + struct session_op *sess = &state->d_sess; + +- int ret = 1; +- + if (!md || state->d_fd < 0) { + printf("cryptodev_digest_final: illegal input\n"); + return (0); +@@ -859,7 +859,7 @@ static int cryptodev_digest_final(EVP_MD_CTX *ctx, unsigned char *md) + cryp.len = state->mac_len; + cryp.src = state->mac_data; + cryp.dst = NULL; +- cryp.mac = (caddr_t) md; ++ cryp.mac = (void*)md; + if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) { + printf("cryptodev_digest_final: digest failed\n"); + return (0); +@@ -870,7 +870,7 @@ static int cryptodev_digest_final(EVP_MD_CTX *ctx, unsigned char *md) + + memcpy(md, state->digest_res, ctx->digest->md_size); + +- return (ret); ++ return 1; + } + + static int cryptodev_digest_cleanup(EVP_MD_CTX *ctx) +@@ -921,8 +921,8 @@ static int cryptodev_digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) + + digest = digest_nid_to_cryptodev(to->digest->type); + +- sess->mackey = dstate->dummy_mac_key; +- sess->mackeylen = digest_key_length(to->digest->type); ++ sess->mackey = NULL; ++ sess->mackeylen = 0; + sess->mac = digest; + + dstate->d_fd = get_dev_crypto(); +@@ -945,34 +945,118 @@ static int cryptodev_digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) + return 1; + } + +-const EVP_MD cryptodev_sha1 = { ++static const EVP_MD cryptodev_sha1 = { + NID_sha1, +- NID_undef, ++ NID_sha1WithRSAEncryption, + SHA_DIGEST_LENGTH, ++#if defined(EVP_MD_FLAG_PKEY_METHOD_SIGNATURE) && defined(EVP_MD_FLAG_DIGALGID_ABSENT) ++ EVP_MD_FLAG_PKEY_METHOD_SIGNATURE| ++ EVP_MD_FLAG_DIGALGID_ABSENT| ++#endif + EVP_MD_FLAG_ONESHOT, + cryptodev_digest_init, + cryptodev_digest_update, + cryptodev_digest_final, + cryptodev_digest_copy, + cryptodev_digest_cleanup, +- EVP_PKEY_NULL_method, ++ EVP_PKEY_RSA_method, + SHA_CBLOCK, +- sizeof(struct dev_crypto_state), ++ sizeof(EVP_MD *)+sizeof(struct dev_crypto_state), + }; + +-const EVP_MD cryptodev_md5 = { ++static const EVP_MD cryptodev_sha256 = { ++ NID_sha256, ++ NID_sha256WithRSAEncryption, ++ SHA256_DIGEST_LENGTH, ++#if defined(EVP_MD_FLAG_PKEY_METHOD_SIGNATURE) && defined(EVP_MD_FLAG_DIGALGID_ABSENT) ++ EVP_MD_FLAG_PKEY_METHOD_SIGNATURE| ++ EVP_MD_FLAG_DIGALGID_ABSENT| ++#endif ++ EVP_MD_FLAG_ONESHOT, ++ cryptodev_digest_init, ++ cryptodev_digest_update, ++ cryptodev_digest_final, ++ cryptodev_digest_copy, ++ cryptodev_digest_cleanup, ++ EVP_PKEY_RSA_method, ++ SHA256_CBLOCK, ++ sizeof(EVP_MD *)+sizeof(struct dev_crypto_state), ++}; ++ ++static const EVP_MD cryptodev_sha224 = { ++ NID_sha224, ++ NID_sha224WithRSAEncryption, ++ SHA224_DIGEST_LENGTH, ++#if defined(EVP_MD_FLAG_PKEY_METHOD_SIGNATURE) && defined(EVP_MD_FLAG_DIGALGID_ABSENT) ++ EVP_MD_FLAG_PKEY_METHOD_SIGNATURE| ++ EVP_MD_FLAG_DIGALGID_ABSENT| ++#endif ++ EVP_MD_FLAG_ONESHOT, ++ cryptodev_digest_init, ++ cryptodev_digest_update, ++ cryptodev_digest_final, ++ cryptodev_digest_copy, ++ cryptodev_digest_cleanup, ++ EVP_PKEY_RSA_method, ++ SHA256_CBLOCK, ++ sizeof(EVP_MD *)+sizeof(struct dev_crypto_state), ++}; ++ ++static const EVP_MD cryptodev_sha384 = { ++ NID_sha384, ++ NID_sha384WithRSAEncryption, ++ SHA384_DIGEST_LENGTH, ++#if defined(EVP_MD_FLAG_PKEY_METHOD_SIGNATURE) && defined(EVP_MD_FLAG_DIGALGID_ABSENT) ++ EVP_MD_FLAG_PKEY_METHOD_SIGNATURE| ++ EVP_MD_FLAG_DIGALGID_ABSENT| ++#endif ++ EVP_MD_FLAG_ONESHOT, ++ cryptodev_digest_init, ++ cryptodev_digest_update, ++ cryptodev_digest_final, ++ cryptodev_digest_copy, ++ cryptodev_digest_cleanup, ++ EVP_PKEY_RSA_method, ++ SHA512_CBLOCK, ++ sizeof(EVP_MD *)+sizeof(struct dev_crypto_state), ++}; ++ ++static const EVP_MD cryptodev_sha512 = { ++ NID_sha512, ++ NID_sha512WithRSAEncryption, ++ SHA512_DIGEST_LENGTH, ++#if defined(EVP_MD_FLAG_PKEY_METHOD_SIGNATURE) && defined(EVP_MD_FLAG_DIGALGID_ABSENT) ++ EVP_MD_FLAG_PKEY_METHOD_SIGNATURE| ++ EVP_MD_FLAG_DIGALGID_ABSENT| ++#endif ++ EVP_MD_FLAG_ONESHOT, ++ cryptodev_digest_init, ++ cryptodev_digest_update, ++ cryptodev_digest_final, ++ cryptodev_digest_copy, ++ cryptodev_digest_cleanup, ++ EVP_PKEY_RSA_method, ++ SHA512_CBLOCK, ++ sizeof(EVP_MD *)+sizeof(struct dev_crypto_state), ++}; ++ ++static const EVP_MD cryptodev_md5 = { + NID_md5, +- NID_undef, ++ NID_md5WithRSAEncryption, + 16 /* MD5_DIGEST_LENGTH */ , ++#if defined(EVP_MD_FLAG_PKEY_METHOD_SIGNATURE) && defined(EVP_MD_FLAG_DIGALGID_ABSENT) ++ EVP_MD_FLAG_PKEY_METHOD_SIGNATURE| ++ EVP_MD_FLAG_DIGALGID_ABSENT| ++#endif + EVP_MD_FLAG_ONESHOT, + cryptodev_digest_init, + cryptodev_digest_update, + cryptodev_digest_final, + cryptodev_digest_copy, + cryptodev_digest_cleanup, +- EVP_PKEY_NULL_method, ++ EVP_PKEY_RSA_method, + 64 /* MD5_CBLOCK */ , +- sizeof(struct dev_crypto_state), ++ sizeof(EVP_MD *)+sizeof(struct dev_crypto_state), + }; + + # endif /* USE_CRYPTODEV_DIGESTS */ +@@ -992,6 +1076,18 @@ cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest, + case NID_sha1: + *digest = &cryptodev_sha1; + break; ++ case NID_sha224: ++ *digest = &cryptodev_sha224; ++ break; ++ case NID_sha256: ++ *digest = &cryptodev_sha256; ++ break; ++ case NID_sha384: ++ *digest = &cryptodev_sha384; ++ break; ++ case NID_sha512: ++ *digest = &cryptodev_sha512; ++ break; + default: + # endif /* USE_CRYPTODEV_DIGESTS */ + *digest = NULL; +@@ -1022,7 +1118,7 @@ static int bn2crparam(const BIGNUM *a, struct crparam *crp) + return (1); + memset(b, 0, bytes); + +- crp->crp_p = (caddr_t) b; ++ crp->crp_p = (void*) b; + crp->crp_nbits = bits; + + for (i = 0, j = 0; i < a->top; i++) { +@@ -1277,7 +1373,7 @@ static DSA_SIG *cryptodev_dsa_do_sign(const unsigned char *dgst, int dlen, + kop.crk_op = CRK_DSA_SIGN; + + /* inputs: dgst dsa->p dsa->q dsa->g dsa->priv_key */ +- kop.crk_param[0].crp_p = (caddr_t) dgst; ++ kop.crk_param[0].crp_p = (void*)dgst; + kop.crk_param[0].crp_nbits = dlen * 8; + if (bn2crparam(dsa->p, &kop.crk_param[1])) + goto err; +@@ -1317,7 +1413,7 @@ cryptodev_dsa_verify(const unsigned char *dgst, int dlen, + kop.crk_op = CRK_DSA_VERIFY; + + /* inputs: dgst dsa->p dsa->q dsa->g dsa->pub_key sig->r sig->s */ +- kop.crk_param[0].crp_p = (caddr_t) dgst; ++ kop.crk_param[0].crp_p = (void*)dgst; + kop.crk_param[0].crp_nbits = dlen * 8; + if (bn2crparam(dsa->p, &kop.crk_param[1])) + goto err; +@@ -1398,9 +1494,10 @@ cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) + goto err; + kop.crk_iparams = 3; + +- kop.crk_param[3].crp_p = (caddr_t) key; +- kop.crk_param[3].crp_nbits = keylen * 8; ++ kop.crk_param[3].crp_p = (void*) key; ++ kop.crk_param[3].crp_nbits = keylen; + kop.crk_oparams = 1; ++ dhret = keylen/8; + + if (ioctl(fd, CIOCKEY, &kop) == -1) { + const DH_METHOD *meth = DH_OpenSSL(); +@@ -1470,7 +1567,7 @@ void ENGINE_load_cryptodev(void) + put_dev_crypto(fd); + + if (!ENGINE_set_id(engine, "cryptodev") || +- !ENGINE_set_name(engine, "BSD cryptodev engine") || ++ !ENGINE_set_name(engine, "cryptodev engine") || + !ENGINE_set_ciphers(engine, cryptodev_engine_ciphers) || + !ENGINE_set_digests(engine, cryptodev_engine_digests) || + !ENGINE_set_ctrl_function(engine, cryptodev_ctrl) || diff --git a/meta-digi-dey/recipes-connectivity/openssl/openssl/0002-cryptodev-allow-copying-EVP-contexts.patch b/meta-digi-dey/recipes-connectivity/openssl/openssl/0002-cryptodev-allow-copying-EVP-contexts.patch new file mode 100644 index 000000000..087b85b50 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/openssl/openssl/0002-cryptodev-allow-copying-EVP-contexts.patch @@ -0,0 +1,203 @@ +From: Nikos Mavrogiannopoulos +Date: Wed, 11 May 2016 12:33:20 +0200 +Subject: [PATCH] cryptodev: allow copying EVP contexts + +Forward port of patch from: +https://rt.openssl.org/Ticket/Display.html?id=2770&user=guest&pass=guest + +Signed-off-by: Javier Viguera +--- + crypto/engine/eng_cryptodev.c | 57 ++++++++++++++++++++++++++----------------- + 1 file changed, 35 insertions(+), 22 deletions(-) + +diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c +index d3554b4eaecd..47e292f5e3c0 100644 +--- a/crypto/engine/eng_cryptodev.c ++++ b/crypto/engine/eng_cryptodev.c +@@ -547,151 +547,164 @@ static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx) + * gets called when libcrypto requests a cipher NID. + */ + ++static int cryptodev_cipher_ctrl(EVP_CIPHER_CTX *ctx, int type, int p1, void *p2) ++{ ++ struct dev_crypto_state *state = ctx->cipher_data; ++ struct session_op *sess = &state->d_sess; ++ ++ if (type == EVP_CTRL_COPY) { ++ EVP_CIPHER_CTX *out = p2; ++ return cryptodev_init_key(out, sess->key, ctx->iv, 0); ++ } ++ ++ return 0; ++} ++ + /* RC4 */ + const EVP_CIPHER cryptodev_rc4 = { + NID_rc4, + 1, 16, 0, +- EVP_CIPH_VARIABLE_LENGTH, ++ EVP_CIPH_VARIABLE_LENGTH|EVP_CIPH_CUSTOM_COPY, + cryptodev_init_key, + cryptodev_cipher, + cryptodev_cleanup, + sizeof(struct dev_crypto_state), + NULL, + NULL, +- NULL ++ cryptodev_cipher_ctrl + }; + + /* DES CBC EVP */ + const EVP_CIPHER cryptodev_des_cbc = { + NID_des_cbc, + 8, 8, 8, +- EVP_CIPH_CBC_MODE, ++ EVP_CIPH_CBC_MODE|EVP_CIPH_CUSTOM_COPY, + cryptodev_init_key, + cryptodev_cipher, + cryptodev_cleanup, + sizeof(struct dev_crypto_state), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, +- NULL ++ cryptodev_cipher_ctrl + }; + + /* 3DES CBC EVP */ + const EVP_CIPHER cryptodev_3des_cbc = { + NID_des_ede3_cbc, + 8, 24, 8, +- EVP_CIPH_CBC_MODE, ++ EVP_CIPH_CBC_MODE|EVP_CIPH_CUSTOM_COPY, + cryptodev_init_key, + cryptodev_cipher, + cryptodev_cleanup, + sizeof(struct dev_crypto_state), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, +- NULL ++ cryptodev_cipher_ctrl + }; + + const EVP_CIPHER cryptodev_bf_cbc = { + NID_bf_cbc, + 8, 16, 8, +- EVP_CIPH_CBC_MODE, ++ EVP_CIPH_CBC_MODE|EVP_CIPH_CUSTOM_COPY, + cryptodev_init_key, + cryptodev_cipher, + cryptodev_cleanup, + sizeof(struct dev_crypto_state), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, +- NULL ++ cryptodev_cipher_ctrl + }; + + const EVP_CIPHER cryptodev_cast_cbc = { + NID_cast5_cbc, + 8, 16, 8, +- EVP_CIPH_CBC_MODE, ++ EVP_CIPH_CBC_MODE|EVP_CIPH_CUSTOM_COPY, + cryptodev_init_key, + cryptodev_cipher, + cryptodev_cleanup, + sizeof(struct dev_crypto_state), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, +- NULL ++ cryptodev_cipher_ctrl + }; + + const EVP_CIPHER cryptodev_aes_cbc = { + NID_aes_128_cbc, + 16, 16, 16, +- EVP_CIPH_CBC_MODE, ++ EVP_CIPH_CBC_MODE|EVP_CIPH_CUSTOM_COPY, + cryptodev_init_key, + cryptodev_cipher, + cryptodev_cleanup, + sizeof(struct dev_crypto_state), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, +- NULL ++ cryptodev_cipher_ctrl + }; + + const EVP_CIPHER cryptodev_aes_192_cbc = { + NID_aes_192_cbc, + 16, 24, 16, +- EVP_CIPH_CBC_MODE, ++ EVP_CIPH_CBC_MODE|EVP_CIPH_CUSTOM_COPY, + cryptodev_init_key, + cryptodev_cipher, + cryptodev_cleanup, + sizeof(struct dev_crypto_state), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, +- NULL ++ cryptodev_cipher_ctrl + }; + + const EVP_CIPHER cryptodev_aes_256_cbc = { + NID_aes_256_cbc, + 16, 32, 16, +- EVP_CIPH_CBC_MODE, ++ EVP_CIPH_CBC_MODE|EVP_CIPH_CUSTOM_COPY, + cryptodev_init_key, + cryptodev_cipher, + cryptodev_cleanup, + sizeof(struct dev_crypto_state), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, +- NULL ++ cryptodev_cipher_ctrl + }; + + # ifdef CRYPTO_AES_CTR + const EVP_CIPHER cryptodev_aes_ctr = { + NID_aes_128_ctr, + 16, 16, 14, +- EVP_CIPH_CTR_MODE, ++ EVP_CIPH_CTR_MODE|EVP_CIPH_CUSTOM_COPY, + cryptodev_init_key, + cryptodev_cipher, + cryptodev_cleanup, + sizeof(struct dev_crypto_state), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, +- NULL ++ cryptodev_cipher_ctrl + }; + + const EVP_CIPHER cryptodev_aes_ctr_192 = { + NID_aes_192_ctr, + 16, 24, 14, +- EVP_CIPH_CTR_MODE, ++ EVP_CIPH_CTR_MODE|EVP_CIPH_CUSTOM_COPY, + cryptodev_init_key, + cryptodev_cipher, + cryptodev_cleanup, + sizeof(struct dev_crypto_state), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, +- NULL ++ cryptodev_cipher_ctrl + }; + + const EVP_CIPHER cryptodev_aes_ctr_256 = { + NID_aes_256_ctr, + 16, 32, 14, +- EVP_CIPH_CTR_MODE, ++ EVP_CIPH_CTR_MODE|EVP_CIPH_CUSTOM_COPY, + cryptodev_init_key, + cryptodev_cipher, + cryptodev_cleanup, + sizeof(struct dev_crypto_state), + EVP_CIPHER_set_asn1_iv, + EVP_CIPHER_get_asn1_iv, +- NULL ++ cryptodev_cipher_ctrl + }; + # endif + /* diff --git a/meta-digi-dey/recipes-connectivity/openssl/openssl_%.bbappend b/meta-digi-dey/recipes-connectivity/openssl/openssl_%.bbappend new file mode 100644 index 000000000..2f4503192 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/openssl/openssl_%.bbappend @@ -0,0 +1,8 @@ +# Copyright (C) 2016 Digi International. + +FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" + +SRC_URI += " \ + file://0001-cryptodev-Fix-issue-with-signature-generation.patch \ + file://0002-cryptodev-allow-copying-EVP-contexts.patch \ +" diff --git a/meta-digi-dey/recipes-connectivity/packagegroups/packagegroup-dey-bluetooth.bb b/meta-digi-dey/recipes-connectivity/packagegroups/packagegroup-dey-bluetooth.bb index b471bbb88..0caf33a3a 100644 --- a/meta-digi-dey/recipes-connectivity/packagegroups/packagegroup-dey-bluetooth.bb +++ b/meta-digi-dey/recipes-connectivity/packagegroups/packagegroup-dey-bluetooth.bb @@ -12,6 +12,6 @@ inherit packagegroup RDEPENDS_${PN} = " \ ${BLUEZ} \ ${BLUEZ}-testtools \ - ${@base_contains("MACHINE_FEATURES", "bluetooth", "libasound-module-bluez", "", d)} \ - ${@base_contains("BLUEZ", "bluez5", "bluez5-noinst-tools bluez5-obex", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "libasound-module-bluez", "", d)} \ + ${@bb.utils.contains("BLUEZ", "bluez5", "bluez5-noinst-tools bluez5-obex", "", d)} \ " diff --git a/meta-digi-dey/recipes-connectivity/packagegroups/packagegroup-dey-network.bb b/meta-digi-dey/recipes-connectivity/packagegroups/packagegroup-dey-network.bb index 2a960787d..ce7d5d7ef 100644 --- a/meta-digi-dey/recipes-connectivity/packagegroups/packagegroup-dey-network.bb +++ b/meta-digi-dey/recipes-connectivity/packagegroups/packagegroup-dey-network.bb @@ -30,7 +30,7 @@ CELLULAR_PKGS = "\ RDEPENDS_${PN} = "\ iproute2 \ - ${@base_contains('DISTRO_FEATURES', 'cellular', '${CELLULAR_PKGS}', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'cellular', '${CELLULAR_PKGS}', '', d)} \ ${VIRTUAL-RUNTIME_ftp-server} \ ${VIRTUAL-RUNTIME_http-server} \ ${VIRTUAL-RUNTIME_network-utils} \ diff --git a/meta-digi-dey/recipes-connectivity/packagegroups/packagegroup-dey-wireless.bb b/meta-digi-dey/recipes-connectivity/packagegroups/packagegroup-dey-wireless.bb index 52304b65d..0ab84684a 100644 --- a/meta-digi-dey/recipes-connectivity/packagegroups/packagegroup-dey-wireless.bb +++ b/meta-digi-dey/recipes-connectivity/packagegroups/packagegroup-dey-wireless.bb @@ -10,11 +10,9 @@ inherit packagegroup RDEPENDS_${PN} = "\ crda \ + iw \ wireless-tools \ wpa-supplicant \ wpa-supplicant-cli \ wpa-supplicant-passphrase \ " - -RDEPENDS_${PN}_append_mxs = " iw" -RDEPENDS_${PN}_append_mx6 = " iw" diff --git a/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/ccimx6ul/wpa_supplicant.conf-sane b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/ccimx6ul/wpa_supplicant.conf-sane new file mode 100644 index 000000000..a180d27d8 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/ccimx6ul/wpa_supplicant.conf-sane @@ -0,0 +1,11 @@ +ctrl_interface=/var/run/wpa_supplicant +ctrl_interface_group=0 +fast_reauth=1 +update_config=1 + +ap_scan=1 +network={ + scan_ssid=1 + ssid="" + key_mgmt=NONE +} 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 d85159e55..045b39c3e 100644 --- a/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant_%.bbappend +++ b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant_%.bbappend @@ -3,3 +3,5 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" PACKAGECONFIG ?= "openssl" + +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 new file mode 100755 index 000000000..d597339b6 --- /dev/null +++ b/meta-digi-dey/recipes-core/busybox/busybox-1.23.2/ccimx6ul/suspend @@ -0,0 +1,58 @@ +#!/bin/sh +#=============================================================================== +# +# suspend +# +# Copyright (C) 2016 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: suspend system to RAM +# +#=============================================================================== + +scriptname="$(basename ${0})" +syspower="/sys/power/state" + +usage() { + printf "\nSuspend system to RAM memory\n" + printf "\nUsage: ${scriptname} [OPTIONS]\n + -h Show this help + \n" +} + +suspend_interfaces() { + if grep -qs '^wlan0' /var/run/ifstate; then + ifdown wlan0 && up_wlan_on_resume="1" && sleep 0.5 && 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 + fi +} + +while getopts "h" c; do + case "${c}" in + h) usage; exit;; + esac +done + +if [ -f "${syspower}" ]; then + # Pre-suspend actions + suspend_interfaces + + # Suspend the device + printf "mem" > ${syspower} + sleep .5 + + # Post-resume actions + resume_interfaces +else + printf "\n[ERROR] File ${syspower} not found\n\n" +fi diff --git a/meta-digi-dey/recipes-core/busybox/busybox_1.23.2.bbappend b/meta-digi-dey/recipes-core/busybox/busybox_1.23.2.bbappend index db220bd20..89ba06284 100644 --- a/meta-digi-dey/recipes-core/busybox/busybox_1.23.2.bbappend +++ b/meta-digi-dey/recipes-core/busybox/busybox_1.23.2.bbappend @@ -74,3 +74,5 @@ do_install_append() { ln -s ../if-pre-up.d/bridgeifupdown ${D}${sysconfdir}/network/if-post-down.d/bridgeifupdown fi } + +PACKAGE_ARCH = "${MACHINE_ARCH}" diff --git a/meta-digi-dey/recipes-core/images/core-image-base.bbappend b/meta-digi-dey/recipes-core/images/core-image-base.bbappend new file mode 100644 index 000000000..6c8a0fe9c --- /dev/null +++ b/meta-digi-dey/recipes-core/images/core-image-base.bbappend @@ -0,0 +1,16 @@ +# +# Copyright (C) 2016 Digi International. +# + +IMAGE_FEATURES += " \ + dey-network \ + package-management \ + ssh-server-dropbear \ + ${@bb.utils.contains('MACHINE_FEATURES', 'accel-video', 'dey-gstreamer', '', d)} \ + ${@bb.utils.contains('MACHINE_FEATURES', 'alsa', 'dey-audio', '', d)} \ + ${@bb.utils.contains('MACHINE_FEATURES', 'bluetooth', 'dey-bluetooth', '', d)} \ + ${@bb.utils.contains('MACHINE_FEATURES', 'wifi', 'dey-wireless', '', d)} \ +" + +# Add our dey-image tweaks to the final image (like /etc/build info) +inherit dey-image 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 454741b2a..56a646301 100644 --- a/meta-digi-dey/recipes-core/images/dey-image-qt.bb +++ b/meta-digi-dey/recipes-core/images/dey-image-qt.bb @@ -19,11 +19,11 @@ IMAGE_FEATURES += " \ dey-qt \ package-management \ ssh-server-dropbear \ - ${@base_contains('DISTRO_FEATURES', 'x11', 'x11-base x11-sato', '', d)} \ - ${@base_contains('MACHINE_FEATURES', 'accel-video', 'dey-gstreamer', '', d)} \ - ${@base_contains('MACHINE_FEATURES', 'alsa', 'dey-audio', '', d)} \ - ${@base_contains('MACHINE_FEATURES', 'bluetooth', 'dey-bluetooth', '', d)} \ - ${@base_contains('MACHINE_FEATURES', 'wifi', 'dey-wireless', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11-base x11-sato', '', d)} \ + ${@bb.utils.contains('MACHINE_FEATURES', 'accel-video', 'dey-gstreamer', '', d)} \ + ${@bb.utils.contains('MACHINE_FEATURES', 'alsa', 'dey-audio', '', d)} \ + ${@bb.utils.contains('MACHINE_FEATURES', 'bluetooth', 'dey-bluetooth', '', d)} \ + ${@bb.utils.contains('MACHINE_FEATURES', 'wifi', 'dey-wireless', '', d)} \ " # SDK features (for toolchains generated from an image with populate_sdk) diff --git a/meta-digi-dey/recipes-core/images/dey-image-trustfence-initramfs.bb b/meta-digi-dey/recipes-core/images/dey-image-trustfence-initramfs.bb new file mode 100644 index 000000000..f5923ce55 --- /dev/null +++ b/meta-digi-dey/recipes-core/images/dey-image-trustfence-initramfs.bb @@ -0,0 +1,25 @@ +DESCRIPTION = "Trustfence initramfs image" +LICENSE = "MIT" + +PACKAGE_INSTALL = " \ + busybox \ + pv \ + trustfence-initramfs \ +" + +# Do not pollute the initrd image with rootfs features +IMAGE_FEATURES = "" +IMAGE_LINGUAS = "" + +IMAGE_FSTYPES = "cpio.gz.u-boot" +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-trustfence-initramfs" 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 b3da925e0..ff4378aa5 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 @@ -44,7 +44,7 @@ do_install_append() { [ -z "${WLAN0_STATIC_NETMASK}" ] && sed -i -e "/##WLAN0_STATIC_NETMASK##/d" ${D}${sysconfdir}/network/interfaces # Cellular interface - if [ -n "${@base_contains('DISTRO_FEATURES', 'cellular', '1', '', d)}" ] && [ -n "${CELLULAR_INTERFACE}" ]; then + if [ -n "${@bb.utils.contains('DISTRO_FEATURES', 'cellular', '1', '', d)}" ] && [ -n "${CELLULAR_INTERFACE}" ]; then cat ${WORKDIR}/interfaces.cellular >> ${D}${sysconfdir}/network/interfaces sed -i -e 's,##CELLULAR_INTERFACE##,${CELLULAR_INTERFACE},g' ${D}${sysconfdir}/network/interfaces [ -n "${CELLULAR_AUTO}" ] && sed -i -e 's/#auto/auto/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 1141b8094..7b6c6baa7 100644 --- a/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb +++ b/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb @@ -24,7 +24,7 @@ VIRTUAL-RUNTIME_login_manager ?= "" VIRTUAL-RUNTIME_passwd_manager ?= "shadow" # Set virtual runtimes depending on X11 feature -VIRTUAL-RUNTIME_touchscreen ?= "${@base_contains('DISTRO_FEATURES', 'x11', '', 'tslib-calibrate tslib-tests', d)}" +VIRTUAL-RUNTIME_touchscreen ?= "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', 'tslib-calibrate tslib-tests', d)}" RDEPENDS_${PN} = "\ base-files \ @@ -32,13 +32,14 @@ RDEPENDS_${PN} = "\ busybox \ busybox-acpid \ busybox-static-nodes \ - ${@base_contains("MACHINE_FEATURES", "keyboard", "${VIRTUAL-RUNTIME_keymaps}", "", d)} \ - ${@base_contains("MACHINE_FEATURES", "rtc", "busybox-hwclock", "", d)} \ - ${@base_contains("MACHINE_FEATURES", "touchscreen", "${VIRTUAL-RUNTIME_touchscreen}", "",d)} \ + ${@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)} \ init-ifupdown \ modutils-initscripts \ netbase \ os-release \ + sysinfo \ usbutils \ ${VIRTUAL-RUNTIME_dev_manager} \ ${VIRTUAL-RUNTIME_init_manager} \ diff --git a/meta-digi-dey/recipes-core/systemd/systemd-serialgetty.bbappend b/meta-digi-dey/recipes-core/systemd/systemd-serialgetty.bbappend new file mode 100644 index 000000000..f489f61be --- /dev/null +++ b/meta-digi-dey/recipes-core/systemd/systemd-serialgetty.bbappend @@ -0,0 +1,6 @@ +# Copyright (C) 2016 Digi International. + +python __anonymous () { + if (d.getVar("TRUSTFENCE_CONSOLE_DISABLE", True) == "1"): + d.setVar("SERIAL_CONSOLES", "") +} diff --git a/meta-digi-dey/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bbappend b/meta-digi-dey/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bbappend new file mode 100644 index 000000000..f489f61be --- /dev/null +++ b/meta-digi-dey/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bbappend @@ -0,0 +1,6 @@ +# Copyright (C) 2016 Digi International. + +python __anonymous () { + if (d.getVar("TRUSTFENCE_CONSOLE_DISABLE", True) == "1"): + d.setVar("SERIAL_CONSOLES", "") +} diff --git a/meta-digi-dey/recipes-core/trustfence/trustfence-initramfs.bb b/meta-digi-dey/recipes-core/trustfence/trustfence-initramfs.bb new file mode 100644 index 000000000..dfe67b5a9 --- /dev/null +++ b/meta-digi-dey/recipes-core/trustfence/trustfence-initramfs.bb @@ -0,0 +1,28 @@ +# Copyright (C) 2016 Digi International. + +SUMMARY = "Trustfence initramfs required files" +LICENSE = "GPL-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" + +SRC_URI = "file://trustfence-initramfs-init" + +S = "${WORKDIR}" + +do_install() { + install -d ${D}${sbindir} + install -m 0755 trustfence-initramfs-init ${D}/init +} + +# Do not create debug/devel packages +PACKAGES = "${PN}" + +FILES_${PN} = "/" + +# Runtime packages used in 'trustfence-initramfs-init' +RDEPENDS_${PN} = " \ + cryptsetup \ + rng-tools \ + trustfence-tool \ + util-linux-findfs \ + wipe \ +" diff --git a/meta-digi-dey/recipes-core/trustfence/trustfence-initramfs/trustfence-initramfs-init b/meta-digi-dey/recipes-core/trustfence/trustfence-initramfs/trustfence-initramfs-init new file mode 100644 index 000000000..441635f73 --- /dev/null +++ b/meta-digi-dey/recipes-core/trustfence/trustfence-initramfs/trustfence-initramfs-init @@ -0,0 +1,72 @@ +#!/bin/sh +#=============================================================================== +# +# trustfence-initramfs-init +# +# Copyright (C) 2016 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: Init script for Trustfence initramfs +# +#=============================================================================== + +export PATH=/bin:/sbin:/usr/bin:/usr/sbin + +mkdir -p /proc /sys /dev +mount -t proc proc /proc +mount -t sysfs sysfs /sys +mount -t devtmpfs devtmpfs /dev + +# Set kernel console loglevel +LOGLEVEL="$(sysctl -n kernel.printk)" +sysctl -q -w kernel.printk=4 + +# Launch 'rngd' to feed random data to kernel entropy pool +mkdir -p /var/run && rngd + +for arg in $(cat /proc/cmdline); do + case "${arg}" in + init=*|rescue=1|root=*) 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 + +# Translate "PARTUUID=..." to real device +root="$(findfs ${root})" + +# Open LUKS encrypted device +if trustfence-tool ${root} cryptroot; then + # Reset root variable to the decrypted mapped device + root="/dev/mapper/cryptroot" +fi + +# Mount mapped device +mkdir -p /newroot +FSTYPE="$(blkid ${root} | sed -e 's,.*TYPE="\([^"]\+\)".*,\1,g')" +mount ${FSTYPE:+-t ${FSTYPE}} ${root} /newroot + +# +# Clean-up and do the switch_root to the final rootfs +# +# - explicit kill 'rngd' daemon so it doesn't leak to the final rootfs +# - restore previous kernel console loglevel +# - umount virtual filesystems +# +pkill -9 rngd +[ -n "${LOGLEVEL}" ] && sysctl -q -w kernel.printk="${LOGLEVEL}" +mount --move /dev /newroot/dev +umount /sys /proc +exec switch_root /newroot ${init:-/sbin/init} diff --git a/meta-digi-dey/recipes-core/trustfence/trustfence-tool_1.0.bb b/meta-digi-dey/recipes-core/trustfence/trustfence-tool_1.0.bb new file mode 100644 index 000000000..88eb069b9 --- /dev/null +++ b/meta-digi-dey/recipes-core/trustfence/trustfence-tool_1.0.bb @@ -0,0 +1,12 @@ +# Copyright (C) 2016 Digi International. + +SUMMARY = "Trustfence command line tool" +SECTION = "console/tools" +LICENSE = "CLOSED" + +SRC_URI = "${DIGI_PKG_SRC}/${BP}.tar.gz" + +SRC_URI[md5sum] = "1140b71d0e619001b677117e8938be48" +SRC_URI[sha256sum] = "13eecca139dfb6470204c75291c5791144dea098653f52d39d847b2aee3fe19b" + +inherit bin_package diff --git a/meta-digi-dey/recipes-digi/auto-serial-console/auto-serial-console/auto-getty b/meta-digi-dey/recipes-digi/auto-serial-console/auto-serial-console/auto-getty new file mode 100755 index 000000000..cc600e543 --- /dev/null +++ b/meta-digi-dey/recipes-digi/auto-serial-console/auto-serial-console/auto-getty @@ -0,0 +1,24 @@ +#!/bin/sh + +set -e + +[ -f "/etc/default/autogetty" ] && . /etc/default/autogetty + +[ "${ENABLED}" != "1" ] && exit + +for arg in $(cat /proc/cmdline); do + case "${arg}" in + console=*) + eval ${arg} + TTY="${console%,*}" + SPEED="${console#*,}" + + # If no speed is given default to 115200 and fall-back + [ "${SPEED}" = "${TTY}" ] && SPEED="115200,57600,38400,19200,9600" + + if [ -n "${TTY}" ] && grep -qs "${TTY}" /etc/securetty; then + /sbin/getty -L "${SPEED}" "${TTY}" & + fi + ;; + esac +done diff --git a/meta-digi-dey/recipes-digi/auto-serial-console/auto-serial-console/auto-serial-console b/meta-digi-dey/recipes-digi/auto-serial-console/auto-serial-console/auto-serial-console new file mode 100755 index 000000000..12da6fc75 --- /dev/null +++ b/meta-digi-dey/recipes-digi/auto-serial-console/auto-serial-console/auto-serial-console @@ -0,0 +1,29 @@ +#!/bin/sh + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/bin/auto-getty +NAME="auto-getty" + +case "$1" in + start) + echo -n "Starting auto-serial-console: " + start-stop-daemon -S -b -n $NAME --exec $DAEMON + echo "done" + ;; + stop) + echo -n "Stopping auto-serial-console: " + start-stop-daemon -K -n $NAME + echo "done" + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "Usage: auto-serial-console { start | stop | restart }" >&2 + exit 1 + ;; +esac + +exit 0 + diff --git a/meta-digi-dey/recipes-digi/auto-serial-console/auto-serial-console/autogetty b/meta-digi-dey/recipes-digi/auto-serial-console/auto-serial-console/autogetty new file mode 100644 index 000000000..7543d5066 --- /dev/null +++ b/meta-digi-dey/recipes-digi/auto-serial-console/auto-serial-console/autogetty @@ -0,0 +1 @@ +ENABLED=##ENABLED## diff --git a/meta-digi-dey/recipes-digi/auto-serial-console/auto-serial-console_0.1.bb b/meta-digi-dey/recipes-digi/auto-serial-console/auto-serial-console_0.1.bb new file mode 100644 index 000000000..8de93f2cf --- /dev/null +++ b/meta-digi-dey/recipes-digi/auto-serial-console/auto-serial-console_0.1.bb @@ -0,0 +1,34 @@ +SUMMARY = "Auto Serial Console script" +DESCRIPTION = "Scripts to call the console tty from the kernel cmd line" +SECTION = "base" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "\ + file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420 \ +" + +SRC_URI = "\ + file://autogetty \ + file://auto-getty \ + file://auto-serial-console \ +" + +S = "${WORKDIR}" + +inherit update-rc.d + +INITSCRIPT_NAME = "auto-serial-console" +INITSCRIPT_PARAMS = "start 99 5 ." + +do_install () { + install -m 0755 -d ${D}${sysconfdir}/default + AUTOGETTY_ENABLE='${@base_conditional( "TRUSTFENCE_CONSOLE_DISABLE", "1", "1", "0", d )}' + install -m 0644 ${WORKDIR}/autogetty ${D}${sysconfdir}/default/autogetty + sed -i -e "s/##ENABLED##/${AUTOGETTY_ENABLE}/g" ${D}${sysconfdir}/default/autogetty + + install -m 0755 -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/auto-serial-console ${D}${sysconfdir}/init.d/auto-serial-console + + install -m 0755 -d ${D}${bindir} + install -m 0755 ${WORKDIR}/auto-getty ${D}${bindir}/auto-getty +} diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-bt.bb b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-bt.bb index 975b0c4fa..71866c3fc 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-bt.bb +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-bt.bb @@ -22,4 +22,4 @@ do_install() { install -m 0755 bt_test ${D}${bindir} } -COMPATIBLE_MACHINE = "(ccardimx28|ccimx6)" +COMPATIBLE_MACHINE = "(ccardimx28|ccimx6$|ccimx6ul)" diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-btconfig.bb b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-btconfig.bb index fa6e52f99..0e997e1a3 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-btconfig.bb +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-btconfig.bb @@ -22,4 +22,4 @@ do_install() { install -m 0755 btconfig ${D}${bindir} } -COMPATIBLE_MACHINE = "(ccardimx28|ccimx6)" +COMPATIBLE_MACHINE = "(ccardimx28|ccimx6$|ccimx6ul)" diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-can.bb b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-can.bb index e87d11af4..a6c7de141 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-can.bb +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-can.bb @@ -18,4 +18,4 @@ do_install() { install -m 0755 can_test ${D}${bindir} } -COMPATIBLE_MACHINE = "(ccardimx28|ccimx6)" +COMPATIBLE_MACHINE = "(ccardimx28|ccimx6$|ccimx6ul)" diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-hdp.bb b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-hdp.bb index 72a34b357..b306b3a9f 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-hdp.bb +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-hdp.bb @@ -16,4 +16,4 @@ do_install() { RDEPENDS_${PN} = "python python-argparse python-crypt python-dbus python-pygobject" -COMPATIBLE_MACHINE = "(ccardimx28|ccimx6)" +COMPATIBLE_MACHINE = "(ccardimx28|ccimx6$|ccimx6ul)" diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles.bb b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles.bb index cf9ada749..f28891e71 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles.bb +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-opengles.bb @@ -24,4 +24,4 @@ RDEPENDS_${PN}_ccimx6 = "libopenvg-mx6" PACKAGE_ARCH = "${MACHINE_ARCH}" -COMPATIBLE_MACHINE = "(ccimx6)" +COMPATIBLE_MACHINE = "(ccimx6$)" diff --git a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-v4l2.bb b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-v4l2.bb index 757bf796a..1e0ce763d 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/dey-examples-v4l2.bb +++ b/meta-digi-dey/recipes-digi/dey-examples/dey-examples-v4l2.bb @@ -25,4 +25,4 @@ do_install() { PACKAGE_ARCH = "${MACHINE_ARCH}" -COMPATIBLE_MACHINE = "(ccimx6)" +COMPATIBLE_MACHINE = "(ccimx6$)" 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 d19be8411..5aed8fd83 100644 --- a/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-examples.bb +++ b/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-examples.bb @@ -11,28 +11,35 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" inherit packagegroup RDEPENDS_${PN} = "\ - ${@base_contains("MACHINE_FEATURES", "alsa", "dey-examples-alsa", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "alsa", "dey-examples-alsa", "", d)} \ dey-examples-gpio-sysfs \ - ${@base_contains("MACHINE_FEATURES", "rtc", "dey-examples-rtc", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "rtc", "dey-examples-rtc", "", d)} \ dey-examples-spidev \ - ${@base_contains("MACHINE_FEATURES", "alsa", "dey-examples-vplay", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "alsa", "dey-examples-vplay", "", d)} \ dey-examples-watchdog \ " RDEPENDS_${PN}_append_ccardimx28 = "\ - ${@base_contains("MACHINE_FEATURES", "bluetooth", "dey-examples-bt", "", d)} \ - ${@base_contains("MACHINE_FEATURES", "bluetooth", "dey-examples-btconfig", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-bt", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-btconfig", "", d)} \ dey-examples-can \ - ${@base_contains("MACHINE_FEATURES", "bluetooth", "dey-examples-hdp", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-hdp", "", d)} \ " RDEPENDS_${PN}_append_ccimx6 = "\ - ${@base_contains("MACHINE_FEATURES", "bluetooth", "dey-examples-bt", "", d)} \ - ${@base_contains("MACHINE_FEATURES", "bluetooth", "dey-examples-btconfig", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-bt", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-btconfig", "", d)} \ dey-examples-can \ - ${@base_contains("MACHINE_FEATURES", "bluetooth", "dey-examples-hdp", "", d)} \ - ${@base_contains("MACHINE_FEATURES", "accel-graphics", "dey-examples-opengles", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-hdp", "", d)} \ + ${@bb.utils.contains("MACHINE_FEATURES", "accel-graphics", "dey-examples-opengles", "", d)} \ dey-examples-v4l2 \ " -COMPATIBLE_MACHINE = "(ccardimx28|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-can \ + ${@bb.utils.contains("MACHINE_FEATURES", "bluetooth", "dey-examples-hdp", "", d)} \ +" + +COMPATIBLE_MACHINE = "(ccardimx28|ccimx6$|ccimx6ul)" diff --git a/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-trustfence.bb b/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-trustfence.bb new file mode 100644 index 000000000..cab5f931e --- /dev/null +++ b/meta-digi-dey/recipes-digi/packagegroups/packagegroup-dey-trustfence.bb @@ -0,0 +1,12 @@ +# Copyright (C) 2016 Digi International. + +SUMMARY = "DEY trustfence packagegroup" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +inherit packagegroup + +RDEPENDS_${PN} = "\ + ${@base_conditional('TRUSTFENCE_CONSOLE_DISABLE', '1', 'auto-serial-console', '', d)} \ +" diff --git a/meta-digi-dey/recipes-digi/sysinfo/sysinfo.bb b/meta-digi-dey/recipes-digi/sysinfo/sysinfo.bb new file mode 100644 index 000000000..c46fdf74b --- /dev/null +++ b/meta-digi-dey/recipes-digi/sysinfo/sysinfo.bb @@ -0,0 +1,15 @@ +# Copyright (C) 2016 Digi International. + +SUMMARY = "Digi's system info utility" +SECTION = "base" +LICENSE = "GPL-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" + +SRC_URI = "file://sysinfo" + +S = "${WORKDIR}" + +do_install() { + install -d ${D}${bindir} + install -m 0755 sysinfo ${D}${bindir} +} diff --git a/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo b/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo new file mode 100755 index 000000000..3a2c1b27e --- /dev/null +++ b/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo @@ -0,0 +1,230 @@ +#!/bin/sh +#=============================================================================== +# +# sysinfo +# +# Copyright (C) 2016 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: System information gather script +# +#=============================================================================== + +FW_PRINTENV="$(which fw_printenv)" + +make_report(){ + echo "--------------------------------------" + echo "- -" + echo "- Uptime -" + echo "- -" + echo "--------------------------------------" + echo "" + uptime + printf "\n\n" + + echo "--------------------------------------" + echo "- -" + echo "- Kernel version -" + echo "- -" + echo "--------------------------------------" + echo "" + uname -a + printf "\n\n" + + echo "--------------------------------------" + echo "- -" + echo "- OS release -" + echo "- -" + echo "--------------------------------------" + echo "" + if [ -f "/etc/os-release" ]; then + cat /etc/os-release + else + echo "[NOT FOUND] /etc/os-release" + fi + printf "\n\n" + + echo "--------------------------------------" + echo "- -" + echo "- Build configurations -" + echo "- -" + echo "--------------------------------------" + echo "" + if [ -f "/etc/build" ]; then + cat /etc/build + else + echo "[NOT FOUND] /etc/build" + fi + printf "\n\n" + + echo "--------------------------------------" + echo "- -" + echo "- U-boot saved environment -" + echo "- -" + echo "--------------------------------------" + echo "" + if [ -x "${FW_PRINTENV}" ]; then + ${FW_PRINTENV} + else + echo "[NOT FOUND] fw_printenv" + fi + printf "\n\n" + + echo "--------------------------------------" + echo "- -" + echo "- Linux boot log -" + echo "- -" + echo "--------------------------------------" + echo "" + dmesg + printf "\n\n" + + echo "--------------------------------------" + echo "- -" + echo "- Log files from /var/log -" + echo "- -" + echo "--------------------------------------" + echo "" + for f in $(find /var/log/ -name *.log); do + echo "${f} FILE"; + echo "---------------------------------------"; + cat ${f}; + printf "\n\n" + done + printf "\n\n" + + echo "--------------------------------------" + echo "- -" + echo "- /var/log/messages -" + echo "- -" + echo "--------------------------------------" + echo "" + if [ -f "/var/log/messages" ]; then + cat /var/log/messages + else + echo "[NOT FOUND] /var/log/messages" + fi + printf "\n\n" + + echo "--------------------------------------" + echo "- -" + echo "- Linux kernel configuration -" + echo "- -" + echo "--------------------------------------" + echo "" + if [ -f "/proc/config.gz" ]; then + zcat /proc/config.gz + else + echo "[NOT FOUND] /proc/config.gz" + fi + printf "\n\n" + + echo "--------------------------------------" + echo "- -" + echo "- Memory consumption -" + echo "- -" + echo "--------------------------------------" + echo "" + free + printf "\n" + cat /proc/meminfo + printf "\n\n" + + echo "--------------------------------------" + echo "- -" + echo "- Running processes -" + echo "- -" + echo "--------------------------------------" + echo "" + ps -l + printf "\n\n" + + echo "--------------------------------------" + echo "- -" + echo "- Mounts -" + echo "- -" + echo "--------------------------------------" + echo "" + mount + printf "\n\n" + + echo "--------------------------------------" + echo "- -" + echo "- Opened ports -" + echo "- -" + echo "--------------------------------------" + echo "" + netstat -n -a -p + printf "\n\n" + + echo "--------------------------------------" + echo "- -" + echo "- Routes -" + echo "- -" + echo "--------------------------------------" + echo "" + route -n + printf "\n\n" + + echo "--------------------------------------" + echo "- -" + echo "- Network configuration -" + echo "- -" + echo "--------------------------------------" + echo "" + ifconfig -a + printf "\n" + ip link show + printf "\n" + + echo "-------------End of report------------" +} + + +DISTRO="$(sed -ne 's,DISTRO = \(.*\)$,\1,g;T;p' /etc/build)" +DEY_VERSION="$(sed -ne 's,DISTRO_VERSION = \(.*\)$,\1,g;T;p' /etc/build)" +UBOOT_PARTITION="/dev/mmcblk0boot0" +[ -c "/dev/mtd0" ] && UBOOT_PARTITION="/dev/mtd0" +UBOOT_VERSION="$(strings ${UBOOT_PARTITION} | grep -m 1 dub | cut -d' ' -f2)" +MACHINE="$(cat /proc/device-tree/digi,machine,name)" +BOARD_VARIANT="$(cat /proc/device-tree/digi,hwid,variant)" +BOARD_SN="$(cat /proc/device-tree/digi,hwid,sn)" +BOARD_VERSION="$(cat /proc/device-tree/digi,carrierboard,version)" +BOARD_ID="$(cat /proc/device-tree/digi,carrierboard,id)" +if grep -qs '\' /proc/device-tree/compatible; then + MCA_NODE="/sys/devices/platform/soc/2100000.aips-bus/21a0000.i2c/i2c-0/0-007e" + MCA_HW_VERSION=$(cat ${MCA_NODE}/hw_version) || MCA_HW_VERSION="??" + MCA_FW_VERSION=$(cat ${MCA_NODE}/fw_version) || MCA_FW_VERSION="??" + MCA_VERSION="HW_VERSION=${MCA_HW_VERSION} FW_VERSION=${MCA_FW_VERSION}" +fi + +DATE="$(date "+%Y%m%d%H%M%S")" +FILE="/tmp/sysinfo-${DEY_VERSION}-${BOARD_SN}-${DATE}.txt" +printf "\n\n" + +( + echo "-------------------------------------" + echo "- -" + echo "- ENVIRONMENT TABLE -" + echo "- -" + echo "-------------------------------------" + echo "" + + 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)" + echo "|| Kernel | $(uname -a)" + [ -n "${MCA_VERSION}" ] && echo "|| Kinetis | ${MCA_VERSION}" + printf "\n\n" +) | tee ${FILE} + +make_report >> ${FILE} +gzip ${FILE} +echo "Report generated in ${FILE}.gz" +printf "\n\n" diff --git a/meta-digi-dey/recipes-graphics/packagegroups/packagegroup-dey-qt.bb b/meta-digi-dey/recipes-graphics/packagegroups/packagegroup-dey-qt.bb index 2bdc3fcdf..4e5e94a34 100644 --- a/meta-digi-dey/recipes-graphics/packagegroups/packagegroup-dey-qt.bb +++ b/meta-digi-dey/recipes-graphics/packagegroups/packagegroup-dey-qt.bb @@ -8,6 +8,9 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" inherit packagegroup +MACHINE_QT5_EXTRA_INSTALL ?= "" +MACHINE_QT5_EXTRA_INSTALL_ccimx6 ?= "qtwebengine-examples" + QT5_PKS = " \ qtbase-fonts \ qtdeclarative-tools \ @@ -20,7 +23,6 @@ QT5_EXAMPLES = " \ qtdeclarative-examples \ qtmultimedia-examples \ qtsvg-examples \ - qtwebengine-examples \ " QT5_DEMOS = " \ @@ -34,4 +36,5 @@ RDEPENDS_${PN} += " \ ${QT5_PKS} \ ${QT5_DEMOS} \ ${QT5_EXAMPLES} \ + ${MACHINE_QT5_EXTRA_INSTALL} \ " diff --git a/meta-digi-dey/recipes-support/lvm2/lvm2_%.bbappend b/meta-digi-dey/recipes-support/lvm2/lvm2_%.bbappend new file mode 100644 index 000000000..a467c444f --- /dev/null +++ b/meta-digi-dey/recipes-support/lvm2/lvm2_%.bbappend @@ -0,0 +1,6 @@ +# Copyright (C) 2016 Digi International. + +# Split libraries into a different package +PACKAGES =+ "lib${PN}" + +FILES_lib${PN} = "${libdir}/lib*.so.*" diff --git a/meta-digi-dey/recipes-support/rng-tools/rng-tools/default b/meta-digi-dey/recipes-support/rng-tools/rng-tools/default new file mode 100644 index 000000000..ab7cd9327 --- /dev/null +++ b/meta-digi-dey/recipes-support/rng-tools/rng-tools/default @@ -0,0 +1,2 @@ +# Specify rng device +RNG_DEVICE=/dev/hwrng diff --git a/meta-digi-dey/recipes-support/rng-tools/rng-tools_%.bbappend b/meta-digi-dey/recipes-support/rng-tools/rng-tools_%.bbappend new file mode 100644 index 000000000..01631c66d --- /dev/null +++ b/meta-digi-dey/recipes-support/rng-tools/rng-tools_%.bbappend @@ -0,0 +1,3 @@ +# Copyright (C) 2016 Digi International. + +FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" diff --git a/sdk/build.sh b/sdk/build.sh index d45438080..c668c50ef 100755 --- a/sdk/build.sh +++ b/sdk/build.sh @@ -70,7 +70,9 @@ copy_images() { else cp -r tmp/deploy/images ${1}/ if [ "${DY_BUILD_TCHAIN}" = "true" ]; then - cp -r tmp/deploy/sdk ${1}/ + if [ -d tmp/deploy/sdk ]; then + cp -r tmp/deploy/sdk ${1}/ + fi fi fi @@ -116,7 +118,6 @@ purge_sstate() { [ -z "${WORKSPACE}" ] && error "WORKSPACE not specified" # Set default settings if Jenkins does not do it -[ -z "${DY_TARGET}" ] && DY_TARGET="dey-image-qt" [ -z "${DY_DISTRO}" ] && DY_DISTRO="dey" # If DY_BUILD_TCHAIN is unset, set it for release jobs @@ -127,8 +128,13 @@ if [ -z "${DY_FB_IMAGE}" ] && echo ${JOB_NAME} | grep -qs 'dey.*fb'; then DY_FB_IMAGE="true" fi -# Per-platform variants -while read _pl _var; do +# If DY_MFG_IMAGE is unset, set it depending on the job name +if [ -z "${DY_MFG_IMAGE}" ] && echo ${JOB_NAME} | grep -qs 'dey.*mfg'; then + DY_MFG_IMAGE="true" +fi + +# Per-platform data +while read _pl _var _tgt; do # DY_BUILD_VARIANTS comes from Jenkins environment: # 'false': don't build variants (only the default) # : build all the variants supported by the platform @@ -140,10 +146,13 @@ while read _pl _var; do _var="${DY_BUILD_VARIANTS}" fi fi + [ -n "${DY_TARGET}" ] && _tgt="${DY_TARGET}" || true eval "${_pl}_var=\"${_var}\"" + eval "${_pl}_tgt=\"${_tgt}\"" done<<-_EOF_ - ccardimx28js - e w wb web web1 - ccimx6sbc DONTBUILDVARIANTS + ccardimx28js - e w wb web web1 dey-image-qt + ccimx6sbc DONTBUILDVARIANTS dey-image-qt + ccimx6ulstarter DONTBUILDVARIANTS core-image-base _EOF_ YOCTO_IMGS_DIR="${WORKSPACE}/images" @@ -170,7 +179,11 @@ if pushd ${YOCTO_INST_DIR}; then error "Revision \"${DY_REVISION}\" not found" fi fi - yes "" 2>/dev/null | ${REPO} init --no-repo-verify -u ${MANIFEST_URL} ${repo_revision} + # If it is a manufacturing job, specify the manufacturing manifest name + if [ "${DY_MFG_IMAGE}" = "true" ]; then + mfg_xml="-m manufacturing.xml" + fi + yes "" 2>/dev/null | ${REPO} init --no-repo-verify -u ${MANIFEST_URL} ${repo_revision} ${mfg_xml} ${REPO} forall -p -c 'git remote prune $(git remote)' time ${REPO} sync -d ${MAKE_JOBS} popd @@ -180,6 +193,7 @@ fi rm -rf ${YOCTO_IMGS_DIR} ${YOCTO_PROJ_DIR} for platform in ${DY_PLATFORMS}; do eval platform_variants="\${${platform}_var}" + eval platform_targets="\${${platform}_tgt}" for variant in ${platform_variants}; do _this_prj_dir="${YOCTO_PROJ_DIR}/${platform}" _this_img_dir="${YOCTO_IMGS_DIR}/${platform}" @@ -216,7 +230,11 @@ for platform in ${DY_PLATFORMS}; do if [ "${DY_FB_IMAGE}" = "true" ]; then printf "${X11_REMOVAL_CFG}" >> conf/local.conf fi - for target in ${DY_TARGET}; do + # Add the manufacturing layer to bblayers.conf file if it is a manufacturing job + if [ "${DY_MFG_IMAGE}" = "true" ]; then + sed -i -e "/meta-digi-dey/a\ ${YOCTO_INST_DIR}/sources/meta-digi-mfg \\\\" conf/bblayers.conf + fi + for target in ${platform_targets}; do printf "\n[INFO] Building the ${target} target.\n" time bitbake ${target} # Build the toolchain for DEY images diff --git a/sdk/config/ccardimx28js/local.conf.sample b/sdk/config/ccardimx28js/local.conf.sample index 1bfcd50e6..fa3340fd4 100644 --- a/sdk/config/ccardimx28js/local.conf.sample +++ b/sdk/config/ccardimx28js/local.conf.sample @@ -247,11 +247,12 @@ BB_DISKMON_DIRS = "\ # Qemu configuration # # By default qemu will build with a builtin VNC server where graphical output can be -# seen. The two lines below enable the SDL backend too. This assumes there is a -# libsdl library available on your build system. +# seen. The two lines below enable the SDL backend too. By default libsdl-native will +# be built, if you want to use your host's libSDL instead of the minimal libsdl built +# by libsdl-native then uncomment the ASSUME_PROVIDED line below. PACKAGECONFIG_append_pn-qemu-native = " sdl" PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" -ASSUME_PROVIDED += "libsdl-native" +#ASSUME_PROVIDED += "libsdl-native" # CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to diff --git a/sdk/config/ccimx6sbc/local.conf.sample b/sdk/config/ccimx6sbc/local.conf.sample index f8f337e5d..31908c8dc 100644 --- a/sdk/config/ccimx6sbc/local.conf.sample +++ b/sdk/config/ccimx6sbc/local.conf.sample @@ -232,11 +232,12 @@ BB_DISKMON_DIRS = "\ # Qemu configuration # # By default qemu will build with a builtin VNC server where graphical output can be -# seen. The two lines below enable the SDL backend too. This assumes there is a -# libsdl library available on your build system. +# seen. The two lines below enable the SDL backend too. By default libsdl-native will +# be built, if you want to use your host's libSDL instead of the minimal libsdl built +# by libsdl-native then uncomment the ASSUME_PROVIDED line below. PACKAGECONFIG_append_pn-qemu-native = " sdl" PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" -ASSUME_PROVIDED += "libsdl-native" +#ASSUME_PROVIDED += "libsdl-native" # CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to diff --git a/sdk/config/ccimx6ulstarter/bblayers.conf.sample b/sdk/config/ccimx6ulstarter/bblayers.conf.sample new file mode 100644 index 000000000..0647c0d8d --- /dev/null +++ b/sdk/config/ccimx6ulstarter/bblayers.conf.sample @@ -0,0 +1,25 @@ +# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +LCONF_VERSION = "6" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ##OEROOT##/meta \ + ##OEROOT##/meta-yocto \ + ##OEROOT##/meta-yocto-bsp \ + ##DIGIBASE##/meta-openembedded/meta-oe \ + ##DIGIBASE##/meta-openembedded/meta-python \ + ##DIGIBASE##/meta-openembedded/meta-networking \ + ##DIGIBASE##/meta-openembedded/meta-webserver \ + ##DIGIBASE##/meta-qt5 \ + ##DIGIBASE##/meta-fsl-arm \ + ##DIGIBASE##/meta-fsl-demos \ + ##DIGIBASE##/meta-digi/meta-digi-arm \ + ##DIGIBASE##/meta-digi/meta-digi-dey \ + " +BBLAYERS_NON_REMOVABLE ?= " \ + ##OEROOT##/meta \ + ##OEROOT##/meta-yocto \ + " diff --git a/sdk/config/ccimx6ulstarter/conf-notes.txt b/sdk/config/ccimx6ulstarter/conf-notes.txt new file mode 100644 index 000000000..6756fcb41 --- /dev/null +++ b/sdk/config/ccimx6ulstarter/conf-notes.txt @@ -0,0 +1,6 @@ +Digi Embedded Yocto provides the following image recipes: + + * core-image-base: A console-only image. + + Expansion of native core-image-base by including all the support for the + target device hardware like firmware files, rootfs customizations, etc. diff --git a/sdk/config/ccimx6ulstarter/local.conf.sample b/sdk/config/ccimx6ulstarter/local.conf.sample new file mode 100644 index 000000000..16ad9f0c1 --- /dev/null +++ b/sdk/config/ccimx6ulstarter/local.conf.sample @@ -0,0 +1,256 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86 if no other machine is selected: +#MACHINE ??= "qemux86" + +MACHINE = "ccimx6ulstarter" + +# +# Use Digi's internal git repositories +# +#DIGI_INTERNAL_GIT ?= "1" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "dey" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK/ADT target architecture +# +# This variable specifies the architecture to build SDK/ADT items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, exmap, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES = "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# - 'image-swab' to perform host system intrusion detection +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +# NOTE: image-prelink is currently broken due to problems with the prelinker. It is advised +# that you do NOT run the prelinker at this time. +USER_CLASSES ?= "buildstats image-mklibs" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. To +# enable this uncomment this line. See classes/testimage(-auto).bbclass for +# further details. +#TEST_IMAGE = "1" +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS = "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + + +# +# Qemu configuration +# +# By default qemu will build with a builtin VNC server where graphical output can be +# seen. The two lines below enable the SDL backend too. By default libsdl-native will +# be built, if you want to use your host's libSDL instead of the minimal libsdl built +# by libsdl-native then uncomment the ASSUME_PROVIDED line below. +PACKAGECONFIG_append_pn-qemu-native = " sdl" +PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" +#ASSUME_PROVIDED += "libsdl-native" + + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# +# Enable local PR server +# +PRSERV_HOST = "localhost:0" + +# +# Some libraries and packages are covered by Freescale EULA +# +#ACCEPT_FSL_EULA = "1"