diff --git a/README.md b/README.md index ae998192d..dda0ee0c6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Digi Embedded Yocto (DEY) 4.0 -## Release 4.0-r2 +## Release 4.0-r3 This document provides information about Digi Embedded Yocto, Digi International's professional embedded Yocto development environment. diff --git a/meta-digi-arm/classes/image_types_digi.bbclass b/meta-digi-arm/classes/image_types_digi.bbclass index 9691b0921..e5d4bc81a 100644 --- a/meta-digi-arm/classes/image_types_digi.bbclass +++ b/meta-digi-arm/classes/image_types_digi.bbclass @@ -207,7 +207,14 @@ trustence_sign_cpio() { [ -n "${TRUSTFENCE_DEK_PATH}" ] && [ "${TRUSTFENCE_DEK_PATH}" != "0" ] && export CONFIG_DEK_PATH="${TRUSTFENCE_DEK_PATH}" # Sign/encrypt the ramdisk - trustfence-sign-artifact.sh -p "${DIGI_FAMILY}" -i "${1}" "${1}.tf" + if [ "${DEY_SOC_VENDOR}" = "NXP" ]; then + trustfence-sign-artifact.sh -p "${DIGI_SOM}" -i "${1}" "${1}.tf" + elif [ "${DEY_SOC_VENDOR}" = "STM" ]; then + # TODO: sign the ramdisk for ST platforms + + # (fall-back) Copy the image with no changes + cp "${1}" "${1}.tf" + fi else # Copy the image with no changes cp "${1}" "${1}.tf" @@ -231,7 +238,7 @@ rootfs_sign() { ROOTFS_IMAGE="${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.squashfs" TMP_ROOTFS_IMAGE_SIGNED="$(mktemp ${ROOTFS_IMAGE}-signed.XXXXXX)" # Sign rootfs read-only image - trustfence-sign-artifact.sh -p "${DIGI_FAMILY}" -r "${ROOTFS_IMAGE}" "${TMP_ROOTFS_IMAGE_SIGNED}" + trustfence-sign-artifact.sh -p "${DIGI_SOM}" -r "${ROOTFS_IMAGE}" "${TMP_ROOTFS_IMAGE_SIGNED}" mv "${TMP_ROOTFS_IMAGE_SIGNED}" "${ROOTFS_IMAGE}" } diff --git a/meta-digi-arm/classes/remove-pkg-postinst-ontarget.bbclass b/meta-digi-arm/classes/remove-pkg-postinst-ontarget.bbclass index dacb75498..c889790ff 100644 --- a/meta-digi-arm/classes/remove-pkg-postinst-ontarget.bbclass +++ b/meta-digi-arm/classes/remove-pkg-postinst-ontarget.bbclass @@ -1,2 +1,7 @@ -pkg_postinst_ontarget:${PN}() { +python __anonymous() { + RPN = d.getVar("REMOVE_POSTINST_RPN") + if RPN is None: + RPN = d.getVar("PN") + if RPN: + d.setVar('pkg_postinst_ontarget:%s' % RPN, "") } diff --git a/meta-digi-arm/conf/layer.conf b/meta-digi-arm/conf/layer.conf index 9b363fb63..8868577f6 100644 --- a/meta-digi-arm/conf/layer.conf +++ b/meta-digi-arm/conf/layer.conf @@ -19,8 +19,8 @@ BBFILES_DYNAMIC += " \ " LAYERDEPENDS_digi-arm = "core" -LAYERDEPENDS_digi-arm += "${@oe.utils.conditional('DEY_BUILD_PLATFORM', 'NXP', 'freescale-layer', '', d)}" -LAYERDEPENDS_digi-arm += "${@oe.utils.conditional('DEY_BUILD_PLATFORM', 'STM', 'stm-st-stm32mp', '', d)}" +LAYERDEPENDS_digi-arm += "${@oe.utils.conditional('DEY_SOC_VENDOR', 'NXP', 'freescale-layer', '', d)}" +LAYERDEPENDS_digi-arm += "${@oe.utils.conditional('DEY_SOC_VENDOR', 'STM', 'stm-st-stm32mp', '', d)}" LAYERSERIES_COMPAT_digi-arm = "kirkstone" @@ -36,6 +36,13 @@ BBMASK += " \ meta-st-stm32mp/recipes-core/systemd/systemd-conf_%.bbappend \ " +# Tweak stm32mpu-ai dependencies to use ST's machine learning packages +LAYERDEPENDS_stm32mpu-ai:remove = "st-openstlinux" +BBMASK += " \ + meta-st-stm32mpu-ai/recipes-st/images/st-image-ai-userfs.bb \ + meta-st-stm32mpu-ai/recipes-st/images/st-image-ai.bb \ +" + # Digi's General and Open Source license agreements DIGI_EULA_FILE = "${LAYERDIR}/DIGI_EULA" DIGI_OPEN_EULA_FILE = "${LAYERDIR}/DIGI_OPEN_EULA" diff --git a/meta-digi-arm/conf/machine/ccimx6qpsbc.conf b/meta-digi-arm/conf/machine/ccimx6qpsbc.conf index c43460a8e..c468d2cd9 100644 --- a/meta-digi-arm/conf/machine/ccimx6qpsbc.conf +++ b/meta-digi-arm/conf/machine/ccimx6qpsbc.conf @@ -2,6 +2,8 @@ #@NAME: ConnectCore 6 QuadPlus Single Board Computer. #@DESCRIPTION: Machine configuration for Digi's ConnectCore 6 QuadPlus SBC. +DIGI_SOM = "ccimx6qp" + # Include the machine configuration for Digi's ConnectCore 6 module. include conf/machine/include/ccimx6.inc diff --git a/meta-digi-arm/conf/machine/ccimx6sbc.conf b/meta-digi-arm/conf/machine/ccimx6sbc.conf index b3d6f539b..4cea9442c 100644 --- a/meta-digi-arm/conf/machine/ccimx6sbc.conf +++ b/meta-digi-arm/conf/machine/ccimx6sbc.conf @@ -2,6 +2,8 @@ #@NAME: ConnectCore 6 Single Board Computer. #@DESCRIPTION: Machine configuration for Digi's ConnectCore 6 SBC. +DIGI_SOM = "ccimx6" + # Contains the ConnectCore 6 module. include conf/machine/include/ccimx6.inc diff --git a/meta-digi-arm/conf/machine/ccimx8mm-dvk.conf b/meta-digi-arm/conf/machine/ccimx8mm-dvk.conf index a6863c8eb..cbe10eec6 100644 --- a/meta-digi-arm/conf/machine/ccimx8mm-dvk.conf +++ b/meta-digi-arm/conf/machine/ccimx8mm-dvk.conf @@ -2,8 +2,8 @@ #@NAME: ConnectCore 8M Mini Development Kit. #@DESCRIPTION: Machine configuration for Digi's ConnectCore 8M Mini DVK. -DIGI_FAMILY = "ccimx8mm" -MACHINEOVERRIDES =. "mx8:mx8m:mx8mm:ccimx8m:${DIGI_FAMILY}:" +DIGI_SOM = "ccimx8mm" +MACHINEOVERRIDES =. "mx8:mx8m:mx8mm:${DIGI_FAMILY}:${DIGI_SOM}:" # Include the machine configuration for Digi's ConnectCore 8M module. include conf/machine/include/ccimx8m.inc diff --git a/meta-digi-arm/conf/machine/ccimx8mn-dvk.conf b/meta-digi-arm/conf/machine/ccimx8mn-dvk.conf index da1583982..dc3a97a43 100644 --- a/meta-digi-arm/conf/machine/ccimx8mn-dvk.conf +++ b/meta-digi-arm/conf/machine/ccimx8mn-dvk.conf @@ -2,8 +2,8 @@ #@NAME: ConnectCore 8M Nano Development Kit. #@DESCRIPTION: Machine configuration for Digi's ConnectCore 8M Nano DVK. -DIGI_FAMILY = "ccimx8mn" -MACHINEOVERRIDES =. "mx8:mx8m:mx8mn:ccimx8m:${DIGI_FAMILY}:" +DIGI_SOM = "ccimx8mn" +MACHINEOVERRIDES =. "mx8:mx8m:mx8mm:${DIGI_FAMILY}:${DIGI_SOM}:" # Include the machine configuration for Digi's ConnectCore 8M module. include conf/machine/include/ccimx8m.inc diff --git a/meta-digi-arm/conf/machine/ccimx93-dvk.conf b/meta-digi-arm/conf/machine/ccimx93-dvk.conf index d446b5082..88c8f3641 100644 --- a/meta-digi-arm/conf/machine/ccimx93-dvk.conf +++ b/meta-digi-arm/conf/machine/ccimx93-dvk.conf @@ -2,8 +2,13 @@ #@NAME: ConnectCore 93 Development Kit #@DESCRIPTION: Machine configuration for Digi's ConnectCore 93 DVK +DIGI_SOM = "ccimx93" + require include/ccimx93.inc +MACHINEOVERRIDES =. "${DIGI_FAMILY}:${DIGI_SOM}:" +MACHINEOVERRIDES =. "mx93:" + # U-Boot configurations UBOOT_CONFIG ??= "ccimx93-dvk" UBOOT_CONFIG[ccimx93-dvk] = "ccimx93-dvk_defconfig" @@ -11,14 +16,26 @@ UBOOT_DTB_NAME = "ccimx93-dvk.dtb" KERNEL_DEVICETREE ?= " \ digi/ccimx93-dvk.dtb \ + digi/_ov_board_dsi_display_ccimx93-dvk.dtbo \ + digi/_ov_board_enet2_ccimx93-dvk.dtbo \ digi/_ov_board_lvds_ccimx93-dvk.dtbo \ + digi/_ov_board_mikroe-accel2-click_ccimx93-dvk.dtbo \ + digi/_ov_board_mikroe-gyro-click_ccimx93-dvk.dtbo \ digi/_ov_som_bt_ccimx93.dtbo \ digi/_ov_som_mca_ccimx93.dtbo \ + digi/_ov_som_npu_ccimx93.dtbo \ digi/_ov_som_wifi_ccimx93.dtbo \ " -# Remove additional bluetooth packages -MACHINE_BLUETOOTH_EXTRA_INSTALL = "" +# Wireless external module +WIRELESS_MODULE ?= "" +WIRELESS_MODULE:append = " ${@oe.utils.conditional('HAVE_WIFI', '1', 'kernel-module-nxp-wlan', '', d)}" +HAS_WIFI_VIRTWLANS = "true" + +# Machine firmware +MACHINE_FIRMWARE:append = " ${@oe.utils.conditional('HAVE_WIFI', '1', 'firmware-nxp-wifi-nxpiw612', '', d)}" + +MACHINE_EXTRA_RRECOMMENDS += "${WIRELESS_MODULE}" IMAGE_BOOT_FILES:append:use-nxp-bsp = " \ imx93_m33_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin \ diff --git a/meta-digi-arm/conf/machine/ccmp13-dvk.conf b/meta-digi-arm/conf/machine/ccmp13-dvk.conf index 957c25b07..a968f92dc 100644 --- a/meta-digi-arm/conf/machine/ccmp13-dvk.conf +++ b/meta-digi-arm/conf/machine/ccmp13-dvk.conf @@ -6,11 +6,13 @@ # Include the machine configuration for Digi's ConnectCore MP1. include conf/machine/include/ccmp1.inc +DIGI_SOM = "ccmp13" + # ========================================================================= # Chip architecture # ========================================================================= DEFAULTTUNE = "cortexa7thf-neon-vfpv4" -MACHINEOVERRIDES = "arm:armv7ve:stcommon:stm32mpcommon:stm32mp1common:${DIGI_FAMILY}:ccmp13:ccmp13-dvk" +MACHINEOVERRIDES = "arm:armv7ve:stcommon:stm32mpcommon:stm32mp1common:${DIGI_FAMILY}:${DIGI_SOM}:ccmp13-dvk" # ========================================================================= # boot device @@ -41,6 +43,7 @@ STM32MP_KERNEL_DEVICETREE:ccmp13-dvk += " \ _ov_board_mikroe-i2c-to-spi-click_ccmp13-dvk.dtbo \ _ov_board_pwm8_ccmp13-dvk.dtbo \ _ov_som_bt_ccmp13.dtbo \ + _ov_som_bt_test_ccmp13.dtbo \ _ov_som_wifi_ccmp13.dtbo \ " @@ -144,29 +147,9 @@ XBEE_TTY ?= "ttySTM2" # ========================================================================= ALSA_LIST = "" -# ========================================================================= -# DISTRO features -# ========================================================================= -DISTRO_FEATURES:remove = " opengl " -DISTRO_FEATURES:remove = " x11 " - -# add support of optee -DISTRO_FEATURES:append = " optee " - -# add support of splashscreen -#DISTRO_FEATURES:append = " splashscreen " - -# add support of systemd -DISTRO_FEATURES:append = " systemd " - -# add support of efi -DISTRO_FEATURES:append = " efi " - -# add support of InitRD installation package -DISTRO_FEATURES:append = " initrd " - -# add support to pulseaudio -DISTRO_FEATURES:append = "pulseaudio" +# Per-machine DISTRO_FEATURES customization +MACHINE_DISTRO_FEATURES_ADD = "efi optee" +MACHINE_DISTRO_FEATURES_REMOVE = "gstreamer opengl vulkan wayland x11" # Disable use of vendorfs partition ST_VENDORFS = "0" @@ -176,3 +159,7 @@ BOOTABLE_ARTIFACTS = " \ arm-trusted-firmware/tf-a-ccmp13-dvk-nand.stm32 \ fip/fip-ccmp13-dvk-optee.bin \ " + +# TRUSTFENCE basic support +# Alternatively, uncommment to enable the console with the specified GPIO +# TRUSTFENCE_CONSOLE_GPIO_ENABLE_NAME ?= "GPIOB6" diff --git a/meta-digi-arm/conf/machine/ccmp15-dvk.conf b/meta-digi-arm/conf/machine/ccmp15-dvk.conf index 6b41a8368..145c857a3 100644 --- a/meta-digi-arm/conf/machine/ccmp15-dvk.conf +++ b/meta-digi-arm/conf/machine/ccmp15-dvk.conf @@ -6,11 +6,13 @@ # Include the machine configuration for Digi's ConnectCore MP1. include conf/machine/include/ccmp1.inc +DIGI_SOM = "ccmp15" + # ========================================================================= # Chip architecture # ========================================================================= DEFAULTTUNE = "cortexa7thf-neon-vfpv4" -MACHINEOVERRIDES = "arm:armv7ve:stcommon:stm32mpcommon:stm32mp1common:${DIGI_FAMILY}:ccmp15:ccmp15-dvk" +MACHINEOVERRIDES = "arm:armv7ve:stcommon:stm32mpcommon:stm32mp1common:${DIGI_FAMILY}:${DIGI_SOM}:ccmp15-dvk" # ========================================================================= # boot device @@ -47,6 +49,7 @@ STM32MP_KERNEL_DEVICETREE:ccmp15-dvk += " \ _ov_board_mikroe-i2c-to-spi-click_ccmp15-dvk.dtbo \ _ov_board_v1_ccmp15-dvk.dtbo \ _ov_som_bt_ccmp15.dtbo \ + _ov_som_bt_test_ccmp15.dtbo \ _ov_som_wifi_ccmp15.dtbo \ " @@ -148,36 +151,9 @@ XBEE_TTY ?= "ttySTM2" # ========================================================================= ALSA_LIST = "" -# ========================================================================= -# DISTRO features -# ========================================================================= -DISTRO_FEATURES:append = " opengl" -DISTRO_FEATURES:remove = " x11 " -DISTRO_FEATURES:append = " gplv3 " - -# add support of gstreamer -DISTRO_FEATURES:append = " gstreamer " - -# add support of optee -DISTRO_FEATURES:append = " optee " - -# add support of splashscreen -DISTRO_FEATURES:append = " splashscreen " - -# add support of wayland -DISTRO_FEATURES:append = " wayland pam " - -# add support of systemd -DISTRO_FEATURES:append = " systemd " - -# add support of efi -DISTRO_FEATURES:append = " efi " - -# add support of InitRD installation package -DISTRO_FEATURES:append = " initrd " - -# add support to pulseaudio -DISTRO_FEATURES:append = "pulseaudio" +# Per-machine DISTRO_FEATURES customization +MACHINE_DISTRO_FEATURES_ADD = "efi optee" +MACHINE_DISTRO_FEATURES_REMOVE = "vulkan x11" # Disable use of vendorfs partition ST_VENDORFS = "0" @@ -188,12 +164,6 @@ BOOTABLE_ARTIFACTS = " \ fip/fip-ccmp15-dvk-optee.bin \ " -# SWUpdate sw-description configuration -BOOTFS_EXT ?= ".boot.ubifs" -ROOTFS_EXT ?= ".ubifs" - -BOOT_DEV_NAME ?= "linux" -ROOTFS_DEV_NAME ?= "rootfs" -ROOTFS_ENC_DEV = "${ROOTFS_DEV_NAME}" -ROOTFS_DEV_NAME_FINAL = "${@oe.utils.ifelse(d.getVar('TRUSTFENCE_ENCRYPT_ROOTFS') == '1', '${ROOTFS_ENC_DEV}', '${ROOTFS_DEV_NAME}')}" - +# TRUSTFENCE basic support +# Alternatively, uncommment to enable the console with the specified GPIO +# TRUSTFENCE_CONSOLE_GPIO_ENABLE_NAME ?= "GPIOA5" diff --git a/meta-digi-arm/conf/machine/include/ccimx6.inc b/meta-digi-arm/conf/machine/include/ccimx6.inc index 23f07ccb0..403b38dd0 100644 --- a/meta-digi-arm/conf/machine/include/ccimx6.inc +++ b/meta-digi-arm/conf/machine/include/ccimx6.inc @@ -3,7 +3,7 @@ #@DESCRIPTION: Machine configuration for Digi's ConnectCore 6 module. DIGI_FAMILY = "ccimx6" -MACHINEOVERRIDES =. "mx6:mx6dl:mx6q:${DIGI_FAMILY}:" +MACHINEOVERRIDES =. "mx6:mx6dl:mx6q:${DIGI_FAMILY}:${DIGI_SOM}:" include conf/machine/include/imx-digi-base.inc include conf/machine/include/arm/armv7a/tune-cortexa9.inc @@ -33,9 +33,8 @@ MACHINE_FEATURES += "accel-graphics wifi bluetooth pci" # TrustFence TRUSTFENCE_SIGN_MODE = "HAB" -# Adding 'wayland' along with 'x11' enables the xwayland backend -# Adding pam is required for SELinux functionality -DISTRO_FEATURES:append = " wayland pam" +# Per-machine DISTRO_FEATURES customization +MACHINE_DISTRO_FEATURES_REMOVE = "vulkan" # SWUpdate sw-description configuration BOOTFS_EXT ?= ".boot.vfat" diff --git a/meta-digi-arm/conf/machine/include/ccimx6ul.inc b/meta-digi-arm/conf/machine/include/ccimx6ul.inc index d3d18ed42..1065b5fb7 100644 --- a/meta-digi-arm/conf/machine/include/ccimx6ul.inc +++ b/meta-digi-arm/conf/machine/include/ccimx6ul.inc @@ -2,8 +2,9 @@ #@NAME: ConnectCore for i.MX6UL. #@DESCRIPTION: Machine configuration for Digi's ConnectCore 6UL. +DIGI_SOM = "ccimx6ul" DIGI_FAMILY = "ccimx6ul" -MACHINEOVERRIDES =. "mx6:mx6ul:${DIGI_FAMILY}:" +MACHINEOVERRIDES =. "mx6:mx6ul:${DIGI_FAMILY}:${DIGI_SOM}:" include conf/machine/include/imx-digi-base.inc include conf/machine/include/arm/armv7a/tune-cortexa7.inc @@ -47,6 +48,9 @@ MKUBIFS_ARGS ?= "-m 2048 -e 126976 -c 8191" # TrustFence TRUSTFENCE_SIGN_MODE = "HAB" +# Per-machine DISTRO_FEATURES customization +MACHINE_DISTRO_FEATURES_REMOVE = "vulkan wayland" + # SWUpdate sw-description configuration BOOTFS_EXT ?= ".boot.ubifs" ROOTFS_EXT ?= '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", ".squashfs", ".ubifs", d)}' diff --git a/meta-digi-arm/conf/machine/include/ccimx8m.inc b/meta-digi-arm/conf/machine/include/ccimx8m.inc index 5d7b62240..99bc0fd59 100644 --- a/meta-digi-arm/conf/machine/include/ccimx8m.inc +++ b/meta-digi-arm/conf/machine/include/ccimx8m.inc @@ -5,6 +5,8 @@ include conf/machine/include/imx-digi-base.inc require conf/machine/include/arm/armv8a/tune-cortexa53.inc +DIGI_FAMILY = "ccimx8m" + # Platform u-boot settings UBOOT_PREFIX = "imx-boot" UBOOT_SUFFIX = "bin" @@ -52,10 +54,6 @@ MACHINE_FEATURES += "accel-graphics wifi bluetooth cryptochip mca optee" # TrustFence TRUSTFENCE_SIGN_MODE = "HAB" -# Adding 'wayland' along with 'x11' enables the xwayland backend -# Vulkan is necessary for wayland to build -DISTRO_FEATURES:append = " wayland vulkan systemd pam" - # SWUpdate sw-description configuration BOOTFS_EXT ?= ".boot.vfat" ROOTFS_EXT ?= ".ext4.gz" diff --git a/meta-digi-arm/conf/machine/include/ccimx8x.inc b/meta-digi-arm/conf/machine/include/ccimx8x.inc index 4a18f5d11..58f80e01d 100644 --- a/meta-digi-arm/conf/machine/include/ccimx8x.inc +++ b/meta-digi-arm/conf/machine/include/ccimx8x.inc @@ -2,8 +2,9 @@ #@NAME: ConnectCore 8X module. #@DESCRIPTION: Machine configuration for Digi's ConnectCore 8X module. +DIGI_SOM = "ccimx8x" DIGI_FAMILY = "ccimx8x" -MACHINEOVERRIDES =. "mx8:mx8x:mx8qxp:${DIGI_FAMILY}:" +MACHINEOVERRIDES =. "mx8:mx8x:mx8qxp:${DIGI_FAMILY}:${DIGI_SOM}:" include conf/machine/include/imx-digi-base.inc include conf/machine/include/arm/armv8a/tune-cortexa35.inc @@ -69,10 +70,6 @@ MACHINE_FEATURES += "accel-graphics wifi bluetooth cryptochip pci mca" # TrustFence TRUSTFENCE_SIGN_MODE = "AHAB" -# Adding 'wayland' along with 'x11' enables the xwayland backend -# Vulkan is necessary for wayland to build -DISTRO_FEATURES:append = " wayland vulkan systemd pam" - # SWUpdate sw-description configuration BOOTFS_EXT ?= ".boot.vfat" ROOTFS_EXT ?= ".ext4.gz" diff --git a/meta-digi-arm/conf/machine/include/ccimx93.inc b/meta-digi-arm/conf/machine/include/ccimx93.inc index 55243d83a..25e8a2568 100644 --- a/meta-digi-arm/conf/machine/include/ccimx93.inc +++ b/meta-digi-arm/conf/machine/include/ccimx93.inc @@ -3,8 +3,6 @@ #@DESCRIPTION: Machine configuration for Digi's ConnectCore 93 family of SOMs DIGI_FAMILY = "ccimx93" -MACHINEOVERRIDES =. "${DIGI_FAMILY}:" -MACHINEOVERRIDES =. "mx93:" require conf/machine/include/imx-digi-base.inc require conf/machine/include/arm/armv8-2a/tune-cortexa55.inc @@ -30,6 +28,7 @@ MACHINE_FEATURES += "pci wifi bluetooth" MACHINE_FEATURES:append:use-nxp-bsp = " optee jailhouse" STORAGE_MEDIA = "mmc" +WLAN_P2P_INTERFACE = "wfd0" # Linux kernel configuration KERNEL_DEFCONFIG ?= "arch/arm64/configs/ccimx93_defconfig" @@ -62,8 +61,8 @@ BT_TTY ?= "ttyLP0" # Add additional firmware MACHINE_FIRMWARE:append = " ethos-u-firmware" -# Adding 'wayland' along with 'x11' enables the xwayland backend -DISTRO_FEATURES:append = " wayland pam" +# Per-machine DISTRO_FEATURES customization +MACHINE_DISTRO_FEATURES_REMOVE = "vulkan" # SWUpdate sw-description configuration BOOTFS_EXT ?= ".boot.vfat" diff --git a/meta-digi-arm/conf/machine/include/ccmp1.inc b/meta-digi-arm/conf/machine/include/ccmp1.inc index 49c5f4c1b..7a96ef851 100644 --- a/meta-digi-arm/conf/machine/include/ccmp1.inc +++ b/meta-digi-arm/conf/machine/include/ccmp1.inc @@ -17,7 +17,7 @@ FIP_UBOOT_DTB = "u-boot" STORAGE_MEDIA = "mtd" # Enable STM specific features -DEY_BUILD_PLATFORM = "STM" +DEY_SOC_VENDOR = "STM" # SWUpdate sw-description configuration BOOTFS_EXT ?= ".boot.ubifs" @@ -42,11 +42,14 @@ MACHINE_EXTRA_RDEPENDS += " \ mtd-utils-ubifs \ " -# Extra udev rules -MACHINE_EXTRA_RRECOMMENDS += "udev-extraconf" - # Image FS types IMAGE_FSTYPES:remove = "ext4 tar.xz" # List of supported boot devices BOOTDEVICE_LABELS ?= "sdcard" + +# Default secure console configuration +TRUSTFENCE_CONSOLE_DISABLE ?= "0" + +# Alternatively, uncommment to enable the console autoboot stop passphrase +# TRUSTFENCE_CONSOLE_PASSPHRASE_ENABLE = "" diff --git a/meta-digi-arm/conf/machine/include/digi-defaults.inc b/meta-digi-arm/conf/machine/include/digi-defaults.inc index d27c3dcfb..af46097ae 100644 --- a/meta-digi-arm/conf/machine/include/digi-defaults.inc +++ b/meta-digi-arm/conf/machine/include/digi-defaults.inc @@ -50,8 +50,8 @@ WLAN1_STATIC_NETMASK ?= "255.255.255.0" P2P0_STATIC_IP ?= "192.168.45.30" P2P0_STATIC_NETMASK ?= "255.255.255.0" WLAN_P2P_INTERFACE ?= "p2p0" -WLAN_P2P_DEVICE_NAME ??= "${DIGI_FAMILY}-p2p" -BT_DEVICE_NAME ??= "${DIGI_FAMILY}" +WLAN_P2P_DEVICE_NAME ??= "${DIGI_SOM}-p2p" +BT_DEVICE_NAME ??= "${DIGI_SOM}" # Digi BSP default settings IMAGE_CLASSES = "image_types_digi" @@ -59,19 +59,21 @@ IMAGE_CLASSES = "image_types_digi" # Do not enable console on VT (see sysvinit-inittab recipe) USE_VT ?= "0" -# Add the machine variant to the valid machine override -MACHINE_VARIANT ?= "" -MACHINEOVERRIDES .= "${@['', ':${MACHINE_VARIANT}']['${MACHINE_VARIANT}' != '']}" - # Extra RDEPENDS +OPTEE_PKGS ??= "" MACHINE_EXTRA_RDEPENDS += " \ ${@bb.utils.contains("MACHINE_FEATURES", "mca", "mca-tool", "", d)} \ + ${@bb.utils.contains('MACHINE_FEATURES', 'optee', '${OPTEE_PKGS}', '', d)} \ " # Extra RRECOMMENDS MACHINE_EXTRA_RRECOMMENDS += " \ ${@bb.utils.contains("MACHINE_FEATURES", "cryptochip", "cryptoauthlib", "", d)} \ " +# Extra rules when device manager is systemd or udev +UDEV_EXTRA_RULES = "udev-extraconf" +MACHINE_EXTRA_RRECOMMENDS += "${@bb.utils.contains_any('VIRTUAL-RUNTIME_dev_manager', 'systemd udev', '${UDEV_EXTRA_RULES}', '', d)}" + # Default image name (for install scripts) DEFAULT_IMAGE_NAME ??= "dey-image-qt" @@ -87,3 +89,6 @@ BOOT_SCRIPTS += "boot.scr:boot.scr altboot.scr:altboot.scr" # This can be used to enable U-Boot update through swupdate SWUPDATE_UBOOTIMG ?= "false" + +# Cloud Connector package to install +CLOUDCONNECTOR_PKG ?= "cloudconnector" diff --git a/meta-digi-arm/conf/machine/include/imx-digi-base.inc b/meta-digi-arm/conf/machine/include/imx-digi-base.inc index 19deabe9d..6c7ef4461 100644 --- a/meta-digi-arm/conf/machine/include/imx-digi-base.inc +++ b/meta-digi-arm/conf/machine/include/imx-digi-base.inc @@ -208,9 +208,6 @@ IMX_ALSA_EXTRA:imx-nxp-bsp = "imx-alsa-plugins" MACHINE_EXTRA_RRECOMMENDS:append:mx6-nxp-bsp = " ${@bb.utils.contains('DISTRO_FEATURES', 'alsa', '${IMX_ALSA_EXTRA}', '', d)}" MACHINE_EXTRA_RRECOMMENDS:append:mx8-nxp-bsp = " ${@bb.utils.contains('DISTRO_FEATURES', 'alsa', '${IMX_ALSA_EXTRA}', '', d)}" -# Extra udev rules -MACHINE_EXTRA_RRECOMMENDS += "udev-extraconf udev-rules-imx" - # GStreamer 1.0 plugins MACHINE_GSTREAMER_1_0_PLUGIN ?= "" MACHINE_GSTREAMER_1_0_PLUGIN:mx6dl-nxp-bsp ?= "imx-gst1.0-plugin" @@ -281,6 +278,9 @@ PREFERRED_VERSION_optee-client:mx9-nxp-bsp ??= "3.19.0.imx" PREFERRED_VERSION_optee-test:mx8-nxp-bsp ??= "3.19.0.imx" PREFERRED_VERSION_optee-test:mx9-nxp-bsp ??= "3.19.0.imx" +# Optee runtime packages to install +OPTEE_PKGS ??= "optee-client optee-os" + # Use i.MX opencv Version PREFERRED_VERSION_opencv:mx8-nxp-bsp ??= "4.6.0.imx" PREFERRED_VERSION_opencv:mx9-nxp-bsp ??= "4.6.0.imx" @@ -292,11 +292,11 @@ KERNEL_IMAGETYPE:aarch64 = "Image.gz" MACHINE_FEATURES = "usbgadget usbhost vfat alsa touchscreen" -# Add a generic gstreamer distro feature for all IMX platforms -DISTRO_FEATURES:append = " gstreamer" +# IMX specific udev extra rules added when device manager is systemd/udev +UDEV_EXTRA_RULES:append = " udev-rules-imx" # U-Boot 2017.X requires a specific dtc version. PREFERRED_VERSION_dtc-native:ccimx6 ?= "1.4.5" PREFERRED_VERSION_nativesdk-dtc:ccimx6 ?= "1.4.5" -DEY_BUILD_PLATFORM = "NXP" +DEY_SOC_VENDOR = "NXP" diff --git a/meta-digi-arm/dynamic-layers/freescale-layer/recipes-bsp/firmware-imx/firmware-nxp-wifi_%.bbappend b/meta-digi-arm/dynamic-layers/freescale-layer/recipes-bsp/firmware-imx/firmware-nxp-wifi_%.bbappend new file mode 100644 index 000000000..90c602bf2 --- /dev/null +++ b/meta-digi-arm/dynamic-layers/freescale-layer/recipes-bsp/firmware-imx/firmware-nxp-wifi_%.bbappend @@ -0,0 +1,16 @@ +# Copyright (C) 2023 Digi International. + +LIC_FILES_CHKSUM:ccimx93 = "file://EULA.txt;md5=add2d392714d3096ed7e0f7e2190724b" + +SRCBRANCH:ccimx93 = "lf-6.1.1_1.0.0" +SRCREV:ccimx93 = "bacbeb4789c1b13d13aab12ada29217ce8c3e905" + +do_install:append:ccimx93() { + install -m 444 ${S}/nxp/FwImage_IW612_SD/sduart_nw61x_v1.bin.se ${D}${base_libdir}/firmware/nxp +} + +PACKAGES:prepend:ccimx93 = "${PN}-nxpiw612 " + +FILES:${PN}-nxpiw612 = " \ + ${base_libdir}/firmware/nxp/sduart_nw61x_v1.bin.se \ +" diff --git a/meta-digi-arm/recipes-bsp/libedgetpu/libedgetpu_13.0.bb b/meta-digi-arm/dynamic-layers/freescale-layer/recipes-bsp/libedgetpu/libedgetpu_13.0.bb similarity index 100% rename from meta-digi-arm/recipes-bsp/libedgetpu/libedgetpu_13.0.bb rename to meta-digi-arm/dynamic-layers/freescale-layer/recipes-bsp/libedgetpu/libedgetpu_13.0.bb diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-bsp/trusted-firmware-a/tf-a-stm32mp_%.bbappend b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-bsp/trusted-firmware-a/tf-a-stm32mp_%.bbappend index 3c96008f2..a61ec3710 100644 --- a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-bsp/trusted-firmware-a/tf-a-stm32mp_%.bbappend +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-bsp/trusted-firmware-a/tf-a-stm32mp_%.bbappend @@ -15,3 +15,57 @@ SRC_URI = " \ " TF_A_CONFIG[nand] = "${DEVICE_BOARD_ENABLE:NAND},STM32MP_RAW_NAND=1 ${@'STM32MP_FORCE_MTD_START_OFFSET=${TF_A_MTD_START_OFFSET_NAND}' if ${TF_A_MTD_START_OFFSET_NAND} else ''} STM32MP_USB_PROGRAMMER=1" + +DEPENDS += " \ + ${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', 'trustfence-sign-tools-native trustfence-genpki-native', '', d)} \ +" + +# This dependency is required so that the PKI generation completes before +# proceeding with set_fip_sign_key() where we extract the password that +# is later used on the do_deploy of the fip-utils-stm32mp.bbclass. +do_install[depends] = " \ + trustfence-sign-tools-native:do_populate_sysroot \ + openssl-native:do_populate_sysroot \ +" + +# Obtain password to use in FIP generation +# Get password from file using the given key index +do_deploy[prefuncs] += "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', 'set_fip_sign_key', '', d)}" +python set_fip_sign_key() { + passfile = d.getVar('TRUSTFENCE_PASSWORD_FILE') + if (os.path.isfile(passfile)): + with open(passfile, "r") as file: + p = file.read().split() + i = int(d.getVar('TRUSTFENCE_KEY_INDEX')) + if (i > 7): + i = 0 + if (p): + d.setVar('FIP_SIGN_KEY_PASS', p[i]) +} + +# Sign TF-A image +do_deploy[postfuncs] += "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', 'tfa_sign', '', d)}" +tfa_sign() { + export CONFIG_SIGN_KEYS_PATH="${TRUSTFENCE_SIGN_KEYS_PATH}" + export CONFIG_KEY_INDEX="${TRUSTFENCE_KEY_INDEX}" + + unset i + for config in ${TF_A_CONFIG}; do + i=$(expr $i + 1) + # Initialize devicetree list and tf-a basename + dt_config=$(echo ${TF_A_DEVICETREE} | cut -d',' -f${i}) + tfa_basename=$(echo ${TF_A_BINARIES} | cut -d',' -f${i}) + tfa_file_type=$(echo ${TF_A_FILES} | cut -d',' -f${i}) + for dt in ${dt_config}; do + for file_type in ${tfa_file_type}; do + case "${file_type}" in + bl2) + TF_A_FILENAME="${tfa_basename}-${dt}-${config}.${TF_A_SUFFIX}" + if [ -f "${DEPLOYDIR}/arm-trusted-firmware/${TF_A_FILENAME}" ]; then + trustfence-sign-artifact.sh -p "${DIGI_SOM}" -t "${DEPLOYDIR}/arm-trusted-firmware/${TF_A_FILENAME}" "${DEPLOYDIR}/arm-trusted-firmware/${TF_A_FILENAME}_signed" + fi + esac + done # for file_type in ${tfa_file_type} + done # for dt in ${dt_config} + done # for config in ${TF_A_CONFIG} +} diff --git a/meta-digi-arm/recipes-bsp/digi-sc-firmware/digi-sc-firmware_1.11.0.bb b/meta-digi-arm/recipes-bsp/digi-sc-firmware/digi-sc-firmware_1.11.0.bb index 64875ed1d..ed6649a55 100644 --- a/meta-digi-arm/recipes-bsp/digi-sc-firmware/digi-sc-firmware_1.11.0.bb +++ b/meta-digi-arm/recipes-bsp/digi-sc-firmware/digi-sc-firmware_1.11.0.bb @@ -16,7 +16,7 @@ SRC_URI[sha256sum] = "36a02b956c288dad6ce6ecb2b13a4e6fb2983fd5c39cab5028ae9a7daf S = "${WORKDIR}/${PN}-${PV}" -SC_FIRMWARE_NAME ?= "mx8x-${DIGI_FAMILY}-scfw-tcm.bin" +SC_FIRMWARE_NAME ?= "mx8x-${DIGI_SOM}-scfw-tcm.bin" symlink_name = "scfw_tcm.bin" SYSROOT_DIRS += "/boot" diff --git a/meta-digi-arm/recipes-bsp/tensorflow-lite/tensorflow-lite-coral_2.5.0.bb b/meta-digi-arm/recipes-bsp/tensorflow-lite/tensorflow-lite-coral_2.5.0.bb index a5ac81dfc..0b3cfcc80 100644 --- a/meta-digi-arm/recipes-bsp/tensorflow-lite/tensorflow-lite-coral_2.5.0.bb +++ b/meta-digi-arm/recipes-bsp/tensorflow-lite/tensorflow-lite-coral_2.5.0.bb @@ -5,7 +5,7 @@ HOMEPAGE = "https://www.tensorflow.org/lite/" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://${S}/tflite_runtime-2.5.0.dist-info/METADATA;md5=8c4b9e107a64b0121980a8705094014b" -PYTHON_PACKAGE = "tflite_runtime-2.5.0-cp38-cp38-linux:aarch64.whl" +PYTHON_PACKAGE = "tflite_runtime-2.5.0-cp38-cp38-linux_aarch64.whl" SRC_URI = "https://github.com/google-coral/pycoral/releases/download/v1.0.1/${PYTHON_PACKAGE};downloadfilename=${PYTHON_PACKAGE};subdir=${BP}" SRC_URI[md5sum] = "9c47617e1fa0bdca673a78b8b6688d64" diff --git a/meta-digi-arm/recipes-bsp/trustfence-stm-signtools/nativesdk-trustfence-stm-signtools_1.0.bb b/meta-digi-arm/recipes-bsp/trustfence-stm-signtools/nativesdk-trustfence-stm-signtools_1.0.bb new file mode 100644 index 000000000..f4614cc4e --- /dev/null +++ b/meta-digi-arm/recipes-bsp/trustfence-stm-signtools/nativesdk-trustfence-stm-signtools_1.0.bb @@ -0,0 +1,9 @@ +# Copyright (C) 2023 Digi International. + +require trustfence-stm-signtools.inc +inherit nativesdk + +# STM signing tools binaries depend on libQt5Core.so.5 +RDEPENDS:${PN} += " \ + nativesdk-qtbase \ +" diff --git a/meta-digi-arm/recipes-bsp/trustfence-stm-signtools/trustfence-stm-signtools-native_1.0.bb b/meta-digi-arm/recipes-bsp/trustfence-stm-signtools/trustfence-stm-signtools-native_1.0.bb new file mode 100644 index 000000000..dace38ef7 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/trustfence-stm-signtools/trustfence-stm-signtools-native_1.0.bb @@ -0,0 +1,4 @@ +# Copyright (C) 2023 Digi International. + +require trustfence-stm-signtools.inc +inherit native diff --git a/meta-digi-arm/recipes-bsp/trustfence-stm-signtools/trustfence-stm-signtools.inc b/meta-digi-arm/recipes-bsp/trustfence-stm-signtools/trustfence-stm-signtools.inc new file mode 100644 index 000000000..2c8e9d882 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/trustfence-stm-signtools/trustfence-stm-signtools.inc @@ -0,0 +1,27 @@ +# Copyright (C) 2023 Digi International. + +SUMMARY = "STM key generation and signing tools" +SECTION = "console/tools" +LICENSE = "Proprietary" + +LIC_FILES_CHKSUM = "file://en.SLA0048.txt;md5=108361d167deef887d204830aba9cf94" + +PKGNAME = "trustfence-stm-signtools" + +# tarball +SRC_URI = "${DIGI_PKG_SRC}/${PKGNAME}-${PV}.tar.gz" +SRC_URI[md5sum] = "5621d99156b75e69eecbae721475463b" +SRC_URI[sha256sum] = "5c04b16934aa316d2586980f93680e90af1968bcb9b76c18b9cecddbcf5d6a1b" + +S = "${WORKDIR}/${PKGNAME}-${PV}" + +inherit bin_package + +INSANE_SKIP:${PN} = "already-stripped" + +do_install() { + install -d ${D}${bindir} + install -m 0755 bin/* ${D}${bindir} + install -d ${D}${base_libdir} + install -m 0644 lib/* ${D}${base_libdir} +} diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey.inc b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey.inc index 45763922b..6970a6a3a 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey.inc +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey.inc @@ -1,4 +1,4 @@ -# Copyright (C) 2018-2022 Digi International +# Copyright (C) 2018-2023 Digi International require recipes-bsp/u-boot/u-boot.inc @@ -38,7 +38,7 @@ BUILD_UBOOT_SCRIPTS ?= "true" BOOTLOADER_IMAGE_RECIPE ?= "u-boot" LOCALVERSION ?= "" -inherit ${@oe.utils.conditional('DEY_BUILD_PLATFORM', 'NXP', 'fsl-u-boot-localversion', '', d)} +inherit ${@oe.utils.conditional('DEY_SOC_VENDOR', 'NXP', 'fsl-u-boot-localversion', '', d)} # Disable u-boot environment artifacts UBOOT_INITIAL_ENV = "" @@ -63,6 +63,16 @@ def tf_bootscript_sedfilter(d): tf_initramfs = d.getVar('TRUSTFENCE_INITRAMFS_IMAGE') or "" return "s,\(^[[:blank:]]*\)true.*,\\1setenv boot_initrd true\\n\\1setenv initrd_file %s-${MACHINE}.cpio.gz.u-boot.tf,g" % tf_initramfs if tf_initramfs else "" +SIGN_UBOOT ?= "" +SIGN_UBOOT:ccimx6 = "sign_uboot" +SIGN_UBOOT:ccimx6ul = "sign_uboot" + +do_deploy[postfuncs] += " \ + adapt_uboot_filenames \ + ${@oe.utils.ifelse('BUILD_UBOOT_SCRIPTS', 'build_uboot_scripts', '')} \ + ${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', '${SIGN_UBOOT}', '', d)} \ +" + build_uboot_scripts() { for f in $(echo ${INSTALL_FW_UBOOT_SCRIPTS} | sed -e 's,file\:\/\/,,g'); do f_ext="${f##*.}" @@ -89,25 +99,25 @@ build_uboot_scripts() { # Alternate boot script for dualboot mkimage -T script -n "Alternate bootscript" -C none -d ${WORKDIR}/altboot.txt ${DEPLOYDIR}/altboot.scr - # Sign the scripts - if [ "${TRUSTFENCE_SIGN}" = "1" ]; then + # Sign the scripts (TODO signing of artifacts for STM-based platforms) + if [ [ "${TRUSTFENCE_SIGN}" = "1" ] && [ "${DEY_SOC_VENDOR}" != "STM" ] ]; then export CONFIG_SIGN_KEYS_PATH="${TRUSTFENCE_SIGN_KEYS_PATH}" [ -n "${TRUSTFENCE_KEY_INDEX}" ] && export CONFIG_KEY_INDEX="${TRUSTFENCE_KEY_INDEX}" [ -n "${TRUSTFENCE_DEK_PATH}" ] && [ "${TRUSTFENCE_DEK_PATH}" != "0" ] && export CONFIG_DEK_PATH="${TRUSTFENCE_DEK_PATH}" # Sign boot script TMP_SIGNED_BOOTSCR="$(mktemp ${WORKDIR}/bootscr-signed.XXXXXX)" - trustfence-sign-artifact.sh -p "${DIGI_FAMILY}" -b "${DEPLOYDIR}/boot.scr" "${TMP_SIGNED_BOOTSCR}" + trustfence-sign-artifact.sh -p "${DIGI_SOM}" -b "${DEPLOYDIR}/boot.scr" "${TMP_SIGNED_BOOTSCR}" mv "${TMP_SIGNED_BOOTSCR}" "${DEPLOYDIR}/boot.scr" # Sign altboot script TMP_SIGNED_BOOTSCR="$(mktemp ${WORKDIR}/altboot-signed.XXXXXX)" - trustfence-sign-artifact.sh -p "${DIGI_FAMILY}" -b "${DEPLOYDIR}/altboot.scr" "${TMP_SIGNED_BOOTSCR}" + trustfence-sign-artifact.sh -p "${DIGI_SOM}" -b "${DEPLOYDIR}/altboot.scr" "${TMP_SIGNED_BOOTSCR}" mv "${TMP_SIGNED_BOOTSCR}" "${DEPLOYDIR}/altboot.scr" fi } -do_deploy:append() { +adapt_uboot_filenames() { # Remove canonical U-Boot symlinks for ${UBOOT_CONFIG} currently in the form: # u-boot-.- # u-boot- @@ -124,7 +134,26 @@ do_deploy:append() { cd ${DEPLOYDIR} rm -r ${UBOOT_BINARY}-${type} ln -sf ${UBOOT_BINARYNAME}-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX} - if [ "${TRUSTFENCE_SIGN}" = "1" ] && [ "${BOOTLOADER_IMAGE_RECIPE}" = "u-boot" ]; then + fi + done + unset j + done + unset i + fi +} + +sign_uboot() { + # This function only applies to CC6, CC6Plus and CC6UL + if [ -n "${UBOOT_CONFIG}" ] + 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 + cd ${DEPLOYDIR} + if [ "${BOOTLOADER_IMAGE_RECIPE}" = "u-boot" ]; then install ${B}/${config}/SRK_efuses.bin SRK_efuses-${PV}-${PR}.bin ln -sf SRK_efuses-${PV}-${PR}.bin SRK_efuses.bin @@ -146,10 +175,6 @@ do_deploy:append() { done unset i fi - - if [ "${BUILD_UBOOT_SCRIPTS}" = "true" ]; then - build_uboot_scripts - fi } BOOT_TOOLS = "imx-boot-tools" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/install_linux_fw_sd.txt index 18383bde5..3f953a5a7 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/install_linux_fw_sd.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/install_linux_fw_sd.txt @@ -79,9 +79,13 @@ echo " --------- --------" echo " bootloader ${INSTALL_UBOOT_FILENAME}" if test "${dualboot}" = "yes"; then echo " linux_a ${INSTALL_LINUX_FILENAME}" - echo " linux_b ${INSTALL_LINUX_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " linux_b ${INSTALL_LINUX_FILENAME}" + fi echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}" - echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + fi else echo " linux ${INSTALL_LINUX_FILENAME}" echo " recovery ${INSTALL_RECOVERY_FILENAME}" @@ -136,6 +140,7 @@ fi setenv bootcmd " env default -a; setenv dualboot ${dualboot}; + setenv install_dualboot ${install_dualboot}; saveenv; echo \"\"; echo \"\"; @@ -162,17 +167,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; - echo \"\"; - echo \"\"; - update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update linux_b!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; + echo \"\"; + echo \"\"; + update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update linux_b!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; echo \"\"; echo \"\"; @@ -186,17 +193,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; - echo \"\"; - echo \"\"; - update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update rootfs_b partition!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; + echo \"\"; + echo \"\"; + update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update rootfs_b partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; else echo \"\"; diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/install_linux_fw_usb.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/install_linux_fw_usb.txt index f826b27c5..1810e52f5 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/install_linux_fw_usb.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/install_linux_fw_usb.txt @@ -79,9 +79,13 @@ echo " --------- --------" echo " bootloader ${INSTALL_UBOOT_FILENAME}" if test "${dualboot}" = "yes"; then echo " linux_a ${INSTALL_LINUX_FILENAME}" - echo " linux_b ${INSTALL_LINUX_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " linux_b ${INSTALL_LINUX_FILENAME}" + fi echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}" - echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + fi else echo " linux ${INSTALL_LINUX_FILENAME}" echo " recovery ${INSTALL_RECOVERY_FILENAME}" @@ -137,6 +141,7 @@ fi setenv bootcmd " env default -a; setenv dualboot ${dualboot}; + setenv install_dualboot ${install_dualboot}; saveenv; echo \"\"; echo \"\"; @@ -164,17 +169,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; - echo \"\"; - echo \"\"; - update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update linux_b!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; + echo \"\"; + echo \"\"; + update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update linux_b!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; usb reset; echo \"\"; @@ -189,17 +196,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; - echo \"\"; - echo \"\"; - update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update rootfs_b partition!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; + echo \"\"; + echo \"\"; + update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update rootfs_b partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; else echo \"\"; diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/install_linux_fw_uuu.sh b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/install_linux_fw_uuu.sh index f743bfbf1..851d48f49 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/install_linux_fw_uuu.sh +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/install_linux_fw_uuu.sh @@ -1,7 +1,7 @@ #!/bin/sh #=============================================================================== # -# Copyright (C) 2021 by Digi International Inc. +# Copyright (C) 2021-2023 by Digi International Inc. # All rights reserved. # # This program is free software; you can redistribute it and/or modify it @@ -39,6 +39,7 @@ show_usage() echo " -n No wait. Skips 10 seconds delay to stop script." echo " -u U-Boot filename." echo " Auto-determined by variant if not provided." + echo " -d Install firmware on dualboot partitions (system A and system B)." exit 2 } @@ -69,9 +70,10 @@ echo "############################################################" # Command line admits the following parameters: # -u # -i -while getopts 'hi:nu:' c +while getopts 'dhi:nu:' c do case $c in + d) INSTALL_DUALBOOT=true ;; h) show_usage ;; i) IMAGE_NAME=${OPTARG} ;; n) NOWAIT=true ;; @@ -192,9 +194,13 @@ if [ "${NOWAIT}" != true ]; then printf " bootloader\t${INSTALL_UBOOT_FILENAME}\n" if [ "${DUALBOOT}" = true ]; then printf " ${LINUX_NAME}_a\t${INSTALL_LINUX_FILENAME}\n" - printf " ${LINUX_NAME}_b\t${INSTALL_LINUX_FILENAME}\n" + if [ "${INSTALL_DUALBOOT}" = true ]; then + printf " ${LINUX_NAME}_b\t${INSTALL_LINUX_FILENAME}\n" + fi printf " ${ROOTFS_NAME}_a\t${INSTALL_ROOTFS_FILENAME}\n" - printf " ${ROOTFS_NAME}_b\t${INSTALL_ROOTFS_FILENAME}\n" + if [ "${INSTALL_DUALBOOT}" = true ]; then + printf " ${ROOTFS_NAME}_b\t${INSTALL_ROOTFS_FILENAME}\n" + fi else printf " ${LINUX_NAME}\t${INSTALL_LINUX_FILENAME}\n" printf " ${RECOVERY_NAME}\t${INSTALL_RECOVERY_FILENAME}\n" @@ -270,11 +276,15 @@ if [ "${DUALBOOT}" = true ]; then # Update Linux A part_update "${LINUX_NAME}_a" "${INSTALL_LINUX_FILENAME}" # Update Linux B - part_update "${LINUX_NAME}_b" "${INSTALL_LINUX_FILENAME}" + if [ "${INSTALL_DUALBOOT}" = true ]; then + part_update "${LINUX_NAME}_b" "${INSTALL_LINUX_FILENAME}" + fi # Update Rootfs A part_update "${ROOTFS_NAME}_a" "${INSTALL_ROOTFS_FILENAME}" # Update Rootfs B - part_update "${ROOTFS_NAME}_b" "${INSTALL_ROOTFS_FILENAME}" + if [ "${INSTALL_DUALBOOT}" = true ]; then + part_update "${ROOTFS_NAME}_b" "${INSTALL_ROOTFS_FILENAME}" + fi else # Update Linux part_update "${LINUX_NAME}" "${INSTALL_LINUX_FILENAME}" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/install_linux_fw_sd.txt index 16ca00ab1..c0d368393 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/install_linux_fw_sd.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/install_linux_fw_sd.txt @@ -90,9 +90,13 @@ echo " --------- --------" echo " bootloader ${INSTALL_UBOOT_FILENAME}" if test "${dualboot}" = "yes"; then echo " linux_a ${INSTALL_LINUX_FILENAME}" - echo " linux_b ${INSTALL_LINUX_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " linux_b ${INSTALL_LINUX_FILENAME}" + fi echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}" - echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + fi else echo " linux ${INSTALL_LINUX_FILENAME}" echo " recovery ${INSTALL_RECOVERY_FILENAME}" @@ -147,6 +151,7 @@ fi setenv bootcmd " env default -a; setenv dualboot ${dualboot}; + setenv install_dualboot ${install_dualboot}; saveenv; echo \"\"; echo \"\"; @@ -173,17 +178,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; - echo \"\"; - echo \"\"; - update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update linux_b!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; + echo \"\"; + echo \"\"; + update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update linux_b!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; echo \"\"; echo \"\"; @@ -197,17 +204,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; - echo \"\"; - echo \"\"; - update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update rootfs_b partition!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; + echo \"\"; + echo \"\"; + update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update rootfs_b partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; else echo \"\"; diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/install_linux_fw_usb.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/install_linux_fw_usb.txt index b2e0d13ca..cf7de617b 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/install_linux_fw_usb.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/install_linux_fw_usb.txt @@ -90,9 +90,13 @@ echo " --------- --------" echo " bootloader ${INSTALL_UBOOT_FILENAME}" if test "${dualboot}" = "yes"; then echo " linux_a ${INSTALL_LINUX_FILENAME}" - echo " linux_b ${INSTALL_LINUX_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " linux_b ${INSTALL_LINUX_FILENAME}" + fi echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}" - echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + fi else echo " linux ${INSTALL_LINUX_FILENAME}" echo " recovery ${INSTALL_RECOVERY_FILENAME}" @@ -148,6 +152,7 @@ fi setenv bootcmd " env default -a; setenv dualboot ${dualboot}; + setenv install_dualboot ${install_dualboot}; saveenv; echo \"\"; echo \"\"; @@ -175,17 +180,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; - echo \"\"; - echo \"\"; - update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update linux_b!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; + echo \"\"; + echo \"\"; + update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update linux_b!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; usb reset; echo \"\"; @@ -200,17 +207,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; - echo \"\"; - echo \"\"; - update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update rootfs_b partition!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; + echo \"\"; + echo \"\"; + update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update rootfs_b partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; else echo \"\"; diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/install_linux_fw_uuu.sh b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/install_linux_fw_uuu.sh index 0ca7a02ef..104ae53c1 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/install_linux_fw_uuu.sh +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/install_linux_fw_uuu.sh @@ -1,7 +1,7 @@ #!/bin/sh #=============================================================================== # -# Copyright (C) 2021 by Digi International Inc. +# Copyright (C) 2021-2023 by Digi International Inc. # All rights reserved. # # This program is free software; you can redistribute it and/or modify it @@ -39,6 +39,7 @@ show_usage() echo " -n No wait. Skips 10 seconds delay to stop script." echo " -u U-Boot filename." echo " Auto-determined by variant if not provided." + echo " -d Install firmware on dualboot partitions (system A and system B)." exit 2 } @@ -69,9 +70,10 @@ echo "############################################################" # Command line admits the following parameters: # -u # -i -while getopts 'hi:nu:' c +while getopts 'dhi:nu:' c do case $c in + d) INSTALL_DUALBOOT=true ;; h) show_usage ;; i) IMAGE_NAME=${OPTARG} ;; n) NOWAIT=true ;; @@ -210,9 +212,13 @@ if [ "${NOWAIT}" != true ]; then printf " bootloader\t${INSTALL_UBOOT_FILENAME}\n" if [ "${DUALBOOT}" = true ]; then printf " ${LINUX_NAME}_a\t${INSTALL_LINUX_FILENAME}\n" - printf " ${LINUX_NAME}_b\t${INSTALL_LINUX_FILENAME}\n" + if [ "${INSTALL_DUALBOOT}" = true ]; then + printf " ${LINUX_NAME}_b\t${INSTALL_LINUX_FILENAME}\n" + fi printf " ${ROOTFS_NAME}_a\t${INSTALL_ROOTFS_FILENAME}\n" - printf " ${ROOTFS_NAME}_b\t${INSTALL_ROOTFS_FILENAME}\n" + if [ "${INSTALL_DUALBOOT}" = true ]; then + printf " ${ROOTFS_NAME}_b\t${INSTALL_ROOTFS_FILENAME}\n" + fi else printf " ${LINUX_NAME}\t${INSTALL_LINUX_FILENAME}\n" printf " ${RECOVERY_NAME}\t${INSTALL_RECOVERY_FILENAME}\n" @@ -288,11 +294,15 @@ if [ "${DUALBOOT}" = true ]; then # Update Linux A part_update "${LINUX_NAME}_a" "${INSTALL_LINUX_FILENAME}" # Update Linux B - part_update "${LINUX_NAME}_b" "${INSTALL_LINUX_FILENAME}" + if [ "${INSTALL_DUALBOOT}" = true ]; then + part_update "${LINUX_NAME}_b" "${INSTALL_LINUX_FILENAME}" + fi # Update Rootfs A part_update "${ROOTFS_NAME}_a" "${INSTALL_ROOTFS_FILENAME}" # Update Rootfs B - part_update "${ROOTFS_NAME}_b" "${INSTALL_ROOTFS_FILENAME}" + if [ "${INSTALL_DUALBOOT}" = true ]; then + part_update "${ROOTFS_NAME}_b" "${INSTALL_ROOTFS_FILENAME}" + fi else # Update Linux part_update "${LINUX_NAME}" "${INSTALL_LINUX_FILENAME}" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_sd.txt index 673d3af4d..785a67e96 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_sd.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_sd.txt @@ -83,9 +83,13 @@ echo " --------- --------" echo " bootloader ${INSTALL_UBOOT_FILENAME}" if test "${dualboot}" = "yes"; then echo " linux_a ${INSTALL_LINUX_FILENAME}" - echo " linux_b ${INSTALL_LINUX_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " linux_b ${INSTALL_LINUX_FILENAME}" + fi echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}" - echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + fi else echo " linux ${INSTALL_LINUX_FILENAME}" echo " recovery ${INSTALL_RECOVERY_FILENAME}" @@ -142,6 +146,7 @@ setenv bootcmd " env default -a; setenv singlemtdsys ${singlemtdsys}; setenv dualboot ${dualboot}; + setenv install_dualboot ${install_dualboot}; run partition_nand_linux; saveenv; if test \"\$\{singlemtdsys\}\" = yes; then @@ -162,17 +167,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; - echo \"\"; - echo \"\"; - update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME} ${force_erase}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update linux_b!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; + echo \"\"; + echo \"\"; + update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME} ${force_erase}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update linux_b!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; echo \"\"; echo \"\"; @@ -186,17 +193,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; - echo \"\"; - echo \"\"; - update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME} ${force_erase}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update rootfs_b partition!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; + echo \"\"; + echo \"\"; + update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME} ${force_erase}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update rootfs_b partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; else echo \"\"; diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_usb.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_usb.txt index b751ed48a..71195f38d 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_usb.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_usb.txt @@ -83,9 +83,13 @@ echo " --------- --------" echo " bootloader ${INSTALL_UBOOT_FILENAME}" if test "${dualboot}" = "yes"; then echo " linux_a ${INSTALL_LINUX_FILENAME}" - echo " linux_b ${INSTALL_LINUX_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " linux_b ${INSTALL_LINUX_FILENAME}" + fi echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}" - echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + fi else echo " linux ${INSTALL_LINUX_FILENAME}" echo " recovery ${INSTALL_RECOVERY_FILENAME}" @@ -142,6 +146,7 @@ setenv bootcmd " env default -a; setenv singlemtdsys ${singlemtdsys}; setenv dualboot ${dualboot}; + setenv install_dualboot ${install_dualboot}; run partition_nand_linux; saveenv; if test \"\$\{singlemtdsys\}\" = yes; then @@ -163,17 +168,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; - echo \"\"; - echo \"\"; - update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME} ${force_erase}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update linux_b!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; + echo \"\"; + echo \"\"; + update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME} ${force_erase}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update linux_b!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; echo \"\"; echo \"\"; @@ -187,17 +194,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; - echo \"\"; - echo \"\"; - update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME} ${force_erase}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update rootfs_b partition!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; + echo \"\"; + echo \"\"; + update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME} ${force_erase}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update rootfs_b partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; else echo \"\"; diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_uuu.sh b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_uuu.sh index 3ef6f114d..598dbf7f8 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_uuu.sh +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_uuu.sh @@ -1,7 +1,7 @@ #!/bin/sh #=============================================================================== # -# Copyright (C) 2020-2021 by Digi International Inc. +# Copyright (C) 2020-2023 by Digi International Inc. # All rights reserved. # # This program is free software; you can redistribute it and/or modify it @@ -39,6 +39,7 @@ show_usage() echo " -n No wait. Skips 10 seconds delay to stop script." echo " -u U-Boot filename." echo " Auto-determined by variant if not provided." + echo " -d Install firmware on dualboot partitions (system A and system B)." exit 2 } @@ -78,9 +79,10 @@ echo "############################################################" # Command line admits the following parameters: # -u # -i -while getopts 'hi:nu:' c +while getopts 'dhi:nu:' c do case $c in + d) INSTALL_DUALBOOT=true ;; h) show_usage ;; i) IMAGE_NAME=${OPTARG} ;; n) NOWAIT=true ;; @@ -199,9 +201,13 @@ if [ "${NOWAIT}" != true ]; then printf " bootloader\t${INSTALL_UBOOT_FILENAME}\n" if [ "${DUALBOOT}" = true ]; then printf " ${LINUX_NAME}_a\t${INSTALL_LINUX_FILENAME}\n" - printf " ${LINUX_NAME}_b\t${INSTALL_LINUX_FILENAME}\n" + if [ "${INSTALL_DUALBOOT}" = true ]; then + printf " ${LINUX_NAME}_b\t${INSTALL_LINUX_FILENAME}\n" + fi printf " ${ROOTFS_NAME}_a\t${INSTALL_ROOTFS_FILENAME}\n" - printf " ${ROOTFS_NAME}_b\t${INSTALL_ROOTFS_FILENAME}\n" + if [ "${INSTALL_DUALBOOT}" = true ]; then + printf " ${ROOTFS_NAME}_b\t${INSTALL_ROOTFS_FILENAME}\n" + fi else printf " ${LINUX_NAME}\t${INSTALL_LINUX_FILENAME}\n" printf " ${RECOVERY_NAME}\t${INSTALL_RECOVERY_FILENAME}\n" @@ -269,11 +275,15 @@ if [ "${DUALBOOT}" = true ]; then # Update Linux A part_update "${LINUX_NAME}_a" "${INSTALL_LINUX_FILENAME}" 15000 # Update Linux B - part_update "${LINUX_NAME}_b" "${INSTALL_LINUX_FILENAME}" 15000 + if [ "${INSTALL_DUALBOOT}" = true ]; then + part_update "${LINUX_NAME}_b" "${INSTALL_LINUX_FILENAME}" 15000 + fi # Update Rootfs A part_update "${ROOTFS_NAME}_a" "${INSTALL_ROOTFS_FILENAME}" 90000 # Update Rootfs B - part_update "${ROOTFS_NAME}_b" "${INSTALL_ROOTFS_FILENAME}" 90000 + if [ "${INSTALL_DUALBOOT}" = true ]; then + part_update "${ROOTFS_NAME}_b" "${INSTALL_ROOTFS_FILENAME}" 90000 + fi else # Update Linux part_update "${LINUX_NAME}" "${INSTALL_LINUX_FILENAME}" 15000 diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8m/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8m/install_linux_fw_sd.txt index e7deac14b..3a50597f0 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8m/install_linux_fw_sd.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8m/install_linux_fw_sd.txt @@ -50,9 +50,13 @@ echo " --------- --------" echo " bootloader ${INSTALL_UBOOT_FILENAME}" if test "${dualboot}" = "yes"; then echo " linux_a ${INSTALL_LINUX_FILENAME}" - echo " linux_b ${INSTALL_LINUX_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " linux_b ${INSTALL_LINUX_FILENAME}" + fi echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}" - echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + fi else echo " linux ${INSTALL_LINUX_FILENAME}" echo " recovery ${INSTALL_RECOVERY_FILENAME}" @@ -112,6 +116,7 @@ fi setenv bootcmd " env default -a; setenv dualboot ${dualboot}; + setenv install_dualboot ${install_dualboot}; saveenv; setenv otf-update yes; echo \"\"; @@ -139,17 +144,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; - echo \"\"; - echo \"\"; - update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update linux_b!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; + echo \"\"; + echo \"\"; + update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update linux_b!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; echo \"\"; echo \"\"; @@ -163,17 +170,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; - echo \"\"; - echo \"\"; - update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update rootfs_b partition!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; + echo \"\"; + echo \"\"; + update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update rootfs_b partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; else echo \"\"; diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8m/install_linux_fw_usb.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8m/install_linux_fw_usb.txt index 1eb95d3bf..e916de50e 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8m/install_linux_fw_usb.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8m/install_linux_fw_usb.txt @@ -50,9 +50,13 @@ echo " --------- --------" echo " bootloader ${INSTALL_UBOOT_FILENAME}" if test "${dualboot}" = "yes"; then echo " linux_a ${INSTALL_LINUX_FILENAME}" - echo " linux_b ${INSTALL_LINUX_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " linux_b ${INSTALL_LINUX_FILENAME}" + fi echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}" - echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + fi else echo " linux ${INSTALL_LINUX_FILENAME}" echo " recovery ${INSTALL_RECOVERY_FILENAME}" @@ -112,6 +116,7 @@ fi setenv bootcmd " env default -a; setenv dualboot ${dualboot}; + setenv install_dualboot ${install_dualboot}; saveenv; setenv otf-update yes; echo \"\"; @@ -140,17 +145,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; - echo \"\"; - echo \"\"; - update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update linux_b!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; + echo \"\"; + echo \"\"; + update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update linux_b!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; echo \"\"; echo \"\"; @@ -164,17 +171,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; - echo \"\"; - echo \"\"; - update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update rootfs_b partition!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; + echo \"\"; + echo \"\"; + update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update rootfs_b partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; else echo \"\"; diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8m/install_linux_fw_uuu.sh b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8m/install_linux_fw_uuu.sh index d580e5c02..f819e6aec 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8m/install_linux_fw_uuu.sh +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8m/install_linux_fw_uuu.sh @@ -1,7 +1,7 @@ #!/bin/sh #=============================================================================== # -# Copyright (C) 2020-2021 by Digi International Inc. +# Copyright (C) 2020-2023 by Digi International Inc. # All rights reserved. # # This program is free software; you can redistribute it and/or modify it @@ -39,6 +39,7 @@ show_usage() echo " -n No wait. Skips 10 seconds delay to stop script." echo " -u U-Boot filename." echo " Auto-determined by variant if not provided." + echo " -d Install firmware on dualboot partitions (system A and system B)." exit 2 } @@ -69,9 +70,10 @@ echo "############################################################" # Command line admits the following parameters: # -u # -i -while getopts 'hi:nu:' c +while getopts 'dhi:nu:' c do case $c in + d) INSTALL_DUALBOOT=true ;; h) show_usage ;; i) IMAGE_NAME=${OPTARG} ;; n) NOWAIT=true ;; @@ -158,9 +160,13 @@ if [ "${NOWAIT}" != true ]; then printf " bootloader\t${INSTALL_UBOOT_FILENAME}\n" if [ "${DUALBOOT}" = true ]; then printf " ${LINUX_NAME}_a\t${INSTALL_LINUX_FILENAME}\n" - printf " ${LINUX_NAME}_b\t${INSTALL_LINUX_FILENAME}\n" + if [ "${INSTALL_DUALBOOT}" = true ]; then + printf " ${LINUX_NAME}_b\t${INSTALL_LINUX_FILENAME}\n" + fi printf " ${ROOTFS_NAME}_a\t${INSTALL_ROOTFS_FILENAME}\n" - printf " ${ROOTFS_NAME}_b\t${INSTALL_ROOTFS_FILENAME}\n" + if [ "${INSTALL_DUALBOOT}" = true ]; then + printf " ${ROOTFS_NAME}_b\t${INSTALL_ROOTFS_FILENAME}\n" + fi else printf " ${LINUX_NAME}\t${INSTALL_LINUX_FILENAME}\n" printf " ${RECOVERY_NAME}\t${INSTALL_RECOVERY_FILENAME}\n" @@ -239,11 +245,15 @@ if [ "${DUALBOOT}" = true ]; then # Update Linux A part_update "${LINUX_NAME}_a" "${INSTALL_LINUX_FILENAME}" # Update Linux B - part_update "${LINUX_NAME}_b" "${INSTALL_LINUX_FILENAME}" + if [ "${INSTALL_DUALBOOT}" = true ]; then + part_update "${LINUX_NAME}_b" "${INSTALL_LINUX_FILENAME}" + fi # Update Rootfs A part_update "${ROOTFS_NAME}_a" "${INSTALL_ROOTFS_FILENAME}" # Update Rootfs B - part_update "${ROOTFS_NAME}_b" "${INSTALL_ROOTFS_FILENAME}" + if [ "${INSTALL_DUALBOOT}" = true ]; then + part_update "${ROOTFS_NAME}_b" "${INSTALL_ROOTFS_FILENAME}" + fi else # Update Linux part_update "${LINUX_NAME}" "${INSTALL_LINUX_FILENAME}" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x/install_linux_fw_sd.txt index 350449e06..d405e4ebb 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x/install_linux_fw_sd.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x/install_linux_fw_sd.txt @@ -121,9 +121,13 @@ echo " --------- --------" echo " bootloader ${INSTALL_UBOOT_FILENAME}" if test "${dualboot}" = "yes"; then echo " linux_a ${INSTALL_LINUX_FILENAME}" - echo " linux_b ${INSTALL_LINUX_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " linux_b ${INSTALL_LINUX_FILENAME}" + fi echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}" - echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + fi else echo " linux ${INSTALL_LINUX_FILENAME}" echo " recovery ${INSTALL_RECOVERY_FILENAME}" @@ -183,6 +187,7 @@ fi setenv bootcmd " env default -a; setenv dualboot ${dualboot}; + setenv install_dualboot ${install_dualboot}; saveenv; setenv otf-update yes; echo \"\"; @@ -210,17 +215,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; - echo \"\"; - echo \"\"; - update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update linux_b!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; + echo \"\"; + echo \"\"; + update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update linux_b!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; echo \"\"; echo \"\"; @@ -234,17 +241,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; - echo \"\"; - echo \"\"; - update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update rootfs_b partition!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; + echo \"\"; + echo \"\"; + update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update rootfs_b partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; else echo \"\"; diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x/install_linux_fw_usb.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x/install_linux_fw_usb.txt index 6021d15d2..f3688b958 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x/install_linux_fw_usb.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x/install_linux_fw_usb.txt @@ -121,9 +121,13 @@ echo " --------- --------" echo " bootloader ${INSTALL_UBOOT_FILENAME}" if test "${dualboot}" = "yes"; then echo " linux_a ${INSTALL_LINUX_FILENAME}" - echo " linux_b ${INSTALL_LINUX_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " linux_b ${INSTALL_LINUX_FILENAME}" + fi echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}" - echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + fi else echo " linux ${INSTALL_LINUX_FILENAME}" echo " recovery ${INSTALL_RECOVERY_FILENAME}" @@ -184,6 +188,7 @@ fi setenv bootcmd " env default -a; setenv dualboot ${dualboot}; + setenv install_dualboot ${install_dualboot}; saveenv; setenv otf-update yes; echo \"\"; @@ -212,17 +217,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; - echo \"\"; - echo \"\"; - update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update linux_b!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; + echo \"\"; + echo \"\"; + update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update linux_b!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; usb reset; echo \"\"; @@ -237,17 +244,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; - echo \"\"; - echo \"\"; - update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update rootfs_b partition!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; + echo \"\"; + echo \"\"; + update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update rootfs_b partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; else echo \"\"; diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x/install_linux_fw_uuu.sh b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x/install_linux_fw_uuu.sh index 3f019fa4e..ddfb41624 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x/install_linux_fw_uuu.sh +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x/install_linux_fw_uuu.sh @@ -1,7 +1,7 @@ #!/bin/sh #=============================================================================== # -# Copyright (C) 2020-2021 by Digi International Inc. +# Copyright (C) 2020-2023 by Digi International Inc. # All rights reserved. # # This program is free software; you can redistribute it and/or modify it @@ -39,6 +39,7 @@ show_usage() echo " -n No wait. Skips 10 seconds delay to stop script." echo " -u U-Boot filename." echo " Auto-determined by variant if not provided." + echo " -d Install firmware on dualboot partitions (system A and system B)." exit 2 } @@ -69,9 +70,10 @@ echo "############################################################" # Command line admits the following parameters: # -u # -i -while getopts 'hi:nu:' c +while getopts 'dhi:nu:' c do case $c in + d) INSTALL_DUALBOOT=true ;; h) show_usage ;; i) IMAGE_NAME=${OPTARG} ;; n) NOWAIT=true ;; @@ -217,9 +219,13 @@ if [ "${NOWAIT}" != true ]; then printf " bootloader\t${INSTALL_UBOOT_FILENAME}\n" if [ "${DUALBOOT}" = true ]; then printf " ${LINUX_NAME}_a\t${INSTALL_LINUX_FILENAME}\n" - printf " ${LINUX_NAME}_b\t${INSTALL_LINUX_FILENAME}\n" + if [ "${INSTALL_DUALBOOT}" = true ]; then + printf " ${LINUX_NAME}_b\t${INSTALL_LINUX_FILENAME}\n" + fi printf " ${ROOTFS_NAME}_a\t${INSTALL_ROOTFS_FILENAME}\n" - printf " ${ROOTFS_NAME}_b\t${INSTALL_ROOTFS_FILENAME}\n" + if [ "${INSTALL_DUALBOOT}" = true ]; then + printf " ${ROOTFS_NAME}_b\t${INSTALL_ROOTFS_FILENAME}\n" + fi else printf " ${LINUX_NAME}\t${INSTALL_LINUX_FILENAME}\n" printf " ${RECOVERY_NAME}\t${INSTALL_RECOVERY_FILENAME}\n" @@ -295,11 +301,15 @@ if [ "${DUALBOOT}" = true ]; then # Update Linux A part_update "${LINUX_NAME}_a" "${INSTALL_LINUX_FILENAME}" # Update Linux B - part_update "${LINUX_NAME}_b" "${INSTALL_LINUX_FILENAME}" + if [ "${INSTALL_DUALBOOT}" = true ]; then + part_update "${LINUX_NAME}_b" "${INSTALL_LINUX_FILENAME}" + fi # Update Rootfs A part_update "${ROOTFS_NAME}_a" "${INSTALL_ROOTFS_FILENAME}" # Update Rootfs B - part_update "${ROOTFS_NAME}_b" "${INSTALL_ROOTFS_FILENAME}" + if [ "${INSTALL_DUALBOOT}" = true ]; then + part_update "${ROOTFS_NAME}_b" "${INSTALL_ROOTFS_FILENAME}" + fi else # Update Linux part_update "${LINUX_NAME}" "${INSTALL_LINUX_FILENAME}" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_sd.txt index e7deac14b..3a50597f0 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_sd.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_sd.txt @@ -50,9 +50,13 @@ echo " --------- --------" echo " bootloader ${INSTALL_UBOOT_FILENAME}" if test "${dualboot}" = "yes"; then echo " linux_a ${INSTALL_LINUX_FILENAME}" - echo " linux_b ${INSTALL_LINUX_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " linux_b ${INSTALL_LINUX_FILENAME}" + fi echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}" - echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + fi else echo " linux ${INSTALL_LINUX_FILENAME}" echo " recovery ${INSTALL_RECOVERY_FILENAME}" @@ -112,6 +116,7 @@ fi setenv bootcmd " env default -a; setenv dualboot ${dualboot}; + setenv install_dualboot ${install_dualboot}; saveenv; setenv otf-update yes; echo \"\"; @@ -139,17 +144,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; - echo \"\"; - echo \"\"; - update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update linux_b!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; + echo \"\"; + echo \"\"; + update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update linux_b!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; echo \"\"; echo \"\"; @@ -163,17 +170,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; - echo \"\"; - echo \"\"; - update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update rootfs_b partition!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; + echo \"\"; + echo \"\"; + update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update rootfs_b partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; else echo \"\"; diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_usb.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_usb.txt index 1eb95d3bf..e916de50e 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_usb.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_usb.txt @@ -50,9 +50,13 @@ echo " --------- --------" echo " bootloader ${INSTALL_UBOOT_FILENAME}" if test "${dualboot}" = "yes"; then echo " linux_a ${INSTALL_LINUX_FILENAME}" - echo " linux_b ${INSTALL_LINUX_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " linux_b ${INSTALL_LINUX_FILENAME}" + fi echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}" - echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + if test "${install_dualboot}" = "yes"; then + echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}" + fi else echo " linux ${INSTALL_LINUX_FILENAME}" echo " recovery ${INSTALL_RECOVERY_FILENAME}" @@ -112,6 +116,7 @@ fi setenv bootcmd " env default -a; setenv dualboot ${dualboot}; + setenv install_dualboot ${install_dualboot}; saveenv; setenv otf-update yes; echo \"\"; @@ -140,17 +145,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; - echo \"\"; - echo \"\"; - update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update linux_b!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\"; + echo \"\"; + echo \"\"; + update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update linux_b!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; echo \"\"; echo \"\"; @@ -164,17 +171,19 @@ setenv bootcmd " echo \"Aborted.\"; exit; fi; - echo \"\"; - echo \"\"; - echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; - echo \"\"; - echo \"\"; - update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME}; - if test \$? -eq 1; then - echo \"[ERROR] Failed to update rootfs_b partition!\"; + if test \"\$\{install_dualboot\}\" = yes; then echo \"\"; - echo \"Aborted.\"; - exit; + echo \"\"; + echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\"; + echo \"\"; + echo \"\"; + update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME}; + if test \$? -eq 1; then + echo \"[ERROR] Failed to update rootfs_b partition!\"; + echo \"\"; + echo \"Aborted.\"; + exit; + fi; fi; else echo \"\"; diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_uuu.sh b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_uuu.sh index d580e5c02..f819e6aec 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_uuu.sh +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_uuu.sh @@ -1,7 +1,7 @@ #!/bin/sh #=============================================================================== # -# Copyright (C) 2020-2021 by Digi International Inc. +# Copyright (C) 2020-2023 by Digi International Inc. # All rights reserved. # # This program is free software; you can redistribute it and/or modify it @@ -39,6 +39,7 @@ show_usage() echo " -n No wait. Skips 10 seconds delay to stop script." echo " -u U-Boot filename." echo " Auto-determined by variant if not provided." + echo " -d Install firmware on dualboot partitions (system A and system B)." exit 2 } @@ -69,9 +70,10 @@ echo "############################################################" # Command line admits the following parameters: # -u # -i -while getopts 'hi:nu:' c +while getopts 'dhi:nu:' c do case $c in + d) INSTALL_DUALBOOT=true ;; h) show_usage ;; i) IMAGE_NAME=${OPTARG} ;; n) NOWAIT=true ;; @@ -158,9 +160,13 @@ if [ "${NOWAIT}" != true ]; then printf " bootloader\t${INSTALL_UBOOT_FILENAME}\n" if [ "${DUALBOOT}" = true ]; then printf " ${LINUX_NAME}_a\t${INSTALL_LINUX_FILENAME}\n" - printf " ${LINUX_NAME}_b\t${INSTALL_LINUX_FILENAME}\n" + if [ "${INSTALL_DUALBOOT}" = true ]; then + printf " ${LINUX_NAME}_b\t${INSTALL_LINUX_FILENAME}\n" + fi printf " ${ROOTFS_NAME}_a\t${INSTALL_ROOTFS_FILENAME}\n" - printf " ${ROOTFS_NAME}_b\t${INSTALL_ROOTFS_FILENAME}\n" + if [ "${INSTALL_DUALBOOT}" = true ]; then + printf " ${ROOTFS_NAME}_b\t${INSTALL_ROOTFS_FILENAME}\n" + fi else printf " ${LINUX_NAME}\t${INSTALL_LINUX_FILENAME}\n" printf " ${RECOVERY_NAME}\t${INSTALL_RECOVERY_FILENAME}\n" @@ -239,11 +245,15 @@ if [ "${DUALBOOT}" = true ]; then # Update Linux A part_update "${LINUX_NAME}_a" "${INSTALL_LINUX_FILENAME}" # Update Linux B - part_update "${LINUX_NAME}_b" "${INSTALL_LINUX_FILENAME}" + if [ "${INSTALL_DUALBOOT}" = true ]; then + part_update "${LINUX_NAME}_b" "${INSTALL_LINUX_FILENAME}" + fi # Update Rootfs A part_update "${ROOTFS_NAME}_a" "${INSTALL_ROOTFS_FILENAME}" # Update Rootfs B - part_update "${ROOTFS_NAME}_b" "${INSTALL_ROOTFS_FILENAME}" + if [ "${INSTALL_DUALBOOT}" = true ]; then + part_update "${ROOTFS_NAME}_b" "${INSTALL_ROOTFS_FILENAME}" + fi else # Update Linux part_update "${LINUX_NAME}" "${INSTALL_LINUX_FILENAME}" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2022.04.bb b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2022.04.bb index 2ac814261..4b2e21d26 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2022.04.bb +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey_2022.04.bb @@ -5,7 +5,7 @@ LIC_FILES_CHKSUM = "file://Licenses/README;md5=5a7450c57ffe5ae63fd732446b988025" DEPENDS += "flex-native bison-native" -SRCBRANCH = "v2022.04/maint" +SRCBRANCH = "v2022.04/master" SRCREV = "${AUTOREV}" COMPATIBLE_MACHINE = "(ccimx93)" diff --git a/meta-digi-arm/recipes-connectivity/nxp-wlan-sdk/iw612-sdk_git.bb b/meta-digi-arm/recipes-connectivity/nxp-wlan-sdk/iw612-sdk_git.bb new file mode 100644 index 000000000..b4c02b7e7 --- /dev/null +++ b/meta-digi-arm/recipes-connectivity/nxp-wlan-sdk/iw612-sdk_git.bb @@ -0,0 +1,21 @@ +require iw612-sdk_git.inc + +SUMMARY = "NXP Wi-Fi SDK for IW612" + +inherit module-base + +TARGET_CC_ARCH += "${LDFLAGS}" + +do_compile () { + oe_runmake appsbuild +} + +do_install () { + install -d ${D}${datadir}/nxp_wireless + + cp -r bin_sdw61x/* ${D}${datadir}/nxp_wireless +} + +FILES:${PN} = "${datadir}/nxp_wireless" + +COMPATIBLE_MACHINE = "(mx93-nxp-bsp)" diff --git a/meta-digi-arm/recipes-connectivity/nxp-wlan-sdk/iw612-sdk_git.bbappend b/meta-digi-arm/recipes-connectivity/nxp-wlan-sdk/iw612-sdk_git.bbappend new file mode 100644 index 000000000..3e5085c3b --- /dev/null +++ b/meta-digi-arm/recipes-connectivity/nxp-wlan-sdk/iw612-sdk_git.bbappend @@ -0,0 +1,3 @@ +# Copyright (C) 2023 Digi International. + +RRECOMMENDS:${PN}:remove = "wireless-tools" diff --git a/meta-digi-arm/recipes-connectivity/nxp-wlan-sdk/iw612-sdk_git.inc b/meta-digi-arm/recipes-connectivity/nxp-wlan-sdk/iw612-sdk_git.inc new file mode 100644 index 000000000..36341f051 --- /dev/null +++ b/meta-digi-arm/recipes-connectivity/nxp-wlan-sdk/iw612-sdk_git.inc @@ -0,0 +1,14 @@ +SUMMARY = "NXP Wi-Fi SDK for IW612" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://gpl-2.0.txt;md5=ab04ac0f249af12befccb94447c08b77" + +SRCBRANCH = "lf-5.15.71_2.2.0" +IW612_SRC ?= "git://github.com/nxp-imx/mwifiex-iw612.git;protocol=https" +SRC_URI = "${IW612_SRC};branch=${SRCBRANCH}" +SRCREV = "4cc2c8831f27c8eceece6b66fc2de8b73360f520" + +S = "${WORKDIR}/git" + +EXTRA_OEMAKE = "KERNELDIR=${STAGING_KERNEL_BUILDDIR}" + +RRECOMMENDS:${PN} = "wireless-tools" diff --git a/meta-digi-arm/recipes-connectivity/nxp-wlan-sdk/nxp-wlan-sdk_git.inc b/meta-digi-arm/recipes-connectivity/nxp-wlan-sdk/nxp-wlan-sdk_git.inc new file mode 100644 index 000000000..0e92104db --- /dev/null +++ b/meta-digi-arm/recipes-connectivity/nxp-wlan-sdk/nxp-wlan-sdk_git.inc @@ -0,0 +1,15 @@ +SUMMARY = "NXP Wi-Fi SDK for module 88w8801/8987/8997/9098 and IW416/612" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://${WORKDIR}/git/LICENSE;md5=ab04ac0f249af12befccb94447c08b77" + +# For Kernel 5.4 and later +SRCBRANCH = "lf-6.1.1_1.0.0" +MRVL_SRC ?= "git://github.com/nxp-imx/mwifiex.git;protocol=https" +SRC_URI = "${MRVL_SRC};branch=${SRCBRANCH}" +SRCREV = "98e5b28b1a7afea9dbded4067e93bfd584531a79" + +S = "${WORKDIR}/git/mxm_wifiex/wlan_src" + +EXTRA_OEMAKE = "KERNELDIR=${STAGING_KERNEL_BUILDDIR}" + +RDEPENDS:${PN} = "wireless-tools" diff --git a/meta-digi-arm/recipes-core/packagegroup/nativesdk-packagegroup-sdk-host.bbappend b/meta-digi-arm/recipes-core/packagegroup/nativesdk-packagegroup-sdk-host.bbappend index 137e373f5..94b076552 100644 --- a/meta-digi-arm/recipes-core/packagegroup/nativesdk-packagegroup-sdk-host.bbappend +++ b/meta-digi-arm/recipes-core/packagegroup/nativesdk-packagegroup-sdk-host.bbappend @@ -1,11 +1,16 @@ -# Copyright (C) 2016-2022 Digi International. +# Copyright (C) 2016-2023 Digi International. + +IMX_OPTEE_SDK_RDEPENDS ?= " \ + nativesdk-python3-cryptography \ + nativesdk-python3-pyelftools \ +" IMX_TRUSTFENCE_SDK_TOOLS ?= " \ - nativesdk-trustfence-sign-tools \ nativesdk-trustfence-cst \ ${@oe.utils.conditional('TRUSTFENCE_SIGN_MODE', 'AHAB', 'nativesdk-imx-mkimage', '', d)} \ " RDEPENDS:${PN} += " \ - ${@oe.utils.conditional('DEY_BUILD_PLATFORM', 'NXP', '${IMX_TRUSTFENCE_SDK_TOOLS}', '', d)} \ + nativesdk-trustfence-sign-tools \ + ${@oe.utils.conditional('DEY_SOC_VENDOR', 'NXP', '${IMX_OPTEE_SDK_RDEPENDS} ${IMX_TRUSTFENCE_SDK_TOOLS}', '', d)} \ " diff --git a/meta-digi-arm/recipes-core/udev/udev-extraconf/00-disable-sd.rules b/meta-digi-arm/recipes-core/udev/udev-extraconf/00-disable-sd.rules new file mode 100644 index 000000000..4096f815a --- /dev/null +++ b/meta-digi-arm/recipes-core/udev/udev-extraconf/00-disable-sd.rules @@ -0,0 +1,2 @@ +# Disable all SD devices +SUBSYSTEMS=="mmc", ATTRS{type}=="SD", RUN:="/bin/true" diff --git a/meta-digi-arm/recipes-core/udev/udev-extraconf/mount_digiparts.sh b/meta-digi-arm/recipes-core/udev/udev-extraconf/mount_digiparts.sh index bf07cce48..6ee14c63a 100644 --- a/meta-digi-arm/recipes-core/udev/udev-extraconf/mount_digiparts.sh +++ b/meta-digi-arm/recipes-core/udev/udev-extraconf/mount_digiparts.sh @@ -53,6 +53,16 @@ fi if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then # systemd as init uses systemd-mount to mount block devices + + # Verify if unit is already launched, if so just restart it. + if systemctl | grep -q "mnt-${PARTNAME}.mount"; then + if ! systemctl restart "mnt-${PARTNAME}.mount"; then + logger -t udev "ERROR: Could not mount '${DEVNAME}'" + exit 1 + fi + exit 0 + fi + MOUNT="/usr/bin/systemd-mount" MOUNT_PARAMS="${MOUNT_PARAMS} --no-block" diff --git a/meta-digi-arm/recipes-core/udev/udev-extraconf_1.1.bbappend b/meta-digi-arm/recipes-core/udev/udev-extraconf_1.1.bbappend index 48063b477..134bfd839 100644 --- a/meta-digi-arm/recipes-core/udev/udev-extraconf_1.1.bbappend +++ b/meta-digi-arm/recipes-core/udev/udev-extraconf_1.1.bbappend @@ -9,6 +9,7 @@ SRC_URI += " \ " SRC_URI:append:ccmp1 = " \ file://99-ext-rtc-wakeup.rules \ + file://00-disable-sd.rules \ " do_install:append() { @@ -59,6 +60,9 @@ do_install:append() { do_install:append:ccmp1() { install -m 0644 ${WORKDIR}/99-ext-rtc-wakeup.rules ${D}${sysconfdir}/udev/rules.d/ + # Disables all SD device but keeps on mounting other external memory devices like USB. + # This is currently needed for the CCMP1 platform as a workaround to fix a boot issue. + install -m 0644 ${WORKDIR}/00-disable-sd.rules ${D}${sysconfdir}/udev/rules.d/ } FILES:${PN}:append = " \ diff --git a/meta-digi-arm/recipes-digi/trustfence/nativesdk-trustfence-sign-tools_git.bb b/meta-digi-arm/recipes-digi/trustfence/nativesdk-trustfence-sign-tools_git.bb new file mode 100644 index 000000000..e1f5f9ade --- /dev/null +++ b/meta-digi-arm/recipes-digi/trustfence/nativesdk-trustfence-sign-tools_git.bb @@ -0,0 +1,9 @@ +# Copyright (C) 2023, Digi International Inc. + +require trustfence-sign-tools.inc +inherit nativesdk + +RDEPENDS:${PN} = " \ + ${@oe.utils.conditional('DEY_SOC_VENDOR', 'NXP', 'nativesdk-trustfence-cst', '', d)} \ + ${@oe.utils.conditional('DEY_SOC_VENDOR', 'STM', 'nativesdk-trustfence-stm-signtools', '', d)} \ +" diff --git a/meta-digi-arm/recipes-digi/trustfence/trustfence-genpki-native.bb b/meta-digi-arm/recipes-digi/trustfence/trustfence-genpki-native.bb new file mode 100644 index 000000000..b1167f55c --- /dev/null +++ b/meta-digi-arm/recipes-digi/trustfence/trustfence-genpki-native.bb @@ -0,0 +1,62 @@ +# Copyright (C) 2023, Digi International Inc. + +SUMMARY = "TrustFence generation of Public Key Infrastructure (PKI)" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" + +inherit native + +RDEPENDS:${PN} = " \ + trustfence-sign-tools-native \ + openssl-native \ +" + +S = "${WORKDIR}" + +do_fetch[noexec] = "1" +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +# Function to generate a PKI tree (with lock dir protection) +GENPKI_LOCK_DIR = "${TRUSTFENCE_SIGN_KEYS_PATH}/.genpki.lock" +gen_pki_tree() { + if mkdir -p ${GENPKI_LOCK_DIR}; then + if [ "${DEY_SOC_VENDOR}" = "NXP" ]; then + trustfence-gen-pki.sh ${TRUSTFENCE_SIGN_KEYS_PATH} + elif [ "${DEY_SOC_VENDOR}" = "STM" ]; then + # Call sign script with no artifact arguments to just + # generate the keys + export CONFIG_SIGN_KEYS_PATH="${TRUSTFENCE_SIGN_KEYS_PATH}" + export CONFIG_KEY_INDEX="${TRUSTFENCE_KEY_INDEX}" + trustfence-sign-artifact.sh -p ${DIGI_SOM} + fi + rm -rf ${GENPKI_LOCK_DIR} + else + bbfatal "Could not get lock to generate PKI tree" + fi +} + +# Function that generates a PKI tree if there isn't one +check_gen_pki_tree() { + if [ "${DEY_SOC_VENDOR}" = "NXP" ]; then + SRK_KEYS="$(echo ${TRUSTFENCE_SIGN_KEYS_PATH}/crts/SRK*crt.pem | sed s/\ /\,/g)" + n_commas="$(echo ${SRK_KEYS} | grep -o "," | wc -l)" + if [ "${n_commas}" -eq 0 ]; then + gen_pki_tree + elif [ "${n_commas}" -ne 3 ]; then + bbfatal "Inconsistent PKI tree" + fi + elif [ "${DEY_SOC_VENDOR}" = "STM" ]; then + # The script that generates the PKI tree already checks if + # there isn't one, so there's nothing to do here but calling it. + gen_pki_tree + fi +} + +do_install[depends] = "trustfence-sign-tools-native:do_populate_sysroot \ + openssl-native:do_populate_sysroot" +do_install() { + check_gen_pki_tree +} + +FILES:${PN} = "${bindir}" diff --git a/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools-native_git.bb b/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools-native_git.bb new file mode 100644 index 000000000..c879f9288 --- /dev/null +++ b/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools-native_git.bb @@ -0,0 +1,12 @@ +# Copyright (C) 2023, Digi International Inc. + +require trustfence-sign-tools.inc +inherit native + +RDEPENDS:${PN} = " \ + ${@oe.utils.conditional('DEY_SOC_VENDOR', 'NXP', 'trustfence-cst-native', '', d)} \ + ${@oe.utils.conditional('DEY_SOC_VENDOR', 'STM', 'trustfence-stm-signtools-native', '', d)} \ + coreutils-native \ + util-linux-native \ + ${@oe.utils.conditional('TRUSTFENCE_SIGN_MODE', 'AHAB', 'imx-mkimage-native', '', d)} \ +" diff --git a/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools.inc b/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools.inc new file mode 100644 index 000000000..de09db48a --- /dev/null +++ b/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools.inc @@ -0,0 +1,59 @@ +# Copyright (C) 2017-2023, Digi International Inc. + +SUMMARY = "TrustFence signing and encryption scripts" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" + +SRCBRANCH = "v2020.04/master" +SRCREV = "${AUTOREV}" + +S = "${WORKDIR}" + +# Select internal or Github U-Boot repo +UBOOT_URI_STASH = "${DIGI_MTK_GIT}/uboot/u-boot-denx.git;protocol=ssh" +UBOOT_URI_GITHUB = "${DIGI_GITHUB_GIT}/u-boot.git;protocol=https" +UBOOT_GIT_URI ?= "${@oe.utils.conditional('DIGI_INTERNAL_GIT', '1' , '${UBOOT_URI_STASH}', '${UBOOT_URI_GITHUB}', d)}" + +SRC_URI = " \ + ${UBOOT_GIT_URI};branch=${SRCBRANCH} \ + file://trustfence-sign-artifact-nxp.sh \ + file://trustfence-sign-artifact-stm.sh \ + file://sign_hab;name=artifact-hab-sign \ + file://encrypt_hab;name=artifact-hab-encrypt \ + file://sign_ahab;name=artifact-ahab-sign \ + file://encrypt_ahab;name=artifact-ahab-encrypt \ +" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +do_install() { + if [ "${DEY_SOC_VENDOR}" = "NXP" ]; then + install -d ${D}${bindir}/csf_templates + if [ "${TRUSTFENCE_SIGN_MODE}" = "AHAB" ]; then + install -m 0755 sign_ahab ${D}${bindir}/csf_templates/ + install -m 0755 encrypt_ahab ${D}${bindir}/csf_templates/ + elif [ "${TRUSTFENCE_SIGN_MODE}" = "HAB" ]; then + install -m 0755 sign_hab ${D}${bindir}/csf_templates/ + install -m 0755 encrypt_hab ${D}${bindir}/csf_templates/ + else + bberror "Unkown TRUSTFENCE_SIGN_MODE value" + exit 1 + fi + + install -m 0755 git/scripts/csf_templates/* ${D}${bindir}/csf_templates + install -m 0755 trustfence-sign-artifact-nxp.sh ${D}${bindir}/trustfence-sign-artifact.sh + + # Select U-Boot sign script depending on U-Boot including an SPL image + if [ -n "${SPL_BINARY}" ]; then + install -m 0755 git/scripts/sign_spl_fit.sh ${D}${bindir}/trustfence-sign-uboot.sh + else + install -m 0755 git/scripts/sign.sh ${D}${bindir}/trustfence-sign-uboot.sh + fi + elif [ "${DEY_SOC_VENDOR}" = "STM" ]; then + install -d ${D}${bindir} + install -m 0755 trustfence-sign-artifact-stm.sh ${D}${bindir}/trustfence-sign-artifact.sh + fi +} + +FILES:${PN} = "${bindir}" diff --git a/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools/trustfence-sign-artifact.sh b/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools/trustfence-sign-artifact-nxp.sh similarity index 100% rename from meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools/trustfence-sign-artifact.sh rename to meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools/trustfence-sign-artifact-nxp.sh diff --git a/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools/trustfence-sign-artifact-stm.sh b/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools/trustfence-sign-artifact-stm.sh new file mode 100755 index 000000000..ddf2d1c86 --- /dev/null +++ b/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools/trustfence-sign-artifact-stm.sh @@ -0,0 +1,134 @@ +#!/bin/sh +#=============================================================================== +# +# trustfence-sign-artifact.sh +# +# Copyright (C) 2023 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 artifacts using STM sign tools. +# +# The following environment variables define the script behaviour: +# +#=============================================================================== + +# Avoid parallel execution of this script +SINGLE_PROCESS_LOCK="/tmp/sign_script.lock.d" +trap 'rm -rf "${SINGLE_PROCESS_LOCK}"' INT TERM EXIT +while ! mkdir "${SINGLE_PROCESS_LOCK}" > /dev/null 2>&1; do + sleep 1 +done + +SCRIPT_NAME="$(basename "${0}")" +SUPPORTED_PLATFORMS="ccmp15, ccmp13" + +while getopts "p:t" c; do + case "${c}" in + p) PLATFORM="${OPTARG}";; + t) ARTIFACT_TFA="y";; + esac +done +shift "$((OPTIND - 1))" + +usage() { + cat < [ ] + + Options: + -p platform + -t sign/encrypt TF-A artifact + +Supported platforms: ${SUPPORTED_PLATFORMS} + +When called without filename parameters, it generates random keys if they +do not exist. + +EOF +} + +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}" + +# Default values +[ -z "${CONFIG_KEY_INDEX}" ] && CONFIG_KEY_INDEX="0" +KEY_PASS_FILE="${CONFIG_SIGN_KEYS_PATH}/keys/key_pass.txt" + +# Generate random keys if they don't exist +if [ "${PLATFORM}" = "ccmp15" ]; then + PUBLIC_KEY="${CONFIG_SIGN_KEYS_PATH}/keys/publicKey00.pem" + PRIVATE_KEY="${CONFIG_SIGN_KEYS_PATH}/keys/privateKey00.pem" + if [ ! -f "${PRIVATE_KEY}" ] && [ ! -f "${PUBLIC_KEY}" ] && [ ! -f "${KEY_PASS_FILE}" ]; then + install -d "${CONFIG_SIGN_KEYS_PATH}/keys/" + # Random password + password="$(openssl rand -base64 32)" + echo "Generating random key" + STM32MP_KeyGen_CLI -abs "${CONFIG_SIGN_KEYS_PATH}/keys/" -pwd ${password} -n 1 + echo "${password}" > "${KEY_PASS_FILE}" + fi +elif [ "${PLATFORM}" = "ccmp13" ]; then + N_PUBK="$(ls -l ${CONFIG_SIGN_KEYS_PATH}/keys/publicKey0* 2>/dev/null | wc -l)" + N_PRVK="$(ls -l ${CONFIG_SIGN_KEYS_PATH}/keys/privateKey0* 2>/dev/null | wc -l)" + PUBLIC_KEY="${CONFIG_SIGN_KEYS_PATH}/keys/publicKey0*.pem" + PRIVATE_KEY="${CONFIG_SIGN_KEYS_PATH}/keys/privateKey0${CONFIG_KEY_INDEX}.pem" + if [ "${N_PUBK}" != "8" ] && [ "${N_PRVK}" != 8 ] && [ ! -f "${KEY_PASS_FILE}" ]; then + install -d "${CONFIG_SIGN_KEYS_PATH}/keys/" + # 8 random passwords (separated by whitespaces) + passwords="$(openssl rand -base64 32)" + for i in $(seq 1 7); do + passwords="${passwords} $(openssl rand -base64 32)" + done + echo "Generating random keys" + STM32MP_KeyGen_CLI -abs "${CONFIG_SIGN_KEYS_PATH}/keys/" -pwd ${passwords} -n 8 + echo "${passwords}" > "${KEY_PASS_FILE}" + fi +else + echo "Undefined platform" + exit 1 +fi + +if [ "${#}" = "0" ]; then + exit 0 +elif [ "${#}" != "2" ]; then + usage + exit 1 +fi + +if [ "${ARTIFACT_TFA}" != "y" ]; then + echo "Specify the type of image to process (-t)" + usage + exit 1 +fi + +INPUT_FILE="$(readlink -e "${1}")" +OUTPUT_FILE="$(readlink -m "${2}")" + +# Obtain password from key pass file +INDEX=$((CONFIG_KEY_INDEX + 1)) +PASS=$(cat "${KEY_PASS_FILE}" | cut -f "${INDEX}" -d " ") + +# Sign TF-A artifact +if [ "${ARTIFACT_TFA}" = "y" ]; then + if [ "${PLATFORM}" = "ccmp15" ]; then + SOC_OPTIONS="-hv 1" + elif [ "${PLATFORM}" = "ccmp13" ]; then + SOC_OPTIONS="-hv 2 -of 0x00000001" + fi + STM32MP_SigningTool_CLI -bin ${INPUT_FILE} \ + --public-key ${PUBLIC_KEY} \ + --private-key ${PRIVATE_KEY} \ + -t fsbl \ + -s \ + ${SOC_OPTIONS} \ + --password ${PASS} \ + -o ${OUTPUT_FILE} +fi diff --git a/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools_git.bb b/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools_git.bb deleted file mode 100644 index fdf63f5d5..000000000 --- a/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools_git.bb +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (C) 2017-2022, Digi International Inc. - -SUMMARY = "TrustFence signing and encryption scripts" -LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" - -DEPENDS = "trustfence-cst coreutils util-linux" -DEPENDS += "${@oe.utils.conditional('TRUSTFENCE_SIGN_MODE', 'AHAB', 'imx-mkimage', '', d)}" - -SRCBRANCH = "v2020.04/maint" -SRCREV = "${AUTOREV}" - -S = "${WORKDIR}" - -# Select internal or Github U-Boot repo -UBOOT_URI_STASH = "${DIGI_MTK_GIT}/uboot/u-boot-denx.git;protocol=ssh" -UBOOT_URI_GITHUB = "${DIGI_GITHUB_GIT}/u-boot.git;protocol=https" -UBOOT_GIT_URI ?= "${@oe.utils.conditional('DIGI_INTERNAL_GIT', '1' , '${UBOOT_URI_STASH}', '${UBOOT_URI_GITHUB}', d)}" - -SRC_URI = " \ - ${UBOOT_GIT_URI};branch=${SRCBRANCH} \ - file://trustfence-sign-artifact.sh;name=artifact-sign-script \ - file://sign_hab;name=artifact-hab-sign \ - file://encrypt_hab;name=artifact-hab-encrypt \ - file://sign_ahab;name=artifact-ahab-sign \ - file://encrypt_ahab;name=artifact-ahab-encrypt \ -" - -do_configure[noexec] = "1" -do_compile[noexec] = "1" - -do_install() { - install -d ${D}${bindir}/csf_templates - if [ "${TRUSTFENCE_SIGN_MODE}" = "AHAB" ]; then - install -m 0755 sign_ahab ${D}${bindir}/csf_templates/ - install -m 0755 encrypt_ahab ${D}${bindir}/csf_templates/ - elif [ "${TRUSTFENCE_SIGN_MODE}" = "HAB" ]; then - install -m 0755 sign_hab ${D}${bindir}/csf_templates/ - install -m 0755 encrypt_hab ${D}${bindir}/csf_templates/ - else - bberror "Unkown TRUSTFENCE_SIGN_MODE value" - exit 1 - fi - install -m 0755 trustfence-sign-artifact.sh ${D}${bindir}/ - install -m 0755 git/scripts/csf_templates/* ${D}${bindir}/csf_templates - - # Select U-Boot sign script depending on U-Boot including an SPL image - if [ -n "${SPL_BINARY}" ]; then - install -m 0755 git/scripts/sign_spl_fit.sh ${D}${bindir}/trustfence-sign-uboot.sh - else - install -m 0755 git/scripts/sign.sh ${D}${bindir}/trustfence-sign-uboot.sh - fi -} - -FILES:${PN} = "${bindir}" -BBCLASSEXTEND = "native nativesdk" diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb index 798eff21d..cdb0f3575 100644 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2022 Digi International. +# Copyright (C) 2016-2023 Digi International. SUMMARY = "Qualcomm's wireless driver for qca65xx" DESCRIPTION = "qcacld-2.0 module" @@ -32,6 +32,7 @@ FILES_SDIO_CCX = " \ FILES_SDIO = " \ file://modprobe-qualcomm.conf \ + file://qualcomm.sh \ ${@oe.utils.vartrue('QUALCOMM_FW_CCX_TAGS', '${FILES_SDIO_CCX}', '', d)} \ " @@ -63,10 +64,17 @@ do_compile:prepend() { export BUILD_VER=${PV} } + +MMC_NODE ?= "30b40000.mmc" +MMC_NODE:ccimx6ul = "2190000.mmc" + do_install:append() { if [ "${QUALCOMM_WIFI_INTERFACE}" = "sdio" ]; then install -d ${D}${sysconfdir}/modprobe.d install -m 0644 ${WORKDIR}/modprobe-qualcomm.conf ${D}${sysconfdir}/modprobe.d/qualcomm.conf + install -d ${D}${sysconfdir}/udev/scripts + install -m 0755 ${WORKDIR}/qualcomm.sh ${D}${sysconfdir}/udev/scripts/ + sed -i -e "s/##NODE##/${MMC_NODE}/g" ${D}${sysconfdir}/udev/scripts/qualcomm.sh fi install -d ${D}${base_libdir}/firmware/wlan/ diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/81-qcom-wifi.rules b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/81-qcom-wifi.rules index 92706c426..6d505c56a 100644 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/81-qcom-wifi.rules +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/81-qcom-wifi.rules @@ -1,4 +1,4 @@ # Load Qualcomm wireless module (sdio) -SUBSYSTEM=="sdio", ACTION=="add", ENV{MODALIAS}=="sdio:c00v0271d050A", RUN="/sbin/modprobe wlan" +SUBSYSTEM=="sdio", ACTION=="add", ENV{MODALIAS}=="sdio:c00v0271d050A", RUN="/etc/udev/scripts/qualcomm.sh" # Load Qualcomm wireless module (pci) SUBSYSTEM=="pci", ACTION=="add", ENV{MODALIAS}=="pci:v0000168Cd0000003Esv*sd*bc*sc*i*", RUN="/sbin/modprobe wlan" diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh new file mode 100644 index 000000000..e53c799fb --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh @@ -0,0 +1,55 @@ +#!/bin/sh +# +# Copyright (c) 2023 Digi International Inc. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at http://mozilla.org/MPL/2.0/. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +MMC_NODE="##NODE##" + +# At this point of the boot (udev script), the system log (syslog) is not +# available yet, so use the kernel log buffer from userspace. +log() { + printf "<$1>qca65x4: $2\n" >/dev/kmsg +} + +# Force re-detection of the mmc node +rebind_mmc_node() { + DRIVER_NODE=$(find /sys/bus/platform/drivers -name ${MMC_NODE} | xargs dirname 2> /dev/null) || return 1 + echo ${MMC_NODE} > ${DRIVER_NODE}/unbind + # Give some time to the mmc driver to re-detect the MMC node in order to re-initialize it. + sleep 2 + echo ${MMC_NODE} > ${DRIVER_NODE}/bind +} + +load_and_check() { + modprobe wlan + [ -d "/sys/class/net/wlan0" ] && return 0 || return 1 +} + +# Do nothing if the wireless node does not exist on the device tree +[ -d "/proc/device-tree/wireless" ] || exit 0 + +# Do nothing if the module is already loaded +grep -qws 'wlan' /proc/modules && exit 0 + +load_and_check && log "3" "[INFO] wlan module loaded" && exit 0 + +# If we are here, the load has failed. Retry. +log "3" "[WARN] Loading wlan module failed, retrying..." + +# Try by re-binding the mmc node. +rebind_mmc_node && load_and_check && log "3" "[INFO] wlan module loaded" && exit 0 + +log "3" "[ERROR] Loading wlan module" +exit 1 diff --git a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-nxp-wlan.bb b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-nxp-wlan.bb new file mode 100644 index 000000000..8cdab4e7b --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-nxp-wlan.bb @@ -0,0 +1,7 @@ +require recipes-connectivity/nxp-wlan-sdk/nxp-wlan-sdk_git.inc + +SUMMARY = "Kernel loadable module for NXP Wi-Fi module 88w8801/8987/8997/9098 IW416/612" + +inherit module + +EXTRA_OEMAKE += "-C ${STAGING_KERNEL_BUILDDIR} M=${S}" diff --git a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-nxp-wlan.bbappend b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-nxp-wlan.bbappend new file mode 100644 index 000000000..e1a0c245a --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-nxp-wlan.bbappend @@ -0,0 +1,22 @@ +# Copyright (C) 2023 Digi International. + +FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" + +SRC_URI:append = " \ + file://81-iw612-wifi.rules \ + file://load_iw612.sh \ +" + +do_install:append () { + install -d ${D}${sysconfdir}/udev/rules.d + install -m 0644 ${WORKDIR}/81-iw612-wifi.rules ${D}${sysconfdir}/udev/rules.d/ + install -d ${D}${sysconfdir}/udev/scripts + install -m 0777 ${WORKDIR}/load_iw612.sh ${D}${sysconfdir}/udev/scripts/ +} + +FILES:${PN}:append = " \ + ${sysconfdir}/udev/rules.d \ + ${sysconfdir}/udev/scripts \ +" + +RDEPENDS:${PN}:remove = "wireless-tools" diff --git a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-nxp-wlan/81-iw612-wifi.rules b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-nxp-wlan/81-iw612-wifi.rules new file mode 100644 index 000000000..bf7b0e977 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-nxp-wlan/81-iw612-wifi.rules @@ -0,0 +1,2 @@ +# Load IW612 wireless module (sdio) +SUBSYSTEM=="sdio", ACTION=="add", ENV{MODALIAS}=="sdio:c00v0471d0205", RUN="/etc/udev/scripts/load_iw612.sh" diff --git a/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-nxp-wlan/load_iw612.sh b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-nxp-wlan/load_iw612.sh new file mode 100644 index 000000000..8a8539688 --- /dev/null +++ b/meta-digi-arm/recipes-kernel/kernel-modules/kernel-module-nxp-wlan/load_iw612.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +# The bit settings of drv_mode are: +# Bit 0 : STA +# Bit 1 : uAP +# Bit 2 : WIFIDIRECT +# eg, for STA + uAP + WIFIDIRECT, set 7 (b'111) +DRIVER_MODE=1 # Only STA + +# MREG_D(00000200), MERROR(00000004),MFATAL(00000002) +DRIVER_DEBUG="0x206" + +MOAL_PARAMS=" \ +cfg80211_wext=0xf \ +max_vir_bss=1 \ +cal_data_cfg=none \ +ps_mode=1 \ +auto_ds=1 \ +host_mlme=1 \ +drv_mode=${DRIVER_MODE} \ +drvdbg=${DRIVER_DEBUG} \ +sta_name=wlan \ +fw_name=nxp/sduart_nw61x_v1.bin.se\ +" + +log() { + printf "<3>iw612-wifi: $1\n" >/dev/kmsg +} + +if ! [ -e "/proc/device-tree/wireless/mac-address" ]; then + log "[ERROR] wireless mac-address not found" + exit 1 +fi + +WLANADDR=$(hexdump -ve '1/1 "%02X" ":"' /proc/device-tree/wireless/mac-address 2>/dev/null | sed 's/:$//g') +modprobe mlan && \ +modprobe moal ${MOAL_PARAMS} mac_addr=${WLANADDR} && \ +log "Wi-Fi activated" && exit 0 + +log "[ERROR] cannot load Wi-Fi driver" +exit 1 diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey_5.15.bb b/meta-digi-arm/recipes-kernel/linux/linux-dey_5.15.bb index a8c85a053..d6a71f85e 100644 --- a/meta-digi-arm/recipes-kernel/linux/linux-dey_5.15.bb +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey_5.15.bb @@ -1,21 +1,21 @@ -# Copyright (C) 2022 Digi International +# Copyright (C) 2022,2023 Digi International SUMMARY = "Linux kernel for Digi boards" LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" # CONFIG_KERNEL_LZO in defconfig -DEPENDS += "${@oe.utils.conditional('DEY_BUILD_PLATFORM', 'NXP', 'lzop-native', '', d)}" +DEPENDS += "${@oe.utils.conditional('DEY_SOC_VENDOR', 'NXP', 'lzop-native', '', d)}" inherit kernel -inherit ${@oe.utils.conditional('DEY_BUILD_PLATFORM', 'NXP', 'fsl-kernel-localversion', '', d)} +inherit ${@oe.utils.conditional('DEY_SOC_VENDOR', 'NXP', 'fsl-kernel-localversion', '', d)} SRCBRANCH = "v5.15/nxp/dey-4.0/maint" SRCBRANCH:stm32mpcommon = "v5.15/stm/dey-4.0/maint" SRCREV = "${AUTOREV}" SRCREV:stm32mpcommon = "${AUTOREV}" -require ${@oe.utils.conditional('DEY_BUILD_PLATFORM', 'STM', 'recipes-kernel/linux/linux-stm32mp.inc', '', d)} +require ${@oe.utils.conditional('DEY_SOC_VENDOR', 'STM', 'recipes-kernel/linux/linux-stm32mp.inc', '', d)} # Don't create custom folder for kernel artifacts do_deploy[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}" diff --git a/meta-digi-arm/recipes-kernel/linux/linux-trustfence.inc b/meta-digi-arm/recipes-kernel/linux/linux-trustfence.inc index 99bdc27c4..690e2cdf2 100644 --- a/meta-digi-arm/recipes-kernel/linux/linux-trustfence.inc +++ b/meta-digi-arm/recipes-kernel/linux/linux-trustfence.inc @@ -5,6 +5,9 @@ DEPENDS += "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', 'trustfence-sign-too do_deploy[postfuncs] += "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', 'trustfence_sign', '', d)}" trustfence_sign() { + # TODO: signing of artifacts for STM-based platforms + [ "${DEY_SOC_VENDOR}" = "STM" ] && return + # Set environment variables for trustfence configuration export CONFIG_SIGN_KEYS_PATH="${TRUSTFENCE_SIGN_KEYS_PATH}" [ -n "${TRUSTFENCE_KEY_INDEX}" ] && export CONFIG_KEY_INDEX="${TRUSTFENCE_KEY_INDEX}" @@ -20,7 +23,7 @@ trustfence_sign() { fi TMP_KERNEL_IMAGE_SIGNED="$(mktemp ${KERNEL_IMAGE}-signed.XXXXXX)" - trustfence-sign-artifact.sh -p "${DIGI_FAMILY}" -l "${KERNEL_IMAGE}" "${TMP_KERNEL_IMAGE_SIGNED}" + trustfence-sign-artifact.sh -p "${DIGI_SOM}" -l "${KERNEL_IMAGE}" "${TMP_KERNEL_IMAGE_SIGNED}" if [ "${type}" = "Image.gz" ]; then # Compress the signed Image and restore the original filename @@ -41,9 +44,9 @@ trustfence_sign() { TMP_DTB_IMAGE_SIGNED="$(mktemp ${DTB_IMAGE}-signed.XXXXXX)" if [ "${DTB_EXT}" = "dtbo" ]; then - trustfence-sign-artifact.sh -p "${DIGI_FAMILY}" -o "${DTB_IMAGE}" "${TMP_DTB_IMAGE_SIGNED}" + trustfence-sign-artifact.sh -p "${DIGI_SOM}" -o "${DTB_IMAGE}" "${TMP_DTB_IMAGE_SIGNED}" else - trustfence-sign-artifact.sh -p "${DIGI_FAMILY}" -d "${DTB_IMAGE}" "${TMP_DTB_IMAGE_SIGNED}" + trustfence-sign-artifact.sh -p "${DIGI_SOM}" -d "${DTB_IMAGE}" "${TMP_DTB_IMAGE_SIGNED}" fi mv "${TMP_DTB_IMAGE_SIGNED}" "${DTB_IMAGE}" done diff --git a/meta-digi-dey/classes/dey-image-installer.bbclass b/meta-digi-dey/classes/dey-image-installer.bbclass index 66243e878..c0d6ad7ba 100644 --- a/meta-digi-dey/classes/dey-image-installer.bbclass +++ b/meta-digi-dey/classes/dey-image-installer.bbclass @@ -25,6 +25,7 @@ FSTYPES_WHITELIST:ccmp1 = " \ HAS_USB_DRIVER = "false" HAS_USB_DRIVER:ccimx8m = "true" +HAS_USB_DRIVER:ccimx93 = "true" HAS_USB_DRIVER:ccmp1 = "true" generate_installer_zip () { diff --git a/meta-digi-dey/classes/trustfence.bbclass b/meta-digi-dey/classes/trustfence.bbclass index 0e430cf94..8de026543 100644 --- a/meta-digi-dey/classes/trustfence.bbclass +++ b/meta-digi-dey/classes/trustfence.bbclass @@ -22,8 +22,11 @@ TRUSTFENCE_CONSOLE_DISABLE ?= "0" TRUSTFENCE_SIGN ?= "1" TRUSTFENCE_SIGN_KEYS_PATH ?= "default" TRUSTFENCE_DEK_PATH ?= "default" +TRUSTFENCE_DEK_PATH:ccmp1 ?= "0" TRUSTFENCE_ENCRYPT_ENVIRONMENT ?= "1" +TRUSTFENCE_ENCRYPT_ENVIRONMENT:ccmp1 ?= "0" TRUSTFENCE_SRK_REVOKE_MASK ?= "0x0" +TRUSTFENCE_KEY_INDEX ?= "0" # Partition encryption configuration TRUSTFENCE_ENCRYPT_PARTITIONS ?= "1" @@ -44,19 +47,42 @@ python () { d.appendVar("UBOOT_TF_CONF", "CONFIG_CONSOLE_DISABLE=y ") if d.getVar("TRUSTFENCE_CONSOLE_PASSPHRASE_ENABLE"): passphrase_hash = hashlib.sha256(d.getVar("TRUSTFENCE_CONSOLE_PASSPHRASE_ENABLE").encode()).hexdigest() - d.appendVar("UBOOT_TF_CONF", 'CONFIG_CONSOLE_ENABLE_PASSPHRASE=y CONFIG_CONSOLE_ENABLE_PASSPHRASE_KEY="%s" ' % passphrase_hash) + if (d.getVar("DEY_SOC_VENDOR") == "NXP"): + d.appendVar("UBOOT_TF_CONF", 'CONFIG_CONSOLE_ENABLE_PASSPHRASE=y CONFIG_CONSOLE_ENABLE_PASSPHRASE_KEY="%s" ' % passphrase_hash) + elif (d.getVar("DEY_SOC_VENDOR") == "STM"): + d.appendVar("UBOOT_TF_CONF", 'CONFIG_AUTOBOOT_KEYED=y CONFIG_AUTOBOOT_ENCRYPTION=y CONFIG_AUTOBOOT_STOP_STR_ENABLE=y CONFIG_AUTOBOOT_STOP_STR_SHA256="%s" ' % passphrase_hash) elif d.getVar("TRUSTFENCE_CONSOLE_GPIO_ENABLE"): - d.appendVar("UBOOT_TF_CONF", "CONFIG_CONSOLE_ENABLE_GPIO=y CONFIG_CONSOLE_ENABLE_GPIO_NR=%s " % d.getVar("TRUSTFENCE_CONSOLE_GPIO_ENABLE")) + if (d.getVar("DEY_SOC_VENDOR") == "NXP"): + d.appendVar("UBOOT_TF_CONF", "CONFIG_CONSOLE_ENABLE_GPIO=y CONFIG_CONSOLE_ENABLE_GPIO_NR=%s " % d.getVar("TRUSTFENCE_CONSOLE_GPIO_ENABLE")) + elif (d.getVar("DEY_SOC_VENDOR") == "STM"): + d.appendVar("UBOOT_TF_CONF", "CONFIG_CONSOLE_ENABLE_GPIO=y CONFIG_CONSOLE_ENABLE_GPIO_NAME=%s " % d.getVar("TRUSTFENCE_CONSOLE_GPIO_ENABLE_NAME")) # Secure boot configuration 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("DEY_SOC_VENDOR") == "NXP"): + if (d.getVar("TRUSTFENCE_DEK_PATH") == "default"): + d.setVar("TRUSTFENCE_DEK_PATH", d.getVar("TRUSTFENCE_SIGN_KEYS_PATH") + "/dek.bin"); + elif (d.getVar("DEY_SOC_VENDOR") == "STM"): + # Enable authentication capabilities on TF-A independently + # of whether the images are going to be signed by DEY or externally + d.setVar("TF_A_SIGN_ENABLE", "1") + if (d.getVar("TRUSTFENCE_SIGN") == "0"): + d.setVar("FIP_SIGN_ENABLE", "0") if (d.getVar("TRUSTFENCE_SIGN") == "1"): - d.appendVar("UBOOT_TF_CONF", "CONFIG_SIGN_IMAGE=y CONFIG_AUTH_ARTIFACTS=y ") + # Set STM-specific variables for signing images + if (d.getVar("DEY_SOC_VENDOR") == "STM"): + d.setVar("FIP_SIGN_ENABLE", "1") + d.setVar("FIP_SIGN_KEY_EXTERNAL", "1") + if (d.getVar("DIGI_SOM") == "ccmp15" ): + d.setVar("FIP_SIGN_KEY", d.getVar("TRUSTFENCE_SIGN_KEYS_PATH") + "/keys/privateKey00.pem"); + elif (d.getVar("DIGI_SOM") == "ccmp13" ): + d.setVar("FIP_SIGN_KEY", d.getVar("TRUSTFENCE_SIGN_KEYS_PATH") + "/keys/privateKey0%s.pem" % d.getVar("TRUSTFENCE_KEY_INDEX")); + d.setVar("TRUSTFENCE_PASSWORD_FILE", d.getVar("TRUSTFENCE_SIGN_KEYS_PATH") + "/keys/key_pass.txt") + + d.appendVar("UBOOT_TF_CONF", "CONFIG_SIGN_IMAGE=y ") if (d.getVar("TRUSTFENCE_READ_ONLY_ROOTFS") == "1"): d.appendVar("UBOOT_TF_CONF", "CONFIG_AUTHENTICATE_SQUASHFS_ROOTFS=y ") if d.getVar("TRUSTFENCE_SIGN_KEYS_PATH"): @@ -65,12 +91,15 @@ python () { d.appendVar("UBOOT_TF_CONF", "CONFIG_UNLOCK_SRK_REVOKE=y ") if d.getVar("TRUSTFENCE_KEY_INDEX"): d.appendVar("UBOOT_TF_CONF", "CONFIG_KEY_INDEX=%s " % d.getVar("TRUSTFENCE_KEY_INDEX")) - if (d.getVar("TRUSTFENCE_DEK_PATH") not in [None, "0"]): - d.appendVar("UBOOT_TF_CONF", 'CONFIG_DEK_PATH="%s" ' % d.getVar("TRUSTFENCE_DEK_PATH")) - if d.getVar("TRUSTFENCE_SIGN_MODE"): - d.appendVar("UBOOT_TF_CONF", 'CONFIG_SIGN_MODE="%s" ' % d.getVar("TRUSTFENCE_SIGN_MODE")) + if (d.getVar("DEY_SOC_VENDOR") == "NXP"): + d.appendVar("UBOOT_TF_CONF", "CONFIG_AUTH_ARTIFACTS=y ") + if (d.getVar("TRUSTFENCE_DEK_PATH") not in [None, "0"]): + d.appendVar("UBOOT_TF_CONF", 'CONFIG_DEK_PATH="%s" ' % d.getVar("TRUSTFENCE_DEK_PATH")) + if d.getVar("TRUSTFENCE_SIGN_MODE"): + d.appendVar("UBOOT_TF_CONF", 'CONFIG_SIGN_MODE="%s" ' % d.getVar("TRUSTFENCE_SIGN_MODE")) if (d.getVar("TRUSTFENCE_ENCRYPT_ENVIRONMENT") == "1"): - d.appendVar("UBOOT_TF_CONF", "CONFIG_ENV_AES=y CONFIG_ENV_AES_CAAM_KEY=y ") + if (d.getVar("DEY_SOC_VENDOR") == "NXP"): + d.appendVar("UBOOT_TF_CONF", "CONFIG_ENV_AES=y CONFIG_ENV_AES_CAAM_KEY=y ") # Provide sane default values for SWUPDATE class in case Trustfence is enabled if (d.getVar("TRUSTFENCE_SIGN") == "1"): @@ -87,12 +116,13 @@ python () { key_index_1 = key_index + 1 # Set the private key template, it will be expanded later in 'swu' recipes once keys are generated. - if (d.getVar("TRUSTFENCE_SIGN_MODE", "") == "AHAB"): - d.setVar("SWUPDATE_PRIVATE_KEY_TEMPLATE", keys_path + "/keys/SRK" + str(key_index_1) + "*key.pem") - d.setVar("CONFIG_SIGN_MODE", "AHAB") - else: - d.setVar("SWUPDATE_PRIVATE_KEY_TEMPLATE", keys_path + "/keys/IMG" + str(key_index_1) + "*key.pem") - d.setVar("CONFIG_SIGN_MODE", "HAB") + if (d.getVar("DEY_SOC_VENDOR") == "NXP"): + if (d.getVar("TRUSTFENCE_SIGN_MODE", "") == "AHAB"): + d.setVar("SWUPDATE_PRIVATE_KEY_TEMPLATE", keys_path + "/keys/SRK" + str(key_index_1) + "*key.pem") + d.setVar("CONFIG_SIGN_MODE", "AHAB") + else: + d.setVar("SWUPDATE_PRIVATE_KEY_TEMPLATE", keys_path + "/keys/IMG" + str(key_index_1) + "*key.pem") + d.setVar("CONFIG_SIGN_MODE", "HAB") # Set the key password. d.setVar("SWUPDATE_PASSWORD_FILE", keys_path + "/keys/key_pass.txt") diff --git a/meta-digi-dey/conf/distro/dey.conf b/meta-digi-dey/conf/distro/dey.conf index 227a01230..e6e8793e8 100644 --- a/meta-digi-dey/conf/distro/dey.conf +++ b/meta-digi-dey/conf/distro/dey.conf @@ -2,7 +2,7 @@ require conf/distro/poky.conf DISTRO = "dey" DISTRO_NAME = "Digi Embedded Yocto" -DISTRO_VERSION = "4.0-r2" +DISTRO_VERSION = "4.0-r3" SDK_VENDOR = "-deysdk" @@ -10,15 +10,16 @@ MAINTAINER = "Digi Support " TARGET_VENDOR = "-dey" -POKY_DEFAULT_DISTRO_FEATURES = "largefile opengl ptest multiarch wayland bluez5 cellular" POKY_DEFAULT_EXTRA_RDEPENDS = "packagegroup-dey-core" POKY_DEFAULT_EXTRA_RRECOMMENDS = "" -# Removed DISTRO_FEATURES -# 'wayland' -> only supported on the i.MX8 QXP -# 'ptest' -> fails to build QT5 toolchain -DISTRO_FEATURES_DEFAULT:remove = "3g nfc nfs zeroconf" -POKY_DEFAULT_DISTRO_FEATURES:remove = "ptest wayland" +# +# Rework distro features for DEY distribution +# +MACHINE_DISTRO_FEATURES_ADD ?= "" +MACHINE_DISTRO_FEATURES_REMOVE ?= "" +DISTRO_FEATURES:append = " cellular gstreamer pam ${MACHINE_DISTRO_FEATURES_ADD}" +DISTRO_FEATURES:remove = "3g nfc nfs ptest zeroconf ${MACHINE_DISTRO_FEATURES_REMOVE}" GRAPHICAL_BACKEND = "${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xwayland', \ bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', \ diff --git a/meta-digi-dey/conf/layer.conf b/meta-digi-dey/conf/layer.conf index c456ba13c..b247a724c 100644 --- a/meta-digi-dey/conf/layer.conf +++ b/meta-digi-dey/conf/layer.conf @@ -12,16 +12,20 @@ BBFILES_DYNAMIC += " \ selinux:${LAYERDIR}/dynamic-layers/selinux/*/*/*.bbappend \ freescale-layer:${LAYERDIR}/dynamic-layers/freescale-layer/*/*/*.bb \ freescale-layer:${LAYERDIR}/dynamic-layers/freescale-layer/*/*/*.bbappend \ + meta-ml:${LAYERDIR}/dynamic-layers/meta-ml/*/*/*.bb \ + meta-ml:${LAYERDIR}/dynamic-layers/meta-ml/*/*/*.bbappend \ stm-st-stm32mp:${LAYERDIR}/dynamic-layers/stm-st-stm32mp/*/*/*.bb \ stm-st-stm32mp:${LAYERDIR}/dynamic-layers/stm-st-stm32mp/*/*/*.bbappend \ + stm32mpu-ai:${LAYERDIR}/dynamic-layers/stm32mpu-ai/*/*/*.bb \ + stm32mpu-ai:${LAYERDIR}/dynamic-layers/stm32mpu-ai/*/*/*.bbappend \ qt5-layer:${LAYERDIR}/dynamic-layers/qt5-layer/*/*/*.bb \ qt5-layer:${LAYERDIR}/dynamic-layers/qt5-layer/*/*/*.bbappend \ - qt5-layer:${LAYERDIR}/dynamic-layers/qt5-layer/${DEY_BUILD_PLATFORM}/*/*/*.bb \ - qt5-layer:${LAYERDIR}/dynamic-layers/qt5-layer/${DEY_BUILD_PLATFORM}/*/*/*.bbappend \ + qt5-layer:${LAYERDIR}/dynamic-layers/qt5-layer/${DEY_SOC_VENDOR}/*/*/*.bb \ + qt5-layer:${LAYERDIR}/dynamic-layers/qt5-layer/${DEY_SOC_VENDOR}/*/*/*.bbappend \ qt6-layer:${LAYERDIR}/dynamic-layers/qt6-layer/*/*/*.bb \ qt6-layer:${LAYERDIR}/dynamic-layers/qt6-layer/*/*/*.bbappend \ - qt6-layer:${LAYERDIR}/dynamic-layers/qt6-layer/${DEY_BUILD_PLATFORM}/*/*/*.bb \ - qt6-layer:${LAYERDIR}/dynamic-layers/qt6-layer/${DEY_BUILD_PLATFORM}/*/*/*.bbappend \ + qt6-layer:${LAYERDIR}/dynamic-layers/qt6-layer/${DEY_SOC_VENDOR}/*/*/*.bb \ + qt6-layer:${LAYERDIR}/dynamic-layers/qt6-layer/${DEY_SOC_VENDOR}/*/*/*.bbappend \ " BBFILE_COLLECTIONS += "digi-dey" diff --git a/meta-digi-dey/recipes-devtools/python3-pycoral/python3-pycoral_1.0.1.bb b/meta-digi-dey/dynamic-layers/freescale-layer/recipes-devtools/python3-pycoral/python3-pycoral_1.0.1.bb similarity index 97% rename from meta-digi-dey/recipes-devtools/python3-pycoral/python3-pycoral_1.0.1.bb rename to meta-digi-dey/dynamic-layers/freescale-layer/recipes-devtools/python3-pycoral/python3-pycoral_1.0.1.bb index fd3ea2cd3..8f540fad3 100644 --- a/meta-digi-dey/recipes-devtools/python3-pycoral/python3-pycoral_1.0.1.bb +++ b/meta-digi-dey/dynamic-layers/freescale-layer/recipes-devtools/python3-pycoral/python3-pycoral_1.0.1.bb @@ -5,7 +5,7 @@ HOMEPAGE = "https://coral.ai/software/#pycoral-api" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://${S}/pycoral-1.0.1.dist-info/LICENSE;md5=d8927f3331d2b3e321b7dd1925166d25" -PYTHON_PACKAGE = "pycoral-1.0.1-cp38-cp38-linux:aarch64.whl" +PYTHON_PACKAGE = "pycoral-1.0.1-cp38-cp38-linux_aarch64.whl" SRC_URI = "git://github.com/google-coral/pycoral.git;protocol=https;branch=master" SRCREV = "d4b9f572fa3baef9d854483a171e02a6b3f9dbd0" diff --git a/meta-digi-dey/dynamic-layers/meta-ml/recipes-libraries/arm-compute-library/arm-compute-library_22.05.bbappend b/meta-digi-dey/dynamic-layers/meta-ml/recipes-libraries/arm-compute-library/arm-compute-library_22.05.bbappend new file mode 100644 index 000000000..c7e0fe2b6 --- /dev/null +++ b/meta-digi-dey/dynamic-layers/meta-ml/recipes-libraries/arm-compute-library/arm-compute-library_22.05.bbappend @@ -0,0 +1,5 @@ +# Copyright 2023 Digi International Inc. + +# The package's SConscript doesn't recognize the MAXLINELENGTH variable +# injected by scons.bbclass, so remove it +EXTRA_OESCONS:remove = "${SCONS_MAXLINELENGTH}" diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-frameworks/onnxruntime/onnxruntime_git.bbappend b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-frameworks/onnxruntime/onnxruntime_git.bbappend new file mode 100644 index 000000000..7c7a3079e --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-frameworks/onnxruntime/onnxruntime_git.bbappend @@ -0,0 +1,45 @@ +# Copyright 2023 Digi International Inc. + +do_install() { + + # Install onnxruntime dynamic library + install -d ${D}${libdir} + install -d ${D}${prefix}/local/bin/${PN}-${PVB}/tools + install -m 0644 ${B}/libonnxruntime.so ${D}${libdir}/libonnxruntime.so.${PVB} + + # This shared lib is used by onnxruntime_shared_lib_test and onnxruntime_test_python.py + install -m 644 ${B}/libcustom_op_library.so ${D}${libdir} + # And this one only by onnxruntime_test_python.py + install -m 644 ${B}/libtest_execution_provider.so ${D}${libdir} + install -m 644 ${B}/libonnxruntime_providers_shared.so ${D}${libdir}/libonnxruntime_providers_shared.so + install -m 644 ${B}/onnxruntime_pybind11_state.so ${D}${libdir}/onnxruntime_pybind11_state.so + + # Install the symlinks. + ln -sf libonnxruntime.so.${PVB} ${D}${libdir}/libonnxruntime.so.${MAJOR} + ln -sf libonnxruntime.so.${PVB} ${D}${libdir}/libonnxruntime.so + + # Digi: copy instead of moving to avoid QA errors + # Copy the onnx_test_runner executable that was installed in /usr instead of /usr/local. + cp ${B}/onnx_test_runner ${D}${prefix}/local/bin/${PN}-${PVB}/tools + + # These are not included in the base installation, so we install them manually. + install -m 755 ${B}/onnxruntime_perf_test ${D}${prefix}/local/bin/${PN}-${PVB}/tools + install -m 755 ${B}/onnxruntime_test_all ${D}${prefix}/local/bin/${PN}-${PVB}/tools + install -m 755 ${B}/onnxruntime_shared_lib_test ${D}${prefix}/local/bin/${PN}-${PVB}/tools + install -m 755 ${B}/onnxruntime_api_tests_without_env ${D}${prefix}/local/bin/${PN}-${PVB}/tools + install -m 755 ${B}/onnxruntime_global_thread_pools_test ${D}${prefix}/local/bin/${PN}-${PVB}/tools + install -m 755 ${B}/onnxruntime_test_python.py ${D}${prefix}/local/bin/${PN}-${PVB}/tools + install -m 755 ${B}/helper.py ${D}${prefix}/local/bin/${PN}-${PVB}/tools + cp -r ${B}/testdata ${D}${prefix}/local/bin/${PN}-${PVB}/tools + + # We have to change some of the RPATH as well. + chrpath -r '$ORIGIN' ${D}${prefix}/local/bin/${PN}-${PVB}/tools/onnxruntime_perf_test + chrpath -r '$ORIGIN' ${D}${prefix}/local/bin/${PN}-${PVB}/tools/onnxruntime_shared_lib_test + chrpath -r '$ORIGIN' ${D}${prefix}/local/bin/${PN}-${PVB}/tools/onnxruntime_api_tests_without_env + chrpath -r '$ORIGIN' ${D}${prefix}/local/bin/${PN}-${PVB}/tools/onnxruntime_global_thread_pools_test + chrpath -r '$ORIGIN' ${D}${libdir}/libtest_execution_provider.so + + # Install the Python package. + mkdir -p ${D}${PYTHON_SITEPACKAGES_DIR}/onnxruntime + cp -r ${B}/onnxruntime ${D}${PYTHON_SITEPACKAGES_DIR} +} diff --git a/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-st/packagegroups/packagegroup-x-linux-ai.bbappend b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-st/packagegroups/packagegroup-x-linux-ai.bbappend new file mode 100644 index 000000000..14c89c828 --- /dev/null +++ b/meta-digi-dey/dynamic-layers/stm32mpu-ai/recipes-st/packagegroups/packagegroup-x-linux-ai.bbappend @@ -0,0 +1,11 @@ +# Copyright 2023 Digi International Inc. + +RDEPENDS:packagegroup-x-linux-ai-tflite:remove:ccmp13 = " \ + tflite-cv-apps-image-classification-c++ \ + tflite-cv-apps-object-detection-c++ \ +" + +RDEPENDS:packagegroup-x-linux-ai-tflite-edgetpu:remove:ccmp13 = " \ + tflite-cv-apps-edgetpu-image-classification-c++ \ + tflite-cv-apps-edgetpu-object-detection-c++ \ +" diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-init.bb b/meta-digi-dey/recipes-connectivity/bluez/bluez5-init.bb index a6cd7ee41..f5df5aa02 100644 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-init.bb +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-init.bb @@ -1,4 +1,4 @@ -# Copyright (C) 2022, Digi International Inc. +# Copyright (C) 2022-2023, Digi International Inc. SUMMARY = "Bluetooth init scripts" LICENSE = "GPL-2.0-only" @@ -58,5 +58,8 @@ SYSTEMD_SERVICE:${PN} = "bluetooth-init.service" # 'bluetooth-init' script uses '/etc/init.d/functions' RDEPENDS:${PN} = "initscripts-functions" +# IW61x Bluetooth support requires the WiFi FW support +RDEPENDS:${PN}:append:ccimx93 = " firmware-nxp-wifi-nxpiw612" + PACKAGE_ARCH = "${MACHINE_ARCH}" -COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul|ccimx8x|ccimx8mn|ccimx8mm)" +COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul|ccimx8x|ccimx8mn|ccimx8mm|ccimx93)" diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-init/ccimx93/bluetooth-init b/meta-digi-dey/recipes-connectivity/bluez/bluez5-init/ccimx93/bluetooth-init new file mode 100644 index 000000000..54f288b76 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-init/ccimx93/bluetooth-init @@ -0,0 +1,81 @@ +#!/bin/sh +#=============================================================================== +# +# Copyright (C) 2023 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: Initialize bluetooth hardware +# +#=============================================================================== + +HCI_IFACE="hci0" + +log() { + printf "<3>iw612-bluetooth: %s\n" "${1}" >/dev/kmsg +} + +set_btaddr() { + bt_addr=$(echo $(fw_printenv -n btaddr) | awk -F ":" '{ for(i=NF;i>=1;i--) printf "0x%s ", $i }') + hcitool -i ${HCI_IFACE} cmd 0x3f 0x0022 0xfe 0x06 ${bt_addr} +} + +bluetooth_start() { + if ! [ -e "/proc/device-tree/bluetooth/mac-address" ]; then + log "[ERROR] Bluetooth mac-address not found" + return + fi + + # If there is a hciattach process running, just do nothing + pidof hciattach > /dev/null && log "Bluetooth already activated" && return + + # If port speed is 3M, assume that FW has been modified to run at that speed + if [ "$(stty -F /dev/ttyBt speed)" != "3000000" ]; then + hciattach -t5 /dev/ttyBt any 115200 flow nosleep && \ + hciconfig ${HCI_IFACE} up && \ + sleep 0.2 && \ + set_btaddr && \ + # Change rate to 3M using a custom vendor command + hcitool -i ${HCI_IFACE} cmd 0x3f 0x0009 0xc0 0xc6 0x2d 0x00 && \ + sleep 0.2 && \ + killall hciattach && \ + sleep 0.2 + fi + + hciattach -t5 /dev/ttyBt any -s 3000000 3000000 flow && \ + log "Bluetooth activated" && return + + log "[ERROR] Cannot initialize Bluetooth" + return 1 +} + +bluetooth_stop() { + if [ -e "/sys/class/bluetooth/${HCI_IFACE}" ]; then + killall hciattach > /dev/null + sleep 1 + # send a raw hci reset to set the chip in a good state + echo -e -n \\x01\\x03\\x0c\\x00 > /dev/ttyBt + fi +} + +case "$1" in + start) + bluetooth_start + ;; + stop) + bluetooth_stop + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-init/ccimx93/bluetooth-init.service b/meta-digi-dey/recipes-connectivity/bluez/bluez5-init/ccimx93/bluetooth-init.service new file mode 100644 index 000000000..9fbfc8b1e --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-init/ccimx93/bluetooth-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Initialization of the IW612 bluetooth chip +ConditionPathIsDirectory=/proc/device-tree/bluetooth +Before=bluetooth.service +After=systemd-modules-load.service + +[Service] +Type=forking +ExecStart=/etc/bluetooth-init start +ExecStop=/etc/bluetooth-init stop + +[Install] +WantedBy=bluetooth.service diff --git a/meta-digi-dey/recipes-connectivity/hostapd/hostapd/defconfig b/meta-digi-dey/recipes-connectivity/hostapd/hostapd/defconfig index 5da684480..2847e34f1 100644 --- a/meta-digi-dey/recipes-connectivity/hostapd/hostapd/defconfig +++ b/meta-digi-dey/recipes-connectivity/hostapd/hostapd/defconfig @@ -18,6 +18,9 @@ CONFIG_DRIVER_HOSTAP=y # Driver interface for drivers using the nl80211 kernel interface CONFIG_DRIVER_NL80211=y +# QCA vendor extensions to nl80211 +#CONFIG_DRIVER_NL80211_QCA=y + # driver_nl80211.c requires libnl. If you are compiling it yourself # you may need to point hostapd to your version of libnl. # @@ -41,17 +44,11 @@ CONFIG_LIBNL32=y # Driver interface for no driver (e.g., RADIUS server only) #CONFIG_DRIVER_NONE=y -# IEEE 802.11F/IAPP -CONFIG_IAPP=y - # WPA2/IEEE 802.11i RSN pre-authentication CONFIG_RSN_PREAUTH=y -# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS) -CONFIG_PEERKEY=y - -# IEEE 802.11w (management frame protection) -CONFIG_IEEE80211W=y +# Support Operating Channel Validation +#CONFIG_OCV=y # Integrated EAP server CONFIG_EAP=y @@ -105,11 +102,18 @@ CONFIG_EAP_PWD=y #CONFIG_EAP_GPSK_SHA256=y # EAP-FAST for the integrated EAP server -# Note: If OpenSSL is used as the TLS library, OpenSSL 1.0 or newer is needed -# for EAP-FAST support. Older OpenSSL releases would need to be patched, e.g., -# with openssl-0.9.8x-tls-extensions.patch, to add the needed functions. #CONFIG_EAP_FAST=y +# EAP-TEAP for the integrated EAP server +# Note: The current EAP-TEAP implementation is experimental and should not be +# enabled for production use. The IETF RFC 7170 that defines EAP-TEAP has number +# of conflicting statements and missing details and the implementation has +# vendor specific workarounds for those and as such, may not interoperate with +# any other implementation. This should not be used for anything else than +# experimentation and interoperability testing until those issues has been +# resolved. +#CONFIG_EAP_TEAP=y + # Wi-Fi Protected Setup (WPS) CONFIG_WPS=y # Enable UPnP support for external WPS Registrars @@ -138,15 +142,12 @@ CONFIG_RADIUS_SERVER=y CONFIG_IPV6=y # IEEE Std 802.11r-2008 (Fast BSS Transition) -#CONFIG_IEEE80211R=y +CONFIG_IEEE80211R=y # Use the hostapd's IEEE 802.11 authentication (ACL), but without # the IEEE 802.11 Management capability (e.g., FreeBSD/net80211) #CONFIG_DRIVER_RADIUS_ACL=y -# IEEE 802.11n (High Throughput) support -CONFIG_IEEE80211N=y - # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. #CONFIG_WNM=y @@ -154,6 +155,12 @@ CONFIG_IEEE80211N=y # IEEE 802.11ac (Very High Throughput) support CONFIG_IEEE80211AC=y +# IEEE 802.11ax HE support +# Note: This is experimental and work in progress. The definitions are still +# subject to change and this should not be expected to interoperate with the +# final IEEE 802.11ax version. +CONFIG_IEEE80211AX=y + # Remove debugging code that is printing out debug messages to stdout. # This can be used to reduce the size of the hostapd considerably if debugging # code is not needed. @@ -163,6 +170,9 @@ CONFIG_IEEE80211AC=y # Disabled by default. CONFIG_DEBUG_FILE=y +# Send debug messages to syslog instead of stdout +#CONFIG_DEBUG_SYSLOG=y + # Add support for sending all debug messages (regardless of debug verbosity) # to the Linux kernel tracing facility. This helps debug the entire stack by # making it easy to record everything happening from the driver up into the @@ -240,10 +250,25 @@ CONFIG_DEBUG_FILE=y # requirements described above. #CONFIG_NO_RANDOM_POOL=y +# Should we attempt to use the getrandom(2) call that provides more reliable +# yet secure randomness source than /dev/random on Linux 3.17 and newer. +# Requires glibc 2.25 to build, falls back to /dev/random if unavailable. +#CONFIG_GETRANDOM=y + +# Should we use poll instead of select? Select is used by default. +#CONFIG_ELOOP_POLL=y + +# Should we use epoll instead of select? Select is used by default. +#CONFIG_ELOOP_EPOLL=y + +# Should we use kqueue instead of select? Select is used by default. +#CONFIG_ELOOP_KQUEUE=y + # Select TLS implementation # openssl = OpenSSL (default) # gnutls = GnuTLS # internal = Internal TLSv1 implementation (experimental) +# linux = Linux kernel AF_ALG and internal TLSv1 implementation (experimental) # none = Empty template #CONFIG_TLS=openssl @@ -256,6 +281,10 @@ CONFIG_DEBUG_FILE=y # can be enabled to enable use of stronger crypto algorithms. #CONFIG_TLSV12=y +# Select which ciphers to use by default with OpenSSL if the user does not +# specify them. +#CONFIG_TLS_DEFAULT_CIPHERS="DEFAULT:!EXP:!LOW" + # If CONFIG_TLS=internal is used, additional library and include paths are # needed for LibTomMath. Alternatively, an integrated, minimal version of # LibTomMath can be used. See beginning of libtommath.c for details on benefits @@ -283,6 +312,12 @@ CONFIG_DEBUG_FILE=y # Enable SQLite database support in hlr_auc_gw, EAP-SIM DB, and eap_user_file #CONFIG_SQLITE=y +# Enable Fast Session Transfer (FST) +#CONFIG_FST=y + +# Enable CLI commands for FST testing +#CONFIG_FST_TEST=y + # Testing options # This can be used to enable some testing options (see also the example # configuration file) that are really useful only for testing clients that @@ -311,6 +346,74 @@ CONFIG_DEBUG_FILE=y # * ath10k # # For more details refer to: -# http://wireless.kernel.org/en/users/Documentation/acs +# https://wireless.wiki.kernel.org/en/users/documentation/acs # -#CONFIG_ACS=y +CONFIG_ACS=y + +# Multiband Operation support +# These extensions facilitate efficient use of multiple frequency bands +# available to the AP and the devices that may associate with it. +#CONFIG_MBO=y + +# Client Taxonomy +# Has the AP retain the Probe Request and (Re)Association Request frames from +# a client, from which a signature can be produced which can identify the model +# of client device like "Nexus 6P" or "iPhone 5s". +#CONFIG_TAXONOMY=y + +# Fast Initial Link Setup (FILS) (IEEE 802.11ai) +#CONFIG_FILS=y +# FILS shared key authentication with PFS +#CONFIG_FILS_SK_PFS=y + +# Include internal line edit mode in hostapd_cli. This can be used to provide +# limited command line editing and history support. +#CONFIG_WPA_CLI_EDIT=y + +# Opportunistic Wireless Encryption (OWE) +# Experimental implementation of draft-harkins-owe-07.txt +#CONFIG_OWE=y + +# Airtime policy support +#CONFIG_AIRTIME_POLICY=y + +# Override default value for the wpa_disable_eapol_key_retries configuration +# parameter. See that parameter in hostapd.conf for more details. +#CFLAGS += -DDEFAULT_WPA_DISABLE_EAPOL_KEY_RETRIES=1 + +# Wired equivalent privacy (WEP) +# WEP is an obsolete cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used for anything anymore. The +# functionality needed to use WEP is available in the current hostapd +# release under this optional build parameter. This functionality is subject to +# be completely removed in a future release. +#CONFIG_WEP=y + +# Remove all TKIP functionality +# TKIP is an old cryptographic data confidentiality algorithm that is not +# considered secure. It should not be used anymore. For now, the default hostapd +# build includes this to allow mixed mode WPA+WPA2 networks to be enabled, but +# that functionality is subject to be removed in the future. +#CONFIG_NO_TKIP=y + +# Pre-Association Security Negotiation (PASN) +# Experimental implementation based on IEEE P802.11z/D2.6 and the protocol +# design is still subject to change. As such, this should not yet be enabled in +# production use. +# This requires CONFIG_IEEE80211W=y to be enabled, too. +#CONFIG_PASN=y + +# Device Provisioning Protocol (DPP) (also known as Wi-Fi Easy Connect) +CONFIG_DPP=y +# DPP version 2 support +CONFIG_DPP2=y +# DPP version 3 support (experimental and still changing; do not enable for +# production use) +#CONFIG_DPP3=y + + +# CUSTOM CONFIG +CONFIG_SAE=y +CONFIG_SAE_PK=y +CONFIG_SUITEB=y +CONFIG_SUITEB192=y diff --git a/meta-digi-dey/recipes-connectivity/hostapd/hostapd/hostapd_uap0.conf b/meta-digi-dey/recipes-connectivity/hostapd/hostapd/hostapd_uap0.conf new file mode 100644 index 000000000..860aa6dc5 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/hostapd/hostapd/hostapd_uap0.conf @@ -0,0 +1,42 @@ +ctrl_interface=/var/run/hostapd +ctrl_interface_group=0 +interface=uap0 +driver=nl80211 + +# SSID to identify the network +ssid=ap-uap0-##MAC## + +# 802.11a (5 GHz) mode +hw_mode=a + +# Set the channel to use. If 0 (ACS), channel will be automatically selected +channel=44 + +# IEEE 802.11i, WPA2 encryption with PSK authentication +auth_algs=1 +wpa=2 +wpa_key_mgmt=WPA-PSK +wpa_pairwise=CCMP +wpa_passphrase=password-wpa2aes + +# Uncomment to enable WPA3-SAE authentication +# wpa_key_mgmt=WPA-PSK SAE +# sae_password=password-wpa3sae + +# IEEE 802.11n (Wi-Fi 4) features +ieee80211n=1 +ht_capab=[HT20][HT40+][HT40-][SHORT-GI-20][SHORT-GI-40] + +# IEEE 802.11ac (Wi-Fi 5) features +ieee80211ac=1 +vht_oper_chwidth=0 +vht_capab=[SHORT-GI-80] + +# IEEE 802.11ax (Wi-Fi 6) features +ieee80211ax=1 +he_su_beamformer=1 +he_su_beamformee=1 + +# IEEE 802.11d (country information) +ieee80211d=1 +country_code=US diff --git a/meta-digi-dey/recipes-connectivity/hostapd/hostapd_%.bbappend b/meta-digi-dey/recipes-connectivity/hostapd/hostapd_%.bbappend index 67e1fb75a..f3609e60c 100644 --- a/meta-digi-dey/recipes-connectivity/hostapd/hostapd_%.bbappend +++ b/meta-digi-dey/recipes-connectivity/hostapd/hostapd_%.bbappend @@ -8,6 +8,10 @@ SRC_URI:append = " \ ${@oe.utils.conditional('HAS_WIFI_VIRTWLANS', 'true', 'file://hostapd_wlan1.conf', '', d)} \ " +SRC_URI:append:ccimx93 = " \ + file://hostapd_uap0.conf \ +" + # Patch series from Murata release MURATA_COMMON_PATCHES = " \ file://murata/0003-nl80211-Report-connection-authorized-in-EVENT_ASSOC.patch \ @@ -53,23 +57,33 @@ SYSTEMD_SERVICE:${PN}:append = " hostapd@.service" do_install:append() { # Remove the default hostapd.conf - rm -f ${WORKDIR}/hostapd.conf - # Install custom hostapd_IFACE.conf file - install -m 0644 ${WORKDIR}/hostapd_wlan0.conf ${D}${sysconfdir} + rm -f ${D}${sysconfdir}/hostapd.conf + + # Install custom hostapd_IFACE.conf files + add_hostapd_files + # Install interface-specific systemd service install -m 0644 ${WORKDIR}/hostapd@.service ${D}${systemd_unitdir}/system/ sed -i -e 's,@SBINDIR@,${sbindir},g' -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/hostapd@.service + # Read-only rootfs: actions that substitute postinst script + # - append the ${DIGI_SOM} string to SSID + if [ -n "${@bb.utils.contains('IMAGE_FEATURES', 'read-only-rootfs', '1', '', d)}" ]; then + sed -i -e "s,##MAC##,${DIGI_SOM},g" ${D}${sysconfdir}/hostapd_*.conf + fi +} + +add_hostapd_files() { + install -m 0644 ${WORKDIR}/hostapd_wlan0.conf ${D}${sysconfdir} + if ${HAS_WIFI_VIRTWLANS}; then # Install custom hostapd_IFACE.conf file install -m 0644 ${WORKDIR}/hostapd_wlan1.conf ${D}${sysconfdir} fi +} - # Read-only rootfs: actions that substitute postinst script - # - append the ${DIGI_FAMILY} string to SSID - if [ -n "${@bb.utils.contains('IMAGE_FEATURES', 'read-only-rootfs', '1', '', d)}" ]; then - sed -i -e "s,##MAC##,${DIGI_FAMILY},g" ${D}${sysconfdir}/hostapd_wlan?.conf - fi +add_hostapd_files:ccimx93() { + install -m 0644 ${WORKDIR}/hostapd_uap0.conf ${D}${sysconfdir} } pkg_postinst_ontarget:${PN}() { @@ -84,7 +98,7 @@ pkg_postinst_ontarget:${PN}() { # Get the last two bytes of the wlan0 MAC address MAC="$(dd conv=swab if=/proc/device-tree/wireless/mac-address 2>/dev/null | hexdump | head -n 1 | cut -d ' ' -f 4)" - find "${sysconfdir}" -type f -name 'hostapd_wlan?.conf' -exec \ + find "${sysconfdir}" -type f -name 'hostapd_*.conf' -exec \ sed -i -e "s,##MAC##,${MAC},g" {} \; # Do not autostart hostapd daemon, it will conflict with wpa-supplicant. diff --git a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/NetworkManager.conf b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/NetworkManager.conf index 82107e5e8..e79beed5b 100644 --- a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/NetworkManager.conf +++ b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/NetworkManager.conf @@ -8,7 +8,7 @@ rc-manager=file managed=false [keyfile] -unmanaged-devices=interface-name:p2p*;interface-name:wlan1 +unmanaged-devices=##UNMANAGED_DEVICES## [device] wifi.scan-rand-mac-address=no diff --git a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager_%.bbappend b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager_%.bbappend index 8c594c368..8614945d7 100644 --- a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager_%.bbappend +++ b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager_%.bbappend @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2019, Digi International Inc. +# Copyright (C) 2017-2023, Digi International Inc. FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" @@ -41,6 +41,9 @@ ETH0_STATIC_CIDR = "${@ipaddr_to_cidr('eth0', d)}" ETH1_STATIC_CIDR = "${@ipaddr_to_cidr('eth1', d)}" WLAN0_STATIC_CIDR = "${@ipaddr_to_cidr('wlan0', d)}" +UNMANAGED_DEVICES = "interface-name:p2p*;interface-name:wlan1" +UNMANAGED_DEVICES:ccimx93 = "interface-name:p2p-wfd0-0;interface-name:wfd0;interface-name:uap0" + inherit update-rc.d do_install:append() { @@ -48,6 +51,11 @@ do_install:append() { install -m 0644 ${WORKDIR}/NetworkManager.conf ${D}${sysconfdir}/NetworkManager/ install -m 0755 ${WORKDIR}/networkmanager-init ${D}${sysconfdir}/init.d/networkmanager + # + # Customize NetworkManager + # + sed -i -e "s,##UNMANAGED_DEVICES##,${UNMANAGED_DEVICES},g" ${D}${sysconfdir}/NetworkManager/NetworkManager.conf + # # Connections config files # diff --git a/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/ccimx93/wpa_supplicant_p2p.conf b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/ccimx93/wpa_supplicant_p2p.conf new file mode 100644 index 000000000..2d5c60e12 --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/ccimx93/wpa_supplicant_p2p.conf @@ -0,0 +1,4 @@ +ctrl_interface=/var/run/wpa_supplicant +device_name=##WLAN_P2P_DEVICE_NAME## +config_methods=display keypad push_button +persistent_reconnect=1 diff --git a/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/defconfig b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/defconfig index ea38c2dbb..3c6cc532a 100644 --- a/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/defconfig +++ b/meta-digi-dey/recipes-connectivity/wpa-supplicant/wpa-supplicant/defconfig @@ -476,7 +476,7 @@ CONFIG_IEEE80211R=y #CONFIG_GETRANDOM=y # IEEE 802.11ac (Very High Throughput) support (mainly for AP mode) -#CONFIG_IEEE80211AC=y +CONFIG_IEEE80211AC=y # Wireless Network Management (IEEE Std 802.11v-2011) # Note: This is experimental and not complete implementation. @@ -489,7 +489,7 @@ CONFIG_IEEE80211R=y #CONFIG_INTERWORKING=y # Hotspot 2.0 -#CONFIG_HS20=y +CONFIG_HS20=y # Enable interface matching in wpa_supplicant #CONFIG_MATCH_IFACE=y diff --git a/meta-digi-dey/recipes-core/busybox/busybox/ccimx93/standby-actions b/meta-digi-dey/recipes-core/busybox/busybox/ccimx93/standby-actions new file mode 100644 index 000000000..154b40520 --- /dev/null +++ b/meta-digi-dey/recipes-core/busybox/busybox/ccimx93/standby-actions @@ -0,0 +1,60 @@ +#!/bin/sh +#=============================================================================== +# +# standby-actions +# +# Copyright (C) 2023 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: manage interfaces before suspending and after resuming from +# suspend +# +#=============================================================================== + +RESUME_ACTIONS="/tmp/resume_actions" + +actions_needed() { + [ -d "/proc/device-tree/wireless" ] && [ ! -e "/sys/firmware/devicetree/base/soc@0/bus@42800000/mmc@428b0000/keep-power-in-suspend" ] +} + +if [ "${1}" = "pre" ]; then + # Stop NetworkManager before suspend + systemctl stop NetworkManager + + if actions_needed; then + rm -f "${RESUME_ACTIONS}" + for iface in wlan0 uap0 wfd0; do + if grep -qs ${iface} /var/run/ifstate; then + ifdown ${iface} && echo "ifup ${iface}" >> "${RESUME_ACTIONS}" + fi + done + + rmmod moal + rmmod mlan + + if systemctl is-active bluetooth-init; then + # + # bluetooth service relies on bluetooth-init service, so stop/start it unconditionally + echo "systemctl start bluetooth-init" >> "${RESUME_ACTIONS}" + echo "systemctl start bluetooth" >> "${RESUME_ACTIONS}" + systemctl stop bluetooth-init + systemctl stop bluetooth + stty -F /dev/ttyBt 115200 + fi + fi +elif [ "${1}" = "post" ]; then + if actions_needed; then + /etc/udev/scripts/load_iw612.sh + sleep 0.5 + sh "${RESUME_ACTIONS}" + rm -f "${RESUME_ACTIONS}" + fi + + # Resume NetworkManager after suspend + systemctl start NetworkManager +fi diff --git a/meta-digi-dey/recipes-core/images/core-image-base.bbappend b/meta-digi-dey/recipes-core/images/core-image-base.bbappend index 6c80f4633..35bb8daf0 100644 --- a/meta-digi-dey/recipes-core/images/core-image-base.bbappend +++ b/meta-digi-dey/recipes-core/images/core-image-base.bbappend @@ -27,6 +27,3 @@ SDKIMAGE_FEATURES ?= "dev-pkgs dbg-pkgs staticdev-pkgs" # Add our dey-image tweaks to the final image (like /etc/build info) inherit dey-image - -# Do not install udev-cache -BAD_RECOMMENDATIONS += "udev-cache" diff --git a/meta-digi-dey/recipes-core/images/dey-image-aws.bb b/meta-digi-dey/recipes-core/images/dey-image-aws.bb index e8dd13c65..6d53eb9f0 100644 --- a/meta-digi-dey/recipes-core/images/dey-image-aws.bb +++ b/meta-digi-dey/recipes-core/images/dey-image-aws.bb @@ -27,6 +27,3 @@ inherit core-image inherit dey-image IMAGE_ROOTFS_SIZE = "8192" - -# Do not install udev-cache -BAD_RECOMMENDATIONS += "udev-cache" diff --git a/meta-digi-dey/recipes-core/images/dey-image-graphical.inc b/meta-digi-dey/recipes-core/images/dey-image-graphical.inc index de593a3ea..2856563ec 100644 --- a/meta-digi-dey/recipes-core/images/dey-image-graphical.inc +++ b/meta-digi-dey/recipes-core/images/dey-image-graphical.inc @@ -42,8 +42,6 @@ CONFLICT_DISTRO_FEATURES = "directfb" IMAGE_ROOTFS_SIZE = "8192" -# Do not install udev-cache -BAD_RECOMMENDATIONS += "udev-cache" BAD_RECOMMENDATIONS += "eudev-hwdb" export IMAGE_BASENAME = "dey-image-${GRAPHICAL_CORE}-${GRAPHICAL_BACKEND}" diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx93/interfaces.br0.example b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx93/interfaces.br0.example new file mode 100644 index 000000000..6cfe96a72 --- /dev/null +++ b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx93/interfaces.br0.example @@ -0,0 +1,8 @@ + +## Example bridge between eth0 and uap0 (NXP IW612) +#auto br0 +#iface br0 inet static +# bridge_ports eth0 uap0 +# address 192.168.42.50 +# netmask 255.255.255.0 +# pre-up [ -d /proc/device-tree/wireless ] diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx93/interfaces.wlan1.dhcp b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx93/interfaces.wlan1.dhcp new file mode 100644 index 000000000..d4aa85741 --- /dev/null +++ b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx93/interfaces.wlan1.dhcp @@ -0,0 +1,8 @@ + +# Wi-Fi AP interface (NXP IW612) +#auto uap0 +iface uap0 inet dhcp + udhcpc_opts -S -b >/dev/null & + pre-up [ -d /proc/device-tree/wireless ] + post-up ##WLAN1_POST_UP_ACTION## + pre-down ##WLAN1_PRE_DOWN_ACTION## diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx93/interfaces.wlan1.static b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx93/interfaces.wlan1.static new file mode 100644 index 000000000..881f8a47b --- /dev/null +++ b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/ccimx93/interfaces.wlan1.static @@ -0,0 +1,11 @@ + +# Wi-Fi AP interface (NXP IW612) +#auto uap0 +iface uap0 inet static + address ##WLAN1_STATIC_IP## + netmask ##WLAN1_STATIC_NETMASK## + gateway ##WLAN1_STATIC_GATEWAY## + dns-nameservers ##WLAN1_STATIC_DNS## + pre-up [ -d /proc/device-tree/wireless ] + post-up ##WLAN1_POST_UP_ACTION## + pre-down ##WLAN1_PRE_DOWN_ACTION## diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.br0.example b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.br0.example index 1a0ffdf42..b04f821dc 100644 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.br0.example +++ b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.br0.example @@ -1,5 +1,5 @@ -## Example bridge between eth0 and wlan1 (Qualcomm QCA65x4) +## Example bridge between eth0 and wlan1 #auto br0 #iface br0 inet static # bridge_ports eth0 wlan1 diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.wlan1.dhcp b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.wlan1.dhcp index cc42c3377..1e62cc561 100644 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.wlan1.dhcp +++ b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.wlan1.dhcp @@ -1,5 +1,5 @@ -# Wi-Fi AP interface (Qualcomm QCA65x4) +# Wi-Fi AP interface #auto wlan1 iface wlan1 inet dhcp udhcpc_opts -S -b >/dev/null & diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.wlan1.static b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.wlan1.static index 35f5b29c6..cbdf15510 100644 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.wlan1.static +++ b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces.wlan1.static @@ -1,5 +1,5 @@ -# Wi-Fi AP interface (Qualcomm QCA65x4) +# Wi-Fi AP interface #auto wlan1 iface wlan1 inet static address ##WLAN1_STATIC_IP## diff --git a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/virtwlans b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/virtwlans index c508c50c8..622d105f8 100644 --- a/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/virtwlans +++ b/meta-digi-dey/recipes-core/init-ifupdown/init-ifupdown-1.0/virtwlans @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2017-2019, Digi International Inc. +# Copyright (c) 2017-2023, Digi International Inc. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this @@ -17,7 +17,7 @@ [ "$IFACE" = "wlan1" ] || exit 0 -if [ "$MODE" = "start" ]; then +check_virtual_wlan_macs() { # Check for default MAC addresses if [ -s "/proc/device-tree/wireless/mac-address1" ] && [ -s "/proc/device-tree/wireless/mac-address2" ] && @@ -26,6 +26,13 @@ if [ "$MODE" = "start" ]; then else echo "[WARN] Using default MAC addresses for virtual interfaces, please program them referring to the Digi U-Boot Documentation" fi +} + +if [ "$MODE" = "start" ]; then + # On ccmp1, there are not virtual wireless MACs, so skip the verification. + if ! grep -qs '\' /proc/device-tree/compatible; then + check_virtual_wlan_macs + fi if [ ! -d "/sys/class/net/wlan1" ]; then # This will create a second wireless network device 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 c32ce9f4a..c5d6ca29d 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 @@ -1,4 +1,4 @@ -# Copyright (C) 2013-2021 Digi International Inc. +# Copyright (C) 2013-2023 Digi International Inc. FILESEXTRAPATHS:prepend := "${THISDIR}/${BP}:" @@ -83,17 +83,23 @@ install_virtwlans() { ln -s ../if-pre-up.d/virtwlans ${D}${sysconfdir}/network/if-post-down.d/virtwlans } +install_virtwlans:ccimx93() { + # Skip + : +} + WLAN1_POST_UP_ACTION = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemctl start hostapd@wlan1.service', '/etc/init.d/hostapd start', d)}" WLAN1_PRE_DOWN_ACTION = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemctl stop hostapd@wlan1.service', '/etc/init.d/hostapd stop', d)}" +WLAN1_POST_UP_ACTION:ccimx93 = "systemctl start hostapd@uap0.service" +WLAN1_PRE_DOWN_ACTION:ccimx93 = "systemctl stop hostapd@uap0.service" + install_wlan1() { - if [ -n "${HAVE_WIFI}" ]; then - cat ${WORKDIR}/interfaces.wlan1.${WLAN1_MODE} >> ${D}${sysconfdir}/network/interfaces - if [ "${MACHINE}" = "ccimx6sbc" ]; then - cat ${WORKDIR}/interfaces.wlan1.atheros.${WLAN1_MODE} >> ${D}${sysconfdir}/network/interfaces - fi - [ -n "${WLAN1_AUTO}" ] && sed -i -e 's/^#auto wlan1/auto wlan1/g' ${D}${sysconfdir}/network/interfaces + cat ${WORKDIR}/interfaces.wlan1.${WLAN1_MODE} >> ${D}${sysconfdir}/network/interfaces + if [ "${MACHINE}" = "ccimx6sbc" ]; then + cat ${WORKDIR}/interfaces.wlan1.atheros.${WLAN1_MODE} >> ${D}${sysconfdir}/network/interfaces fi + [ -n "${WLAN1_AUTO}" ] && sed -i -e 's/^#auto wlan1/auto wlan1/g' ${D}${sysconfdir}/network/interfaces # Remove config entries if corresponding variable is not defined [ -z "${WLAN1_STATIC_DNS}" ] && sed -i -e "/##WLAN1_STATIC_DNS##/d" ${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 20a1a6e4c..4692b509c 100644 --- a/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb +++ b/meta-digi-dey/recipes-core/packagegroups/packagegroup-dey-core.bb @@ -37,7 +37,7 @@ RDEPENDS:${PN} = "\ base-files \ base-passwd \ connectcore-demo-example \ - cloudconnector \ + ${CLOUDCONNECTOR_PKG} \ dualboot \ ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'firmwared', '',d)} \ ${@bb.utils.contains("MACHINE_FEATURES", "keyboard", "${VIRTUAL-RUNTIME_keymaps}", "", d)} \ diff --git a/meta-digi-dey/recipes-core/recovery/recovery-initramfs.bb b/meta-digi-dey/recipes-core/recovery/recovery-initramfs.bb index 03e121515..7b2a395fe 100644 --- a/meta-digi-dey/recipes-core/recovery/recovery-initramfs.bb +++ b/meta-digi-dey/recipes-core/recovery/recovery-initramfs.bb @@ -1,10 +1,16 @@ -# Copyright (C) 2016, 2017 Digi International Inc. +# Copyright (C) 2016-2023 Digi International Inc. SUMMARY = "Recovery initramfs files" LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" -DEPENDS += "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', 'openssl-native trustfence-cst-native', '', d)}" +SOC_SIGN_DEPENDS = " \ + ${@oe.utils.conditional('DEY_SOC_VENDOR', 'NXP', 'trustfence-cst-native', '', d)} \ +" +DEPENDS += "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', \ + 'openssl-native ' \ + 'trustfence-sign-tools-native ' \ + '${SOC_SIGN_DEPENDS}', '', d)}" SRC_URI = " \ file://recovery-initramfs-init \ @@ -34,8 +40,6 @@ do_install() { # If Trustfence is enabled, copy the public key that is going to be used into the # initramfs '/etc/ssl/certs' folder in order to verify swupdate packages. if [ "${TRUSTFENCE_SIGN}" = "1" ]; then - # Check and generate a PKI tree if there isn't one - check_gen_pki_tree # Retrieve the key index to use. KEY_INDEX="0" if [ -n "${TRUSTFENCE_KEY_INDEX}" ]; then @@ -44,18 +48,31 @@ do_install() { KEY_INDEX_1=$(expr ${KEY_INDEX} + 1) # Find the certificate to use. - if [ "${TRUSTFENCE_SIGN_MODE}" = "HAB" ]; then - CERT_IMG="$(echo ${TRUSTFENCE_SIGN_KEYS_PATH}/crts/IMG${KEY_INDEX_1}*crt.pem)" - elif [ "${TRUSTFENCE_SIGN_MODE}" = "AHAB" ]; then - CERT_IMG="$(echo ${TRUSTFENCE_SIGN_KEYS_PATH}/crts/SRK${KEY_INDEX_1}*_ca_crt.pem)" - else - bberror "Unkown TRUSTFENCE_SIGN_MODE value" - exit 1 + if [ "${DEY_SOC_VENDOR}" = "NXP" ]; then + if [ "${TRUSTFENCE_SIGN_MODE}" = "HAB" ]; then + CERT_IMG="$(echo ${TRUSTFENCE_SIGN_KEYS_PATH}/crts/IMG${KEY_INDEX_1}*crt.pem)" + elif [ "${TRUSTFENCE_SIGN_MODE}" = "AHAB" ]; then + CERT_IMG="$(echo ${TRUSTFENCE_SIGN_KEYS_PATH}/crts/SRK${KEY_INDEX_1}*_ca_crt.pem)" + else + bberror "Unkown TRUSTFENCE_SIGN_MODE value" + exit 1 + fi + # Extract the public key from the certificate. + install -d ${D}${sysconfdir}/ssl/certs + openssl x509 -pubkey -noout -in "${CERT_IMG}" > ${D}${sysconfdir}/ssl/certs/key.pub + elif [ "${DEY_SOC_VENDOR}" = "STM" ]; then + # Copy the public key to the rootfs + if [ "${DIGI_SOM}" = "ccmp15" ]; then + PUBLIC_KEY="${TRUSTFENCE_SIGN_KEYS_PATH}/keys/publicKey00.pem" + elif [ "${DIGI_SOM}" = "ccmp13" ]; then + PUBLIC_KEY="${TRUSTFENCE_SIGN_KEYS_PATH}/keys/publicKey0${KEY_INDEX}.pem" + else + bberror "Unknown DIGI_SOM" + exit 1 + fi + install -d ${D}${sysconfdir}/ssl/certs + cp ${PUBLIC_KEY} ${D}${sysconfdir}/ssl/certs/key.pub fi - - # Extract the public key from the certificate. - install -d ${D}${sysconfdir}/ssl/certs - openssl x509 -pubkey -noout -in "${CERT_IMG}" > ${D}${sysconfdir}/ssl/certs/key.pub fi } diff --git a/meta-digi-dey/recipes-devtools/e2fsprogs/e2fsprogs_%.bbappend b/meta-digi-dey/recipes-devtools/e2fsprogs/e2fsprogs_%.bbappend new file mode 100644 index 000000000..da082ff86 --- /dev/null +++ b/meta-digi-dey/recipes-devtools/e2fsprogs/e2fsprogs_%.bbappend @@ -0,0 +1,39 @@ +# Copyright (C) 2023 Digi International. + +pkg_postinst_ontarget:${PN}-mke2fs() { + get_emmc_block_device() { + for emmc_number in $(seq 0 9); do + if [ -b "/dev/mmcblk${emmc_number}" ] && + [ -b "/dev/mmcblk${emmc_number}boot0" ] && + [ -b "/dev/mmcblk${emmc_number}boot1" ] && + [ -c "/dev/mmcblk${emmc_number}rpmb" ]; then + echo "/dev/mmcblk${emmc_number}" + break + fi + done + } + + get_emmc_data_device() { + local EMMC_BLOCK_DEVICE="$(get_emmc_block_device)" + if [ -n "${EMMC_BLOCK_DEVICE}" ]; then + local DATA_DEVICE="$(blkid ${EMMC_BLOCK_DEVICE}p* | sed -ne "{s,\(^${EMMC_BLOCK_DEVICE}[^:]\+\):.*PARTLABEL=\"data\".*,\1,g;T;p}" | sort -u)" + [ -n "${DATA_DEVICE}" ] && echo "${DATA_DEVICE}" + fi + } + + # Format and mount 'data' partition in block system based devices only if it has no format. + EMMC_DATA_DEVICE="$(get_emmc_data_device)" + if [ -n "${EMMC_DATA_DEVICE}" ] && ! blkid ${EMMC_DATA_DEVICE} | grep -q "TYPE="; then + # Format the partition. + echo "WARNING: 'data' partition has no format or it is invalid. Formatting..." + if ! mkfs.ext4 "${EMMC_DATA_DEVICE}"; then + echo "ERROR: Could not format 'data' partition" + else + # Trigger 'add' event for the partition. + echo -n add > "/sys/class/block/${EMMC_DATA_DEVICE##*/}/uevent" + fi + fi +} + +REMOVE_POSTINST_RPN = "${PN}-mke2fs" +inherit ${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "remove-pkg-postinst-ontarget", "", d)} diff --git a/meta-digi-dey/recipes-devtools/python/python3-pyelftools_%.bbappend b/meta-digi-dey/recipes-devtools/python/python3-pyelftools_%.bbappend new file mode 100644 index 000000000..fff2b192d --- /dev/null +++ b/meta-digi-dey/recipes-devtools/python/python3-pyelftools_%.bbappend @@ -0,0 +1,3 @@ +# Copyright (c) 2023, Digi International Inc. + +BBCLASSEXTEND += "nativesdk" diff --git a/meta-digi-dey/recipes-devtools/python3-scipy/python3-scipy_1.7.0.bb b/meta-digi-dey/recipes-devtools/python3-scipy/python3-scipy_1.7.0.bb index 7253ab6ff..baa69a763 100644 --- a/meta-digi-dey/recipes-devtools/python3-scipy/python3-scipy_1.7.0.bb +++ b/meta-digi-dey/recipes-devtools/python3-scipy/python3-scipy_1.7.0.bb @@ -4,7 +4,7 @@ HOMEPAGE = "https://www.scipy.org" LICENSE = "BSD-3-Clause" LIC_FILES_CHKSUM = "file://${S}/scipy-1.7.0.dist-info/LICENSE.txt;md5=caecddab96f03de0092b62333ea77f91" -PYTHON_PACKAGE = "scipy-1.7.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014:aarch64.whl" +PYTHON_PACKAGE = "scipy-1.7.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl" SRC_URI = "https://files.pythonhosted.org/packages/d0/8d/3dbb59d78218b6a76f1ddb55db60ea5459fa7968655acb21252a59a10bc3/${PYTHON_PACKAGE};subdir=${BP}" SRC_URI[md5sum] = "e2e369078c6b7ca29c952cb9971bc154" diff --git a/meta-digi-dey/recipes-devtools/run-postinsts/run-postinsts_%.bbappend b/meta-digi-dey/recipes-devtools/run-postinsts/run-postinsts_%.bbappend deleted file mode 100644 index 5c0ba6ecc..000000000 --- a/meta-digi-dey/recipes-devtools/run-postinsts/run-postinsts_%.bbappend +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (C) 2022 Digi International - -do_install:append() { - # Add ordering dependency between postinsts and ldconfig service - sed -i -e '/After=/ s/$/ ldconfig.service/' \ - ${D}${systemd_system_unitdir}/run-postinsts.service -} diff --git a/meta-digi-dey/recipes-digi/cloudconnector/cloudconnector_git.bb b/meta-digi-dey/recipes-digi/cloudconnector/cloudconnector_git.bb index fc9183416..2ddc74bb4 100644 --- a/meta-digi-dey/recipes-digi/cloudconnector/cloudconnector_git.bb +++ b/meta-digi-dey/recipes-digi/cloudconnector/cloudconnector_git.bb @@ -41,14 +41,7 @@ do_install() { do_install:append:ccimx6ul() { sed -i "/url = \"edp12.devicecloud.com\"/c\url = \"remotemanager.digi.com\"" ${D}${sysconfdir}/cc.conf -} - -do_install:append:ccimx8m() { - sed -i "/url = \"edp12.devicecloud.com\"/c\url = \"remotemanager.digi.com\"" ${D}${sysconfdir}/cc.conf -} - -do_install:append:ccmp1() { - sed -i "/client_cert_path = \"\/etc\/ssl\/certs\/drm_cert.pem\"/c\client_cert_path = \"\/mnt\/data\/drm_cert.pem\"" ${D}${sysconfdir}/cc.conf + sed -i "/client_cert_path = \"\/mnt\/data\/drm_cert.pem\"/c\client_cert_path = \"\/etc\/ssl\/certs\/drm_cert.pem\"" ${D}${sysconfdir}/cc.conf } pkg_postinst_ontarget:${PN}() { diff --git a/meta-digi-dey/recipes-digi/dey-examples/connectcore-demo-example/connectcore-demo-server.service b/meta-digi-dey/recipes-digi/dey-examples/connectcore-demo-example/connectcore-demo-server.service index 9d38970ec..251e9bf1d 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/connectcore-demo-example/connectcore-demo-server.service +++ b/meta-digi-dey/recipes-digi/dey-examples/connectcore-demo-example/connectcore-demo-server.service @@ -1,6 +1,6 @@ [Unit] Description=Initialization of ConnectCore demo server -After=busybox-httpd.service +After=busybox-httpd.service bluetooth.service [Service] Type=forking diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/Makefile b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/Makefile index ac22dafcb..068457973 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/Makefile +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/Makefile @@ -1,18 +1,21 @@ -# -# Copyright (c) 2017, Digi International Inc. +# *************************************************************************** +# Copyright (c) 2017-2023 Digi International Inc. # # This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, you can obtain one at http://mozilla.org/MPL/2.0/. +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. # -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. # +# Digi International Inc., 9350 Excelsior Blvd., Suite 700, Hopkins, MN 55343 +# +# *************************************************************************** PROGRAM := device_request_listener diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/device_request.c b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/device_request.c index cf74e209e..992a73f30 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/device_request.c +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/device_request.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Digi International Inc. + * Copyright (c) 2017-2023 Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, @@ -13,8 +13,8 @@ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * - * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 - * ======================================================================= + * Digi International Inc., 9350 Excelsior Blvd., Suite 700, Hopkins, MN 55343 + * =========================================================================== */ #include @@ -24,8 +24,6 @@ #include "device_request.h" -#define MAX_RESPONSE_SIZE 256 - #if !(defined UNUSED_ARGUMENT) #define UNUSED_ARGUMENT(a) (void)(a) #endif @@ -33,40 +31,44 @@ /* * get_time_cb() - Data callback for 'get_time' device requests * - * @target: Target ID of the device request (get_time). - * @transport: Communication transport used by the device request. - * @request_buffer_info: Buffer containing the device request. - * @response_buffer_info: Buffer to store the answer of the request. + * @target: Target ID of the device request (get_time). + * @transport: Communication transport used by the device request. + * @req_buf_info: Buffer containing the device request. + * @resp_buf_info: Buffer to store the answer of the request. * * Logs information about the received request and executes the corresponding * command. */ -void get_time_cb(char const *const target, - ccapi_transport_t const transport, - ccapi_buffer_info_t const *const request_buffer_info, - ccapi_buffer_info_t *const response_buffer_info) +ccapi_receive_error_t get_time_cb(char const *const target, + ccapi_transport_t const transport, + ccapi_buffer_info_t const *const req_buf_info, + ccapi_buffer_info_t *const resp_buf_info) { - UNUSED_ARGUMENT(request_buffer_info); - log_debug("get_time_cb(): target='%s' - transport='%d'", target, transport); + time_t t = time(NULL); + char *time_str = ctime(&t); - response_buffer_info->buffer = malloc(sizeof(char) * MAX_RESPONSE_SIZE + 1); - if (response_buffer_info->buffer == NULL) { - log_error("%s\n", "get_time_cb(): response_buffer_info malloc error"); - return; + UNUSED_ARGUMENT(req_buf_info); + log_debug("%s: target='%s' - transport='%d'", __func__, target, transport); + + resp_buf_info->length = snprintf(NULL, 0, "Time: %s", time_str); + resp_buf_info->buffer = calloc(resp_buf_info->length + 1, sizeof(char)); + if (resp_buf_info->buffer == NULL) { + log_error("%s: resp_buf_info calloc error", __func__); + return CCAPI_RECEIVE_ERROR_INSUFFICIENT_MEMORY; } - time_t t = time(NULL); - response_buffer_info->length = snprintf(response_buffer_info->buffer, - MAX_RESPONSE_SIZE, "Time: %s", ctime(&t)); + resp_buf_info->length = sprintf(resp_buf_info->buffer, "Time: %s", time_str); + + return CCAPI_RECEIVE_ERROR_NONE; } /* * get_time_status_cb() - Status callback for 'get_time' device requests * - * @target: Target ID of the device request (get_time) - * @transport: Communication transport used by the device request. - * @response_buffer_info: Buffer containing the response data. - * @receive_error: The error status of the receive process. + * @target: Target ID of the device request (get_time) + * @transport: Communication transport used by the device request. + * @resp_buf_info: Buffer containing the response data. + * @receive_error: The error status of the receive process. * * This callback is executed when the response process has finished. It doesn't * matter if everything worked or there was an error during the process. @@ -75,14 +77,13 @@ void get_time_cb(char const *const target, */ void get_time_status_cb(char const *const target, ccapi_transport_t const transport, - ccapi_buffer_info_t *const response_buffer_info, + ccapi_buffer_info_t *const resp_buf_info, ccapi_receive_error_t receive_error) { - log_debug( - "get_time_status_cb(): target='%s' - transport='%d' - error='%d'", - target, transport, receive_error); + log_debug("%s: target='%s' - transport='%d' - error='%d'", + __func__, target, transport, receive_error); /* Free the response buffer */ - if (response_buffer_info != NULL) - free(response_buffer_info->buffer); + if (resp_buf_info != NULL) + free(resp_buf_info->buffer); } diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/device_request.h b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/device_request.h index 26951204f..bdd9530c3 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/device_request.h +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/device_request.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Digi International Inc. + * Copyright (c) 2017-2023 Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, @@ -13,8 +13,8 @@ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * - * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 - * ======================================================================= + * Digi International Inc., 9350 Excelsior Blvd., Suite 700, Hopkins, MN 55343 + * =========================================================================== */ #ifndef DEVICE_REQUEST_H_ @@ -24,12 +24,13 @@ #define TARGET_GET_TIME "get_time" -void get_time_cb(char const *const target, ccapi_transport_t const transport, - ccapi_buffer_info_t const *const request_buffer_info, - ccapi_buffer_info_t *const response_buffer_info); +ccapi_receive_error_t get_time_cb(char const *const target, + ccapi_transport_t const transport, + ccapi_buffer_info_t const *const req_buf_info, + ccapi_buffer_info_t *const resp_buf_info); void get_time_status_cb(char const *const target, ccapi_transport_t const transport, - ccapi_buffer_info_t *const response_buffer_info, + ccapi_buffer_info_t *const resp_buf_info, ccapi_receive_error_t receive_error); #endif /* DEVICE_REQUEST_H_ */ diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/main.c b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/main.c index de584b094..4e29aca32 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/main.c +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/device_request_listener/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Digi International Inc. + * Copyright (c) 2017-2023 Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, @@ -13,9 +13,10 @@ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * - * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 - * ======================================================================= + * Digi International Inc., 9350 Excelsior Blvd., Suite 700, Hopkins, MN 55343 + * =========================================================================== */ + #include #include #include @@ -26,7 +27,8 @@ static void sigint_handler(int signum) { - log_debug("sigint_handler(): received signal %d to close Cloud connection.\n", signum); + log_debug("%s: received signal %d to close Cloud connection.", + __func__, signum); exit(0); } @@ -34,7 +36,6 @@ static void sigint_handler(int signum) static void graceful_shutdown(void) { stop_cloud_connection(); - wait_for_ccimp_threads(); } static void add_sigkill_signal(void) @@ -80,20 +81,20 @@ int main(void) init_error = init_cloud_connection(NULL); if (init_error != CC_INIT_ERROR_NONE) { - log_error("Cannot initialize cloud connection, error %d\n", init_error); + log_error("Cannot initialize cloud connection, error %d", init_error); return EXIT_FAILURE; } start_error = start_cloud_connection(); if (start_error != CC_START_ERROR_NONE) { - log_error("Cannot start cloud connection, error %d\n", start_error); + log_error("Cannot start cloud connection, error %d", start_error); return EXIT_FAILURE; } receive_error = ccapi_receive_add_target(TARGET_GET_TIME, get_time_cb, get_time_status_cb, 0); if (receive_error != CCAPI_RECEIVE_ERROR_NONE) { - log_error("Cannot register target '%s', error %d\n", TARGET_GET_TIME, + log_error("Cannot register target '%s', error %d", TARGET_GET_TIME, receive_error); return EXIT_FAILURE; } diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/Makefile b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/Makefile index f30697238..80b011a0e 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/Makefile +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/Makefile @@ -1,18 +1,21 @@ -# -# Copyright (c) 2017, Digi International Inc. +# *************************************************************************** +# Copyright (c) 2017-2023 Digi International Inc. # # This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, you can obtain one at http://mozilla.org/MPL/2.0/. +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. # -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. # +# Digi International Inc., 9350 Excelsior Blvd., Suite 700, Hopkins, MN 55343 +# +# *************************************************************************** PROGRAM := upload_data_points diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/data_point.c b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/data_point.c index b5f9428c9..b469fe26b 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/data_point.c +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/data_point.c @@ -1,5 +1,5 @@ - /* - * Copyright (c) 2017 Digi International Inc. +/* + * Copyright (c) 2017-2023 Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, @@ -13,8 +13,8 @@ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * - * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 - * ======================================================================= + * Digi International Inc., 9350 Excelsior Blvd., Suite 700, Hopkins, MN 55343 + * =========================================================================== */ #include @@ -37,7 +37,7 @@ static int get_incremental(void) else incremental++; - log_debug("Incremental = %d\n", incremental); + log_debug("Incremental = %d", incremental); return incremental; } @@ -75,14 +75,31 @@ static ccapi_timestamp_t *get_timestamp(void) return timestamp; } +/* + * free_timestamp() - Free given timestamp structure + * + * @timestamp: The timestamp structure to release. + */ +static void free_timestamp(ccapi_timestamp_t *timestamp) +{ + if (timestamp == NULL) + return; + + if (timestamp->iso8601 != NULL) { + free((char *) timestamp->iso8601); + timestamp->iso8601 = NULL; + } + free(timestamp); + timestamp = NULL; +} + ccapi_dp_error_t init_data_stream(ccapi_dp_collection_handle_t *dp_collection) { ccapi_dp_collection_handle_t collection; - ccapi_dp_error_t dp_error; + ccapi_dp_error_t dp_error = ccapi_dp_create_collection(&collection); - dp_error = ccapi_dp_create_collection(&collection); if (dp_error != CCAPI_DP_ERROR_NONE) { - log_error("ccapi_dp_create_collection() error %d\n", dp_error); + log_error("%s: error %d", __func__, dp_error); return dp_error; } else { *dp_collection = collection; @@ -91,9 +108,9 @@ ccapi_dp_error_t init_data_stream(ccapi_dp_collection_handle_t *dp_collection) dp_error = ccapi_dp_add_data_stream_to_collection_extra(collection, STREAM_NAME, "int32 ts_iso", "counts", NULL); if (dp_error != CCAPI_DP_ERROR_NONE) { - log_error("ccapi_dp_add_data_stream_to_collection_extra() error %d\n", - dp_error); - free(collection); + log_error("%s: error %d", __func__, dp_error); + ccapi_dp_destroy_collection(collection); + *dp_collection = NULL; } return dp_error; @@ -101,23 +118,14 @@ ccapi_dp_error_t init_data_stream(ccapi_dp_collection_handle_t *dp_collection) ccapi_dp_error_t add_data_point(ccapi_dp_collection_handle_t dp_collection) { - ccapi_dp_error_t dp_error; - ccapi_timestamp_t *timestamp = get_timestamp(); + ccapi_dp_error_t dp_error = ccapi_dp_add(dp_collection, STREAM_NAME, + get_incremental(), timestamp); - dp_error = ccapi_dp_add(dp_collection, STREAM_NAME, get_incremental(), timestamp); - if (dp_error != CCAPI_DP_ERROR_NONE) { - log_error("ccapi_dp_add() failed with error: %d\n", dp_error); - } + if (dp_error != CCAPI_DP_ERROR_NONE) + log_error("%s: failed with error: %d", __func__, dp_error); - if (timestamp != NULL) { - if (timestamp->iso8601 != NULL) { - free((char *) timestamp->iso8601); - timestamp->iso8601 = NULL; - } - free(timestamp); - timestamp = NULL; - } + free_timestamp(timestamp); return dp_error; } @@ -126,18 +134,17 @@ ccapi_dp_error_t send_data_stream(ccapi_dp_collection_handle_t dp_collection) { ccapi_dp_error_t dp_error; - log_debug("%s", "Sending Data Stream with new incremental value\n"); + log_debug("%s", "Sending Data Stream with new incremental value"); dp_error = ccapi_dp_send_collection(CCAPI_TRANSPORT_TCP, dp_collection); - if (dp_error != CCAPI_DP_ERROR_NONE) { - log_error("ccapi_dp_send_collection() error %d\n", dp_error); - } + if (dp_error != CCAPI_DP_ERROR_NONE) + log_error("%s: error %d", __func__, dp_error); return dp_error; } ccapi_dp_error_t destroy_data_stream(ccapi_dp_collection_handle_t dp_collection) { - log_debug("%s", "Destroying Data Stream\n"); + log_debug("%s", "Destroying Data Stream"); return ccapi_dp_destroy_collection(dp_collection); } diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/data_point.h b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/data_point.h index 5b66bb181..8be777c93 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/data_point.h +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/data_point.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Digi International Inc. + * Copyright (c) 2017-2023 Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, @@ -13,8 +13,8 @@ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * - * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 - * ======================================================================= + * Digi International Inc., 9350 Excelsior Blvd., Suite 700, Hopkins, MN 55343 + * =========================================================================== */ #ifndef DATA_POINT_H_ diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/main.c b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/main.c index 857b07b49..9cf6ddce0 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/main.c +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_data_points/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Digi International Inc. + * Copyright (c) 2017-2023 Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, @@ -13,9 +13,10 @@ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * - * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 - * ======================================================================= + * Digi International Inc., 9350 Excelsior Blvd., Suite 700, Hopkins, MN 55343 + * =========================================================================== */ + #include #include #include @@ -31,20 +32,19 @@ static ccapi_dp_collection_handle_t dp_collection; static void sigint_handler(int signum) { - log_debug("sigint_handler(): received signal %d to close Cloud connection.\n", signum); + log_debug("%s: received signal %d to close Cloud connection.", + __func__, signum); exit(0); } static void graceful_shutdown(void) { - if (running == 1) { + if (running == 1) destroy_data_stream(dp_collection); - } running = 0; stop_cloud_connection(); - wait_for_ccimp_threads(); } static void add_sigkill_signal(void) @@ -75,19 +75,19 @@ int main(void) init_error = init_cloud_connection(NULL); if (init_error != CC_INIT_ERROR_NONE) { - log_error("Cannot initialize cloud connection, error %d\n", init_error); + log_error("Cannot initialize cloud connection, error %d", init_error); return EXIT_FAILURE; } start_error = start_cloud_connection(); if (start_error != CC_START_ERROR_NONE) { - log_error("Cannot start cloud connection, error %d\n", start_error); + log_error("Cannot start cloud connection, error %d", start_error); return EXIT_FAILURE; } dp_error = init_data_stream(&dp_collection); if (dp_error != CCAPI_DP_ERROR_NONE) { - log_error("Cannot initialize data stream, error %d\n", start_error); + log_error("Cannot initialize data stream, error %d", start_error); return EXIT_FAILURE; } @@ -99,7 +99,7 @@ int main(void) dp_error = add_data_point(dp_collection); if (dp_error != CCAPI_DP_ERROR_NONE) { - log_error("Cannot add data point, error %d\n", start_error); + log_error("Cannot add data point, error %d", start_error); i--; } @@ -109,7 +109,7 @@ int main(void) /* Send the block of collected data points */ dp_error = send_data_stream(dp_collection); if (dp_error != CCAPI_DP_ERROR_NONE) - log_error("Cannot send data stream, error %d\n", start_error); + log_error("Cannot send data stream, error %d", start_error); } return EXIT_SUCCESS; diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_file/Makefile b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_file/Makefile index eed50f3e1..ff67e421a 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_file/Makefile +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_file/Makefile @@ -1,18 +1,21 @@ -# -# Copyright (c) 2017, Digi International Inc. +# *************************************************************************** +# Copyright (c) 2017-2023 Digi International Inc. # # This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, you can obtain one at http://mozilla.org/MPL/2.0/. +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. # -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. # +# Digi International Inc., 9350 Excelsior Blvd., Suite 700, Hopkins, MN 55343 +# +# *************************************************************************** PROGRAM := upload_file diff --git a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_file/main.c b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_file/main.c index 0f49d2c02..69f9ad552 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_file/main.c +++ b/meta-digi-dey/recipes-digi/dey-examples/files/cloudconnector_test/upload_file/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Digi International Inc. + * Copyright (c) 2017-2023 Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, @@ -13,9 +13,10 @@ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * - * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343 - * ======================================================================= + * Digi International Inc., 9350 Excelsior Blvd., Suite 700, Hopkins, MN 55343 + * =========================================================================== */ + #include #include #include @@ -28,7 +29,8 @@ static void sigint_handler(int signum) { - log_debug("sigint_handler(): received signal %d to close Cloud connection.\n", signum); + log_debug("%s: received signal %d to close Cloud connection.", + __func__, signum); exit(0); } @@ -36,7 +38,6 @@ static void sigint_handler(int signum) static void graceful_shutdown(void) { stop_cloud_connection(); - wait_for_ccimp_threads(); } static void add_sigkill_signal(void) @@ -67,19 +68,19 @@ int main(int argc, char *argv[]) init_error = init_cloud_connection(NULL); if (init_error != CC_INIT_ERROR_NONE) { - log_error("Cannot initialize cloud connection, error %d\n", init_error); + log_error("Cannot initialize cloud connection, error %d", init_error); return EXIT_FAILURE; } start_error = start_cloud_connection(); if (start_error != CC_START_ERROR_NONE) { - log_error("Cannot start cloud connection, error %d\n", start_error); + log_error("Cannot start cloud connection, error %d", start_error); return EXIT_FAILURE; } send_error = ccapi_dp_binary_send_file(CCAPI_TRANSPORT_TCP, UPLOAD_FILE, STREAM_NAME); if (send_error != CCAPI_DP_B_ERROR_NONE) { - log_error("ccapi_dp_binary_send_file() failed, error %d\n", send_error); + log_error("%s failed, error %d", __func__, send_error); return EXIT_FAILURE; } diff --git a/meta-digi-dey/recipes-digi/dualboot/dualboot.bb b/meta-digi-dey/recipes-digi/dualboot/dualboot.bb index 374a532c7..188ef3839 100644 --- a/meta-digi-dey/recipes-digi/dualboot/dualboot.bb +++ b/meta-digi-dey/recipes-digi/dualboot/dualboot.bb @@ -5,13 +5,18 @@ SECTION = "base" LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" -DEPENDS += "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', 'openssl-native trustfence-cst-native', '', d)}" +SOC_SIGN_DEPENDS = " \ + ${@oe.utils.conditional('DEY_SOC_VENDOR', 'NXP', 'trustfence-cst-native', '', d)} \ +" +DEPENDS += "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', \ + 'openssl-native ' \ + 'trustfence-sign-tools-native ' \ + '${SOC_SIGN_DEPENDS}', '', d)}" SRC_URI = " \ file://dualboot-init \ file://update-firmware \ file://firmware-update-check.service \ - file://on-the-fly-swap-partition.sh \ " S = "${WORKDIR}" @@ -28,7 +33,6 @@ do_install() { install -d ${D}${bindir} install -m 0755 ${WORKDIR}/update-firmware ${D}${bindir} - install -m 0755 ${WORKDIR}/on-the-fly-swap-partition.sh ${D}${bindir} install -d ${D}${systemd_unitdir}/system/ install -m 0644 ${WORKDIR}/firmware-update-check.service ${D}${systemd_unitdir}/system/ @@ -36,8 +40,6 @@ do_install() { # If Trustfence is enabled, copy the public key that is going to be used into the # initramfs '/etc/ssl/certs' folder in order to verify swupdate packages. if [ "${TRUSTFENCE_SIGN}" = "1" ]; then - # Check and generate a PKI tree if there isn't one - check_gen_pki_tree # Retrieve the key index to use. KEY_INDEX="0" if [ -n "${TRUSTFENCE_KEY_INDEX}" ]; then @@ -46,18 +48,31 @@ do_install() { KEY_INDEX_1=$(expr ${KEY_INDEX} + 1) # Find the certificate to use. - if [ "${TRUSTFENCE_SIGN_MODE}" = "HAB" ]; then - CERT_IMG="$(echo ${TRUSTFENCE_SIGN_KEYS_PATH}/crts/IMG${KEY_INDEX_1}*crt.pem)" - elif [ "${TRUSTFENCE_SIGN_MODE}" = "AHAB" ]; then - CERT_IMG="$(echo ${TRUSTFENCE_SIGN_KEYS_PATH}/crts/SRK${KEY_INDEX_1}*_ca_crt.pem)" - else - bberror "Unkown TRUSTFENCE_SIGN_MODE value" - exit 1 + if [ "${DEY_SOC_VENDOR}" = "NXP" ]; then + if [ "${TRUSTFENCE_SIGN_MODE}" = "HAB" ]; then + CERT_IMG="$(echo ${TRUSTFENCE_SIGN_KEYS_PATH}/crts/IMG${KEY_INDEX_1}*crt.pem)" + elif [ "${TRUSTFENCE_SIGN_MODE}" = "AHAB" ]; then + CERT_IMG="$(echo ${TRUSTFENCE_SIGN_KEYS_PATH}/crts/SRK${KEY_INDEX_1}*_ca_crt.pem)" + else + bberror "Unknown TRUSTFENCE_SIGN_MODE value" + exit 1 + fi + # Extract the public key from the certificate. + install -d ${D}${sysconfdir}/ssl/certs + openssl x509 -pubkey -noout -in "${CERT_IMG}" > ${D}${sysconfdir}/ssl/certs/key.pub + elif [ "${DEY_SOC_VENDOR}" = "STM" ]; then + # Copy the public key to the rootfs + if [ "${DIGI_SOM}" = "ccmp15" ]; then + PUBLIC_KEY="${TRUSTFENCE_SIGN_KEYS_PATH}/keys/publicKey00.pem" + elif [ "${DIGI_SOM}" = "ccmp13" ]; then + PUBLIC_KEY="${TRUSTFENCE_SIGN_KEYS_PATH}/keys/publicKey0${KEY_INDEX}.pem" + else + bberror "Unknown DIGI_SOM" + exit 1 + fi + install -d ${D}${sysconfdir}/ssl/certs + cp ${PUBLIC_KEY} ${D}${sysconfdir}/ssl/certs/key.pub fi - - # Extract the public key from the certificate. - install -d ${D}${sysconfdir}/ssl/certs - openssl x509 -pubkey -noout -in "${CERT_IMG}" > ${D}${sysconfdir}/ssl/certs/key.pub fi } @@ -65,7 +80,6 @@ FILES:${PN} += " \ ${sysconfdir}/dualboot-init \ ${sysconfdir}/init.d/dualboot-init \ ${bindir}/update-firmware \ - ${bindir}/on-the-fly-swap-partition.sh \ ${systemd_unitdir}/system/firmware-update-check.service \ ${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', '${sysconfdir}/ssl/certs/key.pub', '', d)} \ " diff --git a/meta-digi-dey/recipes-digi/dualboot/dualboot/dualboot-init b/meta-digi-dey/recipes-digi/dualboot/dualboot/dualboot-init index 1e4337891..63dc75ba0 100644 --- a/meta-digi-dey/recipes-digi/dualboot/dualboot/dualboot-init +++ b/meta-digi-dey/recipes-digi/dualboot/dualboot/dualboot-init @@ -1,7 +1,7 @@ #!/bin/sh #=============================================================================== # -# Copyright (C) 2021 by Digi International Inc. +# Copyright (C) 2021-2023 by Digi International Inc. # All rights reserved. # # This program is free software; you can redistribute it and/or modify it @@ -16,14 +16,16 @@ dualboot_init () { ACTIVE_SYSTEM="$(fw_printenv -n active_system 2>/dev/null)" if [ -z "${ACTIVE_SYSTEM}" ]; then - if grep -qs environment /proc/mtd; then - MTD_BOOT_PART="$(fw_printenv -n mtdbootpart 2>/dev/null)" - fw_setenv active_system "${MTD_BOOT_PART}" - else + # Check if the rootfs is ubifs to determine if it is a nand or emmc device + NANDROOTFS="$(grep -qs '[[:blank:]]\+/[[:blank:]]\+ubifs.*' /proc/mounts 2>/dev/null && echo 1)" + if [ -z "${NANDROOTFS}" ]; then BOOT_PART="$(fw_printenv -n mmcpart 2>/dev/null)" BOOT_DEV="$(fw_printenv -n mmcbootdev 2>/dev/null)" CURRENT_PART="$(sed -ne 's,PARTNAME=,,g;T;p' /sys/class/block/mmcblk"${BOOT_DEV}"p"${BOOT_PART}"/uevent)" fw_setenv active_system "${CURRENT_PART}" + else + MTD_BOOT_PART="$(fw_printenv -n mtdbootpart 2>/dev/null)" + fw_setenv active_system "${MTD_BOOT_PART}" fi fi diff --git a/meta-digi-dey/recipes-digi/dualboot/dualboot/on-the-fly-swap-partition.sh b/meta-digi-dey/recipes-digi/dualboot/dualboot/on-the-fly-swap-partition.sh deleted file mode 100644 index 83d1f586a..000000000 --- a/meta-digi-dey/recipes-digi/dualboot/dualboot/on-the-fly-swap-partition.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -#=============================================================================== -# -# on-the-fly-swap-partition.sh -# -# Copyright (C) 2021-2022 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: On the fly script to swap active partition -# -#=============================================================================== - -ACTIVE_SYSTEM="$(fw_printenv -n active_system 2>/dev/null)" - -# Get current partition information so we can -# determine where to flash the images. -if [ "${ACTIVE_SYSTEM}" = "linux_a" ]; then - KERNELBOOT="linux_b" - ROOTFS="rootfs_b" -else - KERNELBOOT="linux_a" - ROOTFS="rootfs_a" -fi -if grep -qs environment /proc/mtd; then - fw_setenv mtdbootpart ${KERNELBOOT} - fw_setenv mtdrootfspart ${ROOTFS} - fw_setenv rootfsvol ${ROOTFS} - fw_setenv active_system ${KERNELBOOT} -else - # Get Boot partition device and index. - BOOT_DEV="$(fw_printenv -n mmcbootdev 2>/dev/null)" - - # get boot partition index - MMC_PART="$(ls -l /dev/disk/by-partlabel/ | grep -i ${KERNELBOOT} | awk '{print $11}' | sed -e 's/[../mmcblkp]//g' -e 's/^.//')" - - # search rootfs UUID - MMCROOT_PART="$(ls -l /dev/disk/by-partlabel/ | grep -i ${ROOTFS} | awk '{print $11}' | sed -e 's/[../mmcblkp]//g' -e 's/^.//')" - PART_UUID="$(ls -l /dev/disk/by-partuuid/ | grep -i mmcblk${BOOT_DEV}p${MMCROOT_PART} | awk '{print $9}')" - - fw_setenv mmcroot PARTUUID=${PART_UUID} - fw_setenv mmcpart ${MMC_PART} - fw_setenv active_system ${KERNELBOOT} -fi diff --git a/meta-digi-dey/recipes-digi/dualboot/dualboot/update-firmware b/meta-digi-dey/recipes-digi/dualboot/dualboot/update-firmware index f5019e468..3735c26d4 100755 --- a/meta-digi-dey/recipes-digi/dualboot/dualboot/update-firmware +++ b/meta-digi-dey/recipes-digi/dualboot/dualboot/update-firmware @@ -3,7 +3,7 @@ # # update-firmware # -# Copyright (C) 2021-2022 by Digi International Inc. +# Copyright (C) 2021-2023 by Digi International Inc. # All rights reserved. # # This program is free software; you can redistribute it and/or modify it @@ -11,7 +11,7 @@ # the Free Software Foundation. # # -# !Description: Dual boot firmware update script +# !Description: Firmware update script # #=============================================================================== @@ -23,7 +23,17 @@ fi SCRIPTNAME="$(basename "$(readlink -f "${0}")")" VERBOSE="" PUBLIC_KEY="/etc/ssl/certs/key.pub" -ACTIVE_SYSTEM="$(fw_printenv -n active_system 2>/dev/null)" +ACTIVE_SYSTEM="" +SHOW_ACTIVE_SYSTEM=0 +SCRIPT_MODE=0 +SWAP_ACTIVE_SYSTEM=0 +REBOOT=1 +UPDATE_FILE="" +ALT_BOOT="" +ALT_ROOTFS="" + +# Check if the rootfs is ubifs to determine if it is a nand or emmc device +NANDROOTFS="$(grep -qs '[[:blank:]]\+/[[:blank:]]\+ubifs.*' /proc/mounts 2>/dev/null && echo 1)" ## Local functions usage() { @@ -31,24 +41,163 @@ usage() { Usage: ${SCRIPTNAME} [OPTIONS] .swu - -a Show currently active system - -v Enable verbosity - -h Show this help + -a --active Show currently active system + --no-reboot Do not reboot after update + --swap-active-system Swap active system block. + This option reboots the system, unless '--no-reboot' is specified. + -v --verbose Enable verbosity + -h --help Print help and exit EOF } -show_active_system() { - if [ "${ACTIVE_SYSTEM}" = "linux_a" ]; then - echo "Active system is A" +get_active_system() { + if [ -z "${NANDROOTFS}" ]; then + local MMCROOT_DEV + + MMCROOT_DEV="$(stat -c%D /)" + + for label in /dev/disk/by-partlabel/*; do + if [ "$(stat -c"%02t%02T" $(realpath ${label}))" = "${MMCROOT_DEV}" ]; then + ACTIVE_SYSTEM="$(basename ${label})" + break + fi + done else - echo "Active system is B" + ACTIVE_SYSTEM="$(sed -ne 's,^\([^[:blank:]]\+\)[[:blank:]]\+/[[:blank:]]\+ubifs.*,\1,g;T;p' /proc/mounts 2>/dev/null)" + fi + + if [ -z "${ACTIVE_SYSTEM}" ]; then + echo "[ERROR] Unable to get active system." + return 1 + fi + + ACTIVE_SYSTEM="$(echo ${ACTIVE_SYSTEM} | cut -d_ -f2)" + + return 0 +} + +show_active_system() { + if [ ${SCRIPT_MODE} -eq 0 ]; then + local act_sys + + act_sys="$(echo ${ACTIVE_SYSTEM} | tr [:lower:] [:upper:])" + echo "Active system is ${act_sys}" + else + echo "${ACTIVE_SYSTEM}" + fi +} + +# $1: message to show +reboot_system() { + if [ ${REBOOT} -eq 1 ]; then + echo "${1}. Rebooting the system." + reboot -f + else + echo "${1}. Reboot the system to use the new version." + fi +} + +swap_active_system() { + if [ -z "${NANDROOTFS}" ]; then + local PART_UUID="" + + # Get boot and rootfs partition index + local MMC_PART="$(realpath /dev/disk/by-partlabel/${ALT_BOOT} | grep -o '[[:digit:]]\+$')" + + # Search rootfs UUID + local MMCROOT_DEV="$(realpath /dev/disk/by-partlabel/${ALT_ROOTFS})" + for uuid in /dev/disk/by-partuuid/*; do + if [ "$(realpath "${uuid}")" = "${MMCROOT_DEV}" ]; then + PART_UUID="$(basename "${uuid}")" + break + fi + done + + if [ -z "${MMC_PART}" ] || [ -z "${PART_UUID}" ]; then + echo "[ERROR] Unable to detect partitions." + return 1 + fi + + fw_setenv mmcroot "PARTUUID=${PART_UUID}" + fw_setenv mmcpart "${MMC_PART}" + else + fw_setenv mtdbootpart ${ALT_BOOT} + fw_setenv mtdrootfspart ${ALT_ROOTFS} + fw_setenv rootfsvol ${ALT_ROOTFS} + fi + + fw_setenv active_system ${ALT_BOOT} + fw_setenv bootcount 0 + + return 0 +} + +update_emmc() { + local IMAGE_SET="mmc,primary" + + # Get current partition information so we can + # determine where to flash the images. + [ "${ACTIVE_SYSTEM}" = "a" ] && IMAGE_SET="mmc,secondary" + + echo "" + echo "Updating '${IMAGE_SET}' image set from '${UPDATE_FILE}'..." + echo "" + + # Execute the update. + swupdate ${VERBOSE} -i "${UPDATE_FILE}" -e "${IMAGE_SET}" +} + +update_nand() { + local IMAGE_SET="mtd,primary" + + # Get current partition information so we can + # determine where to flash the images. + [ "${ACTIVE_SYSTEM}" = "a" ] && IMAGE_SET="mtd,secondary" + + echo "" + echo "Updating '${IMAGE_SET}' image set from '${UPDATE_FILE}'..." + echo "" + + # Execute the update. + if [ -f "${PUBLIC_KEY}" ]; then + swupdate ${VERBOSE} -i "${UPDATE_FILE}" -e "${IMAGE_SET}" -k "${PUBLIC_KEY}" + else + swupdate ${VERBOSE} -i "${UPDATE_FILE}" -e "${IMAGE_SET}" + fi +} + +update_device() { + local ret + + show_active_system + echo "Updating system on $(echo ${ALT_BOOT} | cut -d'_' -f2 | tr [:lower:] [:upper:])" + + if [ -z "${NANDROOTFS}" ]; then + update_emmc + else + update_nand + fi + + if [ "$?" = "0" ]; then + if ! swap_active_system; then + exit 1 + fi + reboot_system "Firmware update finished" + else + echo "[ERROR] $? There was an error performing the update" fi } while :; do case $1 in - -a|--active) show_active_system;exit + -a|--active) SHOW_ACTIVE_SYSTEM=1 + ;; + --no-reboot) REBOOT=0 + ;; + --swap-active-system) SWAP_ACTIVE_SYSTEM=1 + ;; + -s) SCRIPT_MODE=1 ;; -v|--verbose) VERBOSE="-v" ;; @@ -61,97 +210,38 @@ while :; do shift done +get_active_system || exit + +# Show active system. +if [ ${SHOW_ACTIVE_SYSTEM} -eq 1 ]; then + show_active_system + exit +fi + +if [ "${ACTIVE_SYSTEM}" = "a" ]; then + ALT_BOOT="linux_b" + ALT_ROOTFS="rootfs_b" +else + ALT_BOOT="linux_a" + ALT_ROOTFS="rootfs_a" +fi + +# Swap active system. +if [ ${SWAP_ACTIVE_SYSTEM} -eq 1 ]; then + if ! swap_active_system; then + exit 1 + fi + reboot_system "Swapped active system to $(echo ${ALT_BOOT} | cut -d'_' -f2 | tr [:lower:] [:upper:])" + exit +fi + # Check update file parameter. if [ -z "${UPDATE_FILE}" ]; then echo "[ERROR] Update file not specified" exit +elif [ ! -f "${UPDATE_FILE}" ]; then + echo "[ERROR] Update file '${UPDATE_FILE}' does not exist" + exit fi -# Check if the rootfs is ubifs to determine if it is a nand or emmc device -NANDROOTFS="$(sed -ne "s/\(rootfs\).*\.*/\1/g;T;p" /proc/mounts 2>/dev/null)" - -if [ -z "${NANDROOTFS}" ]; then - # Get current partition information so we can - # determine where to flash the images. - if [ "${ACTIVE_SYSTEM}" = "linux_a" ]; then - echo "Current system is A; Updating system on B" - KERNELBOOT="linux_b" - ROOTFS="rootfs_b" - IMAGE_SET="mmc,secondary" - else - echo "Current system is B; Updating system on A" - KERNELBOOT="linux_a" - ROOTFS="rootfs_a" - IMAGE_SET="mmc,primary" - fi - - # get boot and rootfs partition index - MMC_PART="$(realpath /dev/disk/by-partlabel/${KERNELBOOT} | grep -o '[[:digit:]]\+$')" - - # search rootfs UUID - MMCROOT_DEV="$(realpath /dev/disk/by-partlabel/${ROOTFS})" - for uuid in /dev/disk/by-partuuid/*; do - if [ "$(realpath "${uuid}")" = "${MMCROOT_DEV}" ]; then - PART_UUID="$(basename "${uuid}")" - break - fi - done - - if [ -z "${MMC_PART}" ] || [ -z "${PART_UUID}" ]; then - echo "[ERROR] detecting partitions to update." - exit - fi - - echo "" - echo "Updating '${IMAGE_SET}' image set from '${UPDATE_FILE}'..." - echo "" - - # Execute the update. - swupdate ${VERBOSE} -i "${UPDATE_FILE}" -e "${IMAGE_SET}" - if [ "$?" = "0" ]; then - fw_setenv mmcroot "PARTUUID=${PART_UUID}" - fw_setenv mmcpart "${MMC_PART}" - fw_setenv active_system ${KERNELBOOT} - fw_setenv bootcount 0 - echo "Firmware update finished; Rebooting system." - reboot -f - else - echo "[ERROR] $? There was an error performing the update" - fi -else - # Get current partition information so we can - # determine where to flash the images. - if [ "${ACTIVE_SYSTEM}" = "linux_a" ]; then - echo "Current system is A; Updating system on B" - KERNELBOOT="linux_b" - ROOTFS="rootfs_b" - IMAGE_SET="mtd,secondary" - else - echo "Current system is B; Updating system on A" - KERNELBOOT="linux_a" - ROOTFS="rootfs_a" - IMAGE_SET="mtd,primary" - fi - - echo "" - echo "Updating '${IMAGE_SET}' image set from '${UPDATE_FILE}'..." - echo "" - - # Execute the update. - if [ -f "${PUBLIC_KEY}" ]; then - swupdate ${VERBOSE} -i "${UPDATE_FILE}" -e "${IMAGE_SET}" -k "${PUBLIC_KEY}" - else - swupdate ${VERBOSE} -i "${UPDATE_FILE}" -e "${IMAGE_SET}" - fi - if [ "$?" = "0" ]; then - fw_setenv mtdbootpart ${KERNELBOOT} - fw_setenv mtdrootfspart ${ROOTFS} - fw_setenv rootfsvol ${ROOTFS} - fw_setenv active_system ${KERNELBOOT} - fw_setenv bootcount 0 - echo "Firmware update finished; Rebooting system." - reboot -f - else - echo "[ERROR] $? There was an error performing the update" - fi -fi +update_device diff --git a/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/ccimx93-dvk/libdigiapix.conf b/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/ccimx93-dvk/libdigiapix.conf index 2b1044637..311a02c7f 100644 --- a/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/ccimx93-dvk/libdigiapix.conf +++ b/meta-digi-dey/recipes-digi/libdigiapix/libdigiapix-git/ccimx93-dvk/libdigiapix.conf @@ -1,36 +1,33 @@ [board] -model = Digi International ConnectCore 8M Mini DVK. +model = Digi International ConnectCore 93 DVK. [GPIO] # USER LED1 -USER_LED = mca-gpio,12 -USER_LED1 = mca-gpio,12 +USER_LED1 = gpiochip2,7 # USER_LED2 -USER_LED2 = mca-gpio,18 - -# USER_LED3 -USER_LED3 = gpio2,19 +USER_LED = gpiochip3,23 +USER_LED2 = gpiochip3,23 # USER BUTTON1 -USER_BUTTON = mca-gpio,10 -USER_BUTTON1 = mca-gpio,10 +USER_BUTTON = gpiochip2,7 +USER_BUTTON1 = gpiochip2,7 # USER BUTTON2 -USER_BUTTON2 = gpio2,20 +USER_BUTTON2 = gpiochip3,23 [I2C] -# I2C-4 on Expansion connector. -DEFAULT_I2C_BUS = 4 +# I2C-3 on MikroBus connector. +DEFAULT_I2C_BUS = 2 [PWM] -# PWM0 channel 1 USER_LED1. +# PWM0 channel 1 - LVDS backlight. DEFAULT_PWM = 0,1 [ADC] -# MCA_IO1 (channel 1) at XBEE1_UART_TX. Not enabled by default. -DEFAULT_ADC = 0,1 +# ADC channel 0 - Pin J48-1. +DEFAULT_ADC = 0,0 diff --git a/sdk/mkproject.sh b/sdk/mkproject.sh index 4ece3b868..c201767de 100755 --- a/sdk/mkproject.sh +++ b/sdk/mkproject.sh @@ -28,7 +28,7 @@ MKP_NONE="\033[0m" MKP_CONFIGPATH="${MKP_SCRIPTPATH}/sources/meta-digi/sdk/config" # Blacklist platforms (not officially supported in a DEY release) -MKP_BLACKLIST_PLATFORMS="ccimx6qpsbc ccimx6sbc ccimx8x-sbc-express ccimx8x-sbc-pro ccimx93-dvk" +MKP_BLACKLIST_PLATFORMS="ccimx6qpsbc ccimx6sbc ccimx8x-sbc-express ccimx8x-sbc-pro" MKP_SETUP_ENVIRONMENT='#!/bin/bash @@ -151,10 +151,6 @@ do_mkproject() { # Customize project chmod 644 ${MKP_PROJECTPATH}/conf/bblayers.conf ${MKP_PROJECTPATH}/conf/local.conf sed -i -e "s,##DIGIBASE##,${MKP_SCRIPTPATH}/sources,g" ${MKP_PROJECTPATH}/conf/bblayers.conf - if [ -n "${MKP_VARIANT+x}" ]; then - sed -i -e "/^MACHINE_VARIANT =/cMACHINE_VARIANT = \"${MKP_VARIANT}\"" \ - ${MKP_PROJECTPATH}/conf/local.conf - fi # At this point the user has accepted all the licenses, so enable the vendor EULA sed -i -e "s,^#\(ACCEPT.*EULA\),\1,g" ${MKP_PROJECTPATH}/conf/local.conf # Create dey-setup-environment script @@ -178,11 +174,10 @@ fi # The script needs to be sourced (not executed) so make sure to # initialize OPTIND variable for getopts. OPTIND=1 -while getopts "lp:v:m:" c; do +while getopts "lp:m:" c; do case "${c}" in l) MKP_LIST_PLATFORMS="y";; p) MKP_PLATFORM="${OPTARG}";; - v) MKP_VARIANT="${OPTARG}";; m) MKP_CONFIGPATH="${MKP_SCRIPTPATH}/sources/${OPTARG}/sdk/config";; esac done @@ -219,5 +214,4 @@ unset MKP_AVAILABLE_PLATFORMS \ MKP_RED \ MKP_SCRIPTNAME \ MKP_SCRIPTPATH \ - MKP_SETUP_ENVIRONMENT \ - MKP_VARIANT + MKP_SETUP_ENVIRONMENT