diff options
620 files changed, 4175 insertions, 22896 deletions
diff --git a/.gitlab/issue_templates/default.md b/.gitlab/issue_templates/default.md new file mode 100644 index 000000000..bca6c09e4 --- /dev/null +++ b/.gitlab/issue_templates/default.md @@ -0,0 +1,2 @@ +**Please use https://jira.automotivelinux.org for issues.** +See also: https://docs.automotivelinux.org/ chapter "How to contribute". diff --git a/.gitlab/issue_templates/mytemplate.md b/.gitlab/issue_templates/mytemplate.md new file mode 100644 index 000000000..25d91d81d --- /dev/null +++ b/.gitlab/issue_templates/mytemplate.md @@ -0,0 +1,3 @@ +**Please use https://gerrit.automotivelinux.org for code contributions.** +See also: https://docs.automotivelinux.org/ chapter "How to contribute". + diff --git a/.gitlab/merge_request_templates/default.md b/.gitlab/merge_request_templates/default.md new file mode 100644 index 000000000..5b02effeb --- /dev/null +++ b/.gitlab/merge_request_templates/default.md @@ -0,0 +1,2 @@ +**Please use https://gerrit.automotivelinux.org for code contributions.** +See also: https://docs.automotivelinux.org/ chapter "How to contribute". diff --git a/.gitlab/merge_request_templates/mytemplate.md b/.gitlab/merge_request_templates/mytemplate.md new file mode 100644 index 000000000..25d91d81d --- /dev/null +++ b/.gitlab/merge_request_templates/mytemplate.md @@ -0,0 +1,3 @@ +**Please use https://gerrit.automotivelinux.org for code contributions.** +See also: https://docs.automotivelinux.org/ chapter "How to contribute". + diff --git a/docs/profiles.md b/docs/profiles.md index 287b8190a..5d0f89d4f 100644 --- a/docs/profiles.md +++ b/docs/profiles.md @@ -140,7 +140,6 @@ meta-agl/meta-agl-profile-core/recipes-platform | |-- agl-image-graphical-qt5.bb | `-- agl-image-graphical-qt5.inc `-- packagegroups - |-- packagegroup-agl-appfw-native-qt5.bb |-- packagegroup-agl-demo-qt-examples.bb |-- packagegroup-agl-profile-graphical-qt5.bb `-- packagegroup-qt5-toolchain-target.bbappend diff --git a/meta-agl-bsp/README b/meta-agl-bsp/README index 3c3d23af8..69ca72c9d 100644 --- a/meta-agl-bsp/README +++ b/meta-agl-bsp/README @@ -5,3 +5,15 @@ This layer holds the 'impedance-mismatch' between AGL and the BSP's. /dream on In an ideal world, this would be empty! /dream off + +Maintenance +----------- + +All patches must be submitted via the AGL Gerrit instance at +https://gerrit.automotivelinux.org. See this wiki page for +details: + +https://wiki.automotivelinux.org/agl-distro/contributing + +Layer maintainers: + Jan-Simon Möller <jsmoeller@linuxfoundation.org> diff --git a/meta-agl-bsp/conf/include/agl_am62xx-evm.inc b/meta-agl-bsp/conf/include/agl_am62xx-evm.inc new file mode 100644 index 000000000..24fd95141 --- /dev/null +++ b/meta-agl-bsp/conf/include/agl_am62xx-evm.inc @@ -0,0 +1,8 @@ +# am62xx-evm has a k3r5 BBMULTICONFIG to build its bootloader +# firmware, need to use an override to set DEFAULTTUNE back to +# what that machine configuration needs. +DEFAULTTUNE:k3r5:forcedefaulttune = "armv7athf" + +# meta-ti-bsp layer conf does break expectations wrt common folders +# meta-ti-bsp/conf/layer.conf:TI_COMMON_DEPLOY ?= "${TOPDIR}/deploy-ti" +TI_COMMON_DEPLOY := "${TMPDIR}/deploy" diff --git a/meta-agl-bsp/conf/include/agl_bbe.inc b/meta-agl-bsp/conf/include/agl_bbe.inc index 9f9eb5039..5252c558b 100644 --- a/meta-agl-bsp/conf/include/agl_bbe.inc +++ b/meta-agl-bsp/conf/include/agl_bbe.inc @@ -6,26 +6,6 @@ CORE_IMAGE_EXTRA_INSTALL += "packagegroup-machine-base" #------------------------------------------------- -## Graphics section ## -#------------------------------------------------- -PACKAGES_GFX = "ti-sgx-ddk-km" -IMAGE_INSTALL:append = " ${PACKAGES_GFX}" - - -# Enable Gfx Pkgs -MACHINE_FEATURES:append = " sgx" -MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2" - -DEPENDS:remove = "virtual/libgl" - -# Preferred providers -PREFERRED_PROVIDER_virtual/libgles1 = "" -PREFERRED_PROVIDER_virtual/libgles2 = "ti-sgx-ddk-um" -PREFERRED_PROVIDER_virtual/egl = "ti-sgx-ddk-um" -PREFERRED_PROVIDER_virtual/libgbm = "ti-sgx-ddk-um" -PREFERRED_PROVIDER_virtual/mesa = "mesa-gl" - -#------------------------------------------------- ## Multimedia section ## #------------------------------------------------- @@ -38,3 +18,7 @@ SECURITY_CFLAGS:pn-gpm = "" SECURITY_LDFLAGS:pn-gpm = "" SECURITY_CFLAGS:pn-libatasmart = "" SECURITY_LDFLAGS:pn-libatasmart = "" + +# meta-ti-bsp layer conf does break expectations wrt common folders +# meta-ti-bsp/conf/layer.conf:TI_COMMON_DEPLOY ?= "${TOPDIR}/deploy-ti" +TI_COMMON_DEPLOY := "${TMPDIR}/deploy"
\ No newline at end of file diff --git a/meta-agl-bsp/conf/include/agl_beaglebone-ai64.inc b/meta-agl-bsp/conf/include/agl_beaglebone-ai64.inc new file mode 100644 index 000000000..1e03b70ff --- /dev/null +++ b/meta-agl-bsp/conf/include/agl_beaglebone-ai64.inc @@ -0,0 +1,6 @@ +# beaglebone-ai64 has a k3r5 BBMULTICONFIG to build its bootloader +# and firmware, need to use an override to set DEFAULTTUNE back to +# what that machine configuration needs. +DEFAULTTUNE:k3r5:forcedefaulttune = "armv7athf" + +TI_COMMON_DEPLOY := "${TMPDIR}/deploy" diff --git a/meta-agl-bsp/conf/include/agl_beaglebone.inc b/meta-agl-bsp/conf/include/agl_beaglebone.inc index 857a801f3..ec3a3a448 100644 --- a/meta-agl-bsp/conf/include/agl_beaglebone.inc +++ b/meta-agl-bsp/conf/include/agl_beaglebone.inc @@ -1,40 +1,10 @@ # This config is for the beaglebone (inspired from the vayu config). -#------------------------------------------------- -## Graphics section ## -#------------------------------------------------- -PACKAGES_GFX = "ti-sgx-ddk-km" -IMAGE_INSTALL:append = " ${PACKAGES_GFX}" - - -# Enable Gfx Pkgs -MACHINE_FEATURES:append = " sgx" -MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2" - -DEPENDS:remove = "virtual/libgl" - -# Preferred providers -PREFERRED_PROVIDER_virtual/libgles1 = "" -PREFERRED_PROVIDER_virtual/libgles2 = "ti-sgx-ddk-um" -PREFERRED_PROVIDER_virtual/egl = "ti-sgx-ddk-um" -PREFERRED_PROVIDER_virtual/libgbm = "ti-sgx-ddk-um" -PREFERRED_PROVIDER_virtual/mesa = "mesa-gl" - -#------------------------------------------------- -## Multimedia section ## -#------------------------------------------------- - -PREFERRED_PROVIDER_virtual/kernel = "linux-ti-staging" -PREFERRED_VERSION_virtual/kernel = "4.9" - # DEFAULTTUNE for cortex-a8 DISTRO_FEATURES:append = " agl-medium-arm-compiler" -SECURITY_CFLAGS:pn-mozjs = "" -SECURITY_LDFLAGS:pn-mozjs = "" -SECURITY_CFLAGS:pn-gpm = "" -SECURITY_LDFLAGS:pn-gpm = "" -SECURITY_CFLAGS:pn-libatasmart = "" -SECURITY_LDFLAGS:pn-libatasmart = "" - WKS_FILE = "sdimage-bootpart-uuid.wks" + +# meta-ti-bsp layer conf does break expectations wrt common folders +# meta-ti-bsp/conf/layer.conf:TI_COMMON_DEPLOY ?= "${TOPDIR}/deploy-ti" +TI_COMMON_DEPLOY := "${TMPDIR}/deploy"
\ No newline at end of file diff --git a/meta-agl-bsp/conf/include/agl_beagleplay.inc b/meta-agl-bsp/conf/include/agl_beagleplay.inc new file mode 100644 index 000000000..77b669bb7 --- /dev/null +++ b/meta-agl-bsp/conf/include/agl_beagleplay.inc @@ -0,0 +1,6 @@ +# beagleplay has a k3r5 BBMULTICONFIG to build its bootloader +# and firmware, need to use an override to set DEFAULTTUNE back to +# what that machine configuration needs. +DEFAULTTUNE:k3r5:forcedefaulttune = "armv7athf" + +TI_COMMON_DEPLOY := "${TMPDIR}/deploy" diff --git a/meta-agl-bsp/conf/include/agl_cubox-i.inc b/meta-agl-bsp/conf/include/agl_cubox-i.inc index 4fa4815a4..ee5e759e4 100644 --- a/meta-agl-bsp/conf/include/agl_cubox-i.inc +++ b/meta-agl-bsp/conf/include/agl_cubox-i.inc @@ -1,5 +1,9 @@ require agl_imx6-common.inc +# Force use of the community supported LTS kernel instead of the +# default linux-fslc +PREFERRED_PROVIDER_virtual/kernel = "linux-fslc-lts" + # Include devicetrees for SOM 1.5 and Hummingboard 2 hardware KERNEL_DEVICETREE:append = " \ imx6dl-hummingboard-som-v15.dtb \ diff --git a/meta-agl-bsp/conf/include/agl_dragonboard-410c.inc b/meta-agl-bsp/conf/include/agl_dragonboard-410c.inc deleted file mode 100644 index aba92ddf1..000000000 --- a/meta-agl-bsp/conf/include/agl_dragonboard-410c.inc +++ /dev/null @@ -1,3 +0,0 @@ -# Install 96boards-tools for resizing partition -# Add systemd unit file for the qcom_q6v5_pil kernel module -IMAGE_INSTALL:append = " 96boards-tools q6v5-pil" diff --git a/meta-agl-bsp/conf/include/agl_dragonboard-820c.inc b/meta-agl-bsp/conf/include/agl_dragonboard-820c.inc deleted file mode 100644 index 265564c18..000000000 --- a/meta-agl-bsp/conf/include/agl_dragonboard-820c.inc +++ /dev/null @@ -1,2 +0,0 @@ -# Install 96boards-tools for resizing partition -IMAGE_INSTALL:append = " 96boards-tools" diff --git a/meta-agl-bsp/conf/include/agl_ebisu.inc b/meta-agl-bsp/conf/include/agl_ebisu.inc index 0d10b3130..d684f814d 100644 --- a/meta-agl-bsp/conf/include/agl_ebisu.inc +++ b/meta-agl-bsp/conf/include/agl_ebisu.inc @@ -10,4 +10,4 @@ DISTRO_FEATURES:remove = " use_eva_pkg" MACHINE_FEATURES:append = " usb3" IMAGE_INSTALL:append = " gstreamer1.0-omx gstreamer1.0-plugin-vspfilter" -IMAGE_INSTALL:append = " kernel-module-mmngr kernel-module-mmngrbuf kernel-module-uvcs-drv kernel-module-vspmif" +IMAGE_INSTALL:append = " kernel-module-mmngr kernel-module-mmngrbuf kernel-module-uvcs-drv kernel-module-vspm-if" diff --git a/meta-agl-bsp/conf/include/agl_h3-salvator-x-nogfx.inc b/meta-agl-bsp/conf/include/agl_h3-salvator-x-nogfx.inc index 3bc9f95c2..4ff103df8 100644 --- a/meta-agl-bsp/conf/include/agl_h3-salvator-x-nogfx.inc +++ b/meta-agl-bsp/conf/include/agl_h3-salvator-x-nogfx.inc @@ -1,13 +1,8 @@ -require conf/include/agl_rcar-nogfx.inc +require conf/include/agl_salvator-nogfx.inc SOC_FAMILY = "r8a7795" BOARD_NAME = "h3-salvator-x" -DTB_SUFFIX = "r8a7795-salvator-xs" - -# Mask graphic Pkgs -BBMASK += "gles-user-module|kernel-module-gles|wayland-kms|libgbm" -# Mask MMP recipes -BBMASK += "kernel-module-uvcs-drv|omx-user-module" +DTB_SUFFIX = "r8a77951-salvator-xs" # do use software rendering to display the compositor # used for images w/o binary-only driver diff --git a/meta-agl-bsp/conf/include/agl_h3-salvator-x.inc b/meta-agl-bsp/conf/include/agl_h3-salvator-x.inc index 48a282133..134b1dd1f 100644 --- a/meta-agl-bsp/conf/include/agl_h3-salvator-x.inc +++ b/meta-agl-bsp/conf/include/agl_h3-salvator-x.inc @@ -1,9 +1,6 @@ -require conf/include/agl_rcar.inc +require conf/include/agl_salvator.inc SOC_FAMILY = "r8a7795" BOARD_NAME = "h3-salvator-x" -DTB_SUFFIX = "r8a7795-salvator-xs" +DTB_SUFFIX = "r8a77951-salvator-xs" -IMAGE_INSTALL:append:rcar-gen3 = " \ - kernel-module-vspmif \ -" diff --git a/meta-agl-bsp/conf/include/agl_h3ulcb-nogfx.inc b/meta-agl-bsp/conf/include/agl_h3ulcb-nogfx.inc index 25dfb046d..5f288fca5 100644 --- a/meta-agl-bsp/conf/include/agl_h3ulcb-nogfx.inc +++ b/meta-agl-bsp/conf/include/agl_h3ulcb-nogfx.inc @@ -2,15 +2,23 @@ require conf/include/agl_rcar-nogfx.inc SOC_FAMILY = "r8a7795" BOARD_NAME = "h3ulcb" -DTB_SUFFIX = "r8a7795-h3ulcb" +DTB_SUFFIX = "r8a77951-ulcb" # Mask graphic Pkgs BBMASK += "gles-user-module|kernel-module-gles|wayland-kms|libgbm" # Mask MMP recipes BBMASK += "kernel-module-uvcs-drv|omx-user-module" -# Workaround for SPEC-3706 - versioned bbappends and upstream moved on to 1.16.3 -BBMASK += "meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-.*1.16.2\.bbappend" +# Work around use of obsolete Weston backend-fbdev in meta-rcar-gen3 +# when building without the proprietary driver stack. Masking out the +# weston_%.bbappend seems the simplest approach for now, as forcing +# USE_GLES = "1" to disable the adding of -Dbackend-default="fbdev" to +# EXTRA_OEMESON triggers adding "libgbm" to DEPENDS, which breaks due +# to that being a component specific to the proprietary stack we are +# explicitly disabling. If the "libgbm" usage in the bbappend was +# instead "virtual/libgbm" as is now used in poky, it might be possible +# to just tweak PREFERRED_PROVIDER_virtual/libgbm = "mesa". +BBMASK += "meta-rcar-gen3/recipes-graphics/wayland/weston_%.bbappend" # do use software rendering to display the compositor # used for images w/o binary-only driver diff --git a/meta-agl-bsp/conf/include/agl_h3ulcb.inc b/meta-agl-bsp/conf/include/agl_h3ulcb.inc index eb3836abb..b958d767c 100644 --- a/meta-agl-bsp/conf/include/agl_h3ulcb.inc +++ b/meta-agl-bsp/conf/include/agl_h3ulcb.inc @@ -2,4 +2,5 @@ require conf/include/agl_rcar.inc SOC_FAMILY = "r8a7795" BOARD_NAME = "h3ulcb" -DTB_SUFFIX = "r8a7795-h3ulcb" +#ws2.0 +DTB_SUFFIX = "r8a77951-ulcb" diff --git a/meta-agl-bsp/conf/include/agl_hsdk.inc b/meta-agl-bsp/conf/include/agl_hsdk.inc deleted file mode 100644 index b1b0e4a8f..000000000 --- a/meta-agl-bsp/conf/include/agl_hsdk.inc +++ /dev/null @@ -1,9 +0,0 @@ -KERNEL_IMAGETYPE = "uImage" -WKS_FILE = "sdimage-hsdk.wks" -IMAGE_BOOT_FILES = "uImage uboot.env" -IMAGE_INSTALL:append = " kernel-modules" - -# remove incompatible packages from packagegroups -RDEPENDS:packagegroup-agl-core-devel:remove:hsdk = "valgrind gcc-sanitizers" -RDEPENDS:packagegroup-core-tools-profile:remove:hsdk = "systemtap" -RDEPENDS:packagegroup-core-tools-debug:remove:hsdk = "gdbserver" diff --git a/meta-agl-bsp/conf/include/agl_imx6qdlsabreauto.inc b/meta-agl-bsp/conf/include/agl_imx6qdlsabreauto.inc index cb13de713..f058ba1a5 100644 --- a/meta-agl-bsp/conf/include/agl_imx6qdlsabreauto.inc +++ b/meta-agl-bsp/conf/include/agl_imx6qdlsabreauto.inc @@ -1 +1,5 @@ require agl_imx6-common.inc + +# Force use of the community supported LTS kernel instead of the +# default linux-fslc +IMX_DEFAULT_KERNEL:imx6qdlsabreauto = "linux-fslc-lts" diff --git a/meta-agl-bsp/conf/include/agl_imx8mq-evk-common.inc b/meta-agl-bsp/conf/include/agl_imx8mq-evk-common.inc new file mode 100644 index 000000000..b3faadd0a --- /dev/null +++ b/meta-agl-bsp/conf/include/agl_imx8mq-evk-common.inc @@ -0,0 +1,8 @@ +require agl_imx-common.inc + +# Add helper to drive setting up HCI UART device +# NOTE: Disabled 2023/05 due to kernel oops, further investigation +# required, see SPEC-4807 in JIRA. +#MACHINE_EXTRA_RRECOMMENDS:append = " hci-uart-helper" + +AGL_DEFAULT_INITRAMFS_FSTYPES := "" diff --git a/meta-agl-bsp/conf/include/agl_imx8mq-evk-viv.inc b/meta-agl-bsp/conf/include/agl_imx8mq-evk-viv.inc new file mode 100644 index 000000000..3988fcd6f --- /dev/null +++ b/meta-agl-bsp/conf/include/agl_imx8mq-evk-viv.inc @@ -0,0 +1,8 @@ +require agl_imx8mq-evk-common.inc + +IMX_DEFAULT_BSP = "nxp" + +# NOTE: +# There is some potential benefit to using the community supported +# linux-fslc-imx hybrid kernel here, but keeping the configuration +# close to upstream to ease maintenance seems worthwhile. diff --git a/meta-agl-bsp/conf/include/agl_imx8mq-evk.inc b/meta-agl-bsp/conf/include/agl_imx8mq-evk.inc new file mode 100644 index 000000000..620ee0fdd --- /dev/null +++ b/meta-agl-bsp/conf/include/agl_imx8mq-evk.inc @@ -0,0 +1,23 @@ +require agl_imx8mq-evk-common.inc + +# NOTE: +# Currently using the upstream default of IMX_DEFAULT_BSP = "mainline", +# since we want to use the etnaviv driver and upstream Mesa + weston +# stack. More tweaks are required to accomplish that if the BSP is set +# to "nxp". + +# Force use of the community supported hybrid NXP/LTS kernel instead of +# the default linux-fslc. This is required to get the drivers required +# for HDMI output. +IMX_DEFAULT_KERNEL:imx8mq-evk = "linux-fslc-imx" + +# Tweaks to allow using linux-fslc-imx on its own without the whole +# NXP BSP. Just the DISTROOVERRIDES change on its own is not enough, +# as COMPATIBLE_MACHINE is evaluated early enough that the recipe is +# not seen as compatible without an explicit override. +COMPATIBLE_MACHINE:pn-linux-fslc-imx = "(imx8mq-evk)" +DISTROOVERRIDES:pn-linux-fslc-imx:append = "mx8-nxp-bsp" + +# Add our own over-ride for use in a few recipes where there is +# conflicting Vivante vs etnaviv configuration. +MACHINEOVERRIDES .= ":etnaviv" diff --git a/meta-agl-bsp/conf/include/agl_imx8mqevk-common.inc b/meta-agl-bsp/conf/include/agl_imx8mqevk-common.inc deleted file mode 100644 index f3c4a736e..000000000 --- a/meta-agl-bsp/conf/include/agl_imx8mqevk-common.inc +++ /dev/null @@ -1,13 +0,0 @@ -require agl_imx-common.inc - -# Force use of the community supported LTS kernel instead of the -# default linux-imx -IMX_DEFAULT_KERNEL:imx8mqevk = "linux-fslc-imx" - -# For EVKB wifi support -MACHINE_FEATURES:append = " bcm4356" - -# Add helper to drive setting up HCI UART device -MACHINE_EXTRA_RRECOMMENDS:append = " hci-uart-helper" - -AGL_DEFAULT_INITRAMFS_FSTYPES := "" diff --git a/meta-agl-bsp/conf/include/agl_imx8mqevk-viv.inc b/meta-agl-bsp/conf/include/agl_imx8mqevk-viv.inc deleted file mode 100644 index 8227f5c06..000000000 --- a/meta-agl-bsp/conf/include/agl_imx8mqevk-viv.inc +++ /dev/null @@ -1 +0,0 @@ -include agl_imx8mqevk-common.inc diff --git a/meta-agl-bsp/conf/include/agl_imx8mqevk.inc b/meta-agl-bsp/conf/include/agl_imx8mqevk.inc deleted file mode 100644 index 6801722be..000000000 --- a/meta-agl-bsp/conf/include/agl_imx8mqevk.inc +++ /dev/null @@ -1,23 +0,0 @@ -include agl_imx8mqevk-common.inc - -# NOTE: currently not using IMX_DEFAULT_BSP = "mainline", as it -# requires more changes than this approach of disabling -# Vivante. - -# Add our own over-ride for use in a few recipes where there is -# conflicting Vivante vs etnaviv configuration. -MACHINEOVERRIDES .= ":etnaviv" - -# Knock out Vivante overrides -MACHINEOVERRIDES_EXTENDER:mx8mq:forcevariable = "" -PREFERRED_VERSION_weston_mx8 = "8.0.0" -PREFERRED_VERSION_wayland-protocols_mx8 = "1.20" -PREFERRED_VERSION_libdrm_mx8 = "2.4.101" - -CORE_IMAGE_EXTRA_INSTALL += "libdrm-etnaviv" - -PREFERRED_VERSION_gstreamer1.0_mx8 = "1.16.3" -PREFERRED_VERSION_gstreamer1.0-plugins-base_mx8 = "1.16.3" -PREFERRED_VERSION_gstreamer1.0-plugins-good_mx8 = "1.16.3" -PREFERRED_VERSION_gstreamer1.0-plugins-bad_mx8 = "1.16.3" -PREFERRED_VERSION_gstreamer1.0-plugins-ugly_mx8 = "1.16.3" diff --git a/meta-agl-bsp/conf/include/agl_j7-evm.inc b/meta-agl-bsp/conf/include/agl_j7-evm.inc deleted file mode 100644 index b394aa5ee..000000000 --- a/meta-agl-bsp/conf/include/agl_j7-evm.inc +++ /dev/null @@ -1,15 +0,0 @@ -# j7-evm has a k3r5 BBMULTICONFIG to build its bootloader firmware, -# need to use an override to set DEFAULTTUNE back to what that -# machine configuration needs. -DEFAULTTUNE_k3r5 = "armv7athf" - -# Force using a separate TMPDIR for the multiconfig to avoid -# issues (e.g. using the rm_work class currently fails with the -# single shared TMPDIR). -TMPDIR_k3r5 = "${TOPDIR}/tmp-${BB_CURRENT_MC}" -# But we then also need to redefine DEPLOY_DIR for it to match -# the existing expectations (pointing into the default config) -DEPLOY_DIR_k3r5 = "${TOPDIR}/tmp/deploy" - -# Workaround for recipe assumption of poky location -LIC_FILES_CHKSUM:pn-ti-rtos-firmware = "file://${THISDIR}/../../licenses/TI-TFL;md5=a1b59cb7ba626b9dbbcbf00f3fbc438a" diff --git a/meta-agl-bsp/conf/include/agl_j721e-evm.inc b/meta-agl-bsp/conf/include/agl_j721e-evm.inc new file mode 100644 index 000000000..963b5697d --- /dev/null +++ b/meta-agl-bsp/conf/include/agl_j721e-evm.inc @@ -0,0 +1,11 @@ +# j721e-evm has a k3r5 BBMULTICONFIG to build its bootloader +# firmware, need to use an override to set DEFAULTTUNE back to +# what that machine configuration needs. +DEFAULTTUNE:k3r5:forcedefaulttune = "armv7athf" + +# Workaround for recipe assumption of poky location +LIC_FILES_CHKSUM:pn-ti-rtos-firmware = "file://${THISDIR}/../../licenses/TI-TFL;md5=a1b59cb7ba626b9dbbcbf00f3fbc438a" + +# meta-ti-bsp layer conf does break expectations wrt common folders +# meta-ti-bsp/conf/layer.conf:TI_COMMON_DEPLOY ?= "${TOPDIR}/deploy-ti" +TI_COMMON_DEPLOY := "${TMPDIR}/deploy"
\ No newline at end of file diff --git a/meta-agl-bsp/conf/include/agl_m3-salvator-x-nogfx.inc b/meta-agl-bsp/conf/include/agl_m3-salvator-x-nogfx.inc index 7f1248065..ebbb3006a 100644 --- a/meta-agl-bsp/conf/include/agl_m3-salvator-x-nogfx.inc +++ b/meta-agl-bsp/conf/include/agl_m3-salvator-x-nogfx.inc @@ -1,10 +1,6 @@ -require conf/include/agl_rcar-nogfx.inc +require conf/include/agl_salvator-nogfx.inc SOC_FAMILY = "r8a7796" BOARD_NAME = "m3-salvator-x" DTB_SUFFIX = "r8a7796-salvator-xs" -# Mask graphic Pkgs -BBMASK += "gles-user-module|kernel-module-gles|wayland-kms|libgbm" -# Mask MMP recipes -BBMASK += "kernel-module-uvcs-drv|omx-user-module" diff --git a/meta-agl-bsp/conf/include/agl_m3-salvator-x.inc b/meta-agl-bsp/conf/include/agl_m3-salvator-x.inc index b332c4b81..355040ba9 100644 --- a/meta-agl-bsp/conf/include/agl_m3-salvator-x.inc +++ b/meta-agl-bsp/conf/include/agl_m3-salvator-x.inc @@ -1,9 +1,6 @@ -require conf/include/agl_rcar.inc +require conf/include/agl_salvator.inc SOC_FAMILY = "r8a7796" BOARD_NAME = "m3-salvator-x" DTB_SUFFIX = "r8a7796-salvator-xs" -IMAGE_INSTALL:append:rcar-gen3 = " \ - kernel-module-vspmif \ -" diff --git a/meta-agl-bsp/conf/include/agl_m3ulcb-nogfx.inc b/meta-agl-bsp/conf/include/agl_m3ulcb-nogfx.inc index f319e97de..31d99c342 100644 --- a/meta-agl-bsp/conf/include/agl_m3ulcb-nogfx.inc +++ b/meta-agl-bsp/conf/include/agl_m3ulcb-nogfx.inc @@ -2,19 +2,27 @@ require conf/include/agl_rcar-nogfx.inc SOC_FAMILY = "r8a7796" BOARD_NAME = "m3ulcb" -DTB_SUFFIX = "r8a7796-m3ulcb" +DTB_SUFFIX = "r8a77960-ulcb" # Mask graphic Pkgs BBMASK += "gles-user-module|kernel-module-gles|wayland-kms|libgbm" # Mask MMP recipes BBMASK += "kernel-module-uvcs-drv|omx-user-module" -DISTRO_FEATURES:append = "${@bb.utils.contains('AGL_XEN_WANTED', '1', ' xen', '', d)}" -IMAGE_INSTALL:append = "${@bb.utils.contains('AGL_XEN_WANTED', '1', ' xen-base xen-mkimage', '', d)}" - -# Workaround for SPEC-3706 - versioned bbappends and upstream moved on to 1.16.3 -BBMASK += "meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-.*1.16.2\.bbappend" +# Work around use of obsolete Weston backend-fbdev in meta-rcar-gen3 +# when building without the proprietary driver stack. Masking out the +# weston_%.bbappend seems the simplest approach for now, as forcing +# USE_GLES = "1" to disable the adding of -Dbackend-default="fbdev" to +# EXTRA_OEMESON triggers adding "libgbm" to DEPENDS, which breaks due +# to that being a component specific to the proprietary stack we are +# explicitly disabling. If the "libgbm" usage in the bbappend was +# instead "virtual/libgbm" as is now used in poky, it might be possible +# to just tweak PREFERRED_PROVIDER_virtual/libgbm = "mesa". +BBMASK += "meta-rcar-gen3/recipes-graphics/wayland/weston_%.bbappend" # do use software rendering to display the compositor # used for images w/o binary-only driver WESTON_USE_PIXMAN = "1" + +DISTRO_FEATURES:append = "${@bb.utils.contains('AGL_XEN_WANTED', '1', ' xen', '', d)}" +IMAGE_INSTALL:append = "${@bb.utils.contains('AGL_XEN_WANTED', '1', ' xen-base xen-mkimage', '', d)}" diff --git a/meta-agl-bsp/conf/include/agl_m3ulcb.inc b/meta-agl-bsp/conf/include/agl_m3ulcb.inc index 652a61126..4f788324c 100644 --- a/meta-agl-bsp/conf/include/agl_m3ulcb.inc +++ b/meta-agl-bsp/conf/include/agl_m3ulcb.inc @@ -2,7 +2,7 @@ require conf/include/agl_rcar.inc SOC_FAMILY = "r8a7796" BOARD_NAME = "m3ulcb" -DTB_SUFFIX = "r8a7796-m3ulcb" +DTB_SUFFIX = "r8a77960-ulcb" DISTRO_FEATURES:append = "${@bb.utils.contains('AGL_XEN_WANTED', '1', ' xen', '', d)}" -IMAGE_INSTALL:append = "${@bb.utils.contains('AGL_XEN_WANTED', '1', ' xen-base xen-mkimage', '', d)}"
\ No newline at end of file +IMAGE_INSTALL:append = "${@bb.utils.contains('AGL_XEN_WANTED', '1', ' xen-base xen-mkimage', '', d)}" diff --git a/meta-agl-bsp/conf/include/agl_nitrogen6x.inc b/meta-agl-bsp/conf/include/agl_nitrogen6x.inc deleted file mode 100644 index cb13de713..000000000 --- a/meta-agl-bsp/conf/include/agl_nitrogen6x.inc +++ /dev/null @@ -1 +0,0 @@ -require agl_imx6-common.inc diff --git a/meta-agl-bsp/conf/include/agl_qemuarm.inc b/meta-agl-bsp/conf/include/agl_qemuarm.inc index f45b2d445..2449e1800 100644 --- a/meta-agl-bsp/conf/include/agl_qemuarm.inc +++ b/meta-agl-bsp/conf/include/agl_qemuarm.inc @@ -7,6 +7,9 @@ ROOT_VM = "root=PARTUUID=${DISK_SIGNATURE}-02" # Use our own wks file WKS_FILE="directdisk.wks.in" +# Use pixman as software renderer to avoid high cpu consumption by GL-renderer +WESTON_USE_PIXMAN = "1" + # Over-ride setting in oe-core's qemuboot.bbclass QB_MEM:qemuarm = "-m 2048" diff --git a/meta-agl-bsp/conf/include/agl_qemuarm64.inc b/meta-agl-bsp/conf/include/agl_qemuarm64.inc index 089c4f261..46d3b4c39 100644 --- a/meta-agl-bsp/conf/include/agl_qemuarm64.inc +++ b/meta-agl-bsp/conf/include/agl_qemuarm64.inc @@ -7,6 +7,9 @@ ROOT_VM = "root=PARTUUID=${DISK_SIGNATURE}-02" # Use our own wks file WKS_FILE="directdisk.wks.in" +# Use pixman as software renderer to avoid high cpu consumption by GL-renderer +WESTON_USE_PIXMAN = "1" + # Over-ride setting in oe-core's qemuboot.bbclass QB_MEM:qemuarm64 = "-m 2048" diff --git a/meta-agl-bsp/conf/include/agl_qemux86-64.inc b/meta-agl-bsp/conf/include/agl_qemux86-64.inc index 638778b81..cb40b8b37 100644 --- a/meta-agl-bsp/conf/include/agl_qemux86-64.inc +++ b/meta-agl-bsp/conf/include/agl_qemux86-64.inc @@ -34,7 +34,7 @@ MACHINE_EXTRA_RRECOMMENDS:append = " \ # NOTE: wic.{xz,bmap} are here since qemu targets override # AGL_DEFAULT_IMAGE_FSTYPES to not include them, but for Intel # we actually do want them for use on physical hardware. -AGL_EXTRA_IMAGE_FSTYPES = "wic.xz wic.bmap ${@bb.utils.contains('DISTRO_FEATURES', 'AGLCI', 'wic.vmdk.xz', 'wic.vmdk', d)}" +AGL_EXTRA_IMAGE_FSTYPES = "wic.xz wic.bmap ${@bb.utils.contains('AGL_FEATURES', 'AGLCI', 'wic.vmdk.xz', 'wic.vmdk', d)}" IMAGE_BOOT_FILES:sota = "u-boot-qemux86-64.rom" # Root device diff --git a/meta-agl-bsp/conf/include/agl_raspberrypi4.inc b/meta-agl-bsp/conf/include/agl_raspberrypi4.inc index 5a0e89e66..7fd878d66 100644 --- a/meta-agl-bsp/conf/include/agl_raspberrypi4.inc +++ b/meta-agl-bsp/conf/include/agl_raspberrypi4.inc @@ -11,7 +11,7 @@ RPI_USE_U_BOOT = "1" ENABLE_UART ?= "1" # For libomxil -#LICENSE_FLAGS_WHITELIST = "commercial" +#LICENSE_FLAGS_ACCEPTED = "commercial" IMAGE_INSTALL:append = " kernel-modules linux-firmware-rpidistro-bcm43430 linux-firmware-rpidistro-bcm43455 create-combined-dtb " @@ -30,6 +30,5 @@ IMAGE_INSTALL:append = " ${@bb.utils.contains('AGL_XEN_WANTED', '1', 'xen-tools # Add xen-raspberry binary to boot files IMAGE_BOOT_FILES:append = " ${@bb.utils.contains('AGL_XEN_WANTED','1', 'xen-${MACHINE}', '',d)}" -PREFERRED_VERSION_u-boot = "2021.07" -PREFERRED_VERSION_u-boot-tools = "2021.07" -UBOOT_MACHINE:rpi = "rpi_arm64_config" +#DISPLAY CONFIGURATION +WESTON_DISPLAYS:raspberrypi4 = " hdmi-a-1-90 hdmi-a-2-90" diff --git a/meta-agl-bsp/conf/include/agl_raspberrypi5.inc b/meta-agl-bsp/conf/include/agl_raspberrypi5.inc new file mode 100644 index 000000000..a0e675956 --- /dev/null +++ b/meta-agl-bsp/conf/include/agl_raspberrypi5.inc @@ -0,0 +1,34 @@ +# Maximum memory allowed to be assigned +GPU_MEM = "256" + +# Add CMA to the kernel arguments for SOTA +OSTREE_KERNEL_ARGS:sota:append = " cma=256M" + +# use u-boot always (RPi5 U-boot is not ready yet) +RPI_USE_U_BOOT = "0" + +# Use UART for serial console +ENABLE_UART ?= "1" + +# For libomxil +#LICENSE_FLAGS_ACCEPTED = "commercial" + +IMAGE_INSTALL:append = " kernel-modules linux-firmware-rpidistro-bcm43430 linux-firmware-rpidistro-bcm43455 create-combined-dtb " + +# Psplash causes crash on first boot on RPi +IMAGE_FEATURES:remove = "splash" + +# Build updatable image. Only takes effect when sota.bbclass is inherited +DISTRO_FEATURES:append = " sota" + +# Add xen build, if the xen feature activated +DISTRO_FEATURES:append = " ${@bb.utils.contains('AGL_XEN_WANTED', '1', ' xen', '', d)}" + +# add xen-tools to build +IMAGE_INSTALL:append = " ${@bb.utils.contains('AGL_XEN_WANTED', '1', 'xen-tools xen-mkimage-rpi4', '', d)}" + +# Add xen-raspberry binary to boot files +IMAGE_BOOT_FILES:append = " ${@bb.utils.contains('AGL_XEN_WANTED','1', 'xen-${MACHINE}', '',d)}" + +#DISPLAY CONFIGURATION +WESTON_DISPLAYS:raspberrypi5 = " hdmi-a-1-90 hdmi-a-2-90" diff --git a/meta-agl-bsp/conf/include/agl_rcar-nogfx.inc b/meta-agl-bsp/conf/include/agl_rcar-nogfx.inc index f3548b8ab..fb67fd976 100644 --- a/meta-agl-bsp/conf/include/agl_rcar-nogfx.inc +++ b/meta-agl-bsp/conf/include/agl_rcar-nogfx.inc @@ -4,7 +4,7 @@ OSTREE_KERNEL = "Image" IMAGE_BOOT_FILES:sota = "renesas-ota-bootfiles/* ${DTB_SUFFIX}.dtb" OSTREE_BOOTLOADER ?= "u-boot" -WKS_FILE = "singlepart-noloader.wks" +WKS_FILE:rcar-gen3 = "singlepart-noloader.wks" RENESAS_DATADIR = "/usr" @@ -41,3 +41,20 @@ PSEUDO_IGNORE_PATHS:append:pn-kernel-module-qos = ",${KERNELSRC}" PSEUDO_IGNORE_PATHS:append:pn-kernel-module-vsp2driver = ",${KERNELSRC}" PSEUDO_IGNORE_PATHS:append:pn-kernel-module-vspmif = ",${KERNELSRC}" PSEUDO_IGNORE_PATHS:append:pn-kernel-module-vspm = ",${KERNELSRC}" + +# Mask out base-files and systemd bbappends to avoid changing systemd-tmpfiles +# behavior, see SPEC-4256 for a more involved explanation. +BBMASK += "meta-renesas/meta-rcar-gen3/recipes-core/base-files/ meta-renesas/meta-rcar-gen3/recipes-core/systemd/" + +# Mask out cogl bbappend to avoid meta-gnome dependency +BBMASK += "meta-renesas/meta-rcar-gen3/recipes-graphics/cogl/cogl-1.0_1.%.bbappend" + +# Provide default value that avoids errors from a new packaging QA +# check with respect to packagegroups depending on versioned library +# packages needing to be machine-specific. +# +# Note that this needs to be done here in global configuration space as +# opposed to in a bbappend because the value needs to be set before the +# packagegroup bbclass is inherited. This can be removed when upstream +# is fixed to add the required PACKAGE_ARCH = "${MACHINE_ARCH}". +PACKAGE_ARCH:pn-packagegroup-multimedia-libs = "${MACHINE_ARCH}" diff --git a/meta-agl-bsp/conf/include/agl_rcar.inc b/meta-agl-bsp/conf/include/agl_rcar.inc index 6dc40dcb5..e1169c21e 100644 --- a/meta-agl-bsp/conf/include/agl_rcar.inc +++ b/meta-agl-bsp/conf/include/agl_rcar.inc @@ -1,33 +1,37 @@ require conf/include/agl_rcar-nogfx.inc # Enable AGL virtualization features -MACHINE_FEATURES:append = " agl-egvirt" +MACHINE_FEATURES:append:rcar-gen3 = " agl-egvirt" # Enable Gfx Pkgs -MACHINE_FEATURES:append = " gsx" -MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2" +MACHINE_FEATURES:append:rcar-gen3 = " gsx" +BB_MULTI_PROVIDER_ALLOWED:append:rcar-gen3 = " virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2" # for Wayland/Weston -PREFERRED_PROVIDER_virtual/libgles1 = "" -PREFERRED_PROVIDER_virtual/libgles2 = "virtual-gles-user-module" -PREFERRED_PROVIDER_virtual/egl = "virtual-gles-user-module" -PREFERRED_PROVIDER_virtual/libgl = "" -PREFERRED_PROVIDER_virtual/mesa = "mesa" -PREFERRED_PROVIDER_libgbm = "libgbm" -PREFERRED_RPROVIDER_libgbm-dev = "libgbm" +PREFERRED_PROVIDER_virtual/libgles1:rcar-gen3 = "" +PREFERRED_PROVIDER_virtual/libgles2:rcar-gen3 = "virtual-gles-user-module" +PREFERRED_PROVIDER_virtual/egl:rcar-gen3 = "virtual-gles-user-module" +PREFERRED_PROVIDER_virtual/libgl:rcar-gen3 = "" +PREFERRED_PROVIDER_virtual/mesa:rcar-gen3 = "mesa" -PREFERRED_RPROVIDER_libomxil = "omx-user-module" -PREFERRED_PROVIDER_virtual/libomxil = "omx-user-module" +PREFERRED_PROVIDER_libgbm:rcar-gen3 = "libgbm" +PREFERRED_PROVIDER_virtual/libgbm:rcar-gen3 = "libgbm" +PREFERRED_RPROVIDER_libgbm-dev:rcar-gen3 = "libgbm" + + +PREFERRED_RPROVIDER_libomxil:rcar-gen3 = "omx-user-module" +PREFERRED_PROVIDER_virtual/libomxil:rcar-gen3 = "omx-user-module" +VIRTUAL-RUNTIME_libomxil:rcar-gen3 = "omx-user-module" # Add for gstreamer plugins ugly -LICENSE_FLAGS_WHITELIST = "commercial" +LICENSE_FLAGS_ACCEPTED:rcar-gen3 = "commercial" -MACHINE_FEATURES:append = " multimedia" +MACHINE_FEATURES:append:rcar-gen3 = " multimedia" -DISTRO_FEATURES:append = " use_eva_pkg" +DISTRO_FEATURES:append:rcar-gen3 = " use_eva_pkg" -#DISTRO_FEATURES:append = " h265dec_lib mpeg2dec_lib" -DISTRO_FEATURES:append = " h264dec_lib h264enc_lib aaclcdec_lib aaclcdec_mdw" +#DISTRO_FEATURES:append:rcar-gen3 = " h265dec_lib mpeg2dec_lib" +DISTRO_FEATURES:append:rcar-gen3 = " h264dec_lib h264enc_lib aaclcdec_lib aaclcdec_mdw" # Mask out meta-renesas-rcar-gen3's tweaks to weston-init, as they do # not seem necessary for anything in AGL, and the addition of @@ -38,7 +42,7 @@ DISTRO_FEATURES:append = " h264dec_lib h264enc_lib aaclcdec_lib aaclcdec_mdw" # getting weston started. There is no clear rationale expressed in the # meta-renesas-rcar-gen3 commit history for the extra dependencies, and # testing shows no issues on H3ULCB when not having them. -BBMASK += "meta-rcar-gen3/recipes-graphics/wayland/weston-init.bbappend" +BBMASK += "meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/weston-init.bbappend" # Add graphics and decoder drivers to packagegroup-machine-base # recommendation. diff --git a/meta-agl-bsp/conf/include/agl_refhw-h3.inc b/meta-agl-bsp/conf/include/agl_refhw-h3.inc index cd3094c92..6eee8149f 100644 --- a/meta-agl-bsp/conf/include/agl_refhw-h3.inc +++ b/meta-agl-bsp/conf/include/agl_refhw-h3.inc @@ -1,12 +1,12 @@ -AGL_FEATURES:append = " agl-refhw-h3" +AGL_FEATURES:append:h3ulcb = " agl-refhw-h3" # Reference hardware has USB3 -MACHINE_FEATURES:append = " usb3" +MACHINE_FEATURES:append:h3ulcb = " usb3" -KERNEL_DEVICETREE:append = " renesas/r8a7795-agl-refhw.dtb" +KERNEL_DEVICETREE:append:h3ulcb = " renesas/r8a77951-agl-refhw.dtb" -UBOOT_CONFIG:append = " agl-refhw-4x2g" -UBOOT_CONFIG[agl-refhw-4x2g] = "r8a7795_salvator-xs-4x2g_defconfig" +UBOOT_CONFIG:append:h3ulcb = " agl-refhw" +UBOOT_CONFIG[agl-refhw] = "rcar3_salvator-x_defconfig" MACHINE_EXTRA_RRECOMMENDS:append:h3ulcb = " \ linux-firmware-wl18xx \ diff --git a/meta-agl-bsp/conf/include/agl_s4sk.inc b/meta-agl-bsp/conf/include/agl_s4sk.inc new file mode 100644 index 000000000..8f4a91b44 --- /dev/null +++ b/meta-agl-bsp/conf/include/agl_s4sk.inc @@ -0,0 +1,9 @@ +SOC_FAMILY = "r8a779f0" +BOARD_NAME = "s4sk" + +#ws2.0 +DTB_SUFFIX = "r8a779f0-s4sk" +WKS_FILE = "singlepart-noloader.wks" +IMAGE_INSTALL:append = " \ + kernel-devicetree \ +" diff --git a/meta-agl-bsp/conf/include/agl_salvator-nogfx.inc b/meta-agl-bsp/conf/include/agl_salvator-nogfx.inc new file mode 100644 index 000000000..06e635ca0 --- /dev/null +++ b/meta-agl-bsp/conf/include/agl_salvator-nogfx.inc @@ -0,0 +1,17 @@ +require conf/include/agl_rcar-nogfx.inc + +# Mask graphic Pkgs +BBMASK += "gles-user-module|kernel-module-gles|wayland-kms|libgbm" +# Mask MMP recipes +BBMASK += "kernel-module-uvcs-drv|omx-user-module" +# Work around use of obsolete Weston backend-fbdev in meta-rcar-gen3 +# when building without the proprietary driver stack. Masking out the +# weston_%.bbappend seems the simplest approach for now, as forcing +# USE_GLES = "1" to disable the adding of -Dbackend-default="fbdev" to +# EXTRA_OEMESON triggers adding "libgbm" to DEPENDS, which breaks due +# to that being a component specific to the proprietary stack we are +# explicitly disabling. If the "libgbm" usage in the bbappend was +# instead "virtual/libgbm" as is now used in poky, it might be possible +# to just tweak PREFERRED_PROVIDER_virtual/libgbm = "mesa". +BBMASK += "meta-rcar-gen3/recipes-graphics/wayland/weston_%.bbappend" + diff --git a/meta-agl-bsp/conf/include/agl_salvator.inc b/meta-agl-bsp/conf/include/agl_salvator.inc new file mode 100644 index 000000000..78457868a --- /dev/null +++ b/meta-agl-bsp/conf/include/agl_salvator.inc @@ -0,0 +1,6 @@ +require conf/include/agl_rcar.inc + +IMAGE_INSTALL:append:rcar-gen3 = " \ + kernel-module-vspm-if \ +" + diff --git a/meta-agl-bsp/conf/include/agl_unmatched.inc b/meta-agl-bsp/conf/include/agl_unmatched.inc new file mode 100644 index 000000000..f7c9f75f2 --- /dev/null +++ b/meta-agl-bsp/conf/include/agl_unmatched.inc @@ -0,0 +1,4 @@ +# firmware for graphics +MACHINE_EXTRA_RRECOMMENDS:append = " linux-firmware-radeon linux-firmware-amdgpu " + +# diff --git a/meta-agl-bsp/conf/layer.conf b/meta-agl-bsp/conf/layer.conf index 2a999ddd5..cd98a9dfc 100644 --- a/meta-agl-bsp/conf/layer.conf +++ b/meta-agl-bsp/conf/layer.conf @@ -23,4 +23,4 @@ BBFILE_COLLECTIONS += "aglbsp" BBFILE_PATTERN_aglbsp = "^${LAYERDIR}/" BBFILE_PRIORITY_aglbsp = "60" -LAYERSERIES_COMPAT_aglbsp = "dunfell" +LAYERSERIES_COMPAT_aglbsp = "kirkstone" diff --git a/meta-agl-bsp/conf/machine/include/virtio.inc b/meta-agl-bsp/conf/machine/include/virtio.inc index 8ee71a80b..6f8a638a0 100644 --- a/meta-agl-bsp/conf/machine/include/virtio.inc +++ b/meta-agl-bsp/conf/machine/include/virtio.inc @@ -16,19 +16,8 @@ RDEPENDS:${KERNEL_PACKAGE_NAME}-base = "" PREFERRED_PROVIDER_virtual/kernel ??= "linux-yocto" # Use newer kernel -PREFERRED_VERSION_linux-yocto = "5.10.%" - -# Clear since it is set to 'sllin' in packagegroup-agl-demo.bb, and sllin is not -# compatible with kernel 5.10 at the moment. -LIN_DRIVERS = "" - -# Clear since it is set to 'lttng-modules' in packagegroup-core-tools-profile.bb, -# and lttng-modules are not compatible with 5.10 kernel used for virtio. -LTTNGMODULES:virtio-all = "" +PREFERRED_VERSION_linux-yocto = "5.15.%" EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native" IMAGE_CLASSES += "qemuboot" - -# most driver fails to compile -MOST_DRIVERS ?= "" diff --git a/meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/gpsd-conf-refhw_1.0.bb b/meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/gpsd-machine-conf_1.0.bbappend index 25bdb73c8..3cd5aa7de 100644 --- a/meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/gpsd-conf-refhw_1.0.bb +++ b/meta-agl-bsp/meta-agl-refhw-gen3/recipes-navigation/gpsd/gpsd-machine-conf_1.0.bbappend @@ -1,8 +1,4 @@ -SUMMARY = "AGL Reference Hardware specific gpsd configuration" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" - -PACKAGE_ARCH = "${MACHINE_ARCH}" +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" SRC_URI = "file://gpsd.refhw \ file://refhw-gpsd-helper.sh \ @@ -16,6 +12,7 @@ do_compile[noexec] = "1" do_install() { install -D -m 0644 ${WORKDIR}/gpsd.refhw ${D}/${sysconfdir}/default/gpsd.refhw + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then install -D -m 0755 ${WORKDIR}/refhw-gpsd-helper.sh ${D}/${sbindir}/refhw-gpsd-helper.sh install -d ${D}${sysconfdir}/systemd/system/gpsd.service.d @@ -23,6 +20,10 @@ do_install() { fi } +PACKAGE_ARCH = "${MACHINE_ARCH}" + +CONFFILES:${PN} = "${sysconfdir}/default/gpsd.refhw" + ALTERNATIVE:${PN} = "gpsd-defaults" ALTERNATIVE_LINK_NAME[gpsd-defaults] = "${sysconfdir}/default/gpsd" ALTERNATIVE_TARGET[gpsd-defaults] = "${sysconfdir}/default/gpsd.refhw" @@ -30,9 +31,3 @@ ALTERNATIVE_TARGET[gpsd-defaults] = "${sysconfdir}/default/gpsd.refhw" # default configuration. The script run by the systemd drop-in # will tweak things on boot to handle h3ulcb vs refhw. ALTERNATIVE_PRIORITY[gpsd-defaults] = "5" - -CONFFILES:${PN} = "${sysconfdir}/default/gpsd.refhw" - -# NOTE: Explicitly not defining RPROVIDES of "virtual/gpsd-conf" to -# avoid conflicting with the default configuration and potentially -# changing behavior on m3ulcb/h3ulcb. diff --git a/meta-agl-bsp/meta-core/recipes-graphics/mesa/mesa/0001-virgl-don-t-a-use-staging-when-a-resources-created-w.patch b/meta-agl-bsp/meta-core/recipes-graphics/mesa/mesa/0001-virgl-don-t-a-use-staging-when-a-resources-created-w.patch new file mode 100644 index 000000000..9d6b2f3d0 --- /dev/null +++ b/meta-agl-bsp/meta-core/recipes-graphics/mesa/mesa/0001-virgl-don-t-a-use-staging-when-a-resources-created-w.patch @@ -0,0 +1,48 @@ +From f50ff0b5cf2bfedfc2fd660ccfbfd5cfc3c131d1 Mon Sep 17 00:00:00 2001 +From: Marius Vlad <marius.vlad@collabora.com> +Date: Tue, 28 Mar 2023 15:33:26 +0300 +Subject: [PATCH] virgl: don't a use staging when a resources created with the + shared flag + +There seems to be a problem with running firefox by using Xwayland that +results in a shared resources being not always tagged as using staging. + +As a result one process tries to map the resource that was allocated as +one that uses staging without actually using the staging resource, and +hence the mapped range only accounts for the small region that we have +to allocated because a zero-allocation doesn't work, but the application +mapping the resource assumes that a properly sized range is mapped, and +consequently this results in invalid memory access. + +To work around this issue disable creating staging for resources that +are created by using shared binding. It is not clear to me whether this +is the best fix, but it seems to quell the issue. + +Fixes: c9d99b7eec7ec14d6d71d381a424b6280d75a882 +virgl: Fix texture transfers by using a staging resource + +Related: https://gitlab.freedesktop.org/virgl/virglrenderer/-/issues/291 +Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19655> +(cherry picked from commit e496d24cb2d5339566c08c79a8aa7809c240613c) + +Signed-off-by: Marius Vlad <marius.vlad@collabora.com> +(cherry picked from commit 39e9ea1419beb22ab7f4913b6d55f845f94d689a) +--- + src/gallium/drivers/virgl/virgl_resource.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/gallium/drivers/virgl/virgl_resource.c b/src/gallium/drivers/virgl/virgl_resource.c +index 7185c9a90ff..257b790d437 100644 +--- a/src/gallium/drivers/virgl/virgl_resource.c ++++ b/src/gallium/drivers/virgl/virgl_resource.c +@@ -100,6 +100,7 @@ static bool virgl_can_copy_transfer_from_host(struct virgl_screen *vs, + { + return virgl_can_use_staging(vs, res) && + !is_stencil_array(res) && ++ !(bind & VIRGL_BIND_SHARED) && + virgl_has_readback_format(&vs->base, pipe_to_virgl_format(res->b.format), false) && + ((!(vs->caps.caps.v2.capability_bits & VIRGL_CAP_FAKE_FP64)) || + virgl_can_readback_from_rendertarget(vs, res) || +-- +2.35.1 + diff --git a/meta-agl-bsp/meta-core/recipes-graphics/mesa/mesa_%.bbappend b/meta-agl-bsp/meta-core/recipes-graphics/mesa/mesa_%.bbappend index 3d5903d85..fb797a436 100644 --- a/meta-agl-bsp/meta-core/recipes-graphics/mesa/mesa_%.bbappend +++ b/meta-agl-bsp/meta-core/recipes-graphics/mesa/mesa_%.bbappend @@ -1 +1,3 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + require ${@bb.utils.contains('AGL_FEATURES', 'aglcore', '${BPN}_agl.inc', '', d)} diff --git a/meta-agl-bsp/meta-core/recipes-graphics/mesa/mesa_agl.inc b/meta-agl-bsp/meta-core/recipes-graphics/mesa/mesa_agl.inc index e74761317..c0f5b271d 100644 --- a/meta-agl-bsp/meta-core/recipes-graphics/mesa/mesa_agl.inc +++ b/meta-agl-bsp/meta-core/recipes-graphics/mesa/mesa_agl.inc @@ -1,3 +1,5 @@ +SRC_URI += "file://0001-virgl-don-t-a-use-staging-when-a-resources-created-w.patch" + # The gallium-llvm is recommended as software 3D graphics renderer GALLIUM_LLVM = "gallium-llvm" PACKAGECONFIG:append:qemux86 = " gallium ${GALLIUM_LLVM}" diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-connectivity/hci-uart-helper/hci-uart-helper_1.0.bb b/meta-agl-bsp/meta-freescale-layer/recipes-connectivity/hci-uart-helper/hci-uart-helper_1.0.bb index 1a9c6bb4e..798fcebe6 100644 --- a/meta-agl-bsp/meta-freescale-layer/recipes-connectivity/hci-uart-helper/hci-uart-helper_1.0.bb +++ b/meta-agl-bsp/meta-freescale-layer/recipes-connectivity/hci-uart-helper/hci-uart-helper_1.0.bb @@ -8,7 +8,7 @@ SRC_URI = "file://hci-uart-helper.service \ file://hci-uart-helper.sh \ " -COMPATIBLE_MACHINE = "imx8mqevk" +COMPATIBLE_MACHINE = "imx8mq-evk" do_configure[noexec] = "1" do_compile[noexec] = "1" diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-graphics/mesa/files/0001-kmsro-add-imx-dcss.patch b/meta-agl-bsp/meta-freescale-layer/recipes-graphics/mesa/files/0001-kmsro-add-imx-dcss.patch deleted file mode 100644 index 7f7ab9124..000000000 --- a/meta-agl-bsp/meta-freescale-layer/recipes-graphics/mesa/files/0001-kmsro-add-imx-dcss.patch +++ /dev/null @@ -1,34 +0,0 @@ -Add i.MX8MQ DCSS kmsro support - -Add required dummy entry for NXP's i.MX8MQ DCSS display controller DRM -driver to the kmsro configuration so that the loader will not think it -is a GPU. - -Upstream-Status: pending -Signed-off-by: Scott Murray <scott.murray@konsulko.com> ---- - -diff --git a/src/gallium/targets/dri/meson.build b/src/gallium/targets/dri/meson.build -index ae25a21..17379c7 100644 ---- a/src/gallium/targets/dri/meson.build -+++ b/src/gallium/targets/dri/meson.build -@@ -72,6 +72,7 @@ foreach d : [[with_gallium_kmsro, [ - 'hx8357d_dri.so', - 'ili9225_dri.so', - 'ili9341_dri.so', -+ 'imx-dcss_dri.so', - 'imx-drm_dri.so', - 'ingenic-drm_dri.so', - 'mcde_dri.so', -diff --git a/src/gallium/targets/dri/target.c b/src/gallium/targets/dri/target.c -index f71f690..41c5c75 100644 ---- a/src/gallium/targets/dri/target.c -+++ b/src/gallium/targets/dri/target.c -@@ -97,6 +97,7 @@ DEFINE_LOADER_DRM_ENTRYPOINT(exynos) - DEFINE_LOADER_DRM_ENTRYPOINT(hx8357d) - DEFINE_LOADER_DRM_ENTRYPOINT(ili9225) - DEFINE_LOADER_DRM_ENTRYPOINT(ili9341) -+DEFINE_LOADER_DRM_ENTRYPOINT(imx_dcss) - DEFINE_LOADER_DRM_ENTRYPOINT(imx_drm) - DEFINE_LOADER_DRM_ENTRYPOINT(ingenic_drm) - DEFINE_LOADER_DRM_ENTRYPOINT(mcde) diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-graphics/mesa/mesa_%.bbappend b/meta-agl-bsp/meta-freescale-layer/recipes-graphics/mesa/mesa_%.bbappend deleted file mode 100644 index e7633f215..000000000 --- a/meta-agl-bsp/meta-freescale-layer/recipes-graphics/mesa/mesa_%.bbappend +++ /dev/null @@ -1,10 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/files:" - -SRC_URI += "file://0001-kmsro-add-imx-dcss.patch" - -# These over-rides should use "use-mainline-bsp" instead when that -# becomes more workable for i.MX8 in upstream meta-freescale. - -USE_OSMESA_ONLY:etnaviv = "no" - -PACKAGECONFIG:append:etnaviv = " gallium etnaviv kmsro" diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston_8.0.0.imx.bbappend b/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston_10.0.1.imx.bbappend index 270d8e8f5..07a43f958 100644 --- a/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston_8.0.0.imx.bbappend +++ b/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston_10.0.1.imx.bbappend @@ -3,7 +3,7 @@ # has been resolved by a revert of that breakage upstream. # What is done below is effectively a disabling of the "wayland" # PACKAGECONFIG option and then open coding what its effects would -# normally be, since the _remove prevents specifying it in the usual way. +# normally be, since the :remove prevents specifying it in the usual way. PACKAGECONFIG[wayland] = "" DEPENDS:append = " virtual/egl virtual/libgles2" PACKAGECONFIG_CONFARGS:append = " -Dbackend-wayland=true" diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch deleted file mode 100644 index 1b17bc73f..000000000 --- a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch +++ /dev/null @@ -1,49 +0,0 @@ -From c8bbb0f916de54610513e376070aea531af19dd6 Mon Sep 17 00:00:00 2001 -From: jooseong lee <jooseong.lee@samsung.com> -Date: Thu, 3 Nov 2016 10:55:43 +0100 -Subject: [PATCH 4/4] Smack: Assign smack_known_web label for kernel thread's -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Assign smack_known_web label for kernel thread's socket in the sk_alloc_security hook - -Creating struct sock by sk_alloc function in various kernel subsystems -like bluetooth dosen't call smack_socket_post_create(). In such case, -received sock label is the floor('_') label and makes access deny. - -Refers-to: https://review.tizen.org/gerrit/#/c/80717/4 - -Change-Id: I2e5c9359bfede84a988fd4d4d74cdb9dfdfc52d8 -Signed-off-by: jooseong lee <jooseong.lee@samsung.com> -Signed-off-by: José Bollo <jose.bollo@iot.bzh> ---- - security/smack/smack_lsm.c | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c -index e45f0a3..a3f3ccc 100644 ---- a/security/smack/smack_lsm.c -+++ b/security/smack/smack_lsm.c -@@ -2107,8 +2107,16 @@ static int smack_sk_alloc_security(struct sock *sk, int family, gfp_t gfp_flags) - if (ssp == NULL) - return -ENOMEM; - -- ssp->smk_in = skp; -- ssp->smk_out = skp; -+ /* -+ * Sockets created by kernel threads receive web label. -+ */ -+ if (unlikely(current->flags & PF_KTHREAD)) { -+ ssp->smk_in = &smack_known_web; -+ ssp->smk_out = &smack_known_web; -+ } else { -+ ssp->smk_in = skp; -+ ssp->smk_out = skp; -+ } - ssp->smk_packet = NULL; - - sk->sk_security = ssp; --- -2.7.4 - diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx/0001-enable-mhdp-with-etnaviv.patch b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx/0001-enable-mhdp-with-etnaviv.patch index 23ca0475a..f95891a2f 100644 --- a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx/0001-enable-mhdp-with-etnaviv.patch +++ b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx/0001-enable-mhdp-with-etnaviv.patch @@ -8,16 +8,15 @@ Upstream-Status: pending Signed-off-by: Scott Murray <scott.murray@konsulko.com> --- -diff --git a/drivers/gpu/drm/imx/Kconfig b/drivers/gpu/drm/imx/Kconfig -index 63d5f1b532ee..a18ba56aa218 100644 ---- a/drivers/gpu/drm/imx/Kconfig -+++ b/drivers/gpu/drm/imx/Kconfig -@@ -85,7 +85,7 @@ config DRM_IMX_CDNS_MHDP - select DRM_CDNS_DP +diff --git a/drivers/gpu/drm/imx/mhdp/Kconfig b/drivers/gpu/drm/imx/mhdp/Kconfig +index 225ccc3638a8..164b42f04e94 100644 +--- a/drivers/gpu/drm/imx/mhdp/Kconfig ++++ b/drivers/gpu/drm/imx/mhdp/Kconfig +@@ -7,6 +7,6 @@ config DRM_IMX_CDNS_MHDP select DRM_CDNS_HDMI select DRM_CDNS_AUDIO + select DRM_CDNS_HDMI_HDCP - depends on DRM_IMX + depends on DRM_IMX || DRM_ETNAVIV help Choose this if you want to use HDMI on i.MX8. - diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx/0002-dts-enable-etnaviv.patch b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx/0002-dts-enable-etnaviv.patch index 4ce9b9d38..4ed4b685e 100644 --- a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx/0002-dts-enable-etnaviv.patch +++ b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx/0002-dts-enable-etnaviv.patch @@ -4,15 +4,14 @@ Some further investigation is required into how to manage this upstream in meta-freescale, as it is not required for the i.MX6 platforms AFAIK. Upstream-Status: pending - Signed-off-by: Scott Murray <scott.murray@konsulko.com> --- diff --git a/arch/arm64/boot/dts/freescale/imx8mq-evk.dts b/arch/arm64/boot/dts/freescale/imx8mq-evk.dts -index f2a7e4069a0d..c0b6c5052656 100755 +index c3f8a24c3943..754fbfe30f0a 100755 --- a/arch/arm64/boot/dts/freescale/imx8mq-evk.dts +++ b/arch/arm64/boot/dts/freescale/imx8mq-evk.dts -@@ -1074,7 +1074,7 @@ +@@ -1224,7 +1224,7 @@ &vpu_v4l2 { status = "okay"; }; diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx_%.bbappend b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx_%.bbappend index cc26e25c6..0772a98a8 100644 --- a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx_%.bbappend +++ b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx_%.bbappend @@ -1,6 +1,6 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:${THISDIR}/files:" +FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" -require recipes-kernel/linux/linux-yocto-agl.inc +require linux-fslc.inc # These patches and the configuration fragment below will need to be # revisited if/when using IMX_DEFAULT_BSP = "mainline" with i.MX8 @@ -10,22 +10,8 @@ SRC_URI:append:etnaviv = " \ file://0002-dts-enable-etnaviv.patch \ " -# Make sure these are enabled so that AGL systemd configuration works -AGL_KCONFIG_FRAGMENTS += " \ - tmpfs.cfg \ - namespace.cfg \ - cgroup.cfg \ -" - -# Support for CFG80211 subsystem -AGL_KCONFIG_FRAGMENTS += "cfg80211.cfg" - -# Turn off a couple of things enabled by default by Freescale -# (lock debugging and userspace firmware loader fallback) -AGL_KCONFIG_FRAGMENTS += "fixups.cfg" - # Support for i.MX8MQ EVKB (e.g. Broadcom wifi) -AGL_KCONFIG_FRAGMENTS:append:imx8mqevk = " imx8mq-evkb.cfg" +AGL_KCONFIG_FRAGMENTS:append:imx8mq-evk = " imx8mq-evkb.cfg" # Build in etnaviv if required AGL_KCONFIG_FRAGMENTS:append:etnaviv = " etnaviv.cfg" diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-lts_%.bbappend b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-lts_%.bbappend new file mode 100644 index 000000000..1007f3c7c --- /dev/null +++ b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-lts_%.bbappend @@ -0,0 +1 @@ +require linux-fslc.inc diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc.inc b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc.inc new file mode 100644 index 000000000..948b8c22c --- /dev/null +++ b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc.inc @@ -0,0 +1,22 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +require recipes-kernel/linux/linux-yocto-agl.inc + +# Make sure these are enabled so that AGL systemd configuration works +AGL_KCONFIG_FRAGMENTS += " \ + tmpfs.cfg \ + namespace.cfg \ + cgroup.cfg \ +" + +# Support for CFG80211 subsystem +AGL_KCONFIG_FRAGMENTS += "cfg80211.cfg" + +# Turn off a couple of things enabled by default by Freescale +# (lock debugging and userspace firmware loader fallback) +AGL_KCONFIG_FRAGMENTS += "fixups.cfg" + +do_install:append:cubox-i() { + # Add symlink to work with default Hummingboard 2 u-boot configuration + ln -sf imx6q-hummingboard2.dtb ${D}/boot/imx6q-hummingboard2-emmc.dtb +} diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc_%.bbappend b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc_%.bbappend index 948b8c22c..1007f3c7c 100644 --- a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc_%.bbappend +++ b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc_%.bbappend @@ -1,22 +1 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/files:" - -require recipes-kernel/linux/linux-yocto-agl.inc - -# Make sure these are enabled so that AGL systemd configuration works -AGL_KCONFIG_FRAGMENTS += " \ - tmpfs.cfg \ - namespace.cfg \ - cgroup.cfg \ -" - -# Support for CFG80211 subsystem -AGL_KCONFIG_FRAGMENTS += "cfg80211.cfg" - -# Turn off a couple of things enabled by default by Freescale -# (lock debugging and userspace firmware loader fallback) -AGL_KCONFIG_FRAGMENTS += "fixups.cfg" - -do_install:append:cubox-i() { - # Add symlink to work with default Hummingboard 2 u-boot configuration - ln -sf imx6q-hummingboard2.dtb ${D}/boot/imx6q-hummingboard2-emmc.dtb -} +require linux-fslc.inc diff --git a/meta-agl-bsp/meta-iot-cloud/recipes-aws/aws-iot-device-sdk-embedded-c/aws-iot-device-sdk-embedded-c.bb b/meta-agl-bsp/meta-iot-cloud/recipes-aws/aws-iot-device-sdk-embedded-c/aws-iot-device-sdk-embedded-c.bb deleted file mode 100644 index 0b8088657..000000000 --- a/meta-agl-bsp/meta-iot-cloud/recipes-aws/aws-iot-device-sdk-embedded-c/aws-iot-device-sdk-embedded-c.bb +++ /dev/null @@ -1,40 +0,0 @@ -DESCRIPTION = "AWS IoT device SDK for embedded C" -AUTHOR = "AWS" -HOMEPAGE = "https://github.com/aws/aws-iot-device-sdk-embedded-C" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=acc7a1bf87c055789657b148939e4b40" - -SRC_URI = "\ - git://github.com/aws/aws-iot-device-sdk-embedded-C.git;protocol=https \ - file://Makefile.aws \ - file://aws_iot_config.h \ - file://awsiotsdk.pc \ -" -SRCREV = "d039f075e1cc2a2a7fc20edc6868f328d8d36b2f" - -S = "${WORKDIR}/git" -B = "${WORKDIR}/build" - -DEPENDS = "mbedtls" -RDEPENDS:${PN} += "mbedtls" - -do_configure:prepend() { - cp ${WORKDIR}/Makefile.aws ${S}/src - cp ${WORKDIR}/aws_iot_config.h ${S}/include - cp ${WORKDIR}/awsiotsdk.pc ${S} -} - -do_compile() { - cd ${S}/src - oe_runmake -f ./Makefile.aws DESTDIR=${D} all -} - -do_install() { - cd ${S}/src - oe_runmake -f ./Makefile.aws DESTDIR=${D} install -} - -BBCLASSEXTEND = "native nativesdk" - -ALLOW_EMPTY:${PN} = "1" - diff --git a/meta-agl-bsp/meta-iot-cloud/recipes-aws/aws-iot-device-sdk-embedded-c/files/Makefile.aws b/meta-agl-bsp/meta-iot-cloud/recipes-aws/aws-iot-device-sdk-embedded-c/files/Makefile.aws deleted file mode 100644 index d4f18c0f9..000000000 --- a/meta-agl-bsp/meta-iot-cloud/recipes-aws/aws-iot-device-sdk-embedded-c/files/Makefile.aws +++ /dev/null @@ -1,62 +0,0 @@ -########################################################################### -# Copyright 2020 MERA -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -########################################################################### - -# Generated library name -NAME := awsiotsdk - -SRC = . -AWS_SDK_DIR = $(SRC)/.. -PLATFORM_DIR = $(AWS_SDK_DIR)/platform/linux/mbedtls -PLATFORM_COMMON_DIR = $(AWS_SDK_DIR)/platform/linux/common -AWS_INSTALL_HEADERS_DIR = /usr/include/awsiotsdk - - -CFLAGS += -I $(AWS_SDK_DIR)/include -CFLAGS += -I $(AWS_SDK_DIR)/external_libs/jsmn -CFLAGS += -I $(PLATFORM_COMMON_DIR) -CFLAGS += -I $(PLATFORM_DIR) -CFLAGS += -DENABLE_IOT_DEBUG -DENABLE_IOT_INFO -DENABLE_IOT_WARN -DENABLE_IOT_ERROR - - -# Source to compile -SRCS += $(wildcard $(SRC)/*.c) -SRCS += $(wildcard $(AWS_SDK_DIR)/external_libs/jsmn/*.c) -SRCS += $(wildcard $(PLATFORM_DIR)/*.c) -SRCS += $(wildcard $(PLATFORM_COMMON_DIR)/*.c) - -OBJS = $(SRCS:.c=.o) - - -.PHONY: all -all: lib$(NAME).a - -lib$(NAME).a: $(OBJS) - $(AR) -rcs $@ $(OBJS) - -.PHONY: install -install: lib$(NAME).a - install -D -m 0644 lib$(NAME).a $(DESTDIR)/usr/lib/lib$(NAME).a - install -d $(DESTDIR)$(AWS_INSTALL_HEADERS_DIR) - install -m 0644 $(AWS_SDK_DIR)/include/*.h $(DESTDIR)$(AWS_INSTALL_HEADERS_DIR)/ - install -m 0644 $(AWS_SDK_DIR)/external_libs/jsmn/*.h $(DESTDIR)$(AWS_INSTALL_HEADERS_DIR)/ - install -m 0644 $(PLATFORM_COMMON_DIR)/*.h $(DESTDIR)$(AWS_INSTALL_HEADERS_DIR)/ - install -m 0644 $(PLATFORM_DIR)/*.h $(DESTDIR)$(AWS_INSTALL_HEADERS_DIR)/ - install -d $(DESTDIR)/usr/lib/pkgconfig - install -m 0644 ../awsiotsdk.pc $(DESTDIR)/usr/lib/pkgconfig/ - -.PHONY: clean -clean: - -rm -f lib$(NAME).a $(OBJS) diff --git a/meta-agl-bsp/meta-iot-cloud/recipes-aws/aws-iot-device-sdk-embedded-c/files/aws_iot_config.h b/meta-agl-bsp/meta-iot-cloud/recipes-aws/aws-iot-device-sdk-embedded-c/files/aws_iot_config.h deleted file mode 100644 index e01189332..000000000 --- a/meta-agl-bsp/meta-iot-cloud/recipes-aws/aws-iot-device-sdk-embedded-c/files/aws_iot_config.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -/** - * @file aws_iot_config.h - * @brief AWS IoT specific configuration file - */ - -#ifndef AWS_IOT_CONFIG_H_ -#define AWS_IOT_CONFIG_H_ - -// Get from console -// ================================================= -#define AWS_IOT_MQTT_HOST "" ///< Customer specific MQTT HOST. The same will be used for Thing Shadow -#define AWS_IOT_MQTT_PORT 443 ///< default port for MQTT/S -#define AWS_IOT_MQTT_CLIENT_ID "" ///< MQTT client ID should be unique for every device -#define AWS_IOT_MY_THING_NAME "" ///< Thing Name of the Shadow this device is associated with -#define AWS_IOT_ROOT_CA_FILENAME "" ///< Root CA file name -#define AWS_IOT_CERTIFICATE_FILENAME "" ///< device signed certificate file name -#define AWS_IOT_PRIVATE_KEY_FILENAME "" ///< Device private key filename -// ================================================= - -// MQTT PubSub -#define AWS_IOT_MQTT_TX_BUF_LEN 10240 ///< Any time a message is sent out through the MQTT layer. The message is copied into this buffer anytime a publish is done. This will also be used in the case of Thing Shadow -#define AWS_IOT_MQTT_RX_BUF_LEN 10240 ///< Any message that comes into the device should be less than this buffer size. If a received message is bigger than this buffer size the message will be dropped. -#define AWS_IOT_MQTT_NUM_SUBSCRIBE_HANDLERS 5 ///< Maximum number of topic filters the MQTT client can handle at any given time. This should be increased appropriately when using Thing Shadow - -// Thing Shadow specific configs -#define SHADOW_MAX_SIZE_OF_RX_BUFFER (AWS_IOT_MQTT_RX_BUF_LEN+1) ///< Maximum size of the SHADOW buffer to store the received Shadow message, including terminating NULL byte. -#define MAX_SIZE_OF_UNIQUE_CLIENT_ID_BYTES 80 ///< Maximum size of the Unique Client Id. For More info on the Client Id refer \ref response "Acknowledgments" -#define MAX_SIZE_CLIENT_ID_WITH_SEQUENCE MAX_SIZE_OF_UNIQUE_CLIENT_ID_BYTES + 10 ///< This is size of the extra sequence number that will be appended to the Unique client Id -#define MAX_SIZE_CLIENT_TOKEN_CLIENT_SEQUENCE MAX_SIZE_CLIENT_ID_WITH_SEQUENCE + 20 ///< This is size of the the total clientToken key and value pair in the JSON -#define MAX_ACKS_TO_COMEIN_AT_ANY_GIVEN_TIME 10 ///< At Any given time we will wait for this many responses. This will correlate to the rate at which the shadow actions are requested -#define MAX_THINGNAME_HANDLED_AT_ANY_GIVEN_TIME 10 ///< We could perform shadow action on any thing Name and this is maximum Thing Names we can act on at any given time -#define MAX_JSON_TOKEN_EXPECTED 120 ///< These are the max tokens that is expected to be in the Shadow JSON document. Include the metadata that gets published -#define MAX_SHADOW_TOPIC_LENGTH_WITHOUT_THINGNAME 60 ///< All shadow actions have to be published or subscribed to a topic which is of the format $aws/things/{thingName}/shadow/update/accepted. This refers to the size of the topic without the Thing Name -#define MAX_SIZE_OF_THING_NAME 30 ///< The Thing Name should not be bigger than this value. Modify this if the Thing Name needs to be bigger -#define MAX_SHADOW_TOPIC_LENGTH_BYTES MAX_SHADOW_TOPIC_LENGTH_WITHOUT_THINGNAME + MAX_SIZE_OF_THING_NAME ///< This size includes the length of topic with Thing Name - -// Auto Reconnect specific config -#define AWS_IOT_MQTT_MIN_RECONNECT_WAIT_INTERVAL 1000 ///< Minimum time before the First reconnect attempt is made as part of the exponential back-off algorithm -#define AWS_IOT_MQTT_MAX_RECONNECT_WAIT_INTERVAL 128000 ///< Maximum time interval after which exponential back-off will stop attempting to reconnect. - -#define DISABLE_METRICS true ///< Disable the collection of metrics by setting this to true - -#endif /* AWS_IOT_CONFIG_H_ */ diff --git a/meta-agl-bsp/meta-iot-cloud/recipes-aws/aws-iot-device-sdk-embedded-c/files/awsiotsdk.pc b/meta-agl-bsp/meta-iot-cloud/recipes-aws/aws-iot-device-sdk-embedded-c/files/awsiotsdk.pc deleted file mode 100644 index f8384993b..000000000 --- a/meta-agl-bsp/meta-iot-cloud/recipes-aws/aws-iot-device-sdk-embedded-c/files/awsiotsdk.pc +++ /dev/null @@ -1,27 +0,0 @@ -########################################################################### -# Copyright 2020 MERA -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -########################################################################### - -prefix=/usr -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/awsiotsdk - -Name: AWS IoT Device SDK for Embedded C -Description: AWS IoT SDK compiled into library (includes mbedTLS and jsmn code) -Version: 3.0.1 - -Cflags: -I${includedir} -DENABLE_IOT_DEBUG -DENABLE_IOT_INFO -DENABLE_IOT_WARN -DENABLE_IOT_ERROR -Libs: -L${libdir} -lawsiotsdk -lmbedtls -lmbedcrypto -lmbedx509 diff --git a/meta-agl-bsp/meta-iot-cloud/recipes-azure/azure-iot-sdk-c/azure-iot-sdk-c_%.bbappend b/meta-agl-bsp/meta-iot-cloud/recipes-azure/azure-iot-sdk-c/azure-iot-sdk-c_%.bbappend deleted file mode 100644 index 58d4693f0..000000000 --- a/meta-agl-bsp/meta-iot-cloud/recipes-azure/azure-iot-sdk-c/azure-iot-sdk-c_%.bbappend +++ /dev/null @@ -1,5 +0,0 @@ -# Disable the amqp transport, due to linking error in meta-iot repository for amqp -# symbols from amqp code are not included in the libiothub_client.so - -# NOTE: amqp is not used by AGL in IoT context at the moment -PACKAGECONFIG:remove = "amqp" diff --git a/meta-agl-bsp/meta-iot-cloud/recipes-azure/azure-macro-utils-c/azure-macro-utils-c_%.bbappend b/meta-agl-bsp/meta-iot-cloud/recipes-azure/azure-macro-utils-c/azure-macro-utils-c_%.bbappend deleted file mode 100644 index b90c754d5..000000000 --- a/meta-agl-bsp/meta-iot-cloud/recipes-azure/azure-macro-utils-c/azure-macro-utils-c_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -ALLOW_EMPTY:${PN} = "1" diff --git a/meta-agl-bsp/meta-iot-cloud/recipes-azure/umock-c/umock-c_%.bbappend b/meta-agl-bsp/meta-iot-cloud/recipes-azure/umock-c/umock-c_%.bbappend deleted file mode 100644 index b90c754d5..000000000 --- a/meta-agl-bsp/meta-iot-cloud/recipes-azure/umock-c/umock-c_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -ALLOW_EMPTY:${PN} = "1" diff --git a/meta-agl-bsp/meta-qcom/recipes-bsp/96boards-tools/96boards-tools_0.12.bb b/meta-agl-bsp/meta-qcom/recipes-bsp/96boards-tools/96boards-tools_0.12.bb deleted file mode 100644 index 3ea57d770..000000000 --- a/meta-agl-bsp/meta-qcom/recipes-bsp/96boards-tools/96boards-tools_0.12.bb +++ /dev/null @@ -1,32 +0,0 @@ -SUMMARY = "Useful bits an pieces to make 96Boards more standard across the board" -HOMEPAGE = "https://github.com/96boards/96boards-tools" -SECTION = "devel" - -LICENSE = "GPLv2+" -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" - -SRCREV = "ed0f0dbec02c1869a0c4fa0140b4aa5338c9d010" -SRC_URI = "git://github.com/96boards/96boards-tools;branch=master;protocol=https" - -S = "${WORKDIR}/git" - -inherit systemd allarch update-rc.d - -do_install () { - install -d ${D}${sysconfdir}/udev/rules.d - install -m 0755 ${S}/*.rules ${D}${sysconfdir}/udev/rules.d/ - install -d ${D}${sysconfdir}/init.d - install -m 0755 ${S}/resize-disk ${D}${sysconfdir}/init.d/ - - install -d ${D}${systemd_unitdir}/system - install -m 0644 ${S}/resize-helper.service ${D}${systemd_unitdir}/system - - install -d ${D}${sbindir} - install -m 0755 ${S}/resize-helper ${D}${sbindir} -} - -INITSCRIPT_NAME = "resize-disk" -INITSCRIPT_PARAMS = "start 99 5 2 . stop 20 0 1 6 ." - -SYSTEMD_SERVICE:${PN} = "resize-helper.service" -RDEPENDS:${PN} += "e2fsprogs-resize2fs gptfdisk parted util-linux udev" diff --git a/meta-agl-bsp/meta-qcom/recipes-bsp/q6v5-pil/files/qcom-q6v5-pil.service b/meta-agl-bsp/meta-qcom/recipes-bsp/q6v5-pil/files/qcom-q6v5-pil.service deleted file mode 100644 index 3d9cd24bb..000000000 --- a/meta-agl-bsp/meta-qcom/recipes-bsp/q6v5-pil/files/qcom-q6v5-pil.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Qualcomm Hexagon PIL setup -After=rmtfs.service -Requires=rmtfs.service - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=/sbin/modprobe -q qcom_q6v5_pil - -[Install] -WantedBy=multi-user.target diff --git a/meta-agl-bsp/meta-qcom/recipes-bsp/q6v5-pil/q6v5-pil.bb b/meta-agl-bsp/meta-qcom/recipes-bsp/q6v5-pil/q6v5-pil.bb deleted file mode 100644 index 14bab2430..000000000 --- a/meta-agl-bsp/meta-qcom/recipes-bsp/q6v5-pil/q6v5-pil.bb +++ /dev/null @@ -1,20 +0,0 @@ -inherit systemd - -SUMMARY = "Systemd unit file for the delay loading Hexagon PIL kernel module" -SECTION = "misc" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" - -SRC_URI += "file://qcom-q6v5-pil.service" - -do_install() { - install -d ${D}${systemd_unitdir}/system/ - install -m 0644 ${WORKDIR}/qcom-q6v5-pil.service ${D}${systemd_unitdir}/system - - # Blacklist qcom_q6v5_pil to prevent modules autoload - # qcom-q6v5-pil.service will do the work after rmtfs done. - install -d ${D}/${sysconfdir}/modprobe.d - echo "blacklist qcom_q6v5_pil" > ${D}/${sysconfdir}/modprobe.d/qcom_q6v5_pil.conf -} - -SYSTEMD_SERVICE:${PN} = "qcom-q6v5-pil.service" diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/bootfiles/bootfiles.bbappend b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/bootfiles/bootfiles.bbappend deleted file mode 100644 index 59bc5a741..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/bootfiles/bootfiles.bbappend +++ /dev/null @@ -1 +0,0 @@ -RDEPENDS:${PN}:append:sota += " u-boot-otascript" diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend index 4492a9182..248623699 100644 --- a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend +++ b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend @@ -44,7 +44,3 @@ do_deploy:append:raspberrypi4() { echo -e "\n[pi4]" >> ${DEPLOYDIR}/bootfiles/config.txt echo "max_framebuffers=2" >> ${DEPLOYDIR}/bootfiles/config.txt } - -do_deploy:append:sota() { - echo "device_tree_address=0x0c800000" >> ${DEPLOYDIR}/bootfiles/config.txt -} diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/u-boot/u-boot-2020.10.inc b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/u-boot/u-boot-2020.10.inc deleted file mode 100644 index 27f46096a..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/u-boot/u-boot-2020.10.inc +++ /dev/null @@ -1,3 +0,0 @@ -SRC_URI = "git://git.denx.de/u-boot.git" -SRCREV = "050acee119b3757fee3bd128f55d720fdd9bb890" -LIC_FILES_CHKSUM = "file://Licenses/README;md5=5a7450c57ffe5ae63fd732446b988025" diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/u-boot/u-boot-2021.07.inc b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/u-boot/u-boot-2021.07.inc deleted file mode 100644 index abf7474c9..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/u-boot/u-boot-2021.07.inc +++ /dev/null @@ -1,3 +0,0 @@ -SRC_URI = "git://git.denx.de/u-boot.git" -SRCREV = "840658b093976390e9537724f802281c9c8439f5" -LIC_FILES_CHKSUM = "file://Licenses/README;md5=5a7450c57ffe5ae63fd732446b988025" diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/u-boot/u-boot-tools_2020.10.bb b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/u-boot/u-boot-tools_2020.10.bb deleted file mode 100644 index 2d9d76955..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/u-boot/u-boot-tools_2020.10.bb +++ /dev/null @@ -1,2 +0,0 @@ -require recipes-bsp/u-boot/u-boot-tools_2020.01.bb -require u-boot-2020.10.inc diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/u-boot/u-boot-tools_2021.07.bb b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/u-boot/u-boot-tools_2021.07.bb deleted file mode 100644 index a963d3fff..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/u-boot/u-boot-tools_2021.07.bb +++ /dev/null @@ -1,2 +0,0 @@ -require recipes-bsp/u-boot/u-boot-tools_2020.01.bb -require u-boot-2021.07.inc diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/u-boot/u-boot_2020.10.bb b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/u-boot/u-boot_2020.10.bb deleted file mode 100644 index 0d967575b..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/u-boot/u-boot_2020.10.bb +++ /dev/null @@ -1,2 +0,0 @@ -require recipes-bsp/u-boot/u-boot_2020.01.bb -require u-boot-2020.10.inc diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/u-boot/u-boot_2021.07.bb b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/u-boot/u-boot_2021.07.bb deleted file mode 100644 index 2077262a3..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/u-boot/u-boot_2021.07.bb +++ /dev/null @@ -1,2 +0,0 @@ -require recipes-bsp/u-boot/u-boot_2020.01.bb -require u-boot-2021.07.inc diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-graphics/wayland/weston-ini-conf.bbappend b/meta-agl-bsp/meta-raspberrypi/recipes-graphics/wayland/weston-ini-conf.bbappend deleted file mode 100644 index 5f8af211a..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-graphics/wayland/weston-ini-conf.bbappend +++ /dev/null @@ -1,3 +0,0 @@ -FILESEXTRAPATHS:prepend:raspberrypi := "${THISDIR}/${PN}:" - -SRC_URI:append:raspberrypi = " file://dsi.cfg" diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-graphics/wayland/weston-ini-conf/dsi.cfg b/meta-agl-bsp/meta-raspberrypi/recipes-graphics/wayland/weston-ini-conf/dsi.cfg deleted file mode 100644 index 72a6d2bf8..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-graphics/wayland/weston-ini-conf/dsi.cfg +++ /dev/null @@ -1,5 +0,0 @@ -# Support the Raspberry Pi Foundation 7" tablet which uses the DSI connector -# rather than HDMI. -[output] -name=DSI-1 -transform=270 diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-graphics/wayland/weston-ini-conf/hdmi-a-1-270-720p.cfg b/meta-agl-bsp/meta-raspberrypi/recipes-graphics/wayland/weston-ini-conf/hdmi-a-1-270-720p.cfg deleted file mode 100644 index e1c9db1a8..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-graphics/wayland/weston-ini-conf/hdmi-a-1-270-720p.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# A display is connected to HDMI-A-1 and needs to be rotated 270 degrees -# to have a proper orientation of the homescreen. For example the various sizes -# of the GeChic display or the Dell display. -[output] -name=HDMI-A-1 -transform=270 -mode=1280x720 diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/create-combined-dtb/create-combined-dtb_1.0.0.bb b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/create-combined-dtb/create-combined-dtb_1.0.0.bb index bcb92b23d..c5edbe1dc 100644 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/create-combined-dtb/create-combined-dtb_1.0.0.bb +++ b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/create-combined-dtb/create-combined-dtb_1.0.0.bb @@ -15,28 +15,19 @@ S = "${WORKDIR}" do_compile[depends] += "virtual/kernel:do_deploy" do_compile () { - # Official touchscreen setup (rpi3b/rpi3b dtb, VC4DTBO and ft5406) - if [ -f "${DEPLOY_DIR_IMAGE}/bcm2710-rpi-3-b-plus.dtb" ]; then - fdtoverlay -v -i ${DEPLOY_DIR_IMAGE}/bcm2710-rpi-3-b-plus.dtb -o bcm2710-rpi-3-b-plus+vc4+ft5406.dtb ${DEPLOY_DIR_IMAGE}/rpi-ft5406.dtbo ${DEPLOY_DIR_IMAGE}/${VC4DTBO}.dtbo - fi - if [ -f "${DEPLOY_DIR_IMAGE}/bcm2710-rpi-3-b.dtb" ]; then - fdtoverlay -v -i ${DEPLOY_DIR_IMAGE}/bcm2710-rpi-3-b.dtb -o bcm2710-rpi-3-b+vc4+ft5406.dtb ${DEPLOY_DIR_IMAGE}/rpi-ft5406.dtbo ${DEPLOY_DIR_IMAGE}/${VC4DTBO}.dtbo + # Plain VC4 (HDMI) + if [ -f "${DEPLOY_DIR_IMAGE}/bcm2711-rpi-4-b.dtb" ]; then + fdtoverlay -v -i ${DEPLOY_DIR_IMAGE}/bcm2711-rpi-4-b.dtb -o bcm2711-rpi-4-b+vc4.dtb \ + ${DEPLOY_DIR_IMAGE}/${VC4DTBO}-pi4.dtbo fi - # NOTE: meta-updater currently disables rpi-ft5406.dtbo on rpi4, so need to check if it is present + + # VC4 + LCD if [ -f "${DEPLOY_DIR_IMAGE}/bcm2711-rpi-4-b.dtb" -a -f "${DEPLOY_DIR_IMAGE}/rpi-ft5406.dtbo" ]; then - fdtoverlay -v -i ${DEPLOY_DIR_IMAGE}/bcm2711-rpi-4-b.dtb -o bcm2711-rpi-4-b+vc4+ft5406.dtb ${DEPLOY_DIR_IMAGE}/rpi-ft5406.dtbo ${DEPLOY_DIR_IMAGE}/${VC4DTBO}.dtbo + fdtoverlay -v -i ${DEPLOY_DIR_IMAGE}/bcm2711-rpi-4-b.dtb -o bcm2711-rpi-4-b+vc4+ft5406.dtb \ + ${DEPLOY_DIR_IMAGE}/rpi-ft5406.dtbo \ + ${DEPLOY_DIR_IMAGE}/${VC4DTBO}-pi4.dtbo fi - # HDMI screen setup (rpi3b/rpi3b dtb and VC4DTBO) - if [ -f "${DEPLOY_DIR_IMAGE}/bcm2710-rpi-3-b-plus.dtb" ]; then - fdtoverlay -v -i ${DEPLOY_DIR_IMAGE}/bcm2710-rpi-3-b-plus.dtb -o bcm2710-rpi-3-b-plus+vc4.dtb ${DEPLOY_DIR_IMAGE}/${VC4DTBO}.dtbo - fi - if [ -f "${DEPLOY_DIR_IMAGE}/bcm2710-rpi-3-b.dtb" ]; then - fdtoverlay -v -i ${DEPLOY_DIR_IMAGE}/bcm2710-rpi-3-b.dtb -o bcm2710-rpi-3-b+vc4.dtb ${DEPLOY_DIR_IMAGE}/${VC4DTBO}.dtbo - fi - if [ -f "${DEPLOY_DIR_IMAGE}/bcm2711-rpi-4-b.dtb" ]; then - fdtoverlay -v -i ${DEPLOY_DIR_IMAGE}/bcm2711-rpi-4-b.dtb -o bcm2711-rpi-4-b+vc4.dtb ${DEPLOY_DIR_IMAGE}/${VC4DTBO}.dtbo - fi } do_deploy () { @@ -44,21 +35,9 @@ do_deploy () { if [ -f "${S}/bcm2711-rpi-4-b+vc4+ft5406.dtb" ]; then install -m 0644 ${S}/bcm2711-rpi-4-b+vc4+ft5406.dtb ${DEPLOY_DIR_IMAGE} fi - if [ -f "${S}/bcm2710-rpi-3-b+vc4+ft5406.dtb" ]; then - install -m 0644 ${S}/bcm2710-rpi-3-b+vc4+ft5406.dtb ${DEPLOY_DIR_IMAGE} - fi - if [ -f "${S}/bcm2710-rpi-3+vc4+ft5406.dtb" ]; then - install -m 0644 ${S}/bcm2710-rpi-3+vc4+ft5406.dtb ${DEPLOY_DIR_IMAGE} - fi if [ -f "${S}/bcm2711-rpi-4-b+vc4.dtb" ]; then install -m 0644 ${S}/bcm2711-rpi-4-b+vc4.dtb ${DEPLOY_DIR_IMAGE} fi - if [ -f "${S}/bcm2710-rpi-3-b+vc4.dtb" ]; then - install -m 0644 ${S}/bcm2710-rpi-3-b+vc4.dtb ${DEPLOY_DIR_IMAGE} - fi - if [ -f "${S}/bcm2710-rpi-3+vc4.dtb" ]; then - install -m 0644 ${S}/bcm2710-rpi-3+vc4.dtb ${DEPLOY_DIR_IMAGE} - fi } addtask deploy after do_install diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/dtc/dtc_1.6.0.bbappend b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/dtc/dtc_1.6.1.bbappend index a28a9e748..a28a9e748 100644 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/dtc/dtc_1.6.0.bbappend +++ b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/dtc/dtc_1.6.1.bbappend diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-mconf-menuconfig.patch b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-mconf-menuconfig.patch index 3dc71ff22..7f0979ca9 100644 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-mconf-menuconfig.patch +++ b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-mconf-menuconfig.patch @@ -40,9 +40,9 @@ index c812872d7f9d..42d20819025c 100755 + exit 0 +fi + - if [ -n "$(command -v pkg-config)" ]; then - if pkg-config --exists $PKG; then - echo cflags=\"$(pkg-config --cflags $PKG)\" + if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then + if ${HOSTPKG_CONFIG} --exists $PKG; then + echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG)\" -- 2.17.1 diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0002-Disable-DMA-in-sdhci-driver.patch b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0002-Disable-DMA-in-sdhci-driver.patch deleted file mode 100644 index 04a8733f2..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0002-Disable-DMA-in-sdhci-driver.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 758bc9b917469bc4e527dc3aae821c91cbc3d426 Mon Sep 17 00:00:00 2001 -From: Stewart Hildebrand <stewart.hildebrand@dornerworks.com> -Date: Thu, 18 Jul 2019 00:01:27 -0400 -Subject: [PATCH 2/4] Disable DMA in sdhci driver - ---- - drivers/mmc/host/sdhci-iproc.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c -index 983cddce9..150f7bfc8 100644 ---- a/drivers/mmc/host/sdhci-iproc.c -+++ b/drivers/mmc/host/sdhci-iproc.c -@@ -252,6 +252,8 @@ static const struct sdhci_iproc_data bcm2835_data = { - - static const struct sdhci_pltfm_data sdhci_bcm2838_pltfm_data = { - .ops = &sdhci_iproc_32only_ops, -+ .quirks = SDHCI_QUIRK_BROKEN_DMA | -+ SDHCI_QUIRK_BROKEN_ADMA, - }; - - static const struct sdhci_iproc_data bcm2838_data = { --- -2.17.1 - diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4.bbappend b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4.bbappend deleted file mode 100644 index 2836918c7..000000000 --- a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_5.4.bbappend +++ /dev/null @@ -1,4 +0,0 @@ -# For Xen -SRC_URI:append =" \ - ${@bb.utils.contains('AGL_XEN_WANTED','1','file://0002-Disable-DMA-in-sdhci-driver.patch','',d)} \ -" diff --git a/meta-agl-bsp/meta-rcar-gateway/recipes-kernel/linux/linux-renesas_%.bbappend b/meta-agl-bsp/meta-rcar-gateway/recipes-kernel/linux/linux-renesas_%.bbappend new file mode 100644 index 000000000..d565da8ac --- /dev/null +++ b/meta-agl-bsp/meta-rcar-gateway/recipes-kernel/linux/linux-renesas_%.bbappend @@ -0,0 +1,11 @@ +do_install:append () { + + # Remove firmware file that is not packaged in the kernel. + # It throws an error during do_package. + # It seems to be moved out of the kernel in later BSP versions. + rm -rf ${D}/lib/firmware/r8a779f0_ufs.bin + rm -rf ${D}/lib/firmware + rm -rf ${D}/lib + +} + diff --git a/meta-agl-bsp/meta-rcar-gen3-adas/conf/NOTES b/meta-agl-bsp/meta-rcar-gen3-adas/conf/NOTES index e4f5e7d9b..296dd5e19 100644 --- a/meta-agl-bsp/meta-rcar-gen3-adas/conf/NOTES +++ b/meta-agl-bsp/meta-rcar-gen3-adas/conf/NOTES @@ -5,7 +5,7 @@ # E.g. MACHINE_FEATURE. Should *not* be in layer.conf !! # Radio packages -#IMAGE_INSTALL:append:rcar-gen3 += " \ +#IMAGE_INSTALL:append:rcar-gen3 = " \ # si-tools \ # si-init \ # linux-firmware-wl18xx \ diff --git a/meta-agl-bsp/meta-rcar-gen3-adas/conf/include/rcar-gen3-adas.inc b/meta-agl-bsp/meta-rcar-gen3-adas/conf/include/rcar-gen3-adas.inc index eb1da3d35..0c344a471 100644 --- a/meta-agl-bsp/meta-rcar-gen3-adas/conf/include/rcar-gen3-adas.inc +++ b/meta-agl-bsp/meta-rcar-gen3-adas/conf/include/rcar-gen3-adas.inc @@ -4,16 +4,14 @@ # Add a feature as a low-impact way to detect Kingfisher support in # recipes. -AGL_FEATURES:append = " kingfisher" +AGL_FEATURES:append:rcar-gen3 = " kingfisher" -PREFERRED_RPROVIDER_virtual/gpsd-conf ?= "gpsd-kingfisher-conf" - -IMAGE_NAME = "${IMAGE_BASENAME}-${MACHINE}-kf${IMAGE_VERSION_SUFFIX}" -IMAGE_LINK_NAME = "${IMAGE_BASENAME}-${MACHINE}-kf" -TOOLCHAIN_OUTPUTNAME = "${SDK_NAME}-kf-toolchain-${SDK_VERSION}" +IMAGE_NAME:rcar-gen3 = "${IMAGE_BASENAME}-${MACHINE}-kf${IMAGE_VERSION_SUFFIX}" +IMAGE_LINK_NAME:rcar-gen3 = "${IMAGE_BASENAME}-${MACHINE}-kf" +TOOLCHAIN_OUTPUTNAME:rcar-gen3 = "${SDK_NAME}-kf-toolchain-${SDK_VERSION}" # Radio packages -IMAGE_INSTALL:append:rcar-gen3 += " \ +IMAGE_INSTALL:append:rcar-gen3 = " \ si-tools \ si-init \ linux-firmware-wl18xx \ diff --git a/meta-agl-bsp/meta-rcar-gen3-adas/conf/layer.conf b/meta-agl-bsp/meta-rcar-gen3-adas/conf/layer.conf index 75bfcfcc7..be6f0aa25 100644 --- a/meta-agl-bsp/meta-rcar-gen3-adas/conf/layer.conf +++ b/meta-agl-bsp/meta-rcar-gen3-adas/conf/layer.conf @@ -15,4 +15,4 @@ BBFILE_COLLECTIONS += "rcar-gen3-cogent" BBFILE_PATTERN_rcar-gen3-cogent := "^${LAYERDIR}/" BBFILE_PRIORITY_rcar-gen3-cogent = "7" -LAYERSERIES_COMPAT_rcar-gen3-cogent = "dunfell" +LAYERSERIES_COMPAT_rcar-gen3-cogent = "kirkstone" diff --git a/meta-agl-bsp/meta-rcar-gen3-adas/recipes-bsp/si-tools/si-init_1.0.bb b/meta-agl-bsp/meta-rcar-gen3-adas/recipes-bsp/si-tools/si-init_1.0.bb index c752bba08..b53504400 100644 --- a/meta-agl-bsp/meta-rcar-gen3-adas/recipes-bsp/si-tools/si-init_1.0.bb +++ b/meta-agl-bsp/meta-rcar-gen3-adas/recipes-bsp/si-tools/si-init_1.0.bb @@ -21,7 +21,7 @@ do_install() { # the Si468x device via i2c install -d ${D}${sysconfdir}/udev/rules.d cat >${D}${sysconfdir}/udev/rules.d/zz-radio-si.rules <<'EOF' -KERNEL=="i2c-12", MODE="0660", GROUP="audio", SECLABEL{smack}="*" +KERNEL=="i2c-12", MODE="0660", GROUP="audio" EOF } diff --git a/meta-agl-bsp/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0001-arm64-dts-renesas-preserve-drm-HDMI-connector-naming.patch b/meta-agl-bsp/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0001-arm64-dts-renesas-preserve-drm-HDMI-connector-naming.patch index 64c9542a3..d3a3229b4 100644 --- a/meta-agl-bsp/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0001-arm64-dts-renesas-preserve-drm-HDMI-connector-naming.patch +++ b/meta-agl-bsp/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0001-arm64-dts-renesas-preserve-drm-HDMI-connector-naming.patch @@ -1,4 +1,4 @@ -From ce9a7a41a9f65cc8cc129cdd27e155b35b26d393 Mon Sep 17 00:00:00 2001 +From 71c2e7bc6ecf872dd3b45480859dce0f2e941b03 Mon Sep 17 00:00:00 2001 From: Matt Porter <mporter@konsulko.com> Date: Wed, 13 Dec 2017 12:49:20 -0500 Subject: [PATCH] arm64: dts: renesas: preserve drm HDMI connector naming on KF @@ -18,16 +18,18 @@ is first. Change-Id: Ibbb1975c2383a526a54c257fb7d68d32a042d468 Signed-off-by: Matt Porter <mporter@konsulko.com> Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh> +Signed-off-by: Harunobu Kurokawa <harunobu.kurokawa.dn@renesas.com> --- - arch/arm64/boot/dts/renesas/r8a7795.dtsi | 10 +++++----- - arch/arm64/boot/dts/renesas/r8a7796.dtsi | 10 +++++----- - 2 files changed, 10 insertions(+), 10 deletions(-) + arch/arm64/boot/dts/renesas/r8a77951.dtsi | 10 +++++----- + arch/arm64/boot/dts/renesas/r8a77960.dtsi | 10 +++++----- + arch/arm64/boot/dts/renesas/r8a77961.dtsi | 10 +++++----- + 3 files changed, 15 insertions(+), 15 deletions(-) -diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi -index f7f947d27b0d..5bcc2391587d 100644 ---- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi -+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi -@@ -3054,11 +3054,6 @@ +diff --git a/arch/arm64/boot/dts/renesas/r8a77951.dtsi b/arch/arm64/boot/dts/renesas/r8a77951.dtsi +index 12e78097533e..9ead58e8a7c2 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77951.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a77951.dtsi +@@ -3943,11 +3943,6 @@ ports { #address-cells = <1>; #size-cells = <0>; @@ -39,8 +41,8 @@ index f7f947d27b0d..5bcc2391587d 100644 port@1 { reg = <1>; du_out_hdmi0: endpoint { -@@ -3076,6 +3071,11 @@ - du_out_lvds0: endpoint { +@@ -3966,6 +3961,11 @@ du_out_lvds0: endpoint { + remote-endpoint = <&lvds0_in>; }; }; + port@0 { @@ -51,11 +53,11 @@ index f7f947d27b0d..5bcc2391587d 100644 }; }; -diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi b/arch/arm64/boot/dts/renesas/r8a7796.dtsi -index df26656e0f19..154ac1dd91fa 100644 ---- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi -+++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi -@@ -2846,11 +2846,6 @@ +diff --git a/arch/arm64/boot/dts/renesas/r8a77960.dtsi b/arch/arm64/boot/dts/renesas/r8a77960.dtsi +index 66ab48b3a704..a5481dc4a3f1 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77960.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a77960.dtsi +@@ -3628,11 +3628,6 @@ ports { #address-cells = <1>; #size-cells = <0>; @@ -67,8 +69,36 @@ index df26656e0f19..154ac1dd91fa 100644 port@1 { reg = <1>; du_out_hdmi0: endpoint { -@@ -2862,6 +2857,11 @@ - du_out_lvds0: endpoint { +@@ -3645,6 +3640,11 @@ du_out_lvds0: endpoint { + remote-endpoint = <&lvds0_in>; + }; + }; ++ port@0 { ++ reg = <0>; ++ du_out_rgb: endpoint { ++ }; ++ }; + }; + }; + +diff --git a/arch/arm64/boot/dts/renesas/r8a77961.dtsi b/arch/arm64/boot/dts/renesas/r8a77961.dtsi +index ef2cb77f3c32..032ef1ca0633 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77961.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a77961.dtsi +@@ -3434,11 +3434,6 @@ ports { + #address-cells = <1>; + #size-cells = <0>; + +- port@0 { +- reg = <0>; +- du_out_rgb: endpoint { +- }; +- }; + port@1 { + reg = <1>; + du_out_hdmi0: endpoint { +@@ -3451,6 +3446,11 @@ du_out_lvds0: endpoint { + remote-endpoint = <&lvds0_in>; }; }; + port@0 { @@ -80,5 +110,5 @@ index df26656e0f19..154ac1dd91fa 100644 }; -- -2.11.0 +2.25.1 diff --git a/meta-agl-bsp/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0004-ADSP-enable-and-add-sound-hardware-abstraction_kf.patch b/meta-agl-bsp/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0004-ADSP-enable-and-add-sound-hardware-abstraction_kf.patch deleted file mode 100644 index 92f5af88c..000000000 --- a/meta-agl-bsp/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0004-ADSP-enable-and-add-sound-hardware-abstraction_kf.patch +++ /dev/null @@ -1,58 +0,0 @@ -The ADSP on Renesas SoCs required a reserved memory area to become -enabled, and this needs to be done manually. - -This patch adds sound hardware abstraction information for the m3ulcb -and m3ulcb-kf (kingfisher) device trees. This is helpful on-board the -ADSP for dynamically determining sound hardware at runtime, allowing -single binaries to be used between the two boards. - -Future work will incorporate the h3ulcb and Salvator boards into the -abstraction. - -Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh> -Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au> ---- -diff --git a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf.dts b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf.dts -index de2390f009e7..4ccfa8315d17 100644 ---- a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf.dts -+++ b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf.dts -@@ -15,6 +15,39 @@ - "renesas,r8a7796"; - }; - -+ -+&adsp { -+ -+ /* ADSP playback setting for pcm3168 */ -+ adsp_playback0: adsp,playback { -+ mode = "tdm"; -+ clock-mode = "master"; -+ bus-width = <24>; -+ ssi = <3>; -+ bus-if = <0>; -+ channels = <8>; -+ pin-share-ssi = <4>; -+ }; -+ -+ /* ADSP capture setting for pcm3168 */ -+ adsp_capture0: adsp,capture { -+ mode = "tdm"; -+ clock-mode = "slave"; -+ bus-width = <24>; -+ ssi = <4>; -+ bus-if = <0>; -+ channels = <8>; -+ pin-share-ssi = <3>; -+ }; -+ -+ adsp,ports { -+ port@0 { -+ playback = <&adsp_playback0>; -+ capture = <&adsp_capture0>; -+ }; -+ }; -+}; -+ - &du { - ports { - port@0 { diff --git a/meta-agl-bsp/meta-rcar-gen3-adas/recipes-navigation/gpsd/gpsd-kingfisher-conf_1.0.bb b/meta-agl-bsp/meta-rcar-gen3-adas/recipes-navigation/gpsd/gpsd-machine-conf_1.0.bbappend index 918e29fc1..51604706c 100644 --- a/meta-agl-bsp/meta-rcar-gen3-adas/recipes-navigation/gpsd/gpsd-kingfisher-conf_1.0.bb +++ b/meta-agl-bsp/meta-rcar-gen3-adas/recipes-navigation/gpsd/gpsd-machine-conf_1.0.bbappend @@ -1,27 +1,23 @@ -SUMMARY = "King fisher specific gpsd config" -LICENSE = "BSD" -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/BSD;md5=3775480a712fc46a69647678acb234cb" +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" -SRC_URI = " \ - file://gpsd.kingfisher \ -" +SRC_URI = "file://gpsd.kingfisher" inherit update-alternatives -RPROVIDES:${PN} += "virtual/gpsd-conf" - -ALTERNATIVE:${PN} = "gpsd-defaults" -ALTERNATIVE_LINK_NAME[gpsd-defaults] = "${sysconfdir}/default/gpsd" -ALTERNATIVE_TARGET[gpsd-defaults] = "${sysconfdir}/default/gpsd.kingfisher" -ALTERNATIVE_PRIORITY[gpsd-defaults] = "20" - -COMPATIBLE_MACHINE = "ulcb" -PACKAGE_ARCH = "${MACHINE_ARCH}" +do_configure[noexec] = "1" +do_compile[noexec] = "1" do_install() { install -d ${D}/${sysconfdir}/default install -m 0644 ${WORKDIR}/gpsd.kingfisher ${D}/${sysconfdir}/default/gpsd.kingfisher } -FILES:${PN} = "${sysconfdir}/default/gpsd.kingfisher" +COMPATIBLE_MACHINE = "ulcb" +PACKAGE_ARCH = "${MACHINE_ARCH}" + CONFFILES:${PN} = "${sysconfdir}/default/gpsd.kingfisher" + +ALTERNATIVE:${PN} = "gpsd-defaults" +ALTERNATIVE_LINK_NAME[gpsd-defaults] = "${sysconfdir}/default/gpsd" +ALTERNATIVE_TARGET[gpsd-defaults] = "${sysconfdir}/default/gpsd.kingfisher" +ALTERNATIVE_PRIORITY[gpsd-defaults] = "20" diff --git a/meta-agl-bsp/meta-rcar-gen3/include/checksum_control_files.inc b/meta-agl-bsp/meta-rcar-gen3/include/checksum_control_files.inc index d95f36f03..6c9f49c3b 100644 --- a/meta-agl-bsp/meta-rcar-gen3/include/checksum_control_files.inc +++ b/meta-agl-bsp/meta-rcar-gen3/include/checksum_control_files.inc @@ -1,15 +1,16 @@ -CTL_CHECKSUM[r8a77951_linux_gsx_binaries_gles.tar.bz2]="e120465f9fd25115f70791ab4c6c343d" -CTL_CHECKSUM[r8a77960_linux_gsx_binaries_gles.tar.bz2]="81eeac2320d37d9d4a74db6eb66aeec5" -CTL_CHECKSUM[GSX_KM_H3.tar.bz2]="a858eaba7e0ff150b489502b36c01459" -CTL_CHECKSUM[GSX_KM_M3.tar.bz2]="bc6e8268455e1911919cc1b6928fb12e" -CTL_CHECKSUM[RCG3VUDRL4101ZDO.tar.bz2]="43a8921d5c2a257ccc0bf491c737f5be" -CTL_CHECKSUM[RTM0AC0000ADAACMZ1SL41C.tar.gz]="4e0bb98feeb1e309a2ec12c201bc16aa" -CTL_CHECKSUM[RTM0AC0000AEAACMZ1SL41C.tar.gz]="414c5fc22bcf848b5a6eee3812874611" -CTL_CHECKSUM[RTM0AC0000XAAACD30SL41C.tar.gz]="e44c10bd24372fc70013c2498c6869d3" -CTL_CHECKSUM[RTM0AC0000XAAACE30SL41C.tar.gz]="1611375916d9e17cff19c34b83300c83" -CTL_CHECKSUM[RTM0AC0000XACMND30SL41C.tar.gz]="6229f43b2260d194f663bceed16ca273" -CTL_CHECKSUM[RTM0AC0000XCMCTL30SL41C.tar.bz2]="516f86033669537a162220c773cb972d" -CTL_CHECKSUM[RTM0AC0000XV264D30SL41C.tar.bz2]="b9e4e0d6dc65f65d21079b88824d6de3" -CTL_CHECKSUM[RTM0AC0000XV264E30SL41C.tar.bz2]="3f2cd1aa774ce4bc980ef1b2cc4a77cf" -CTL_CHECKSUM[RTM0AC0000XVCMND30SL41C.tar.bz2]="e484652d06f1383a3543fd9188316a8a" -CTL_CHECKSUM[RTM0AC0000XVCMNE30SL41C.tar.bz2]="bc419ea899e0d93c226cb637800e8028" +CTL_CHECKSUM[r8a77951_linux_gsx_binaries_gles.tar.bz2]="06cc04c52f56048dbc00ead14447cb35" +CTL_CHECKSUM[r8a77960_linux_gsx_binaries_gles.tar.bz2]="a24be039f1c294035416dbd77fa10f4a" +CTL_CHECKSUM[GSX_KM_H3.tar.bz2]="563ff3f5d5dc8b40d19d0b6e7484bf22" +CTL_CHECKSUM[GSX_KM_M3.tar.bz2]="7cbbffb874b30e36cc2c7751573e468b" +CTL_CHECKSUM[RTM8RC0000ZMX0DQ00JFL3E.tar.bz2]="2ee662978a45fc7c7cf2cef0e4bf1e33" +CTL_CHECKSUM[RTM8RC0000ZAD1LQ00JPL3E.tar.gz]="f59cb979a030a3545a6c0b2337e8ea0e" +CTL_CHECKSUM[RTM8RC0000ZAE1LQ00JPL3E.tar.gz]="7bdfac397034e8e13425cd83e3bd5090" +CTL_CHECKSUM[RTM8RC0000ZMD0LQ00JPL3E.tar.bz2]="8d774178a3fe5ddac0cc5bd16bc58e3e" +CTL_CHECKSUM[RTM8RC0000ZMD1LQ00JPL3E.tar.bz2]="3f30a263a038d148b2af445bc09dc4b7" +CTL_CHECKSUM[RTM8RC0000ZME0LQ00JPL3E.tar.bz2]="8f83d1c3947904e48316faa058c196c7" +CTL_CHECKSUM[RTM8RC0000ZME1LQ00JPL3E.tar.bz2]="89d4ce58062ef956fa2b8ef1bd8a66f3" +CTL_CHECKSUM[RTM8RC0000ZMX0LQ00JPL3E.tar.bz2]="035361ad4715bbb491ee23d80bc50e3a" +CTL_CHECKSUM[RTM8RC0000ZND1LQ00JPL3E.tar.gz]="b56fa5404bdee152b557869390783eb4" +CTL_CHECKSUM[RTM8RC0000ZNE1LQ00JPL3E.tar.gz]="63880c583eb132b868a074db3d39c8ee" +CTL_CHECKSUM[RTM8RC0000ZNX0LQ00JPL3E.tar.gz]="53ff1eb5de6c5345bd24e8e3605eb82d" + diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_git.bbappend b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_git.bbappend index 4ba36ca2c..f4d086938 100644 --- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_git.bbappend +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_git.bbappend @@ -1,5 +1,9 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/files:" +# Boot Normal World in EL2: this define configures ATF (SPSR register) to boot +# BL33 in EL2. +EXTRA_OEMAKE += " RCAR_BL33_EXECUTION_EL=1" -SRC_URI:append = " \ - file://0001-Boot-Normal-World-in-EL2.patch \ -" +do_ipl_opt_deploy:prepend () { + # Work around bug in BSP recipe, it can fail if nothing else has + # happened to run first and create the directory. + install -d ${DEPLOY_DIR_IMAGE} +} diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/files/0001-Boot-Normal-World-in-EL2.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/files/0001-Boot-Normal-World-in-EL2.patch deleted file mode 100644 index 6ce9c0f9d..000000000 --- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/files/0001-Boot-Normal-World-in-EL2.patch +++ /dev/null @@ -1,28 +0,0 @@ -From c97f38b09f8b7d9c57a6e6f500c6ba8f7abd9914 Mon Sep 17 00:00:00 2001 -From: Michele Paolino <m.paolino@virtualopensystems.com> -Date: Fri, 19 May 2017 14:50:55 +0200 -Subject: [PATCH] Boot Normal World in EL2 - -This patch configures ATF (SPSR register) to boot BL33 in EL2. - -Signed-off-by: Michele Paolino <m.paolino@virtualopensystems.com> ---- - plat/renesas/rcar/platform.mk | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/plat/renesas/rcar/platform.mk b/plat/renesas/rcar/platform.mk -index ef7bf0f..06bc592 100644 ---- a/plat/renesas/rcar/platform.mk -+++ b/plat/renesas/rcar/platform.mk -@@ -186,7 +186,7 @@ $(eval $(call add_define,RCAR_DRAM_SPLIT)) - - # Process RCAR_BL33_EXECUTION_EL flag - ifndef RCAR_BL33_EXECUTION_EL --RCAR_BL33_EXECUTION_EL := 0 -+RCAR_BL33_EXECUTION_EL := 1 - endif - $(eval $(call add_define,RCAR_BL33_EXECUTION_EL)) - --- -2.7.4 - diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/bootfiles/files/uEnv-ota-h3ulcb.txt b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/bootfiles/files/uEnv-ota-h3ulcb.txt index a08cc7d9c..9cc3eb9d2 100644 --- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/bootfiles/files/uEnv-ota-h3ulcb.txt +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/bootfiles/files/uEnv-ota-h3ulcb.txt @@ -12,7 +12,7 @@ rootmmc=0:2 booteload_sd=ext4load mmc ${rootmmc} ${bootkaddr} boot/loader/uEnv.txt; env import -t ${bootkaddr} ${filesize} bootkload_sd=ext4load mmc ${rootmmc} ${bootkaddr} boot/${kernel_image} bootiload_sd=ext4load mmc ${rootmmc} ${bootiaddr} boot/${ramdisk_image}; setenv ramdisk_size ${filesize} -bootdload_sd=fatload mmc ${bootmmc} ${bootdaddr} r8a7795-h3ulcb.dtb +bootdload_sd=fatload mmc ${bootmmc} ${bootdaddr} r8a77951-ulcb.dtb bootcmd=run booteload_sd; setenv bootargs ${bootargs} ${bootargs_console} ${bootargs_root} ${bootargs_extra}; run bootkload_sd; run bootiload_sd; run bootdload_sd; booti ${bootkaddr} ${bootiaddr}:${ramdisk_size} ${bootdaddr} diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/bootfiles/files/uEnv-ota-m3ulcb.txt b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/bootfiles/files/uEnv-ota-m3ulcb.txt index 979014a28..145f82eae 100644 --- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/bootfiles/files/uEnv-ota-m3ulcb.txt +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/bootfiles/files/uEnv-ota-m3ulcb.txt @@ -12,7 +12,7 @@ rootmmc=0:2 booteload_sd=ext4load mmc ${rootmmc} ${bootkaddr} boot/loader/uEnv.txt; env import -t ${bootkaddr} ${filesize} bootkload_sd=ext4load mmc ${rootmmc} ${bootkaddr} boot/${kernel_image} bootiload_sd=ext4load mmc ${rootmmc} ${bootiaddr} boot/${ramdisk_image}; setenv ramdisk_size ${filesize} -bootdload_sd=fatload mmc ${bootmmc} ${bootdaddr} r8a7796-m3ulcb.dtb +bootdload_sd=fatload mmc ${bootmmc} ${bootdaddr} r8a77960-ulcb.dtb bootcmd=run booteload_sd; setenv bootargs ${bootargs} ${bootargs_console} ${bootargs_root} ${bootargs_extra}; run bootkload_sd; run bootiload_sd; run bootdload_sd; booti ${bootkaddr} ${bootiaddr}:${ramdisk_size} ${bootdaddr} diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/bootfiles/renesas-ota-bootfiles.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/bootfiles/renesas-ota-bootfiles.bb index e8235b9bd..d46f4d885 100644 --- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/bootfiles/renesas-ota-bootfiles.bb +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/bootfiles/renesas-ota-bootfiles.bb @@ -8,10 +8,10 @@ COMPATIBLE_MACHINE = "(salvator-x|m3ulcb|h3ulcb|ebisu)" S = "${WORKDIR}" -SRC_URI:append:sota = "file://uEnv-ota-m3ulcb.txt \ - file://uEnv-ota-h3ulcb.txt \ - file://uEnv-ota-h3-salvator-xs \ - file://uEnv-ota-m3-salvator-xs" +SRC_URI:append:sota = " file://uEnv-ota-m3ulcb.txt \ + file://uEnv-ota-h3ulcb.txt \ + file://uEnv-ota-h3-salvator-xs \ + file://uEnv-ota-m3-salvator-xs" do_deploy() { install -d ${DEPLOYDIR}/${PN} } diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-examples_git.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-examples_git.bb index 6528f3073..7ff677c80 100644 --- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-examples_git.bb +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-examples_git.bb @@ -1,6 +1,6 @@ SUMMARY = "OP-TEE examples" -LICENSE = "GPLv2" +LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=cd95ab417e23b94f381dafc453d70c30" @@ -13,7 +13,7 @@ PV = "3.6.0+git${SRCPV}" SRCREV = "292da2fd8db0176e0e96989268c63ef9ab910a6c" SRC_URI = " \ - git://github.com/linaro-swg/optee_examples;branch=master;name=master \ + git://github.com/linaro-swg/optee_examples;branch=master;name=master;protocol=https \ file://0001-secure_storage-ta-Add-a-missing-include-file.patch \ " diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-test_git.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-test_git.bb index 153bfe628..b66f0676e 100644 --- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-test_git.bb +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-test_git.bb @@ -1,6 +1,6 @@ DESCRIPTION = "OP-TEE TEST" -LICENSE = "GPLv2 & BSD-2-Clause" +LICENSE = "GPL-2.0-only & BSD-2-Clause" LIC_FILES_CHKSUM = "file://${S}/host/LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263" PACKAGE_ARCH = "${MACHINE_ARCH}" @@ -12,7 +12,7 @@ PV = "3.1.0+git${SRCPV}" SRCREV = "45218eb59b006ad20cc7610904f291dd85157a43" SRC_URI = " \ - git://github.com/OP-TEE/optee_test.git;branch=master;name=master \ + git://github.com/OP-TEE/optee_test.git;branch=master;name=master;protocol=https \ file://optee_xtest_fix.diff \ " diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-user-app-template_git.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-user-app-template_git.bb index 10d8bdc6c..2b93af710 100644 --- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-user-app-template_git.bb +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/optee/optee-user-app-template_git.bb @@ -1,6 +1,6 @@ SUMMARY = "OP-TEE user_app_template" -LICENSE = "GPLv2" +LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=cd95ab417e23b94f381dafc453d70c30" PACKAGE_ARCH = "${MACHINE_ARCH}" @@ -12,7 +12,7 @@ PV = "0.1+git${SRCPV}" SRCREV = "0.1" SRC_URI = " \ - git://github.com/iotbzh/optee_user_app_template;branch=master \ + git://github.com/iotbzh/optee_user_app_template;branch=master;protocol=https \ " COMPATIBLE_MACHINE = "(salvator-x|h3ulcb|m3ulcb|m3nulcb|ebisu)" diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/u-boot/files/remove-redundant-yyloc-global.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/u-boot/files/remove-redundant-yyloc-global.patch deleted file mode 100644 index 2a184e57e..000000000 --- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/u-boot/files/remove-redundant-yyloc-global.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 018921ee79d3f30893614b3b2b63b588d8544f73 Mon Sep 17 00:00:00 2001 -From: Peter Robinson <pbrobinson@gmail.com> -Date: Thu, 30 Jan 2020 09:37:15 +0000 -Subject: [PATCH] Remove redundant YYLOC global declaration - -Same as the upstream fix for building dtc with gcc 10. - -Signed-off-by: Peter Robinson <pbrobinson@gmail.com> ---- - scripts/dtc/dtc-lexer.l | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l -index fd825ebba6..24af549977 100644 ---- a/scripts/dtc/dtc-lexer.l -+++ b/scripts/dtc/dtc-lexer.l -@@ -38,7 +38,6 @@ LINECOMMENT "//".*\n - #include "srcpos.h" - #include "dtc-parser.tab.h" - --YYLTYPE yylloc; - extern bool treesource_error; - - /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ --- -2.26.2 - diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/u-boot/u-boot_2020.01.bbappend b/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/u-boot/u-boot_2020.01.bbappend deleted file mode 100644 index ec75d0585..000000000 --- a/meta-agl-bsp/meta-rcar-gen3/recipes-bsp/u-boot/u-boot_2020.01.bbappend +++ /dev/null @@ -1,3 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/files:" - -SRC_URI:append = " file://remove-redundant-yyloc-global.patch " diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-graphics/gles-module/gles-user-module.bbappend b/meta-agl-bsp/meta-rcar-gen3/recipes-graphics/gles-module/gles-user-module.bbappend index d690b15ac..8f2d47adc 100644 --- a/meta-agl-bsp/meta-rcar-gen3/recipes-graphics/gles-module/gles-user-module.bbappend +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-graphics/gles-module/gles-user-module.bbappend @@ -1,6 +1,3 @@ require checksum_control.inc -do_install:append(){ - sed -i 's/MODE="0660", OWNER/MODE="0660", SECLABEL{smack}="*", OWNER/g' ${D}${sysconfdir}/udev/rules.d/72-pvr-seat.rules - sed -i 's/GROUP="video"/GROUP="display"/g' ${D}${sysconfdir}/udev/rules.d/72-pvr-seat.rules -} +RDEPENDS:${PN}:append = " wayland-wsegl" diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-graphics/virtual-gles-user-module/virtual-gles-user-module.bb b/meta-agl-bsp/meta-rcar-gen3/recipes-graphics/virtual-gles-user-module/virtual-gles-user-module.bb index a477e1c3c..76d3ea88f 100644 --- a/meta-agl-bsp/meta-rcar-gen3/recipes-graphics/virtual-gles-user-module/virtual-gles-user-module.bb +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-graphics/virtual-gles-user-module/virtual-gles-user-module.bb @@ -1,6 +1,6 @@ DESCRIPTION = "Virtual gles-module" -LICENSE="GPLv2" +LICENSE="GPL-2.0-only" DEPENDS = "gles-user-module wayland-kms libgbm" diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-graphics/wayland/wayland-wsegl.bbappend b/meta-agl-bsp/meta-rcar-gen3/recipes-graphics/wayland/wayland-wsegl.bbappend new file mode 100644 index 000000000..9a0eb73a3 --- /dev/null +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-graphics/wayland/wayland-wsegl.bbappend @@ -0,0 +1 @@ +DEPENDS:append = " wayland-protocols" diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/kernel-module-gles/kernel-module-gles.bbappend b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/kernel-module-gles/kernel-module-gles.bbappend index 1d53e4e99..b8882ae49 100644 --- a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/kernel-module-gles/kernel-module-gles.bbappend +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/kernel-module-gles/kernel-module-gles.bbappend @@ -2,5 +2,5 @@ require checksum_control.inc module_do_compile:prepend() { cd ${S}/build/linux/config/compilers - cp aarch64-poky-linux.mk ${TARGET_SYS}.mk + cp aarch64-linux-gnu.mk ${TARGET_SYS}.mk } diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/kernel-module-vspmif/kernel-module-vspmif.bbappend b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/kernel-module-vspmif/kernel-module-vspm-if.bbappend index 5efe01045..5efe01045 100644 --- a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/kernel-module-vspmif/kernel-module-vspmif.bbappend +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/kernel-module-vspmif/kernel-module-vspm-if.bbappend diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/0004-ADSP-enable-and-add-sound-hardware-abstraction.patch b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/0004-ADSP-enable-and-add-sound-hardware-abstraction.patch index e8ea125e9..9c7f01b26 100644 --- a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/0004-ADSP-enable-and-add-sound-hardware-abstraction.patch +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/0004-ADSP-enable-and-add-sound-hardware-abstraction.patch @@ -1,10 +1,13 @@ -The ADSP on Renesas SoCs required a reserved memory area to become -enabled, and this needs to be done manually. +From 274657edb779d77ad0fe5ccb52b51634d075adf8 Mon Sep 17 00:00:00 2001 +From: invalid_git config <unknown@unknown> +Date: Wed, 6 Oct 2021 14:42:47 +0000 +Subject: [PATCH 2/2] The ADSP on Renesas SoCs required a reserved memory area + to become enabled, and this needs to be done manually. This patch adds sound hardware abstraction information for the m3ulcb and m3ulcb-kf (kingfisher) device trees. This is helpful on-board the ADSP for dynamically determining sound hardware at runtime, allowing -single binaries to be used between the two boards. +single binaries to be used between the two boards. Future work will incorporate the h3ulcb and Salvator boards into the abstraction. @@ -12,11 +15,15 @@ abstraction. Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh> Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au> --- -diff --git a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts -index 1cd64c1b3b31..71e59da3528d 100644 ---- a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts -+++ b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts -@@ -42,11 +42,18 @@ + arch/arm64/boot/dts/renesas/r8a77960-ulcb.dts | 45 ++++++++++++++++++- + arch/arm64/boot/dts/renesas/r8a77961-ulcb.dts | 45 ++++++++++++++++++- + 2 files changed, 88 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/renesas/r8a77960-ulcb.dts b/arch/arm64/boot/dts/renesas/r8a77960-ulcb.dts +index fbc8c9af6e52..df3bd589d9bb 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77960-ulcb.dts ++++ b/arch/arm64/boot/dts/renesas/r8a77960-ulcb.dts +@@ -62,11 +62,18 @@ lossy_decompress: linux,lossy_decompress@54000000 { reg = <0x00000000 0x54000000 0x0 0x03000000>; }; @@ -36,7 +43,7 @@ index 1cd64c1b3b31..71e59da3528d 100644 linux,cma-default; }; -@@ -110,6 +117,42 @@ +@@ -126,6 +133,42 @@ &du { "dclkin.0", "dclkin.1", "dclkin.2"; }; @@ -79,3 +86,73 @@ index 1cd64c1b3b31..71e59da3528d 100644 &vspb { status = "okay"; }; +diff --git a/arch/arm64/boot/dts/renesas/r8a77961-ulcb.dts b/arch/arm64/boot/dts/renesas/r8a77961-ulcb.dts +index e57dd7bb43f7..f583cc6c18bf 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77961-ulcb.dts ++++ b/arch/arm64/boot/dts/renesas/r8a77961-ulcb.dts +@@ -41,11 +41,18 @@ lossy_decompress: linux,lossy_decompress@54000000 { + reg = <0x00000000 0x54000000 0x0 0x03000000>; + }; + ++ /* For Audio DSP */ ++ adsp_reserved: linux,adsp { ++ compatible = "shared-dma-pool"; ++ reusable; ++ reg = <0x00000000 0x57000000 0x0 0x01000000>; ++ }; ++ + /* global autoconfigured region for contiguous allocations */ + linux,cma@57000000 { + compatible = "shared-dma-pool"; + reusable; +- reg = <0x00000000 0x57000000 0x0 0x19000000>; ++ reg = <0x00000000 0x58000000 0x0 0x18000000>; + linux,cma-default; + }; + +@@ -89,6 +96,42 @@ &du { + "dclkin.0", "dclkin.1", "dclkin.2"; + }; + ++&adsp { ++ status = "okay"; ++ clock-frequency = <12288000 11289600>; ++ audio-clocks = <22579200 24576000>; ++ memory-region = <&adsp_reserved>; ++ ++ /* ADSP playback setting for ak4613 */ ++ adsp_playback0: adsp,playback { ++ mode = "i2s"; ++ clock-mode = "master"; ++ bus-width = <16>; ++ ssi = <0>; ++ bus-if = <0>; ++ channels = <2>; ++ pin-share-ssi = <1>; ++ }; ++ ++ /* ADSP capture setting for ak4613 */ ++ adsp_capture0: adsp,capture { ++ mode = "i2s"; ++ clock-mode = "slave"; ++ bus-width = <16>; ++ ssi = <1>; ++ bus-if = <0>; ++ channels = <2>; ++ pin-share-ssi = <0>; ++ }; ++ ++ adsp,ports { ++ port@0 { ++ playback = <&adsp_playback0>; ++ capture = <&adsp_capture0>; ++ }; ++ }; ++}; ++ + &vspb { + status = "okay"; + }; +-- +2.31.1 + diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/Set_GOV_PERFORMANCE.cfg b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/Set_GOV_PERFORMANCE.cfg new file mode 100644 index 000000000..b020174e8 --- /dev/null +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/Set_GOV_PERFORMANCE.cfg @@ -0,0 +1,2 @@ +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/r8a7796-m3ulcb-xen.dts b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/r8a77960-ulcb-xen.dts index 7940b1027..6947a62c2 100644 --- a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/r8a7796-m3ulcb-xen.dts +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/r8a77960-ulcb-xen.dts @@ -7,7 +7,7 @@ */ /dts-v1/; -#include "r8a7796.dtsi" +#include "r8a77960.dtsi" #include "ulcb.dtsi" / { diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/vivid.cfg b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/vivid.cfg new file mode 100644 index 000000000..3c3574346 --- /dev/null +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/files/vivid.cfg @@ -0,0 +1,6 @@ +CONFIG_V4L_TEST_DRIVERS=y +CONFIG_MEDIA_CONTROLLER_REQUEST_API=y +CONFIG_MEDIA_TEST_SUPPORT=y +CONFIG_VIDEO_V4L2_TPG=m +CONFIG_VIDEO_VIVID=m +CONFIG_VIDEO_VIVID_MAX_DEVS=64 diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_%.bbappend b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_%.bbappend index d4c247b2e..78996bf0a 100644 --- a/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_%.bbappend +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_%.bbappend @@ -8,14 +8,17 @@ SRC_URI:append = " \ " AGL_KCONFIG_FRAGMENTS += "namespace_fix.cfg" +AGL_KCONFIG_FRAGMENTS += "Set_GOV_PERFORMANCE.cfg" +AGL_KCONFIG_FRAGMENTS += "vivid.cfg" # For Xen AGL_KCONFIG_FRAGMENTS += " \ ${@bb.utils.contains('AGL_XEN_WANTED','1','xen-be.cfg','',d)} \ " + SRC_URI:append:m3ulcb = " \ - ${@bb.utils.contains('AGL_XEN_WANTED','1','file://r8a7796-m3ulcb-xen.dts;subdir=git/arch/${ARCH}/boot/dts/renesas','',d)} \ + ${@bb.utils.contains('AGL_XEN_WANTED','1','file://r8a77960-ulcb-xen.dts;subdir=git/arch/${ARCH}/boot/dts/renesas','',d)} \ " KERNEL_DEVICETREE:append:m3ulcb = " \ - ${@bb.utils.contains('AGL_XEN_WANTED','1','renesas/r8a7796-m3ulcb-xen.dtb','',d)} \ + ${@bb.utils.contains('AGL_XEN_WANTED','1','renesas/r8a77960-ulcb-xen.dtb','',d)} \ " diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.20.%.bbappend b/meta-agl-bsp/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.20.%.bbappend new file mode 100644 index 000000000..d91281c18 --- /dev/null +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.20.%.bbappend @@ -0,0 +1 @@ +do_unpack[network] = "1" diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20.%.bbappend b/meta-agl-bsp/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20.%.bbappend new file mode 100644 index 000000000..d91281c18 --- /dev/null +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.20.%.bbappend @@ -0,0 +1 @@ +do_unpack[network] = "1" diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20.%.bbappend b/meta-agl-bsp/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20.%.bbappend new file mode 100644 index 000000000..d91281c18 --- /dev/null +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.20.%.bbappend @@ -0,0 +1 @@ +do_unpack[network] = "1" diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-multimedia/mmngr-module/mmngr-user-module.bbappend b/meta-agl-bsp/meta-rcar-gen3/recipes-multimedia/mmngr-module/mmngr-user-module.bbappend new file mode 100644 index 000000000..9d3f5c670 --- /dev/null +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-multimedia/mmngr-module/mmngr-user-module.bbappend @@ -0,0 +1,11 @@ +do_install:append() { + # Add a rule to ensure the 'video' user has permission to access + install -d ${D}${sysconfdir}/udev/rules.d + cat >${D}${sysconfdir}/udev/rules.d/56-rgnmm.rules <<'EOF' +KERNEL=="rgnmm", MODE="0660", GROUP="video" +EOF +} + +FILES:${PN}:append = " \ + ${sysconfdir}/udev/rules.d/*.rules \ +" diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-multimedia/mmngr-module/mmngrbuf-user-module.bbappend b/meta-agl-bsp/meta-rcar-gen3/recipes-multimedia/mmngr-module/mmngrbuf-user-module.bbappend new file mode 100644 index 000000000..640e52651 --- /dev/null +++ b/meta-agl-bsp/meta-rcar-gen3/recipes-multimedia/mmngr-module/mmngrbuf-user-module.bbappend @@ -0,0 +1,11 @@ +do_install:append() { + # Add a rule to ensure the 'video' group has permission to access + install -d ${D}${sysconfdir}/udev/rules.d + cat >${D}${sysconfdir}/udev/rules.d/56-rgnmmbuf.rules <<'EOF' +KERNEL=="rgnmmbuf", MODE="0660", GROUP="video" +EOF +} + +FILES:${PN}:append = " \ + ${sysconfdir}/udev/rules.d/*.rules \ +" diff --git a/meta-agl-bsp/meta-rcar-gen3/recipes-platform/packagegroups/packagegroup-agl-graphical-multimedia.bbappend b/meta-agl-bsp/meta-rcar-gen3/recipes-platform/packagegroups/packagegroup-agl-graphical-multimedia.bbappend deleted file mode 100644 index bcf15faa1..000000000 --- a/meta-agl-bsp/meta-rcar-gen3/recipes-platform/packagegroups/packagegroup-agl-graphical-multimedia.bbappend +++ /dev/null @@ -1,5 +0,0 @@ -RDEPENDS_${PN}:append:rcar-gen3 = "\ - ${@bb.utils.contains('MACHINE_FEATURES','multimedia','packagegroup-multimedia-kernel-modules','',d)} \ - ${@bb.utils.contains('MACHINE_FEATURES','multimedia','packagegroup-multimedia-libs','',d)} \ - ${@bb.utils.contains('MACHINE_FEATURES','multimedia','packagegroup-gstreamer1.0-plugins','',d)} \ - " diff --git a/meta-agl-bsp/meta-rcar-gen3/scripts/setup_mm_packages.sh b/meta-agl-bsp/meta-rcar-gen3/scripts/setup_mm_packages.sh index 89238e5b0..3e8a2f242 100644 --- a/meta-agl-bsp/meta-rcar-gen3/scripts/setup_mm_packages.sh +++ b/meta-agl-bsp/meta-rcar-gen3/scripts/setup_mm_packages.sh @@ -1,7 +1,7 @@ #!/bin/bash -ZIP_1="R-Car_Gen3_Series_Evaluation_Software_Package_for_Linux-weston8-20210121.zip" -ZIP_2="R-Car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-weston8-20210121.zip" +ZIP_1="R-Car_Gen3_Series_Evaluation_Software_Package_for_Linux-20220121.zip" +ZIP_2="R-Car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-20220121.zip" COPY_SCRIPT="$METADIR/bsp/meta-renesas/meta-rcar-gen3/docs/sample/copyscript/copy_evaproprietary_softwares.sh" diff --git a/meta-agl-bsp/meta-sancloud/recipes-kernel/linux/linux-bbe/disable-relay.cfg b/meta-agl-bsp/meta-sancloud/recipes-kernel/linux/linux-bbe/disable-relay.cfg new file mode 100644 index 000000000..09a117919 --- /dev/null +++ b/meta-agl-bsp/meta-sancloud/recipes-kernel/linux/linux-bbe/disable-relay.cfg @@ -0,0 +1 @@ +# CONFIG_RELAY is not set diff --git a/meta-agl-bsp/meta-sancloud/recipes-kernel/linux/linux-bbe_%.bbappend b/meta-agl-bsp/meta-sancloud/recipes-kernel/linux/linux-bbe_%.bbappend index b3709a24b..803d4a995 100644 --- a/meta-agl-bsp/meta-sancloud/recipes-kernel/linux/linux-bbe_%.bbappend +++ b/meta-agl-bsp/meta-sancloud/recipes-kernel/linux/linux-bbe_%.bbappend @@ -3,3 +3,4 @@ require recipes-kernel/linux/linux-agl.inc FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" AGL_KCONFIG_FRAGMENTS += "cma-256.cfg" +AGL_KCONFIG_FRAGMENTS += "disable-relay.cfg" diff --git a/meta-agl-bsp/meta-sifive/recipes-bsp/u-boot/files/0001-WIP-Make-BSP-work-under-YP-kirkstone.patch b/meta-agl-bsp/meta-sifive/recipes-bsp/u-boot/files/0001-WIP-Make-BSP-work-under-YP-kirkstone.patch new file mode 100644 index 000000000..7fce516f0 --- /dev/null +++ b/meta-agl-bsp/meta-sifive/recipes-bsp/u-boot/files/0001-WIP-Make-BSP-work-under-YP-kirkstone.patch @@ -0,0 +1,46 @@ +From 57575ce80a96411bce828be6fc84ebd2ed003810 Mon Sep 17 00:00:00 2001 +From: Jan-Simon Moeller <jsmoeller@linuxfoundation.org> +Date: Tue, 12 Sep 2023 22:50:28 +0200 +Subject: [PATCH] [WIP] Make BSP work under YP kirkstone + +This fixes build issues when using the layer with YP 'kirkstone' branch. + +check-config.sh can be solved differently as well. +binman/control.py needs a little investigation + +Upstream-Status: Inappropriate +Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org> +--- + scripts/check-config.sh | 2 +- + tools/binman/control.py | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/scripts/check-config.sh b/scripts/check-config.sh +index cc1c9a54d9..633c69eb76 100755 +--- a/scripts/check-config.sh ++++ b/scripts/check-config.sh +@@ -57,7 +57,7 @@ if [ -s ${new_adhoc} ]; then + echo >&2 "Please add these via Kconfig instead. Find a suitable Kconfig" + echo >&2 "file and add a 'config' or 'menuconfig' option." + # Don't delete the temporary files in case they are useful +- exit 1 ++ exit 0 + else + rm ${suspects} ${ok} ${new_adhoc} + fi +diff --git a/tools/binman/control.py b/tools/binman/control.py +index 47aac207b4..3d013dea17 100644 +--- a/tools/binman/control.py ++++ b/tools/binman/control.py +@@ -8,7 +8,7 @@ + from collections import OrderedDict + import glob + import os +-import pkg_resources ++#import pkg_resources + import re + + import sys +-- +2.35.3 + diff --git a/meta-agl-bsp/meta-sifive/recipes-bsp/u-boot/u-boot-sifive_2023.07.02.bbappend b/meta-agl-bsp/meta-sifive/recipes-bsp/u-boot/u-boot-sifive_2023.07.02.bbappend new file mode 100644 index 000000000..30bf957cf --- /dev/null +++ b/meta-agl-bsp/meta-sifive/recipes-bsp/u-boot/u-boot-sifive_2023.07.02.bbappend @@ -0,0 +1,3 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRC_URI:append = " file://0001-WIP-Make-BSP-work-under-YP-kirkstone.patch " diff --git a/meta-agl-bsp/meta-sifive/recipes-kernel/linux/linux-sifive/radeon.cfg b/meta-agl-bsp/meta-sifive/recipes-kernel/linux/linux-sifive/radeon.cfg new file mode 100644 index 000000000..fd25fdd56 --- /dev/null +++ b/meta-agl-bsp/meta-sifive/recipes-kernel/linux/linux-sifive/radeon.cfg @@ -0,0 +1,19 @@ +CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS=y +CONFIG_MOUSE_PS2_SMBUS=y +CONFIG_I2C=y +CONFIG_I2C_ALGOBIT=y +CONFIG_DRM_BUDDY=m +CONFIG_DRM_SCHED=m +CONFIG_DRM_AMDGPU=m +CONFIG_DRM_AMD_DC=y +CONFIG_FB_DDC=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_BACKLIGHT=y +CONFIG_FB_MODE_HELPERS=y +CONFIG_FB_RADEON=y +CONFIG_FB_RADEON_I2C=y +CONFIG_FB_RADEON_BACKLIGHT=y +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_RTC_I2C_AND_SPI=y
\ No newline at end of file diff --git a/meta-agl-bsp/meta-sifive/recipes-kernel/linux/linux-sifive_%.bbappend b/meta-agl-bsp/meta-sifive/recipes-kernel/linux/linux-sifive_%.bbappend new file mode 100644 index 000000000..d951b33ba --- /dev/null +++ b/meta-agl-bsp/meta-sifive/recipes-kernel/linux/linux-sifive_%.bbappend @@ -0,0 +1,6 @@ +require recipes-kernel/linux/linux-agl.inc + +FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" + +# enable AMDgpu +AGL_KCONFIG_FRAGMENTS += "radeon.cfg" diff --git a/meta-agl-bsp/meta-synopsys/recipes-kernel/linux-yocto_%.bbappend b/meta-agl-bsp/meta-synopsys/recipes-kernel/linux-yocto_%.bbappend deleted file mode 100644 index d10ca3517..000000000 --- a/meta-agl-bsp/meta-synopsys/recipes-kernel/linux-yocto_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require recipes-kernel/linux/linux-yocto-agl.inc diff --git a/meta-agl-bsp/meta-ti/.gitkeep b/meta-agl-bsp/meta-ti-bsp/.gitkeep index e69de29bb..e69de29bb 100644 --- a/meta-agl-bsp/meta-ti/.gitkeep +++ b/meta-agl-bsp/meta-ti-bsp/.gitkeep diff --git a/meta-agl-bsp/meta-ti/recipes-bsp/cm3-pm-firmware/amx3-cm3_git.bbappend b/meta-agl-bsp/meta-ti-bsp/recipes-bsp/cm3-pm-firmware/amx3-cm3_git.bbappend index 1fc5130f0..1fc5130f0 100644 --- a/meta-agl-bsp/meta-ti/recipes-bsp/cm3-pm-firmware/amx3-cm3_git.bbappend +++ b/meta-agl-bsp/meta-ti-bsp/recipes-bsp/cm3-pm-firmware/amx3-cm3_git.bbappend diff --git a/meta-agl-bsp/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr_%.bbappend b/meta-agl-bsp/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr_%.bbappend new file mode 100644 index 000000000..08e684609 --- /dev/null +++ b/meta-agl-bsp/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr_%.bbappend @@ -0,0 +1 @@ +PR = "sgxrgx0" diff --git a/meta-agl-bsp/meta-ti-bsp/recipes-graphics/mesa/mesa_%.bbappend b/meta-agl-bsp/meta-ti-bsp/recipes-graphics/mesa/mesa_%.bbappend new file mode 100644 index 000000000..be4ee237b --- /dev/null +++ b/meta-agl-bsp/meta-ti-bsp/recipes-graphics/mesa/mesa_%.bbappend @@ -0,0 +1 @@ +require ${@bb.utils.contains_any('PREFERRED_PROVIDER_virtual/gpudriver', 'ti-img-rogue-driver ti-sgx-ddk-km', 'pvr-fix.inc', '', d)} diff --git a/meta-agl-bsp/meta-ti-bsp/recipes-graphics/mesa/pvr-fix.inc b/meta-agl-bsp/meta-ti-bsp/recipes-graphics/mesa/pvr-fix.inc new file mode 100644 index 000000000..82fda6896 --- /dev/null +++ b/meta-agl-bsp/meta-ti-bsp/recipes-graphics/mesa/pvr-fix.inc @@ -0,0 +1 @@ +SRC_URI:remove = "file://0001-virgl-don-t-a-use-staging-when-a-resources-created-w.patch" diff --git a/meta-agl-bsp/meta-ti/recipes-kernel/linux/linux-ti-staging_%.bbappend b/meta-agl-bsp/meta-ti-bsp/recipes-kernel/linux/linux-bb.org_%.bbappend index 07ba7d4d1..07ba7d4d1 100644 --- a/meta-agl-bsp/meta-ti/recipes-kernel/linux/linux-ti-staging_%.bbappend +++ b/meta-agl-bsp/meta-ti-bsp/recipes-kernel/linux/linux-bb.org_%.bbappend diff --git a/meta-agl-bsp/meta-qcom/recipes-kernel/linux/linux-linaro-qcomlt_%.bbappend b/meta-agl-bsp/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_%.bbappend index b60201986..07ba7d4d1 100644 --- a/meta-agl-bsp/meta-qcom/recipes-kernel/linux/linux-linaro-qcomlt_%.bbappend +++ b/meta-agl-bsp/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_%.bbappend @@ -1 +1,2 @@ require recipes-kernel/linux/linux-agl-config.inc + diff --git a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0001-Add-soc-performance-monitor-utilites.patch b/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0001-Add-soc-performance-monitor-utilites.patch deleted file mode 100644 index 4268b7dc2..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0001-Add-soc-performance-monitor-utilites.patch +++ /dev/null @@ -1,3570 +0,0 @@ -From 7830118ecb980766f4a6e3997769d7ae326bee77 Mon Sep 17 00:00:00 2001 -From: Karthik Ramanan <a0393906@ti.com> -Date: Fri, 3 Jun 2016 18:32:50 +0530 -Subject: [PATCH] Add soc performance monitor utilites - -Signed-off-by: Karthik Ramanan <a0393906@ti.com> ---- - Makefile.am | 17 +- - clients/Dra7xx_ddrstat_speed.c | 494 +++++++++++++ - clients/soc_performance_monitor.c | 630 ++++++++++++++++ - clients/soc_performance_monitor.h | 40 ++ - clients/statcoll.c | 1433 +++++++++++++++++++++++++++++++++++++ - clients/statcoll.h | 152 ++++ - clients/statcoll_gui.h | 101 +++ - clients/time_bar_graph.c | 515 +++++++++++++ - clients/time_bar_graph.h | 93 +++ - 10 files changed, 4873 insertions(+), 1 deletion(-) - create mode 100644 clients/Dra7xx_ddrstat_speed.c - create mode 100644 clients/soc_performance_monitor.c - create mode 100644 clients/soc_performance_monitor.h - create mode 100644 clients/statcoll.c - create mode 100644 clients/statcoll.h - create mode 100644 clients/statcoll_gui.h - create mode 100644 clients/time_bar_graph.c - create mode 100644 clients/time_bar_graph.h - -diff --git a/Makefile.am b/Makefile.am -index 62719c9..55aed6d 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -432,7 +432,9 @@ demo_clients = \ - weston-fullscreen \ - weston-stacking \ - weston-calibrator \ -- weston-scaler -+ weston-scaler \ -+ soc-performance-monitor \ -+ soc-ddr-bw-visualizer - - if INSTALL_DEMO_CLIENTS - bin_PROGRAMS += $(demo_clients) -@@ -570,6 +572,19 @@ weston_image_SOURCES = clients/image.c - weston_image_LDADD = libtoytoolkit.la - weston_image_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS) - -+noinst_LTLIBRARIES += libtimebargraph.la -+libtimebargraph_la_SOURCES = clients/time_bar_graph.c clients/time_bar_graph.h -+libtimebargraph_la_LIBADD = libtoytoolkit.la -+libtimebargraph_la_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS) $(CAIRO_CFLAGS) $(CAIRO_EGL_CFLAGS) -+ -+soc_performance_monitor_SOURCES = clients/soc_performance_monitor.c clients/soc_performance_monitor.h -+soc_performance_monitor_LDADD = libtoytoolkit.la libtimebargraph.la -+soc_performance__CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS) -+ -+soc_ddr_bw_visualizer_SOURCES = clients/statcoll.c clients/Dra7xx_ddrstat_speed.c clients/statcoll.h clients/statcoll_gui.h -+soc_ddr_bw_visualizer_LDADD = libtoytoolkit.la libtimebargraph.la -+soc_ddr_bw_visualizer__CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS) -+ - weston_cliptest_SOURCES = \ - clients/cliptest.c \ - src/vertex-clipping.c \ -diff --git a/clients/Dra7xx_ddrstat_speed.c b/clients/Dra7xx_ddrstat_speed.c -new file mode 100644 -index 0000000..af06733 ---- /dev/null -+++ b/clients/Dra7xx_ddrstat_speed.c -@@ -0,0 +1,494 @@ -+/* -+ * Copyright (C) 2015 Texas Instruments -+ * Author: Karthik Ramanan <karthik.ramanan@ti.com> -+ * -+ * 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. -+ * -+ * This program is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -+ * more details. -+ * -+ * You should have received a copy of the GNU General Public License along with -+ * this program. If not, see <http://www.gnu.org/licenses/>. -+ */ -+ -+#include <stdio.h> -+#include <stdlib.h> -+#include <stdint.h> -+#include <string.h> -+#include <sys/mman.h> -+#include <sys/time.h> -+#include <unistd.h> -+#include <fcntl.h> -+#include "statcoll.h" -+ -+#define PAGE_SIZE 4096 -+ -+#define EMIF1_BASE 0x4c000000 -+#define EMIF2_BASE 0x4d000000 -+ -+#define EMIF_PERF_CNT_1 0x80 -+#define EMIF_PERF_CNT_2 0x84 -+#define EMIF_PERF_CNT_CFG 0x88 -+#define EMIF_PERF_CNT_TIM 0x90 -+ -+static unsigned -+tv_diff(struct timeval *tv1, struct timeval *tv2) -+{ -+ return (tv2->tv_sec - tv1->tv_sec) * 1000000 + -+ (tv2->tv_usec - tv1->tv_usec); -+} -+ -+ -+struct emif_perf { -+ int code; -+ const char *name; -+}; -+ -+static const struct emif_perf emif_perf_tab[] = { -+ { 0, "access" }, -+ { 1, "activate" }, -+ { 2, "read" }, -+ { 3, "write" }, -+ { 4, "fifo_cmd" }, -+ { 5, "fifo_write" }, -+ { 6, "fifo_read" }, -+ { 7, "fifo_ret" }, -+ { 8, "prio" }, -+ { 9, "cmd_pend" }, -+ { 10, "data" }, -+}; -+ -+static void *emif1, *emif2; -+static int BANDWIDTH=0; -+static int DELAY = 1; -+static int EMIF_PERF_CFG1 = 9; -+static int EMIF_PERF_CFG2 = 10; -+ -+ -+static int STATCOLL=0; -+static int TOTAL_TIME; -+static int INTERVAL_US; -+ -+struct timeval t1, t2; -+ -+FILE* outfile; -+struct emif_stats { -+ uint32_t cycles; -+ uint32_t cnt1; -+ uint32_t cnt2; -+}; -+ -+static struct emif_stats emif1_start, emif1_end; -+static struct emif_stats emif2_start, emif2_end; -+ -+static void *emif_init(int fd, unsigned base) -+{ -+ void *mem = -+ mmap(NULL, PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, base); -+ volatile uint32_t *emif = mem,temp; -+ -+ if (mem == MAP_FAILED){ -+ return NULL; -+ } -+ -+ emif[EMIF_PERF_CNT_CFG>>2] = EMIF_PERF_CFG2 << 16 | EMIF_PERF_CFG1; -+ -+ return mem; -+} -+ -+static void emif_read(volatile uint32_t *emif, struct emif_stats *st) -+{ -+ st->cycles = emif[EMIF_PERF_CNT_TIM>>2]; -+ st->cnt1 = emif[EMIF_PERF_CNT_1>>2]; -+ st->cnt2 = emif[EMIF_PERF_CNT_2>>2]; -+} -+ -+static void emif_print(const char *tag, struct emif_stats *st1, -+ struct emif_stats *st2) -+{ -+ uint32_t cycles = st2->cycles - st1->cycles; -+ uint32_t cnt1 = st2->cnt1 - st1->cnt1; -+ uint32_t cnt2 = st2->cnt2 - st1->cnt2; -+ printf("%s %s %2llu%% %s %2llu%%", tag, -+ emif_perf_tab[EMIF_PERF_CFG1].name, 100ull*cnt1/cycles, -+ emif_perf_tab[EMIF_PERF_CFG2].name, 100ull*cnt2/cycles); -+ fprintf(outfile,"%s%s= %2llu,%s%s= %2llu,", -+ tag, emif_perf_tab[EMIF_PERF_CFG1].name, 100ull*cnt1/cycles, -+ tag, emif_perf_tab[EMIF_PERF_CFG2].name, 100ull*cnt2/cycles); -+} -+ -+static int perf_init(void) -+{ -+ int fd = open("/dev/mem", O_RDWR); -+ int err = 0; -+ -+ if (fd == -1){ -+ printf("error fd=open() \n"); -+ return -1; -+ } -+ emif1 = emif_init(fd, EMIF1_BASE); -+ emif2 = emif_init(fd, EMIF2_BASE); -+ -+ if (!emif1 || !emif2){ -+ printf("error if (!emif1 || !emif2) \n"); -+ err = -1; -+ } -+ -+ close(fd); -+ return err; -+} -+ -+static void perf_start(void) -+{ -+ if (emif1) { -+ emif_read(emif1, &emif1_start); -+ emif_read(emif2, &emif2_start); -+ } -+} -+ -+static void perf_stop(void) -+{ -+ if (emif1) { -+ emif_read(emif1, &emif1_end); -+ emif_read(emif2, &emif2_end); -+ } -+} -+ -+static void perf_print(void) -+{ -+ if (emif1) { -+ emif_print("EMIF1", &emif1_start, &emif1_end); -+ printf("\t"); -+ emif_print("EMIF2", &emif2_start, &emif2_end); -+ printf("\r"); -+ fprintf(outfile, "\n"); -+ fflush(outfile); -+ fflush(stdout); -+ } -+} -+ -+static void perf_close(void) -+{ -+ if (emif1) munmap(emif1, PAGE_SIZE); -+ if (emif2) munmap(emif2, PAGE_SIZE); -+} -+ -+static int get_cfg(const char *name, int def) -+{ -+ char *end; -+ int n = strtol(name, &end, 0); -+ int i; -+ -+ if (!*end) -+ return n; -+ -+ for (i = 0; i < sizeof(emif_perf_tab)/sizeof(emif_perf_tab[0]); i++) -+ if (!strcmp(name, emif_perf_tab[i].name)) -+ return emif_perf_tab[i].code; -+ -+ return def; -+} -+ -+ -+unsigned int emif_freq() -+{ -+ volatile unsigned *tim1; -+ unsigned v1, v2; -+ int fd; -+ -+ /*calculation EMIF frequency -+ EMIF_PERF_CNT_TIM = \n32-bit counter that -+ continuously counts number for -+ EMIF_FCLK clock cycles elapsed -+ after EMIFis brought out of reset*/ -+ -+ fd = open("/dev/mem", O_RDONLY); -+ if (fd == -1) { -+ perror("/dev/mem"); -+ return 1; -+ } -+ -+ void *mem = -+ mem = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_SHARED, fd, EMIF1_BASE); -+ if (mem == MAP_FAILED) { -+ perror("mmap"); -+ exit(1); -+ } -+ -+ tim1 = (unsigned *)((char*)mem + EMIF_PERF_CNT_TIM); -+ -+ v1 = *tim1; -+ gettimeofday(&t1, NULL); -+ sleep(2); -+ v2 = *tim1; -+ gettimeofday(&t2, NULL); -+ -+ munmap(mem, PAGE_SIZE); -+ close(fd); -+ -+ return (v2 - v1) / tv_diff(&t1, &t2); -+ -+} -+ -+ -+char config_file_path[100]; -+char keylist[][50] = { -+ "DELAY", -+ "EMIF_PERF_CFG1", -+ "EMIF_PERF_CFG2", -+ "BANDWIDTH", -+ "STATCOLL", -+ "TOTAL_TIME", -+ "INTERVAL_US", -+ "INITIATORS", -+}; -+ -+char line[512], *p; -+char tokens[6][512]; -+int temp, flag = 0; -+char *keyvalue, *pair; -+char key[100]; -+int linecount=0; -+ -+ -+int debug=0; -+ -+void print_valid_options(void) -+{ -+ int i; -+ printf("Invalid key found\n"); -+ printf("Supported keys are :\n"); -+ for(i=0; i<sizeof(keylist)/sizeof(keylist[0]); i++) -+ printf("\t\t %s\n", keylist[i]); -+ -+} -+int validatekey(char *ptr) -+{ -+ int i; -+ for(i=0; i<sizeof(keylist)/sizeof(keylist[0]); i++) -+ if(strcmp(ptr, keylist[i]) == 0) -+ return 0; -+ -+ return 1; -+} -+ -+void add_key_value(char *key, int value) -+{ -+ printd("%s", "Inside add_key_value\n"); -+ -+ if(strcmp(key, "BANDWIDTH") == 0) { -+ BANDWIDTH = value; -+ return; -+ } -+ if(strcmp(key, "STATCOLL") == 0) { -+ STATCOLL = value; -+ return; -+ } -+ else -+ printd("%s", "********** UNKNOWN**********"); -+ -+ if(BANDWIDTH == 1) { -+ if(strcmp(key, "DELAY") == 0) -+ DELAY = value; -+ else if(strcmp(key, "EMIF_PERF_CFG1") == 0) -+ EMIF_PERF_CFG1 = value; -+ else if(strcmp(key, "EMIF_PERF_CFG2") == 0) -+ EMIF_PERF_CFG2 = value; -+ } -+ else -+ printf("NOTE: BANDWIDTH is not enabled, ignoring %s\n", key); -+ -+ -+ if(STATCOLL == 1) { -+ if(strcmp(key, "INTERVAL_US") == 0) -+ INTERVAL_US = value; -+ else if(strcmp(key, "TOTAL_TIME") == 0) -+ TOTAL_TIME = value; -+ } -+ else -+ printf("NOTE: STATCOLL is not enabled, ignoring %s\n", key); -+} -+ -+void bandwidth_usage() { -+ -+ printf("#########################################################\n##\n" -+ -+ "## usage : ./Dra7xx_ddrstat <DELAY> <EMIF_PERF_CFG1> <EMIF_PERF_CFG2> \n" -+ "## default : DELAY=1 EMIF_PERF_CFG1=9 EMIF_PERF_CFG2=10\n" -+ "## option : for EMIF_PERF_CFG1 and EMIF_PERF_CFG2\n" -+ "## 0 -> access,\n" -+ "## 1 -> activate,\n" -+ "## 2 -> read,\n" -+ "## 3 -> write,\n" -+ "## 4 -> fifo_cmd,\n" -+ "## 5 -> fifo_write,\n" -+ "## 6 -> fifo_read,\n" -+ "## 7 -> fifo_ret,\n" -+ "## 8 -> prio,\n" -+ "## 9 -> cmd_pend,\n" -+ "## 10 -> data \n##\n" -+ -+ "## EMIF frq : %d MHz\n\n", emif_freq() ); -+} -+ -+ -+int main(int argc, char **argv) -+{ -+ int option; -+ FILE *fp; -+ int i; -+ int xpos = 600, ypos = 40; -+ -+ -+ /* Read config file */ -+ /* Initialize this to turn off verbosity of getopt */ -+ opterr = 0; -+ -+// while ((option = getopt (argc, argv, "df:")) != -1) -+ while ((option = getopt (argc, argv, "dx:y:")) != -1) -+ { -+ switch(option) -+ { -+#if 0 -+ case 'f': -+ strcpy(config_file_path, optarg); -+ break; -+#endif -+ case 'd': -+ debug=1; -+ break; -+ case 'x': -+ xpos=atoi(optarg); -+ break; -+ case 'y': -+ ypos=atoi(optarg); -+ break; -+ -+ default: -+ printf("Invalid option.. Exiting\n"); -+ exit(0); -+ } -+ } -+ -+ printf("xpos = %d, ypos = %d\n", xpos, ypos); -+ -+ strcpy(config_file_path,"config.ini"); -+ fp = fopen(config_file_path, "r"); -+ if (fp == NULL) { -+ fprintf(stderr, "couldn't open the specified file\n"); -+ return -1; -+ } -+ -+ while (fgets(line, sizeof line, fp)) { -+ printd("Line is = %s", line); -+ -+ if (line[0] == '#' || line[0] == '\n') { -+ continue; -+ } -+ -+ memset(tokens, 0, sizeof(tokens)); -+ i = 0; -+ -+ pair = strtok (line," ,"); -+ while (pair != NULL) -+ { -+ printd ("\tPair is = %s\n",pair); -+ strcpy(tokens[i++], pair); -+ pair = strtok (NULL, " ,.-"); -+ } -+ -+ for(temp=0; temp< i; temp++) -+ { -+ printd("Line %d: %s\n", temp, tokens[temp]); -+ -+ keyvalue = strtok (tokens[temp]," ="); -+ while (keyvalue != NULL) -+ { -+ if(flag == 0) -+ { -+ if(validatekey(keyvalue)) -+ { -+ print_valid_options(); -+ exit(0); -+ } -+ strcpy(key, keyvalue); -+ printd ("\tKey is = %s\n",key); -+ flag++; -+ } -+ else -+ { -+ printd ("\tValue is = %s",keyvalue); -+ printd (" (%d)\n", atoi(keyvalue)); -+ add_key_value(key, atoi(keyvalue)); -+ flag = 0; -+ } -+ keyvalue = strtok (NULL, " ="); -+ } -+ } -+ -+ -+ -+ linecount++; -+ printd("%s", "------------------- \n"); -+ -+ } -+ -+ fclose(fp); -+ -+ printf("\n\nCOMPLETED: Parsing of the user specified parameters.. \n \ -+ \nConfiguring device now.. \n\n"); -+ if(BANDWIDTH == 1) { -+ bandwidth_usage(); -+ if (DELAY <= 0) -+ DELAY = 1; -+ -+ if (perf_init()){ -+ printf("perf_init return non zero \n"); -+ return 1; -+ } -+ -+ outfile = fopen("emif-performance.csv", "w+"); -+ if (!outfile) { -+ printf("\n Error opening file"); -+ } -+ for (;;) { -+ perf_start(); -+ sleep(DELAY); -+ perf_stop(); -+ perf_print(); -+ } -+ -+ fclose(outfile); -+ perf_close(); -+ return 0; -+ } -+ -+ if(STATCOLL == 1) { -+ printf("STATISTICS COLLECTOR option chosen\n"); -+ printf("------------------------------------------------\n\n"); -+ fp = fopen("initiators.cfg", "r"); -+ if (fp == NULL) { -+ fprintf(stderr, "couldn't open the specified file initiators.cfg'\n"); -+ return -1; -+ } -+ -+ int i=0; -+ char list[100][50]; -+ memset(list, sizeof(list), 0); -+ while (fgets(line, sizeof line, fp)) { -+ printf("Line is = %s", line); -+ /* Slightly strange way to chop off the \n character */ -+ strtok(line, "\n"); -+ strcpy(list[i++], line); -+ } -+ fclose(fp); -+ -+ statcoll_start(TOTAL_TIME, INTERVAL_US, list, xpos, ypos); -+ } -+ -+} -+ -diff --git a/clients/soc_performance_monitor.c b/clients/soc_performance_monitor.c -new file mode 100644 -index 0000000..5d1db32 ---- /dev/null -+++ b/clients/soc_performance_monitor.c -@@ -0,0 +1,630 @@ -+/* -+ * Copyright (C) 2016 Texas Instruments -+ * Author: Karthik Ramanan <karthik.ramanan@ti.com> -+ * -+ * 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. -+ * -+ * This program is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -+ * more details. -+ * -+ * You should have received a copy of the GNU General Public License along with -+ * this program. If not, see <http://www.gnu.org/licenses/>. -+ */ -+ -+#include <stdint.h> -+#include <stdio.h> -+#include <stdlib.h> -+#include <string.h> -+#include <stdint.h> -+#include <signal.h> -+#include <time.h> -+#include <math.h> -+#include <unistd.h> -+#include <sys/time.h> -+#include <pthread.h> -+#include <errno.h> -+#include <unistd.h> -+#include <fcntl.h> -+#include <sys/stat.h> -+ -+#include "time_bar_graph.h" -+ -+#include "soc_performance_monitor.h" -+ -+static int debug=0; -+ -+static char readfifo[100]; -+static int MAX_WIDTH=1920; -+static int MAX_HEIGHT=1080; -+static int x_pos=0; -+static int y_pos=40; -+ -+void *ctx; -+struct time_graph_create_params tg_p; -+struct bar_graph_create_params bg_p; -+ -+static int cpu_load_offset = 0; -+static int total_cpu_load_items = 0; -+static int total_elements = 0; -+ -+struct _bar_graph_y_config *y_cfg; -+struct _text_config *t_cfg; -+char *tg_text[100]; -+char *bg_text[100]; -+ -+ -+int command_handler(int command, double *y, char **text) -+{ -+ static int fd; -+ char buf[MAX_BUF]; -+ int i, bytes, offset; -+ -+ switch(command) -+ { -+ case OPEN: -+ fd = open(readfifo, O_RDONLY|O_NONBLOCK); -+ break; -+ -+ case READ: -+ -+ /* open, read, and display the message from the FIFO */ -+ bytes=read(fd, buf, MAX_BUF); -+ buf[bytes]='\0'; -+ if(bytes > 0) -+ { -+ char command[100]; -+ char string[100]; -+ sscanf(buf, "%s %s", command, string); -+ printd("Received %s\n", buf); -+ if(strcmp(command, "TABLE:") == 0) -+ { -+ char field[100], value[100], unit[100]; -+ sscanf(buf, "%s %s %s %s", command, field, value, unit); -+ for(i=0; i<cpu_load_offset; i++) { -+ if(strcmp(text[i*2], field) == 0) { -+ printd("Updating value(%s), unit(%s)\n", value, unit); -+ sprintf(text[i*2+1], "%s %s", value, unit); -+ } -+ } -+ } -+ else if(strcmp(command, "CPULOAD:") == 0) -+ { -+ char field[100], value[100]; -+ -+ sscanf(buf, "%s %s %s", command, field, value); -+ -+ for(i=cpu_load_offset; i<cpu_load_offset+total_cpu_load_items; i++) { -+ if(strcmp(text[i*2], field) == 0) { -+ if(strlen(value) <= 2) { -+ y[i*2+1] = atoi(value)/100.0; -+ sprintf(text[i*2+1], " %02s%s", value,"%"); -+ printd("CPULOAD: Updating %s with %s\n", field, value); -+ } -+ else { -+ printf("Ignoring value: %s\n", value); -+ } -+ } -+ } -+ } -+ else if(strcmp(command, "MOVE:") == 0) -+ { -+ char value[100]; -+ printd("Received MOVE command : %s\n", buf); -+ sscanf(string, "%s", value); -+ sprintf(tg_p.title, "CPU Usage[@position-req=%sx%d]", value, y_pos); -+ move_graph(ctx, &tg_p); -+ } -+ else -+ { -+ printf("ERROR: Received unexpected data from FIFO - \" %s \" \n", buf); -+ } -+ memset(buf, 0x0, sizeof(buf)); -+ } -+ -+ break; -+ -+ case CLOSE: -+ close(fd); -+ break; -+ } -+ return bytes; -+} -+ -+volatile sig_atomic_t sigtermed = 0; -+ -+void my_signal_handler(int signum) -+{ -+ if (signum == SIGTERM || signum == SIGINT) { -+ sigtermed = 1; -+ } -+} -+ -+int get_strings_in_section(char *string, char **output) -+{ -+ FILE *fd; -+ char line[512]; -+ int total_strings = 0; -+ -+ fd = fopen("soc_performance_monitor.cfg", "r"); -+ if(fd == NULL) { -+ fprintf(stderr, "ERROR: Unable to open file soc_performance_monitor.cfg\n"); -+ fprintf(stderr, " Please copy the file from /etc/visualization_scripts into current directory\n"); -+ exit(0); -+ } -+ -+ while(fgets(line, sizeof line, fd)) { -+ if(strstr(line, string)) { -+ printf("\n-------------------------------------------------\n"); -+ printf("CONFIG FILE PARSE: Found section %s in line : %s\n", string, line); -+ break; -+ } -+ } -+ -+ while(fgets(line, sizeof line, fd)) { -+ printd("Line is = %s", line); -+ -+ if (line[0] == '#' || line[0] == '\n' || line[0] == '[') { -+ break; -+ } -+ -+ line[strlen(line) - 1] = '\0'; -+ strcpy(output[total_strings++], line); -+ -+ } -+ fclose(fd); -+ -+ return total_strings; -+} -+ -+ -+void fill_cpu_load_details(int start_offset, int end_offset, char **output, struct table_configuration *table_config) -+{ -+ int i; -+ -+ const int BL_START_X = table_config->BL_START_X; -+ const int BL_START_Y = table_config->BL_START_Y; -+ const int BAR_GAP = table_config->BAR_GAP; -+ const int BAR_HEIGHT = table_config->BAR_HEIGHT; -+ const int BAR_WIDTH = table_config->BAR_WIDTH; -+ const int TR_START_X = table_config->TR_START_X; -+ const int TR_START_Y = table_config->TR_START_Y; -+ const int FONT_SIZE = table_config->FONT_SIZE; -+ printf("Filling from %d to %d\n", start_offset, end_offset); -+ cpu_load_offset = start_offset; -+ -+ for(i=start_offset; i< end_offset-1; i++) { -+ y_cfg[i*2].region.bottom_left.x = BL_START_X + (i-start_offset) * (BAR_GAP + BAR_WIDTH); -+ y_cfg[i*2].region.bottom_left.y = BL_START_Y; -+ y_cfg[i*2].region.top_right.x = TR_START_X + (i-start_offset) * (BAR_GAP + BAR_WIDTH); -+ y_cfg[i*2].region.top_right.y = TR_START_Y; -+ y_cfg[i*2].line_color.r = 1.0; -+ y_cfg[i*2].line_color.g = 1.0; -+ y_cfg[i*2].line_color.b = 1.0; -+ y_cfg[i*2].line_color.a = 1.0; -+ y_cfg[i*2].fill_color.r = 0.0; -+ y_cfg[i*2].fill_color.g = 0.0; -+ y_cfg[i*2].fill_color.b = 1.0; -+ y_cfg[i*2].fill_color.a = 0.7; -+ -+ y_cfg[i*2+1].region.bottom_left.x = BL_START_X +(i-start_offset) * (BAR_GAP + BAR_WIDTH); -+ y_cfg[i*2+1].region.bottom_left.y = BL_START_Y; -+ y_cfg[i*2+1].region.top_right.x = TR_START_X + (i-start_offset) * (BAR_GAP + BAR_WIDTH); -+ y_cfg[i*2+1].region.top_right.y = TR_START_Y; -+ y_cfg[i*2+1].line_color.r = 1.0; -+ y_cfg[i*2+1].line_color.g = 1.0; -+ y_cfg[i*2+1].line_color.b = 1.0; -+ y_cfg[i*2+1].line_color.a = 1.0; -+ y_cfg[i*2+1].fill_color.r = 1.0; -+ y_cfg[i*2+1].fill_color.g = 0.0; -+ y_cfg[i*2+1].fill_color.b = 0.0; -+ y_cfg[i*2+1].fill_color.a = 1.0; -+ -+ -+ t_cfg[i*2].color.r = 1.0; -+ t_cfg[i*2].color.g = 1.0; -+ t_cfg[i*2].color.b = 1.0; -+ t_cfg[i*2].color.a = 1.0; -+ t_cfg[i*2].at.x = BL_START_X + (i-start_offset) * (BAR_GAP + BAR_WIDTH); -+ t_cfg[i*2].at.y = BL_START_Y + FONT_SIZE; -+ t_cfg[i*2].fontsize = FONT_SIZE; -+ -+ t_cfg[i*2+1].color.r = 1.0; -+ t_cfg[i*2+1].color.g = 1.0; -+ t_cfg[i*2+1].color.b = 1.0; -+ t_cfg[i*2+1].color.a = 1.0; -+ t_cfg[i*2+1].at.x = BL_START_X + (i-start_offset) * (BAR_GAP + BAR_WIDTH); -+ t_cfg[i*2+1].at.y = BL_START_Y - BAR_HEIGHT - FONT_SIZE; -+ t_cfg[i*2+1].fontsize = FONT_SIZE; -+ -+ strcpy(bg_text[i*2], output[i - start_offset]); -+ strcpy(bg_text[i*2+1], "0%"); -+ } -+ -+ t_cfg[(end_offset-1)*2].color.r = 0.0; -+ t_cfg[(end_offset-1)*2].color.g = 1.0; -+ t_cfg[(end_offset-1)*2].color.b = 1.0; -+ t_cfg[(end_offset-1)*2].color.a = 1.0; -+ t_cfg[(end_offset-1)*2].at.x = BL_START_X + 80; -+ t_cfg[(end_offset-1)*2].at.y = TR_START_Y - 40; -+ t_cfg[(end_offset-1)*2].fontsize = FONT_SIZE + 3; -+ -+ printd("Copying title string %s\n", output[end_offset - start_offset -1]); -+ strcpy(bg_text[(end_offset-1)*2], output[end_offset - start_offset-1]); -+} -+ -+void fill_table_details(int start_offset, int end_offset, char **output, struct table_configuration *table_config) -+{ -+ int i; -+ -+ const int BL_START_X = table_config->BL_START_X; -+ const int BL_START_Y = table_config->BL_START_Y; -+ const int BAR_GAP = table_config->BAR_GAP; -+ const int BAR_HEIGHT = table_config->BAR_HEIGHT; -+ const int BAR_WIDTH = table_config->BAR_WIDTH; -+ const int TR_START_X = table_config->TR_START_X; -+ const int TR_START_Y = table_config->TR_START_Y; -+ const int FONT_SIZE = table_config->FONT_SIZE; -+ printf("Filling from %d to %d\n", start_offset, end_offset); -+ -+ -+ char tokenize[200]; -+ char tokens[10][100]; -+ char *pair, *key, *value; -+ int k=0; -+ char title[100], unit[100]; -+ -+ strcpy(tokenize, output[end_offset - start_offset - 1]); -+ memset(tokens, 0, sizeof(tokens)); -+ -+ k=0; -+ pair = strtok (tokenize,","); -+ while (pair != NULL) { -+ strcpy(tokens[k++], pair); -+ pair = strtok (NULL, ","); -+ } -+ -+ i=0; -+ memset(title, 0, sizeof(title)); -+ memset(unit, 0, sizeof(unit)); -+ while(i < k) { -+ key=strtok(tokens[i], "="); -+ if(key != NULL) { -+ if(strcmp(key,"TITLE") == 0) { -+ value = strtok(NULL, "="); -+ if(value != NULL) { -+ strcpy(title, value); -+ } -+ } -+ if(strcmp(key,"UNIT") == 0) { -+ value = strtok(NULL, "="); -+ if(value != NULL) { -+ strcpy(unit, value); -+ } -+ } -+ } -+ i++; -+ } -+ -+ for(i=start_offset; i< end_offset-1; i++) { -+ y_cfg[i*2].region.bottom_left.x = BL_START_X; -+ y_cfg[i*2].region.bottom_left.y = BL_START_Y + (i - start_offset) * (BAR_GAP + BAR_HEIGHT); -+ y_cfg[i*2].region.top_right.x = TR_START_X; -+ y_cfg[i*2].region.top_right.y = TR_START_Y + (i - start_offset) * (BAR_GAP + BAR_HEIGHT); -+ y_cfg[i*2].line_color.r = 1.0; -+ y_cfg[i*2].line_color.g = 1.0; -+ y_cfg[i*2].line_color.b = 1.0; -+ y_cfg[i*2].line_color.a = 1.0; -+ y_cfg[i*2].fill_color.r = 0.0; -+ y_cfg[i*2].fill_color.g = 0.3; -+ y_cfg[i*2].fill_color.b = 0.0; -+ y_cfg[i*2].fill_color.a = 0.7; -+ -+ y_cfg[i*2+1].region.bottom_left.x = TR_START_X; -+ y_cfg[i*2+1].region.bottom_left.y = BL_START_Y + (i - start_offset) * (BAR_GAP + BAR_HEIGHT); -+ y_cfg[i*2+1].region.top_right.x = TR_START_X + (BAR_WIDTH); //+ 1 * BL_START_X; -+ y_cfg[i*2+1].region.top_right.y = TR_START_Y + (i - start_offset) * (BAR_GAP + BAR_HEIGHT);; -+ y_cfg[i*2+1].line_color.r = 1.0; -+ y_cfg[i*2+1].line_color.g = 1.0; -+ y_cfg[i*2+1].line_color.b = 1.0; -+ y_cfg[i*2+1].line_color.a = 1.0; -+ y_cfg[i*2+1].fill_color.r = 0.3; -+ y_cfg[i*2+1].fill_color.g = 0.0; -+ y_cfg[i*2+1].fill_color.b = 0.0; -+ y_cfg[i*2+1].fill_color.a = 0.7; -+ -+ -+ t_cfg[i*2].color.r = 1.0; -+ t_cfg[i*2].color.g = 1.0; -+ t_cfg[i*2].color.b = 1.0; -+ t_cfg[i*2].color.a = 1.0; -+ t_cfg[i*2].at.x = BL_START_X + 5; -+ t_cfg[i*2].at.y = BL_START_Y + (i - start_offset) * (BAR_GAP+BAR_HEIGHT) -5; -+ t_cfg[i*2].fontsize = FONT_SIZE; -+ -+ t_cfg[i*2+1].color.r = 1.0; -+ t_cfg[i*2+1].color.g = 1.0; -+ t_cfg[i*2+1].color.b = 1.0; -+ t_cfg[i*2+1].color.a = 1.0; -+ t_cfg[i*2+1].at.x = TR_START_X + 50;//BAR_WIDTH + TR_START_X; -+ t_cfg[i*2+1].at.y = BL_START_Y + (i - start_offset) * (BAR_GAP + BAR_HEIGHT) -5; -+ t_cfg[i*2+1].fontsize = FONT_SIZE; -+ -+ printd("Copying string %s at %d\n", output[i-start_offset], i); -+ strcpy(bg_text[i*2], output[i-start_offset]); -+ printd("Setting text 0 %s at %d\n", unit, i*2+1); -+ sprintf(bg_text[i*2+1], "0 %s", unit); -+ } -+ for(i=start_offset; i< end_offset*2; i++) { -+ printd("%d - (%d, %d) to (%d, %d)\n", i, y_cfg[i].region.bottom_left.x, y_cfg[i].region.bottom_left.y, y_cfg[i].region.top_right.x, y_cfg[i].region.top_right.y); -+ } -+ -+ t_cfg[(end_offset-1)*2].color.r = 0.0; -+ t_cfg[(end_offset-1)*2].color.g = 1.0; -+ t_cfg[(end_offset-1)*2].color.b = 1.0; -+ t_cfg[(end_offset-1)*2].color.a = 1.0; -+ t_cfg[(end_offset-1)*2].at.x = BL_START_X + 80; -+ t_cfg[(end_offset-1)*2].at.y = BL_START_Y - 40; -+ t_cfg[(end_offset-1)*2].fontsize = FONT_SIZE + 3; -+ -+ printd("Copying title string %s\n", title); -+ strcpy(bg_text[(end_offset-1)*2], title); -+ -+} -+ -+ -+int get_key_value_from_string(char *string, char *limiter, char *key, char *value) -+{ -+ char *mykey, *myvalue; -+ -+ mykey=strtok(string, limiter); -+ if(mykey != NULL) { -+ myvalue = strtok(NULL, "="); -+ strtok(myvalue, "\n"); -+ if(myvalue == NULL) { -+ return -1; -+ } -+ } -+ else { -+ return -1; -+ } -+ printd("Key is %s\n", mykey); -+ printd("Value is %s\n", myvalue); -+ strcpy(key, mykey); -+ strcpy(value, myvalue); -+ return 0; -+ -+} -+ -+void populate_table_configuration(struct table_configuration *tbl_cfg, int cur_items, char **item_list) -+{ -+ static int total_items = 0; -+ static int total_tables = 0; -+ -+ tbl_cfg->BAR_HEIGHT = 25; -+ tbl_cfg->BAR_WIDTH = 150; -+ tbl_cfg->BL_START_X = 40; -+ tbl_cfg->BL_START_Y = 80 + (total_items + total_tables) * tbl_cfg->BAR_HEIGHT; -+ tbl_cfg->BAR_GAP = 0; -+ tbl_cfg->TR_START_X = tbl_cfg->BL_START_X + tbl_cfg->BAR_WIDTH; -+ tbl_cfg->TR_START_Y = tbl_cfg->BL_START_Y - tbl_cfg->BAR_HEIGHT; -+ tbl_cfg->FONT_SIZE = 15; -+ -+ printf("Proceeding with filling out details...\n"); -+ if(cur_items > 0) -+ fill_table_details(total_items, total_items+cur_items, item_list, tbl_cfg); -+ -+ total_items += cur_items; -+ if(cur_items > 0) -+ total_tables++; -+ -+ printf("total_items = %d, total_tables = %d\n", total_items, total_tables); -+ return; -+} -+ -+int fill_list_from_section(char **section_list, char *section_name) -+{ -+ int total_items, j; -+ -+ for(j=0; j<20; j++) { -+ section_list[j] = malloc(100); -+ } -+ -+ total_items = get_strings_in_section(section_name, section_list); -+ printf("\tThe total values in the section %s are %d\n", section_name, total_items); -+ for(j=0; j<total_items; j++) { -+ printf("\t\tThe returned strings for BOOT_TIME are %s\n", section_list[j]); -+ } -+ -+ total_elements += total_items; -+ -+ return total_items; -+} -+ -+int main(int argc, char *argv[]) -+{ -+ double *bg_y; -+ double *tg_y; -+ int i,j; -+ int refresh_rate; -+ -+ if (SIG_ERR == signal(SIGPIPE,SIG_IGN)) -+ exit(1); -+ -+ if (SIG_ERR == signal(SIGINT,my_signal_handler)) -+ exit(1); -+ -+ if (SIG_ERR == signal(SIGTERM,my_signal_handler)) -+ exit(1); -+ -+ if(argc == 2) { -+ printf("Enabling debug\n"); -+ debug = atoi(argv[1]); -+ } -+ else { -+ printf("Debug is disabled\n"); -+ debug = 0; -+ } -+ -+ char *output[20]; -+ int total = fill_list_from_section(output, "GLOBAL"); -+ for(j=0; j<total; j++) { -+ char key[100], value[100]; -+ int ret = get_key_value_from_string(output[j], "=", key, value); -+ if(ret == 0) { -+ if(strcmp(key, "FIFO") == 0) { -+ strcpy(readfifo, value); -+ } -+ if(strcmp(key, "REFRESH_RATE_USEC") == 0) { -+ refresh_rate = atoi(value); -+ } -+ if(strcmp(key, "MAX_WIDTH") == 0) { -+ MAX_WIDTH = atoi(value); -+ } -+ if(strcmp(key, "MAX_HEIGHT") == 0) { -+ MAX_HEIGHT = atoi(value); -+ } -+ if(strcmp(key, "X_POS") == 0) { -+ x_pos = atoi(value); -+ } -+ if(strcmp(key, "Y_POS") == 0) { -+ y_pos = atoi(value); -+ } -+ } -+ -+ } -+ -+ printf("\n-------------------------------------------------\n"); -+ printf("Configured REFRESH_RATE is %d\n", refresh_rate); -+ printf("Configured FIFO is %s\n", readfifo); -+ printf("Configured MAX_WIDTH is %d\n", MAX_WIDTH); -+ printf("Configured MAX_HEIGHT is %d\n", MAX_HEIGHT); -+ printf("Configured starting location is (%d, %d)\n", x_pos, y_pos); -+ printf("\n-------------------------------------------------\n"); -+ -+ int fd = open(readfifo, O_RDONLY|O_NONBLOCK); -+ if (fd != -1) { -+ printf("SUCCESS: Configured FIFO exists\n"); -+ close(fd); -+ } -+ else { -+ printf("ERROR: %s not found\nPlease create the fifo by executing mkfifo %s before running the application\n", readfifo, readfifo); -+ exit(0); -+ } -+ -+ -+ bg_p.title = malloc(100); -+ sprintf(bg_p.title, "CPU Usage[@position-req=%dx%d]", x_pos, y_pos); -+ -+ /* ------------------------------------------------------------------------*/ -+ /* Section for populating all lists from cfg sections*/ -+ /* ------------------------------------------------------------------------*/ -+ char *boot_list[20]; -+ int total_boot_items = fill_list_from_section(boot_list, "BOOT_TIME"); -+ -+ char *temperature_list[20]; -+ int total_temperature_items = fill_list_from_section(temperature_list, "TEMPERATURE"); -+ -+ char *cpu_load_list[20]; -+ total_cpu_load_items = fill_list_from_section(cpu_load_list, "CPU_LOAD"); -+ -+ char *voltage_list[20]; -+ int total_voltage_items = fill_list_from_section(voltage_list, "VOLTAGE"); -+ -+ char *frequency_list[20]; -+ int total_frequency_items = fill_list_from_section(frequency_list, "FREQUENCY"); -+ /* ------------------------------------------------------------------------*/ -+ /* total_elements will be updated inside the fill_list_from_section function */ -+ -+ t_cfg = malloc(sizeof(struct _text_config) * (total_elements*2 + 1)); -+ y_cfg = malloc(sizeof(struct _bar_graph_y_config) * total_elements*2); -+ bg_p.num_of_y_items = total_elements*2; -+ bg_p.y_config_array = y_cfg; -+ bg_p.num_of_text_items = total_elements*2 + 1; -+ bg_p.text_config_array = t_cfg; -+ -+ bg_y = malloc(sizeof(double) * total_elements * 2); -+ for(i=0; i< (total_elements*2+1); i++) { -+ bg_text[i] = malloc(150); -+ bg_y[i] = 1.0; -+ } -+ -+ tg_y = malloc(sizeof(double) * total_elements * 2); -+ for(i=0; i< (total_elements*2+1); i++) { -+ tg_text[i] = malloc(150); -+ tg_y[i] = 0.1 * i; -+ } -+ -+ struct table_configuration boot_table_config; -+ populate_table_configuration(&boot_table_config, total_boot_items, boot_list); -+ -+ struct table_configuration temp_table_config; -+ populate_table_configuration(&temp_table_config, total_temperature_items, temperature_list); -+ -+ struct table_configuration voltage_table_config; -+ populate_table_configuration(&voltage_table_config, total_voltage_items, voltage_list); -+ -+ struct table_configuration frequency_table_config; -+ populate_table_configuration(&frequency_table_config, total_frequency_items, frequency_list); -+ -+ struct table_configuration cpu_load_config; -+ cpu_load_config.BL_START_X = 40; -+ cpu_load_config.BL_START_Y = 80 + (total_boot_items + total_temperature_items + total_voltage_items + total_frequency_items+ 4) * boot_table_config.BAR_HEIGHT + 80 /*cpu_load_config.BAR_HEIGHT */; -+ cpu_load_config.BAR_GAP = 20; -+ cpu_load_config.BAR_HEIGHT = 80; -+ cpu_load_config.BAR_WIDTH = 40; -+ cpu_load_config.TR_START_X = cpu_load_config.BL_START_X + cpu_load_config.BAR_WIDTH; -+ cpu_load_config.TR_START_Y = cpu_load_config.BL_START_Y - cpu_load_config.BAR_HEIGHT; -+ cpu_load_config.FONT_SIZE = 15; -+ if(total_cpu_load_items > 0) { -+ fill_cpu_load_details(total_boot_items+total_temperature_items+total_voltage_items+total_frequency_items, total_boot_items+total_temperature_items+total_voltage_items+total_frequency_items+total_cpu_load_items, cpu_load_list, &cpu_load_config); -+ } -+ else { -+ cpu_load_offset = total_boot_items + total_temperature_items + total_voltage_items + total_frequency_items; -+ } -+ -+ tg_p.title=(char *)malloc(100); -+ sprintf(tg_p.title, "CPU Usage[@position-req=%dx%d]", x_pos, y_pos); -+ tg_p.height = MAX_HEIGHT; -+ tg_p.width = MAX_WIDTH; -+ -+ struct _y_config *tg_y_cfg = malloc(tg_p.num_of_y_items * sizeof(struct _y_config)); -+ tg_p.y_config_array = tg_y_cfg; -+ tg_p.text_config_array = t_cfg; -+ -+ printf("Proceeding to create starting visualization...\n"); -+ ctx = time_graph_create(argc, argv, &tg_p); -+ if (!ctx) { -+ printf("Unable to create time_graph... \n"); -+ exit(0); -+ } -+ -+ ctx = bar_graph_create(argc, argv, &bg_p); -+ if (!ctx) { -+ printf("Error creating context\n"); -+ exit(0); -+ } -+ -+ command_handler(OPEN, NULL, NULL); -+ -+ /* Plot the graph first time */ -+ time_graph_plot(ctx, tg_y, (const char **)tg_text); -+ bar_graph_plot(ctx, bg_y, (const char **)bg_text); -+ -+ while (!sigtermed) -+ { -+ usleep(refresh_rate); -+ int bytes_read = command_handler(READ, bg_y, bg_text); -+ if(bytes_read > 0) { -+ time_graph_plot(ctx, tg_y, (const char **)tg_text); -+ bar_graph_plot(ctx, bg_y, (const char **)bg_text); -+ } -+ } -+ -+ bar_graph_destroy(ctx); -+ command_handler(CLOSE, NULL, NULL); -+ return 0; -+} -diff --git a/clients/soc_performance_monitor.h b/clients/soc_performance_monitor.h -new file mode 100644 -index 0000000..861c8c7 ---- /dev/null -+++ b/clients/soc_performance_monitor.h -@@ -0,0 +1,40 @@ -+#define __SLEEP usleep(1000000) -+ -+#define MAX_BUF 1024 -+#define OPEN 1 -+#define READ 2 -+#define CLOSE 3 -+ -+#define MAX_COLORS 12 -+ -+#define printd(fmt, ...) \ -+ do { if (debug) fprintf(stderr, fmt, __VA_ARGS__); } while (0) -+ -+ -+struct _rgba pallette[MAX_COLORS] = -+{ -+ { 1.0, 0.0, 0.0, 1.0 }, -+ { 0.0, 0.5, 0.0, 1.0 }, -+ { 0.0, 0.0, 1.0, 1.0 }, -+ { 0.0, 0.0, 0.0, 1.0 }, -+ { 0.0, 0.5, 1.0, 1.0 }, -+ { 1.0, 0.0, 1.0, 1.0 }, -+ { 0.5, 0.5, 1.0, 1.0 }, -+ { 1.0, 0.5, 0.0, 1.0 }, -+ { 0.5, 0.5, 0.25, 1.0 }, -+ { 0.5, 0.0, 0.0, 1.0 }, -+ { 1.0, 0.5, 0.5, 1.0 }, -+ { 0.0, 0.0, 0.20, 1.0 } -+}; -+ -+struct table_configuration { -+ int BL_START_X; -+ int BL_START_Y; -+ int BAR_GAP; -+ int BAR_HEIGHT; -+ int BAR_WIDTH; -+ int TR_START_X; -+ int TR_START_Y; -+ int FONT_SIZE; -+}; -+ -diff --git a/clients/statcoll.c b/clients/statcoll.c -new file mode 100644 -index 0000000..5d5cae7 ---- /dev/null -+++ b/clients/statcoll.c -@@ -0,0 +1,1433 @@ -+/* -+ * Copyright (C) 2015 Texas Instruments -+ * created by prash@ti.com on 16 Jan 2013 -+ * Adapted to Linux with changes in framework: Karthik R <karthik.ramanan@ti.com> -+ * -+ * 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. -+ * -+ * This program is distributed in the hope that it will be useful, but WITHOUT -+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -+ * more details. -+ * -+ * You should have received a copy of the GNU General Public License along with -+ * this program. If not, see <http://www.gnu.org/licenses/>. -+ */ -+ -+#include <stdio.h> -+#include <stdlib.h> -+#include <string.h> -+#include <sys/mman.h> -+#include <fcntl.h> -+#include <signal.h> -+#include <unistd.h> -+#include <sys/time.h> -+ -+#include "statcoll.h" -+#include "statcoll_gui.h" -+#include "time_bar_graph.h" -+ -+#define ENABLE_MODE 0x0 -+#define READ_STATUS_MODE 0x1 -+ -+ -+ -+#define OPEN 1 -+#define READ 2 -+#define CLOSE 3 -+ -+ -+#if 1 -+#define __SLEEP sleep(1) -+#else -+#define __SLEEP usleep(100000) -+#endif -+//#define DUMMY_MODE -+ -+#define MAX_COLORS 12 -+ -+struct _rgba pallette[MAX_COLORS] = -+{ -+ { 1.0, 0.0, 0.0, 1.0 }, -+ { 0.0, 0.5, 0.0, 1.0 }, -+ { 0.0, 0.0, 1.0, 1.0 }, -+ { 0.0, 0.0, 0.0, 1.0 }, -+ { 0.0, 0.5, 1.0, 1.0 }, -+ { 1.0, 0.0, 1.0, 1.0 }, -+ { 0.5, 0.5, 1.0, 1.0 }, -+ { 1.0, 0.5, 0.0, 1.0 }, -+ { 0.5, 0.5, 0.25, 1.0 }, -+ { 0.5, 0.0, 0.0, 1.0 }, -+ { 1.0, 0.5, 0.5, 1.0 }, -+ { 0.0, 0.0, 0.20, 1.0 } -+}; -+ -+const struct list_of_initiators initiators[STATCOL_MAX] = -+{ -+ { STATCOL_EMIF1_SYS, "STATCOL_EMIF1_SYS" }, -+ { STATCOL_EMIF2_SYS,"STATCOL_EMIF2_SYS" }, -+ { STATCOL_MA_MPU_P1,"STATCOL_MPU_P1" }, -+ { STATCOL_MA_MPU_P2,"STATCOL_MPU_P2" }, -+ { STATCOL_MPU1,"STATCOL_MPU1" }, -+ { STATCOL_MMU1,"STATCOL_MMU1" }, -+ { STATCOL_TPTC_RD1,"STATCOL_TPTC_RD1" }, -+ { STATCOL_TPTC_WR1,"STATCOL_TPTC_WR1" }, -+ { STATCOL_TPTC_RD2,"STATCOL_TPTC_RD2" }, -+ { STATCOL_TPTC_WR2,"STATCOL_TPTC_WR2" }, -+ { STATCOL_VIP1_P1,"STATCOL_VIP1_P1" }, -+ { STATCOL_VIP1_P2,"STATCOL_VIP1_P2" }, -+ { STATCOL_VIP2_P1,"STATCOL_VIP2_P1" }, -+ { STATCOL_VIP2_P2,"STATCOL_VIP2_P2" }, -+ { STATCOL_VIP3_P1,"STATCOL_VIP3_P1" }, -+ { STATCOL_VIP3_P2,"STATCOL_VIP3_P2" }, -+ { STATCOL_VPE_P1,"STATCOL_VPE_P1" }, -+ { STATCOL_VPE_P2,"STATCOL_VPE_P2" }, -+ { STATCOL_EVE1_TC0,"STATCOL_EVE1_TC0" }, -+ { STATCOL_EVE1_TC1,"STATCOL_EVE1_TC1" }, -+ { STATCOL_EVE2_TC0,"STATCOL_EVE2_TC0" }, -+ { STATCOL_EVE2_TC1,"STATCOL_EVE2_TC1" }, -+ { STATCOL_EVE3_TC0,"STATCOL_EVE3_TC0" }, -+ { STATCOL_EVE3_TC1,"STATCOL_EVE3_TC1" }, -+ { STATCOL_EVE4_TC0,"STATCOL_EVE4_TC0" }, -+ { STATCOL_EVE4_TC1,"STATCOL_EVE4_TC1" }, -+ { STATCOL_DSP1_MDMA,"STATCOL_DSP1_MDMA" }, -+ { STATCOL_DSP1_EDMA,"STATCOL_DSP1_EDMA" }, -+ { STATCOL_DSP2_MDMA,"STATCOL_DSP2_MDMA" }, -+ { STATCOL_DSP2_EDMA,"STATCOL_DSP2_EDMA" }, -+ { STATCOL_IVA,"STATCOL_IVA" }, -+ { STATCOL_GPU_P1,"STATCOL_GPU_P1" }, -+ { STATCOL_GPU_P2,"STATCOL_GPU_P2" }, -+ { STATCOL_BB2D_P1,"STATCOL_BB2D_P1" }, -+ { STATCOL_DSS,"STATCOL_DSS" }, -+ { STATCOL_CSI2_2,"STATCOL_CSI2_2" }, -+ { STATCOL_MMU2,"STATCOL_MMU2" }, -+ { STATCOL_IPU1,"STATCOL_IPU1" }, -+ { STATCOL_IPU2,"STATCOL_IPU2" }, -+ { STATCOL_DMA_SYSTEM_RD,"STATCOL_DMA_SYSTEM_RD" }, -+ { STATCOL_DMA_SYSTEM_WR,"STATCOL_DMA_SYSTEM_WR" }, -+ { STATCOL_CSI2_1,"STATCOL_CSI2_1" }, -+ { STATCOL_USB3_SS,"STATCOL_USB3_SS" }, -+ { STATCOL_USB2_SS,"STATCOL_USB2_SS" }, -+ { STATCOL_USB2_ULPI_SS1,"STATCOL_USB2_ULPI_SS1" }, -+ { STATCOL_USB2_ULPI_SS2,"STATCOL_USB2_ULPI_SS2" }, -+ { STATCOL_PCIE_SS1,"STATCOL_PCIE_SS1" }, -+ { STATCOL_PCIE_SS2,"STATCOL_PCIE_SS2" }, -+ { STATCOL_DSP1_CFG,"STATCOL_DSP1_CFG" }, -+ { STATCOL_DSP2_CFG,"STATCOL_DSP2_CFG" }, -+ { STATCOL_GMAC_SW,"STATCOL_GMAC_SW" }, -+ { STATCOL_PRUSS1_P1,"STATCOL_PRUSS1_P1" }, -+ { STATCOL_PRUSS1_P2,"STATCOL_PRUSS1_P2" }, -+ { STATCOL_PRUSS2_P1,"STATCOL_PRUSS2_P1" }, -+ { STATCOL_PRUSS2_P2,"STATCOL_PRUSS2_P2" }, -+ { STATCOL_DMA_CRYPTO_RD,"STATCOL_DMA_CRYPTO_RD" }, -+ { STATCOL_DMA_CRYPTO_WR,"STATCOL_DMA_CRYPTO_WR" }, -+ { STATCOL_MPU2,"STATCOL_MPU2" }, -+ { STATCOL_MMC1,"STATCOL_MMC1" }, -+ { STATCOL_MMC2,"STATCOL_MMC2" }, -+ { STATCOL_SATA,"STATCOL_SATA" }, -+ { STATCOL_MLBSS,"STATCOL_MLBSS" }, -+ { STATCOL_BB2D_P2,"STATCOL_BB2D_P2" }, -+ { STATCOL_IEEE1500,"STATCOL_IEEE1500" }, -+ { STATCOL_DBG,"STATCOL_DBG" }, -+ { STATCOL_VCP1,"STATCOL_VCP1" }, -+ { STATCOL_OCMC_RAM1,"STATCOL_OCMC_RAM1" }, -+ { STATCOL_OCMC_RAM2,"STATCOL_OCMC_RAM2" }, -+ { STATCOL_OCMC_RAM3,"STATCOL_OCMC_RAM3" }, -+ { STATCOL_GPMC,"STATCOL_GPMC" }, -+ { STATCOL_MCASP1,"STATCOL_MCASP1" }, -+ { STATCOL_MCASP2,"STATCOL_MCASP2" }, -+ { STATCOL_MCASP3,"STATCOL_MCASP3" }, -+ { STATCOL_VCP2, "STATCOL_VCP2" } -+}; -+ -+StatCollectorObj gStatColState; -+ -+static void *statcoll_base_mem; -+static int *l3_3_clkctrl; -+ -+static UInt32 *statCountDSS = NULL; -+static UInt32 *statCountIVA = NULL; -+static UInt32 *statCountBB2DP1 = NULL; -+static UInt32 *statCountBB2DP2 = NULL; -+static UInt32 *statCountUSB4 = NULL; -+static UInt32 *statCountSata = NULL; -+static UInt32 *statCountEmif1 = NULL; -+static UInt32 *statCountEmif2 = NULL; -+ -+ -+static statcoll_initiators_object global_object[STATCOL_MAX]; -+UInt32 statCountIdx = 0; -+UInt32 TRACE_SZ = 0; -+ -+void create_overall_box(struct _bar_graph_y_config *y_cfg, struct _text_config *t_cfg, char *text[]) -+{ -+ int i=0; -+ -+ memset(y_cfg, 0x0, sizeof(struct _y_config)*25); -+ memset(t_cfg, 0x0, sizeof(struct _text_config)*25); -+ -+ -+ for(i=0; i<TOTAL_Y_PARAMETERS; i++) { -+ (y_cfg+i)->line_color.r = 1.0; -+ (y_cfg+i)->line_color.g = 1.0; -+ (y_cfg+i)->line_color.b = 1.0; -+ (y_cfg+i)->line_color.a = 0.7; -+ (y_cfg+i)->fill_color.r = 0.0; -+ (y_cfg+i)->fill_color.g = 0.0; -+ (y_cfg+i)->fill_color.b = 0.0; -+ (y_cfg+i)->fill_color.a = 0.1; -+ } -+ -+ (y_cfg+0)->region.bottom_left.x = 0; -+ (y_cfg+0)->region.bottom_left.y = MAX_HEIGHT - HEIGHT_EMIF_AREA; -+ (y_cfg+0)->region.top_right.x = MAX_WIDTH; -+ (y_cfg+0)->region.top_right.y = 0; -+ -+ (t_cfg+0)->at.x = MAX_WIDTH/2 - 8*FONT_SIZE - 50; -+ (t_cfg+0)->at.y = BORDER - FONT_SIZE + 6; -+ strcpy(text[0], string_list[0]); -+ -+ (y_cfg+1)->region.bottom_left.x = TIME_GRAPH_AREA_BL_X; -+ (y_cfg+1)->region.bottom_left.y = TIME_GRAPH_AREA_BL_Y; -+ (y_cfg+1)->region.top_right.x = TIME_GRAPH_AREA_TR_X; -+ (y_cfg+1)->region.top_right.y = TIME_GRAPH_AREA_TR_Y; -+ -+ (t_cfg+1)->at.x = TIME_GRAPH_AREA_BL_X - 2*FONT_SIZE; -+ (t_cfg+1)->at.y = TIME_GRAPH_AREA_TR_Y; -+ strcpy(text[1],string_list[1]); -+ -+ for(i=2; i<7; i++) -+ { -+ (y_cfg+i)->region.bottom_left.x = TIME_GRAPH_AREA_BL_X; -+ (y_cfg+i)->region.bottom_left.y = TIME_GRAPH_AREA_BL_Y;// - (i-2) * (30); -+ (y_cfg+i)->region.top_right.x = TIME_GRAPH_AREA_TR_X; -+ (y_cfg+i)->region.top_right.y = TIME_GRAPH_AREA_TR_Y + (i-1) * ((TIME_GRAPH_AREA_BL_Y - TIME_GRAPH_AREA_TR_Y)/5); -+ (t_cfg+i)->at.x = TIME_GRAPH_AREA_BL_X - 2*FONT_SIZE; -+ (t_cfg+i)->at.y = TIME_GRAPH_AREA_TR_Y + (i-1) * ((TIME_GRAPH_AREA_BL_Y - TIME_GRAPH_AREA_TR_Y)/5);//TIME_GRAPH_AREA_TR_Y; -+ strcpy(text[i],string_list[i]); -+ } -+ -+#if 1 -+ (y_cfg+7)->region.bottom_left.x = EMIF_AREA_BL_X; -+ (y_cfg+7)->region.bottom_left.y = EMIF_AREA_BL_Y; -+ (y_cfg+7)->region.top_right.x = EMIF_AREA_TR_X; -+ (y_cfg+7)->region.top_right.y = EMIF_AREA_TR_Y; -+ -+ (t_cfg+7)->at.x = WIDTH_EMIF_AREA/2 - 2*FONT_SIZE; -+ (t_cfg+7)->at.y = EMIF_AREA_TR_Y + FONT_SIZE; -+ strcpy(text[7],string_list[7]); -+ -+ for(i=8; i<12; i=i+2) -+ { -+ (y_cfg+i)->region.bottom_left.x = EMIF_AREA_BL_X + BORDER + (i-8)*(BAR_WIDTH+BAR_GAP)/2; -+ (y_cfg+i)->region.bottom_left.y = EMIF_AREA_BL_Y - BORDER/2;// - (i-2) * (30); -+ (y_cfg+i)->region.top_right.x = EMIF_AREA_BL_X + BORDER + BAR_WIDTH + (i-8) * (BAR_WIDTH + BAR_GAP)/2; -+ (y_cfg+i)->region.top_right.y = EMIF_AREA_TR_Y + BORDER * 1.2; -+ -+ (y_cfg+i)->fill_color.r = 1.0; -+ (y_cfg+i)->fill_color.g = 0.0; -+ (y_cfg+i)->fill_color.b = 0.0; -+ (y_cfg+i)->fill_color.a = 0.1; -+ -+ (y_cfg+i+1)->region.bottom_left.x = EMIF_AREA_BL_X + BORDER + (i-8) * (BAR_WIDTH + BAR_GAP)/2; -+ (y_cfg+i+1)->region.bottom_left.y = EMIF_AREA_BL_Y - BORDER/2; -+ (y_cfg+i+1)->region.top_right.x = EMIF_AREA_BL_X + BORDER + BAR_WIDTH + (i-8) * (BAR_WIDTH + BAR_GAP)/2; -+ (y_cfg+i+1)->region.top_right.y = EMIF_AREA_TR_Y + BORDER*1.2; -+ -+ (y_cfg+i+1)->fill_color.r = 0.0; -+ (y_cfg+i+1)->fill_color.g = 1.0; -+ (y_cfg+i+1)->fill_color.b = 0.0; -+ (y_cfg+i+1)->fill_color.a = 1.0; -+ -+ (t_cfg+i)->at.x = EMIF_AREA_BL_X + BAR_WIDTH + BORDER + (i-8) * (BAR_WIDTH + BAR_GAP)/2- 2.2*FONT_SIZE; -+ (t_cfg+i)->at.y = EMIF_AREA_TR_Y + BORDER*1.2 -5; -+ -+ /* Fixed strings */ -+ (t_cfg+i+1)->at.x = EMIF_AREA_BL_X + BORDER + (i-8) * (BAR_WIDTH + BAR_GAP)/2; -+ (t_cfg+i+1)->at.y = EMIF_AREA_BL_Y;// - BORDER + FONT_SIZE; -+ -+ strcpy(text[i],string_list[i]); -+ strcpy(text[i+1],string_list[i+1]); -+ } -+ -+ (y_cfg+12)->region.bottom_left.x = INITIATORS_AREA_BL_X; -+ (y_cfg+12)->region.bottom_left.y = INITIATORS_AREA_BL_Y; -+ (y_cfg+12)->region.top_right.x = INITIATORS_AREA_TR_X; -+ (y_cfg+12)->region.top_right.y = INITIATORS_AREA_TR_Y; -+ -+ (t_cfg+12)->at.x = EMIF_AREA_TR_X + (INITIATORS_AREA_TR_X - INITIATORS_AREA_BL_X)/2 - 4 * FONT_SIZE; -+ (t_cfg+12)->at.y = INITIATORS_AREA_TR_Y + FONT_SIZE; -+ strcpy(text[12],string_list[12]); -+ -+ for(i=13; i<25; i=i+2) -+ { -+ (y_cfg+i)->region.bottom_left.x = INITIATORS_AREA_BL_X + BORDER + (i-13)*(BAR_WIDTH+BAR_GAP)/2; -+ (y_cfg+i)->region.bottom_left.y = INITIATORS_AREA_BL_Y - BORDER/2;// - (i-2) * (30); -+ (y_cfg+i)->region.top_right.x = INITIATORS_AREA_BL_X + BORDER + BAR_WIDTH + (i-13) * (BAR_WIDTH + BAR_GAP)/2; -+ (y_cfg+i)->region.top_right.y = INITIATORS_AREA_TR_Y + BORDER*1.2; -+ -+ (y_cfg+i)->fill_color.r = 1.0; -+ (y_cfg+i)->fill_color.g = 0.0; -+ (y_cfg+i)->fill_color.b = 0.0; -+ (y_cfg+i)->fill_color.a = 0.1; -+ -+ (y_cfg+i+1)->region.bottom_left.x = INITIATORS_AREA_BL_X + BORDER + (i-13) * (BAR_WIDTH + BAR_GAP)/2; -+ (y_cfg+i+1)->region.bottom_left.y = INITIATORS_AREA_BL_Y - BORDER/2;// - (i-2) * (30); -+ (y_cfg+i+1)->region.top_right.x = INITIATORS_AREA_BL_X + BORDER + BAR_WIDTH + (i-13) * (BAR_WIDTH + BAR_GAP)/2; -+ (y_cfg+i+1)->region.top_right.y = INITIATORS_AREA_TR_Y + BORDER* 1.2; -+ -+ (y_cfg+i+1)->fill_color.r = 0.0; -+ (y_cfg+i+1)->fill_color.g = 1.0; -+ (y_cfg+i+1)->fill_color.b = 0.0; -+ (y_cfg+i+1)->fill_color.a = 1.0; -+ -+ (t_cfg+i)->at.x = INITIATORS_AREA_BL_X + BORDER + BAR_WIDTH + (i-13) * (BAR_WIDTH + BAR_GAP)/2 - 2.2* FONT_SIZE; -+ (t_cfg+i)->at.y = INITIATORS_AREA_TR_Y + BORDER*1.2 -5; -+ -+ (t_cfg+i+1)->at.x = INITIATORS_AREA_BL_X + BORDER + (i-13)*(BAR_WIDTH+BAR_GAP)/2; -+ (t_cfg+i+1)->at.y = INITIATORS_AREA_BL_Y; -+ -+ strcpy(text[i],string_list[i]); -+ strcpy(text[i+1],string_list[i+1]); -+ } -+#endif -+ -+#if 0 -+ for(i=0; i<25; i++) -+ printf("(%d, %d) to (%d, %d)\n", (y_cfg +i)->region.bottom_left.x,(y_cfg +i)->region.bottom_left.y,(y_cfg +i)->region.top_right.x, (y_cfg +i)->region.top_right.y); -+#endif -+ -+ -+ -+ for(i=0; i<25; i++) { -+ (t_cfg+i)->color.r = 0.0; -+ (t_cfg+i)->color.g = 1.0; -+ (t_cfg+i)->color.b = 1.0; -+ (t_cfg+i)->color.a = 1.0; -+ (t_cfg+i)->fontsize = FONT_SIZE; -+ } -+ (t_cfg+0)->fontsize = 20; -+ -+ -+} -+ -+ -+void statCollectorInit() -+{ -+ int index; -+ -+ gStatColState.stat0_filter_cnt = 0; -+ gStatColState.stat1_filter_cnt = 0; -+ gStatColState.stat2_filter_cnt = 0; -+ gStatColState.stat3_filter_cnt = 0; -+ gStatColState.stat4_filter_cnt = 0; -+ gStatColState.stat5_filter_cnt = 0; -+ gStatColState.stat6_filter_cnt = 0; -+ gStatColState.stat7_filter_cnt = 0; -+ gStatColState.stat8_filter_cnt = 0; -+ gStatColState.stat9_filter_cnt = 0; -+ -+ for(index=STATCOL_EMIF1_SYS; index < STATCOL_MAX; index++) -+ { -+ global_object[index].b_enabled = 0; -+ -+ strcpy(global_object[index].name, initiators[index].name); -+ -+ global_object[index].readings = malloc(TRACE_SZ * sizeof(UInt32)); -+ memset(global_object[index].readings, 0, TRACE_SZ * sizeof(UInt32)); -+ -+ global_object[index].timestamp = NULL; -+ -+ global_object[index].group_id = 0xFF; -+ global_object[index].counter_id = 0; -+ global_object[index].base_address = 0; -+ global_object[index].mux_req = 0; -+ } -+ -+} -+ -+void wr_stat_reg(UInt32 address, UInt32 data) -+{ -+ UInt32 *mymem = statcoll_base_mem; -+ UInt32 delta = (address - STATCOLL_BASE) / 4; -+#ifndef DUMMY_MODE -+ mymem[delta] = data; -+#else -+ printf("WRITE: Address = 0x%x, Data = 0x%x\n", address, data); -+#endif -+} -+ -+UInt32 rd_stat_reg(UInt32 address) -+{ -+#ifndef DUMMY_MODE -+ UInt32 *mymem = statcoll_base_mem; -+ UInt32 data; -+ UInt32 delta = (address - STATCOLL_BASE) / 4; -+ data = mymem[delta]; -+ return data; -+#else -+ printf("READ: Address = 0x%x\n", address); -+#endif -+} -+ -+UInt32 statCollectorControlInitialize(UInt32 instance_id) -+{ -+ UInt32 cur_base_address = 0; -+ UInt32 cur_event_mux_req; -+ UInt32 cur_event_mux_resp; -+ UInt32 cur_stat_filter_cnt; -+ -+ switch (instance_id) -+ { -+ case STATCOL_EMIF1_SYS: -+ cur_base_address = stat_coll0_base_address; -+ cur_event_mux_req = 0; -+ cur_event_mux_resp = 1; -+ gStatColState.stat0_filter_cnt = gStatColState.stat0_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat0_filter_cnt; -+ global_object[instance_id].group_id = 0; -+ break; -+ case STATCOL_EMIF2_SYS: -+ cur_base_address = stat_coll0_base_address; -+ cur_event_mux_req = 2; -+ cur_event_mux_resp = 3; -+ gStatColState.stat0_filter_cnt = gStatColState.stat0_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat0_filter_cnt; -+ global_object[instance_id].group_id = 0; -+ break; -+ case STATCOL_MA_MPU_P1: -+ cur_base_address = stat_coll0_base_address; -+ cur_event_mux_req = 4; -+ cur_event_mux_resp = 5; -+ gStatColState.stat0_filter_cnt = gStatColState.stat0_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat0_filter_cnt; -+ global_object[instance_id].group_id = 0; -+ break; -+ case STATCOL_MA_MPU_P2: -+ cur_base_address = stat_coll0_base_address; -+ cur_event_mux_req = 6; -+ cur_event_mux_resp = 7; -+ gStatColState.stat0_filter_cnt = gStatColState.stat0_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat0_filter_cnt; -+ global_object[instance_id].group_id = 0; -+ break; -+ case STATCOL_MPU1: -+ cur_base_address = stat_coll1_base_address; -+ cur_event_mux_req = 0; -+ cur_event_mux_resp = 1; -+ gStatColState.stat1_filter_cnt = gStatColState.stat1_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat1_filter_cnt; -+ global_object[instance_id].group_id = 1; -+ break; -+ case STATCOL_MMU1: -+ cur_base_address = stat_coll1_base_address; -+ cur_event_mux_req = 2; -+ cur_event_mux_resp = 3; -+ gStatColState.stat1_filter_cnt = gStatColState.stat1_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat1_filter_cnt; -+ global_object[instance_id].group_id = 1; -+ break; -+ case STATCOL_TPTC_RD1: -+ cur_base_address = stat_coll1_base_address; -+ cur_event_mux_req = 4; -+ cur_event_mux_resp = 5; -+ gStatColState.stat1_filter_cnt = gStatColState.stat1_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat1_filter_cnt; -+ global_object[instance_id].group_id = 1; -+ break; -+ case STATCOL_TPTC_WR1: -+ cur_base_address = stat_coll1_base_address; -+ cur_event_mux_req = 6; -+ cur_event_mux_resp = 7; -+ gStatColState.stat1_filter_cnt = gStatColState.stat1_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat1_filter_cnt; -+ global_object[instance_id].group_id = 1; -+ break; -+ case STATCOL_TPTC_RD2: -+ cur_base_address = stat_coll1_base_address; -+ cur_event_mux_req = 8; -+ cur_event_mux_resp = 9; -+ gStatColState.stat1_filter_cnt = gStatColState.stat1_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat1_filter_cnt; -+ global_object[instance_id].group_id = 1; -+ break; -+ case STATCOL_TPTC_WR2: -+ cur_base_address = stat_coll1_base_address; -+ cur_event_mux_req = 10; -+ cur_event_mux_resp = 11; -+ gStatColState.stat1_filter_cnt = gStatColState.stat1_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat1_filter_cnt; -+ global_object[instance_id].group_id = 1; -+ break; -+ case STATCOL_VIP1_P1: -+ cur_base_address = stat_coll2_base_address; -+ cur_event_mux_req = 0; -+ cur_event_mux_resp = 1; -+ gStatColState.stat2_filter_cnt = gStatColState.stat2_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat2_filter_cnt; -+ global_object[instance_id].group_id = 2; -+ break; -+ case STATCOL_VIP1_P2: -+ cur_base_address = stat_coll2_base_address; -+ cur_event_mux_req = 2; -+ cur_event_mux_resp = 3; -+ gStatColState.stat2_filter_cnt = gStatColState.stat2_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat2_filter_cnt; -+ global_object[instance_id].group_id = 2; -+ break; -+ case STATCOL_VIP2_P1: -+ cur_base_address = stat_coll2_base_address; -+ cur_event_mux_req = 4; -+ cur_event_mux_resp = 5; -+ gStatColState.stat2_filter_cnt = gStatColState.stat2_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat2_filter_cnt; -+ global_object[instance_id].group_id = 2; -+ break; -+ case STATCOL_VIP2_P2: -+ cur_base_address = stat_coll2_base_address; -+ cur_event_mux_req = 6; -+ cur_event_mux_resp = 7; -+ gStatColState.stat2_filter_cnt = gStatColState.stat2_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat2_filter_cnt; -+ global_object[instance_id].group_id = 2; -+ break; -+ case STATCOL_VIP3_P1: -+ cur_base_address = stat_coll2_base_address; -+ cur_event_mux_req = 8; -+ cur_event_mux_resp = 9; -+ gStatColState.stat2_filter_cnt = gStatColState.stat2_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat2_filter_cnt; -+ global_object[instance_id].group_id = 2; -+ break; -+ case STATCOL_VIP3_P2: -+ cur_base_address = stat_coll2_base_address; -+ cur_event_mux_req = 10; -+ cur_event_mux_resp = 11; -+ gStatColState.stat2_filter_cnt = gStatColState.stat2_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat2_filter_cnt; -+ global_object[instance_id].group_id = 2; -+ break; -+ case STATCOL_VPE_P1: -+ cur_base_address = stat_coll2_base_address; -+ cur_event_mux_req = 12; -+ cur_event_mux_resp = 13; -+ gStatColState.stat2_filter_cnt = gStatColState.stat2_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat2_filter_cnt; -+ global_object[instance_id].group_id = 2; -+ break; -+ case STATCOL_VPE_P2: -+ cur_base_address = stat_coll2_base_address; -+ cur_event_mux_req = 14; -+ cur_event_mux_resp = 15; -+ gStatColState.stat2_filter_cnt = gStatColState.stat2_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat2_filter_cnt; -+ global_object[instance_id].group_id = 2; -+ break; -+ case STATCOL_EVE1_TC0: -+ cur_base_address = stat_coll3_base_address; -+ cur_event_mux_req = 0; -+ cur_event_mux_resp = 1; -+ gStatColState.stat3_filter_cnt = gStatColState.stat3_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat3_filter_cnt; -+ global_object[instance_id].group_id = 3; -+ break; -+ case STATCOL_EVE1_TC1: -+ cur_base_address = stat_coll3_base_address; -+ cur_event_mux_req = 2; -+ cur_event_mux_resp = 3; -+ gStatColState.stat3_filter_cnt = gStatColState.stat3_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat3_filter_cnt; -+ global_object[instance_id].group_id = 3; -+ break; -+ case STATCOL_EVE2_TC0: -+ cur_base_address = stat_coll3_base_address; -+ cur_event_mux_req = 4; -+ cur_event_mux_resp = 5; -+ gStatColState.stat3_filter_cnt = gStatColState.stat3_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat3_filter_cnt; -+ global_object[instance_id].group_id = 3; -+ break; -+ case STATCOL_EVE2_TC1: -+ cur_base_address = stat_coll3_base_address; -+ cur_event_mux_req = 6; -+ cur_event_mux_resp = 7; -+ gStatColState.stat3_filter_cnt = gStatColState.stat3_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat3_filter_cnt; -+ global_object[instance_id].group_id = 3; -+ break; -+ case STATCOL_EVE3_TC0: -+ cur_base_address = stat_coll3_base_address; -+ cur_event_mux_req = 8; -+ cur_event_mux_resp = 9; -+ gStatColState.stat3_filter_cnt = gStatColState.stat3_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat3_filter_cnt; -+ global_object[instance_id].group_id = 3; -+ break; -+ case STATCOL_EVE3_TC1: -+ cur_base_address = stat_coll3_base_address; -+ cur_event_mux_req = 10; -+ cur_event_mux_resp = 11; -+ gStatColState.stat3_filter_cnt = gStatColState.stat3_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat3_filter_cnt; -+ global_object[instance_id].group_id = 3; -+ break; -+ case STATCOL_EVE4_TC0: -+ cur_base_address = stat_coll3_base_address; -+ cur_event_mux_req = 12; -+ cur_event_mux_resp = 13; -+ gStatColState.stat3_filter_cnt = gStatColState.stat3_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat3_filter_cnt; -+ global_object[instance_id].group_id = 3; -+ break; -+ case STATCOL_EVE4_TC1: -+ cur_base_address = stat_coll3_base_address; -+ cur_event_mux_req = 14; -+ cur_event_mux_resp = 15; -+ gStatColState.stat3_filter_cnt = gStatColState.stat3_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat3_filter_cnt; -+ global_object[instance_id].group_id = 3; -+ break; -+ case STATCOL_DSP1_MDMA: -+ cur_base_address = stat_coll4_base_address; -+ cur_event_mux_req = 0; -+ cur_event_mux_resp = 1; -+ gStatColState.stat4_filter_cnt = gStatColState.stat4_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat4_filter_cnt; -+ global_object[instance_id].group_id = 4; -+ break; -+ case STATCOL_DSP1_EDMA: -+ cur_base_address = stat_coll4_base_address; -+ cur_event_mux_req = 2; -+ cur_event_mux_resp = 3; -+ gStatColState.stat4_filter_cnt = gStatColState.stat4_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat4_filter_cnt; -+ global_object[instance_id].group_id = 4; -+ break; -+ case STATCOL_DSP2_MDMA: -+ cur_base_address = stat_coll4_base_address; -+ cur_event_mux_req = 4; -+ cur_event_mux_resp = 5; -+ gStatColState.stat4_filter_cnt = gStatColState.stat4_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat4_filter_cnt; -+ global_object[instance_id].group_id = 4; -+ break; -+ case STATCOL_DSP2_EDMA: -+ cur_base_address = stat_coll4_base_address; -+ cur_event_mux_req = 6; -+ cur_event_mux_resp = 7; -+ gStatColState.stat4_filter_cnt = gStatColState.stat4_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat4_filter_cnt; -+ global_object[instance_id].group_id = 4; -+ break; -+ case STATCOL_IVA: -+ cur_base_address = stat_coll4_base_address; -+ cur_event_mux_req = 8; -+ cur_event_mux_resp = 9; -+ gStatColState.stat4_filter_cnt = gStatColState.stat4_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat4_filter_cnt; -+ global_object[instance_id].group_id = 4; -+ break; -+ case STATCOL_GPU_P1: -+ cur_base_address = stat_coll4_base_address; -+ cur_event_mux_req = 10; -+ cur_event_mux_resp = 11; -+ gStatColState.stat4_filter_cnt = gStatColState.stat4_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat4_filter_cnt; -+ global_object[instance_id].group_id = 4; -+ break; -+ case STATCOL_GPU_P2: -+ cur_base_address = stat_coll4_base_address; -+ cur_event_mux_req = 12; -+ cur_event_mux_resp = 13; -+ gStatColState.stat4_filter_cnt = gStatColState.stat4_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat4_filter_cnt; -+ global_object[instance_id].group_id = 4; -+ break; -+ case STATCOL_BB2D_P1: -+ cur_base_address = stat_coll4_base_address; -+ cur_event_mux_req = 14; -+ cur_event_mux_resp = 15; -+ gStatColState.stat4_filter_cnt = gStatColState.stat4_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat4_filter_cnt; -+ global_object[instance_id].group_id = 4; -+ break; -+ case STATCOL_DSS: -+ cur_base_address = stat_coll5_base_address; -+ cur_event_mux_req = 0; -+ cur_event_mux_resp = 1; -+ gStatColState.stat5_filter_cnt = gStatColState.stat5_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat5_filter_cnt; -+ global_object[instance_id].group_id = 5; -+ break; -+ case STATCOL_CSI2_2: -+ cur_base_address = stat_coll5_base_address; -+ cur_event_mux_req = 2; -+ cur_event_mux_resp = 3; -+ gStatColState.stat5_filter_cnt = gStatColState.stat5_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat5_filter_cnt; -+ global_object[instance_id].group_id = 5; -+ break; -+ case STATCOL_MMU2: -+ cur_base_address = stat_coll5_base_address; -+ cur_event_mux_req = 4; -+ cur_event_mux_resp = 5; -+ gStatColState.stat5_filter_cnt = gStatColState.stat5_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat5_filter_cnt; -+ global_object[instance_id].group_id = 5; -+ break; -+ case STATCOL_IPU1: -+ cur_base_address = stat_coll5_base_address; -+ cur_event_mux_req = 6; -+ cur_event_mux_resp = 7; -+ gStatColState.stat5_filter_cnt = gStatColState.stat5_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat5_filter_cnt; -+ global_object[instance_id].group_id = 5; -+ break; -+ case STATCOL_IPU2: -+ cur_base_address = stat_coll5_base_address; -+ cur_event_mux_req = 8; -+ cur_event_mux_resp = 9; -+ gStatColState.stat5_filter_cnt = gStatColState.stat5_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat5_filter_cnt; -+ global_object[instance_id].group_id = 5; -+ break; -+ case STATCOL_DMA_SYSTEM_RD: -+ cur_base_address = stat_coll5_base_address; -+ cur_event_mux_req = 10; -+ cur_event_mux_resp = 11; -+ gStatColState.stat5_filter_cnt = gStatColState.stat5_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat5_filter_cnt; -+ global_object[instance_id].group_id = 5; -+ break; -+ case STATCOL_DMA_SYSTEM_WR: -+ cur_base_address = stat_coll5_base_address; -+ cur_event_mux_req = 12; -+ cur_event_mux_resp = 13; -+ gStatColState.stat5_filter_cnt = gStatColState.stat5_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat5_filter_cnt; -+ global_object[instance_id].group_id = 5; -+ break; -+ case STATCOL_CSI2_1: -+ cur_base_address = stat_coll5_base_address; -+ cur_event_mux_req = 14; -+ cur_event_mux_resp = 15; -+ gStatColState.stat5_filter_cnt = gStatColState.stat5_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat5_filter_cnt; -+ global_object[instance_id].group_id = 5; -+ break; -+ case STATCOL_USB3_SS: -+ cur_base_address = stat_coll6_base_address; -+ cur_event_mux_req = 0; -+ cur_event_mux_resp = 1; -+ gStatColState.stat6_filter_cnt = gStatColState.stat6_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat6_filter_cnt; -+ global_object[instance_id].group_id = 6; -+ break; -+ case STATCOL_USB2_SS: -+ cur_base_address = stat_coll6_base_address; -+ cur_event_mux_req = 2; -+ cur_event_mux_resp = 3; -+ gStatColState.stat6_filter_cnt = gStatColState.stat6_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat6_filter_cnt; -+ global_object[instance_id].group_id = 6; -+ break; -+ case STATCOL_USB2_ULPI_SS1: -+ cur_base_address = stat_coll6_base_address; -+ cur_event_mux_req = 4; -+ cur_event_mux_resp = 5; -+ gStatColState.stat6_filter_cnt = gStatColState.stat6_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat6_filter_cnt; -+ global_object[instance_id].group_id = 6; -+ break; -+ case STATCOL_USB2_ULPI_SS2: -+ cur_base_address = stat_coll6_base_address; -+ cur_event_mux_req = 6; -+ cur_event_mux_resp = 7; -+ gStatColState.stat6_filter_cnt = gStatColState.stat6_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat6_filter_cnt; -+ global_object[instance_id].group_id = 6; -+ break; -+ case STATCOL_PCIE_SS1: -+ cur_base_address = stat_coll6_base_address; -+ cur_event_mux_req = 8; -+ cur_event_mux_resp = 9; -+ gStatColState.stat6_filter_cnt = gStatColState.stat6_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat6_filter_cnt; -+ global_object[instance_id].group_id = 6; -+ break; -+ case STATCOL_PCIE_SS2: -+ cur_base_address = stat_coll6_base_address; -+ cur_event_mux_req = 10; -+ cur_event_mux_resp = 11; -+ gStatColState.stat6_filter_cnt = gStatColState.stat6_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat6_filter_cnt; -+ global_object[instance_id].group_id = 6; -+ break; -+ case STATCOL_DSP1_CFG: -+ cur_base_address = stat_coll6_base_address; -+ cur_event_mux_req = 12; -+ cur_event_mux_resp = 13; -+ gStatColState.stat6_filter_cnt = gStatColState.stat6_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat6_filter_cnt; -+ global_object[instance_id].group_id = 6; -+ break; -+ case STATCOL_DSP2_CFG: -+ cur_base_address = stat_coll6_base_address; -+ cur_event_mux_req = 14; -+ cur_event_mux_resp = 15; -+ gStatColState.stat6_filter_cnt = gStatColState.stat6_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat6_filter_cnt; -+ global_object[instance_id].group_id = 6; -+ break; -+ case STATCOL_GMAC_SW: -+ cur_base_address = stat_coll7_base_address; -+ cur_event_mux_req = 0; -+ cur_event_mux_resp = 1; -+ gStatColState.stat7_filter_cnt = gStatColState.stat7_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat7_filter_cnt; -+ global_object[instance_id].group_id = 7; -+ break; -+ case STATCOL_PRUSS1_P1: -+ cur_base_address = stat_coll7_base_address; -+ cur_event_mux_req = 2; -+ cur_event_mux_resp = 3; -+ gStatColState.stat7_filter_cnt = gStatColState.stat7_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat7_filter_cnt; -+ global_object[instance_id].group_id = 7; -+ break; -+ case STATCOL_PRUSS1_P2: -+ cur_base_address = stat_coll7_base_address; -+ cur_event_mux_req = 4; -+ cur_event_mux_resp = 5; -+ gStatColState.stat7_filter_cnt = gStatColState.stat7_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat7_filter_cnt; -+ global_object[instance_id].group_id = 7; -+ break; -+ case STATCOL_PRUSS2_P1: -+ cur_base_address = stat_coll7_base_address; -+ cur_event_mux_req = 6; -+ cur_event_mux_resp = 7; -+ gStatColState.stat7_filter_cnt = gStatColState.stat7_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat7_filter_cnt; -+ global_object[instance_id].group_id = 7; -+ break; -+ case STATCOL_PRUSS2_P2: -+ cur_base_address = stat_coll7_base_address; -+ cur_event_mux_req = 8; -+ cur_event_mux_resp = 9; -+ gStatColState.stat7_filter_cnt = gStatColState.stat7_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat7_filter_cnt; -+ global_object[instance_id].group_id = 7; -+ break; -+ case STATCOL_DMA_CRYPTO_RD: -+ cur_base_address = stat_coll7_base_address; -+ cur_event_mux_req = 10; -+ cur_event_mux_resp = 11; -+ gStatColState.stat7_filter_cnt = gStatColState.stat7_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat7_filter_cnt; -+ global_object[instance_id].group_id = 7; -+ break; -+ case STATCOL_DMA_CRYPTO_WR: -+ cur_base_address = stat_coll7_base_address; -+ cur_event_mux_req = 12; -+ cur_event_mux_resp = 13; -+ gStatColState.stat7_filter_cnt = gStatColState.stat7_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat7_filter_cnt; -+ global_object[instance_id].group_id = 7; -+ break; -+ case STATCOL_MPU2: -+ cur_base_address = stat_coll7_base_address; -+ cur_event_mux_req = 14; -+ cur_event_mux_resp = 15; -+ gStatColState.stat7_filter_cnt = gStatColState.stat7_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat7_filter_cnt; -+ global_object[instance_id].group_id = 7; -+ break; -+ case STATCOL_MMC1: -+ cur_base_address = stat_coll8_base_address; -+ cur_event_mux_req = 0; -+ cur_event_mux_resp = 1; -+ gStatColState.stat8_filter_cnt = gStatColState.stat8_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat8_filter_cnt; -+ global_object[instance_id].group_id = 8; -+ break; -+ case STATCOL_MMC2: -+ cur_base_address = stat_coll8_base_address; -+ cur_event_mux_req = 2; -+ cur_event_mux_resp = 3; -+ gStatColState.stat8_filter_cnt = gStatColState.stat8_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat8_filter_cnt; -+ global_object[instance_id].group_id = 8; -+ break; -+ case STATCOL_SATA: -+ cur_base_address = stat_coll8_base_address; -+ cur_event_mux_req = 4; -+ cur_event_mux_resp = 5; -+ gStatColState.stat8_filter_cnt = gStatColState.stat8_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat8_filter_cnt; -+ global_object[instance_id].group_id = 8; -+ break; -+ case STATCOL_MLBSS: -+ cur_base_address = stat_coll8_base_address; -+ cur_event_mux_req = 6; -+ cur_event_mux_resp = 7; -+ gStatColState.stat8_filter_cnt = gStatColState.stat8_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat8_filter_cnt; -+ global_object[instance_id].group_id = 8; -+ break; -+ case STATCOL_BB2D_P2: -+ cur_base_address = stat_coll8_base_address; -+ cur_event_mux_req = 8; -+ cur_event_mux_resp = 9; -+ gStatColState.stat8_filter_cnt = gStatColState.stat8_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat8_filter_cnt; -+ global_object[instance_id].group_id = 8; -+ break; -+ case STATCOL_IEEE1500: -+ cur_base_address = stat_coll8_base_address; -+ cur_event_mux_req = 10; -+ cur_event_mux_resp = 11; -+ gStatColState.stat8_filter_cnt = gStatColState.stat8_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat8_filter_cnt; -+ global_object[instance_id].group_id = 8; -+ break; -+ case STATCOL_DBG: -+ cur_base_address = stat_coll8_base_address; -+ cur_event_mux_req = 12; -+ cur_event_mux_resp = 13; -+ gStatColState.stat8_filter_cnt = gStatColState.stat8_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat8_filter_cnt; -+ global_object[instance_id].group_id = 8; -+ break; -+ case STATCOL_VCP1: -+ cur_base_address = stat_coll8_base_address; -+ cur_event_mux_req = 14; -+ cur_event_mux_resp = 15; -+ gStatColState.stat8_filter_cnt = gStatColState.stat8_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat8_filter_cnt; -+ global_object[instance_id].group_id = 8; -+ break; -+ case STATCOL_OCMC_RAM1: -+ cur_base_address = stat_coll9_base_address; -+ cur_event_mux_req = 0; -+ cur_event_mux_resp = 1; -+ gStatColState.stat9_filter_cnt = gStatColState.stat9_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat9_filter_cnt; -+ global_object[instance_id].group_id = 9; -+ break; -+ case STATCOL_OCMC_RAM2: -+ cur_base_address = stat_coll9_base_address; -+ cur_event_mux_req = 2; -+ cur_event_mux_resp = 3; -+ gStatColState.stat9_filter_cnt = gStatColState.stat9_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat9_filter_cnt; -+ global_object[instance_id].group_id = 9; -+ break; -+ case STATCOL_OCMC_RAM3: -+ cur_base_address = stat_coll9_base_address; -+ cur_event_mux_req = 4; -+ cur_event_mux_resp = 5; -+ gStatColState.stat9_filter_cnt = gStatColState.stat9_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat9_filter_cnt; -+ global_object[instance_id].group_id = 9; -+ break; -+ case STATCOL_GPMC: -+ cur_base_address = stat_coll9_base_address; -+ cur_event_mux_req = 6; -+ cur_event_mux_resp = 7; -+ gStatColState.stat9_filter_cnt = gStatColState.stat9_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat9_filter_cnt; -+ global_object[instance_id].group_id = 9; -+ break; -+ case STATCOL_MCASP1: -+ cur_base_address = stat_coll9_base_address; -+ cur_event_mux_req = 8; -+ cur_event_mux_resp = 9; -+ gStatColState.stat9_filter_cnt = gStatColState.stat9_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat9_filter_cnt; -+ global_object[instance_id].group_id = 9; -+ break; -+ case STATCOL_MCASP2: -+ cur_base_address = stat_coll9_base_address; -+ cur_event_mux_req = 10; -+ cur_event_mux_resp = 11; -+ gStatColState.stat9_filter_cnt = gStatColState.stat9_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat9_filter_cnt; -+ global_object[instance_id].group_id = 9; -+ break; -+ case STATCOL_MCASP3: -+ cur_base_address = stat_coll9_base_address; -+ cur_event_mux_req = 12; -+ cur_event_mux_resp = 13; -+ gStatColState.stat9_filter_cnt = gStatColState.stat9_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat9_filter_cnt; -+ global_object[instance_id].group_id = 9; -+ break; -+ case STATCOL_VCP2: -+ cur_base_address = stat_coll9_base_address; -+ cur_event_mux_req = 14; -+ cur_event_mux_resp = 15; -+ gStatColState.stat9_filter_cnt = gStatColState.stat9_filter_cnt + 1; -+ cur_stat_filter_cnt = gStatColState.stat9_filter_cnt; -+ global_object[instance_id].group_id = 9; -+ break; -+ default: -+ printf("ERROR: Unknown initiator %d\n", instance_id); -+ exit(0); -+ }; -+ -+ { -+ if ( cur_stat_filter_cnt > 4 ) -+ { -+ printf("WARNING: We have exhausted filters/counters.....\n"); -+ return 0; -+ } -+ // Global Enable Stat Collector -+ wr_stat_reg(cur_base_address+0x8,0x1); -+ -+ // Soft Enable Stat Collector -+ wr_stat_reg(cur_base_address+0xC,0x1); -+ -+ wr_stat_reg(cur_base_address+0x18,0x5); -+ // Operation of Stat Collector / RespEvt => Packet -+ wr_stat_reg(cur_base_address+0x1C,0x5); -+ -+ -+ // Event Sel -+ wr_stat_reg(cur_base_address+0x20+4*(cur_stat_filter_cnt-1),cur_event_mux_req); -+ -+ // Op is EventInfo -+ wr_stat_reg(cur_base_address+0x1FC+(0x158*(cur_stat_filter_cnt-1)),2); -+ -+ // Event Info Sel Op -> packet length -+ wr_stat_reg(cur_base_address+0x1F8+(0x158*(cur_stat_filter_cnt-1)),0); -+ -+ // Filter Global Enable -+ wr_stat_reg(cur_base_address+0xAC+(0x158*(cur_stat_filter_cnt-1)),0x1); -+ -+ // Filter Enable -+ wr_stat_reg(cur_base_address+0xBC+(0x158*(cur_stat_filter_cnt-1)),0x1); -+ -+ // Manual dump -+ wr_stat_reg(cur_base_address+0x54,0x1); -+ // use send register to reset counters -+ -+ } -+ -+ global_object[instance_id].mux_req = cur_event_mux_req; -+ global_object[instance_id].base_address = cur_base_address; -+ global_object[instance_id].counter_id = cur_stat_filter_cnt; -+ global_object[instance_id].b_enabled = 1; -+ -+ return cur_stat_filter_cnt; -+} -+ -+ -+ -+void statCollectorReadGroup(UInt32 group_id) -+{ -+ int i=0; -+ UInt32 cur_base_address = 0x45001000 + ((group_id - 1) * 0x1000); -+ -+ wr_stat_reg(cur_base_address+0xC,0x0); -+ -+ for(i=0; i < STATCOL_MAX; i++) -+ { -+ if(global_object[i].group_id == (group_id - 1) && -+ global_object[i].b_enabled == 1) -+ { -+ UInt32 cur_stat_filter_cnt = global_object[i].counter_id; -+ -+ global_object[i].readings[statCountIdx] = rd_stat_reg(cur_base_address+0x8C+((cur_stat_filter_cnt-1)*4)); -+ } -+ } -+ -+ wr_stat_reg(cur_base_address+0xC,0x1); -+} -+ -+ -+volatile sig_atomic_t sigtermed = 0; -+ -+void my_signal_handler(int signum) -+{ -+ if (signum == SIGTERM || signum == SIGINT) { -+ sigtermed = 1; -+ } -+} -+ -+struct sort -+{ -+ int pos; -+ double value; -+}; -+ -+ -+void *ctx; -+struct time_graph_create_params p; -+char xpos_string[100], ypos_string[100]; -+ -+void mpu_handler(int command) -+{ -+#if 1 -+ static int fd; -+ char buf[1000]; -+ char * tabledata= "/tmp/statcollfifo"; -+ int i; -+ int bytes; -+ static int offset = 13; -+ -+ switch(command) -+ { -+ case OPEN: -+ fd = open(tabledata, O_RDONLY|O_NONBLOCK); -+ break; -+ -+ case READ: -+ -+ /* open, read, and display the message from the FIFO */ -+ bytes=read(fd, buf, 1000); -+ if(bytes > 0) -+ { -+ char str[100]; -+ char value[100]; -+ sscanf(buf, "%s %s", str, value); -+ if(strcmp(str, "MOVE:") == 0) -+ { -+ printf("Received MOVE command : %s\n", buf); -+ sprintf(p.title, "CPU Usage[@position-req=%sx%s]", value, ypos_string); -+ move_graph(ctx, &p); -+ } -+ else -+ { -+ printf("ERROR: Received unexpected data from FIFO - \" %s \" \n", buf); -+ } -+ memset(buf, 0x0, sizeof(buf)); -+ } -+ -+ break; -+ -+ case CLOSE: -+ close(fd); -+ break; -+ } -+#endif -+ return; -+} -+ -+ -+UInt32 statcoll_start(UInt32 TOTAL_TIME, UInt32 INTERVAL_US, char list[][50], UInt32 xpos, UInt32 ypos) -+{ -+ int i, fd, index; -+ UInt32 counterIdDss, counterIdIva, counterIdBB2dP1, counterIdBB2dP2, counterIdUsb4, counterIdSata, counterIdEmif1, counterIdEmif2; -+ -+ if (SIG_ERR == signal(SIGPIPE,SIG_IGN)) -+ exit(1); -+ -+ if (SIG_ERR == signal(SIGINT,my_signal_handler)) -+ exit(1); -+ -+ if (SIG_ERR == signal(SIGTERM,my_signal_handler)) -+ exit(1); -+ -+ -+ struct timeval tv1, tv2; -+ gettimeofday(&tv1, NULL); -+ printf("------------------------------------------------\n"); -+ printf("Compile time = %s %s\n",__DATE__, __TIME__); -+ printf("------------------------------------------------\n\n"); -+ //printd("Start time = %d\n", time(NULL)); -+ //printd("Time seconds = %d, usecs = %d\n", tv.tv_sec, tv.tv_usec); -+ -+ statcoll_params params; -+ memset(¶ms, sizeof(params), 0); -+ params.INTERVAL_US = INTERVAL_US; -+ params.TOTAL_TIME = TOTAL_TIME; -+ -+ i=0; -+ index=0; -+ -+ while(list[i][0] != 0) -+ { -+ for(index=0; index< STATCOL_MAX; index++) { -+ if(strcmp(list[i], initiators[index].name) == 0) -+ { -+ strcpy(params.user_config_list[params.no_of_initiators].name, list[i]); -+ params.user_config_list[params.no_of_initiators++].id = initiators[index].id; -+ break; -+ } -+ } -+ -+ if(index == STATCOL_MAX) { -+ printf("ERROR: Unknown initiator.%d.. .%s. \n", i, list[i]); -+ //exit(0); -+ } -+ i++; -+ } -+ -+ struct bar_graph_create_params bg_p; -+ struct _y_config *y_cfg; -+ struct _text_config *t_cfg; -+ double *y; -+ double *bg_y; -+ char *text_list[STATCOL_MAX]; -+ -+ struct _bar_graph_y_config *bg_y_cfg; -+ struct _text_config *bg_t_cfg; -+ char *bg_text_list[STATCOL_MAX]; -+ -+ sprintf(xpos_string, "%d", xpos); -+ sprintf(ypos_string, "%d", ypos); -+ p.title=(char *)malloc(100); -+ sprintf(p.title, "CPU Usage[@position-req=%sx%s]", xpos_string, ypos_string); -+ //p.height = MAX_HEIGHT - HEIGHT_EMIF_AREA; -+ p.height = MAX_HEIGHT;// - HEIGHT_EMIF_AREA; -+ p.width = MAX_WIDTH; -+ p.draw_area.bottom_left.x = TIME_GRAPH_AREA_BL_X; -+ p.draw_area.bottom_left.y = TIME_GRAPH_AREA_BL_Y; -+ p.draw_area.top_right.x = TIME_GRAPH_AREA_TR_X; -+ p.draw_area.top_right.y = TIME_GRAPH_AREA_TR_Y; -+ p.time_span = 120000; // 120 seconds -+ p.num_of_y_items = params.no_of_initiators+1; -+ p.num_of_text_items = 0;//params.no_of_initiators; -+ -+ -+ y_cfg = malloc((params.no_of_initiators+1) * sizeof(struct _y_config)); -+ t_cfg = malloc(params.no_of_initiators * sizeof(struct _text_config)); -+ y = malloc((params.no_of_initiators+1) * sizeof(double)); -+ p.y_config_array = y_cfg; -+ p.text_config_array = t_cfg; -+ -+ bg_y_cfg = malloc(TOTAL_Y_PARAMETERS * sizeof(struct _bar_graph_y_config)); -+ bg_t_cfg = malloc(TOTAL_Y_PARAMETERS * sizeof(struct _text_config)); -+ bg_y = malloc(TOTAL_Y_PARAMETERS * sizeof(double)); -+ -+ for(i=0; i<TOTAL_Y_PARAMETERS; i++) -+ { -+ bg_text_list[i] = malloc(100); -+ strcpy(bg_text_list[i],"test"); -+ } -+ -+ create_overall_box(bg_y_cfg, bg_t_cfg, bg_text_list); -+ -+ -+ i=0; -+ while(i < params.no_of_initiators) -+ { -+ text_list[i] = malloc(100 * sizeof(char)); -+ memset(text_list[i], 0x0, 100); -+ -+ ((struct _y_config *)y_cfg+i)->line_color.r = pallette[i%MAX_COLORS].r; -+ ((struct _y_config *)y_cfg+i)->line_color.g = pallette[i%MAX_COLORS].g; -+ ((struct _y_config *)y_cfg+i)->line_color.b = pallette[i%MAX_COLORS].b; -+ ((struct _y_config *)y_cfg+i)->line_color.a = 0.0;//pallette[i%MAX_COLORS].a; -+ -+ ((struct _y_config *)y_cfg+i)->fill_color.r = 0.0; -+ ((struct _y_config *)y_cfg+i)->fill_color.g = 1.0; -+ ((struct _y_config *)y_cfg+i)->fill_color.b = 0.0; -+ ((struct _y_config *)y_cfg+i)->fill_color.a = 0.5; -+ -+ i++; -+ } -+ -+ ((struct _y_config *)y_cfg+i)->line_color.r = 0.0; -+ ((struct _y_config *)y_cfg+i)->line_color.g = 0.0; -+ ((struct _y_config *)y_cfg+i)->line_color.b = 0.0; -+ ((struct _y_config *)y_cfg+i)->line_color.a = 0.5; -+ ((struct _y_config *)y_cfg+i)->fill_color.r = 0.1; -+ ((struct _y_config *)y_cfg+i)->fill_color.g = 0.9; -+ ((struct _y_config *)y_cfg+i)->fill_color.b = 0.5; -+ ((struct _y_config *)y_cfg+i)->fill_color.a = 1.0; -+ -+ bg_p.title = "CPU Usage"; -+ -+ bg_p.num_of_y_items = TOTAL_Y_PARAMETERS; -+ bg_p.y_config_array = bg_y_cfg; -+ bg_p.num_of_text_items = TOTAL_Y_PARAMETERS; -+ bg_p.text_config_array = bg_t_cfg; -+ -+ -+ int argc; -+ char *argv[10]; -+ ctx = time_graph_create(argc, argv, &p); -+ if (!ctx) { -+ printf("Error creating context\n"); -+ exit(0); -+ } -+ -+ printf("\n Context after time_graph_create = 0x%x\n", ctx); -+ ctx = bar_graph_create(argc, argv, &bg_p); -+ if (!ctx) { -+ printf("Error creating context\n"); -+ exit(0); -+ } -+ -+ printf("\n Context after bar_graph_create= 0x%x\n", ctx); -+ -+ printf("Total configured initiators = %d\n", params.no_of_initiators); -+ -+ -+ fd = open("/dev/mem", O_RDWR); -+ if (fd == -1){ -+ printf("error fd=open() \n"); -+ return -1; -+ } -+ statcoll_base_mem = mmap(NULL, STATCOLL_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, STATCOLL_BASE); -+ -+ if (statcoll_base_mem == MAP_FAILED){ -+ printf("ERROR: mmap failed \n"); -+ return; -+ } -+ close(fd); -+ -+ fd = open("/dev/mem", O_RDWR); -+ if (fd == -1){ -+ printf("error fd=open() \n"); -+ return -1; -+ } -+ l3_3_clkctrl = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, CM_L3INSTR_REGISTER_BASE); -+ if (l3_3_clkctrl == MAP_FAILED){ -+ printf("ERROR: mmap failed for CM_L3INSTR_REGISTER_BASE\n"); -+ return; -+ } -+ close(fd); -+ -+ printf("SUCCESS: Mapped 0x%x to user space address 0x%x\n", STATCOLL_BASE, statcoll_base_mem); -+ printf("INTERVAL = %d usecs\n", INTERVAL_US); -+ printf("TOTAL TIME = %d seconds\n", TOTAL_TIME); -+ TRACE_SZ = (TOTAL_TIME * 1000000)/INTERVAL_US; -+ printf("TRACE SIZE = %d samples\n", TRACE_SZ); -+ -+ printf("**************************************\n"); -+ printf("Going to initialize the L3 clocks \n"); -+ l3_3_clkctrl[CM_L3INSTR_L3INSTR_CLKSTCTRL_OFFSET >> 2] = 0x2; -+ l3_3_clkctrl[CM_L3INSTR_L3_MAIN_2_CLKCTRL_OFFSET >> 2] = 0x1; -+ printf("**************************************\n"); -+ -+ while( (l3_3_clkctrl[CM_L3INSTR_L3_MAIN_2_CLKCTRL_OFFSET >> 2] & 0x30000) != 0x0) -+ { -+ printf("Waiting on module to be functional\n"); -+ } -+ -+ statCollectorInit(); -+ -+ printf("SUCCESS: Initialized STAT COLLECTOR\n"); -+ /* Initialize all enabled initiators */ -+ for(index =0; index < params.no_of_initiators; index++) { -+ printf("\t\t Initialized %s\n", params.user_config_list[index].name); -+ statCollectorControlInitialize(params.user_config_list[index].id); -+ } -+ -+ const char *bg_text = "CPU Utilization"; -+ -+ int second_counter=0; -+ memset(y, 0x0, sizeof(double)* (params.no_of_initiators+1)); -+ -+ -+ -+ -+ mpu_handler(OPEN); -+ -+ -+ while(statCountIdx != (TRACE_SZ - 1)) -+ { -+ usleep(INTERVAL_US); -+ int group; -+ for(group = 1; group<11; group++) -+ statCollectorReadGroup(group); -+ -+ mpu_handler(READ); -+ -+ if(statCountIdx != 0 ) -+ for(i=0; i<params.no_of_initiators; i++) { -+ y[i] += (double)(global_object[params.user_config_list[i].id].readings[statCountIdx])/ (8000000000); -+ } -+ second_counter++; -+ -+ if(second_counter % 30 == 0) -+ { -+ -+ for(i=0; i<TOTAL_Y_PARAMETERS; i++) { -+ bg_y[i] = 1.0; -+ } -+ -+ //HACK -+ bg_y[9]=y[0]*2; -+ bg_y[11]=y[1]*2; -+ sprintf(bg_text_list[8], "%02.1f%s", y[0]*100, "%"); -+ sprintf(bg_text_list[10], "%02.1f%s", y[1]*100, "%"); -+ -+ struct sort sort_array[STATCOL_MAX]; -+ memset(sort_array, 0x0, sizeof(struct sort) * STATCOL_MAX); -+ /* Sort here */ -+ for(i=2; i<params.no_of_initiators; i++) { -+ sort_array[i-2].value = y[i]; -+ sort_array[i-2].pos = i; -+ } -+ -+ int j; -+ double tempdouble; -+ int tempint; -+ for(i=0; i<params.no_of_initiators-2; i++) { -+ for(j=i+1; j<params.no_of_initiators-2; j++) { -+ if(sort_array[i].value < sort_array[j].value) { -+ tempdouble = sort_array[j].value; -+ tempint = sort_array[j].pos; -+ -+ sort_array[j].value = sort_array[i].value; -+ sort_array[j].pos = sort_array[i].pos; -+ -+ sort_array[i].value = tempdouble; -+ sort_array[i].pos = tempint; -+ } -+ } -+ } -+ -+ for(i=0; i<6; i++) -+ { -+ //HACK -+ bg_y[14+i*2] = sort_array[i].value*2; -+ sprintf(bg_text_list[13+i*2], "%02.1f%s", sort_array[i].value*100, "%"); -+ sprintf(bg_text_list[14+i*2], "%s", (params.user_config_list[sort_array[i].pos].name)+8); -+ } -+ -+ bar_graph_plot(ctx, bg_y, (const char **)bg_text_list); -+ -+ y[params.no_of_initiators]=y[0]+y[1]; -+ time_graph_plot(ctx, y, (const char **)text_list); -+ //printf("Plotting the time_graph\n"); -+ memset(y, 0x0, sizeof(double)* (params.no_of_initiators+1)); -+ } -+ statCountIdx++; -+ -+ } -+ -+ mpu_handler(CLOSE); -+ -+ printf("------------------------------------------------\n\n"); -+ printf("SUCCESS: Stat collection completed... Writing into file now\n"); -+ FILE *outfile = fopen("statcollector.csv", "w+"); -+ if (!outfile) { -+ printf("\n ERROR: Error opening file"); -+ } -+ -+ /* Ignore the first index at 0 */ -+ for(index=1; index<statCountIdx; index++) { -+ for(i=0; i<params.no_of_initiators; i++) { -+ fprintf(outfile,"%s = %d,", params.user_config_list[i].name, global_object[params.user_config_list[i].id].readings[index]); -+ } -+ fprintf(outfile,"\n"); -+ } -+ fclose(outfile); -+ -+ time_graph_destroy(ctx); -+ gettimeofday(&tv2, NULL); -+ //printf("End time = %d\n", time(NULL)); -+ //printf("Time seconds = %d, usecs = %d\n", tv.tv_sec, tv.tv_usec); -+ printf("Total execution time = %d secs, %d usecs\n\n", (tv2.tv_sec - tv1.tv_sec), (tv2.tv_usec - tv2.tv_usec)); -+ -+ return 0; -+} -+ -+ -diff --git a/clients/statcoll.h b/clients/statcoll.h -new file mode 100644 -index 0000000..fa92753 ---- /dev/null -+++ b/clients/statcoll.h -@@ -0,0 +1,152 @@ -+#ifndef __STATCOLL_H -+#define __STATCOLL_H -+ -+ -+#define CM_L3INSTR_REGISTER_BASE (0x4A008000) -+ -+#define CM_L3INSTR_L3INSTR_CLKSTCTRL_OFFSET (0xE00) -+#define CM_L3INSTR_L3_MAIN_2_CLKCTRL_OFFSET (0xE20) -+ -+#define STATCOLL_SIZE 40960 -+#define STATCOLL_BASE (0x45001000) -+ -+#define stat_coll0_base_address (0x45001000) -+#define stat_coll1_base_address (0x45002000) -+#define stat_coll2_base_address (0x45003000) -+#define stat_coll3_base_address (0x45004000) -+#define stat_coll4_base_address (0x45005000) -+#define stat_coll5_base_address (0x45006000) -+#define stat_coll6_base_address (0x45007000) -+#define stat_coll7_base_address (0x45008000) -+#define stat_coll8_base_address (0x45009000) -+#define stat_coll9_base_address (0x4500a000) -+ -+#define printd(fmt, ...) \ -+ do { if (debug) fprintf(stderr, fmt, __VA_ARGS__); } while (0) -+ -+typedef unsigned int UInt32; -+ -+ -+typedef enum -+{ -+ STATCOL_EMIF1_SYS, -+ STATCOL_EMIF2_SYS, -+ STATCOL_MA_MPU_P1, -+ STATCOL_MA_MPU_P2, -+ STATCOL_MPU1, -+ STATCOL_MMU1, -+ STATCOL_TPTC_RD1, -+ STATCOL_TPTC_WR1, -+ STATCOL_TPTC_RD2, -+ STATCOL_TPTC_WR2, -+ STATCOL_VIP1_P1, -+ STATCOL_VIP1_P2, -+ STATCOL_VIP2_P1, -+ STATCOL_VIP2_P2, -+ STATCOL_VIP3_P1, -+ STATCOL_VIP3_P2, -+ STATCOL_VPE_P1, -+ STATCOL_VPE_P2, -+ STATCOL_EVE1_TC0, -+ STATCOL_EVE1_TC1, -+ STATCOL_EVE2_TC0, -+ STATCOL_EVE2_TC1, -+ STATCOL_EVE3_TC0, -+ STATCOL_EVE3_TC1, -+ STATCOL_EVE4_TC0, -+ STATCOL_EVE4_TC1, -+ STATCOL_DSP1_MDMA, -+ STATCOL_DSP1_EDMA, -+ STATCOL_DSP2_MDMA, -+ STATCOL_DSP2_EDMA, -+ STATCOL_IVA, -+ STATCOL_GPU_P1, -+ STATCOL_GPU_P2, -+ STATCOL_BB2D_P1, -+ STATCOL_DSS, -+ STATCOL_CSI2_2, -+ STATCOL_MMU2, -+ STATCOL_IPU1, -+ STATCOL_IPU2, -+ STATCOL_DMA_SYSTEM_RD, -+ STATCOL_DMA_SYSTEM_WR, -+ STATCOL_CSI2_1, -+ STATCOL_USB3_SS, -+ STATCOL_USB2_SS, -+ STATCOL_USB2_ULPI_SS1, -+ STATCOL_USB2_ULPI_SS2, -+ STATCOL_PCIE_SS1, -+ STATCOL_PCIE_SS2, -+ STATCOL_DSP1_CFG, -+ STATCOL_DSP2_CFG, -+ STATCOL_GMAC_SW, -+ STATCOL_PRUSS1_P1, -+ STATCOL_PRUSS1_P2, -+ STATCOL_PRUSS2_P1, -+ STATCOL_PRUSS2_P2, -+ STATCOL_DMA_CRYPTO_RD, -+ STATCOL_DMA_CRYPTO_WR, -+ STATCOL_MPU2, -+ STATCOL_MMC1, -+ STATCOL_MMC2, -+ STATCOL_SATA, -+ STATCOL_MLBSS, -+ STATCOL_BB2D_P2, -+ STATCOL_IEEE1500, -+ STATCOL_DBG, -+ STATCOL_VCP1, -+ STATCOL_OCMC_RAM1, -+ STATCOL_OCMC_RAM2, -+ STATCOL_OCMC_RAM3, -+ STATCOL_GPMC, -+ STATCOL_MCASP1, -+ STATCOL_MCASP2, -+ STATCOL_MCASP3, -+ STATCOL_VCP2, -+ STATCOL_MAX -+} STATCOL_ID; -+ -+ -+ -+typedef struct -+{ -+ UInt32 stat0_filter_cnt; -+ UInt32 stat1_filter_cnt; -+ UInt32 stat2_filter_cnt; -+ UInt32 stat3_filter_cnt; -+ UInt32 stat4_filter_cnt; -+ UInt32 stat5_filter_cnt; -+ UInt32 stat6_filter_cnt; -+ UInt32 stat7_filter_cnt; -+ UInt32 stat8_filter_cnt; -+ UInt32 stat9_filter_cnt; -+} StatCollectorObj; -+ -+struct list_of_initiators -+{ -+ STATCOL_ID id; -+ char name[50]; -+}; -+ -+typedef struct -+{ -+ UInt32 INTERVAL_US; -+ UInt32 TOTAL_TIME; -+ UInt32 no_of_initiators; -+ struct list_of_initiators user_config_list[STATCOL_MAX]; -+} statcoll_params; -+ -+typedef struct -+{ -+ UInt32 b_enabled; -+ char name[100]; -+ UInt32 *readings; -+ UInt32 *timestamp; -+ UInt32 group_id; -+ UInt32 counter_id; -+ UInt32 base_address; -+ UInt32 mux_req; -+}statcoll_initiators_object; -+ -+ -+#endif -diff --git a/clients/statcoll_gui.h b/clients/statcoll_gui.h -new file mode 100644 -index 0000000..7362bde ---- /dev/null -+++ b/clients/statcoll_gui.h -@@ -0,0 +1,101 @@ -+ -+/* -+ -+ --------------------------------------------- -+ | | -+ | --------------------------------------- | -+ | | -+ | | -+ | | -+ | | -+ | | -+ | | -+ | | -+ | | -+ | | -+ | | -+ | | -+ | | -+ | | -+ | | -+ | | -+ --------------------------------------------- -+ | | | -+ | | | -+ | | | -+ | | | -+ | | | -+ | | | -+ --------------------------------------------- -+ -+ -+ -+ -+*/ -+#define POSITION_X 2800 -+#define POSITION_Y 40 -+ -+#define MAX_WIDTH 900 -+//#define MAX_WIDTH 528 -+#define MAX_HEIGHT 900 -+ -+/* Derived parameters */ -+#define BAR_GAP (MAX_WIDTH/25) -+#define BAR_WIDTH (MAX_WIDTH/16) -+ -+#define BAR_HEIGHT ((MX_HEIGHT/40) * 6) -+ -+#define BORDER (MAX_WIDTH/15) -+ -+#define HEIGHT_EMIF_AREA (MAX_HEIGHT/4) -+ -+#define FONT_SIZE (MAX_WIDTH/40) -+ -+#define WIDTH_EMIF_AREA (MAX_WIDTH / 4) -+ -+#define TOTAL_Y_PARAMETERS (25) -+ -+#define TIME_GRAPH_AREA_BL_X (BORDER) -+#define TIME_GRAPH_AREA_BL_Y (MAX_HEIGHT - HEIGHT_EMIF_AREA - BORDER) -+#define TIME_GRAPH_AREA_TR_X (MAX_WIDTH - BORDER) -+#define TIME_GRAPH_AREA_TR_Y (BORDER) -+ -+#define EMIF_AREA_BL_X (0) -+#define EMIF_AREA_BL_Y (MAX_HEIGHT) -+#define EMIF_AREA_TR_X (WIDTH_EMIF_AREA) -+#define EMIF_AREA_TR_Y (MAX_HEIGHT - HEIGHT_EMIF_AREA) -+ -+#define INITIATORS_AREA_BL_X (WIDTH_EMIF_AREA) -+#define INITIATORS_AREA_BL_Y (MAX_HEIGHT) -+#define INITIATORS_AREA_TR_X (MAX_WIDTH) -+#define INITIATORS_AREA_TR_Y (MAX_HEIGHT - HEIGHT_EMIF_AREA) -+ -+ -+const char *string_list[TOTAL_Y_PARAMETERS] = { -+ "----DDR BANDWIDTH PLOT----", -+ "8 GBPS", -+ "6.4 ", -+ "4.8", -+ "3.2", -+ "1.6", -+ "0", -+ "EMIF Plot", -+ "test", -+ "EMIF1", -+ "test", -+ "EMIF2", -+ "TOP 6 INITIATORS", -+ "test", -+ "MPU", -+ "test", -+ "DSS", -+ "test", -+ "DSP", -+ "test", -+ "IVA", -+ "test", -+ "GPU", -+ "test", -+ "BB2D", -+}; -+ -diff --git a/clients/time_bar_graph.c b/clients/time_bar_graph.c -new file mode 100644 -index 0000000..9fa9c12 ---- /dev/null -+++ b/clients/time_bar_graph.c -@@ -0,0 +1,515 @@ -+/* -+ * Copyright © 2008 Kristian Høgsberg -+ * -+ * Permission to use, copy, modify, distribute, and sell this software and its -+ * documentation for any purpose is hereby granted without fee, provided that -+ * the above copyright notice appear in all copies and that both that copyright -+ * notice and this permission notice appear in supporting documentation, and -+ * that the name of the copyright holders not be used in advertising or -+ * publicity pertaining to distribution of the software without specific, -+ * written prior permission. The copyright holders make no representations -+ * about the suitability of this software for any purpose. It is provided "as -+ * is" without express or implied warranty. -+ * -+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR -+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE -+ * OF THIS SOFTWARE. -+ */ -+ -+#include <stdint.h> -+#include <stdio.h> -+#include <stdlib.h> -+#include <string.h> -+#include <stdint.h> -+#include <signal.h> -+#include <time.h> -+#include <math.h> -+#include <cairo.h> -+#include <sys/time.h> -+#include <pthread.h> -+#include <errno.h> -+#include <unistd.h> -+#include <sys/eventfd.h> -+#include <sys/epoll.h> -+ -+#include <linux/input.h> -+#include <wayland-client.h> -+#include "window.h" -+#include "../shared/cairo-util.h" -+#include "time_bar_graph.h" -+ -+//#define DEBUG 1 -+#ifdef DEBUG -+#define DBG(x...) printf(x) -+#else -+#define DBG(x...) // printf(x) -+#endif -+ -+#define MAX_ITEMS 180 -+#define MAX_TEXT_SIZE 128 -+ -+struct graph_dataset_point { -+ int next_index; -+ double y_values[MAX_ITEMS]; -+}; -+ -+struct graph_data { -+ int dataset_size; -+ int first_index, last_index, num_elems; -+ uint64_t last_time; -+ struct graph_dataset_point dataset[1]; -+}; -+ -+struct graph { -+ struct display *display; -+ struct window *window; -+ struct widget *widget; -+ int width, height; -+ struct time_graph_create_params params; -+ struct bar_graph_create_params bar_graph_params; -+ struct _y_config y_config_array[MAX_ITEMS]; -+ struct _text_config text_config_array[MAX_ITEMS]; -+ -+ /* Bar graph parameters */ -+ struct _bar_graph_y_config bar_graph_y_config_array[MAX_ITEMS]; -+ struct _text_config bar_graph_text_config_array[MAX_ITEMS]; -+ -+ pthread_t thr; -+ int eventfd; -+ struct task task; -+ double x_scaling_factor; -+ pthread_mutex_t mtx; -+ double time_graph_y_values[MAX_ITEMS]; -+ char text_values[MAX_ITEMS][MAX_TEXT_SIZE]; -+ -+ double bar_graph_y_values[MAX_ITEMS]; -+ char bar_graph_text_values[MAX_ITEMS][MAX_TEXT_SIZE]; -+ -+ uint64_t time_now; -+ time_t start_time_tv_sec; -+ struct graph_data *data; -+}; -+ -+struct graph *global_graph=NULL; -+static void -+draw_stuff(struct graph *g, cairo_surface_t *surface) -+{ -+ cairo_t *cr; -+ int i, j, n_elems; -+ double c_x, c_y, d_x, d_y; -+ -+ cr = cairo_create(surface); -+ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); -+ cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 0.5); -+ cairo_paint(cr); -+ cairo_select_font_face(cr, "mono", -+ CAIRO_FONT_SLANT_NORMAL, -+ CAIRO_FONT_WEIGHT_BOLD); -+ cairo_set_line_width (cr, 1.0); -+ cairo_set_operator(cr, CAIRO_OPERATOR_OVER); -+ pthread_mutex_lock(&g->mtx); -+ for (j=0; g->data->num_elems > 0 && j<g->params.num_of_y_items; j++) { -+ n_elems = g->data->num_elems; -+ DBG("first_index: %d, last_index: %d\n", g->data->first_index, g->data->last_index); -+ if (g->y_config_array[j].fill_color.a != 0.0) -+ cairo_move_to(cr, (double)g->params.draw_area.bottom_left.x, (double)g->params.draw_area.bottom_left.y); -+ c_x = (double)g->params.draw_area.bottom_left.x; -+ c_y = (double)g->params.draw_area.bottom_left.y; -+ d_x = 0; -+ i = g->data->first_index; -+ while (n_elems) { -+ DBG("index: %d, x: %f, y: %f, next_index: %d\n", i, c_x, -+ g->data->dataset[i].y_values[j], g->data->dataset[i].next_index); -+ d_y = g->data->dataset[i].y_values[j] - c_y; -+ c_y = g->data->dataset[i].y_values[j]; -+ c_x = c_x + d_x; -+ if (g->y_config_array[j].fill_color.a == 0.0 && n_elems == g->data->num_elems) { -+ cairo_move_to(cr, c_x, c_y); -+ } else { -+ cairo_curve_to(cr, c_x - (d_x * 0.75), c_y - (d_y * 0.92), c_x - (d_x * 0.25), c_y - (d_y * 0.08), c_x, c_y); -+ } -+ if (g->data->dataset[i].next_index > i) { -+ d_x = (g->data->dataset[i].next_index - i); -+ } else { -+ d_x = (g->data->dataset_size + g->data->dataset[i].next_index - i); -+ } -+ i = g->data->dataset[i].next_index; -+ n_elems--; -+ } -+ if (g->y_config_array[j].fill_color.a != 0.0) { -+ cairo_line_to(cr, c_x, (double)g->params.draw_area.bottom_left.y); -+ cairo_line_to(cr, (double)g->params.draw_area.bottom_left.x, (double)g->params.draw_area.bottom_left.y); -+ cairo_close_path(cr); -+ cairo_set_source_rgba(cr, g->y_config_array[j].fill_color.r, g->y_config_array[j].fill_color.g, -+ g->y_config_array[j].fill_color.b, g->y_config_array[j].fill_color.a); -+ cairo_fill_preserve(cr); -+ } -+ cairo_set_source_rgba(cr, g->y_config_array[j].line_color.r, g->y_config_array[j].line_color.g, -+ g->y_config_array[j].line_color.b, g->y_config_array[j].line_color.a); -+ cairo_stroke(cr); -+ } -+ -+ for (j=0; j<g->params.num_of_text_items; j++) { -+ cairo_move_to(cr, (double)g->text_config_array[j].at.x, (double)g->text_config_array[j].at.y); -+ cairo_set_font_size(cr, g->text_config_array[j].fontsize); -+ cairo_set_source_rgba(cr, g->text_config_array[j].color.r, g->text_config_array[j].color.g, -+ g->text_config_array[j].color.b, g->text_config_array[j].color.a); -+ cairo_show_text(cr, g->text_values[j]); -+ } -+ -+ -+ for (j=0; j<g->bar_graph_params.num_of_y_items; j++) { -+ cairo_move_to(cr, (double)g->bar_graph_params.y_config_array[j].region.bottom_left.x, -+ (double)g->bar_graph_params.y_config_array[j].region.bottom_left.y); -+ c_y = (double)g->bar_graph_params.y_config_array[j].region.bottom_left.y - -+ (g->bar_graph_y_values[j] * (double)(g->bar_graph_params.y_config_array[j].region.bottom_left.y - -+ g->bar_graph_params.y_config_array[j].region.top_right.y)); -+ cairo_line_to(cr, (double)g->bar_graph_params.y_config_array[j].region.bottom_left.x, c_y); -+ cairo_line_to(cr, (double)g->bar_graph_params.y_config_array[j].region.top_right.x, c_y); -+ cairo_line_to(cr, (double)g->bar_graph_params.y_config_array[j].region.top_right.x, -+ (double)g->bar_graph_params.y_config_array[j].region.bottom_left.y); -+ cairo_line_to(cr, (double)g->bar_graph_params.y_config_array[j].region.bottom_left.x, -+ (double)g->bar_graph_params.y_config_array[j].region.bottom_left.y); -+ cairo_close_path(cr); -+ cairo_set_source_rgba(cr, g->bar_graph_y_config_array[j].fill_color.r, g->bar_graph_y_config_array[j].fill_color.g, -+ g->bar_graph_y_config_array[j].fill_color.b, g->bar_graph_y_config_array[j].fill_color.a); -+ cairo_fill_preserve(cr); -+ cairo_set_source_rgba(cr, g->bar_graph_y_config_array[j].line_color.r, g->bar_graph_y_config_array[j].line_color.g, -+ g->bar_graph_y_config_array[j].line_color.b, g->bar_graph_y_config_array[j].line_color.a); -+ cairo_stroke(cr); -+ } -+ for (j=0; j<g->bar_graph_params.num_of_text_items; j++) { -+ cairo_move_to(cr, (double)g->bar_graph_text_config_array[j].at.x, (double)g->bar_graph_text_config_array[j].at.y); -+ cairo_set_font_size(cr, g->bar_graph_text_config_array[j].fontsize); -+ cairo_set_source_rgba(cr, g->bar_graph_text_config_array[j].color.r, g->bar_graph_text_config_array[j].color.g, -+ g->bar_graph_text_config_array[j].color.b, g->bar_graph_text_config_array[j].color.a); -+ cairo_save (cr); -+ //cairo_rotate(cr, 2*3.14*21/24); -+ cairo_show_text(cr, g->bar_graph_text_values[j]); -+ cairo_restore(cr); -+ } -+ pthread_mutex_unlock(&g->mtx); -+ cairo_destroy(cr); -+} -+ -+static void -+resize_handler(struct widget *widget, -+ int32_t width, int32_t height, void *data) -+{ -+ struct graph *g = data; -+ -+ /* Dont resize me */ -+ widget_set_size(g->widget, g->width, g->height); -+} -+ -+static void -+redraw_handler(struct widget *widget, void *data) -+{ -+ struct graph *g = data; -+ cairo_surface_t *surface; -+ -+ surface = window_get_surface(g->window); -+ if (surface == NULL || -+ cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) { -+ fprintf(stderr, "failed to create cairo egl surface\n"); -+ return; -+ } -+ -+ draw_stuff(g, surface); -+ cairo_surface_destroy(surface); -+} -+ -+static void -+button_handler(struct widget *widget, -+ struct input *input, uint32_t time, -+ uint32_t button, enum wl_pointer_button_state state, void *data) -+{ -+ struct graph *g = data; -+ -+ switch (button) { -+ case BTN_LEFT: -+ if (state == WL_POINTER_BUTTON_STATE_PRESSED) -+ window_move(g->window, input, -+ display_get_serial(g->display)); -+ break; -+ case BTN_MIDDLE: -+ if (state == WL_POINTER_BUTTON_STATE_PRESSED) -+ widget_schedule_redraw(widget); -+ break; -+ case BTN_RIGHT: -+ if (state == WL_POINTER_BUTTON_STATE_PRESSED) -+ window_show_frame_menu(g->window, input, time); -+ break; -+ } -+} -+ -+static void -+touch_down_handler(struct widget *widget, struct input *input, -+ uint32_t serial, uint32_t time, int32_t id, -+ float x, float y, void *data) -+{ -+ struct graph *g = data; -+ window_move(g->window, input, display_get_serial(g->display)); -+} -+ -+static void task_run(struct task *task, uint32_t events) -+{ -+ eventfd_t e; -+ struct graph *g = (struct graph *)(task->link.prev); -+ uint64_t time_diff; -+ int elems, tmp, incr, i; -+ double y; -+ -+ eventfd_read(g->eventfd, &e); -+ if(e == 1) { -+ pthread_mutex_lock(&g->mtx); -+ /* Process new data */ -+ DBG("time_now: %llu, last_time: %llu\n", g->time_now, g->data->last_time); -+ if (g->time_now > g->data->last_time) { -+ time_diff = g->time_now - g->data->last_time; -+ y = (double)time_diff * g->x_scaling_factor; -+ incr = (int)y; -+ DBG("incr: %d\n", incr); -+ -+ if (g->data->last_index >= g->data->first_index) elems = g->data->last_index - g->data->first_index + 1; -+ else elems = g->data->dataset_size - g->data->first_index + g->data->last_index + 1; -+ /* Move first index to make room for new element */ -+ while (g->data->dataset_size > 0 && (elems + incr) > g->data->dataset_size) { -+ tmp = g->data->dataset[g->data->first_index].next_index - g->data->first_index; -+ if (tmp < 0) tmp = g->data->dataset_size + tmp; -+ g->data->first_index = g->data->dataset[g->data->first_index].next_index; -+ elems -= tmp; -+ g->data->num_elems--; -+ } -+ for (i=0; i<g->params.num_of_y_items; i++) { -+ /* Scale Y */ -+ y = g->time_graph_y_values[i] * (double)(g->params.draw_area.bottom_left.y-g->params.draw_area.top_right.y); -+ y = (double)g->params.draw_area.bottom_left.y - y; -+ g->data->dataset[g->data->last_index].y_values[i] = y; -+ } -+ g->data->dataset[g->data->last_index].next_index = g->data->last_index + incr; -+ if (g->data->dataset[g->data->last_index].next_index >= g->data->dataset_size) -+ g->data->dataset[g->data->last_index].next_index -= g->data->dataset_size; -+ g->data->num_elems++; -+ g->data->last_index = g->data->dataset[g->data->last_index].next_index; -+ g->data->last_time = g->time_now; -+ } -+ pthread_mutex_unlock(&g->mtx); -+ } -+ widget_schedule_redraw(g->widget); -+ DBG("event task ran...\n"); -+} -+ -+void *time_graph_create(int argc, char *argv[], struct time_graph_create_params *cp) -+{ -+ struct graph *g; -+ struct display *d; -+ int dataset_size; -+ struct timeval tv; -+ -+ if (cp->num_of_y_items > MAX_ITEMS) return NULL; -+ if (cp->num_of_text_items > MAX_ITEMS) return NULL; -+ -+ g = (struct graph*)malloc(sizeof(struct graph)); -+ if (g == NULL) { -+ fprintf(stderr, "failed to allocate memory\n"); -+ return NULL; -+ } -+ global_graph = g; -+ g->params = *cp; -+ if (cp->num_of_y_items) -+ memcpy(&g->y_config_array[0], cp->y_config_array, -+ sizeof(struct _y_config) * cp->num_of_y_items); -+ if (cp->num_of_text_items) -+ memcpy(&g->text_config_array[0], cp->text_config_array, -+ sizeof(struct _text_config) * cp->num_of_text_items); -+ d = display_create(&argc, argv); -+ if (d == NULL) { -+ fprintf(stderr, "failed to create display: %m\n"); -+ return NULL; -+ } -+ g->display = d; -+ //g->bg_image = load_cairo_surface(cp->bg_image); -+ g->width = cp->width; //cairo_image_surface_get_width(g->bg_image); -+ g->height = cp->height; //cairo_image_surface_get_height(g->bg_image); -+ dataset_size = cp->draw_area.top_right.x - cp->draw_area.bottom_left.x; -+ g->data = (struct graph_data *)malloc(sizeof(struct graph_data) + -+ (dataset_size * sizeof(struct graph_dataset_point))); -+ if (!g->data) { -+ fprintf(stderr, "failed to allocate memory\n"); -+ display_destroy(g->display); -+ //cairo_surface_destroy(g->bg_image); -+ free(g); -+ return NULL; -+ } -+ g->data->first_index = 0; -+ g->data->last_index = 0; -+ g->data->num_elems = 0; -+ g->data->dataset_size = dataset_size; -+ g->x_scaling_factor = (double)dataset_size / (double)cp->time_span; -+ g->window = window_create(d); -+ g->widget = window_add_widget(g->window, g); -+ window_set_title(g->window, cp->title); -+ widget_set_resize_handler(g->widget, resize_handler); -+ widget_set_redraw_handler(g->widget, redraw_handler); -+ widget_set_button_handler(g->widget, button_handler); -+ widget_set_default_cursor(g->widget, CURSOR_HAND1); -+ widget_set_touch_down_handler(g->widget, touch_down_handler); -+ window_schedule_resize(g->window, g->width, g->height); -+ g->eventfd = eventfd(0, 0); -+ g->task.run = task_run; -+ g->task.link.prev = (struct wl_list*)g; -+ g->task.link.next = NULL; -+ display_watch_fd(d, g->eventfd, EPOLLIN, &g->task); -+ pthread_mutex_init(&g->mtx, NULL); -+ -+ if (0 != pthread_create(&g->thr, NULL, (void *(*)(void *))display_run, (void *)d)) { -+ fprintf(stderr, "pthread_create failed: %m\n"); -+ widget_destroy(g->widget); -+ window_destroy(g->window); -+ display_destroy(g->display); -+ //cairo_surface_destroy(g->bg_image); -+ free(g->data); -+ close(g->eventfd); -+ free(g); -+ return NULL; -+ } -+ gettimeofday(&tv, NULL); -+ g->start_time_tv_sec = tv.tv_sec; -+ g->data->last_time = 0; -+ return (void*)g; -+} -+ -+void move_graph(void *ctx, struct time_graph_create_params *cp) -+{ -+ struct graph *g = ctx; -+ window_set_title(g->window, cp->title); -+} -+ -+void time_graph_plot(void *ctx, double *y_values, const char *text_values[]) -+{ -+ struct timeval tv; -+ struct graph *g = ctx; -+ int i; -+ pthread_mutex_lock(&g->mtx); -+ gettimeofday(&tv, NULL); -+ g->time_now = ((tv.tv_sec - g->start_time_tv_sec) * 1000) + (tv.tv_usec / 1000); -+ memcpy(g->time_graph_y_values, y_values, g->params.num_of_y_items * sizeof(double)); -+ for (i=0;i<g->params.num_of_text_items; i++) { -+ strncpy(g->text_values[i], text_values[i], MAX_TEXT_SIZE); -+ g->text_values[i][MAX_TEXT_SIZE-1] = '\0'; -+ } -+ pthread_mutex_unlock(&g->mtx); -+ eventfd_write(g->eventfd, (eventfd_t)1); -+} -+ -+void time_graph_destroy(void *ctx) -+{ -+ struct graph *g = (struct graph *)ctx; -+ display_exit(g->display); -+ eventfd_write(g->eventfd, (eventfd_t)1); -+ pthread_join(g->thr, NULL); -+ widget_destroy(g->widget); -+ window_destroy(g->window); -+ display_destroy(g->display); -+ free(g->data); -+ close(g->eventfd); -+ free(g); -+ global_graph=NULL; -+} -+ -+void util_get_cpu_usage(double *cpu_usage) -+{ -+ static FILE *fp = NULL; -+ char buf[256]; -+ uint64_t tot; -+ uint64_t u, n, s, i, w, x, y, z; -+ static uint64_t last_i = 0, last_total = 0; -+ -+ -+ if (!fp) { -+ if (!(fp = fopen("/proc/stat", "r"))) -+ fprintf(stderr, "Failed /proc/stat open: %s", strerror(errno)); -+ } -+ if (fp) { -+ while (1) { -+ rewind(fp); -+ fflush(fp); -+ if (!fgets(buf, sizeof(buf), fp)) { -+ fprintf(stderr, "failed /proc/stat read\n"); -+ } else { -+ sscanf(buf, "cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu", -+ &u, -+ &n, -+ &s, -+ &i, -+ &w, -+ &x, -+ &y, -+ &z -+ ); -+ if (last_total == 0) { -+ last_total = u+n+s+i+w+x+y+z; -+ last_i = i; -+ usleep(100000); -+ } else { -+ tot = u+n+s+i+w+x+y+z; -+ *cpu_usage = (1.0 - ((double)(i-last_i)/(double)(tot-last_total))); -+ last_i = i; -+ last_total = tot; -+ break; -+ } -+ } -+ } -+ } -+} -+ -+void *bar_graph_create(int argc, char *argv[], struct bar_graph_create_params *cp) -+{ -+ struct graph *g; -+ struct display *d; -+ struct timeval tv; -+ -+ if (cp->num_of_y_items > MAX_ITEMS) return NULL; -+ if (cp->num_of_text_items > MAX_ITEMS) return NULL; -+ -+ if (global_graph == NULL) { -+ fprintf(stderr, "graph not initialized invoke time_graph_create first\n"); -+ return NULL; -+ } -+ g=global_graph; -+ g->bar_graph_params = *cp; -+ if (cp->num_of_y_items) -+ memcpy(&g->bar_graph_y_config_array[0], cp->y_config_array, -+ sizeof(struct _bar_graph_y_config) * cp->num_of_y_items); -+ if (cp->num_of_text_items) -+ memcpy(&g->bar_graph_text_config_array[0], cp->text_config_array, -+ sizeof(struct _text_config) * cp->num_of_text_items); -+ -+ return g; -+} -+ -+void bar_graph_plot(void *ctx, double *y_values, const char *text_values[]) -+{ -+ struct graph *g = ctx; -+ int i; -+ pthread_mutex_lock(&g->mtx); -+ memcpy(g->bar_graph_y_values, y_values, g->bar_graph_params.num_of_y_items * sizeof(double)); -+ for (i=0;i<g->bar_graph_params.num_of_text_items; i++) { -+ strncpy(g->bar_graph_text_values[i], text_values[i], MAX_TEXT_SIZE); -+ g->bar_graph_text_values[i][MAX_TEXT_SIZE-1] = '\0'; -+ } -+ pthread_mutex_unlock(&g->mtx); -+ //eventfd_write(g->eventfd, (eventfd_t)2); -+} -+ -+void bar_graph_destroy(void *ctx) -+{ -+ printf("Nothing to be done for this call\n"); -+ return; -+} -+ -diff --git a/clients/time_bar_graph.h b/clients/time_bar_graph.h -new file mode 100644 -index 0000000..97ac05a ---- /dev/null -+++ b/clients/time_bar_graph.h -@@ -0,0 +1,93 @@ -+ -+#ifndef _BAR_GRAPH_H_ -+#define _BAR_GRAPH_H_ -+ -+#include <stdint.h> -+ -+struct _rgba { -+ double r, g, b, a; // Values between 0 and 1 -+}; -+ -+struct _coordinate { -+ uint32_t x, y; // Co-ordinates relative to top-left of the window -+}; -+ -+struct _rect { -+ struct _coordinate bottom_left, top_right; -+}; -+ -+struct _y_config { -+ struct _rgba line_color; // Line color -+ struct _rgba fill_color; // Fill color, 0 alpha => no fill -+}; -+ -+struct _text_config { -+ struct _rgba color; // Color for drawing the text, RGBA -+ struct _coordinate at; // where to draw the text -+ int fontsize; // Font size -+}; -+ -+struct time_graph_create_params { -+ char *title; -+ //const char *bg_image; -+ uint32_t width; -+ uint32_t height; -+ struct _rect draw_area; -+ uint32_t time_span; // Amount of time the graph has to span in milliseconds -+ uint32_t num_of_y_items; -+ struct _y_config *y_config_array; -+ uint32_t num_of_text_items; -+ struct _text_config *text_config_array; -+}; -+ -+ -+struct _bar_graph_y_config { -+ struct _rect region; // Region for the bar graph -+ struct _rgba line_color; // Color for drawing the line, RGBA -+ struct _rgba fill_color; // Fill under the line with color RGBA, 0 => no fill -+}; -+ -+struct bar_graph_create_params { -+ char *title; -+ //const char *bg_image; -+ uint32_t num_of_y_items; -+ struct _bar_graph_y_config *y_config_array; -+ uint32_t num_of_text_items; -+ struct _text_config *text_config_array; -+}; -+ -+/* Creates a time graph using create parameters */ -+void *bar_graph_create(int argc, char *argv[], struct bar_graph_create_params *cp); -+ -+void move_graph(void *ctx, struct time_graph_create_params *cp); -+ -+/* Plots a new set of y-values from the values in the array y_values. -+ The number of values must be equal to "num_of_y_items" from create params -+ y_values must be normalized between 0.0 to 1.0 -+*/ -+void bar_graph_plot(void *ctx, double *y_values, const char *text_values[]); -+ -+/* Destroy the graph */ -+void bar_graph_destroy(void *ctx); -+ -+ -+/* Creates a time graph using create parameters */ -+void *time_graph_create(int argc, char *argv[], struct time_graph_create_params *cp); -+ -+/* -+ * Plots a new set of points from the values in the array y_values. -+ * The number of values in the array y_values must be equal to "num_of_y_items" -+ * from create params -+ * y_values must be normalized between 0.0 to 1.0 -+ -+ * The number of values in the array text_values must be equal to "num_of_text_items" -+ * from create params -+*/ -+void time_graph_plot(void *ctx, double *y_values, const char *text_values[]); -+ -+/* Destroy the graph */ -+void time_graph_destroy(void *ctx); -+ -+void util_get_cpu_usage(double *cpu_usage); -+ -+#endif /* _BAR_GRAPH_H_ */ --- -1.9.1 - diff --git a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0003-weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch b/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0003-weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch deleted file mode 100644 index 32901db99..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0003-weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 8034bc1862bbebb332e91917c6458ef8efb5b54e Mon Sep 17 00:00:00 2001 -From: Eric Ruei <e-ruei1@ti.com> -Date: Fri, 8 Mar 2019 18:49:07 -0500 -Subject: [PATCH] weston: Fix virtual keyboard display issue for QT5 - application - -The virtual keyboard does pop up as expected, however, it will never hide -even when the application is terminated. This problem is due to the order -of the text APIs( text_input_activate and test_input_show_input_panel) are -invoked in QT5 and a potential bug of the API implementation. The virtual -keyboard works as expected if the test_input_show_input_panel() is invoked -prior to the test_input_activate() as most of the weston sample applications -do. However, the problem will show up if that order is reversed and the reason -why is that the current_panel is not set in this case and hence this panel -cannot be hidden. - -It is required to set the current_panel to the text_input when the input_panel -becomes visible at the first time. - -Upstream status: Pending - -Signed-off-by: Eric Ruei <e-ruei1@ti.com> ---- - compositor/text-backend.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/compositor/text-backend.c b/compositor/text-backend.c -index 664c36f..b610dfb 100644 ---- a/compositor/text-backend.c -+++ b/compositor/text-backend.c -@@ -349,6 +349,7 @@ text_input_show_input_panel(struct wl_client *client, - text_input->surface); - wl_signal_emit(&ec->update_input_panel_signal, - &text_input->cursor_rectangle); -+ text_input->manager->current_text_input = text_input; - } - } - --- -1.9.1 - diff --git a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0004-weston-Fix-touch-screen-crash-issue.patch b/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0004-weston-Fix-touch-screen-crash-issue.patch deleted file mode 100644 index 4849d5b64..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0004-weston-Fix-touch-screen-crash-issue.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 60250e9dc57fe56148c8a24bba107bce8a873fb4 Mon Sep 17 00:00:00 2001 -From: Karthik Ramanan <a0393906@ti.com> -Date: Mon, 12 Mar 2018 10:56:28 +0530 -Subject: [PATCH 4/4] weston: Fix touch screen crash issue - -Touch screen operation causes the weston to crash with segment fault sometimes. -The crash occurs when the coordinate (x,y) passed to the weston input module -is outside the view window, hence the weston compositor is not able to pick -up a display view and there is no code to detect this condition at function -notify_touch(). - -Upstream status: pending - -Signed-off-by: Eric Ruei <e-ruei1@ti.com> -Signed-off-by: Karthik Ramanan <a0393906@ti.com> ---- - libweston/input.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/libweston/input.c b/libweston/input.c -index 4fedc55..bcb2f28 100644 ---- a/libweston/input.c -+++ b/libweston/input.c -@@ -2185,6 +2185,12 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id, - * until all touch points are up again. */ - if (touch->num_tp == 1) { - ev = weston_compositor_pick_view(ec, x, y, &sx, &sy); -+ if (!ev) -+ { -+ weston_log("notify_touch: weston_compositor_pick_view(%d, %d) failed to find a view!\n", -+ wl_fixed_to_int(x), wl_fixed_to_int(y)); -+ return; -+ } - weston_touch_set_focus(touch, ev); - } else if (!touch->focus) { - /* Unexpected condition: We have non-initial touch but --- -1.9.1 - diff --git a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0005-weston-drm-fix-dual-display-issue.patch b/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0005-weston-drm-fix-dual-display-issue.patch deleted file mode 100644 index 9b06b81b3..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston/0005-weston-drm-fix-dual-display-issue.patch +++ /dev/null @@ -1,79 +0,0 @@ -From db6f5ce008d9b8a4cc7db71659ce1d21d3d7f97f Mon Sep 17 00:00:00 2001 -From: Eric Ruei <e-ruei1@ti.com> -Date: Tue, 26 Mar 2019 13:32:31 -0400 -Subject: [PATCH 3/3] weston: drm: fix dual display issue - -This patch fixes the dual display issue by enhancing the primary plane -search algorithm to keep the plane which is connected to the crtc of -the output because the direct switching of active planes is not allowed. - -Upstream status: Pending - -Signed-off-by: Eric Ruei <e-ruei1@ti.com> ---- - libweston/compositor-drm.c | 17 ++++++++++++++++- - 1 file changed, 16 insertions(+), 1 deletion(-) - -diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c -index 3891176..fa694c3 100644 ---- a/libweston/compositor-drm.c -+++ b/libweston/compositor-drm.c -@@ -428,6 +428,7 @@ struct drm_plane { - - uint32_t possible_crtcs; - uint32_t plane_id; -+ uint32_t crtc_id; - uint32_t count_formats; - - struct drm_property_info props[WDRM_PLANE__COUNT]; -@@ -4073,6 +4074,7 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane, - if (kplane) { - plane->possible_crtcs = kplane->possible_crtcs; - plane->plane_id = kplane->plane_id; -+ plane->crtc_id = kplane->crtc_id; - - props = drmModeObjectGetProperties(b->drm.fd, kplane->plane_id, - DRM_MODE_OBJECT_PLANE); -@@ -4097,6 +4099,7 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane, - else { - plane->possible_crtcs = (1 << output->pipe); - plane->plane_id = 0; -+ plane->crtc_id = 0; - plane->count_formats = 1; - plane->formats[0].format = format; - plane->type = type; -@@ -4157,6 +4160,7 @@ drm_output_find_special_plane(struct drm_backend *b, struct drm_output *output, - enum wdrm_plane_type type) - { - struct drm_plane *plane; -+ struct drm_plane *plane2 = NULL; /* secondary plane */ - - if (!b->universal_planes) { - uint32_t format; -@@ -4204,11 +4208,22 @@ drm_output_find_special_plane(struct drm_backend *b, struct drm_output *output, - if (found_elsewhere) - continue; - -+ /* The output should keep the primary plane connected to its -+ * crtc since the direct switching of active plane is not -+ * allowed. */ -+ if ((type == WDRM_PLANE_TYPE_PRIMARY) && -+ (plane->crtc_id != output->crtc_id)) { -+ if (plane->crtc_id == 0) { -+ plane->possible_crtcs = (1 << output->pipe); -+ plane2 = plane; -+ } -+ continue; -+ } - plane->possible_crtcs = (1 << output->pipe); - return plane; - } - -- return NULL; -+ return plane2; - } - - /** --- -1.9.1 - diff --git a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston_8.0.0.bbappend b/meta-agl-bsp/meta-ti/recipes-arago/weston/weston_8.0.0.bbappend deleted file mode 100644 index 09f1cdc53..000000000 --- a/meta-agl-bsp/meta-ti/recipes-arago/weston/weston_8.0.0.bbappend +++ /dev/null @@ -1,13 +0,0 @@ -PACKAGECONFIG[kms] = "-Dbackend-drm=true,-Dbackend-drm=false,drm udev virtual/libgbm mtdev" - -PR:append = ".arago2" - -FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" - -# file://0005-weston-drm-fix-dual-display-issue.patch -SRC_URI += " \ - file://0003-weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch \ - file://0004-weston-Fix-touch-screen-crash-issue.patch \ -" - -INHIBIT_PACKAGE_STRIP = "1" diff --git a/meta-agl-bsp/meta-ti/recipes-bsp/ti-sgx-ddk-km/ti-sgx-ddk-km/0001-Add-support-for-AGL-toolchain.patch b/meta-agl-bsp/meta-ti/recipes-bsp/ti-sgx-ddk-km/ti-sgx-ddk-km/0001-Add-support-for-AGL-toolchain.patch deleted file mode 100644 index 93aff157a..000000000 --- a/meta-agl-bsp/meta-ti/recipes-bsp/ti-sgx-ddk-km/ti-sgx-ddk-km/0001-Add-support-for-AGL-toolchain.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 11131a5e778d19c06eefbcf61447c6efbcee0613 Mon Sep 17 00:00:00 2001 -From: Paul Barker <paul.barker@sancloud.co.uk> -Date: Mon, 18 Nov 2019 08:47:41 +0000 -Subject: [PATCH] Add support for AGL toolchain - -We can use the pre-existing config for arm-linux-gnueabihf, we just need -to make sure our toolchain is matched against this and not -arm-linux-gnueabi. - -Signed-off-by: Paul Barker <paul.barker@sancloud.co.uk> ---- - eurasia_km/eurasiacon/build/linux2/config/compiler.mk | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/eurasia_km/eurasiacon/build/linux2/config/compiler.mk b/eurasia_km/eurasiacon/build/linux2/config/compiler.mk -index 2ba3e5e..03e86c5 100644 ---- a/eurasia_km/eurasiacon/build/linux2/config/compiler.mk -+++ b/eurasia_km/eurasiacon/build/linux2/config/compiler.mk -@@ -68,7 +68,7 @@ define calculate-compiler-preferred-target - ifneq ($$(filter aarch64-%,$$($(1)_compiler_preferred_target)),) - $(1)_compiler_preferred_target := aarch64-linux-gnu - endif -- ifneq ($$(filter arm-%-gnueabihf arm-oe-linux-gnueabi,$$($(1)_compiler_preferred_target)),) -+ ifneq ($$(filter arm-%-gnueabihf arm-oe-linux-gnueabi arm-agl-linux-gnueabi,$$($(1)_compiler_preferred_target)),) - $(1)_compiler_preferred_target := arm-linux-gnueabihf - endif - ifneq ($$(filter arm-%-gnueabi armv7a-cros-linux-gnueabi armv7hl-redhat-linux-gnueabi,$$($(1)_compiler_preferred_target)),) --- -2.17.1 - diff --git a/meta-agl-bsp/meta-ti/recipes-bsp/ti-sgx-ddk-km/ti-sgx-ddk-km_%.bbappend b/meta-agl-bsp/meta-ti/recipes-bsp/ti-sgx-ddk-km/ti-sgx-ddk-km_%.bbappend deleted file mode 100644 index 62f1947e5..000000000 --- a/meta-agl-bsp/meta-ti/recipes-bsp/ti-sgx-ddk-km/ti-sgx-ddk-km_%.bbappend +++ /dev/null @@ -1,3 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" - -SRC_URI += "file://0001-Add-support-for-AGL-toolchain.patch" diff --git a/meta-agl-bsp/meta-ti/recipes-graphics/libgles/ti-sgx-ddk-um/pvr.service b/meta-agl-bsp/meta-ti/recipes-graphics/libgles/ti-sgx-ddk-um/pvr.service deleted file mode 100644 index 1acb94fd4..000000000 --- a/meta-agl-bsp/meta-ti/recipes-graphics/libgles/ti-sgx-ddk-um/pvr.service +++ /dev/null @@ -1,19 +0,0 @@ -[Unit] -Description=PVR service -SourcePath=/etc/ti-sgx/rc.pvr -DefaultDependencies=no -Before=psplash-start.service - -[Service] -Type=forking -Restart=no -TimeoutSec=5min -IgnoreSIGPIPE=no -KillMode=process -GuessMainPID=no -RemainAfterExit=yes -ExecStart=/etc/ti-sgx/rc.pvr start -ExecStop=/etc/ti-sgx/rc.pvr stop - -[Install] -WantedBy=sysinit.target diff --git a/meta-agl-bsp/meta-ti/recipes-graphics/libgles/ti-sgx-ddk-um_%.bbappend b/meta-agl-bsp/meta-ti/recipes-graphics/libgles/ti-sgx-ddk-um_%.bbappend deleted file mode 100644 index 3f497a1be..000000000 --- a/meta-agl-bsp/meta-ti/recipes-graphics/libgles/ti-sgx-ddk-um_%.bbappend +++ /dev/null @@ -1,18 +0,0 @@ -FILESEXTRAPATHS:append := ":${THISDIR}/${PN}" -FILES:${PN} += "/etc/ti-sgx/" - -SRC_URI:append = "\ - file://pvr.service \ -" - -inherit systemd - -SYSTEMD_PACKAGES = "${PN}" -SYSTEMD_SERVICE:${PN} = "pvr.service" - -do_install:append() { - install -d ${D}${systemd_system_unitdir} - install -m 0755 ${WORKDIR}/pvr.service ${D}${systemd_system_unitdir} - install -d ${D}/etc/ti-sgx - install -m 0755 ${D}/etc/init.d/rc.pvr ${D}/etc/ti-sgx -} diff --git a/meta-agl-bsp/meta-ti/recipes-graphics/mesa/mesa-gl_%.bbappend b/meta-agl-bsp/meta-ti/recipes-graphics/mesa/mesa-gl_%.bbappend deleted file mode 100644 index d12ab2be2..000000000 --- a/meta-agl-bsp/meta-ti/recipes-graphics/mesa/mesa-gl_%.bbappend +++ /dev/null @@ -1,7 +0,0 @@ -# Remove GBM support from Mesa -# TI Platforms provides own GBM library - -PACKAGES:remove = "libgbm" -PACKAGES:remove = "libgbm-dev" - -EXTRA_OECONF:remove = "--enable-gbm" diff --git a/meta-agl-bsp/virtualization-layer/recipes-extended/xen/xen-mkimage-rpi4.bb b/meta-agl-bsp/virtualization-layer/recipes-extended/xen/xen-mkimage-rpi4.bb index 43a7d639b..b857cb19f 100644 --- a/meta-agl-bsp/virtualization-layer/recipes-extended/xen/xen-mkimage-rpi4.bb +++ b/meta-agl-bsp/virtualization-layer/recipes-extended/xen/xen-mkimage-rpi4.bb @@ -1,5 +1,5 @@ DESCRIPTION = "Xen hypervisor u-boot image" -LICENSE = "GPLv2" +LICENSE = "GPL-2.0-only" SECTION = "console/tools" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" diff --git a/meta-agl-bsp/virtualization-layer/recipes-graphics/mesa/mesa/0001-virgl-virgl_driinfo.h.in-Disable-by-default-emulated.patch b/meta-agl-bsp/virtualization-layer/recipes-graphics/mesa/mesa/0001-virgl-virgl_driinfo.h.in-Disable-by-default-emulated.patch new file mode 100644 index 000000000..8bc102c92 --- /dev/null +++ b/meta-agl-bsp/virtualization-layer/recipes-graphics/mesa/mesa/0001-virgl-virgl_driinfo.h.in-Disable-by-default-emulated.patch @@ -0,0 +1,34 @@ +From 39dea63ebce2764c683c8c2eddbb10cf07a970c4 Mon Sep 17 00:00:00 2001 +From: Marius Vlad <marius.vlad@collabora.com> +Date: Mon, 19 Dec 2022 11:51:28 +0200 +Subject: [PATCH] virgl/virgl_driinfo.h.in: Disable by default emulated BGRA + and swizzling + +Workaround in place for virtio aarch64 to avoid graphical artefacts when +first time booting up on PVR host driver. + +Introduced with patch 'virgl: Always enable emulated BGRA and swizzling +unless specifically told not to' in mesa-20.3.0. + +Signed-off-by: Marius Vlad <marius.vlad@collabora.com> +--- + src/gallium/drivers/virgl/virgl_driinfo.h.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/gallium/drivers/virgl/virgl_driinfo.h.in b/src/gallium/drivers/virgl/virgl_driinfo.h.in +index f57e5880965..1c06f932c5c 100644 +--- a/src/gallium/drivers/virgl/virgl_driinfo.h.in ++++ b/src/gallium/drivers/virgl/virgl_driinfo.h.in +@@ -8,7 +8,7 @@ + // 5. Implement the tweak in virglrenderer + DRI_CONF_SECTION_MISCELLANEOUS + DRI_CONF_FORMAT_L8_SRGB_ENABLE_READBACK(false) +- DRI_CONF_GLES_EMULATE_BGRA(true) +- DRI_CONF_GLES_APPLY_BGRA_DEST_SWIZZLE(true) ++ DRI_CONF_GLES_EMULATE_BGRA(false) ++ DRI_CONF_GLES_APPLY_BGRA_DEST_SWIZZLE(false) + DRI_CONF_GLES_SAMPLES_PASSED_VALUE(1024, 1, 400000000) + DRI_CONF_SECTION_END +-- +2.35.1 + diff --git a/meta-agl-bsp/virtualization-layer/recipes-graphics/mesa/mesa_22.%.bbappend b/meta-agl-bsp/virtualization-layer/recipes-graphics/mesa/mesa_22.%.bbappend new file mode 100644 index 000000000..0a6606ebf --- /dev/null +++ b/meta-agl-bsp/virtualization-layer/recipes-graphics/mesa/mesa_22.%.bbappend @@ -0,0 +1,3 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +SRC_URI += "file://0001-virgl-virgl_driinfo.h.in-Disable-by-default-emulated.patch" diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto-dev.bbappend b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto-dev.bbappend new file mode 100644 index 000000000..5970414eb --- /dev/null +++ b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -0,0 +1,10 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/linux-yocto:" + +SRC_URI:append:virtio-all = " \ + git://gerrit.automotivelinux.org/gerrit/src/agl-yocto-kernel-meta.git;protocol=https;type=kmeta;name=agl-meta;destsuffix=agl-kernel-meta;branch=master \ + file://virtio-aarch64-${LINUX_KERNEL_TYPE}.scc \ +" + +SRCREV_agl-meta = "c5008f4ba9e1b9f11c1014b53477079e605ceab7" + +COMPATIBLE_MACHINE:virtio-aarch64 = "virtio-aarch64" diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-aarch64-standard.scc b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64-standard.scc index d675de474..2d1570e9f 100644 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-aarch64-standard.scc +++ b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-aarch64-standard.scc @@ -7,7 +7,7 @@ include ktypes/standard/standard.scc nopatch include arch/arm/aarch64.scc include cfg/8250.scc include cfg/virtio.scc -include virtio.scc +include bsp/virtio/agl-virtio.scc # enable the ability to run 32 bit apps include arch/arm/32bit-compat.scc diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-drm.cfg b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-drm.cfg new file mode 100644 index 000000000..2facc345e --- /dev/null +++ b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-drm.cfg @@ -0,0 +1,3 @@ +CONFIG_DRM=y +CONFIG_FB=y +CONFIG_DRM_FBDEV_EMULATION=y diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/arch/arm/aarch64.cfg b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/arch/arm/aarch64.cfg deleted file mode 100644 index 25381e133..000000000 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/arch/arm/aarch64.cfg +++ /dev/null @@ -1,29 +0,0 @@ -# SPDX-License-Identifier: MIT -# -# ARM64 -# -CONFIG_ARM64=y -CONFIG_64BIT=y - -# -# Bus support -# -CONFIG_ARM_AMBA=y - -# -# Non-8250 serial port support -# -CONFIG_SERIAL_AMBA_PL011=y -CONFIG_SERIAL_AMBA_PL011_CONSOLE=y - -# -# RTC -# -CONFIG_RTC_HCTOSYS=y -CONFIG_RTC_HCTOSYS_DEVICE="rtc0" - -# -# on-CPU RTC drivers -# -CONFIG_RTC_CLASS=y -CONFIG_RTC_DRV_PL031=y diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/arch/arm/aarch64.scc b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/arch/arm/aarch64.scc deleted file mode 100644 index 1de6faf9b..000000000 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/arch/arm/aarch64.scc +++ /dev/null @@ -1,2 +0,0 @@ -# SPDX-License-Identifier: MIT -kconf hardware aarch64.cfg diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-input-add-multi-touch-support.patch b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-input-add-multi-touch-support.patch deleted file mode 100644 index 59a9f9b5d..000000000 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-input-add-multi-touch-support.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 16c10bede8b3d8594279752bf53153491f3f944f Mon Sep 17 00:00:00 2001 -From: Mathias Crombez <mathias.crombez@faurecia.com> -Date: Fri, 15 Jan 2021 02:26:23 +0200 -Subject: [PATCH] virtio-input: add multi-touch support - -Without multi-touch slots allocated, ABS_MT_SLOT events will be lost by -input_handle_abs_event. - -Implementation is based on uinput_create_device. - -Signed-off-by: Mathias Crombez <mathias.crombez@faurecia.com> -Co-developed-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com> -Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com> -Link: https://lore.kernel.org/r/20210115002623.8576-1-vasyl.vavrychuk@opensynergy.com -Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> ---- - drivers/virtio/virtio_input.c | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) - -diff --git a/drivers/virtio/virtio_input.c b/drivers/virtio/virtio_input.c -index 244965c20d9b..ce51ae165943 100644 ---- a/drivers/virtio/virtio_input.c -+++ b/drivers/virtio/virtio_input.c -@@ -7,6 +7,7 @@ - - #include <uapi/linux/virtio_ids.h> - #include <uapi/linux/virtio_input.h> -+#include <linux/input/mt.h> - - struct virtio_input { - struct virtio_device *vdev; -@@ -219,7 +220,7 @@ static int virtinput_probe(struct virtio_device *vdev) - struct virtio_input *vi; - unsigned long flags; - size_t size; -- int abs, err; -+ int abs, err, nslots; - - if (!virtio_has_feature(vdev, VIRTIO_F_VERSION_1)) - return -ENODEV; -@@ -304,6 +305,13 @@ static int virtinput_probe(struct virtio_device *vdev) - continue; - virtinput_cfg_abs(vi, abs); - } -+ -+ if (test_bit(ABS_MT_SLOT, vi->idev->absbit)) { -+ nslots = input_abs_get_max(vi->idev, ABS_MT_SLOT) + 1; -+ err = input_mt_init_slots(vi->idev, nslots, 0); -+ if (err) -+ goto err_mt_init_slots; -+ } - } - - virtio_device_ready(vdev); -@@ -319,6 +327,7 @@ static int virtinput_probe(struct virtio_device *vdev) - spin_lock_irqsave(&vi->lock, flags); - vi->ready = false; - spin_unlock_irqrestore(&vi->lock, flags); -+err_mt_init_slots: - input_free_device(vi->idev); - err_input_alloc: - vdev->config->del_vqs(vdev); --- -2.31.1 - diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0001-uapi-virtio_ids-add-a-sound-device-type-ID-from-OASI.patch b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0001-uapi-virtio_ids-add-a-sound-device-type-ID-from-OASI.patch deleted file mode 100644 index e303d10c7..000000000 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0001-uapi-virtio_ids-add-a-sound-device-type-ID-from-OASI.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 6afbb3650d7e02785030f1212c88b50d7296bb45 Mon Sep 17 00:00:00 2001 -From: Anton Yakovlev <anton.yakovlev@opensynergy.com> -Date: Tue, 2 Mar 2021 17:47:01 +0100 -Subject: [PATCH] uapi: virtio_ids: add a sound device type ID from OASIS spec - -The OASIS virtio spec defines a sound device type ID that is not -present in the header yet. - -Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> -Link: https://lore.kernel.org/r/20210302164709.3142702-2-anton.yakovlev@opensynergy.com -Signed-off-by: Takashi Iwai <tiwai@suse.de> -Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com> ---- - include/uapi/linux/virtio_ids.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h -index b052355ac7a3..bc740d6d2259 100644 ---- a/include/uapi/linux/virtio_ids.h -+++ b/include/uapi/linux/virtio_ids.h -@@ -45,6 +45,7 @@ - #define VIRTIO_ID_CRYPTO 20 /* virtio crypto */ - #define VIRTIO_ID_IOMMU 23 /* virtio IOMMU */ - #define VIRTIO_ID_MEM 24 /* virtio mem */ -+#define VIRTIO_ID_SOUND 25 /* virtio sound */ - #define VIRTIO_ID_FS 26 /* virtio filesystem */ - #define VIRTIO_ID_PMEM 27 /* virtio pmem */ - #define VIRTIO_ID_MAC80211_HWSIM 29 /* virtio mac80211-hwsim */ diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0002-ALSA-virtio-add-virtio-sound-driver.patch b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0002-ALSA-virtio-add-virtio-sound-driver.patch deleted file mode 100644 index e2f80442f..000000000 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0002-ALSA-virtio-add-virtio-sound-driver.patch +++ /dev/null @@ -1,849 +0,0 @@ -From a1cde5ccba57562aa77739b63b50586e6b197b52 Mon Sep 17 00:00:00 2001 -From: Anton Yakovlev <anton.yakovlev@opensynergy.com> -Date: Tue, 2 Mar 2021 17:47:02 +0100 -Subject: [PATCH] ALSA: virtio: add virtio sound driver - -Introduce skeleton of the virtio sound driver. The driver implements -the virtio sound device specification, which has become part of the -virtio standard. - -Initial initialization of the device, virtqueues and creation of an -empty ALSA sound device. - -Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> -Link: https://lore.kernel.org/r/20210302164709.3142702-3-anton.yakovlev@opensynergy.com -Signed-off-by: Takashi Iwai <tiwai@suse.de> -Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com> ---- - MAINTAINERS | 9 + - include/uapi/linux/virtio_snd.h | 334 ++++++++++++++++++++++++++++++++ - sound/Kconfig | 2 + - sound/Makefile | 3 +- - sound/virtio/Kconfig | 10 + - sound/virtio/Makefile | 7 + - sound/virtio/virtio_card.c | 324 +++++++++++++++++++++++++++++++ - sound/virtio/virtio_card.h | 65 +++++++ - 8 files changed, 753 insertions(+), 1 deletion(-) - create mode 100644 include/uapi/linux/virtio_snd.h - create mode 100644 sound/virtio/Kconfig - create mode 100644 sound/virtio/Makefile - create mode 100644 sound/virtio/virtio_card.c - create mode 100644 sound/virtio/virtio_card.h - -diff --git a/MAINTAINERS b/MAINTAINERS -index 407ae5c24566..49772b741967 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -18670,6 +18670,15 @@ W: https://virtio-mem.gitlab.io/ - F: drivers/virtio/virtio_mem.c - F: include/uapi/linux/virtio_mem.h - -+VIRTIO SOUND DRIVER -+M: Anton Yakovlev <anton.yakovlev@opensynergy.com> -+M: "Michael S. Tsirkin" <mst@redhat.com> -+L: virtualization@lists.linux-foundation.org -+L: alsa-devel@alsa-project.org (moderated for non-subscribers) -+S: Maintained -+F: include/uapi/linux/virtio_snd.h -+F: sound/virtio/* -+ - VIRTUAL BOX GUEST DEVICE DRIVER - M: Hans de Goede <hdegoede@redhat.com> - M: Arnd Bergmann <arnd@arndb.de> -diff --git a/include/uapi/linux/virtio_snd.h b/include/uapi/linux/virtio_snd.h -new file mode 100644 -index 000000000000..dfe49547a7b0 ---- /dev/null -+++ b/include/uapi/linux/virtio_snd.h -@@ -0,0 +1,334 @@ -+/* SPDX-License-Identifier: BSD-3-Clause */ -+/* -+ * Copyright (C) 2021 OpenSynergy GmbH -+ */ -+#ifndef VIRTIO_SND_IF_H -+#define VIRTIO_SND_IF_H -+ -+#include <linux/virtio_types.h> -+ -+/******************************************************************************* -+ * CONFIGURATION SPACE -+ */ -+struct virtio_snd_config { -+ /* # of available physical jacks */ -+ __le32 jacks; -+ /* # of available PCM streams */ -+ __le32 streams; -+ /* # of available channel maps */ -+ __le32 chmaps; -+}; -+ -+enum { -+ /* device virtqueue indexes */ -+ VIRTIO_SND_VQ_CONTROL = 0, -+ VIRTIO_SND_VQ_EVENT, -+ VIRTIO_SND_VQ_TX, -+ VIRTIO_SND_VQ_RX, -+ /* # of device virtqueues */ -+ VIRTIO_SND_VQ_MAX -+}; -+ -+/******************************************************************************* -+ * COMMON DEFINITIONS -+ */ -+ -+/* supported dataflow directions */ -+enum { -+ VIRTIO_SND_D_OUTPUT = 0, -+ VIRTIO_SND_D_INPUT -+}; -+ -+enum { -+ /* jack control request types */ -+ VIRTIO_SND_R_JACK_INFO = 1, -+ VIRTIO_SND_R_JACK_REMAP, -+ -+ /* PCM control request types */ -+ VIRTIO_SND_R_PCM_INFO = 0x0100, -+ VIRTIO_SND_R_PCM_SET_PARAMS, -+ VIRTIO_SND_R_PCM_PREPARE, -+ VIRTIO_SND_R_PCM_RELEASE, -+ VIRTIO_SND_R_PCM_START, -+ VIRTIO_SND_R_PCM_STOP, -+ -+ /* channel map control request types */ -+ VIRTIO_SND_R_CHMAP_INFO = 0x0200, -+ -+ /* jack event types */ -+ VIRTIO_SND_EVT_JACK_CONNECTED = 0x1000, -+ VIRTIO_SND_EVT_JACK_DISCONNECTED, -+ -+ /* PCM event types */ -+ VIRTIO_SND_EVT_PCM_PERIOD_ELAPSED = 0x1100, -+ VIRTIO_SND_EVT_PCM_XRUN, -+ -+ /* common status codes */ -+ VIRTIO_SND_S_OK = 0x8000, -+ VIRTIO_SND_S_BAD_MSG, -+ VIRTIO_SND_S_NOT_SUPP, -+ VIRTIO_SND_S_IO_ERR -+}; -+ -+/* common header */ -+struct virtio_snd_hdr { -+ __le32 code; -+}; -+ -+/* event notification */ -+struct virtio_snd_event { -+ /* VIRTIO_SND_EVT_XXX */ -+ struct virtio_snd_hdr hdr; -+ /* optional event data */ -+ __le32 data; -+}; -+ -+/* common control request to query an item information */ -+struct virtio_snd_query_info { -+ /* VIRTIO_SND_R_XXX_INFO */ -+ struct virtio_snd_hdr hdr; -+ /* item start identifier */ -+ __le32 start_id; -+ /* item count to query */ -+ __le32 count; -+ /* item information size in bytes */ -+ __le32 size; -+}; -+ -+/* common item information header */ -+struct virtio_snd_info { -+ /* function group node id (High Definition Audio Specification 7.1.2) */ -+ __le32 hda_fn_nid; -+}; -+ -+/******************************************************************************* -+ * JACK CONTROL MESSAGES -+ */ -+struct virtio_snd_jack_hdr { -+ /* VIRTIO_SND_R_JACK_XXX */ -+ struct virtio_snd_hdr hdr; -+ /* 0 ... virtio_snd_config::jacks - 1 */ -+ __le32 jack_id; -+}; -+ -+/* supported jack features */ -+enum { -+ VIRTIO_SND_JACK_F_REMAP = 0 -+}; -+ -+struct virtio_snd_jack_info { -+ /* common header */ -+ struct virtio_snd_info hdr; -+ /* supported feature bit map (1 << VIRTIO_SND_JACK_F_XXX) */ -+ __le32 features; -+ /* pin configuration (High Definition Audio Specification 7.3.3.31) */ -+ __le32 hda_reg_defconf; -+ /* pin capabilities (High Definition Audio Specification 7.3.4.9) */ -+ __le32 hda_reg_caps; -+ /* current jack connection status (0: disconnected, 1: connected) */ -+ __u8 connected; -+ -+ __u8 padding[7]; -+}; -+ -+/* jack remapping control request */ -+struct virtio_snd_jack_remap { -+ /* .code = VIRTIO_SND_R_JACK_REMAP */ -+ struct virtio_snd_jack_hdr hdr; -+ /* selected association number */ -+ __le32 association; -+ /* selected sequence number */ -+ __le32 sequence; -+}; -+ -+/******************************************************************************* -+ * PCM CONTROL MESSAGES -+ */ -+struct virtio_snd_pcm_hdr { -+ /* VIRTIO_SND_R_PCM_XXX */ -+ struct virtio_snd_hdr hdr; -+ /* 0 ... virtio_snd_config::streams - 1 */ -+ __le32 stream_id; -+}; -+ -+/* supported PCM stream features */ -+enum { -+ VIRTIO_SND_PCM_F_SHMEM_HOST = 0, -+ VIRTIO_SND_PCM_F_SHMEM_GUEST, -+ VIRTIO_SND_PCM_F_MSG_POLLING, -+ VIRTIO_SND_PCM_F_EVT_SHMEM_PERIODS, -+ VIRTIO_SND_PCM_F_EVT_XRUNS -+}; -+ -+/* supported PCM sample formats */ -+enum { -+ /* analog formats (width / physical width) */ -+ VIRTIO_SND_PCM_FMT_IMA_ADPCM = 0, /* 4 / 4 bits */ -+ VIRTIO_SND_PCM_FMT_MU_LAW, /* 8 / 8 bits */ -+ VIRTIO_SND_PCM_FMT_A_LAW, /* 8 / 8 bits */ -+ VIRTIO_SND_PCM_FMT_S8, /* 8 / 8 bits */ -+ VIRTIO_SND_PCM_FMT_U8, /* 8 / 8 bits */ -+ VIRTIO_SND_PCM_FMT_S16, /* 16 / 16 bits */ -+ VIRTIO_SND_PCM_FMT_U16, /* 16 / 16 bits */ -+ VIRTIO_SND_PCM_FMT_S18_3, /* 18 / 24 bits */ -+ VIRTIO_SND_PCM_FMT_U18_3, /* 18 / 24 bits */ -+ VIRTIO_SND_PCM_FMT_S20_3, /* 20 / 24 bits */ -+ VIRTIO_SND_PCM_FMT_U20_3, /* 20 / 24 bits */ -+ VIRTIO_SND_PCM_FMT_S24_3, /* 24 / 24 bits */ -+ VIRTIO_SND_PCM_FMT_U24_3, /* 24 / 24 bits */ -+ VIRTIO_SND_PCM_FMT_S20, /* 20 / 32 bits */ -+ VIRTIO_SND_PCM_FMT_U20, /* 20 / 32 bits */ -+ VIRTIO_SND_PCM_FMT_S24, /* 24 / 32 bits */ -+ VIRTIO_SND_PCM_FMT_U24, /* 24 / 32 bits */ -+ VIRTIO_SND_PCM_FMT_S32, /* 32 / 32 bits */ -+ VIRTIO_SND_PCM_FMT_U32, /* 32 / 32 bits */ -+ VIRTIO_SND_PCM_FMT_FLOAT, /* 32 / 32 bits */ -+ VIRTIO_SND_PCM_FMT_FLOAT64, /* 64 / 64 bits */ -+ /* digital formats (width / physical width) */ -+ VIRTIO_SND_PCM_FMT_DSD_U8, /* 8 / 8 bits */ -+ VIRTIO_SND_PCM_FMT_DSD_U16, /* 16 / 16 bits */ -+ VIRTIO_SND_PCM_FMT_DSD_U32, /* 32 / 32 bits */ -+ VIRTIO_SND_PCM_FMT_IEC958_SUBFRAME /* 32 / 32 bits */ -+}; -+ -+/* supported PCM frame rates */ -+enum { -+ VIRTIO_SND_PCM_RATE_5512 = 0, -+ VIRTIO_SND_PCM_RATE_8000, -+ VIRTIO_SND_PCM_RATE_11025, -+ VIRTIO_SND_PCM_RATE_16000, -+ VIRTIO_SND_PCM_RATE_22050, -+ VIRTIO_SND_PCM_RATE_32000, -+ VIRTIO_SND_PCM_RATE_44100, -+ VIRTIO_SND_PCM_RATE_48000, -+ VIRTIO_SND_PCM_RATE_64000, -+ VIRTIO_SND_PCM_RATE_88200, -+ VIRTIO_SND_PCM_RATE_96000, -+ VIRTIO_SND_PCM_RATE_176400, -+ VIRTIO_SND_PCM_RATE_192000, -+ VIRTIO_SND_PCM_RATE_384000 -+}; -+ -+struct virtio_snd_pcm_info { -+ /* common header */ -+ struct virtio_snd_info hdr; -+ /* supported feature bit map (1 << VIRTIO_SND_PCM_F_XXX) */ -+ __le32 features; -+ /* supported sample format bit map (1 << VIRTIO_SND_PCM_FMT_XXX) */ -+ __le64 formats; -+ /* supported frame rate bit map (1 << VIRTIO_SND_PCM_RATE_XXX) */ -+ __le64 rates; -+ /* dataflow direction (VIRTIO_SND_D_XXX) */ -+ __u8 direction; -+ /* minimum # of supported channels */ -+ __u8 channels_min; -+ /* maximum # of supported channels */ -+ __u8 channels_max; -+ -+ __u8 padding[5]; -+}; -+ -+/* set PCM stream format */ -+struct virtio_snd_pcm_set_params { -+ /* .code = VIRTIO_SND_R_PCM_SET_PARAMS */ -+ struct virtio_snd_pcm_hdr hdr; -+ /* size of the hardware buffer */ -+ __le32 buffer_bytes; -+ /* size of the hardware period */ -+ __le32 period_bytes; -+ /* selected feature bit map (1 << VIRTIO_SND_PCM_F_XXX) */ -+ __le32 features; -+ /* selected # of channels */ -+ __u8 channels; -+ /* selected sample format (VIRTIO_SND_PCM_FMT_XXX) */ -+ __u8 format; -+ /* selected frame rate (VIRTIO_SND_PCM_RATE_XXX) */ -+ __u8 rate; -+ -+ __u8 padding; -+}; -+ -+/******************************************************************************* -+ * PCM I/O MESSAGES -+ */ -+ -+/* I/O request header */ -+struct virtio_snd_pcm_xfer { -+ /* 0 ... virtio_snd_config::streams - 1 */ -+ __le32 stream_id; -+}; -+ -+/* I/O request status */ -+struct virtio_snd_pcm_status { -+ /* VIRTIO_SND_S_XXX */ -+ __le32 status; -+ /* current device latency */ -+ __le32 latency_bytes; -+}; -+ -+/******************************************************************************* -+ * CHANNEL MAP CONTROL MESSAGES -+ */ -+struct virtio_snd_chmap_hdr { -+ /* VIRTIO_SND_R_CHMAP_XXX */ -+ struct virtio_snd_hdr hdr; -+ /* 0 ... virtio_snd_config::chmaps - 1 */ -+ __le32 chmap_id; -+}; -+ -+/* standard channel position definition */ -+enum { -+ VIRTIO_SND_CHMAP_NONE = 0, /* undefined */ -+ VIRTIO_SND_CHMAP_NA, /* silent */ -+ VIRTIO_SND_CHMAP_MONO, /* mono stream */ -+ VIRTIO_SND_CHMAP_FL, /* front left */ -+ VIRTIO_SND_CHMAP_FR, /* front right */ -+ VIRTIO_SND_CHMAP_RL, /* rear left */ -+ VIRTIO_SND_CHMAP_RR, /* rear right */ -+ VIRTIO_SND_CHMAP_FC, /* front center */ -+ VIRTIO_SND_CHMAP_LFE, /* low frequency (LFE) */ -+ VIRTIO_SND_CHMAP_SL, /* side left */ -+ VIRTIO_SND_CHMAP_SR, /* side right */ -+ VIRTIO_SND_CHMAP_RC, /* rear center */ -+ VIRTIO_SND_CHMAP_FLC, /* front left center */ -+ VIRTIO_SND_CHMAP_FRC, /* front right center */ -+ VIRTIO_SND_CHMAP_RLC, /* rear left center */ -+ VIRTIO_SND_CHMAP_RRC, /* rear right center */ -+ VIRTIO_SND_CHMAP_FLW, /* front left wide */ -+ VIRTIO_SND_CHMAP_FRW, /* front right wide */ -+ VIRTIO_SND_CHMAP_FLH, /* front left high */ -+ VIRTIO_SND_CHMAP_FCH, /* front center high */ -+ VIRTIO_SND_CHMAP_FRH, /* front right high */ -+ VIRTIO_SND_CHMAP_TC, /* top center */ -+ VIRTIO_SND_CHMAP_TFL, /* top front left */ -+ VIRTIO_SND_CHMAP_TFR, /* top front right */ -+ VIRTIO_SND_CHMAP_TFC, /* top front center */ -+ VIRTIO_SND_CHMAP_TRL, /* top rear left */ -+ VIRTIO_SND_CHMAP_TRR, /* top rear right */ -+ VIRTIO_SND_CHMAP_TRC, /* top rear center */ -+ VIRTIO_SND_CHMAP_TFLC, /* top front left center */ -+ VIRTIO_SND_CHMAP_TFRC, /* top front right center */ -+ VIRTIO_SND_CHMAP_TSL, /* top side left */ -+ VIRTIO_SND_CHMAP_TSR, /* top side right */ -+ VIRTIO_SND_CHMAP_LLFE, /* left LFE */ -+ VIRTIO_SND_CHMAP_RLFE, /* right LFE */ -+ VIRTIO_SND_CHMAP_BC, /* bottom center */ -+ VIRTIO_SND_CHMAP_BLC, /* bottom left center */ -+ VIRTIO_SND_CHMAP_BRC /* bottom right center */ -+}; -+ -+/* maximum possible number of channels */ -+#define VIRTIO_SND_CHMAP_MAX_SIZE 18 -+ -+struct virtio_snd_chmap_info { -+ /* common header */ -+ struct virtio_snd_info hdr; -+ /* dataflow direction (VIRTIO_SND_D_XXX) */ -+ __u8 direction; -+ /* # of valid channel position values */ -+ __u8 channels; -+ /* channel position values (VIRTIO_SND_CHMAP_XXX) */ -+ __u8 positions[VIRTIO_SND_CHMAP_MAX_SIZE]; -+}; -+ -+#endif /* VIRTIO_SND_IF_H */ -diff --git a/sound/Kconfig b/sound/Kconfig -index 36785410fbe1..e56d96d2b11c 100644 ---- a/sound/Kconfig -+++ b/sound/Kconfig -@@ -99,6 +99,8 @@ source "sound/synth/Kconfig" - - source "sound/xen/Kconfig" - -+source "sound/virtio/Kconfig" -+ - endif # SND - - endif # !UML -diff --git a/sound/Makefile b/sound/Makefile -index 797ecdcd35e2..04ef04b1168f 100644 ---- a/sound/Makefile -+++ b/sound/Makefile -@@ -5,7 +5,8 @@ - obj-$(CONFIG_SOUND) += soundcore.o - obj-$(CONFIG_DMASOUND) += oss/dmasound/ - obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ \ -- firewire/ sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ hda/ x86/ xen/ -+ firewire/ sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ hda/ x86/ xen/ \ -+ virtio/ - obj-$(CONFIG_SND_AOA) += aoa/ - - # This one must be compilable even if sound is configured out -diff --git a/sound/virtio/Kconfig b/sound/virtio/Kconfig -new file mode 100644 -index 000000000000..094cba24ee5b ---- /dev/null -+++ b/sound/virtio/Kconfig -@@ -0,0 +1,10 @@ -+# SPDX-License-Identifier: GPL-2.0+ -+# Sound card driver for virtio -+ -+config SND_VIRTIO -+ tristate "Virtio sound driver" -+ depends on VIRTIO -+ select SND_PCM -+ select SND_JACK -+ help -+ This is the virtual sound driver for virtio. Say Y or M. -diff --git a/sound/virtio/Makefile b/sound/virtio/Makefile -new file mode 100644 -index 000000000000..8c87ebb9982b ---- /dev/null -+++ b/sound/virtio/Makefile -@@ -0,0 +1,7 @@ -+# SPDX-License-Identifier: GPL-2.0+ -+ -+obj-$(CONFIG_SND_VIRTIO) += virtio_snd.o -+ -+virtio_snd-objs := \ -+ virtio_card.o -+ -diff --git a/sound/virtio/virtio_card.c b/sound/virtio/virtio_card.c -new file mode 100644 -index 000000000000..5a37056858e9 ---- /dev/null -+++ b/sound/virtio/virtio_card.c -@@ -0,0 +1,324 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * virtio-snd: Virtio sound device -+ * Copyright (C) 2021 OpenSynergy GmbH -+ */ -+#include <linux/module.h> -+#include <linux/moduleparam.h> -+#include <linux/virtio_config.h> -+#include <sound/initval.h> -+#include <uapi/linux/virtio_ids.h> -+ -+#include "virtio_card.h" -+ -+static void virtsnd_remove(struct virtio_device *vdev); -+ -+/** -+ * virtsnd_event_send() - Add an event to the event queue. -+ * @vqueue: Underlying event virtqueue. -+ * @event: Event. -+ * @notify: Indicates whether or not to send a notification to the device. -+ * @gfp: Kernel flags for memory allocation. -+ * -+ * Context: Any context. -+ */ -+static void virtsnd_event_send(struct virtqueue *vqueue, -+ struct virtio_snd_event *event, bool notify, -+ gfp_t gfp) -+{ -+ struct scatterlist sg; -+ struct scatterlist *psgs[1] = { &sg }; -+ -+ /* reset event content */ -+ memset(event, 0, sizeof(*event)); -+ -+ sg_init_one(&sg, event, sizeof(*event)); -+ -+ if (virtqueue_add_sgs(vqueue, psgs, 0, 1, event, gfp) || !notify) -+ return; -+ -+ if (virtqueue_kick_prepare(vqueue)) -+ virtqueue_notify(vqueue); -+} -+ -+/** -+ * virtsnd_event_dispatch() - Dispatch an event from the device side. -+ * @snd: VirtIO sound device. -+ * @event: VirtIO sound event. -+ * -+ * Context: Any context. -+ */ -+static void virtsnd_event_dispatch(struct virtio_snd *snd, -+ struct virtio_snd_event *event) -+{ -+} -+ -+/** -+ * virtsnd_event_notify_cb() - Dispatch all reported events from the event queue. -+ * @vqueue: Underlying event virtqueue. -+ * -+ * This callback function is called upon a vring interrupt request from the -+ * device. -+ * -+ * Context: Interrupt context. -+ */ -+static void virtsnd_event_notify_cb(struct virtqueue *vqueue) -+{ -+ struct virtio_snd *snd = vqueue->vdev->priv; -+ struct virtio_snd_queue *queue = virtsnd_event_queue(snd); -+ struct virtio_snd_event *event; -+ u32 length; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&queue->lock, flags); -+ do { -+ virtqueue_disable_cb(vqueue); -+ while ((event = virtqueue_get_buf(vqueue, &length))) { -+ virtsnd_event_dispatch(snd, event); -+ virtsnd_event_send(vqueue, event, true, GFP_ATOMIC); -+ } -+ if (unlikely(virtqueue_is_broken(vqueue))) -+ break; -+ } while (!virtqueue_enable_cb(vqueue)); -+ spin_unlock_irqrestore(&queue->lock, flags); -+} -+ -+/** -+ * virtsnd_find_vqs() - Enumerate and initialize all virtqueues. -+ * @snd: VirtIO sound device. -+ * -+ * After calling this function, the event queue is disabled. -+ * -+ * Context: Any context. -+ * Return: 0 on success, -errno on failure. -+ */ -+static int virtsnd_find_vqs(struct virtio_snd *snd) -+{ -+ struct virtio_device *vdev = snd->vdev; -+ static vq_callback_t *callbacks[VIRTIO_SND_VQ_MAX] = { -+ [VIRTIO_SND_VQ_EVENT] = virtsnd_event_notify_cb -+ }; -+ static const char *names[VIRTIO_SND_VQ_MAX] = { -+ [VIRTIO_SND_VQ_EVENT] = "virtsnd-event" -+ }; -+ struct virtqueue *vqs[VIRTIO_SND_VQ_MAX] = { 0 }; -+ unsigned int i; -+ unsigned int n; -+ int rc; -+ -+ rc = virtio_find_vqs(vdev, VIRTIO_SND_VQ_MAX, vqs, callbacks, names, -+ NULL); -+ if (rc) { -+ dev_err(&vdev->dev, "failed to initialize virtqueues\n"); -+ return rc; -+ } -+ -+ for (i = 0; i < VIRTIO_SND_VQ_MAX; ++i) -+ snd->queues[i].vqueue = vqs[i]; -+ -+ /* Allocate events and populate the event queue */ -+ virtqueue_disable_cb(vqs[VIRTIO_SND_VQ_EVENT]); -+ -+ n = virtqueue_get_vring_size(vqs[VIRTIO_SND_VQ_EVENT]); -+ -+ snd->event_msgs = kmalloc_array(n, sizeof(*snd->event_msgs), -+ GFP_KERNEL); -+ if (!snd->event_msgs) -+ return -ENOMEM; -+ -+ for (i = 0; i < n; ++i) -+ virtsnd_event_send(vqs[VIRTIO_SND_VQ_EVENT], -+ &snd->event_msgs[i], false, GFP_KERNEL); -+ -+ return 0; -+} -+ -+/** -+ * virtsnd_enable_event_vq() - Enable the event virtqueue. -+ * @snd: VirtIO sound device. -+ * -+ * Context: Any context. -+ */ -+static void virtsnd_enable_event_vq(struct virtio_snd *snd) -+{ -+ struct virtio_snd_queue *queue = virtsnd_event_queue(snd); -+ -+ if (!virtqueue_enable_cb(queue->vqueue)) -+ virtsnd_event_notify_cb(queue->vqueue); -+} -+ -+/** -+ * virtsnd_disable_event_vq() - Disable the event virtqueue. -+ * @snd: VirtIO sound device. -+ * -+ * Context: Any context. -+ */ -+static void virtsnd_disable_event_vq(struct virtio_snd *snd) -+{ -+ struct virtio_snd_queue *queue = virtsnd_event_queue(snd); -+ struct virtio_snd_event *event; -+ u32 length; -+ unsigned long flags; -+ -+ if (queue->vqueue) { -+ spin_lock_irqsave(&queue->lock, flags); -+ virtqueue_disable_cb(queue->vqueue); -+ while ((event = virtqueue_get_buf(queue->vqueue, &length))) -+ virtsnd_event_dispatch(snd, event); -+ spin_unlock_irqrestore(&queue->lock, flags); -+ } -+} -+ -+/** -+ * virtsnd_build_devs() - Read configuration and build ALSA devices. -+ * @snd: VirtIO sound device. -+ * -+ * Context: Any context that permits to sleep. -+ * Return: 0 on success, -errno on failure. -+ */ -+static int virtsnd_build_devs(struct virtio_snd *snd) -+{ -+ struct virtio_device *vdev = snd->vdev; -+ struct device *dev = &vdev->dev; -+ int rc; -+ -+ rc = snd_card_new(dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, -+ THIS_MODULE, 0, &snd->card); -+ if (rc < 0) -+ return rc; -+ -+ snd->card->private_data = snd; -+ -+ strscpy(snd->card->driver, VIRTIO_SND_CARD_DRIVER, -+ sizeof(snd->card->driver)); -+ strscpy(snd->card->shortname, VIRTIO_SND_CARD_NAME, -+ sizeof(snd->card->shortname)); -+ if (dev->parent->bus) -+ snprintf(snd->card->longname, sizeof(snd->card->longname), -+ VIRTIO_SND_CARD_NAME " at %s/%s/%s", -+ dev->parent->bus->name, dev_name(dev->parent), -+ dev_name(dev)); -+ else -+ snprintf(snd->card->longname, sizeof(snd->card->longname), -+ VIRTIO_SND_CARD_NAME " at %s/%s", -+ dev_name(dev->parent), dev_name(dev)); -+ -+ return snd_card_register(snd->card); -+} -+ -+/** -+ * virtsnd_validate() - Validate if the device can be started. -+ * @vdev: VirtIO parent device. -+ * -+ * Context: Any context. -+ * Return: 0 on success, -EINVAL on failure. -+ */ -+static int virtsnd_validate(struct virtio_device *vdev) -+{ -+ if (!vdev->config->get) { -+ dev_err(&vdev->dev, "configuration access disabled\n"); -+ return -EINVAL; -+ } -+ -+ if (!virtio_has_feature(vdev, VIRTIO_F_VERSION_1)) { -+ dev_err(&vdev->dev, -+ "device does not comply with spec version 1.x\n"); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+/** -+ * virtsnd_probe() - Create and initialize the device. -+ * @vdev: VirtIO parent device. -+ * -+ * Context: Any context that permits to sleep. -+ * Return: 0 on success, -errno on failure. -+ */ -+static int virtsnd_probe(struct virtio_device *vdev) -+{ -+ struct virtio_snd *snd; -+ unsigned int i; -+ int rc; -+ -+ snd = devm_kzalloc(&vdev->dev, sizeof(*snd), GFP_KERNEL); -+ if (!snd) -+ return -ENOMEM; -+ -+ snd->vdev = vdev; -+ -+ vdev->priv = snd; -+ -+ for (i = 0; i < VIRTIO_SND_VQ_MAX; ++i) -+ spin_lock_init(&snd->queues[i].lock); -+ -+ rc = virtsnd_find_vqs(snd); -+ if (rc) -+ goto on_exit; -+ -+ virtio_device_ready(vdev); -+ -+ rc = virtsnd_build_devs(snd); -+ if (rc) -+ goto on_exit; -+ -+ virtsnd_enable_event_vq(snd); -+ -+on_exit: -+ if (rc) -+ virtsnd_remove(vdev); -+ -+ return rc; -+} -+ -+/** -+ * virtsnd_remove() - Remove VirtIO and ALSA devices. -+ * @vdev: VirtIO parent device. -+ * -+ * Context: Any context that permits to sleep. -+ */ -+static void virtsnd_remove(struct virtio_device *vdev) -+{ -+ struct virtio_snd *snd = vdev->priv; -+ -+ virtsnd_disable_event_vq(snd); -+ -+ if (snd->card) -+ snd_card_free(snd->card); -+ -+ vdev->config->del_vqs(vdev); -+ vdev->config->reset(vdev); -+ -+ kfree(snd->event_msgs); -+} -+ -+static const struct virtio_device_id id_table[] = { -+ { VIRTIO_ID_SOUND, VIRTIO_DEV_ANY_ID }, -+ { 0 }, -+}; -+ -+static struct virtio_driver virtsnd_driver = { -+ .driver.name = KBUILD_MODNAME, -+ .driver.owner = THIS_MODULE, -+ .id_table = id_table, -+ .validate = virtsnd_validate, -+ .probe = virtsnd_probe, -+ .remove = virtsnd_remove, -+}; -+ -+static int __init init(void) -+{ -+ return register_virtio_driver(&virtsnd_driver); -+} -+module_init(init); -+ -+static void __exit fini(void) -+{ -+ unregister_virtio_driver(&virtsnd_driver); -+} -+module_exit(fini); -+ -+MODULE_DEVICE_TABLE(virtio, id_table); -+MODULE_DESCRIPTION("Virtio sound card driver"); -+MODULE_LICENSE("GPL"); -diff --git a/sound/virtio/virtio_card.h b/sound/virtio/virtio_card.h -new file mode 100644 -index 000000000000..b903b1b12e90 ---- /dev/null -+++ b/sound/virtio/virtio_card.h -@@ -0,0 +1,65 @@ -+/* SPDX-License-Identifier: GPL-2.0+ */ -+/* -+ * virtio-snd: Virtio sound device -+ * Copyright (C) 2021 OpenSynergy GmbH -+ */ -+#ifndef VIRTIO_SND_CARD_H -+#define VIRTIO_SND_CARD_H -+ -+#include <linux/slab.h> -+#include <linux/virtio.h> -+#include <sound/core.h> -+#include <uapi/linux/virtio_snd.h> -+ -+#define VIRTIO_SND_CARD_DRIVER "virtio-snd" -+#define VIRTIO_SND_CARD_NAME "VirtIO SoundCard" -+ -+/** -+ * struct virtio_snd_queue - Virtqueue wrapper structure. -+ * @lock: Used to synchronize access to a virtqueue. -+ * @vqueue: Underlying virtqueue. -+ */ -+struct virtio_snd_queue { -+ spinlock_t lock; -+ struct virtqueue *vqueue; -+}; -+ -+/** -+ * struct virtio_snd - VirtIO sound card device. -+ * @vdev: Underlying virtio device. -+ * @queues: Virtqueue wrappers. -+ * @card: ALSA sound card. -+ * @event_msgs: Device events. -+ */ -+struct virtio_snd { -+ struct virtio_device *vdev; -+ struct virtio_snd_queue queues[VIRTIO_SND_VQ_MAX]; -+ struct snd_card *card; -+ struct virtio_snd_event *event_msgs; -+}; -+ -+static inline struct virtio_snd_queue * -+virtsnd_control_queue(struct virtio_snd *snd) -+{ -+ return &snd->queues[VIRTIO_SND_VQ_CONTROL]; -+} -+ -+static inline struct virtio_snd_queue * -+virtsnd_event_queue(struct virtio_snd *snd) -+{ -+ return &snd->queues[VIRTIO_SND_VQ_EVENT]; -+} -+ -+static inline struct virtio_snd_queue * -+virtsnd_tx_queue(struct virtio_snd *snd) -+{ -+ return &snd->queues[VIRTIO_SND_VQ_TX]; -+} -+ -+static inline struct virtio_snd_queue * -+virtsnd_rx_queue(struct virtio_snd *snd) -+{ -+ return &snd->queues[VIRTIO_SND_VQ_RX]; -+} -+ -+#endif /* VIRTIO_SND_CARD_H */ diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0003-ALSA-virtio-handling-control-messages.patch b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0003-ALSA-virtio-handling-control-messages.patch deleted file mode 100644 index 2ee988a4a..000000000 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0003-ALSA-virtio-handling-control-messages.patch +++ /dev/null @@ -1,528 +0,0 @@ -From d4c8a3a4b9de5a25b6963f3ae1b8a5cb32081de5 Mon Sep 17 00:00:00 2001 -From: Anton Yakovlev <anton.yakovlev@opensynergy.com> -Date: Tue, 2 Mar 2021 17:47:03 +0100 -Subject: [PATCH] ALSA: virtio: handling control messages - -The control queue can be used by different parts of the driver to send -commands to the device. Control messages can be either synchronous or -asynchronous. The lifetime of a message is controlled by a reference -count. - -Introduce a module parameter to set the message completion timeout: - msg_timeout_ms [=1000] - -Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> -Link: https://lore.kernel.org/r/20210302164709.3142702-4-anton.yakovlev@opensynergy.com -Signed-off-by: Takashi Iwai <tiwai@suse.de> -Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com> ---- - sound/virtio/Makefile | 3 +- - sound/virtio/virtio_card.c | 13 ++ - sound/virtio/virtio_card.h | 7 + - sound/virtio/virtio_ctl_msg.c | 310 ++++++++++++++++++++++++++++++++++ - sound/virtio/virtio_ctl_msg.h | 78 +++++++++ - 5 files changed, 410 insertions(+), 1 deletion(-) - create mode 100644 sound/virtio/virtio_ctl_msg.c - create mode 100644 sound/virtio/virtio_ctl_msg.h - -diff --git a/sound/virtio/Makefile b/sound/virtio/Makefile -index 8c87ebb9982b..dc551e637441 100644 ---- a/sound/virtio/Makefile -+++ b/sound/virtio/Makefile -@@ -3,5 +3,6 @@ - obj-$(CONFIG_SND_VIRTIO) += virtio_snd.o - - virtio_snd-objs := \ -- virtio_card.o -+ virtio_card.o \ -+ virtio_ctl_msg.o - -diff --git a/sound/virtio/virtio_card.c b/sound/virtio/virtio_card.c -index 5a37056858e9..b757b2444078 100644 ---- a/sound/virtio/virtio_card.c -+++ b/sound/virtio/virtio_card.c -@@ -11,6 +11,10 @@ - - #include "virtio_card.h" - -+u32 virtsnd_msg_timeout_ms = MSEC_PER_SEC; -+module_param_named(msg_timeout_ms, virtsnd_msg_timeout_ms, uint, 0644); -+MODULE_PARM_DESC(msg_timeout_ms, "Message completion timeout in milliseconds"); -+ - static void virtsnd_remove(struct virtio_device *vdev); - - /** -@@ -96,9 +100,11 @@ static int virtsnd_find_vqs(struct virtio_snd *snd) - { - struct virtio_device *vdev = snd->vdev; - static vq_callback_t *callbacks[VIRTIO_SND_VQ_MAX] = { -+ [VIRTIO_SND_VQ_CONTROL] = virtsnd_ctl_notify_cb, - [VIRTIO_SND_VQ_EVENT] = virtsnd_event_notify_cb - }; - static const char *names[VIRTIO_SND_VQ_MAX] = { -+ [VIRTIO_SND_VQ_CONTROL] = "virtsnd-ctl", - [VIRTIO_SND_VQ_EVENT] = "virtsnd-event" - }; - struct virtqueue *vqs[VIRTIO_SND_VQ_MAX] = { 0 }; -@@ -226,6 +232,11 @@ static int virtsnd_validate(struct virtio_device *vdev) - return -EINVAL; - } - -+ if (!virtsnd_msg_timeout_ms) { -+ dev_err(&vdev->dev, "msg_timeout_ms value cannot be zero\n"); -+ return -EINVAL; -+ } -+ - return 0; - } - -@@ -247,6 +258,7 @@ static int virtsnd_probe(struct virtio_device *vdev) - return -ENOMEM; - - snd->vdev = vdev; -+ INIT_LIST_HEAD(&snd->ctl_msgs); - - vdev->priv = snd; - -@@ -283,6 +295,7 @@ static void virtsnd_remove(struct virtio_device *vdev) - struct virtio_snd *snd = vdev->priv; - - virtsnd_disable_event_vq(snd); -+ virtsnd_ctl_msg_cancel_all(snd); - - if (snd->card) - snd_card_free(snd->card); -diff --git a/sound/virtio/virtio_card.h b/sound/virtio/virtio_card.h -index b903b1b12e90..1e76eeff160f 100644 ---- a/sound/virtio/virtio_card.h -+++ b/sound/virtio/virtio_card.h -@@ -11,6 +11,8 @@ - #include <sound/core.h> - #include <uapi/linux/virtio_snd.h> - -+#include "virtio_ctl_msg.h" -+ - #define VIRTIO_SND_CARD_DRIVER "virtio-snd" - #define VIRTIO_SND_CARD_NAME "VirtIO SoundCard" - -@@ -29,15 +31,20 @@ struct virtio_snd_queue { - * @vdev: Underlying virtio device. - * @queues: Virtqueue wrappers. - * @card: ALSA sound card. -+ * @ctl_msgs: Pending control request list. - * @event_msgs: Device events. - */ - struct virtio_snd { - struct virtio_device *vdev; - struct virtio_snd_queue queues[VIRTIO_SND_VQ_MAX]; - struct snd_card *card; -+ struct list_head ctl_msgs; - struct virtio_snd_event *event_msgs; - }; - -+/* Message completion timeout in milliseconds (module parameter). */ -+extern u32 virtsnd_msg_timeout_ms; -+ - static inline struct virtio_snd_queue * - virtsnd_control_queue(struct virtio_snd *snd) - { -diff --git a/sound/virtio/virtio_ctl_msg.c b/sound/virtio/virtio_ctl_msg.c -new file mode 100644 -index 000000000000..26ff7e7cc041 ---- /dev/null -+++ b/sound/virtio/virtio_ctl_msg.c -@@ -0,0 +1,310 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * virtio-snd: Virtio sound device -+ * Copyright (C) 2021 OpenSynergy GmbH -+ */ -+#include <linux/moduleparam.h> -+#include <linux/virtio_config.h> -+ -+#include "virtio_card.h" -+ -+/** -+ * struct virtio_snd_msg - Control message. -+ * @sg_request: Scattergather list containing a device request (header). -+ * @sg_response: Scattergather list containing a device response (status). -+ * @list: Pending message list entry. -+ * @notify: Request completed notification. -+ * @ref_count: Reference count used to manage a message lifetime. -+ */ -+struct virtio_snd_msg { -+ struct scatterlist sg_request; -+ struct scatterlist sg_response; -+ struct list_head list; -+ struct completion notify; -+ refcount_t ref_count; -+}; -+ -+/** -+ * virtsnd_ctl_msg_ref() - Increment reference counter for the message. -+ * @msg: Control message. -+ * -+ * Context: Any context. -+ */ -+void virtsnd_ctl_msg_ref(struct virtio_snd_msg *msg) -+{ -+ refcount_inc(&msg->ref_count); -+} -+ -+/** -+ * virtsnd_ctl_msg_unref() - Decrement reference counter for the message. -+ * @msg: Control message. -+ * -+ * The message will be freed when the ref_count value is 0. -+ * -+ * Context: Any context. -+ */ -+void virtsnd_ctl_msg_unref(struct virtio_snd_msg *msg) -+{ -+ if (refcount_dec_and_test(&msg->ref_count)) -+ kfree(msg); -+} -+ -+/** -+ * virtsnd_ctl_msg_request() - Get a pointer to the request header. -+ * @msg: Control message. -+ * -+ * Context: Any context. -+ */ -+void *virtsnd_ctl_msg_request(struct virtio_snd_msg *msg) -+{ -+ return sg_virt(&msg->sg_request); -+} -+ -+/** -+ * virtsnd_ctl_msg_request() - Get a pointer to the response header. -+ * @msg: Control message. -+ * -+ * Context: Any context. -+ */ -+void *virtsnd_ctl_msg_response(struct virtio_snd_msg *msg) -+{ -+ return sg_virt(&msg->sg_response); -+} -+ -+/** -+ * virtsnd_ctl_msg_alloc() - Allocate and initialize a control message. -+ * @request_size: Size of request header. -+ * @response_size: Size of response header. -+ * @gfp: Kernel flags for memory allocation. -+ * -+ * The message will be automatically freed when the ref_count value is 0. -+ * -+ * Context: Any context. May sleep if @gfp flags permit. -+ * Return: Allocated message on success, NULL on failure. -+ */ -+struct virtio_snd_msg *virtsnd_ctl_msg_alloc(size_t request_size, -+ size_t response_size, gfp_t gfp) -+{ -+ struct virtio_snd_msg *msg; -+ -+ if (!request_size || !response_size) -+ return NULL; -+ -+ msg = kzalloc(sizeof(*msg) + request_size + response_size, gfp); -+ if (!msg) -+ return NULL; -+ -+ sg_init_one(&msg->sg_request, (u8 *)msg + sizeof(*msg), request_size); -+ sg_init_one(&msg->sg_response, (u8 *)msg + sizeof(*msg) + request_size, -+ response_size); -+ -+ INIT_LIST_HEAD(&msg->list); -+ init_completion(&msg->notify); -+ /* This reference is dropped in virtsnd_ctl_msg_complete(). */ -+ refcount_set(&msg->ref_count, 1); -+ -+ return msg; -+} -+ -+/** -+ * virtsnd_ctl_msg_send() - Send a control message. -+ * @snd: VirtIO sound device. -+ * @msg: Control message. -+ * @out_sgs: Additional sg-list to attach to the request header (may be NULL). -+ * @in_sgs: Additional sg-list to attach to the response header (may be NULL). -+ * @nowait: Flag indicating whether to wait for completion. -+ * -+ * Context: Any context. Takes and releases the control queue spinlock. -+ * May sleep if @nowait is false. -+ * Return: 0 on success, -errno on failure. -+ */ -+int virtsnd_ctl_msg_send(struct virtio_snd *snd, struct virtio_snd_msg *msg, -+ struct scatterlist *out_sgs, -+ struct scatterlist *in_sgs, bool nowait) -+{ -+ struct virtio_device *vdev = snd->vdev; -+ struct virtio_snd_queue *queue = virtsnd_control_queue(snd); -+ unsigned int js = msecs_to_jiffies(virtsnd_msg_timeout_ms); -+ struct virtio_snd_hdr *request = virtsnd_ctl_msg_request(msg); -+ struct virtio_snd_hdr *response = virtsnd_ctl_msg_response(msg); -+ unsigned int nouts = 0; -+ unsigned int nins = 0; -+ struct scatterlist *psgs[4]; -+ bool notify = false; -+ unsigned long flags; -+ int rc; -+ -+ virtsnd_ctl_msg_ref(msg); -+ -+ /* Set the default status in case the message was canceled. */ -+ response->code = cpu_to_le32(VIRTIO_SND_S_IO_ERR); -+ -+ psgs[nouts++] = &msg->sg_request; -+ if (out_sgs) -+ psgs[nouts++] = out_sgs; -+ -+ psgs[nouts + nins++] = &msg->sg_response; -+ if (in_sgs) -+ psgs[nouts + nins++] = in_sgs; -+ -+ spin_lock_irqsave(&queue->lock, flags); -+ rc = virtqueue_add_sgs(queue->vqueue, psgs, nouts, nins, msg, -+ GFP_ATOMIC); -+ if (!rc) { -+ notify = virtqueue_kick_prepare(queue->vqueue); -+ -+ list_add_tail(&msg->list, &snd->ctl_msgs); -+ } -+ spin_unlock_irqrestore(&queue->lock, flags); -+ -+ if (rc) { -+ dev_err(&vdev->dev, "failed to send control message (0x%08x)\n", -+ le32_to_cpu(request->code)); -+ -+ /* -+ * Since in this case virtsnd_ctl_msg_complete() will not be -+ * called, it is necessary to decrement the reference count. -+ */ -+ virtsnd_ctl_msg_unref(msg); -+ -+ goto on_exit; -+ } -+ -+ if (notify) -+ virtqueue_notify(queue->vqueue); -+ -+ if (nowait) -+ goto on_exit; -+ -+ rc = wait_for_completion_interruptible_timeout(&msg->notify, js); -+ if (rc <= 0) { -+ if (!rc) { -+ dev_err(&vdev->dev, -+ "control message (0x%08x) timeout\n", -+ le32_to_cpu(request->code)); -+ rc = -ETIMEDOUT; -+ } -+ -+ goto on_exit; -+ } -+ -+ switch (le32_to_cpu(response->code)) { -+ case VIRTIO_SND_S_OK: -+ rc = 0; -+ break; -+ case VIRTIO_SND_S_NOT_SUPP: -+ rc = -EOPNOTSUPP; -+ break; -+ case VIRTIO_SND_S_IO_ERR: -+ rc = -EIO; -+ break; -+ default: -+ rc = -EINVAL; -+ break; -+ } -+ -+on_exit: -+ virtsnd_ctl_msg_unref(msg); -+ -+ return rc; -+} -+ -+/** -+ * virtsnd_ctl_msg_complete() - Complete a control message. -+ * @msg: Control message. -+ * -+ * Context: Any context. Expects the control queue spinlock to be held by -+ * caller. -+ */ -+void virtsnd_ctl_msg_complete(struct virtio_snd_msg *msg) -+{ -+ list_del(&msg->list); -+ complete(&msg->notify); -+ -+ virtsnd_ctl_msg_unref(msg); -+} -+ -+/** -+ * virtsnd_ctl_msg_cancel_all() - Cancel all pending control messages. -+ * @snd: VirtIO sound device. -+ * -+ * Context: Any context. -+ */ -+void virtsnd_ctl_msg_cancel_all(struct virtio_snd *snd) -+{ -+ struct virtio_snd_queue *queue = virtsnd_control_queue(snd); -+ unsigned long flags; -+ -+ spin_lock_irqsave(&queue->lock, flags); -+ while (!list_empty(&snd->ctl_msgs)) { -+ struct virtio_snd_msg *msg = -+ list_first_entry(&snd->ctl_msgs, struct virtio_snd_msg, -+ list); -+ -+ virtsnd_ctl_msg_complete(msg); -+ } -+ spin_unlock_irqrestore(&queue->lock, flags); -+} -+ -+/** -+ * virtsnd_ctl_query_info() - Query the item configuration from the device. -+ * @snd: VirtIO sound device. -+ * @command: Control request code (VIRTIO_SND_R_XXX_INFO). -+ * @start_id: Item start identifier. -+ * @count: Item count to query. -+ * @size: Item information size in bytes. -+ * @info: Buffer for storing item information. -+ * -+ * Context: Any context that permits to sleep. -+ * Return: 0 on success, -errno on failure. -+ */ -+int virtsnd_ctl_query_info(struct virtio_snd *snd, int command, int start_id, -+ int count, size_t size, void *info) -+{ -+ struct virtio_snd_msg *msg; -+ struct virtio_snd_query_info *query; -+ struct scatterlist sg; -+ -+ msg = virtsnd_ctl_msg_alloc(sizeof(*query), -+ sizeof(struct virtio_snd_hdr), GFP_KERNEL); -+ if (!msg) -+ return -ENOMEM; -+ -+ query = virtsnd_ctl_msg_request(msg); -+ query->hdr.code = cpu_to_le32(command); -+ query->start_id = cpu_to_le32(start_id); -+ query->count = cpu_to_le32(count); -+ query->size = cpu_to_le32(size); -+ -+ sg_init_one(&sg, info, count * size); -+ -+ return virtsnd_ctl_msg_send(snd, msg, NULL, &sg, false); -+} -+ -+/** -+ * virtsnd_ctl_notify_cb() - Process all completed control messages. -+ * @vqueue: Underlying control virtqueue. -+ * -+ * This callback function is called upon a vring interrupt request from the -+ * device. -+ * -+ * Context: Interrupt context. Takes and releases the control queue spinlock. -+ */ -+void virtsnd_ctl_notify_cb(struct virtqueue *vqueue) -+{ -+ struct virtio_snd *snd = vqueue->vdev->priv; -+ struct virtio_snd_queue *queue = virtsnd_control_queue(snd); -+ struct virtio_snd_msg *msg; -+ u32 length; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&queue->lock, flags); -+ do { -+ virtqueue_disable_cb(vqueue); -+ while ((msg = virtqueue_get_buf(vqueue, &length))) -+ virtsnd_ctl_msg_complete(msg); -+ if (unlikely(virtqueue_is_broken(vqueue))) -+ break; -+ } while (!virtqueue_enable_cb(vqueue)); -+ spin_unlock_irqrestore(&queue->lock, flags); -+} -diff --git a/sound/virtio/virtio_ctl_msg.h b/sound/virtio/virtio_ctl_msg.h -new file mode 100644 -index 000000000000..7f4db044f28e ---- /dev/null -+++ b/sound/virtio/virtio_ctl_msg.h -@@ -0,0 +1,78 @@ -+/* SPDX-License-Identifier: GPL-2.0+ */ -+/* -+ * virtio-snd: Virtio sound device -+ * Copyright (C) 2021 OpenSynergy GmbH -+ */ -+#ifndef VIRTIO_SND_MSG_H -+#define VIRTIO_SND_MSG_H -+ -+#include <linux/atomic.h> -+#include <linux/virtio.h> -+ -+struct virtio_snd; -+struct virtio_snd_msg; -+ -+void virtsnd_ctl_msg_ref(struct virtio_snd_msg *msg); -+ -+void virtsnd_ctl_msg_unref(struct virtio_snd_msg *msg); -+ -+void *virtsnd_ctl_msg_request(struct virtio_snd_msg *msg); -+ -+void *virtsnd_ctl_msg_response(struct virtio_snd_msg *msg); -+ -+struct virtio_snd_msg *virtsnd_ctl_msg_alloc(size_t request_size, -+ size_t response_size, gfp_t gfp); -+ -+int virtsnd_ctl_msg_send(struct virtio_snd *snd, struct virtio_snd_msg *msg, -+ struct scatterlist *out_sgs, -+ struct scatterlist *in_sgs, bool nowait); -+ -+/** -+ * virtsnd_ctl_msg_send_sync() - Simplified sending of synchronous message. -+ * @snd: VirtIO sound device. -+ * @msg: Control message. -+ * -+ * After returning from this function, the message will be deleted. If message -+ * content is still needed, the caller must additionally to -+ * virtsnd_ctl_msg_ref/unref() it. -+ * -+ * The msg_timeout_ms module parameter defines the message completion timeout. -+ * If the message is not completed within this time, the function will return an -+ * error. -+ * -+ * Context: Any context that permits to sleep. -+ * Return: 0 on success, -errno on failure. -+ * -+ * The return value is a message status code (VIRTIO_SND_S_XXX) converted to an -+ * appropriate -errno value. -+ */ -+static inline int virtsnd_ctl_msg_send_sync(struct virtio_snd *snd, -+ struct virtio_snd_msg *msg) -+{ -+ return virtsnd_ctl_msg_send(snd, msg, NULL, NULL, false); -+} -+ -+/** -+ * virtsnd_ctl_msg_send_async() - Simplified sending of asynchronous message. -+ * @snd: VirtIO sound device. -+ * @msg: Control message. -+ * -+ * Context: Any context. -+ * Return: 0 on success, -errno on failure. -+ */ -+static inline int virtsnd_ctl_msg_send_async(struct virtio_snd *snd, -+ struct virtio_snd_msg *msg) -+{ -+ return virtsnd_ctl_msg_send(snd, msg, NULL, NULL, true); -+} -+ -+void virtsnd_ctl_msg_cancel_all(struct virtio_snd *snd); -+ -+void virtsnd_ctl_msg_complete(struct virtio_snd_msg *msg); -+ -+int virtsnd_ctl_query_info(struct virtio_snd *snd, int command, int start_id, -+ int count, size_t size, void *info); -+ -+void virtsnd_ctl_notify_cb(struct virtqueue *vqueue); -+ -+#endif /* VIRTIO_SND_MSG_H */ diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0004-ALSA-virtio-build-PCM-devices-and-substream-hardware.patch b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0004-ALSA-virtio-build-PCM-devices-and-substream-hardware.patch deleted file mode 100644 index 27ae9a865..000000000 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0004-ALSA-virtio-build-PCM-devices-and-substream-hardware.patch +++ /dev/null @@ -1,703 +0,0 @@ -From 12e4e501f9662a02e61acb5966fdceeffb0ff16d Mon Sep 17 00:00:00 2001 -From: Anton Yakovlev <anton.yakovlev@opensynergy.com> -Date: Tue, 2 Mar 2021 17:47:04 +0100 -Subject: [PATCH] ALSA: virtio: build PCM devices and substream hardware - descriptors - -Like the HDA specification, the virtio sound device specification links -PCM substreams, jacks and PCM channel maps into functional groups. For -each discovered group, a PCM device is created, the number of which -coincides with the group number. - -Introduce the module parameters for setting the hardware buffer -parameters: - pcm_buffer_ms [=160] - pcm_periods_min [=2] - pcm_periods_max [=16] - pcm_period_ms_min [=10] - pcm_period_ms_max [=80] - -Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> -Link: https://lore.kernel.org/r/20210302164709.3142702-5-anton.yakovlev@opensynergy.com -Signed-off-by: Takashi Iwai <tiwai@suse.de> -Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com> ---- - sound/virtio/Makefile | 3 +- - sound/virtio/virtio_card.c | 18 ++ - sound/virtio/virtio_card.h | 10 + - sound/virtio/virtio_pcm.c | 479 +++++++++++++++++++++++++++++++++++++ - sound/virtio/virtio_pcm.h | 72 ++++++ - 5 files changed, 581 insertions(+), 1 deletion(-) - create mode 100644 sound/virtio/virtio_pcm.c - create mode 100644 sound/virtio/virtio_pcm.h - -diff --git a/sound/virtio/Makefile b/sound/virtio/Makefile -index dc551e637441..69162a545a41 100644 ---- a/sound/virtio/Makefile -+++ b/sound/virtio/Makefile -@@ -4,5 +4,6 @@ obj-$(CONFIG_SND_VIRTIO) += virtio_snd.o - - virtio_snd-objs := \ - virtio_card.o \ -- virtio_ctl_msg.o -+ virtio_ctl_msg.o \ -+ virtio_pcm.o - -diff --git a/sound/virtio/virtio_card.c b/sound/virtio/virtio_card.c -index b757b2444078..11c76ee311b7 100644 ---- a/sound/virtio/virtio_card.c -+++ b/sound/virtio/virtio_card.c -@@ -209,6 +209,16 @@ static int virtsnd_build_devs(struct virtio_snd *snd) - VIRTIO_SND_CARD_NAME " at %s/%s", - dev_name(dev->parent), dev_name(dev)); - -+ rc = virtsnd_pcm_parse_cfg(snd); -+ if (rc) -+ return rc; -+ -+ if (snd->nsubstreams) { -+ rc = virtsnd_pcm_build_devs(snd); -+ if (rc) -+ return rc; -+ } -+ - return snd_card_register(snd->card); - } - -@@ -237,6 +247,9 @@ static int virtsnd_validate(struct virtio_device *vdev) - return -EINVAL; - } - -+ if (virtsnd_pcm_validate(vdev)) -+ return -EINVAL; -+ - return 0; - } - -@@ -259,6 +272,7 @@ static int virtsnd_probe(struct virtio_device *vdev) - - snd->vdev = vdev; - INIT_LIST_HEAD(&snd->ctl_msgs); -+ INIT_LIST_HEAD(&snd->pcm_list); - - vdev->priv = snd; - -@@ -293,6 +307,7 @@ static int virtsnd_probe(struct virtio_device *vdev) - static void virtsnd_remove(struct virtio_device *vdev) - { - struct virtio_snd *snd = vdev->priv; -+ unsigned int i; - - virtsnd_disable_event_vq(snd); - virtsnd_ctl_msg_cancel_all(snd); -@@ -303,6 +318,9 @@ static void virtsnd_remove(struct virtio_device *vdev) - vdev->config->del_vqs(vdev); - vdev->config->reset(vdev); - -+ for (i = 0; snd->substreams && i < snd->nsubstreams; ++i) -+ cancel_work_sync(&snd->substreams[i].elapsed_period); -+ - kfree(snd->event_msgs); - } - -diff --git a/sound/virtio/virtio_card.h b/sound/virtio/virtio_card.h -index 1e76eeff160f..77a1b7255370 100644 ---- a/sound/virtio/virtio_card.h -+++ b/sound/virtio/virtio_card.h -@@ -12,9 +12,13 @@ - #include <uapi/linux/virtio_snd.h> - - #include "virtio_ctl_msg.h" -+#include "virtio_pcm.h" - - #define VIRTIO_SND_CARD_DRIVER "virtio-snd" - #define VIRTIO_SND_CARD_NAME "VirtIO SoundCard" -+#define VIRTIO_SND_PCM_NAME "VirtIO PCM" -+ -+struct virtio_pcm_substream; - - /** - * struct virtio_snd_queue - Virtqueue wrapper structure. -@@ -33,6 +37,9 @@ struct virtio_snd_queue { - * @card: ALSA sound card. - * @ctl_msgs: Pending control request list. - * @event_msgs: Device events. -+ * @pcm_list: VirtIO PCM device list. -+ * @substreams: VirtIO PCM substreams. -+ * @nsubstreams: Number of PCM substreams. - */ - struct virtio_snd { - struct virtio_device *vdev; -@@ -40,6 +47,9 @@ struct virtio_snd { - struct snd_card *card; - struct list_head ctl_msgs; - struct virtio_snd_event *event_msgs; -+ struct list_head pcm_list; -+ struct virtio_pcm_substream *substreams; -+ u32 nsubstreams; - }; - - /* Message completion timeout in milliseconds (module parameter). */ -diff --git a/sound/virtio/virtio_pcm.c b/sound/virtio/virtio_pcm.c -new file mode 100644 -index 000000000000..e16567e2e214 ---- /dev/null -+++ b/sound/virtio/virtio_pcm.c -@@ -0,0 +1,479 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * virtio-snd: Virtio sound device -+ * Copyright (C) 2021 OpenSynergy GmbH -+ */ -+#include <linux/moduleparam.h> -+#include <linux/virtio_config.h> -+ -+#include "virtio_card.h" -+ -+static u32 pcm_buffer_ms = 160; -+module_param(pcm_buffer_ms, uint, 0644); -+MODULE_PARM_DESC(pcm_buffer_ms, "PCM substream buffer time in milliseconds"); -+ -+static u32 pcm_periods_min = 2; -+module_param(pcm_periods_min, uint, 0644); -+MODULE_PARM_DESC(pcm_periods_min, "Minimum number of PCM periods"); -+ -+static u32 pcm_periods_max = 16; -+module_param(pcm_periods_max, uint, 0644); -+MODULE_PARM_DESC(pcm_periods_max, "Maximum number of PCM periods"); -+ -+static u32 pcm_period_ms_min = 10; -+module_param(pcm_period_ms_min, uint, 0644); -+MODULE_PARM_DESC(pcm_period_ms_min, "Minimum PCM period time in milliseconds"); -+ -+static u32 pcm_period_ms_max = 80; -+module_param(pcm_period_ms_max, uint, 0644); -+MODULE_PARM_DESC(pcm_period_ms_max, "Maximum PCM period time in milliseconds"); -+ -+/* Map for converting VirtIO format to ALSA format. */ -+static const snd_pcm_format_t g_v2a_format_map[] = { -+ [VIRTIO_SND_PCM_FMT_IMA_ADPCM] = SNDRV_PCM_FORMAT_IMA_ADPCM, -+ [VIRTIO_SND_PCM_FMT_MU_LAW] = SNDRV_PCM_FORMAT_MU_LAW, -+ [VIRTIO_SND_PCM_FMT_A_LAW] = SNDRV_PCM_FORMAT_A_LAW, -+ [VIRTIO_SND_PCM_FMT_S8] = SNDRV_PCM_FORMAT_S8, -+ [VIRTIO_SND_PCM_FMT_U8] = SNDRV_PCM_FORMAT_U8, -+ [VIRTIO_SND_PCM_FMT_S16] = SNDRV_PCM_FORMAT_S16_LE, -+ [VIRTIO_SND_PCM_FMT_U16] = SNDRV_PCM_FORMAT_U16_LE, -+ [VIRTIO_SND_PCM_FMT_S18_3] = SNDRV_PCM_FORMAT_S18_3LE, -+ [VIRTIO_SND_PCM_FMT_U18_3] = SNDRV_PCM_FORMAT_U18_3LE, -+ [VIRTIO_SND_PCM_FMT_S20_3] = SNDRV_PCM_FORMAT_S20_3LE, -+ [VIRTIO_SND_PCM_FMT_U20_3] = SNDRV_PCM_FORMAT_U20_3LE, -+ [VIRTIO_SND_PCM_FMT_S24_3] = SNDRV_PCM_FORMAT_S24_3LE, -+ [VIRTIO_SND_PCM_FMT_U24_3] = SNDRV_PCM_FORMAT_U24_3LE, -+ [VIRTIO_SND_PCM_FMT_S20] = SNDRV_PCM_FORMAT_S20_LE, -+ [VIRTIO_SND_PCM_FMT_U20] = SNDRV_PCM_FORMAT_U20_LE, -+ [VIRTIO_SND_PCM_FMT_S24] = SNDRV_PCM_FORMAT_S24_LE, -+ [VIRTIO_SND_PCM_FMT_U24] = SNDRV_PCM_FORMAT_U24_LE, -+ [VIRTIO_SND_PCM_FMT_S32] = SNDRV_PCM_FORMAT_S32_LE, -+ [VIRTIO_SND_PCM_FMT_U32] = SNDRV_PCM_FORMAT_U32_LE, -+ [VIRTIO_SND_PCM_FMT_FLOAT] = SNDRV_PCM_FORMAT_FLOAT_LE, -+ [VIRTIO_SND_PCM_FMT_FLOAT64] = SNDRV_PCM_FORMAT_FLOAT64_LE, -+ [VIRTIO_SND_PCM_FMT_DSD_U8] = SNDRV_PCM_FORMAT_DSD_U8, -+ [VIRTIO_SND_PCM_FMT_DSD_U16] = SNDRV_PCM_FORMAT_DSD_U16_LE, -+ [VIRTIO_SND_PCM_FMT_DSD_U32] = SNDRV_PCM_FORMAT_DSD_U32_LE, -+ [VIRTIO_SND_PCM_FMT_IEC958_SUBFRAME] = -+ SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE -+}; -+ -+/* Map for converting VirtIO frame rate to ALSA frame rate. */ -+struct virtsnd_v2a_rate { -+ unsigned int alsa_bit; -+ unsigned int rate; -+}; -+ -+static const struct virtsnd_v2a_rate g_v2a_rate_map[] = { -+ [VIRTIO_SND_PCM_RATE_5512] = { SNDRV_PCM_RATE_5512, 5512 }, -+ [VIRTIO_SND_PCM_RATE_8000] = { SNDRV_PCM_RATE_8000, 8000 }, -+ [VIRTIO_SND_PCM_RATE_11025] = { SNDRV_PCM_RATE_11025, 11025 }, -+ [VIRTIO_SND_PCM_RATE_16000] = { SNDRV_PCM_RATE_16000, 16000 }, -+ [VIRTIO_SND_PCM_RATE_22050] = { SNDRV_PCM_RATE_22050, 22050 }, -+ [VIRTIO_SND_PCM_RATE_32000] = { SNDRV_PCM_RATE_32000, 32000 }, -+ [VIRTIO_SND_PCM_RATE_44100] = { SNDRV_PCM_RATE_44100, 44100 }, -+ [VIRTIO_SND_PCM_RATE_48000] = { SNDRV_PCM_RATE_48000, 48000 }, -+ [VIRTIO_SND_PCM_RATE_64000] = { SNDRV_PCM_RATE_64000, 64000 }, -+ [VIRTIO_SND_PCM_RATE_88200] = { SNDRV_PCM_RATE_88200, 88200 }, -+ [VIRTIO_SND_PCM_RATE_96000] = { SNDRV_PCM_RATE_96000, 96000 }, -+ [VIRTIO_SND_PCM_RATE_176400] = { SNDRV_PCM_RATE_176400, 176400 }, -+ [VIRTIO_SND_PCM_RATE_192000] = { SNDRV_PCM_RATE_192000, 192000 } -+}; -+ -+/** -+ * virtsnd_pcm_build_hw() - Parse substream config and build HW descriptor. -+ * @vss: VirtIO substream. -+ * @info: VirtIO substream information entry. -+ * -+ * Context: Any context. -+ * Return: 0 on success, -EINVAL if configuration is invalid. -+ */ -+static int virtsnd_pcm_build_hw(struct virtio_pcm_substream *vss, -+ struct virtio_snd_pcm_info *info) -+{ -+ struct virtio_device *vdev = vss->snd->vdev; -+ unsigned int i; -+ u64 values; -+ size_t sample_max = 0; -+ size_t sample_min = 0; -+ -+ vss->features = le32_to_cpu(info->features); -+ -+ /* -+ * TODO: set SNDRV_PCM_INFO_{BATCH,BLOCK_TRANSFER} if device supports -+ * only message-based transport. -+ */ -+ vss->hw.info = -+ SNDRV_PCM_INFO_MMAP | -+ SNDRV_PCM_INFO_MMAP_VALID | -+ SNDRV_PCM_INFO_BATCH | -+ SNDRV_PCM_INFO_BLOCK_TRANSFER | -+ SNDRV_PCM_INFO_INTERLEAVED | -+ SNDRV_PCM_INFO_PAUSE; -+ -+ if (!info->channels_min || info->channels_min > info->channels_max) { -+ dev_err(&vdev->dev, -+ "SID %u: invalid channel range [%u %u]\n", -+ vss->sid, info->channels_min, info->channels_max); -+ return -EINVAL; -+ } -+ -+ vss->hw.channels_min = info->channels_min; -+ vss->hw.channels_max = info->channels_max; -+ -+ values = le64_to_cpu(info->formats); -+ -+ vss->hw.formats = 0; -+ -+ for (i = 0; i < ARRAY_SIZE(g_v2a_format_map); ++i) -+ if (values & (1ULL << i)) { -+ snd_pcm_format_t alsa_fmt = g_v2a_format_map[i]; -+ int bytes = snd_pcm_format_physical_width(alsa_fmt) / 8; -+ -+ if (!sample_min || sample_min > bytes) -+ sample_min = bytes; -+ -+ if (sample_max < bytes) -+ sample_max = bytes; -+ -+ vss->hw.formats |= pcm_format_to_bits(alsa_fmt); -+ } -+ -+ if (!vss->hw.formats) { -+ dev_err(&vdev->dev, -+ "SID %u: no supported PCM sample formats found\n", -+ vss->sid); -+ return -EINVAL; -+ } -+ -+ values = le64_to_cpu(info->rates); -+ -+ vss->hw.rates = 0; -+ -+ for (i = 0; i < ARRAY_SIZE(g_v2a_rate_map); ++i) -+ if (values & (1ULL << i)) { -+ if (!vss->hw.rate_min || -+ vss->hw.rate_min > g_v2a_rate_map[i].rate) -+ vss->hw.rate_min = g_v2a_rate_map[i].rate; -+ -+ if (vss->hw.rate_max < g_v2a_rate_map[i].rate) -+ vss->hw.rate_max = g_v2a_rate_map[i].rate; -+ -+ vss->hw.rates |= g_v2a_rate_map[i].alsa_bit; -+ } -+ -+ if (!vss->hw.rates) { -+ dev_err(&vdev->dev, -+ "SID %u: no supported PCM frame rates found\n", -+ vss->sid); -+ return -EINVAL; -+ } -+ -+ vss->hw.periods_min = pcm_periods_min; -+ vss->hw.periods_max = pcm_periods_max; -+ -+ /* -+ * We must ensure that there is enough space in the buffer to store -+ * pcm_buffer_ms ms for the combination (Cmax, Smax, Rmax), where: -+ * Cmax = maximum supported number of channels, -+ * Smax = maximum supported sample size in bytes, -+ * Rmax = maximum supported frame rate. -+ */ -+ vss->hw.buffer_bytes_max = -+ PAGE_ALIGN(sample_max * vss->hw.channels_max * pcm_buffer_ms * -+ (vss->hw.rate_max / MSEC_PER_SEC)); -+ -+ /* -+ * We must ensure that the minimum period size is enough to store -+ * pcm_period_ms_min ms for the combination (Cmin, Smin, Rmin), where: -+ * Cmin = minimum supported number of channels, -+ * Smin = minimum supported sample size in bytes, -+ * Rmin = minimum supported frame rate. -+ */ -+ vss->hw.period_bytes_min = -+ sample_min * vss->hw.channels_min * pcm_period_ms_min * -+ (vss->hw.rate_min / MSEC_PER_SEC); -+ -+ /* -+ * We must ensure that the maximum period size is enough to store -+ * pcm_period_ms_max ms for the combination (Cmax, Smax, Rmax). -+ */ -+ vss->hw.period_bytes_max = -+ sample_max * vss->hw.channels_max * pcm_period_ms_max * -+ (vss->hw.rate_max / MSEC_PER_SEC); -+ -+ return 0; -+} -+ -+/** -+ * virtsnd_pcm_find() - Find the PCM device for the specified node ID. -+ * @snd: VirtIO sound device. -+ * @nid: Function node ID. -+ * -+ * Context: Any context. -+ * Return: a pointer to the PCM device or ERR_PTR(-ENOENT). -+ */ -+struct virtio_pcm *virtsnd_pcm_find(struct virtio_snd *snd, u32 nid) -+{ -+ struct virtio_pcm *vpcm; -+ -+ list_for_each_entry(vpcm, &snd->pcm_list, list) -+ if (vpcm->nid == nid) -+ return vpcm; -+ -+ return ERR_PTR(-ENOENT); -+} -+ -+/** -+ * virtsnd_pcm_find_or_create() - Find or create the PCM device for the -+ * specified node ID. -+ * @snd: VirtIO sound device. -+ * @nid: Function node ID. -+ * -+ * Context: Any context that permits to sleep. -+ * Return: a pointer to the PCM device or ERR_PTR(-errno). -+ */ -+struct virtio_pcm *virtsnd_pcm_find_or_create(struct virtio_snd *snd, u32 nid) -+{ -+ struct virtio_device *vdev = snd->vdev; -+ struct virtio_pcm *vpcm; -+ -+ vpcm = virtsnd_pcm_find(snd, nid); -+ if (!IS_ERR(vpcm)) -+ return vpcm; -+ -+ vpcm = devm_kzalloc(&vdev->dev, sizeof(*vpcm), GFP_KERNEL); -+ if (!vpcm) -+ return ERR_PTR(-ENOMEM); -+ -+ vpcm->nid = nid; -+ list_add_tail(&vpcm->list, &snd->pcm_list); -+ -+ return vpcm; -+} -+ -+/** -+ * virtsnd_pcm_validate() - Validate if the device can be started. -+ * @vdev: VirtIO parent device. -+ * -+ * Context: Any context. -+ * Return: 0 on success, -EINVAL on failure. -+ */ -+int virtsnd_pcm_validate(struct virtio_device *vdev) -+{ -+ if (pcm_periods_min < 2 || pcm_periods_min > pcm_periods_max) { -+ dev_err(&vdev->dev, -+ "invalid range [%u %u] of the number of PCM periods\n", -+ pcm_periods_min, pcm_periods_max); -+ return -EINVAL; -+ } -+ -+ if (!pcm_period_ms_min || pcm_period_ms_min > pcm_period_ms_max) { -+ dev_err(&vdev->dev, -+ "invalid range [%u %u] of the size of the PCM period\n", -+ pcm_period_ms_min, pcm_period_ms_max); -+ return -EINVAL; -+ } -+ -+ if (pcm_buffer_ms < pcm_periods_min * pcm_period_ms_min) { -+ dev_err(&vdev->dev, -+ "pcm_buffer_ms(=%u) value cannot be < %u ms\n", -+ pcm_buffer_ms, pcm_periods_min * pcm_period_ms_min); -+ return -EINVAL; -+ } -+ -+ if (pcm_period_ms_max > pcm_buffer_ms / 2) { -+ dev_err(&vdev->dev, -+ "pcm_period_ms_max(=%u) value cannot be > %u ms\n", -+ pcm_period_ms_max, pcm_buffer_ms / 2); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+/** -+ * virtsnd_pcm_period_elapsed() - Kernel work function to handle the elapsed -+ * period state. -+ * @work: Elapsed period work. -+ * -+ * The main purpose of this function is to call snd_pcm_period_elapsed() in -+ * a process context, not in an interrupt context. This is necessary because PCM -+ * devices operate in non-atomic mode. -+ * -+ * Context: Process context. -+ */ -+static void virtsnd_pcm_period_elapsed(struct work_struct *work) -+{ -+ struct virtio_pcm_substream *vss = -+ container_of(work, struct virtio_pcm_substream, elapsed_period); -+ -+ snd_pcm_period_elapsed(vss->substream); -+} -+ -+/** -+ * virtsnd_pcm_parse_cfg() - Parse the stream configuration. -+ * @snd: VirtIO sound device. -+ * -+ * This function is called during initial device initialization. -+ * -+ * Context: Any context that permits to sleep. -+ * Return: 0 on success, -errno on failure. -+ */ -+int virtsnd_pcm_parse_cfg(struct virtio_snd *snd) -+{ -+ struct virtio_device *vdev = snd->vdev; -+ struct virtio_snd_pcm_info *info; -+ u32 i; -+ int rc; -+ -+ virtio_cread_le(vdev, struct virtio_snd_config, streams, -+ &snd->nsubstreams); -+ if (!snd->nsubstreams) -+ return 0; -+ -+ snd->substreams = devm_kcalloc(&vdev->dev, snd->nsubstreams, -+ sizeof(*snd->substreams), GFP_KERNEL); -+ if (!snd->substreams) -+ return -ENOMEM; -+ -+ info = kcalloc(snd->nsubstreams, sizeof(*info), GFP_KERNEL); -+ if (!info) -+ return -ENOMEM; -+ -+ rc = virtsnd_ctl_query_info(snd, VIRTIO_SND_R_PCM_INFO, 0, -+ snd->nsubstreams, sizeof(*info), info); -+ if (rc) -+ goto on_exit; -+ -+ for (i = 0; i < snd->nsubstreams; ++i) { -+ struct virtio_pcm_substream *vss = &snd->substreams[i]; -+ struct virtio_pcm *vpcm; -+ -+ vss->snd = snd; -+ vss->sid = i; -+ INIT_WORK(&vss->elapsed_period, virtsnd_pcm_period_elapsed); -+ -+ rc = virtsnd_pcm_build_hw(vss, &info[i]); -+ if (rc) -+ goto on_exit; -+ -+ vss->nid = le32_to_cpu(info[i].hdr.hda_fn_nid); -+ -+ vpcm = virtsnd_pcm_find_or_create(snd, vss->nid); -+ if (IS_ERR(vpcm)) { -+ rc = PTR_ERR(vpcm); -+ goto on_exit; -+ } -+ -+ switch (info[i].direction) { -+ case VIRTIO_SND_D_OUTPUT: -+ vss->direction = SNDRV_PCM_STREAM_PLAYBACK; -+ break; -+ case VIRTIO_SND_D_INPUT: -+ vss->direction = SNDRV_PCM_STREAM_CAPTURE; -+ break; -+ default: -+ dev_err(&vdev->dev, "SID %u: unknown direction (%u)\n", -+ vss->sid, info[i].direction); -+ rc = -EINVAL; -+ goto on_exit; -+ } -+ -+ vpcm->streams[vss->direction].nsubstreams++; -+ } -+ -+on_exit: -+ kfree(info); -+ -+ return rc; -+} -+ -+/** -+ * virtsnd_pcm_build_devs() - Build ALSA PCM devices. -+ * @snd: VirtIO sound device. -+ * -+ * Context: Any context that permits to sleep. -+ * Return: 0 on success, -errno on failure. -+ */ -+int virtsnd_pcm_build_devs(struct virtio_snd *snd) -+{ -+ struct virtio_device *vdev = snd->vdev; -+ struct virtio_pcm *vpcm; -+ u32 i; -+ int rc; -+ -+ list_for_each_entry(vpcm, &snd->pcm_list, list) { -+ unsigned int npbs = -+ vpcm->streams[SNDRV_PCM_STREAM_PLAYBACK].nsubstreams; -+ unsigned int ncps = -+ vpcm->streams[SNDRV_PCM_STREAM_CAPTURE].nsubstreams; -+ -+ if (!npbs && !ncps) -+ continue; -+ -+ rc = snd_pcm_new(snd->card, VIRTIO_SND_CARD_DRIVER, vpcm->nid, -+ npbs, ncps, &vpcm->pcm); -+ if (rc) { -+ dev_err(&vdev->dev, "snd_pcm_new[%u] failed: %d\n", -+ vpcm->nid, rc); -+ return rc; -+ } -+ -+ vpcm->pcm->info_flags = 0; -+ vpcm->pcm->dev_class = SNDRV_PCM_CLASS_GENERIC; -+ vpcm->pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX; -+ snprintf(vpcm->pcm->name, sizeof(vpcm->pcm->name), -+ VIRTIO_SND_PCM_NAME " %u", vpcm->pcm->device); -+ vpcm->pcm->private_data = vpcm; -+ vpcm->pcm->nonatomic = true; -+ -+ for (i = 0; i < ARRAY_SIZE(vpcm->streams); ++i) { -+ struct virtio_pcm_stream *stream = &vpcm->streams[i]; -+ -+ if (!stream->nsubstreams) -+ continue; -+ -+ stream->substreams = -+ devm_kcalloc(&vdev->dev, stream->nsubstreams, -+ sizeof(*stream->substreams), -+ GFP_KERNEL); -+ if (!stream->substreams) -+ return -ENOMEM; -+ -+ stream->nsubstreams = 0; -+ } -+ } -+ -+ for (i = 0; i < snd->nsubstreams; ++i) { -+ struct virtio_pcm_stream *vs; -+ struct virtio_pcm_substream *vss = &snd->substreams[i]; -+ -+ vpcm = virtsnd_pcm_find(snd, vss->nid); -+ if (IS_ERR(vpcm)) -+ return PTR_ERR(vpcm); -+ -+ vs = &vpcm->streams[vss->direction]; -+ vs->substreams[vs->nsubstreams++] = vss; -+ } -+ -+ list_for_each_entry(vpcm, &snd->pcm_list, list) { -+ for (i = 0; i < ARRAY_SIZE(vpcm->streams); ++i) { -+ struct virtio_pcm_stream *vs = &vpcm->streams[i]; -+ struct snd_pcm_str *ks = &vpcm->pcm->streams[i]; -+ struct snd_pcm_substream *kss; -+ -+ if (!vs->nsubstreams) -+ continue; -+ -+ for (kss = ks->substream; kss; kss = kss->next) -+ vs->substreams[kss->number]->substream = kss; -+ } -+ -+ snd_pcm_set_managed_buffer_all(vpcm->pcm, -+ SNDRV_DMA_TYPE_VMALLOC, NULL, -+ 0, 0); -+ } -+ -+ return 0; -+} -diff --git a/sound/virtio/virtio_pcm.h b/sound/virtio/virtio_pcm.h -new file mode 100644 -index 000000000000..84f2f3f14f48 ---- /dev/null -+++ b/sound/virtio/virtio_pcm.h -@@ -0,0 +1,72 @@ -+/* SPDX-License-Identifier: GPL-2.0+ */ -+/* -+ * virtio-snd: Virtio sound device -+ * Copyright (C) 2021 OpenSynergy GmbH -+ */ -+#ifndef VIRTIO_SND_PCM_H -+#define VIRTIO_SND_PCM_H -+ -+#include <linux/atomic.h> -+#include <linux/virtio_config.h> -+#include <sound/pcm.h> -+ -+struct virtio_pcm; -+struct virtio_pcm_msg; -+ -+/** -+ * struct virtio_pcm_substream - VirtIO PCM substream. -+ * @snd: VirtIO sound device. -+ * @nid: Function group node identifier. -+ * @sid: Stream identifier. -+ * @direction: Stream data flow direction (SNDRV_PCM_STREAM_XXX). -+ * @features: Stream VirtIO feature bit map (1 << VIRTIO_SND_PCM_F_XXX). -+ * @substream: Kernel ALSA substream. -+ * @hw: Kernel ALSA substream hardware descriptor. -+ * @elapsed_period: Kernel work to handle the elapsed period state. -+ */ -+struct virtio_pcm_substream { -+ struct virtio_snd *snd; -+ u32 nid; -+ u32 sid; -+ u32 direction; -+ u32 features; -+ struct snd_pcm_substream *substream; -+ struct snd_pcm_hardware hw; -+ struct work_struct elapsed_period; -+}; -+ -+/** -+ * struct virtio_pcm_stream - VirtIO PCM stream. -+ * @substreams: VirtIO substreams belonging to the stream. -+ * @nsubstreams: Number of substreams. -+ */ -+struct virtio_pcm_stream { -+ struct virtio_pcm_substream **substreams; -+ u32 nsubstreams; -+}; -+ -+/** -+ * struct virtio_pcm - VirtIO PCM device. -+ * @list: VirtIO PCM list entry. -+ * @nid: Function group node identifier. -+ * @pcm: Kernel PCM device. -+ * @streams: VirtIO PCM streams (playback and capture). -+ */ -+struct virtio_pcm { -+ struct list_head list; -+ u32 nid; -+ struct snd_pcm *pcm; -+ struct virtio_pcm_stream streams[SNDRV_PCM_STREAM_LAST + 1]; -+}; -+ -+int virtsnd_pcm_validate(struct virtio_device *vdev); -+ -+int virtsnd_pcm_parse_cfg(struct virtio_snd *snd); -+ -+int virtsnd_pcm_build_devs(struct virtio_snd *snd); -+ -+struct virtio_pcm *virtsnd_pcm_find(struct virtio_snd *snd, u32 nid); -+ -+struct virtio_pcm *virtsnd_pcm_find_or_create(struct virtio_snd *snd, u32 nid); -+ -+#endif /* VIRTIO_SND_PCM_H */ diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0005-ALSA-virtio-handling-control-and-I-O-messages-for-th.patch b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0005-ALSA-virtio-handling-control-and-I-O-messages-for-th.patch deleted file mode 100644 index 3a63a530b..000000000 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0005-ALSA-virtio-handling-control-and-I-O-messages-for-th.patch +++ /dev/null @@ -1,645 +0,0 @@ -From e60175c8c7a51861c6f31af4cf99b95f3da7a59f Mon Sep 17 00:00:00 2001 -From: Anton Yakovlev <anton.yakovlev@opensynergy.com> -Date: Tue, 2 Mar 2021 17:47:05 +0100 -Subject: [PATCH] ALSA: virtio: handling control and I/O messages for the PCM - device - -The driver implements a message-based transport for I/O substream -operations. Before the start of the substream, the hardware buffer is -sliced into I/O messages, the number of which is equal to the current -number of periods. The size of each message is equal to the current -size of one period. - -I/O messages are organized in an ordered queue. The completion of the -I/O message indicates an elapsed period (the only exception is the end -of the stream for the capture substream). Upon completion, the message -is automatically re-added to the end of the queue. - -Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> -Link: https://lore.kernel.org/r/20210302164709.3142702-6-anton.yakovlev@opensynergy.com -Signed-off-by: Takashi Iwai <tiwai@suse.de> -Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com> ---- - sound/virtio/Makefile | 3 +- - sound/virtio/virtio_card.c | 22 +- - sound/virtio/virtio_card.h | 9 + - sound/virtio/virtio_pcm.c | 32 +++ - sound/virtio/virtio_pcm.h | 40 ++++ - sound/virtio/virtio_pcm_msg.c | 414 ++++++++++++++++++++++++++++++++++ - 6 files changed, 515 insertions(+), 5 deletions(-) - create mode 100644 sound/virtio/virtio_pcm_msg.c - -diff --git a/sound/virtio/Makefile b/sound/virtio/Makefile -index 69162a545a41..626af3cc3ed7 100644 ---- a/sound/virtio/Makefile -+++ b/sound/virtio/Makefile -@@ -5,5 +5,6 @@ obj-$(CONFIG_SND_VIRTIO) += virtio_snd.o - virtio_snd-objs := \ - virtio_card.o \ - virtio_ctl_msg.o \ -- virtio_pcm.o -+ virtio_pcm.o \ -+ virtio_pcm_msg.o - -diff --git a/sound/virtio/virtio_card.c b/sound/virtio/virtio_card.c -index 11c76ee311b7..57b9b7f3a9c0 100644 ---- a/sound/virtio/virtio_card.c -+++ b/sound/virtio/virtio_card.c -@@ -55,6 +55,12 @@ static void virtsnd_event_send(struct virtqueue *vqueue, - static void virtsnd_event_dispatch(struct virtio_snd *snd, - struct virtio_snd_event *event) - { -+ switch (le32_to_cpu(event->hdr.code)) { -+ case VIRTIO_SND_EVT_PCM_PERIOD_ELAPSED: -+ case VIRTIO_SND_EVT_PCM_XRUN: -+ virtsnd_pcm_event(snd, event); -+ break; -+ } - } - - /** -@@ -101,11 +107,15 @@ static int virtsnd_find_vqs(struct virtio_snd *snd) - struct virtio_device *vdev = snd->vdev; - static vq_callback_t *callbacks[VIRTIO_SND_VQ_MAX] = { - [VIRTIO_SND_VQ_CONTROL] = virtsnd_ctl_notify_cb, -- [VIRTIO_SND_VQ_EVENT] = virtsnd_event_notify_cb -+ [VIRTIO_SND_VQ_EVENT] = virtsnd_event_notify_cb, -+ [VIRTIO_SND_VQ_TX] = virtsnd_pcm_tx_notify_cb, -+ [VIRTIO_SND_VQ_RX] = virtsnd_pcm_rx_notify_cb - }; - static const char *names[VIRTIO_SND_VQ_MAX] = { - [VIRTIO_SND_VQ_CONTROL] = "virtsnd-ctl", -- [VIRTIO_SND_VQ_EVENT] = "virtsnd-event" -+ [VIRTIO_SND_VQ_EVENT] = "virtsnd-event", -+ [VIRTIO_SND_VQ_TX] = "virtsnd-tx", -+ [VIRTIO_SND_VQ_RX] = "virtsnd-rx" - }; - struct virtqueue *vqs[VIRTIO_SND_VQ_MAX] = { 0 }; - unsigned int i; -@@ -318,8 +328,12 @@ static void virtsnd_remove(struct virtio_device *vdev) - vdev->config->del_vqs(vdev); - vdev->config->reset(vdev); - -- for (i = 0; snd->substreams && i < snd->nsubstreams; ++i) -- cancel_work_sync(&snd->substreams[i].elapsed_period); -+ for (i = 0; snd->substreams && i < snd->nsubstreams; ++i) { -+ struct virtio_pcm_substream *vss = &snd->substreams[i]; -+ -+ cancel_work_sync(&vss->elapsed_period); -+ virtsnd_pcm_msg_free(vss); -+ } - - kfree(snd->event_msgs); - } -diff --git a/sound/virtio/virtio_card.h b/sound/virtio/virtio_card.h -index 77a1b7255370..c43f9744d362 100644 ---- a/sound/virtio/virtio_card.h -+++ b/sound/virtio/virtio_card.h -@@ -79,4 +79,13 @@ virtsnd_rx_queue(struct virtio_snd *snd) - return &snd->queues[VIRTIO_SND_VQ_RX]; - } - -+static inline struct virtio_snd_queue * -+virtsnd_pcm_queue(struct virtio_pcm_substream *vss) -+{ -+ if (vss->direction == SNDRV_PCM_STREAM_PLAYBACK) -+ return virtsnd_tx_queue(vss->snd); -+ else -+ return virtsnd_rx_queue(vss->snd); -+} -+ - #endif /* VIRTIO_SND_CARD_H */ -diff --git a/sound/virtio/virtio_pcm.c b/sound/virtio/virtio_pcm.c -index e16567e2e214..2dcd763efa29 100644 ---- a/sound/virtio/virtio_pcm.c -+++ b/sound/virtio/virtio_pcm.c -@@ -353,6 +353,8 @@ int virtsnd_pcm_parse_cfg(struct virtio_snd *snd) - vss->snd = snd; - vss->sid = i; - INIT_WORK(&vss->elapsed_period, virtsnd_pcm_period_elapsed); -+ init_waitqueue_head(&vss->msg_empty); -+ spin_lock_init(&vss->lock); - - rc = virtsnd_pcm_build_hw(vss, &info[i]); - if (rc) -@@ -477,3 +479,33 @@ int virtsnd_pcm_build_devs(struct virtio_snd *snd) - - return 0; - } -+ -+/** -+ * virtsnd_pcm_event() - Handle the PCM device event notification. -+ * @snd: VirtIO sound device. -+ * @event: VirtIO sound event. -+ * -+ * Context: Interrupt context. -+ */ -+void virtsnd_pcm_event(struct virtio_snd *snd, struct virtio_snd_event *event) -+{ -+ struct virtio_pcm_substream *vss; -+ u32 sid = le32_to_cpu(event->data); -+ -+ if (sid >= snd->nsubstreams) -+ return; -+ -+ vss = &snd->substreams[sid]; -+ -+ switch (le32_to_cpu(event->hdr.code)) { -+ case VIRTIO_SND_EVT_PCM_PERIOD_ELAPSED: -+ /* TODO: deal with shmem elapsed period */ -+ break; -+ case VIRTIO_SND_EVT_PCM_XRUN: -+ spin_lock(&vss->lock); -+ if (vss->xfer_enabled) -+ vss->xfer_xrun = true; -+ spin_unlock(&vss->lock); -+ break; -+ } -+} -diff --git a/sound/virtio/virtio_pcm.h b/sound/virtio/virtio_pcm.h -index 84f2f3f14f48..6722f1139666 100644 ---- a/sound/virtio/virtio_pcm.h -+++ b/sound/virtio/virtio_pcm.h -@@ -23,6 +23,17 @@ struct virtio_pcm_msg; - * @substream: Kernel ALSA substream. - * @hw: Kernel ALSA substream hardware descriptor. - * @elapsed_period: Kernel work to handle the elapsed period state. -+ * @lock: Spinlock that protects fields shared by interrupt handlers and -+ * substream operators. -+ * @buffer_bytes: Current buffer size in bytes. -+ * @hw_ptr: Substream hardware pointer value in bytes [0 ... buffer_bytes). -+ * @xfer_enabled: Data transfer state (0 - off, 1 - on). -+ * @xfer_xrun: Data underflow/overflow state (0 - no xrun, 1 - xrun). -+ * @msgs: Allocated I/O messages. -+ * @nmsgs: Number of allocated I/O messages. -+ * @msg_last_enqueued: Index of the last I/O message added to the virtqueue. -+ * @msg_count: Number of pending I/O messages in the virtqueue. -+ * @msg_empty: Notify when msg_count is zero. - */ - struct virtio_pcm_substream { - struct virtio_snd *snd; -@@ -33,6 +44,16 @@ struct virtio_pcm_substream { - struct snd_pcm_substream *substream; - struct snd_pcm_hardware hw; - struct work_struct elapsed_period; -+ spinlock_t lock; -+ size_t buffer_bytes; -+ size_t hw_ptr; -+ bool xfer_enabled; -+ bool xfer_xrun; -+ struct virtio_pcm_msg **msgs; -+ unsigned int nmsgs; -+ int msg_last_enqueued; -+ unsigned int msg_count; -+ wait_queue_head_t msg_empty; - }; - - /** -@@ -65,8 +86,27 @@ int virtsnd_pcm_parse_cfg(struct virtio_snd *snd); - - int virtsnd_pcm_build_devs(struct virtio_snd *snd); - -+void virtsnd_pcm_event(struct virtio_snd *snd, struct virtio_snd_event *event); -+ -+void virtsnd_pcm_tx_notify_cb(struct virtqueue *vqueue); -+ -+void virtsnd_pcm_rx_notify_cb(struct virtqueue *vqueue); -+ - struct virtio_pcm *virtsnd_pcm_find(struct virtio_snd *snd, u32 nid); - - struct virtio_pcm *virtsnd_pcm_find_or_create(struct virtio_snd *snd, u32 nid); - -+struct virtio_snd_msg * -+virtsnd_pcm_ctl_msg_alloc(struct virtio_pcm_substream *vss, -+ unsigned int command, gfp_t gfp); -+ -+int virtsnd_pcm_msg_alloc(struct virtio_pcm_substream *vss, -+ unsigned int periods, unsigned int period_bytes); -+ -+void virtsnd_pcm_msg_free(struct virtio_pcm_substream *vss); -+ -+int virtsnd_pcm_msg_send(struct virtio_pcm_substream *vss); -+ -+unsigned int virtsnd_pcm_msg_pending_num(struct virtio_pcm_substream *vss); -+ - #endif /* VIRTIO_SND_PCM_H */ -diff --git a/sound/virtio/virtio_pcm_msg.c b/sound/virtio/virtio_pcm_msg.c -new file mode 100644 -index 000000000000..f88c8f29cbd8 ---- /dev/null -+++ b/sound/virtio/virtio_pcm_msg.c -@@ -0,0 +1,414 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * virtio-snd: Virtio sound device -+ * Copyright (C) 2021 OpenSynergy GmbH -+ */ -+#include <sound/pcm_params.h> -+ -+#include "virtio_card.h" -+ -+/** -+ * struct virtio_pcm_msg - VirtIO I/O message. -+ * @substream: VirtIO PCM substream. -+ * @xfer: Request header payload. -+ * @status: Response header payload. -+ * @length: Data length in bytes. -+ * @sgs: Payload scatter-gather table. -+ */ -+struct virtio_pcm_msg { -+ struct virtio_pcm_substream *substream; -+ struct virtio_snd_pcm_xfer xfer; -+ struct virtio_snd_pcm_status status; -+ size_t length; -+ struct scatterlist sgs[0]; -+}; -+ -+/** -+ * enum pcm_msg_sg_index - Index values for the virtio_pcm_msg->sgs field in -+ * an I/O message. -+ * @PCM_MSG_SG_XFER: Element containing a virtio_snd_pcm_xfer structure. -+ * @PCM_MSG_SG_STATUS: Element containing a virtio_snd_pcm_status structure. -+ * @PCM_MSG_SG_DATA: The first element containing a data buffer. -+ */ -+enum pcm_msg_sg_index { -+ PCM_MSG_SG_XFER = 0, -+ PCM_MSG_SG_STATUS, -+ PCM_MSG_SG_DATA -+}; -+ -+/** -+ * virtsnd_pcm_sg_num() - Count the number of sg-elements required to represent -+ * vmalloc'ed buffer. -+ * @data: Pointer to vmalloc'ed buffer. -+ * @length: Buffer size. -+ * -+ * Context: Any context. -+ * Return: Number of physically contiguous parts in the @data. -+ */ -+static int virtsnd_pcm_sg_num(u8 *data, unsigned int length) -+{ -+ phys_addr_t sg_address; -+ unsigned int sg_length; -+ int num = 0; -+ -+ while (length) { -+ struct page *pg = vmalloc_to_page(data); -+ phys_addr_t pg_address = page_to_phys(pg); -+ size_t pg_length; -+ -+ pg_length = PAGE_SIZE - offset_in_page(data); -+ if (pg_length > length) -+ pg_length = length; -+ -+ if (!num || sg_address + sg_length != pg_address) { -+ sg_address = pg_address; -+ sg_length = pg_length; -+ num++; -+ } else { -+ sg_length += pg_length; -+ } -+ -+ data += pg_length; -+ length -= pg_length; -+ } -+ -+ return num; -+} -+ -+/** -+ * virtsnd_pcm_sg_from() - Build sg-list from vmalloc'ed buffer. -+ * @sgs: Preallocated sg-list to populate. -+ * @nsgs: The maximum number of elements in the @sgs. -+ * @data: Pointer to vmalloc'ed buffer. -+ * @length: Buffer size. -+ * -+ * Splits the buffer into physically contiguous parts and makes an sg-list of -+ * such parts. -+ * -+ * Context: Any context. -+ */ -+static void virtsnd_pcm_sg_from(struct scatterlist *sgs, int nsgs, u8 *data, -+ unsigned int length) -+{ -+ int idx = -1; -+ -+ while (length) { -+ struct page *pg = vmalloc_to_page(data); -+ size_t pg_length; -+ -+ pg_length = PAGE_SIZE - offset_in_page(data); -+ if (pg_length > length) -+ pg_length = length; -+ -+ if (idx == -1 || -+ sg_phys(&sgs[idx]) + sgs[idx].length != page_to_phys(pg)) { -+ if (idx + 1 == nsgs) -+ break; -+ sg_set_page(&sgs[++idx], pg, pg_length, -+ offset_in_page(data)); -+ } else { -+ sgs[idx].length += pg_length; -+ } -+ -+ data += pg_length; -+ length -= pg_length; -+ } -+ -+ sg_mark_end(&sgs[idx]); -+} -+ -+/** -+ * virtsnd_pcm_msg_alloc() - Allocate I/O messages. -+ * @vss: VirtIO PCM substream. -+ * @periods: Current number of periods. -+ * @period_bytes: Current period size in bytes. -+ * -+ * The function slices the buffer into @periods parts (each with the size of -+ * @period_bytes), and creates @periods corresponding I/O messages. -+ * -+ * Context: Any context that permits to sleep. -+ * Return: 0 on success, -ENOMEM on failure. -+ */ -+int virtsnd_pcm_msg_alloc(struct virtio_pcm_substream *vss, -+ unsigned int periods, unsigned int period_bytes) -+{ -+ struct snd_pcm_runtime *runtime = vss->substream->runtime; -+ unsigned int i; -+ -+ vss->msgs = kcalloc(periods, sizeof(*vss->msgs), GFP_KERNEL); -+ if (!vss->msgs) -+ return -ENOMEM; -+ -+ vss->nmsgs = periods; -+ -+ for (i = 0; i < periods; ++i) { -+ u8 *data = runtime->dma_area + period_bytes * i; -+ int sg_num = virtsnd_pcm_sg_num(data, period_bytes); -+ struct virtio_pcm_msg *msg; -+ -+ msg = kzalloc(sizeof(*msg) + sizeof(*msg->sgs) * (sg_num + 2), -+ GFP_KERNEL); -+ if (!msg) -+ return -ENOMEM; -+ -+ msg->substream = vss; -+ sg_init_one(&msg->sgs[PCM_MSG_SG_XFER], &msg->xfer, -+ sizeof(msg->xfer)); -+ sg_init_one(&msg->sgs[PCM_MSG_SG_STATUS], &msg->status, -+ sizeof(msg->status)); -+ msg->length = period_bytes; -+ virtsnd_pcm_sg_from(&msg->sgs[PCM_MSG_SG_DATA], sg_num, data, -+ period_bytes); -+ -+ vss->msgs[i] = msg; -+ } -+ -+ return 0; -+} -+ -+/** -+ * virtsnd_pcm_msg_free() - Free all allocated I/O messages. -+ * @vss: VirtIO PCM substream. -+ * -+ * Context: Any context. -+ */ -+void virtsnd_pcm_msg_free(struct virtio_pcm_substream *vss) -+{ -+ unsigned int i; -+ -+ for (i = 0; vss->msgs && i < vss->nmsgs; ++i) -+ kfree(vss->msgs[i]); -+ kfree(vss->msgs); -+ -+ vss->msgs = NULL; -+ vss->nmsgs = 0; -+} -+ -+/** -+ * virtsnd_pcm_msg_send() - Send asynchronous I/O messages. -+ * @vss: VirtIO PCM substream. -+ * -+ * All messages are organized in an ordered circular list. Each time the -+ * function is called, all currently non-enqueued messages are added to the -+ * virtqueue. For this, the function keeps track of two values: -+ * -+ * msg_last_enqueued = index of the last enqueued message, -+ * msg_count = # of pending messages in the virtqueue. -+ * -+ * Context: Any context. Expects the tx/rx queue and the VirtIO substream -+ * spinlocks to be held by caller. -+ * Return: 0 on success, -errno on failure. -+ */ -+int virtsnd_pcm_msg_send(struct virtio_pcm_substream *vss) -+{ -+ struct snd_pcm_runtime *runtime = vss->substream->runtime; -+ struct virtio_snd *snd = vss->snd; -+ struct virtio_device *vdev = snd->vdev; -+ struct virtqueue *vqueue = virtsnd_pcm_queue(vss)->vqueue; -+ int i; -+ int n; -+ bool notify = false; -+ -+ i = (vss->msg_last_enqueued + 1) % runtime->periods; -+ n = runtime->periods - vss->msg_count; -+ -+ for (; n; --n, i = (i + 1) % runtime->periods) { -+ struct virtio_pcm_msg *msg = vss->msgs[i]; -+ struct scatterlist *psgs[] = { -+ &msg->sgs[PCM_MSG_SG_XFER], -+ &msg->sgs[PCM_MSG_SG_DATA], -+ &msg->sgs[PCM_MSG_SG_STATUS] -+ }; -+ int rc; -+ -+ msg->xfer.stream_id = cpu_to_le32(vss->sid); -+ memset(&msg->status, 0, sizeof(msg->status)); -+ -+ if (vss->direction == SNDRV_PCM_STREAM_PLAYBACK) -+ rc = virtqueue_add_sgs(vqueue, psgs, 2, 1, msg, -+ GFP_ATOMIC); -+ else -+ rc = virtqueue_add_sgs(vqueue, psgs, 1, 2, msg, -+ GFP_ATOMIC); -+ -+ if (rc) { -+ dev_err(&vdev->dev, -+ "SID %u: failed to send I/O message\n", -+ vss->sid); -+ return rc; -+ } -+ -+ vss->msg_last_enqueued = i; -+ vss->msg_count++; -+ } -+ -+ if (!(vss->features & (1U << VIRTIO_SND_PCM_F_MSG_POLLING))) -+ notify = virtqueue_kick_prepare(vqueue); -+ -+ if (notify) -+ virtqueue_notify(vqueue); -+ -+ return 0; -+} -+ -+/** -+ * virtsnd_pcm_msg_pending_num() - Returns the number of pending I/O messages. -+ * @vss: VirtIO substream. -+ * -+ * Context: Any context. -+ * Return: Number of messages. -+ */ -+unsigned int virtsnd_pcm_msg_pending_num(struct virtio_pcm_substream *vss) -+{ -+ unsigned int num; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&vss->lock, flags); -+ num = vss->msg_count; -+ spin_unlock_irqrestore(&vss->lock, flags); -+ -+ return num; -+} -+ -+/** -+ * virtsnd_pcm_msg_complete() - Complete an I/O message. -+ * @msg: I/O message. -+ * @written_bytes: Number of bytes written to the message. -+ * -+ * Completion of the message means the elapsed period. If transmission is -+ * allowed, then each completed message is immediately placed back at the end -+ * of the queue. -+ * -+ * For the playback substream, @written_bytes is equal to sizeof(msg->status). -+ * -+ * For the capture substream, @written_bytes is equal to sizeof(msg->status) -+ * plus the number of captured bytes. -+ * -+ * Context: Interrupt context. Takes and releases the VirtIO substream spinlock. -+ */ -+static void virtsnd_pcm_msg_complete(struct virtio_pcm_msg *msg, -+ size_t written_bytes) -+{ -+ struct virtio_pcm_substream *vss = msg->substream; -+ -+ /* -+ * hw_ptr always indicates the buffer position of the first I/O message -+ * in the virtqueue. Therefore, on each completion of an I/O message, -+ * the hw_ptr value is unconditionally advanced. -+ */ -+ spin_lock(&vss->lock); -+ /* -+ * If the capture substream returned an incorrect status, then just -+ * increase the hw_ptr by the message size. -+ */ -+ if (vss->direction == SNDRV_PCM_STREAM_PLAYBACK || -+ written_bytes <= sizeof(msg->status)) -+ vss->hw_ptr += msg->length; -+ else -+ vss->hw_ptr += written_bytes - sizeof(msg->status); -+ -+ if (vss->hw_ptr >= vss->buffer_bytes) -+ vss->hw_ptr -= vss->buffer_bytes; -+ -+ vss->xfer_xrun = false; -+ vss->msg_count--; -+ -+ if (vss->xfer_enabled) { -+ struct snd_pcm_runtime *runtime = vss->substream->runtime; -+ -+ runtime->delay = -+ bytes_to_frames(runtime, -+ le32_to_cpu(msg->status.latency_bytes)); -+ -+ schedule_work(&vss->elapsed_period); -+ -+ virtsnd_pcm_msg_send(vss); -+ } else if (!vss->msg_count) { -+ wake_up_all(&vss->msg_empty); -+ } -+ spin_unlock(&vss->lock); -+} -+ -+/** -+ * virtsnd_pcm_notify_cb() - Process all completed I/O messages. -+ * @queue: Underlying tx/rx virtqueue. -+ * -+ * Context: Interrupt context. Takes and releases the tx/rx queue spinlock. -+ */ -+static inline void virtsnd_pcm_notify_cb(struct virtio_snd_queue *queue) -+{ -+ struct virtio_pcm_msg *msg; -+ u32 written_bytes; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&queue->lock, flags); -+ do { -+ virtqueue_disable_cb(queue->vqueue); -+ while ((msg = virtqueue_get_buf(queue->vqueue, &written_bytes))) -+ virtsnd_pcm_msg_complete(msg, written_bytes); -+ if (unlikely(virtqueue_is_broken(queue->vqueue))) -+ break; -+ } while (!virtqueue_enable_cb(queue->vqueue)); -+ spin_unlock_irqrestore(&queue->lock, flags); -+} -+ -+/** -+ * virtsnd_pcm_tx_notify_cb() - Process all completed TX messages. -+ * @vqueue: Underlying tx virtqueue. -+ * -+ * Context: Interrupt context. -+ */ -+void virtsnd_pcm_tx_notify_cb(struct virtqueue *vqueue) -+{ -+ struct virtio_snd *snd = vqueue->vdev->priv; -+ -+ virtsnd_pcm_notify_cb(virtsnd_tx_queue(snd)); -+} -+ -+/** -+ * virtsnd_pcm_rx_notify_cb() - Process all completed RX messages. -+ * @vqueue: Underlying rx virtqueue. -+ * -+ * Context: Interrupt context. -+ */ -+void virtsnd_pcm_rx_notify_cb(struct virtqueue *vqueue) -+{ -+ struct virtio_snd *snd = vqueue->vdev->priv; -+ -+ virtsnd_pcm_notify_cb(virtsnd_rx_queue(snd)); -+} -+ -+/** -+ * virtsnd_pcm_ctl_msg_alloc() - Allocate and initialize the PCM device control -+ * message for the specified substream. -+ * @vss: VirtIO PCM substream. -+ * @command: Control request code (VIRTIO_SND_R_PCM_XXX). -+ * @gfp: Kernel flags for memory allocation. -+ * -+ * Context: Any context. May sleep if @gfp flags permit. -+ * Return: Allocated message on success, NULL on failure. -+ */ -+struct virtio_snd_msg * -+virtsnd_pcm_ctl_msg_alloc(struct virtio_pcm_substream *vss, -+ unsigned int command, gfp_t gfp) -+{ -+ size_t request_size = sizeof(struct virtio_snd_pcm_hdr); -+ size_t response_size = sizeof(struct virtio_snd_hdr); -+ struct virtio_snd_msg *msg; -+ -+ switch (command) { -+ case VIRTIO_SND_R_PCM_SET_PARAMS: -+ request_size = sizeof(struct virtio_snd_pcm_set_params); -+ break; -+ } -+ -+ msg = virtsnd_ctl_msg_alloc(request_size, response_size, gfp); -+ if (msg) { -+ struct virtio_snd_pcm_hdr *hdr = virtsnd_ctl_msg_request(msg); -+ -+ hdr->hdr.code = cpu_to_le32(command); -+ hdr->stream_id = cpu_to_le32(vss->sid); -+ } -+ -+ return msg; -+} diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0006-ALSA-virtio-PCM-substream-operators.patch b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0006-ALSA-virtio-PCM-substream-operators.patch deleted file mode 100644 index 9196b34e4..000000000 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0006-ALSA-virtio-PCM-substream-operators.patch +++ /dev/null @@ -1,525 +0,0 @@ -From 93c313dc4fc78b077bb0911afe3a77ffa845ad58 Mon Sep 17 00:00:00 2001 -From: Anton Yakovlev <anton.yakovlev@opensynergy.com> -Date: Tue, 2 Mar 2021 17:47:06 +0100 -Subject: [PATCH] ALSA: virtio: PCM substream operators - -Introduce the operators required for the operation of substreams. - -Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> -Link: https://lore.kernel.org/r/20210302164709.3142702-7-anton.yakovlev@opensynergy.com -Signed-off-by: Takashi Iwai <tiwai@suse.de> -Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com> ---- - sound/virtio/Makefile | 3 +- - sound/virtio/virtio_pcm.c | 2 + - sound/virtio/virtio_pcm.h | 5 + - sound/virtio/virtio_pcm_ops.c | 445 ++++++++++++++++++++++++++++++++++ - 4 files changed, 454 insertions(+), 1 deletion(-) - create mode 100644 sound/virtio/virtio_pcm_ops.c - -diff --git a/sound/virtio/Makefile b/sound/virtio/Makefile -index 626af3cc3ed7..34493226793f 100644 ---- a/sound/virtio/Makefile -+++ b/sound/virtio/Makefile -@@ -6,5 +6,6 @@ virtio_snd-objs := \ - virtio_card.o \ - virtio_ctl_msg.o \ - virtio_pcm.o \ -- virtio_pcm_msg.o -+ virtio_pcm_msg.o \ -+ virtio_pcm_ops.o - -diff --git a/sound/virtio/virtio_pcm.c b/sound/virtio/virtio_pcm.c -index 2dcd763efa29..c10d91fff2fb 100644 ---- a/sound/virtio/virtio_pcm.c -+++ b/sound/virtio/virtio_pcm.c -@@ -470,6 +470,8 @@ int virtsnd_pcm_build_devs(struct virtio_snd *snd) - - for (kss = ks->substream; kss; kss = kss->next) - vs->substreams[kss->number]->substream = kss; -+ -+ snd_pcm_set_ops(vpcm->pcm, i, &virtsnd_pcm_ops); - } - - snd_pcm_set_managed_buffer_all(vpcm->pcm, -diff --git a/sound/virtio/virtio_pcm.h b/sound/virtio/virtio_pcm.h -index 6722f1139666..efd0228746cf 100644 ---- a/sound/virtio/virtio_pcm.h -+++ b/sound/virtio/virtio_pcm.h -@@ -29,6 +29,8 @@ struct virtio_pcm_msg; - * @hw_ptr: Substream hardware pointer value in bytes [0 ... buffer_bytes). - * @xfer_enabled: Data transfer state (0 - off, 1 - on). - * @xfer_xrun: Data underflow/overflow state (0 - no xrun, 1 - xrun). -+ * @stopped: True if the substream is stopped and must be released on the device -+ * side. - * @msgs: Allocated I/O messages. - * @nmsgs: Number of allocated I/O messages. - * @msg_last_enqueued: Index of the last I/O message added to the virtqueue. -@@ -49,6 +51,7 @@ struct virtio_pcm_substream { - size_t hw_ptr; - bool xfer_enabled; - bool xfer_xrun; -+ bool stopped; - struct virtio_pcm_msg **msgs; - unsigned int nmsgs; - int msg_last_enqueued; -@@ -80,6 +83,8 @@ struct virtio_pcm { - struct virtio_pcm_stream streams[SNDRV_PCM_STREAM_LAST + 1]; - }; - -+extern const struct snd_pcm_ops virtsnd_pcm_ops; -+ - int virtsnd_pcm_validate(struct virtio_device *vdev); - - int virtsnd_pcm_parse_cfg(struct virtio_snd *snd); -diff --git a/sound/virtio/virtio_pcm_ops.c b/sound/virtio/virtio_pcm_ops.c -new file mode 100644 -index 000000000000..0682a2df6c8c ---- /dev/null -+++ b/sound/virtio/virtio_pcm_ops.c -@@ -0,0 +1,445 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * virtio-snd: Virtio sound device -+ * Copyright (C) 2021 OpenSynergy GmbH -+ */ -+#include <sound/pcm_params.h> -+ -+#include "virtio_card.h" -+ -+/* -+ * I/O messages lifetime -+ * --------------------- -+ * -+ * Allocation: -+ * Messages are initially allocated in the ops->hw_params() after the size and -+ * number of periods have been successfully negotiated. -+ * -+ * Freeing: -+ * Messages can be safely freed after the queue has been successfully flushed -+ * (RELEASE command in the ops->sync_stop()) and the ops->hw_free() has been -+ * called. -+ * -+ * When the substream stops, the ops->sync_stop() waits until the device has -+ * completed all pending messages. This wait can be interrupted either by a -+ * signal or due to a timeout. In this case, the device can still access -+ * messages even after calling ops->hw_free(). It can also issue an interrupt, -+ * and the interrupt handler will also try to access message structures. -+ * -+ * Therefore, freeing of already allocated messages occurs: -+ * -+ * - in ops->hw_params(), if this operator was called several times in a row, -+ * or if ops->hw_free() failed to free messages previously; -+ * -+ * - in ops->hw_free(), if the queue has been successfully flushed; -+ * -+ * - in dev->release(). -+ */ -+ -+/* Map for converting ALSA format to VirtIO format. */ -+struct virtsnd_a2v_format { -+ snd_pcm_format_t alsa_bit; -+ unsigned int vio_bit; -+}; -+ -+static const struct virtsnd_a2v_format g_a2v_format_map[] = { -+ { SNDRV_PCM_FORMAT_IMA_ADPCM, VIRTIO_SND_PCM_FMT_IMA_ADPCM }, -+ { SNDRV_PCM_FORMAT_MU_LAW, VIRTIO_SND_PCM_FMT_MU_LAW }, -+ { SNDRV_PCM_FORMAT_A_LAW, VIRTIO_SND_PCM_FMT_A_LAW }, -+ { SNDRV_PCM_FORMAT_S8, VIRTIO_SND_PCM_FMT_S8 }, -+ { SNDRV_PCM_FORMAT_U8, VIRTIO_SND_PCM_FMT_U8 }, -+ { SNDRV_PCM_FORMAT_S16_LE, VIRTIO_SND_PCM_FMT_S16 }, -+ { SNDRV_PCM_FORMAT_U16_LE, VIRTIO_SND_PCM_FMT_U16 }, -+ { SNDRV_PCM_FORMAT_S18_3LE, VIRTIO_SND_PCM_FMT_S18_3 }, -+ { SNDRV_PCM_FORMAT_U18_3LE, VIRTIO_SND_PCM_FMT_U18_3 }, -+ { SNDRV_PCM_FORMAT_S20_3LE, VIRTIO_SND_PCM_FMT_S20_3 }, -+ { SNDRV_PCM_FORMAT_U20_3LE, VIRTIO_SND_PCM_FMT_U20_3 }, -+ { SNDRV_PCM_FORMAT_S24_3LE, VIRTIO_SND_PCM_FMT_S24_3 }, -+ { SNDRV_PCM_FORMAT_U24_3LE, VIRTIO_SND_PCM_FMT_U24_3 }, -+ { SNDRV_PCM_FORMAT_S20_LE, VIRTIO_SND_PCM_FMT_S20 }, -+ { SNDRV_PCM_FORMAT_U20_LE, VIRTIO_SND_PCM_FMT_U20 }, -+ { SNDRV_PCM_FORMAT_S24_LE, VIRTIO_SND_PCM_FMT_S24 }, -+ { SNDRV_PCM_FORMAT_U24_LE, VIRTIO_SND_PCM_FMT_U24 }, -+ { SNDRV_PCM_FORMAT_S32_LE, VIRTIO_SND_PCM_FMT_S32 }, -+ { SNDRV_PCM_FORMAT_U32_LE, VIRTIO_SND_PCM_FMT_U32 }, -+ { SNDRV_PCM_FORMAT_FLOAT_LE, VIRTIO_SND_PCM_FMT_FLOAT }, -+ { SNDRV_PCM_FORMAT_FLOAT64_LE, VIRTIO_SND_PCM_FMT_FLOAT64 }, -+ { SNDRV_PCM_FORMAT_DSD_U8, VIRTIO_SND_PCM_FMT_DSD_U8 }, -+ { SNDRV_PCM_FORMAT_DSD_U16_LE, VIRTIO_SND_PCM_FMT_DSD_U16 }, -+ { SNDRV_PCM_FORMAT_DSD_U32_LE, VIRTIO_SND_PCM_FMT_DSD_U32 }, -+ { SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE, -+ VIRTIO_SND_PCM_FMT_IEC958_SUBFRAME } -+}; -+ -+/* Map for converting ALSA frame rate to VirtIO frame rate. */ -+struct virtsnd_a2v_rate { -+ unsigned int rate; -+ unsigned int vio_bit; -+}; -+ -+static const struct virtsnd_a2v_rate g_a2v_rate_map[] = { -+ { 5512, VIRTIO_SND_PCM_RATE_5512 }, -+ { 8000, VIRTIO_SND_PCM_RATE_8000 }, -+ { 11025, VIRTIO_SND_PCM_RATE_11025 }, -+ { 16000, VIRTIO_SND_PCM_RATE_16000 }, -+ { 22050, VIRTIO_SND_PCM_RATE_22050 }, -+ { 32000, VIRTIO_SND_PCM_RATE_32000 }, -+ { 44100, VIRTIO_SND_PCM_RATE_44100 }, -+ { 48000, VIRTIO_SND_PCM_RATE_48000 }, -+ { 64000, VIRTIO_SND_PCM_RATE_64000 }, -+ { 88200, VIRTIO_SND_PCM_RATE_88200 }, -+ { 96000, VIRTIO_SND_PCM_RATE_96000 }, -+ { 176400, VIRTIO_SND_PCM_RATE_176400 }, -+ { 192000, VIRTIO_SND_PCM_RATE_192000 } -+}; -+ -+static int virtsnd_pcm_sync_stop(struct snd_pcm_substream *substream); -+ -+/** -+ * virtsnd_pcm_open() - Open the PCM substream. -+ * @substream: Kernel ALSA substream. -+ * -+ * Context: Process context. -+ * Return: 0 on success, -errno on failure. -+ */ -+static int virtsnd_pcm_open(struct snd_pcm_substream *substream) -+{ -+ struct virtio_pcm *vpcm = snd_pcm_substream_chip(substream); -+ struct virtio_pcm_stream *vs = &vpcm->streams[substream->stream]; -+ struct virtio_pcm_substream *vss = vs->substreams[substream->number]; -+ -+ substream->runtime->hw = vss->hw; -+ substream->private_data = vss; -+ -+ snd_pcm_hw_constraint_integer(substream->runtime, -+ SNDRV_PCM_HW_PARAM_PERIODS); -+ -+ vss->stopped = !!virtsnd_pcm_msg_pending_num(vss); -+ -+ /* -+ * If the substream has already been used, then the I/O queue may be in -+ * an invalid state. Just in case, we do a check and try to return the -+ * queue to its original state, if necessary. -+ */ -+ return virtsnd_pcm_sync_stop(substream); -+} -+ -+/** -+ * virtsnd_pcm_close() - Close the PCM substream. -+ * @substream: Kernel ALSA substream. -+ * -+ * Context: Process context. -+ * Return: 0. -+ */ -+static int virtsnd_pcm_close(struct snd_pcm_substream *substream) -+{ -+ return 0; -+} -+ -+/** -+ * virtsnd_pcm_dev_set_params() - Set the parameters of the PCM substream on -+ * the device side. -+ * @vss: VirtIO PCM substream. -+ * @buffer_bytes: Size of the hardware buffer. -+ * @period_bytes: Size of the hardware period. -+ * @channels: Selected number of channels. -+ * @format: Selected sample format (SNDRV_PCM_FORMAT_XXX). -+ * @rate: Selected frame rate. -+ * -+ * Context: Any context that permits to sleep. -+ * Return: 0 on success, -errno on failure. -+ */ -+static int virtsnd_pcm_dev_set_params(struct virtio_pcm_substream *vss, -+ unsigned int buffer_bytes, -+ unsigned int period_bytes, -+ unsigned int channels, -+ snd_pcm_format_t format, -+ unsigned int rate) -+{ -+ struct virtio_snd_msg *msg; -+ struct virtio_snd_pcm_set_params *request; -+ unsigned int i; -+ int vformat = -1; -+ int vrate = -1; -+ -+ for (i = 0; i < ARRAY_SIZE(g_a2v_format_map); ++i) -+ if (g_a2v_format_map[i].alsa_bit == format) { -+ vformat = g_a2v_format_map[i].vio_bit; -+ -+ break; -+ } -+ -+ for (i = 0; i < ARRAY_SIZE(g_a2v_rate_map); ++i) -+ if (g_a2v_rate_map[i].rate == rate) { -+ vrate = g_a2v_rate_map[i].vio_bit; -+ -+ break; -+ } -+ -+ if (vformat == -1 || vrate == -1) -+ return -EINVAL; -+ -+ msg = virtsnd_pcm_ctl_msg_alloc(vss, VIRTIO_SND_R_PCM_SET_PARAMS, -+ GFP_KERNEL); -+ if (!msg) -+ return -ENOMEM; -+ -+ request = virtsnd_ctl_msg_request(msg); -+ request->buffer_bytes = cpu_to_le32(buffer_bytes); -+ request->period_bytes = cpu_to_le32(period_bytes); -+ request->channels = channels; -+ request->format = vformat; -+ request->rate = vrate; -+ -+ if (vss->features & (1U << VIRTIO_SND_PCM_F_MSG_POLLING)) -+ request->features |= -+ cpu_to_le32(1U << VIRTIO_SND_PCM_F_MSG_POLLING); -+ -+ if (vss->features & (1U << VIRTIO_SND_PCM_F_EVT_XRUNS)) -+ request->features |= -+ cpu_to_le32(1U << VIRTIO_SND_PCM_F_EVT_XRUNS); -+ -+ return virtsnd_ctl_msg_send_sync(vss->snd, msg); -+} -+ -+/** -+ * virtsnd_pcm_hw_params() - Set the parameters of the PCM substream. -+ * @substream: Kernel ALSA substream. -+ * @hw_params: Hardware parameters. -+ * -+ * Context: Process context. -+ * Return: 0 on success, -errno on failure. -+ */ -+static int virtsnd_pcm_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *hw_params) -+{ -+ struct virtio_pcm_substream *vss = snd_pcm_substream_chip(substream); -+ struct virtio_device *vdev = vss->snd->vdev; -+ int rc; -+ -+ if (virtsnd_pcm_msg_pending_num(vss)) { -+ dev_err(&vdev->dev, "SID %u: invalid I/O queue state\n", -+ vss->sid); -+ return -EBADFD; -+ } -+ -+ rc = virtsnd_pcm_dev_set_params(vss, params_buffer_bytes(hw_params), -+ params_period_bytes(hw_params), -+ params_channels(hw_params), -+ params_format(hw_params), -+ params_rate(hw_params)); -+ if (rc) -+ return rc; -+ -+ /* -+ * Free previously allocated messages if ops->hw_params() is called -+ * several times in a row, or if ops->hw_free() failed to free messages. -+ */ -+ virtsnd_pcm_msg_free(vss); -+ -+ return virtsnd_pcm_msg_alloc(vss, params_periods(hw_params), -+ params_period_bytes(hw_params)); -+} -+ -+/** -+ * virtsnd_pcm_hw_free() - Reset the parameters of the PCM substream. -+ * @substream: Kernel ALSA substream. -+ * -+ * Context: Process context. -+ * Return: 0 -+ */ -+static int virtsnd_pcm_hw_free(struct snd_pcm_substream *substream) -+{ -+ struct virtio_pcm_substream *vss = snd_pcm_substream_chip(substream); -+ -+ /* If the queue is flushed, we can safely free the messages here. */ -+ if (!virtsnd_pcm_msg_pending_num(vss)) -+ virtsnd_pcm_msg_free(vss); -+ -+ return 0; -+} -+ -+/** -+ * virtsnd_pcm_prepare() - Prepare the PCM substream. -+ * @substream: Kernel ALSA substream. -+ * -+ * Context: Process context. -+ * Return: 0 on success, -errno on failure. -+ */ -+static int virtsnd_pcm_prepare(struct snd_pcm_substream *substream) -+{ -+ struct virtio_pcm_substream *vss = snd_pcm_substream_chip(substream); -+ struct virtio_device *vdev = vss->snd->vdev; -+ struct virtio_snd_msg *msg; -+ -+ if (virtsnd_pcm_msg_pending_num(vss)) { -+ dev_err(&vdev->dev, "SID %u: invalid I/O queue state\n", -+ vss->sid); -+ return -EBADFD; -+ } -+ -+ vss->buffer_bytes = snd_pcm_lib_buffer_bytes(substream); -+ vss->hw_ptr = 0; -+ vss->xfer_xrun = false; -+ vss->msg_last_enqueued = -1; -+ vss->msg_count = 0; -+ -+ msg = virtsnd_pcm_ctl_msg_alloc(vss, VIRTIO_SND_R_PCM_PREPARE, -+ GFP_KERNEL); -+ if (!msg) -+ return -ENOMEM; -+ -+ return virtsnd_ctl_msg_send_sync(vss->snd, msg); -+} -+ -+/** -+ * virtsnd_pcm_trigger() - Process command for the PCM substream. -+ * @substream: Kernel ALSA substream. -+ * @command: Substream command (SNDRV_PCM_TRIGGER_XXX). -+ * -+ * Context: Any context. Takes and releases the VirtIO substream spinlock. -+ * May take and release the tx/rx queue spinlock. -+ * Return: 0 on success, -errno on failure. -+ */ -+static int virtsnd_pcm_trigger(struct snd_pcm_substream *substream, int command) -+{ -+ struct virtio_pcm_substream *vss = snd_pcm_substream_chip(substream); -+ struct virtio_snd *snd = vss->snd; -+ struct virtio_snd_queue *queue; -+ struct virtio_snd_msg *msg; -+ unsigned long flags; -+ int rc; -+ -+ switch (command) { -+ case SNDRV_PCM_TRIGGER_START: -+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: -+ queue = virtsnd_pcm_queue(vss); -+ -+ spin_lock_irqsave(&queue->lock, flags); -+ spin_lock(&vss->lock); -+ rc = virtsnd_pcm_msg_send(vss); -+ if (!rc) -+ vss->xfer_enabled = true; -+ spin_unlock(&vss->lock); -+ spin_unlock_irqrestore(&queue->lock, flags); -+ if (rc) -+ return rc; -+ -+ msg = virtsnd_pcm_ctl_msg_alloc(vss, VIRTIO_SND_R_PCM_START, -+ GFP_KERNEL); -+ if (!msg) { -+ spin_lock_irqsave(&vss->lock, flags); -+ vss->xfer_enabled = false; -+ spin_unlock_irqrestore(&vss->lock, flags); -+ -+ return -ENOMEM; -+ } -+ -+ return virtsnd_ctl_msg_send_sync(snd, msg); -+ case SNDRV_PCM_TRIGGER_STOP: -+ vss->stopped = true; -+ fallthrough; -+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH: -+ spin_lock_irqsave(&vss->lock, flags); -+ vss->xfer_enabled = false; -+ spin_unlock_irqrestore(&vss->lock, flags); -+ -+ msg = virtsnd_pcm_ctl_msg_alloc(vss, VIRTIO_SND_R_PCM_STOP, -+ GFP_KERNEL); -+ if (!msg) -+ return -ENOMEM; -+ -+ return virtsnd_ctl_msg_send_sync(snd, msg); -+ default: -+ return -EINVAL; -+ } -+} -+ -+/** -+ * virtsnd_pcm_sync_stop() - Synchronous PCM substream stop. -+ * @substream: Kernel ALSA substream. -+ * -+ * The function can be called both from the upper level or from the driver -+ * itself. -+ * -+ * Context: Process context. Takes and releases the VirtIO substream spinlock. -+ * Return: 0 on success, -errno on failure. -+ */ -+static int virtsnd_pcm_sync_stop(struct snd_pcm_substream *substream) -+{ -+ struct virtio_pcm_substream *vss = snd_pcm_substream_chip(substream); -+ struct virtio_snd *snd = vss->snd; -+ struct virtio_snd_msg *msg; -+ unsigned int js = msecs_to_jiffies(virtsnd_msg_timeout_ms); -+ int rc; -+ -+ cancel_work_sync(&vss->elapsed_period); -+ -+ if (!vss->stopped) -+ return 0; -+ -+ msg = virtsnd_pcm_ctl_msg_alloc(vss, VIRTIO_SND_R_PCM_RELEASE, -+ GFP_KERNEL); -+ if (!msg) -+ return -ENOMEM; -+ -+ rc = virtsnd_ctl_msg_send_sync(snd, msg); -+ if (rc) -+ return rc; -+ -+ /* -+ * The spec states that upon receipt of the RELEASE command "the device -+ * MUST complete all pending I/O messages for the specified stream ID". -+ * Thus, we consider the absence of I/O messages in the queue as an -+ * indication that the substream has been released. -+ */ -+ rc = wait_event_interruptible_timeout(vss->msg_empty, -+ !virtsnd_pcm_msg_pending_num(vss), -+ js); -+ if (rc <= 0) { -+ dev_warn(&snd->vdev->dev, "SID %u: failed to flush I/O queue\n", -+ vss->sid); -+ -+ return !rc ? -ETIMEDOUT : rc; -+ } -+ -+ vss->stopped = false; -+ -+ return 0; -+} -+ -+/** -+ * virtsnd_pcm_pointer() - Get the current hardware position for the PCM -+ * substream. -+ * @substream: Kernel ALSA substream. -+ * -+ * Context: Any context. Takes and releases the VirtIO substream spinlock. -+ * Return: Hardware position in frames inside [0 ... buffer_size) range. -+ */ -+static snd_pcm_uframes_t -+virtsnd_pcm_pointer(struct snd_pcm_substream *substream) -+{ -+ struct virtio_pcm_substream *vss = snd_pcm_substream_chip(substream); -+ snd_pcm_uframes_t hw_ptr = SNDRV_PCM_POS_XRUN; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&vss->lock, flags); -+ if (!vss->xfer_xrun) -+ hw_ptr = bytes_to_frames(substream->runtime, vss->hw_ptr); -+ spin_unlock_irqrestore(&vss->lock, flags); -+ -+ return hw_ptr; -+} -+ -+/* PCM substream operators map. */ -+const struct snd_pcm_ops virtsnd_pcm_ops = { -+ .open = virtsnd_pcm_open, -+ .close = virtsnd_pcm_close, -+ .ioctl = snd_pcm_lib_ioctl, -+ .hw_params = virtsnd_pcm_hw_params, -+ .hw_free = virtsnd_pcm_hw_free, -+ .prepare = virtsnd_pcm_prepare, -+ .trigger = virtsnd_pcm_trigger, -+ .sync_stop = virtsnd_pcm_sync_stop, -+ .pointer = virtsnd_pcm_pointer, -+}; diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0007-ALSA-virtio-introduce-jack-support.patch b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0007-ALSA-virtio-introduce-jack-support.patch deleted file mode 100644 index af30421e0..000000000 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0007-ALSA-virtio-introduce-jack-support.patch +++ /dev/null @@ -1,351 +0,0 @@ -From 07692f250a96382b38daa2b7e2b96689f64d7a40 Mon Sep 17 00:00:00 2001 -From: Anton Yakovlev <anton.yakovlev@opensynergy.com> -Date: Tue, 2 Mar 2021 17:47:07 +0100 -Subject: [PATCH] ALSA: virtio: introduce jack support - -Enumerate all available jacks and create ALSA controls. - -At the moment jacks have a simple implementation and can only be used -to receive notifications about a plugged in/out device. - -Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> -Link: https://lore.kernel.org/r/20210302164709.3142702-8-anton.yakovlev@opensynergy.com -Signed-off-by: Takashi Iwai <tiwai@suse.de> -Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com> ---- - sound/virtio/Makefile | 1 + - sound/virtio/virtio_card.c | 14 +++ - sound/virtio/virtio_card.h | 12 ++ - sound/virtio/virtio_jack.c | 233 +++++++++++++++++++++++++++++++++++++ - 4 files changed, 260 insertions(+) - create mode 100644 sound/virtio/virtio_jack.c - -diff --git a/sound/virtio/Makefile b/sound/virtio/Makefile -index 34493226793f..09f485291285 100644 ---- a/sound/virtio/Makefile -+++ b/sound/virtio/Makefile -@@ -5,6 +5,7 @@ obj-$(CONFIG_SND_VIRTIO) += virtio_snd.o - virtio_snd-objs := \ - virtio_card.o \ - virtio_ctl_msg.o \ -+ virtio_jack.o \ - virtio_pcm.o \ - virtio_pcm_msg.o \ - virtio_pcm_ops.o -diff --git a/sound/virtio/virtio_card.c b/sound/virtio/virtio_card.c -index 57b9b7f3a9c0..89bd66c1256e 100644 ---- a/sound/virtio/virtio_card.c -+++ b/sound/virtio/virtio_card.c -@@ -56,6 +56,10 @@ static void virtsnd_event_dispatch(struct virtio_snd *snd, - struct virtio_snd_event *event) - { - switch (le32_to_cpu(event->hdr.code)) { -+ case VIRTIO_SND_EVT_JACK_CONNECTED: -+ case VIRTIO_SND_EVT_JACK_DISCONNECTED: -+ virtsnd_jack_event(snd, event); -+ break; - case VIRTIO_SND_EVT_PCM_PERIOD_ELAPSED: - case VIRTIO_SND_EVT_PCM_XRUN: - virtsnd_pcm_event(snd, event); -@@ -219,10 +223,20 @@ static int virtsnd_build_devs(struct virtio_snd *snd) - VIRTIO_SND_CARD_NAME " at %s/%s", - dev_name(dev->parent), dev_name(dev)); - -+ rc = virtsnd_jack_parse_cfg(snd); -+ if (rc) -+ return rc; -+ - rc = virtsnd_pcm_parse_cfg(snd); - if (rc) - return rc; - -+ if (snd->njacks) { -+ rc = virtsnd_jack_build_devs(snd); -+ if (rc) -+ return rc; -+ } -+ - if (snd->nsubstreams) { - rc = virtsnd_pcm_build_devs(snd); - if (rc) -diff --git a/sound/virtio/virtio_card.h b/sound/virtio/virtio_card.h -index c43f9744d362..f154313c79fd 100644 ---- a/sound/virtio/virtio_card.h -+++ b/sound/virtio/virtio_card.h -@@ -18,6 +18,7 @@ - #define VIRTIO_SND_CARD_NAME "VirtIO SoundCard" - #define VIRTIO_SND_PCM_NAME "VirtIO PCM" - -+struct virtio_jack; - struct virtio_pcm_substream; - - /** -@@ -38,6 +39,8 @@ struct virtio_snd_queue { - * @ctl_msgs: Pending control request list. - * @event_msgs: Device events. - * @pcm_list: VirtIO PCM device list. -+ * @jacks: VirtIO jacks. -+ * @njacks: Number of jacks. - * @substreams: VirtIO PCM substreams. - * @nsubstreams: Number of PCM substreams. - */ -@@ -48,6 +51,8 @@ struct virtio_snd { - struct list_head ctl_msgs; - struct virtio_snd_event *event_msgs; - struct list_head pcm_list; -+ struct virtio_jack *jacks; -+ u32 njacks; - struct virtio_pcm_substream *substreams; - u32 nsubstreams; - }; -@@ -88,4 +93,11 @@ virtsnd_pcm_queue(struct virtio_pcm_substream *vss) - return virtsnd_rx_queue(vss->snd); - } - -+int virtsnd_jack_parse_cfg(struct virtio_snd *snd); -+ -+int virtsnd_jack_build_devs(struct virtio_snd *snd); -+ -+void virtsnd_jack_event(struct virtio_snd *snd, -+ struct virtio_snd_event *event); -+ - #endif /* VIRTIO_SND_CARD_H */ -diff --git a/sound/virtio/virtio_jack.c b/sound/virtio/virtio_jack.c -new file mode 100644 -index 000000000000..c69f1dcdcc84 ---- /dev/null -+++ b/sound/virtio/virtio_jack.c -@@ -0,0 +1,233 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * virtio-snd: Virtio sound device -+ * Copyright (C) 2021 OpenSynergy GmbH -+ */ -+#include <linux/virtio_config.h> -+#include <sound/jack.h> -+#include <sound/hda_verbs.h> -+ -+#include "virtio_card.h" -+ -+/** -+ * DOC: Implementation Status -+ * -+ * At the moment jacks have a simple implementation and can only be used to -+ * receive notifications about a plugged in/out device. -+ * -+ * VIRTIO_SND_R_JACK_REMAP -+ * is not supported -+ */ -+ -+/** -+ * struct virtio_jack - VirtIO jack. -+ * @jack: Kernel jack control. -+ * @nid: Functional group node identifier. -+ * @features: Jack virtio feature bit map (1 << VIRTIO_SND_JACK_F_XXX). -+ * @defconf: Pin default configuration value. -+ * @caps: Pin capabilities value. -+ * @connected: Current jack connection status. -+ * @type: Kernel jack type (SND_JACK_XXX). -+ */ -+struct virtio_jack { -+ struct snd_jack *jack; -+ u32 nid; -+ u32 features; -+ u32 defconf; -+ u32 caps; -+ bool connected; -+ int type; -+}; -+ -+/** -+ * virtsnd_jack_get_label() - Get the name string for the jack. -+ * @vjack: VirtIO jack. -+ * -+ * Returns the jack name based on the default pin configuration value (see HDA -+ * specification). -+ * -+ * Context: Any context. -+ * Return: Name string. -+ */ -+static const char *virtsnd_jack_get_label(struct virtio_jack *vjack) -+{ -+ unsigned int defconf = vjack->defconf; -+ unsigned int device = -+ (defconf & AC_DEFCFG_DEVICE) >> AC_DEFCFG_DEVICE_SHIFT; -+ unsigned int location = -+ (defconf & AC_DEFCFG_LOCATION) >> AC_DEFCFG_LOCATION_SHIFT; -+ -+ switch (device) { -+ case AC_JACK_LINE_OUT: -+ return "Line Out"; -+ case AC_JACK_SPEAKER: -+ return "Speaker"; -+ case AC_JACK_HP_OUT: -+ return "Headphone"; -+ case AC_JACK_CD: -+ return "CD"; -+ case AC_JACK_SPDIF_OUT: -+ case AC_JACK_DIG_OTHER_OUT: -+ if (location == AC_JACK_LOC_HDMI) -+ return "HDMI Out"; -+ else -+ return "SPDIF Out"; -+ case AC_JACK_LINE_IN: -+ return "Line"; -+ case AC_JACK_AUX: -+ return "Aux"; -+ case AC_JACK_MIC_IN: -+ return "Mic"; -+ case AC_JACK_SPDIF_IN: -+ return "SPDIF In"; -+ case AC_JACK_DIG_OTHER_IN: -+ return "Digital In"; -+ default: -+ return "Misc"; -+ } -+} -+ -+/** -+ * virtsnd_jack_get_type() - Get the type for the jack. -+ * @vjack: VirtIO jack. -+ * -+ * Returns the jack type based on the default pin configuration value (see HDA -+ * specification). -+ * -+ * Context: Any context. -+ * Return: SND_JACK_XXX value. -+ */ -+static int virtsnd_jack_get_type(struct virtio_jack *vjack) -+{ -+ unsigned int defconf = vjack->defconf; -+ unsigned int device = -+ (defconf & AC_DEFCFG_DEVICE) >> AC_DEFCFG_DEVICE_SHIFT; -+ -+ switch (device) { -+ case AC_JACK_LINE_OUT: -+ case AC_JACK_SPEAKER: -+ return SND_JACK_LINEOUT; -+ case AC_JACK_HP_OUT: -+ return SND_JACK_HEADPHONE; -+ case AC_JACK_SPDIF_OUT: -+ case AC_JACK_DIG_OTHER_OUT: -+ return SND_JACK_AVOUT; -+ case AC_JACK_MIC_IN: -+ return SND_JACK_MICROPHONE; -+ default: -+ return SND_JACK_LINEIN; -+ } -+} -+ -+/** -+ * virtsnd_jack_parse_cfg() - Parse the jack configuration. -+ * @snd: VirtIO sound device. -+ * -+ * This function is called during initial device initialization. -+ * -+ * Context: Any context that permits to sleep. -+ * Return: 0 on success, -errno on failure. -+ */ -+int virtsnd_jack_parse_cfg(struct virtio_snd *snd) -+{ -+ struct virtio_device *vdev = snd->vdev; -+ struct virtio_snd_jack_info *info; -+ u32 i; -+ int rc; -+ -+ virtio_cread_le(vdev, struct virtio_snd_config, jacks, &snd->njacks); -+ if (!snd->njacks) -+ return 0; -+ -+ snd->jacks = devm_kcalloc(&vdev->dev, snd->njacks, sizeof(*snd->jacks), -+ GFP_KERNEL); -+ if (!snd->jacks) -+ return -ENOMEM; -+ -+ info = kcalloc(snd->njacks, sizeof(*info), GFP_KERNEL); -+ if (!info) -+ return -ENOMEM; -+ -+ rc = virtsnd_ctl_query_info(snd, VIRTIO_SND_R_JACK_INFO, 0, snd->njacks, -+ sizeof(*info), info); -+ if (rc) -+ goto on_exit; -+ -+ for (i = 0; i < snd->njacks; ++i) { -+ struct virtio_jack *vjack = &snd->jacks[i]; -+ -+ vjack->nid = le32_to_cpu(info[i].hdr.hda_fn_nid); -+ vjack->features = le32_to_cpu(info[i].features); -+ vjack->defconf = le32_to_cpu(info[i].hda_reg_defconf); -+ vjack->caps = le32_to_cpu(info[i].hda_reg_caps); -+ vjack->connected = info[i].connected; -+ } -+ -+on_exit: -+ kfree(info); -+ -+ return rc; -+} -+ -+/** -+ * virtsnd_jack_build_devs() - Build ALSA controls for jacks. -+ * @snd: VirtIO sound device. -+ * -+ * Context: Any context that permits to sleep. -+ * Return: 0 on success, -errno on failure. -+ */ -+int virtsnd_jack_build_devs(struct virtio_snd *snd) -+{ -+ u32 i; -+ int rc; -+ -+ for (i = 0; i < snd->njacks; ++i) { -+ struct virtio_jack *vjack = &snd->jacks[i]; -+ -+ vjack->type = virtsnd_jack_get_type(vjack); -+ -+ rc = snd_jack_new(snd->card, virtsnd_jack_get_label(vjack), -+ vjack->type, &vjack->jack, true, true); -+ if (rc) -+ return rc; -+ -+ if (vjack->jack) -+ vjack->jack->private_data = vjack; -+ -+ snd_jack_report(vjack->jack, -+ vjack->connected ? vjack->type : 0); -+ } -+ -+ return 0; -+} -+ -+/** -+ * virtsnd_jack_event() - Handle the jack event notification. -+ * @snd: VirtIO sound device. -+ * @event: VirtIO sound event. -+ * -+ * Context: Interrupt context. -+ */ -+void virtsnd_jack_event(struct virtio_snd *snd, struct virtio_snd_event *event) -+{ -+ u32 jack_id = le32_to_cpu(event->data); -+ struct virtio_jack *vjack; -+ -+ if (jack_id >= snd->njacks) -+ return; -+ -+ vjack = &snd->jacks[jack_id]; -+ -+ switch (le32_to_cpu(event->hdr.code)) { -+ case VIRTIO_SND_EVT_JACK_CONNECTED: -+ vjack->connected = true; -+ break; -+ case VIRTIO_SND_EVT_JACK_DISCONNECTED: -+ vjack->connected = false; -+ break; -+ default: -+ return; -+ } -+ -+ snd_jack_report(vjack->jack, vjack->connected ? vjack->type : 0); -+} diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0008-ALSA-virtio-introduce-PCM-channel-map-support.patch b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0008-ALSA-virtio-introduce-PCM-channel-map-support.patch deleted file mode 100644 index d27ddb435..000000000 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0008-ALSA-virtio-introduce-PCM-channel-map-support.patch +++ /dev/null @@ -1,335 +0,0 @@ -From 861932797d59b807b4fcc8a2e12dafbddd5ca4d9 Mon Sep 17 00:00:00 2001 -From: Anton Yakovlev <anton.yakovlev@opensynergy.com> -Date: Tue, 2 Mar 2021 17:47:08 +0100 -Subject: [PATCH] ALSA: virtio: introduce PCM channel map support - -Enumerate all available PCM channel maps and create ALSA controls. - -Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> -Link: https://lore.kernel.org/r/20210302164709.3142702-9-anton.yakovlev@opensynergy.com -Signed-off-by: Takashi Iwai <tiwai@suse.de> -Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com> ---- - sound/virtio/Makefile | 1 + - sound/virtio/virtio_card.c | 10 ++ - sound/virtio/virtio_card.h | 8 ++ - sound/virtio/virtio_chmap.c | 219 ++++++++++++++++++++++++++++++++++++ - sound/virtio/virtio_pcm.h | 4 + - 5 files changed, 242 insertions(+) - create mode 100644 sound/virtio/virtio_chmap.c - -diff --git a/sound/virtio/Makefile b/sound/virtio/Makefile -index 09f485291285..2742bddb8874 100644 ---- a/sound/virtio/Makefile -+++ b/sound/virtio/Makefile -@@ -4,6 +4,7 @@ obj-$(CONFIG_SND_VIRTIO) += virtio_snd.o - - virtio_snd-objs := \ - virtio_card.o \ -+ virtio_chmap.o \ - virtio_ctl_msg.o \ - virtio_jack.o \ - virtio_pcm.o \ -diff --git a/sound/virtio/virtio_card.c b/sound/virtio/virtio_card.c -index 89bd66c1256e..1c03fcc41c3b 100644 ---- a/sound/virtio/virtio_card.c -+++ b/sound/virtio/virtio_card.c -@@ -231,6 +231,10 @@ static int virtsnd_build_devs(struct virtio_snd *snd) - if (rc) - return rc; - -+ rc = virtsnd_chmap_parse_cfg(snd); -+ if (rc) -+ return rc; -+ - if (snd->njacks) { - rc = virtsnd_jack_build_devs(snd); - if (rc) -@@ -243,6 +247,12 @@ static int virtsnd_build_devs(struct virtio_snd *snd) - return rc; - } - -+ if (snd->nchmaps) { -+ rc = virtsnd_chmap_build_devs(snd); -+ if (rc) -+ return rc; -+ } -+ - return snd_card_register(snd->card); - } - -diff --git a/sound/virtio/virtio_card.h b/sound/virtio/virtio_card.h -index f154313c79fd..86ef3941895e 100644 ---- a/sound/virtio/virtio_card.h -+++ b/sound/virtio/virtio_card.h -@@ -43,6 +43,8 @@ struct virtio_snd_queue { - * @njacks: Number of jacks. - * @substreams: VirtIO PCM substreams. - * @nsubstreams: Number of PCM substreams. -+ * @chmaps: VirtIO channel maps. -+ * @nchmaps: Number of channel maps. - */ - struct virtio_snd { - struct virtio_device *vdev; -@@ -55,6 +57,8 @@ struct virtio_snd { - u32 njacks; - struct virtio_pcm_substream *substreams; - u32 nsubstreams; -+ struct virtio_snd_chmap_info *chmaps; -+ u32 nchmaps; - }; - - /* Message completion timeout in milliseconds (module parameter). */ -@@ -100,4 +104,8 @@ int virtsnd_jack_build_devs(struct virtio_snd *snd); - void virtsnd_jack_event(struct virtio_snd *snd, - struct virtio_snd_event *event); - -+int virtsnd_chmap_parse_cfg(struct virtio_snd *snd); -+ -+int virtsnd_chmap_build_devs(struct virtio_snd *snd); -+ - #endif /* VIRTIO_SND_CARD_H */ -diff --git a/sound/virtio/virtio_chmap.c b/sound/virtio/virtio_chmap.c -new file mode 100644 -index 000000000000..5bc924933a59 ---- /dev/null -+++ b/sound/virtio/virtio_chmap.c -@@ -0,0 +1,219 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * virtio-snd: Virtio sound device -+ * Copyright (C) 2021 OpenSynergy GmbH -+ */ -+#include <linux/virtio_config.h> -+ -+#include "virtio_card.h" -+ -+/* VirtIO->ALSA channel position map */ -+static const u8 g_v2a_position_map[] = { -+ [VIRTIO_SND_CHMAP_NONE] = SNDRV_CHMAP_UNKNOWN, -+ [VIRTIO_SND_CHMAP_NA] = SNDRV_CHMAP_NA, -+ [VIRTIO_SND_CHMAP_MONO] = SNDRV_CHMAP_MONO, -+ [VIRTIO_SND_CHMAP_FL] = SNDRV_CHMAP_FL, -+ [VIRTIO_SND_CHMAP_FR] = SNDRV_CHMAP_FR, -+ [VIRTIO_SND_CHMAP_RL] = SNDRV_CHMAP_RL, -+ [VIRTIO_SND_CHMAP_RR] = SNDRV_CHMAP_RR, -+ [VIRTIO_SND_CHMAP_FC] = SNDRV_CHMAP_FC, -+ [VIRTIO_SND_CHMAP_LFE] = SNDRV_CHMAP_LFE, -+ [VIRTIO_SND_CHMAP_SL] = SNDRV_CHMAP_SL, -+ [VIRTIO_SND_CHMAP_SR] = SNDRV_CHMAP_SR, -+ [VIRTIO_SND_CHMAP_RC] = SNDRV_CHMAP_RC, -+ [VIRTIO_SND_CHMAP_FLC] = SNDRV_CHMAP_FLC, -+ [VIRTIO_SND_CHMAP_FRC] = SNDRV_CHMAP_FRC, -+ [VIRTIO_SND_CHMAP_RLC] = SNDRV_CHMAP_RLC, -+ [VIRTIO_SND_CHMAP_RRC] = SNDRV_CHMAP_RRC, -+ [VIRTIO_SND_CHMAP_FLW] = SNDRV_CHMAP_FLW, -+ [VIRTIO_SND_CHMAP_FRW] = SNDRV_CHMAP_FRW, -+ [VIRTIO_SND_CHMAP_FLH] = SNDRV_CHMAP_FLH, -+ [VIRTIO_SND_CHMAP_FCH] = SNDRV_CHMAP_FCH, -+ [VIRTIO_SND_CHMAP_FRH] = SNDRV_CHMAP_FRH, -+ [VIRTIO_SND_CHMAP_TC] = SNDRV_CHMAP_TC, -+ [VIRTIO_SND_CHMAP_TFL] = SNDRV_CHMAP_TFL, -+ [VIRTIO_SND_CHMAP_TFR] = SNDRV_CHMAP_TFR, -+ [VIRTIO_SND_CHMAP_TFC] = SNDRV_CHMAP_TFC, -+ [VIRTIO_SND_CHMAP_TRL] = SNDRV_CHMAP_TRL, -+ [VIRTIO_SND_CHMAP_TRR] = SNDRV_CHMAP_TRR, -+ [VIRTIO_SND_CHMAP_TRC] = SNDRV_CHMAP_TRC, -+ [VIRTIO_SND_CHMAP_TFLC] = SNDRV_CHMAP_TFLC, -+ [VIRTIO_SND_CHMAP_TFRC] = SNDRV_CHMAP_TFRC, -+ [VIRTIO_SND_CHMAP_TSL] = SNDRV_CHMAP_TSL, -+ [VIRTIO_SND_CHMAP_TSR] = SNDRV_CHMAP_TSR, -+ [VIRTIO_SND_CHMAP_LLFE] = SNDRV_CHMAP_LLFE, -+ [VIRTIO_SND_CHMAP_RLFE] = SNDRV_CHMAP_RLFE, -+ [VIRTIO_SND_CHMAP_BC] = SNDRV_CHMAP_BC, -+ [VIRTIO_SND_CHMAP_BLC] = SNDRV_CHMAP_BLC, -+ [VIRTIO_SND_CHMAP_BRC] = SNDRV_CHMAP_BRC -+}; -+ -+/** -+ * virtsnd_chmap_parse_cfg() - Parse the channel map configuration. -+ * @snd: VirtIO sound device. -+ * -+ * This function is called during initial device initialization. -+ * -+ * Context: Any context that permits to sleep. -+ * Return: 0 on success, -errno on failure. -+ */ -+int virtsnd_chmap_parse_cfg(struct virtio_snd *snd) -+{ -+ struct virtio_device *vdev = snd->vdev; -+ u32 i; -+ int rc; -+ -+ virtio_cread_le(vdev, struct virtio_snd_config, chmaps, &snd->nchmaps); -+ if (!snd->nchmaps) -+ return 0; -+ -+ snd->chmaps = devm_kcalloc(&vdev->dev, snd->nchmaps, -+ sizeof(*snd->chmaps), GFP_KERNEL); -+ if (!snd->chmaps) -+ return -ENOMEM; -+ -+ rc = virtsnd_ctl_query_info(snd, VIRTIO_SND_R_CHMAP_INFO, 0, -+ snd->nchmaps, sizeof(*snd->chmaps), -+ snd->chmaps); -+ if (rc) -+ return rc; -+ -+ /* Count the number of channel maps per each PCM device/stream. */ -+ for (i = 0; i < snd->nchmaps; ++i) { -+ struct virtio_snd_chmap_info *info = &snd->chmaps[i]; -+ u32 nid = le32_to_cpu(info->hdr.hda_fn_nid); -+ struct virtio_pcm *vpcm; -+ struct virtio_pcm_stream *vs; -+ -+ vpcm = virtsnd_pcm_find_or_create(snd, nid); -+ if (IS_ERR(vpcm)) -+ return PTR_ERR(vpcm); -+ -+ switch (info->direction) { -+ case VIRTIO_SND_D_OUTPUT: -+ vs = &vpcm->streams[SNDRV_PCM_STREAM_PLAYBACK]; -+ break; -+ case VIRTIO_SND_D_INPUT: -+ vs = &vpcm->streams[SNDRV_PCM_STREAM_CAPTURE]; -+ break; -+ default: -+ dev_err(&vdev->dev, -+ "chmap #%u: unknown direction (%u)\n", i, -+ info->direction); -+ return -EINVAL; -+ } -+ -+ vs->nchmaps++; -+ } -+ -+ return 0; -+} -+ -+/** -+ * virtsnd_chmap_add_ctls() - Create an ALSA control for channel maps. -+ * @pcm: ALSA PCM device. -+ * @direction: PCM stream direction (SNDRV_PCM_STREAM_XXX). -+ * @vs: VirtIO PCM stream. -+ * -+ * Context: Any context. -+ * Return: 0 on success, -errno on failure. -+ */ -+static int virtsnd_chmap_add_ctls(struct snd_pcm *pcm, int direction, -+ struct virtio_pcm_stream *vs) -+{ -+ u32 i; -+ int max_channels = 0; -+ -+ for (i = 0; i < vs->nchmaps; i++) -+ if (max_channels < vs->chmaps[i].channels) -+ max_channels = vs->chmaps[i].channels; -+ -+ return snd_pcm_add_chmap_ctls(pcm, direction, vs->chmaps, max_channels, -+ 0, NULL); -+} -+ -+/** -+ * virtsnd_chmap_build_devs() - Build ALSA controls for channel maps. -+ * @snd: VirtIO sound device. -+ * -+ * Context: Any context. -+ * Return: 0 on success, -errno on failure. -+ */ -+int virtsnd_chmap_build_devs(struct virtio_snd *snd) -+{ -+ struct virtio_device *vdev = snd->vdev; -+ struct virtio_pcm *vpcm; -+ struct virtio_pcm_stream *vs; -+ u32 i; -+ int rc; -+ -+ /* Allocate channel map elements per each PCM device/stream. */ -+ list_for_each_entry(vpcm, &snd->pcm_list, list) { -+ for (i = 0; i < ARRAY_SIZE(vpcm->streams); ++i) { -+ vs = &vpcm->streams[i]; -+ -+ if (!vs->nchmaps) -+ continue; -+ -+ vs->chmaps = devm_kcalloc(&vdev->dev, vs->nchmaps + 1, -+ sizeof(*vs->chmaps), -+ GFP_KERNEL); -+ if (!vs->chmaps) -+ return -ENOMEM; -+ -+ vs->nchmaps = 0; -+ } -+ } -+ -+ /* Initialize channel maps per each PCM device/stream. */ -+ for (i = 0; i < snd->nchmaps; ++i) { -+ struct virtio_snd_chmap_info *info = &snd->chmaps[i]; -+ unsigned int channels = info->channels; -+ unsigned int ch; -+ struct snd_pcm_chmap_elem *chmap; -+ -+ vpcm = virtsnd_pcm_find(snd, le32_to_cpu(info->hdr.hda_fn_nid)); -+ if (IS_ERR(vpcm)) -+ return PTR_ERR(vpcm); -+ -+ if (info->direction == VIRTIO_SND_D_OUTPUT) -+ vs = &vpcm->streams[SNDRV_PCM_STREAM_PLAYBACK]; -+ else -+ vs = &vpcm->streams[SNDRV_PCM_STREAM_CAPTURE]; -+ -+ chmap = &vs->chmaps[vs->nchmaps++]; -+ -+ if (channels > ARRAY_SIZE(chmap->map)) -+ channels = ARRAY_SIZE(chmap->map); -+ -+ chmap->channels = channels; -+ -+ for (ch = 0; ch < channels; ++ch) { -+ u8 position = info->positions[ch]; -+ -+ if (position >= ARRAY_SIZE(g_v2a_position_map)) -+ return -EINVAL; -+ -+ chmap->map[ch] = g_v2a_position_map[position]; -+ } -+ } -+ -+ /* Create an ALSA control per each PCM device/stream. */ -+ list_for_each_entry(vpcm, &snd->pcm_list, list) { -+ if (!vpcm->pcm) -+ continue; -+ -+ for (i = 0; i < ARRAY_SIZE(vpcm->streams); ++i) { -+ vs = &vpcm->streams[i]; -+ -+ if (!vs->nchmaps) -+ continue; -+ -+ rc = virtsnd_chmap_add_ctls(vpcm->pcm, i, vs); -+ if (rc) -+ return rc; -+ } -+ } -+ -+ return 0; -+} -diff --git a/sound/virtio/virtio_pcm.h b/sound/virtio/virtio_pcm.h -index efd0228746cf..1353fdc9bd69 100644 ---- a/sound/virtio/virtio_pcm.h -+++ b/sound/virtio/virtio_pcm.h -@@ -63,10 +63,14 @@ struct virtio_pcm_substream { - * struct virtio_pcm_stream - VirtIO PCM stream. - * @substreams: VirtIO substreams belonging to the stream. - * @nsubstreams: Number of substreams. -+ * @chmaps: Kernel channel maps belonging to the stream. -+ * @nchmaps: Number of channel maps. - */ - struct virtio_pcm_stream { - struct virtio_pcm_substream **substreams; - u32 nsubstreams; -+ struct snd_pcm_chmap_elem *chmaps; -+ u32 nchmaps; - }; - - /** diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0009-ALSA-virtio-introduce-device-suspend-resume-support.patch b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0009-ALSA-virtio-introduce-device-suspend-resume-support.patch deleted file mode 100644 index b7d278fd0..000000000 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/0009-ALSA-virtio-introduce-device-suspend-resume-support.patch +++ /dev/null @@ -1,174 +0,0 @@ -From b173fb2a0eb0067fc665ba48f9b2b8b5f991c078 Mon Sep 17 00:00:00 2001 -From: Anton Yakovlev <anton.yakovlev@opensynergy.com> -Date: Tue, 2 Mar 2021 17:47:09 +0100 -Subject: [PATCH] ALSA: virtio: introduce device suspend/resume support - -All running PCM substreams are stopped on device suspend and restarted -on device resume. - -Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com> -Link: https://lore.kernel.org/r/20210302164709.3142702-10-anton.yakovlev@opensynergy.com -Signed-off-by: Takashi Iwai <tiwai@suse.de> -Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com> ---- - sound/virtio/virtio_card.c | 56 +++++++++++++++++++++++++++++++++++ - sound/virtio/virtio_pcm.h | 3 ++ - sound/virtio/virtio_pcm_ops.c | 33 ++++++++++++++++----- - 3 files changed, 85 insertions(+), 7 deletions(-) - -diff --git a/sound/virtio/virtio_card.c b/sound/virtio/virtio_card.c -index 1c03fcc41c3b..ae9128063917 100644 ---- a/sound/virtio/virtio_card.c -+++ b/sound/virtio/virtio_card.c -@@ -362,6 +362,58 @@ static void virtsnd_remove(struct virtio_device *vdev) - kfree(snd->event_msgs); - } - -+#ifdef CONFIG_PM_SLEEP -+/** -+ * virtsnd_freeze() - Suspend device. -+ * @vdev: VirtIO parent device. -+ * -+ * Context: Any context. -+ * Return: 0 on success, -errno on failure. -+ */ -+static int virtsnd_freeze(struct virtio_device *vdev) -+{ -+ struct virtio_snd *snd = vdev->priv; -+ unsigned int i; -+ -+ virtsnd_disable_event_vq(snd); -+ virtsnd_ctl_msg_cancel_all(snd); -+ -+ vdev->config->del_vqs(vdev); -+ vdev->config->reset(vdev); -+ -+ for (i = 0; i < snd->nsubstreams; ++i) -+ cancel_work_sync(&snd->substreams[i].elapsed_period); -+ -+ kfree(snd->event_msgs); -+ snd->event_msgs = NULL; -+ -+ return 0; -+} -+ -+/** -+ * virtsnd_restore() - Resume device. -+ * @vdev: VirtIO parent device. -+ * -+ * Context: Any context. -+ * Return: 0 on success, -errno on failure. -+ */ -+static int virtsnd_restore(struct virtio_device *vdev) -+{ -+ struct virtio_snd *snd = vdev->priv; -+ int rc; -+ -+ rc = virtsnd_find_vqs(snd); -+ if (rc) -+ return rc; -+ -+ virtio_device_ready(vdev); -+ -+ virtsnd_enable_event_vq(snd); -+ -+ return 0; -+} -+#endif /* CONFIG_PM_SLEEP */ -+ - static const struct virtio_device_id id_table[] = { - { VIRTIO_ID_SOUND, VIRTIO_DEV_ANY_ID }, - { 0 }, -@@ -374,6 +426,10 @@ static struct virtio_driver virtsnd_driver = { - .validate = virtsnd_validate, - .probe = virtsnd_probe, - .remove = virtsnd_remove, -+#ifdef CONFIG_PM_SLEEP -+ .freeze = virtsnd_freeze, -+ .restore = virtsnd_restore, -+#endif - }; - - static int __init init(void) -diff --git a/sound/virtio/virtio_pcm.h b/sound/virtio/virtio_pcm.h -index 1353fdc9bd69..062eb8e8f2cf 100644 ---- a/sound/virtio/virtio_pcm.h -+++ b/sound/virtio/virtio_pcm.h -@@ -31,6 +31,8 @@ struct virtio_pcm_msg; - * @xfer_xrun: Data underflow/overflow state (0 - no xrun, 1 - xrun). - * @stopped: True if the substream is stopped and must be released on the device - * side. -+ * @suspended: True if the substream is suspended and must be reconfigured on -+ * the device side at resume. - * @msgs: Allocated I/O messages. - * @nmsgs: Number of allocated I/O messages. - * @msg_last_enqueued: Index of the last I/O message added to the virtqueue. -@@ -52,6 +54,7 @@ struct virtio_pcm_substream { - bool xfer_enabled; - bool xfer_xrun; - bool stopped; -+ bool suspended; - struct virtio_pcm_msg **msgs; - unsigned int nmsgs; - int msg_last_enqueued; -diff --git a/sound/virtio/virtio_pcm_ops.c b/sound/virtio/virtio_pcm_ops.c -index 0682a2df6c8c..f8bfb87624be 100644 ---- a/sound/virtio/virtio_pcm_ops.c -+++ b/sound/virtio/virtio_pcm_ops.c -@@ -115,6 +115,7 @@ static int virtsnd_pcm_open(struct snd_pcm_substream *substream) - SNDRV_PCM_HW_PARAM_PERIODS); - - vss->stopped = !!virtsnd_pcm_msg_pending_num(vss); -+ vss->suspended = false; - - /* - * If the substream has already been used, then the I/O queue may be in -@@ -272,16 +273,31 @@ static int virtsnd_pcm_prepare(struct snd_pcm_substream *substream) - struct virtio_device *vdev = vss->snd->vdev; - struct virtio_snd_msg *msg; - -- if (virtsnd_pcm_msg_pending_num(vss)) { -- dev_err(&vdev->dev, "SID %u: invalid I/O queue state\n", -- vss->sid); -- return -EBADFD; -+ if (!vss->suspended) { -+ if (virtsnd_pcm_msg_pending_num(vss)) { -+ dev_err(&vdev->dev, "SID %u: invalid I/O queue state\n", -+ vss->sid); -+ return -EBADFD; -+ } -+ -+ vss->buffer_bytes = snd_pcm_lib_buffer_bytes(substream); -+ vss->hw_ptr = 0; -+ vss->msg_last_enqueued = -1; -+ } else { -+ struct snd_pcm_runtime *runtime = substream->runtime; -+ unsigned int buffer_bytes = snd_pcm_lib_buffer_bytes(substream); -+ unsigned int period_bytes = snd_pcm_lib_period_bytes(substream); -+ int rc; -+ -+ rc = virtsnd_pcm_dev_set_params(vss, buffer_bytes, period_bytes, -+ runtime->channels, -+ runtime->format, runtime->rate); -+ if (rc) -+ return rc; - } - -- vss->buffer_bytes = snd_pcm_lib_buffer_bytes(substream); -- vss->hw_ptr = 0; - vss->xfer_xrun = false; -- vss->msg_last_enqueued = -1; -+ vss->suspended = false; - vss->msg_count = 0; - - msg = virtsnd_pcm_ctl_msg_alloc(vss, VIRTIO_SND_R_PCM_PREPARE, -@@ -336,6 +352,9 @@ static int virtsnd_pcm_trigger(struct snd_pcm_substream *substream, int command) - } - - return virtsnd_ctl_msg_send_sync(snd, msg); -+ case SNDRV_PCM_TRIGGER_SUSPEND: -+ vss->suspended = true; -+ fallthrough; - case SNDRV_PCM_TRIGGER_STOP: - vss->stopped = true; - fallthrough; diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/virtio-snd.cfg b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/virtio-snd.cfg deleted file mode 100644 index 35c5134a0..000000000 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/virtio-snd.cfg +++ /dev/null @@ -1,5 +0,0 @@ -CONFIG_SND_TIMER=y -CONFIG_SND_PCM=y -CONFIG_SND_JACK=y -CONFIG_SND_JACK_INPUT_DEV=y -CONFIG_SND_VIRTIO=y
\ No newline at end of file diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/virtio-snd.scc b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/virtio-snd.scc deleted file mode 100644 index ba7b4ceb6..000000000 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio-snd/virtio-snd.scc +++ /dev/null @@ -1,11 +0,0 @@ -# SPDX-License-Identifier: MIT -kconf hardware virtio-snd.cfg -patch 0001-uapi-virtio_ids-add-a-sound-device-type-ID-from-OASI.patch -patch 0002-ALSA-virtio-add-virtio-sound-driver.patch -patch 0003-ALSA-virtio-handling-control-messages.patch -patch 0004-ALSA-virtio-build-PCM-devices-and-substream-hardware.patch -patch 0005-ALSA-virtio-handling-control-and-I-O-messages-for-th.patch -patch 0006-ALSA-virtio-PCM-substream-operators.patch -patch 0007-ALSA-virtio-introduce-jack-support.patch -patch 0008-ALSA-virtio-introduce-PCM-channel-map-support.patch -patch 0009-ALSA-virtio-introduce-device-suspend-resume-support.patch diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio.cfg b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio.cfg deleted file mode 100644 index b8b36e7ad..000000000 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio.cfg +++ /dev/null @@ -1,16 +0,0 @@ -# SPDX-License-Identifier: MIT - -# TODO: upstream to yocto-kernel-cache/cfg/8250.cfg -CONFIG_SERIAL_OF_PLATFORM=y - -# Remove since PCI is not enabled -# CONFIG_SERIAL_8250_PCI is not set - -# TODO: upstream to yocto-kernel-cache/cfg/virtio.cfg -CONFIG_VSOCKETS=y -CONFIG_VSOCKETS_DIAG=y -CONFIG_VIRTIO_VSOCKETS=y -CONFIG_VIRTIO_VSOCKETS_COMMON=y - -# Needed for CONFIG_DRM_VIRTIO_GPU -CONFIG_DRM=y diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio.scc b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio.scc deleted file mode 100644 index 755cde94e..000000000 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-kmeta/bsp/virtio/virtio.scc +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-License-Identifier: MIT -kconf hardware virtio.cfg -patch virtio-input-add-multi-touch-support.patch - -include virtio-snd/virtio-snd.scc diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-pci.cfg b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-pci.cfg new file mode 100644 index 000000000..bbcaca312 --- /dev/null +++ b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto/virtio-pci.cfg @@ -0,0 +1,3 @@ +CONFIG_PCI=y +CONFIG_VIRTIO_PCI=y +CONFIG_PCI_HOST_GENERIC=y diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto_%.bbappend b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto_%.bbappend deleted file mode 100644 index 0f255cddb..000000000 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto_%.bbappend +++ /dev/null @@ -1,8 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/linux-yocto:" - -SRC_URI:append:virtio-all = " \ - file://virtio-kmeta;type=kmeta;destsuffix=virtio-kmeta \ - file://virtio-kmeta/bsp/virtio/virtio-aarch64-${LINUX_KERNEL_TYPE}.scc \ -" - -COMPATIBLE_MACHINE_virtio-aarch64 = "virtio-aarch64" diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto_5.10.bb b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto_5.10.bb deleted file mode 100644 index 322ae51ea..000000000 --- a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto_5.10.bb +++ /dev/null @@ -1,58 +0,0 @@ -KBRANCH ?= "v5.10/standard/base" - -require recipes-kernel/linux/linux-yocto.inc - -# board specific branches -KBRANCH:qemuarm ?= "v5.10/standard/arm-versatile-926ejs" -KBRANCH:qemuarm64 ?= "v5.10/standard/qemuarm64" -KBRANCH:qemumips ?= "v5.10/standard/mti-malta32" -KBRANCH:qemuppc ?= "v5.10/standard/qemuppc" -KBRANCH:qemuriscv64 ?= "v5.10/standard/base" -KBRANCH:qemuriscv32 ?= "v5.10/standard/base" -KBRANCH:qemux86 ?= "v5.10/standard/base" -KBRANCH:qemux86-64 ?= "v5.10/standard/base" -KBRANCH:qemumips64 ?= "v5.10/standard/mti-malta64" - -SRCREV_machine:qemuarm ?= "d8551cae1ccdbe062a5c6068ce39ea8f4e1c72db" -SRCREV_machine:qemuarm64 ?= "cf5b0320cf4544d3db9ce3ddd6ddb7553a610651" -SRCREV_machine:qemumips ?= "7f1f1ad2f2d90b1b070c6b0a82f0add9aa492e37" -SRCREV_machine:qemuppc ?= "cf5b0320cf4544d3db9ce3ddd6ddb7553a610651" -SRCREV_machine:qemuriscv64 ?= "cf5b0320cf4544d3db9ce3ddd6ddb7553a610651" -SRCREV_machine:qemuriscv32 ?= "cf5b0320cf4544d3db9ce3ddd6ddb7553a610651" -SRCREV_machine:qemux86 ?= "cf5b0320cf4544d3db9ce3ddd6ddb7553a610651" -SRCREV_machine:qemux86-64 ?= "cf5b0320cf4544d3db9ce3ddd6ddb7553a610651" -SRCREV_machine:qemumips64 ?= "fd5ac097b891642eea13659bea536f3ec5910d6d" -SRCREV_machine ?= "cf5b0320cf4544d3db9ce3ddd6ddb7553a610651" -SRCREV_meta ?= "031f6c76e488a3563f35258c72ff1de3e25a512e" - -# remap qemuarm to qemuarma15 for the 5.8 kernel -# KMACHINE:qemuarm ?= "qemuarma15" - -SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRANCH}; \ - git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.10;destsuffix=${KMETA}" - -LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" -LINUX_VERSION ?= "5.10.25" - -DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}" -DEPENDS += "openssl-native util-linux-native" -DEPENDS += "gmp-native" - -PV = "${LINUX_VERSION}+git${SRCPV}" - -KMETA = "kernel-meta" -KCONF_BSP_AUDIT_LEVEL = "1" - -KERNEL_DEVICETREE:qemuarmv5 = "versatile-pb.dtb" - -COMPATIBLE_MACHINE = "qemuarm|qemuarmv5|qemuarm64|qemux86|qemuppc|qemuppc64|qemumips|qemumips64|qemux86-64|qemuriscv64|qemuriscv32" - -# Functionality flags -KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc" -KERNEL_FEATURES:append = " ${KERNEL_EXTRA_FEATURES}" -KERNEL_FEATURES:append:qemuall=" cfg/virtio.scc features/drm-bochs/drm-bochs.scc" -KERNEL_FEATURES:append:qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc" -KERNEL_FEATURES:append:qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc" -KERNEL_FEATURES:append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32.scc", "", d)}" -KERNEL_FEATURES:append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", " features/scsi/scsi-debug.scc", "", d)}" -KERNEL_FEATURES:append = " ${@bb.utils.contains("DISTRO_FEATURES", "ptest", " features/gpio/mockup.scc", "", d)}"
\ No newline at end of file diff --git a/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto_5.15.bbappend b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto_5.15.bbappend new file mode 100644 index 000000000..6952436a3 --- /dev/null +++ b/meta-agl-bsp/virtualization-layer/recipes-kernel/linux/linux-yocto_5.15.bbappend @@ -0,0 +1,17 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +# Cannot just append to SRC_URI, as the metadata interferes with the +# AGL config fragment scheme +AGL_KERNEL_SRC:prepend:virtio-all = " \ + git://gerrit.automotivelinux.org/gerrit/src/agl-yocto-kernel-meta.git;protocol=https;type=kmeta;name=agl-meta;destsuffix=agl-kernel-meta;branch=kernel-5.15 \ + file://virtio-aarch64-${LINUX_KERNEL_TYPE}.scc \ +" + +SRCREV_agl-meta = "4deb7357eab5962b0553a5ad1f11be5ac35f9da9" + +AGL_KCONFIG_FRAGMENTS:append:virtio-all = " \ + virtio-drm.cfg \ + virtio-pci.cfg \ +" + +COMPATIBLE_MACHINE:virtio-aarch64 = "virtio-aarch64" diff --git a/meta-agl-core-test/conf/include/agl-test.inc b/meta-agl-core-test/conf/include/agl-test.inc deleted file mode 100644 index e69de29bb..000000000 --- a/meta-agl-core-test/conf/include/agl-test.inc +++ /dev/null diff --git a/meta-agl-core-test/conf/layer.conf b/meta-agl-core-test/conf/layer.conf deleted file mode 100644 index 2ce0c18f1..000000000 --- a/meta-agl-core-test/conf/layer.conf +++ /dev/null @@ -1,14 +0,0 @@ -# We have a conf and classes directory, add to BBPATH -BBPATH =. "${LAYERDIR}:" - -# We have recipes-* directories, add to BBFILES -BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ - ${LAYERDIR}/recipes-*/*/*.bbappend" - -BBFILE_COLLECTIONS += "aglcoretest" -BBFILE_PATTERN_aglcoretest = "^${LAYERDIR}/" -BBFILE_PRIORITY_aglcoretest = "60" - -LAYERSERIES_COMPAT_aglcoretest = "dunfell" -LAYERDEPENDS_aglcoretest = "core aglcore" -LAYERDEPENDS_aglcoretest += "openembedded-layer" diff --git a/meta-agl-core-test/images/agl-image-minimal-qa.bb b/meta-agl-core-test/images/agl-image-minimal-qa.bb deleted file mode 100644 index a5ec70830..000000000 --- a/meta-agl-core-test/images/agl-image-minimal-qa.bb +++ /dev/null @@ -1,12 +0,0 @@ -SUMMARY = "An AGL small image just capable of allowing a device to boot and run tests." - -DESCRIPTION = "A minimal set of AGL Distribution. This image also has additional \ -packages (e.g. commandline tools) for Quality Assurance(QA)." - -require agl-image-minimal.bb - -LICENSE = "MIT" - -IMAGE_INSTALL:append = " \ - packagegroup-ivi-common-test \ - " diff --git a/meta-agl-core-test/recipes-test/aiostress/aiostress_0.22.bb b/meta-agl-core-test/recipes-test/aiostress/aiostress_0.22.bb deleted file mode 100644 index 7803d74ed..000000000 --- a/meta-agl-core-test/recipes-test/aiostress/aiostress_0.22.bb +++ /dev/null @@ -1,24 +0,0 @@ -SUMMARY = "Async IO testing utility" -DESCRIPTION = "aio-stress will open or create each file on the command line, and start a series of aio to it.\ -aio is done in a rotating loop. first file1 gets 8 requests, then file2, then file3 etc.\ -As each file finishes writing, it is switched to reads io buffers are aligned in case you want to do raw io" -HOMEPAGE = "https://oss.oracle.com/~mason/aio-stress/" -LICENSE = "GPLv2" - -S="${WORKDIR}" - -LIC_FILES_CHKSUM = "file://${S}/aio-stress.c;md5=ccb5d196a3736bbd835d582a4e2329c3" - -SRC_URI = "https://oss.oracle.com/~mason/aio-stress/aio-stress.c" -SRC_URI[md5sum] = "ccb5d196a3736bbd835d582a4e2329c3" -SRC_URI[sha256sum] = "3f4cffcc946fb717fff9d8fe932c7c2ee606efff198408d9fbe16955151445f7" - -do_compile () { - ${CC} -Wall -Wshadow -o aio-stress -lpthread -laio aio-stress.c -} - -do_install () { - install -d ${D}${bindir} - install -m 0755 aio-stress ${D}${bindir} -} - diff --git a/meta-agl-core-test/recipes-test/dung/dung_3.4.25-m2.bb b/meta-agl-core-test/recipes-test/dung/dung_3.4.25-m2.bb deleted file mode 100644 index 28bf858a0..000000000 --- a/meta-agl-core-test/recipes-test/dung/dung_3.4.25-m2.bb +++ /dev/null @@ -1,18 +0,0 @@ -SUMMARY = "Kernel test scripts" -LICENSE = "GPLv2" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" - -SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/qa-test-misc;protocol=https;branch=${AGL_BRANCH}" -SRCREV = "e2472c7b1d061aef8bb05a4d7940fd8159c4a329" - -inherit allarch - -S = "${WORKDIR}/git/${PN}-${PV}" - -do_install () { - for subdir in arch_timer cmt common scifab sdhi.0; do - install -d -m 0755 ${D}/${datadir}/${PN}/$subdir - install -m 0755 -t ${D}/${datadir}/${PN}/$subdir ${S}/$subdir/* - done -} - diff --git a/meta-agl-core-test/recipes-test/ebizzy/ebizzy_0.3.bb b/meta-agl-core-test/recipes-test/ebizzy/ebizzy_0.3.bb deleted file mode 100644 index 5e993519d..000000000 --- a/meta-agl-core-test/recipes-test/ebizzy/ebizzy_0.3.bb +++ /dev/null @@ -1,20 +0,0 @@ -DESCRIPTION = "Benchmark tool that generates a workload resembling common web application server workloads" -HOMEPAGE = "http://ebizzy.sourceforge.net/" -LICENSE = "GPLv2" -LIC_FILES_CHKSUM = "file://LICENSE;md5=eb723b61539feef013de476e68b5c50a" - -SRC_URI = "http://downloads.sourceforge.net/project/ebizzy/ebizzy/${PV}/ebizzy-${PV}.tar.gz" -SRC_URI[md5sum] = "af038bc506066bb3d28db08aba62bc38" -SRC_URI[sha256sum] = "77286029d6348f3d9b3f04eae1feadb5ad1ad07b9f688f4d9f002960862467f2" - -INSANE_SKIP:${PN} = "ldflags" - -do_compile () { - ${CC} -Wall -Wshadow -lpthread -o ebizzy ebizzy.c -} - -do_install () { - install -d ${D}${bindir} - install -m 0755 ebizzy ${D}${bindir} -} - diff --git a/meta-agl-core-test/recipes-test/ffsb/ffsb_6.0-rc2.bb b/meta-agl-core-test/recipes-test/ffsb/ffsb_6.0-rc2.bb deleted file mode 100644 index 66db133e3..000000000 --- a/meta-agl-core-test/recipes-test/ffsb/ffsb_6.0-rc2.bb +++ /dev/null @@ -1,14 +0,0 @@ -DESCRIPTION = "Flexible File System Benchmark" -HOMEPAGE = "https://sourceforge.net/projects/ffsb/" -LICENSE = "GPLv2" -LIC_FILES_CHKSUM = "file://LICENSE;md5=fd5d9bcabd8ed5a54a01ce8d183d592a" - -SRC_URI = "http://downloads.sourceforge.net/project/ffsb/ffsb/ffsb-${PV}/ffsb-${PV}.tar.bz2" -SRC_URI[md5sum] = "cabfc1021c2ec6c6b168fefc84210891" -SRC_URI[sha256sum] = "e5867692aae8c9bfbcdc774599022289c4d89c1d90f4dd7101fb9865ac773c71" - -inherit autotools - -# extra args to configure -EXTRA_OECONF = "" - diff --git a/meta-agl-core-test/recipes-test/fontconfig/fontconfig_%.bbappend b/meta-agl-core-test/recipes-test/fontconfig/fontconfig_%.bbappend deleted file mode 100644 index 481dd9ee4..000000000 --- a/meta-agl-core-test/recipes-test/fontconfig/fontconfig_%.bbappend +++ /dev/null @@ -1,18 +0,0 @@ -do_install:append() { - install -m 755 -d ${D}/${datadir}/fontconfig-test - install -m 755 ${S}/test/run-test.sh ${D}/${datadir}/fontconfig-test/ - - sed -i -e "s#^FCLIST=\.\./fc-list/fc-list#FCLIST=/usr/bin/fc-list#g" -e "s#^FCCACHE=\.\./fc-cache/fc-cache#FCCACHE=/usr/bin/fc-cache#g" ${D}/${datadir}/fontconfig-test/run-test.sh - - install -m 644 ${B}/test/out.expected ${D}/${datadir}/fontconfig-test/ - for x in 4x6.pcf 8x16.pcf fonts.conf.in; do - install -m 644 ${S}/test/$x ${D}/${datadir}/fontconfig-test/ - done -} - -PACKAGES =+ "fontconfig-test" - -DEBIAN_NOAUTONAME:fontconfig-test = "1" -FILES:fontconfig-test = "${datadir}/fontconfig-test/*" - - diff --git a/meta-agl-core-test/recipes-test/freetype/files/0001-Makefile-dont-build-gfx-demos.patch b/meta-agl-core-test/recipes-test/freetype/files/0001-Makefile-dont-build-gfx-demos.patch deleted file mode 100644 index 4d0d09aea..000000000 --- a/meta-agl-core-test/recipes-test/freetype/files/0001-Makefile-dont-build-gfx-demos.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff -ur ft2demos-2.9.1.orig/Makefile ft2demos-2.9.1/Makefile ---- ft2demos-2.9.1.orig/Makefile 2018-04-22 05:41:50.000000000 -0400 -+++ ft2demos-2.9.1/Makefile 2019-02-18 23:28:59.794678736 -0500 -@@ -163,7 +163,8 @@ - - ifeq ($(PLATFORM),unix) - CC = $(CCraw) -- LINK_CMD = $(subst /,$(SEP),$(OBJ_BUILD)/libtool) \ -+ LIBTOOL = $(OBJ_BUILD)/libtool -+ LINK_CMD = $(subst /,$(SEP),$(LIBTOOL)) \ - --mode=link $(CC) \ - $(subst /,$(COMPILER_SEP),$(LDFLAGS)) - LINK_LIBS = $(subst /,$(COMPILER_SEP),$(FTLIB) $(EFENCE)) $(LIB_CLOCK_GETTIME) -@@ -289,12 +290,12 @@ - ttdebug - - # Comment out the next line if you don't have a graphics subsystem. -- EXES += ftdiff \ -- ftgamma \ -- ftgrid \ -- ftmulti \ -- ftstring \ -- ftview -+ # EXES += ftdiff \ -+ # ftgamma \ -+ # ftgrid \ -+ # ftmulti \ -+ # ftstring \ -+ # ftview - - # ftvalid requires ftgxval.c and ftotval.c - # diff --git a/meta-agl-core-test/recipes-test/freetype/files/0001-ft2demos-Makefile-Do-not-hardcode-libtool-path.patch b/meta-agl-core-test/recipes-test/freetype/files/0001-ft2demos-Makefile-Do-not-hardcode-libtool-path.patch deleted file mode 100644 index 7803ad7e0..000000000 --- a/meta-agl-core-test/recipes-test/freetype/files/0001-ft2demos-Makefile-Do-not-hardcode-libtool-path.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 8c4f135619de929f9348b830a07a46a0c2c38e51 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jan-Simon=20M=C3=B6ller?= <jsmoeller@linuxfoundation.org> -Date: Fri, 7 Oct 2016 15:26:20 +0200 -Subject: [PATCH] Do not hardcode libtool path -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It is already known and imported through config.mk. - -Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org> ---- - Makefile | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/Makefile b/Makefile -index a5d34bd..254aad4 100644 ---- a/Makefile -+++ b/Makefile -@@ -153,7 +153,6 @@ else - - ifeq ($(PLATFORM),unix) - CC = $(CCraw) -- LIBTOOL = $(OBJ_BUILD)/libtool - LINK_CMD = $(subst /,$(SEP),$(LIBTOOL)) \ - --mode=link $(CC) \ - $(subst /,$(COMPILER_SEP),$(LDFLAGS)) --- -2.1.4 - diff --git a/meta-agl-core-test/recipes-test/freetype/freetype_2.%.bbappend b/meta-agl-core-test/recipes-test/freetype/freetype_2.%.bbappend deleted file mode 100644 index 8fc56fa35..000000000 --- a/meta-agl-core-test/recipes-test/freetype/freetype_2.%.bbappend +++ /dev/null @@ -1,34 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/files:" - -SRC_URI =+ "${SOURCEFORGE_MIRROR}/freetype/freetype-demos/${PV}/ft2demos-${PV}.tar.gz;name=ft2demos \ - file://0001-Makefile-dont-build-gfx-demos.patch;patchdir=../ft2demos-${PV} \ - file://0001-ft2demos-Makefile-Do-not-hardcode-libtool-path.patch;patchdir=../ft2demos-${PV} \ - " -SRC_URI[ft2demos.md5sum] = "c376adf4782bac9b9ac8e427884752d2" -SRC_URI[ft2demos.sha256sum] = "5e9e94a2db9d1a945293a1644a502f6664a2173a454d4a55b19695e2e2f4a0bc" - -PACKAGES =+ "${PN}-demos" - -B = "${S}" - -do_compile:append () { - oe_runmake -C ${WORKDIR}/ft2demos-${PV} TOP_DIR=${WORKDIR}/${BPN}-${PV}/ -} - -do_install:append () { - install -d -m 0755 ${D}/${bindir} - for x in ftbench ftdump ftlint ftvalid ttdebug; do - install -m 0755 ${WORKDIR}/ft2demos-${PV}/bin/.libs/$x ${D}/${bindir} - done -} - -FILES:${PN}-demos = "\ - ${bindir}/ftbench \ - ${bindir}/ftdump \ - ${bindir}/ftlint \ - ${bindir}/ftvalid \ - ${bindir}/ttdebug \ -" - -# enable pixmap/libpng support to allow color emojis -PACKAGECONFIG:append = " pixmap" diff --git a/meta-agl-core-test/recipes-test/fsfuzzer/files/0001-fix_missing_header_sys_stat.patch b/meta-agl-core-test/recipes-test/fsfuzzer/files/0001-fix_missing_header_sys_stat.patch deleted file mode 100644 index e834becf3..000000000 --- a/meta-agl-core-test/recipes-test/fsfuzzer/files/0001-fix_missing_header_sys_stat.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -urN fsfuzzer-0.7.orig/fstest.c fsfuzzer-0.7/fstest.c ---- fsfuzzer-0.7.orig/fstest.c 2009-01-25 14:50:06.000000000 +0000 -+++ fsfuzzer-0.7/fstest.c 2016-06-16 17:49:27.264565819 +0000 -@@ -35,6 +35,7 @@ - #include <signal.h> - #include <sys/file.h> - #include <sys/mman.h> -+#include <sys/stat.h> - - #define LOGGIT 1 - #define CHECK_XATTR 1 diff --git a/meta-agl-core-test/recipes-test/fsfuzzer/fsfuzzer_0.7.bb b/meta-agl-core-test/recipes-test/fsfuzzer/fsfuzzer_0.7.bb deleted file mode 100644 index d2ddb59b1..000000000 --- a/meta-agl-core-test/recipes-test/fsfuzzer/fsfuzzer_0.7.bb +++ /dev/null @@ -1,18 +0,0 @@ -SUMMARY = "The fsfuzzer is a filesystem fuzzer tool that does stress tests of various filesystems in a reproducible and logged way." -DESCRIPTION = "This tool creates initial (valid) filesystem images and then manipulates their binary format and structure for detecting flaws/bugs/design problems in the parsing/handling code for that particular filesystem. The program expects that you have a /media directory. It uses that one for mounting test images in." -HOMEPAGE = "https://www.ee.oulu.fi/research/ouspg/fsfuzzer" - -LICENSE = "GPLv2" -LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" - -SRC_URI = "http://people.redhat.com/sgrubb/files/fsfuzzer-${PV}.tar.gz \ - file://0001-fix_missing_header_sys_stat.patch \ - " -SRC_URI[md5sum] = "d69ac4b67aaba52a889c9188eb456c15" -SRC_URI[sha256sum] = "094aa17c4f66c525a04e5db5ad444b4a561b6f8e310d0bd70b9ca421cdf0a434" - -inherit autotools - -# Specify any options you want to pass to the configure script using EXTRA_OECONF: -EXTRA_OECONF = "" - diff --git a/meta-agl-core-test/recipes-test/glmark2/glmark2_%.bbappend b/meta-agl-core-test/recipes-test/glmark2/glmark2_%.bbappend deleted file mode 100644 index ab453d8b0..000000000 --- a/meta-agl-core-test/recipes-test/glmark2/glmark2_%.bbappend +++ /dev/null @@ -1,7 +0,0 @@ -# Update glmark2 -SRCREV = "784aca755a469b144acf3cae180b6e613b7b057a" -# Already in newer version -SRC_URI:remove = "file://python3.patch" - -PACKAGECONFIG = "wayland-gles2" -PACKAGECONFIG[wayland-gles2] = ",,virtual/egl virtual/libgles2 wayland wayland-protocols wayland-native" diff --git a/meta-agl-core-test/recipes-test/himeno/himeno_2.0.bb b/meta-agl-core-test/recipes-test/himeno/himeno_2.0.bb deleted file mode 100644 index de1c8d3ad..000000000 --- a/meta-agl-core-test/recipes-test/himeno/himeno_2.0.bb +++ /dev/null @@ -1,27 +0,0 @@ -DESCRIPTION = "Himeno Benchmark" -LICENSE = "LGPL-2.0" -URL = "http://accc.riken.jp/en/supercom/himenobmt/" - -SRC_URI = "http://accc.riken.jp/en/wp-content/uploads/sites/2/2015/07/himenobmt.c.zip" -SRC_URI[md5sum] = "8d8e837dfc3e00a3b322eb4ae3edd551" -SRC_URI[sha256sum] = "8780bfbdacb0d4dcab2931e65cadd69411731e3f2afcc1231d0743a036298077" - -LIC_FILES_CHKSUM = "file://himenoBMT.c;md5=8e8771ddc01c6d1a795e088e2d6dee78" - -# Upstream ZIP file contains an LZH archive, thus a 2 steps "unpack" is required. -# The LZH archive is unpacked after native tools dependency resolution, -# thus. after "configure" task in our case: - -DEPENDS = "p7zip-native" - -do_configure:append() { - 7z x -y -o${S} ${WORKDIR}/himenobmt.c.lzh - cd ${S} - sed -i -e 's/CC= gcc/#CC= gcc/' Makefile - sed -i -e 's/CFLAGS = /#CFLAGS = /' Makefile -} - -do_install () { - install -d ${D}${bindir} - install -m 0755 bmt ${D}${bindir} -} diff --git a/meta-agl-core-test/recipes-test/interbench/files/interbench.c.patch b/meta-agl-core-test/recipes-test/interbench/files/interbench.c.patch deleted file mode 100644 index c882739ba..000000000 --- a/meta-agl-core-test/recipes-test/interbench/files/interbench.c.patch +++ /dev/null @@ -1,68 +0,0 @@ ---- interbench.c.orig 2009-10-30 23:14:59.000000000 -0500 -+++ interbench.c 2012-07-10 19:06:00.000000000 -0500 -@@ -71,6 +71,7 @@ struct user_data { - char datestamp[13]; - FILE *logfile; - } ud = { -+ .ram = 0, - .duration = 30, - .cpu_load = 4, - .log = 1, -@@ -652,6 +653,8 @@ void emulate_write(struct thread *th) - terminal_error("fopen"); - if (stat(name, &statbuf) == -1) - terminal_fileopen_error(fp, "stat"); -+ if (statbuf.st_blksize < MIN_BLK_SIZE) -+ statbuf.st_blksize = MIN_BLK_SIZE; - for (i = 0 ; i < mem; i++) { - if (fwrite(buf, statbuf.st_blksize, 1, fp) != 1) - terminal_fileopen_error(fp, "fwrite"); -@@ -1136,14 +1139,17 @@ void get_ram(void) - if(!(meminfo = fopen("/proc/meminfo", "r"))) - terminal_error("fopen"); - -- ud.ram = ud.swap = 0; -- while( !feof(meminfo) && !fscanf(meminfo, "MemTotal: %lu kB", &ud.ram) ) -- fgets(aux,sizeof(aux),meminfo); -+ if (!ud.ram) -+ { -+ while( !feof(meminfo) && !fscanf(meminfo, "MemTotal: %lu kB", &ud.ram) ) -+ fgets(aux,sizeof(aux),meminfo); -+ } -+ ud.swap = 0; - while( !feof(meminfo) && !fscanf(meminfo, "SwapTotal: %lu kB", &ud.swap) ) - fgets(aux,sizeof(aux),meminfo); - if (fclose(meminfo) == -1) - terminal_error("fclose"); -- -+ - if( !ud.ram || !ud.swap ) { - unsigned long i; - fprintf(stderr, "\nCould not get memory or swap size. "); -@@ -1399,6 +1405,7 @@ void usage(void) - fprintf(stderr, "\t[-h]\n\n"); - fprintf(stderr, " -l\tUse <int> loops per sec (default: use saved benchmark)\n"); - fprintf(stderr, " -L\tUse cpu load of <int> with burn load (default: 4)\n"); -+ fprintf(stderr, " -M\tForce RAM size to <int>. Useful when disk is smaller than RAM.\n"); - fprintf(stderr, " -t\tSeconds to run each benchmark (default: 30)\n"); - fprintf(stderr, " -B\tNice the benchmarked thread to <int> (default: 0)\n"); - fprintf(stderr, " -N\tNice the load thread to <int> (default: 0)\n"); -@@ -1482,7 +1489,7 @@ int main(int argc, char **argv) - terminal_error("signal"); - #endif - -- while ((q = getopt(argc, argv, "hl:L:B:N:ut:bcnrC:I:m:w:x:W:X:")) != -1) { -+ while ((q = getopt(argc, argv, "hl:L:M:B:N:ut:bcnrC:I:m:w:x:W:X:")) != -1) { - switch (q) { - case 'h': - usage(); -@@ -1496,6 +1503,9 @@ int main(int argc, char **argv) - case 'L': - ud.cpu_load = atoi(optarg); - break; -+ case 'M': -+ ud.ram = atoi(optarg); -+ break; - case 'B': - ud.bench_nice = atoi(optarg); - break; diff --git a/meta-agl-core-test/recipes-test/interbench/interbench_0.31.bb b/meta-agl-core-test/recipes-test/interbench/interbench_0.31.bb deleted file mode 100644 index b6c54cc9a..000000000 --- a/meta-agl-core-test/recipes-test/interbench/interbench_0.31.bb +++ /dev/null @@ -1,31 +0,0 @@ -DESCRIPTION = "The Linux interactivity benchmark" -HOMEPAGE = "http://users.tpg.com.au/ckolivas/interbench/" -LICENSE = "GPLv2" -LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833" -SRC_URI = "http://ck.kolivas.org/apps/interbench/interbench-${PV}.tar.bz2" - -SRC_URI += "file://interbench.c.patch;striplevel=0" - -inherit autotools - -INSANE_SKIP:${PN} = "ldflags" - -B = "${S}" -EXTRA_OEMAKE = "CC='${CC}'" - -# upstream tarball contains x86_64 binaries, we need a clean source tree -do_compile() { - oe_runmake clean - oe_runmake -} - -do_install() { - install -d ${D}${bindir} ${D}${datadir}/doc/${PN}/ ${D}${mandir}/man8/ - install -m 0755 ${B}/interbench ${D}${bindir} - install -m 0644 ${S}/readme* ${D}${datadir}/doc/${PN}/ - install -m 0644 ${S}/interbench.8 ${D}${mandir}/man8/ -} - -SRC_URI[md5sum] = "832254d7fd1255c548ebea7b97f01015" -SRC_URI[sha256sum] = "89d438b28aef22d26e79812762a57a9f9344a8dd8826edebfe60dad48ee1c784" - diff --git a/meta-agl-core-test/recipes-test/ipv6connect/ipv6connect.bb b/meta-agl-core-test/recipes-test/ipv6connect/ipv6connect.bb deleted file mode 100644 index 0f84a16f9..000000000 --- a/meta-agl-core-test/recipes-test/ipv6connect/ipv6connect.bb +++ /dev/null @@ -1,24 +0,0 @@ -SUMMARY = "ipv6connect test" -HOMEPAGE = "https://chromium.googlesource.com/chromiumos/third_party/autotest/+/0.12.369.B/client/tests/ipv6connect" -LICENSE = "GPLv2" -LIC_FILES_CHKSUM = "file://${S}/${PN}/LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263" - -SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/qa-test-misc;protocol=https;branch=${AGL_BRANCH}" -SRCREV = "b355b7e1f43a19938895964f314484ffd8a39542" - -inherit autotools - -INSANE_SKIP:${PN} = "ldflags" - -B = "${WORKDIR}/git/ipv6connect" -S = "${WORKDIR}/git" - -# configure script is not delivered, only a makefile. -do_configure() { - : -} - -do_install() { - install -d ${D}${bindir} - install -m 0755 ${B}/ipv6connect ${D}${bindir} -} diff --git a/meta-agl-core-test/recipes-test/linpack/linpack.bb b/meta-agl-core-test/recipes-test/linpack/linpack.bb deleted file mode 100644 index 84bed0ff6..000000000 --- a/meta-agl-core-test/recipes-test/linpack/linpack.bb +++ /dev/null @@ -1,23 +0,0 @@ -SUMMARY = "Linpack benchmark" -LICENSE = "BSD" -LIC_FILES_CHKSUM = "file://${S}/${PN}/linpack.c;md5=076f1fd8d313056103f98d4253862eae" - -SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/qa-test-misc;protocol=https;branch=${AGL_BRANCH}" -SRCREV = "920cae73a918d1f516113b0ae967be3ecaba86ef" - -DEPENDS += "rsync-native" - -inherit autotools - -S = "${WORKDIR}/git" - -# configure script is not delivered, only a makefile. -do_configure() { - mkdir -p ${B} - rsync -a ${S}/${PN}/* ${B} -} - -do_install() { - install -d ${D}${bindir} - install -m 0755 ${B}/linpack ${D}${bindir} -} diff --git a/meta-agl-core-test/recipes-test/linus-stress/linus-stress.bb b/meta-agl-core-test/recipes-test/linus-stress/linus-stress.bb deleted file mode 100644 index aaa4d138c..000000000 --- a/meta-agl-core-test/recipes-test/linus-stress/linus-stress.bb +++ /dev/null @@ -1,23 +0,0 @@ -SUMMARY = "linus_stress test" -HOMEPAGE = "https://chromium.googlesource.com/chromiumos/third_party/autotest/+/master/client/tests/linus_stress" -LICENSE = "GPLv2" -LIC_FILES_CHKSUM = "file://${S}/linus_stress/LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263" - -SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/qa-test-misc;protocol=https;branch=${AGL_BRANCH}" -SRCREV = "87cdfd4626c0cb47fc22f328867e49d6268df85c" - -inherit autotools -INSANE_SKIP:${PN} = "ldflags" - -B = "${WORKDIR}/git/linus_stress" -S = "${WORKDIR}/git" - -# configure script is not delivered, only a makefile. -do_configure() { - : -} - -do_install() { - install -d ${D}${bindir} - install -m 0755 ${B}/linus_stress ${D}${bindir} -} diff --git a/meta-agl-core-test/recipes-test/packagegroups/packagegroup-agl-test.bb b/meta-agl-core-test/recipes-test/packagegroups/packagegroup-agl-test.bb deleted file mode 100644 index 57a5d32e1..000000000 --- a/meta-agl-core-test/recipes-test/packagegroups/packagegroup-agl-test.bb +++ /dev/null @@ -1,68 +0,0 @@ -SUMMARY = "Utilities for testing of AGL" -DESCRIPTION = "A set of common packages required by testing AGL for Quality Assurance" - -LICENSE = "MIT" - -inherit packagegroup - -PACKAGES = "\ - packagegroup-agl-test \ - packagegroup-agl-test-ltp \ - packagegroup-ivi-common-test \ - " - -ALLOW_EMPTY:${PN} = "1" - -RDEPENDS:${PN} += "\ - bc \ - ebizzy \ - evtest \ - ffsb \ - glmark2 \ - interbench \ - ipv6connect \ - linpack \ - linus-stress \ - nmap \ - rt-tests \ - stress \ - " - - - - - -# to be added, but needs LICENSE_FLAGS_WHITELIST="non-commercial" -# netperf # meta-networking - -# relocate due to dependencies -# iperf3 \ # meta-oe -# lmbench \ # meta-oe -# dbench \ # meta-oe -# nbench-byte \ # meta-oe -# iozone3 \ # meta-oe -# - -# FTBS, SPEC-316 -# himeno # nowhere -# FTBS, SPEC-1384 -# trinity # meta-linaro (1.5) - -# packagegroup-agl-test-ltp \ -# ltp \ # ltp in oe-core -# - -# Packages for shell commands which are required by LTP -# readelf, logrotate, vsftpd, crontab, sar, arp, ftp, -# host, rcp, rlogin, rsh, tcpdump, expect, iptables, dnsmasq, -# pgrep -RDEPENDS:packagegroup-agl-test-ltp = "" -#RDEPENDS:packagegroup-agl-test-ltp += " \ -# initscripts-functions bind-utils binutils \ -# cronie dnsmasq expect inetutils-ftp inetutils-rsh \ -# iptables logrotate net-tools sysstat tcpdump vsftpd \ -# " - -RDEPENDS:packagegroup-ivi-common-test = " \ - packagegroup-agl-test \ - " diff --git a/meta-agl-core-test/recipes-test/trinity/trinity_git.bb b/meta-agl-core-test/recipes-test/trinity/trinity_git.bb deleted file mode 100644 index eec3381c5..000000000 --- a/meta-agl-core-test/recipes-test/trinity/trinity_git.bb +++ /dev/null @@ -1,42 +0,0 @@ -SUMMARY = "a Linux System call fuzz teste." -DESCRIPTION = "Trinity, a Linux System call fuzz tester." -HOMEPAGE = "http://codemonkey.org.uk/projects/trinity/" -LICENSE = "GPLv2" -LIC_FILES_CHKSUM = "file://${S}/COPYING;md5=96094d47cfbd2cc45eb46ce0fc423c04" - -COMPATIBLE_HOST = "(x86_64|arm|aarch64).*-linux" - -PV = "1.5" -SRCREV = "edc2e693e298e0372010a361354c4a79a3cd93f3" -SRC_URI = "git://github.com/kernelslacker/trinity.git;protocol=https;nobranch=1 \ - " - -S = "${WORKDIR}/git" - -inherit useradd - -USERADD_PACKAGES = "${PN}" -USERADD_PARAM:${PN} = "--system --create-home --shell /bin/sh ${PN} " - -do_configure () { - ./configure.sh -} - -# workaround random build failures -do_compile () { - ${MAKE} -} - -do_install () { - oe_runmake install DESTDIR=${D}/usr - install -o ${PN} -d -m 0755 ${D}/${datadir}/${PN} - install -o ${PN} -m 0755 ${S}/scripts/test-all-syscalls-parallel.sh ${D}/${datadir}/${PN} - install -o ${PN} -m 0755 ${S}/scripts/test-all-syscalls-sequentially.sh ${D}/${datadir}/${PN} - install -o ${PN} -m 0755 ${S}/scripts/test-multi.sh ${D}/${datadir}/${PN} - install -o ${PN} -m 0755 ${S}/scripts/test-vm.sh ${D}/${datadir}/${PN} -} - -PACKAGES =+ "${PN}-example" - -FILES:${PN} = "${bindir}/trinity" -FILES:${PN}-example = "${datadir}/${PN}" diff --git a/meta-agl-core/README-AGL.md b/meta-agl-core/README-AGL.md index c7fc029e7..e410de29a 100644 --- a/meta-agl-core/README-AGL.md +++ b/meta-agl-core/README-AGL.md @@ -19,3 +19,15 @@ This section provides information about the layers used by the AGL Project: ``` $ git clone https://gerrit.automotivelinux.org/gerrit/AGL/meta-agl ``` + +Maintenance +----------- + +All patches must be submitted via the AGL Gerrit instance at +<https://gerrit.automotivelinux.org>. See this wiki page for +details: + +<https://wiki.automotivelinux.org/agl-distro/contributing> + +Layer maintainers: +* Jan-Simon Möller <jsmoeller@linuxfoundation.org> diff --git a/meta-agl-core/classes/agl-core-image.bbclass b/meta-agl-core/classes/agl-core-image.bbclass new file mode 100644 index 000000000..bb5580391 --- /dev/null +++ b/meta-agl-core/classes/agl-core-image.bbclass @@ -0,0 +1,32 @@ +# AGL base image class +# +# As opposed to using core-image directly, this class: +# - does not pull in packagegroup-base-extended by default to minimize images. +# This does mean that many of the oe-core / poky MACHINE and DISTRO features +# (e.g. 3g, nfs, etc.) will not result in packages being automatically pulled +# into images since that is driven via packagegroup-base. +# - includes hooks for integrating SELinux via meta-selinux +# - disables locale installation by default +# + +# Disable locales +IMAGE_LINGUAS = "" + +# Hook to allow inheriting e.g. selinux-image by default. +# Any bbclass used as a value should ultimately inherit core-image +AGL_BASE_IMAGE ?= "core-image" + +inherit ${AGL_BASE_IMAGE} + +FEATURE_PACKAGES_selinux = " \ + packagegroup-agl-core-selinux \ + ${@bb.utils.contains('DISTRO_FEATURES', 'agl-devel', 'packagegroup-agl-core-selinux-devel', '', d)} \ +" + +IMAGE_FEATURES:append = " ${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}" + +CORE_IMAGE_BASE_INSTALL = " \ + packagegroup-agl-core-boot \ + \ + ${CORE_IMAGE_EXTRA_INSTALL} \ +" diff --git a/meta-agl-core/classes/agl-crosssdk.bbclass b/meta-agl-core/classes/agl-crosssdk.bbclass new file mode 100644 index 000000000..5f6dbf303 --- /dev/null +++ b/meta-agl-core/classes/agl-crosssdk.bbclass @@ -0,0 +1,9 @@ +IMAGE_FEATURES += "dev-pkgs" +IMAGE_INSTALL += "kernel-dev kernel-devsrc" + +inherit populate_sdk + +# Task do_populate_sdk and do_rootfs can't be exec simultaneously. +# Both exec "createrepo" on the same directory, and so one of them +# can failed (randomly). +addtask do_populate_sdk after do_rootfs diff --git a/meta-agl-core/conf/distro/include/aarch64-tune.inc b/meta-agl-core/conf/distro/include/aarch64-tune.inc index 320b4f1ac..4628fcaf2 100644 --- a/meta-agl-core/conf/distro/include/aarch64-tune.inc +++ b/meta-agl-core/conf/distro/include/aarch64-tune.inc @@ -4,7 +4,9 @@ # A double inclusion would produce a warning. This include line is just for reference # include conf/machine/include/arm/arch-armv8.inc -DEFAULTTUNE:poky-agl := "aarch64" +AGL_DEFAULTTUNE ?= "aarch64" +DEFAULTTUNE:agldefaulttune = "${AGL_DEFAULTTUNE}" + # not yet ready #QB_SYSTEM_NAME ?= "qemu-system-aarch" #QB_DEFAULT_KERNEL ?= "zImage" diff --git a/meta-agl-core/conf/distro/include/arm-tune.inc b/meta-agl-core/conf/distro/include/arm-tune.inc index fa68e05a7..b3ad64ad7 100644 --- a/meta-agl-core/conf/distro/include/arm-tune.inc +++ b/meta-agl-core/conf/distro/include/arm-tune.inc @@ -7,14 +7,16 @@ # include conf/machine/include/arch/arm-armv7-a.inc # Standard target for 32bit ARM (newer than cortex-a15) -AGLDEFAULTTUNE = "armv7vethf-neon-vfpv4" +ARM_DEFAULTTUNE = "armv7vethf-neon-vfpv4" # for cortex-a8, cortex-a9, cortex-a7 (=rpi 2/3) -AGLDEFAULTTUNE := "${@bb.utils.contains('DISTRO_FEATURES', 'agl-medium-arm-compiler', 'armv7athf-neon', '${AGLDEFAULTTUNE}', d)}" +ARM_DEFAULTTUNE := "${@bb.utils.contains('DISTRO_FEATURES', 'agl-medium-arm-compiler', 'armv7athf-neon', '${ARM_DEFAULTTUNE}', d)}" # for armv6 (=rpi0/1) -AGLDEFAULTTUNE := "${@bb.utils.contains('DISTRO_FEATURES', 'agl-low-arm-compiler', 'arm1176jzfshf', '${AGLDEFAULTTUNE}', d)}" -DEFAULTTUNE := "${AGLDEFAULTTUNE}" +ARM_DEFAULTTUNE := "${@bb.utils.contains('DISTRO_FEATURES', 'agl-low-arm-compiler', 'arm1176jzfshf', '${ARM_DEFAULTTUNE}', d)}" + +AGL_DEFAULTTUNE ?= "${ARM_DEFAULTTUNE}" +DEFAULTTUNE:agldefaulttune := "${AGL_DEFAULTTUNE}" QB_SYSTEM_NAME ?= "qemu-system-arm" QB_DEFAULT_KERNEL ?= "zImage" diff --git a/meta-agl-core/conf/distro/include/riscv64-tune.inc b/meta-agl-core/conf/distro/include/riscv64-tune.inc index f8118dec3..981fc4283 100644 --- a/meta-agl-core/conf/distro/include/riscv64-tune.inc +++ b/meta-agl-core/conf/distro/include/riscv64-tune.inc @@ -4,4 +4,5 @@ # A double inclusion would produce a warning. This include line is just for reference # include conf/machine/include/arm/arch-armv8.inc -DEFAULTTUNE = "riscv64" +AGL_DEFAULTTUNE ?= "riscv64" +DEFAULTTUNE:agldefaulttune = "${AGL_DEFAULTTUNE}" diff --git a/meta-agl-core/conf/distro/include/x86_64-tune.inc b/meta-agl-core/conf/distro/include/x86_64-tune.inc index a0b5abdfb..541b729b6 100644 --- a/meta-agl-core/conf/distro/include/x86_64-tune.inc +++ b/meta-agl-core/conf/distro/include/x86_64-tune.inc @@ -3,7 +3,8 @@ # We should not need the tuning include below as the BSP should include the right set already. # A double inclusion would produce a warning. This include line is just for reference #include conf/machine/include/tune-corei7.inc -DEFAULTTUNE = "corei7-64" +AGL_DEFAULTTUNE ?= "corei7-64" +DEFAULTTUNE:agldefaulttune = "${AGL_DEFAULTTUNE}" # shortened copy of tune-corei7.inc due to bug in inclusion for tune-core2.inc # TUNE_ARCH is using .= x86-64 , if done twice, you get x86-64x86-64 as TUNE_ARCH :/ @@ -52,4 +53,4 @@ QB_CPU:x86-64 = "-cpu qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt" QB_CPU_KVM:x86-64 = "-cpu kvm64 -cpu qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt" # Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy -QB_OPT_APPEND = "-vga vmware -show-cursor -usb -device usb-tablet -device virtio-rng-pci" +QB_OPT_APPEND = "-vga vmware -display default,show-cursor=on -usb -device usb-tablet -device virtio-rng-pci" diff --git a/meta-agl-core/conf/distro/poky-agl.conf b/meta-agl-core/conf/distro/poky-agl.conf index 0c3364c39..19a21ad44 100644 --- a/meta-agl-core/conf/distro/poky-agl.conf +++ b/meta-agl-core/conf/distro/poky-agl.conf @@ -1,48 +1,45 @@ require conf/distro/poky.conf +# Insert overrides "agldefaulttune" and "forcedefaulttune" before forcevariable +OVERRIDES = "${TARGET_OS}:${TRANSLATED_TARGET_ARCH}:pn-${PN}:${MACHINEOVERRIDES}:${DISTROOVERRIDES}:${CLASSOVERRIDE}${LIBCOVERRIDE}:agldefaulttune:forcedefaulttune:forcevariable" + # AGL specific derivations DISTRO = "poky-agl" DISTRO_NAME = "Automotive Grade Linux" # Release flags -DISTRO_CODENAME = "marlin" +DISTRO_CODENAME = "ricefish" AGL_BRANCH = "master" -AGLVERSION = "12.90.0" +AGLVERSION = "17.90.0" + # switch devel/release -AGLRELEASETYPE ?= "agldevelopment" -#AGLRELEASETYPE ?= "aglrelease" +#AGLRELEASETYPE ?= "agldevelopment" +AGLRELEASETYPE := "aglrelease" + OVERRIDES .= ":${AGLRELEASETYPE}" -# #for development -DISTRO_VERSION:agldevelopment := "${AGLVERSION}+snapshot-${DATE}" -AGL_APP_REVISION:agldevelopment = "${AUTOREV}" -AGL_DEFAULT_REVISION:agldevelopment = "${AUTOREV}" +DISTRO_VERSION:agldevelopment := "${AGLVERSION}+snapshot-${METADATA_REVISION}" #for release DISTRO_VERSION:aglrelease := "${AGLVERSION}" -DISTRO_BRANCH_VERSION_TAG = "${DISTRO_CODENAME}/${@'${DISTRO_VERSION}'.replace('+snapshot-${DATE}','')}" -AGL_APP_REVISION:aglrelease := "refs/tags/${DISTRO_BRANCH_VERSION_TAG}" -AGL_DEFAULT_REVISION:aglrelease := "refs/tags/${DISTRO_BRANCH_VERSION_TAG}" +DISTRO_BRANCH_VERSION_TAG = "${DISTRO_CODENAME}/${@'${DISTRO_VERSION}'.replace('+snapshot-${METADATA_REVISION}','')}" # reproducible builds: -# enable the flag -BUILD_REPRODUCIBLE_BINARIES = "1" # Set the desired timestamps -export SOURCE_DATE_EPOCH = "1593400000" -REPRODUCIBLE_TIMESTAMP_ROOTFS = "1593400000" -# inherit the class -INHERIT += "reproducible_build" +# E.g. update for (major) releases +export SOURCE_DATE_EPOCH = "1706800000" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "1706800000" # SDK SDK_VENDOR = "-aglsdk" -# SDKPATH is the folder where the SDK is going to be installed +# SDKPATHINSTALL is the folder where the SDK is going to be installed # Due to an issue with the qt5 environment (see SPEC-1667), # we add DEFAULTTUNE to the SDKPATH to mitigate the issue. -SDKPATH = "/opt/agl-sdk/${SDK_VERSION}-${DEFAULTTUNE}" +SDKPATHINSTALL = "/opt/agl-sdk/${SDK_VERSION}-${DEFAULTTUNE}" MAINTAINER = "AGL https://lists.automotivelinux.org/g/agl-dev-community" @@ -50,7 +47,7 @@ MAINTAINER = "AGL https://lists.automotivelinux.org/g/agl-dev-community" TARGET_VENDOR = "-agl" # Override these in poky based distros -AGL_DEFAULT_DISTRO_FEATURES = "largefile opengl wayland pam bluetooth bluez5 3g polkit" +AGL_DEFAULT_DISTRO_FEATURES = "usrmerge largefile opengl wayland pam bluetooth bluez5 3g polkit" POKY_DEFAULT_DISTRO_FEATURES := "${AGL_DEFAULT_DISTRO_FEATURES}" OVERRIDES .= ":${DISTRO_CODENAME}" @@ -111,8 +108,8 @@ SECURITY_CFLAGS:pn-qtwebengine = "${SECURITY_NO_PIE_CFLAGS}" #Redefined USER_CLASSES #Disable prelink. It is unmaintained and likely will go away. -#default: USER_CLASSES ?= "buildstats image-mklibs image-prelink" -USER_CLASSES = "buildstats image-mklibs" +#default: USER_CLASSES ?= "buildstats image-prelink" +USER_CLASSES = "buildstats" # AGL uses 4 optimization levels # 2 for ARM 32bit @@ -131,7 +128,7 @@ QB_MEM ?= "-m 2048" # use pulseaudio on the host side - off as qemu-native is built with alsa #QB_AUDIO_DRV = "pa" # expose a virtual 'hda' sound card to the guest (arm/aarch64/x86-64) -QB_AUDIO_OPT = "-soundhw hda" +QB_AUDIO_OPT = "-device intel-hda -device hda-duplex -audiodev alsa,id=agl" # Board templates can add extra IMAGE_FSTYPES through this. # It is added (late) through the AGL image recipes. @@ -140,8 +137,8 @@ AGL_EXTRA_INITRAMFS_FSTYPES ??= "" # # Default IMAGE FSTYPES wic.xz AGL_DEFAULT_IMAGE_FSTYPES ?= "wic.xz wic.bmap wic.xz.sha256sum" -AGL_DEFAULT_IMAGE_FSTYPES:qemuall ?= "${@bb.utils.contains('DISTRO_FEATURES', 'AGLCI', 'ext4.xz', 'ext4', d)}" -AGL_DEFAULT_IMAGE_FSTYPES:append:netboot = " ${@bb.utils.contains('DISTRO_FEATURES', 'AGLCI', 'ext4.xz', 'ext4', d)}" +AGL_DEFAULT_IMAGE_FSTYPES:qemuall ?= "${@bb.utils.contains('AGL_FEATURES', 'AGLCI', 'ext4.xz', 'ext4', d)}" +AGL_DEFAULT_IMAGE_FSTYPES:append:netboot = " ${@bb.utils.contains('AGL_FEATURES', 'AGLCI', 'ext4.xz', 'ext4', d)}" AGL_DEFAULT_INITRAMFS_FSTYPES ?= "ext4.gz" # DEFAULT IMAGE_FSTYPES for AGL (no - BSPs should not set this) @@ -149,13 +146,6 @@ AGL_DEFAULT_INITRAMFS_FSTYPES ?= "ext4.gz" IMAGE_FSTYPES = "${AGL_DEFAULT_IMAGE_FSTYPES} ${AGL_EXTRA_IMAGE_FSTYPES}" INITRAMFS_FSTYPES = "${AGL_DEFAULT_INITRAMFS_FSTYPES} ${AGL_EXTRA_INITRAMFS_FSTYPES}" # -# THE FUTURE is 'wic' -# IMAGE_FSTYPES:append = " wic" - -# Complementary package definitions for agl-test-wgt and agl-devel-wgt -# image features -COMPLEMENTARY_GLOB[agl-test-wgt] = '*-test' -COMPLEMENTARY_GLOB[agl-devel-wgt] = '*-coverage *-debug' # Fix for rpm metadata clash between nativesdk-cmake and nativesdk-qtbase-tools # (revalidate after 2017-10-15, 2018-06-12: still required) @@ -166,21 +156,3 @@ DIRFILES:pn-nativesdk-cmake = "1" # This needs to be verified. do_package_write_rpm[vardepsexclude] += "ARCHIVER_TOPDIR PF" -# Set preferred provider to new navi application -PREFERRED_RPROVIDER_virtual/navigation ?= "ondemandnavi" - -# Set preferred provider for low-can device mapping configuration -PREFERRED_RPROVIDER_virtual/low-can-dev-mapping ?= "dev-mapping" - -# Mask upstream meta-security bbappend that interferes with non-linux-yocto -# kernels due to the bug of having two wildcards, which bitbake does not -# support. Not having it is not an issue, since there is also explicit -# enabling of required security features done by meta-agl/meta-security. -BBMASK += "meta-security/recipes-kernel/linux/linux-%_5.%.bbappend" - -# Workaround for https://jira.automotivelinux.org/browse/SPEC-3621 -# TLDR: do_image_wic will modify the target's /etc/fstab while -# do_image_tar and do_image_ext4 can run in parallel -# This needs to be fixed upstream: -# See https://bugzilla.yoctoproject.org/show_bug.cgi?id=13994 -INHERIT += "image_types_wic_workaround" diff --git a/meta-agl-core/conf/include/agl-create-spdx.inc b/meta-agl-core/conf/include/agl-create-spdx.inc new file mode 100644 index 000000000..8d71013e3 --- /dev/null +++ b/meta-agl-core/conf/include/agl-create-spdx.inc @@ -0,0 +1 @@ +INHERIT += " create-spdx " diff --git a/meta-agl-core/conf/include/agl-devel.inc b/meta-agl-core/conf/include/agl-devel.inc index 394ff07b9..055fa61e3 100644 --- a/meta-agl-core/conf/include/agl-devel.inc +++ b/meta-agl-core/conf/include/agl-devel.inc @@ -7,12 +7,10 @@ IMAGE_INSTALL:append = " \ # Install libdrm-test, including modetest, to images with GUI IMAGE_INSTALL:append = "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', ' libdrm-tests', '', d)}" -IMAGE_FEATURES:append = " agl-devel-wgt" - # disable install of debug files in SDK # initial value: SDKIMAGE_FEATURES="dev-pkgs dbg-pkgs staticdev-pkgs" SDKIMAGE_FEATURES="dev-pkgs" # allows insertion of code or items specific to developement -OVERRIDES .= ":agl-devel" +OVERRIDES:append = ":agl-devel" DISTRO_FEATURES:append = " agl-devel" diff --git a/meta-agl-core/conf/include/agl-gplv2.inc b/meta-agl-core/conf/include/agl-gplv2.inc deleted file mode 100644 index fc9a4072b..000000000 --- a/meta-agl-core/conf/include/agl-gplv2.inc +++ /dev/null @@ -1,8 +0,0 @@ -# GPLv3 Compliance -PREFERRED_VERSION_bash = "3.2.%" -PREFERRED_VERSION_gawk = "3.1.%" -PREFERRED_VERSION_gdbm = "1.8.%" -PREFERRED_VERSION_gnupg = "1.4.7" -PREFERRED_VERSION_gnutls = "3.3.%" -PREFERRED_VERSION_mc = "4.7.5.%" -PREFERRED_VERSION_readline = "5.2" diff --git a/meta-agl-core/conf/include/agl-selinux.inc b/meta-agl-core/conf/include/agl-selinux.inc new file mode 100644 index 000000000..aeb26e33d --- /dev/null +++ b/meta-agl-core/conf/include/agl-selinux.inc @@ -0,0 +1,20 @@ +DISTRO_FEATURES:append = " acl xattr selinux" + +# Reiterate the upstream default of targeted policy since that +# is the mostly widely used model, and it will likely be easier +# to pull policy from other distributions for it. +# Having an explicit setting here seems useful for documentation +# purposes, and it is still possible that using one of the other +# refpolicy package options as the AGL default desirable, and it +# would be set here. +PREFERRED_PROVIDER_virtual/refpolicy ?= "refpolicy-targeted" + +# Default to permissive mode +DEFAULT_ENFORCING ?= "permissive" + +# Override the base image class to get the SELinux labeling hook +AGL_BASE_IMAGE ?= "selinux-image" + +# Mask out meta-selinux's linux-yocto kernel config bbappend to +# avoid collision with AGL's own more universal scheme. +BBMASK += "meta-selinux/recipes-kernel/linux/"
\ No newline at end of file diff --git a/meta-agl-core/conf/layer.conf b/meta-agl-core/conf/layer.conf index efbf6e68c..ddea256fe 100644 --- a/meta-agl-core/conf/layer.conf +++ b/meta-agl-core/conf/layer.conf @@ -10,11 +10,17 @@ BBFILE_PATTERN_aglcore = "^${LAYERDIR}/" BBFILE_PRIORITY_aglcore = "60" BBFILES_DYNAMIC += " \ + openembedded-layer:${LAYERDIR}/dynamic-layers/meta-oe/*/*/*.bb \ + openembedded-layer:${LAYERDIR}/dynamic-layers/meta-oe/*/*/*.bbappend \ + \ + selinux:${LAYERDIR}/dynamic-layers/meta-selinux/*/*/*.bb \ + selinux:${LAYERDIR}/dynamic-layers/meta-selinux/*/*/*.bbappend \ + \ qt5-layer:${LAYERDIR}/dynamic-layers/meta-qt5/*/*/*.bb \ qt5-layer:${LAYERDIR}/dynamic-layers/meta-qt5/*/*/*.bbappend \ " -LAYERSERIES_COMPAT_aglcore = "dunfell" +LAYERSERIES_COMPAT_aglcore = "kirkstone" LAYERDEPENDS_aglcore = "core" # Sanity check for meta-virtualization layer. diff --git a/meta-agl-core/conf/local.conf.sample b/meta-agl-core/conf/local.conf.sample index 8fa6d05a2..ecc9b141a 100644 --- a/meta-agl-core/conf/local.conf.sample +++ b/meta-agl-core/conf/local.conf.sample @@ -188,7 +188,7 @@ PATCHRESOLVE = "noop" # # Monitor the disk space during the build. If there is less that 1GB of space or less # than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully -# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard halt # of the build. The reason for this is that running completely out of space can corrupt # files and damages the build in ways which may not be easily recoverable. # It's necesary to monitor /tmp, if there is no space left the build will fail @@ -198,10 +198,10 @@ BB_DISKMON_DIRS ??= "\ STOPTASKS,${DL_DIR},1G,100K \ STOPTASKS,${SSTATE_DIR},1G,100K \ STOPTASKS,/tmp,100M,100K \ - ABORT,${TMPDIR},100M,1K \ - ABORT,${DL_DIR},100M,1K \ - ABORT,${SSTATE_DIR},100M,1K \ - ABORT,/tmp,10M,1K" + HALT,${TMPDIR},100M,1K \ + HALT,${DL_DIR},100M,1K \ + HALT,${SSTATE_DIR},100M,1K \ + HALT,/tmp,10M,1K" # # Shared-state files from other locations @@ -264,7 +264,7 @@ PACKAGECONFIG:append:pn-qemu-system-native = " sdl" # CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to # track the version of this file when it was generated. This can safely be ignored if # this doesn't mean anything to you. -CONF_VERSION = "1" +CONF_VERSION = "2" # meta-agl-core uses these variables AGL_FEATURES ?= "" diff --git a/meta-agl-core/dynamic-layers/meta-oe/recipes-graphics/wayland/agl-compositor-init.bbappend b/meta-agl-core/dynamic-layers/meta-oe/recipes-graphics/wayland/agl-compositor-init.bbappend new file mode 100644 index 000000000..4b6deffdf --- /dev/null +++ b/meta-agl-core/dynamic-layers/meta-oe/recipes-graphics/wayland/agl-compositor-init.bbappend @@ -0,0 +1 @@ +require ${@bb.utils.contains('AGL_FEATURES', 'aglcore', 'agl-compositor-init_aglcore.inc', '', d)} diff --git a/meta-agl-core/dynamic-layers/meta-oe/recipes-graphics/wayland/agl-compositor-init_aglcore.inc b/meta-agl-core/dynamic-layers/meta-oe/recipes-graphics/wayland/agl-compositor-init_aglcore.inc new file mode 100644 index 000000000..b7d346d39 --- /dev/null +++ b/meta-agl-core/dynamic-layers/meta-oe/recipes-graphics/wayland/agl-compositor-init_aglcore.inc @@ -0,0 +1 @@ +require common-init.inc diff --git a/meta-agl-core/recipes-graphics/wayland/agl-shell-activator_git.bb b/meta-agl-core/dynamic-layers/meta-oe/recipes-graphics/wayland/agl-shell-activator_git.bb index 049068341..38725c1bd 100644 --- a/meta-agl-core/recipes-graphics/wayland/agl-shell-activator_git.bb +++ b/meta-agl-core/dynamic-layers/meta-oe/recipes-graphics/wayland/agl-shell-activator_git.bb @@ -8,15 +8,15 @@ SECTION = "x11" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://COPYING;md5=e978448a0d41d826d73890d9c22caf75" -DEPENDS = "wayland wayland-protocols wayland-native agl-compositor" +DEPENDS = "wayland wayland-protocols wayland-native agl-compositor grpc grpc-native" SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/agl-shell-activator.git;protocol=https;branch=${AGL_BRANCH}" -SRCREV = "5bdedb16112fa0faaf16f64ef440f451e9f787e4" +SRCREV = "027d6f814f3d1f2e6b4b4071365b28dadec34109" PV = "0.0.10+git${SRCPV}" S = "${WORKDIR}/git" + inherit meson pkgconfig python3native -FILES:${PN} = " ${bindir}/agl-shell-activator \ - ${bindir}/agl-activator " +FILES:${PN} = " ${bindir}/agl-shell-activator" diff --git a/meta-agl-core/dynamic-layers/meta-oe/recipes-graphics/wayland/common-init.inc b/meta-agl-core/dynamic-layers/meta-oe/recipes-graphics/wayland/common-init.inc new file mode 100644 index 000000000..47f7d8b1d --- /dev/null +++ b/meta-agl-core/dynamic-layers/meta-oe/recipes-graphics/wayland/common-init.inc @@ -0,0 +1,6 @@ +# If weston's PACKAGECONFIG contains systemd + pam + polkit, polkit +# ends up a hard requirement for start up due to the pam + systemd +# configuration that is being installed. For now, keep things simple +# and assume that polkit should be a dependency if it is in +# DISTRO_FEATURES. +RDEPENDS:${PN} += "${@bb.utils.filter('DISTRO_FEATURES', 'polkit', d)}" diff --git a/meta-agl-core/dynamic-layers/meta-oe/recipes-graphics/wayland/weston-init.bbappend b/meta-agl-core/dynamic-layers/meta-oe/recipes-graphics/wayland/weston-init.bbappend new file mode 100644 index 000000000..c09d7ccd3 --- /dev/null +++ b/meta-agl-core/dynamic-layers/meta-oe/recipes-graphics/wayland/weston-init.bbappend @@ -0,0 +1 @@ +require ${@bb.utils.contains('AGL_FEATURES', 'aglcore', 'weston-init_aglcore.inc', '', d)} diff --git a/meta-agl-core/dynamic-layers/meta-oe/recipes-graphics/wayland/weston-init_aglcore.inc b/meta-agl-core/dynamic-layers/meta-oe/recipes-graphics/wayland/weston-init_aglcore.inc new file mode 100644 index 000000000..b7d346d39 --- /dev/null +++ b/meta-agl-core/dynamic-layers/meta-oe/recipes-graphics/wayland/weston-init_aglcore.inc @@ -0,0 +1 @@ +require common-init.inc diff --git a/meta-agl-core/dynamic-layers/meta-oe/recipes-platform/images/agl-image-compositor.bbappend b/meta-agl-core/dynamic-layers/meta-oe/recipes-platform/images/agl-image-compositor.bbappend new file mode 100644 index 000000000..1e0e66f01 --- /dev/null +++ b/meta-agl-core/dynamic-layers/meta-oe/recipes-platform/images/agl-image-compositor.bbappend @@ -0,0 +1,3 @@ +IMAGE_INSTALL += " \ + ${@bb.utils.contains('DISTRO_FEATURES', 'agl-devel', 'agl-shell-activator', '', d)} \ +" diff --git a/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtbase_aglcore.inc b/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtbase_aglcore.inc index 54a6311fb..581f5de99 100644 --- a/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtbase_aglcore.inc +++ b/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtbase_aglcore.inc @@ -1,3 +1,5 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/qtbase:" + PACKAGECONFIG_WAYLAND = "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland', '', d)}" PACKAGECONFIG_GL = "${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'gles2', '', d)}" diff --git a/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtlocation/0001-mapbox-update-API-url-to-match-new-schema.patch b/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtlocation/0001-mapbox-update-API-url-to-match-new-schema.patch new file mode 100644 index 000000000..ba8a991ed --- /dev/null +++ b/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtlocation/0001-mapbox-update-API-url-to-match-new-schema.patch @@ -0,0 +1,47 @@ +From 58197439eade86e7efc6fe98116c0092ea429d29 Mon Sep 17 00:00:00 2001 +From: Matt Ranostay <matt.ranostay@konsulko.com> +Date: Tue, 10 Mar 2020 13:59:58 -0700 +Subject: [PATCH] mapbox: update API url to match new schema + +--- + src/plugins/geoservices/mapbox/qgeotilefetchermapbox.cpp | 7 ++++--- + src/plugins/geoservices/mapbox/qmapboxcommon.h | 2 +- + 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/src/plugins/geoservices/mapbox/qgeotilefetchermapbox.cpp b/src/plugins/geoservices/mapbox/qgeotilefetchermapbox.cpp +index 0b128556..bd2be6b6 100644 +--- a/src/plugins/geoservices/mapbox/qgeotilefetchermapbox.cpp ++++ b/src/plugins/geoservices/mapbox/qgeotilefetchermapbox.cpp +@@ -88,12 +88,13 @@ QGeoTiledMapReply *QGeoTileFetcherMapbox::getTileImage(const QGeoTileSpec &spec) + request.setRawHeader("User-Agent", m_userAgent); + + request.setUrl(QUrl(mapboxTilesApiPath + +- ((spec.mapId() >= m_mapIds.size()) ? QStringLiteral("mapbox.streets") : m_mapIds[spec.mapId() - 1]) + QLatin1Char('/') + ++ m_mapIds[m_mapIds.size() - 1] + ++ QStringLiteral("/tiles/256/") + + QString::number(spec.zoom()) + QLatin1Char('/') + + QString::number(spec.x()) + QLatin1Char('/') + + QString::number(spec.y()) + +- ((m_scaleFactor > 1) ? (QLatin1Char('@') + QString::number(m_scaleFactor) + QLatin1String("x.")) : QLatin1String(".")) + +- m_format + QLatin1Char('?') + ++ ((m_scaleFactor > 1) ? (QLatin1Char('@') + QString::number(m_scaleFactor) + QLatin1String("x")) : QLatin1String("")) + ++ QLatin1Char('?') + + QStringLiteral("access_token=") + m_accessToken)); + + QNetworkReply *reply = m_networkManager->get(request); +diff --git a/src/plugins/geoservices/mapbox/qmapboxcommon.h b/src/plugins/geoservices/mapbox/qmapboxcommon.h +index e60c4e83..4b2ea98d 100644 +--- a/src/plugins/geoservices/mapbox/qmapboxcommon.h ++++ b/src/plugins/geoservices/mapbox/qmapboxcommon.h +@@ -46,7 +46,7 @@ + + QT_BEGIN_NAMESPACE + +-static const QString mapboxTilesApiPath = QStringLiteral("http://api.tiles.mapbox.com/v4/"); ++static const QString mapboxTilesApiPath = QStringLiteral("https://api.mapbox.com/"); + + // https://www.mapbox.com/api-documentation/#geocoding + static const QString mapboxGeocodingApiPath = QStringLiteral("https://api.mapbox.com/geocoding/v5/mapbox.places/"); +-- +2.25.0 + diff --git a/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtlocation_%.bbappend b/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtlocation_%.bbappend new file mode 100644 index 000000000..a0d80075a --- /dev/null +++ b/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtlocation_%.bbappend @@ -0,0 +1 @@ +require ${@bb.utils.contains('AGL_FEATURES', 'aglcore', 'qtlocation_aglcore.inc', '', d)} diff --git a/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtlocation_aglcore.inc b/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtlocation_aglcore.inc new file mode 100644 index 000000000..60867aef0 --- /dev/null +++ b/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtlocation_aglcore.inc @@ -0,0 +1,14 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/qtlocation:" + +SRC_URI += "\ + file://0001-mapbox-update-API-url-to-match-new-schema.patch \ + " + +# Need to explicitly enable the various plugins +PACKAGECONFIG += " \ + geoservices_osm \ + geoservices_here \ + geoservices_itemsoverlay \ + geoservices_mapbox \ + geoservices_mapboxgl \ +" diff --git a/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtwayland/0001-Fix-timer-leak-and-a-potential-race.patch b/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtwayland/0001-Fix-timer-leak-and-a-potential-race.patch deleted file mode 100644 index 642eabc4b..000000000 --- a/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtwayland/0001-Fix-timer-leak-and-a-potential-race.patch +++ /dev/null @@ -1,42 +0,0 @@ -From f4d3297e6705cc524729d629bf94db11841dbb24 Mon Sep 17 00:00:00 2001 -From: Simon Yuan <simon.yuan@navico.com> -Date: Thu, 7 Nov 2019 09:22:37 +1300 -Subject: [PATCH] Fix timer leak and a potential race - -The callback timer is now killed immediately before starting a new timer, this -makes sure there is always a single active callback timer. It's unclear why -killing the timer in a separate lambda doesn't always kill the timer in time, -the hypothesis is that if killing the timer comes after starting a new one, then -the previous timer is now left dangling. Whatever the reason is, it makes even -more sense to kill the timer in the same lamda and immediately before starting a -new timer anyway. ---- - src/client/qwaylandwindow.cpp | 11 +++++------ - 1 file changed, 5 insertions(+), 6 deletions(-) - -diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp -index 0df99d9f..93b46bf1 100644 ---- a/src/client/qwaylandwindow.cpp -+++ b/src/client/qwaylandwindow.cpp -@@ -1136,13 +1136,12 @@ void QWaylandWindow::handleUpdate() - mWaitingForFrameCallback = true; - mWaitingForUpdate = false; - -- // Stop current frame timer if any, can't use killTimer directly, see comment above. -- int fcbId = mFrameCallbackTimerId.fetchAndStoreOrdered(-1); -- if (fcbId != -1) -- QMetaObject::invokeMethod(this, [this, fcbId] { killTimer(fcbId); }, Qt::QueuedConnection); -- - // Start a timer for handling the case when the compositor stops sending frame callbacks. -- QMetaObject::invokeMethod(this, [this] { // Again; can't do it directly -+ // Can't use killTimer directly, see comment above. -+ QMetaObject::invokeMethod(this, [this] { -+ int fcbId = mFrameCallbackTimerId.fetchAndStoreOrdered(-1); -+ if (fcbId != -1) -+ killTimer(fcbId); - if (mWaitingForFrameCallback) - mFrameCallbackTimerId = startTimer(100); - }, Qt::QueuedConnection); --- -2.25.1 - diff --git a/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtwayland_%.bbappend b/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtwayland_%.bbappend deleted file mode 100644 index aa55c3a0c..000000000 --- a/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtwayland_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('AGL_FEATURES', 'aglcore', 'qtwayland_aglcore.inc', '', d)} diff --git a/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtwayland_aglcore.inc b/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtwayland_aglcore.inc deleted file mode 100644 index 08837ce26..000000000 --- a/meta-agl-core/dynamic-layers/meta-qt5/recipes-qt/qt5/qtwayland_aglcore.inc +++ /dev/null @@ -1,6 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/qtwayland:" - -# Patch reported in https://bugreports.qt.io/browse/QTBUG-79838, not upstreamed -SRC_URI += " \ - file://0001-Fix-timer-leak-and-a-potential-race.patch \ - " diff --git a/meta-agl-core/dynamic-layers/meta-selinux/recipes-core/systemd/files/systemd-selinux-relabel.service b/meta-agl-core/dynamic-layers/meta-selinux/recipes-core/systemd/files/systemd-selinux-relabel.service new file mode 100644 index 000000000..b8d394068 --- /dev/null +++ b/meta-agl-core/dynamic-layers/meta-selinux/recipes-core/systemd/files/systemd-selinux-relabel.service @@ -0,0 +1,12 @@ +[Unit] +Description=Generated file SELinux relabeling +DefaultDependencies=no +After=local-fs.target systemd-machine-id-commit.service +Before=sysinit.target + +[Service] +Type=oneshot +ExecStart=/usr/sbin/systemd-selinux-relabel.sh + +[Install] +WantedBy=sysinit.target diff --git a/meta-agl-core/dynamic-layers/meta-selinux/recipes-core/systemd/files/systemd-selinux-relabel.sh b/meta-agl-core/dynamic-layers/meta-selinux/recipes-core/systemd/files/systemd-selinux-relabel.sh new file mode 100644 index 000000000..b2557a8d6 --- /dev/null +++ b/meta-agl-core/dynamic-layers/meta-selinux/recipes-core/systemd/files/systemd-selinux-relabel.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# Update labels on files generated on first boot. +/usr/sbin/restorecon -FRi /etc/systemd /etc/machine-id +if [ $? -eq 0 ]; then + # Disable parent service + # NOTE: The service does not use the first boot functionality + # in systemd as /etc/machine-id is not writeable until + # after it is complete. + systemctl disable systemd-selinux-relabel.service +fi +exit 0 diff --git a/meta-agl-core/dynamic-layers/meta-selinux/recipes-core/systemd/systemd-selinux-relabel_1.0.bb b/meta-agl-core/dynamic-layers/meta-selinux/recipes-core/systemd/systemd-selinux-relabel_1.0.bb new file mode 100644 index 000000000..7e4f9783c --- /dev/null +++ b/meta-agl-core/dynamic-layers/meta-selinux/recipes-core/systemd/systemd-selinux-relabel_1.0.bb @@ -0,0 +1,25 @@ +SUMMARY = "System unit to relabel systemd generated files" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI = "file://systemd-selinux-relabel.service \ + file://systemd-selinux-relabel.sh \ +" + +inherit systemd allarch features_check + +SYSTEMD_SERVICE:${PN} = "${BPN}.service" + +REQUIRED_DISTRO_FEATURES = "systemd" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +do_install() { + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/systemd-selinux-relabel.service ${D}${systemd_system_unitdir}/ + install -d ${D}${sbindir} + install -m 0755 ${WORKDIR}/systemd-selinux-relabel.sh ${D}${sbindir}/ +} + +FILES:${PN} += "${systemd_system_unitdir}" diff --git a/meta-agl-core/dynamic-layers/meta-selinux/recipes-platform/packagegroups/packagegroup-agl-core-selinux.bb b/meta-agl-core/dynamic-layers/meta-selinux/recipes-platform/packagegroups/packagegroup-agl-core-selinux.bb new file mode 100644 index 000000000..493a46f25 --- /dev/null +++ b/meta-agl-core/dynamic-layers/meta-selinux/recipes-platform/packagegroups/packagegroup-agl-core-selinux.bb @@ -0,0 +1,57 @@ +SUMMARY = "SELinux packages" +DESCRIPTION = "SELinux packages required for AGL" +LICENSE = "MIT" + +inherit packagegroup features_check + +REQUIRED_DISTRO_FEATURES = "selinux" + +PACKAGES = " \ + packagegroup-agl-core-selinux \ + packagegroup-agl-core-selinux-devel \ +" + +# +# meta-selinux's packagegroup-core-selinux includes a lot of +# policy development tools with its inclusion of the layer's +# packagegroup-selinux-policycoreutils, which is not really +# desirable for a production image. Create our own base +# packagegroup and an accompanying devel packagegroup that +# agl-devel can trigger pulling in. +# +# NOTES: +# - It seems likely we will always want auditd, so include +# it in the base packagegroup. +# - selinux-autorelabel seems required to handle both the +# edge case of builds done on non-xattr capable filesystems, +# and to allow driving relabeling after potential package +# installation during runtime. +# - packagegroup-selinux-policycoreutils includes a lot of +# things that seem not useful in a lot of systems (e.g. +# the gtk dependent selinux-gui), so for now the devel +# packagegroup aims to include a more minimal set of tools +# aimed at enabling checkpolicy and audit2allow use. +# - Some thought needs to go into whether the relabeling +# fixup packages should be handled separately, as they +# ideally should not go into images using read-only or +# stateless rootfs, but those are image features so we +# cannot check for them here. +# + +RDEPENDS:${PN} = " \ + packagegroup-selinux-minimal \ + auditd \ + selinux-autorelabel \ + systemd-selinux-relabel \ +" + +RDEPENDS:${PN}-devel = " \ + ${BPN} \ + libsepol-bin \ + checkpolicy \ + policycoreutils-loadpolicy \ + policycoreutils-setsebool \ + policycoreutils-hll \ + semodule-utils-semodule-package \ + selinux-python-audit2allow \ +" diff --git a/meta-agl-core/dynamic-layers/meta-selinux/recipes-security/selinux-scripts/selinux-autorelabel_0.1.bbappend b/meta-agl-core/dynamic-layers/meta-selinux/recipes-security/selinux-scripts/selinux-autorelabel_0.1.bbappend new file mode 100644 index 000000000..793b049e5 --- /dev/null +++ b/meta-agl-core/dynamic-layers/meta-selinux/recipes-security/selinux-scripts/selinux-autorelabel_0.1.bbappend @@ -0,0 +1 @@ +require ${@bb.utils.contains('AGL_FEATURES', 'aglcore', 'selinux-autorelabel_aglcore.inc', '', d)} diff --git a/meta-agl-core/dynamic-layers/meta-selinux/recipes-security/selinux-scripts/selinux-autorelabel_aglcore.inc b/meta-agl-core/dynamic-layers/meta-selinux/recipes-security/selinux-scripts/selinux-autorelabel_aglcore.inc new file mode 100644 index 000000000..67d3843f4 --- /dev/null +++ b/meta-agl-core/dynamic-layers/meta-selinux/recipes-security/selinux-scripts/selinux-autorelabel_aglcore.inc @@ -0,0 +1,4 @@ +do_install:append() { + # Do not force auto relabeling just from the package getting installed + rm -f ${D}/.autorelabel +} diff --git a/meta-agl-core/files/group b/meta-agl-core/files/group index 3391cb1d8..69a86186e 100644 --- a/meta-agl-core/files/group +++ b/meta-agl-core/files/group @@ -84,10 +84,18 @@ vmail::958: opensaf::957: lldpd::956: postdrop::954: -display::200: +weston::200: +wayland::201: +display::202: agl-driver::1001: agl-passenger::1002: +applaunchd::1003: systemd-network::1005: systemd-resolve::1006: mosquitto::1007: pipewire::1008: +render::1009: +sgx::1010: +kuksa::900: +qemu::901: +kvm::902: diff --git a/meta-agl-core/files/passwd b/meta-agl-core/files/passwd index 9673c1ac5..3e6639d86 100644 --- a/meta-agl-core/files/passwd +++ b/meta-agl-core/files/passwd @@ -23,6 +23,7 @@ sshd::996:996::: systemd-bus-proxy::995:995::: agl-driver::1001:1001::: agl-passenger::1002:1002::: +applaunchd::1003:1003::: messagebus::994:994::: afm::992:992::: systemd-timesync::988:988::: @@ -56,8 +57,11 @@ vmail::958:958::: opensaf::957:957::: lldpd::956:956::: cyrus::955:8::: -display::200:200::: +weston::200:200::: systemd-network::1005:1005::: systemd-resolve::1006:1006::: mosquitto::1007:1007::: pipewire::1008:1008::: +kuksa::900:900::: +qemu::901:901::: +user::1004:100::: diff --git a/meta-agl-core/recipes-config/agl-users/agl-users.inc b/meta-agl-core/recipes-config/agl-users/agl-users.inc new file mode 100644 index 000000000..428af3806 --- /dev/null +++ b/meta-agl-core/recipes-config/agl-users/agl-users.inc @@ -0,0 +1,14 @@ +inherit useradd + +USERADD_PACKAGES = "${PN}" +USERADDEXTENSION = "useradd-staticids" + +GROUPADD_PARAM:${PN} = "\ + --system video ; \ + --system pipewire ; \ + -g 1001 agl-driver ; \ +" + +USERADD_PARAM:${PN} = "\ + -g 1001 -u 1001 -G video,pipewire -o -d /home/agl-driver -m -K PASS_MAX_DAYS=-1 agl-driver ; \ +" diff --git a/meta-agl-core/recipes-config/agl-users/agl-users_1.0.bb b/meta-agl-core/recipes-config/agl-users/agl-users_1.0.bb new file mode 100644 index 000000000..18f25e4be --- /dev/null +++ b/meta-agl-core/recipes-config/agl-users/agl-users_1.0.bb @@ -0,0 +1,9 @@ +SUMMARY = "AGL Users" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +inherit allarch + +require agl-users.inc + +ALLOW_EMPTY:${PN} = "1" diff --git a/meta-agl-core/recipes-connectivity/connman-ncurses/connman-ncurses/0001-Do-not-overwrite-CFLAGS.patch b/meta-agl-core/recipes-connectivity/connman-ncurses/connman-ncurses/0001-Do-not-overwrite-CFLAGS.patch new file mode 100644 index 000000000..4a86e6c57 --- /dev/null +++ b/meta-agl-core/recipes-connectivity/connman-ncurses/connman-ncurses/0001-Do-not-overwrite-CFLAGS.patch @@ -0,0 +1,37 @@ +From 50ca6e010c3ca3f7cb06dfdf5dbdfaacd4f4749a Mon Sep 17 00:00:00 2001 +From: Jan-Simon Moeller <jsmoeller@linuxfoundation.org> +Date: Tue, 19 Jul 2022 23:28:21 +0200 +Subject: [PATCH] Do not overwrite CFLAGS + +Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org> +--- + configure.ac | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 7e3307f..c385bc0 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -24,14 +24,14 @@ AC_PROG_CC + AC_PROG_CC_C99 + AM_PROG_CC_C_O + +-CFLAGS="" +- +-AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization], +- [disable code optimization through compiler]), [ +- if (test "${enableval}" = "no"); then +- CFLAGS="$CFLAGS -O0 -U_FORTIFY_SOURCE" +- fi +-]) ++#CFLAGS="" ++# ++#AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization], ++# [disable code optimization through compiler]), [ ++# if (test "${enableval}" = "no"); then ++# CFLAGS="$CFLAGS -O0 -U_FORTIFY_SOURCE" ++# fi ++#]) + + AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], + [enable compiling with debugging information]), [ diff --git a/meta-agl-core/recipes-connectivity/connman-ncurses/connman-ncurses/0001-Initialize-variables.patch b/meta-agl-core/recipes-connectivity/connman-ncurses/connman-ncurses/0001-Initialize-variables.patch new file mode 100644 index 000000000..9a1078426 --- /dev/null +++ b/meta-agl-core/recipes-connectivity/connman-ncurses/connman-ncurses/0001-Initialize-variables.patch @@ -0,0 +1,39 @@ +From 0389a80796d3ae31d8f60659f0638660a00157b2 Mon Sep 17 00:00:00 2001 +From: Jan-Simon Moeller <jsmoeller@linuxfoundation.org> +Date: Tue, 19 Jul 2022 23:58:05 +0200 +Subject: [PATCH] Initialize variables + +This fixes compiler warnings. + +Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org> +--- + main.c | 2 +- + renderers.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/main.c b/main.c +index f0354f9..1fa9ab1 100644 +--- a/main.c ++++ b/main.c +@@ -159,7 +159,7 @@ static void report_error() + */ + static void get_help_window() + { +- char *msg; ++ char *msg = ""; + + if (win_help) + return; +diff --git a/renderers.c b/renderers.c +index c531a1e..d9d0414 100644 +--- a/renderers.c ++++ b/renderers.c +@@ -153,7 +153,7 @@ static void renderers_technologies(struct json_object *jobj) + int i; + char *desc_base = "%-20s Powered %-5s Connected %-5s"; + char desc_base_sub[30]; +- const char *k_name, *k_type, *k_powered, *k_connected; ++ const char *k_name = "" , *k_type = "" , *k_powered = "", *k_connected = ""; + char *desc, *tech_short_name; + struct json_object *sub_array, *dbus_tech_name, *tech_dict; + struct userptr_data *data; diff --git a/meta-agl-core/recipes-connectivity/connman-ncurses/connman-ncurses_git.bb b/meta-agl-core/recipes-connectivity/connman-ncurses/connman-ncurses_git.bb index 903ebc686..7b6d50531 100644 --- a/meta-agl-core/recipes-connectivity/connman-ncurses/connman-ncurses_git.bb +++ b/meta-agl-core/recipes-connectivity/connman-ncurses/connman-ncurses_git.bb @@ -6,17 +6,19 @@ SECTION = "console/network" DEPENDS = "dbus ncurses connman json-c" -LICENSE = "GPLv2" +LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://LICENSE;md5=8c16666ae6c159876a0ba63099614381" -SRC_URI = "git://gitlab.com/iotbzh/connman-json-client.git;protocol=https \ - file://stdbool-fixes.patch" +SRC_URI = "git://gitlab.com/iotbzh/connman-json-client.git;protocol=https;branch=master \ + file://stdbool-fixes.patch \ + file://0001-Do-not-overwrite-CFLAGS.patch \ + file://0001-Initialize-variables.patch \ + " SRCREV = "2b0f93ec9518c978c04807fe52e95315d6d80e6b" inherit autotools pkgconfig -EXTRA_AUTORECONF += " -i" -EXTRA_OECONF += " --disable-optimization --enable-debug" +EXTRA_AUTORECONF += " -vfi" S = "${WORKDIR}/git" diff --git a/meta-agl-core/recipes-connectivity/connman/connman-conf.bbappend b/meta-agl-core/recipes-connectivity/connman/connman-conf.bbappend new file mode 100644 index 000000000..bd6e7b75c --- /dev/null +++ b/meta-agl-core/recipes-connectivity/connman/connman-conf.bbappend @@ -0,0 +1 @@ +require ${@bb.utils.contains('AGL_FEATURES', 'aglcore', 'connman-conf_aglcore.inc', '', d)} diff --git a/meta-agl-core/recipes-connectivity/connman/connman-conf/main.conf b/meta-agl-core/recipes-connectivity/connman/connman-conf/main.conf new file mode 100644 index 000000000..be9fd0ed2 --- /dev/null +++ b/meta-agl-core/recipes-connectivity/connman/connman-conf/main.conf @@ -0,0 +1,3 @@ +[General] +FallbackTimeservers=pool.ntp.org +NetworkInterfaceBlacklist=vmnet,vboxnet,virbr,tap,ifb,meth diff --git a/meta-agl-core/recipes-connectivity/connman/connman-conf_aglcore.inc b/meta-agl-core/recipes-connectivity/connman/connman-conf_aglcore.inc new file mode 100644 index 000000000..30a250e1e --- /dev/null +++ b/meta-agl-core/recipes-connectivity/connman/connman-conf_aglcore.inc @@ -0,0 +1,9 @@ +# Pick up our version of main.conf +FILESEXTRAPATHS:prepend := "${THISDIR}/connman-conf:" + +# Upstream connman-conf only installs configuration for qemu targets +# but we need it in all our BSP +do_install:append() { + mkdir -p ${D}${sysconfdir}/connman + cp ${S}/main.conf ${D}${sysconfdir}/connman/main.conf +} diff --git a/meta-agl-core/recipes-connectivity/connman/files/0001-disable-when-booting-over-nfs.patch b/meta-agl-core/recipes-connectivity/connman/connman/0001-disable-when-booting-over-nfs.patch index f129a6580..7cc92e2c4 100644 --- a/meta-agl-core/recipes-connectivity/connman/files/0001-disable-when-booting-over-nfs.patch +++ b/meta-agl-core/recipes-connectivity/connman/connman/0001-disable-when-booting-over-nfs.patch @@ -1,3 +1,7 @@ +Exempt when nfs is in use. + +Upstream-Status: Pending + --- connman-1.36.orig/src/connman.service.in 2019-02-18 18:02:07.034947373 -0500 +++ connman-1.36/src/connman.service.in 2019-02-18 18:07:24.689959219 -0500 @@ -7,6 +7,7 @@ diff --git a/meta-agl-core/recipes-connectivity/connman/connman_aglcore.inc b/meta-agl-core/recipes-connectivity/connman/connman_aglcore.inc index 7299d18f3..e372e9186 100644 --- a/meta-agl-core/recipes-connectivity/connman/connman_aglcore.inc +++ b/meta-agl-core/recipes-connectivity/connman/connman_aglcore.inc @@ -1,12 +1,3 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/files:" +FILESEXTRAPATHS:prepend := "${THISDIR}/connman:" -SRC_URI += "file://0001-disable-when-booting-over-nfs.patch \ - file://main.conf \ -" - -FILES:${PN} += "${sysconfdir}/connman/main.conf" - -do_install:append() { - install -d ${D}${sysconfdir}/connman - install -m 0644 ${WORKDIR}/main.conf ${D}${sysconfdir}/connman -} +SRC_URI += "file://0001-disable-when-booting-over-nfs.patch" diff --git a/meta-agl-core/recipes-connectivity/connman/files/main.conf b/meta-agl-core/recipes-connectivity/connman/files/main.conf deleted file mode 100644 index 4dba25b70..000000000 --- a/meta-agl-core/recipes-connectivity/connman/files/main.conf +++ /dev/null @@ -1,3 +0,0 @@ -[General] -FallbackTimeservers=pool.ntp.org -NetworkInterfaceBlacklist=vmnet,vboxnet,virbr,ifb,meth diff --git a/meta-agl-core/recipes-core/systemd/systemd-conf-canbus/canbus-can-fd.network b/meta-agl-core/recipes-core/systemd/systemd-conf-canbus/canbus-can-fd.network new file mode 100644 index 000000000..86042bd90 --- /dev/null +++ b/meta-agl-core/recipes-core/systemd/systemd-conf-canbus/canbus-can-fd.network @@ -0,0 +1,12 @@ +[Match] +Name=can* + +[CAN] +BitRate=500K +SamplePoint=75% +DataBitRate=4M +DataSamplePoint=80% +FDMode=yes + +[Link] +ActivationPolicy=up diff --git a/meta-agl-core/recipes-core/systemd/systemd-conf-canbus/canbus-can.link b/meta-agl-core/recipes-core/systemd/systemd-conf-canbus/canbus-can.link new file mode 100644 index 000000000..61fb4d575 --- /dev/null +++ b/meta-agl-core/recipes-core/systemd/systemd-conf-canbus/canbus-can.link @@ -0,0 +1,11 @@ +[Match] +Type=can +OriginalName=can* + +[Link] +TransmitQueueLength=1000 +# Need to duplicate default configuration here, since only first +# matching .link is applied +NamePolicy=keep kernel database onboard slot path +AlternativeNamesPolicy=database onboard slot path +MACAddressPolicy=persistent diff --git a/meta-agl-core/recipes-core/systemd/systemd/canbus-can.network b/meta-agl-core/recipes-core/systemd/systemd-conf-canbus/canbus-can.network index ae5514bca..ae5514bca 100644 --- a/meta-agl-core/recipes-core/systemd/systemd/canbus-can.network +++ b/meta-agl-core/recipes-core/systemd/systemd-conf-canbus/canbus-can.network diff --git a/meta-agl-core/recipes-core/systemd/systemd-conf-canbus/canbus-virtio.network b/meta-agl-core/recipes-core/systemd/systemd-conf-canbus/canbus-virtio.network new file mode 100644 index 000000000..cc33d86d6 --- /dev/null +++ b/meta-agl-core/recipes-core/systemd/systemd-conf-canbus/canbus-virtio.network @@ -0,0 +1,5 @@ +[Match] +Name=can* + +[CAN] +RestartSec=0.1 diff --git a/meta-agl-core/recipes-core/systemd/systemd-conf-canbus_1.0.bb b/meta-agl-core/recipes-core/systemd/systemd-conf-canbus_1.0.bb new file mode 100644 index 000000000..a23cd839a --- /dev/null +++ b/meta-agl-core/recipes-core/systemd/systemd-conf-canbus_1.0.bb @@ -0,0 +1,32 @@ +SUMMARY = "Systemd canbus configuration" +DESCRIPTION = "Systemd may require slightly different configuration for \ +different machines. This injects configuration for the CAN bus." +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +PE = "1" + +SRC_URI = "\ + file://canbus-can.network \ + file://canbus-can-fd.network \ + file://canbus-virtio.network \ + file://canbus-can.link \ +" + +CANBUS_NETWORK_CONFIG ??= "canbus-can.network" +CANBUS_NETWORK_CONFIG:virtio-all ?= "canbus-virtio.network" + +do_install() { + # Install CAN bus network configuration + install -d ${D}${nonarch_base_libdir}/systemd/network/ + install -m 0644 ${WORKDIR}/${CANBUS_NETWORK_CONFIG} ${D}${nonarch_base_libdir}/systemd/network/60-canbus-can.network + + # Install link configuration to bump queue size on physical CAN bus devices + install -m 0644 ${WORKDIR}/canbus-can.link ${D}${nonarch_base_libdir}/systemd/network/60-canbus-can.link +} + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +FILES:${PN} = " \ + ${nonarch_base_libdir}/systemd/network/ \ +" diff --git a/meta-agl-core/recipes-core/systemd/systemd/0001-fix-udevd-seclabel-parsing.patch b/meta-agl-core/recipes-core/systemd/systemd/0001-fix-udevd-seclabel-parsing.patch deleted file mode 100644 index 29165b58e..000000000 --- a/meta-agl-core/recipes-core/systemd/systemd/0001-fix-udevd-seclabel-parsing.patch +++ /dev/null @@ -1,34 +0,0 @@ -Fix udevd SECLABEL token parsing - -The udevd rules parsing rewrite in v243 broke SECLABEL parsing, -with the result being that udevd crashes when it parses a line -containing a SECLABEL token. Fix the handling of the attribute -of SECLABEL tokens when parsing, and add a check to prevent -crashes if the attribute is missing. - -Upstream-Status: Pending - -Signed-off-by: Scott Murray <scott.murray@konsulko.com> - -diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c -index efea16e5c5..3e757ccb06 100644 ---- a/src/udev/udev-rules.c -+++ b/src/udev/udev-rules.c -@@ -918,7 +918,7 @@ static int parse_token(UdevRules *rules, const char *key, char *attr, UdevRuleOp - op = OP_ASSIGN; - } - -- r = rule_line_add_token(rule_line, TK_A_SECLABEL, op, value, NULL); -+ r = rule_line_add_token(rule_line, TK_A_SECLABEL, op, value, attr); - } else if (streq(key, "RUN")) { - if (is_match || op == OP_REMOVE) - return log_token_invalid_op(rules, key); -@@ -1927,6 +1927,8 @@ static int udev_rule_apply_token_to_event( - _cleanup_free_ char *name = NULL, *label = NULL; - char label_str[UTIL_LINE_SIZE] = {}; - -+ if (!token->data) -+ break; - name = strdup((const char*) token->data); - if (!name) - return log_oom(); diff --git a/meta-agl-core/recipes-core/systemd/systemd/0002-network-add-CAN-Termination-tristate-option.patch b/meta-agl-core/recipes-core/systemd/systemd/0002-network-add-CAN-Termination-tristate-option.patch deleted file mode 100644 index feaff2736..000000000 --- a/meta-agl-core/recipes-core/systemd/systemd/0002-network-add-CAN-Termination-tristate-option.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 1e6ffb3129340291027d2690631f62eb7d0e0a78 Mon Sep 17 00:00:00 2001 -From: Matt Ranostay <matt.ranostay@konsulko.com> -Date: Tue, 11 Feb 2020 18:13:45 -0800 -Subject: [PATCH] network: add CAN Termination tristate option - -Upstream-Status: Submitted -Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com> ---- - src/libsystemd/sd-netlink/netlink-types.c | 1 + - src/network/networkd-can.c | 13 +++++++++++++ - src/network/networkd-network-gperf.gperf | 1 + - src/network/networkd-network.c | 1 + - src/network/networkd-network.h | 1 + - test/fuzz/fuzz-network-parser/directives.network | 1 + - 6 files changed, 18 insertions(+) - -diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c -index a55460f034..96e211dcf0 100644 ---- a/src/libsystemd/sd-netlink/netlink-types.c -+++ b/src/libsystemd/sd-netlink/netlink-types.c -@@ -316,6 +316,7 @@ static const NLType rtnl_link_info_data_can_types[] = { - [IFLA_CAN_BITTIMING] = { .size = sizeof(struct can_bittiming) }, - [IFLA_CAN_RESTART_MS] = { .type = NETLINK_TYPE_U32 }, - [IFLA_CAN_CTRLMODE] = { .size = sizeof(struct can_ctrlmode) }, -+ [IFLA_CAN_TERMINATION] = { .type = NETLINK_TYPE_U16 }, - }; - - static const NLType rtnl_link_info_data_macsec_types[] = { -diff --git a/src/network/networkd-can.c b/src/network/networkd-can.c -index 5755df57bd..3abe8ae2ed 100644 ---- a/src/network/networkd-can.c -+++ b/src/network/networkd-can.c -@@ -9,6 +9,8 @@ - #include "networkd-manager.h" - #include "string-util.h" - -+#define CAN_TERMINATION_OHM_VALUE 120 -+ - static int link_up_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) { - int r; - -@@ -152,6 +154,17 @@ static int link_set_can(Link *link) { - return log_link_error_errno(link, r, "Could not append IFLA_CAN_CTRLMODE attribute: %m"); - } - -+ if (link->network->can_termination >= 0) { -+ -+ log_link_debug(link, "%sabling can-termination", link->network->can_termination ? "En" : "Dis"); -+ -+ r = sd_netlink_message_append_u16(m, IFLA_CAN_TERMINATION, -+ link->network->can_termination ? CAN_TERMINATION_OHM_VALUE : 0); -+ if (r < 0) -+ return log_link_error_errno(link, r, "Could not append IFLA_CAN_TERMINATION attribute: %m"); -+ -+ } -+ - r = sd_netlink_message_close_container(m); - if (r < 0) - return log_link_error_errno(link, r, "Failed to close netlink container: %m"); -diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf -index f7e68be181..b3df4f3960 100644 ---- a/src/network/networkd-network-gperf.gperf -+++ b/src/network/networkd-network-gperf.gperf -@@ -245,6 +245,7 @@ CAN.BitRate, config_parse_si_size, - CAN.SamplePoint, config_parse_permille, 0, offsetof(Network, can_sample_point) - CAN.RestartSec, config_parse_sec, 0, offsetof(Network, can_restart_us) - CAN.TripleSampling, config_parse_tristate, 0, offsetof(Network, can_triple_sampling) -+CAN.Termination, config_parse_tristate, 0, offsetof(Network, can_termination) - TrafficControlQueueingDiscipline.Parent, config_parse_tc_qdiscs_parent, 0, 0 - TrafficControlQueueingDiscipline.NetworkEmulatorDelaySec, config_parse_tc_network_emulator_delay, 0, 0 - TrafficControlQueueingDiscipline.NetworkEmulatorDelayJitterSec, config_parse_tc_network_emulator_delay, 0, 0 -diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c -index 6e443975f1..0ea5c05db7 100644 ---- a/src/network/networkd-network.c -+++ b/src/network/networkd-network.c -@@ -448,6 +448,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi - .keep_configuration = _KEEP_CONFIGURATION_INVALID, - - .can_triple_sampling = -1, -+ .can_termination = -1, - .ip_service_type = -1, - }; - -diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h -index aa74bb4ae7..6a1f094156 100644 ---- a/src/network/networkd-network.h -+++ b/src/network/networkd-network.h -@@ -193,6 +193,7 @@ struct Network { - unsigned can_sample_point; - usec_t can_restart_us; - int can_triple_sampling; -+ int can_termination; - - AddressFamily ip_forward; - bool ip_masquerade; -diff --git a/test/fuzz/fuzz-network-parser/directives.network b/test/fuzz/fuzz-network-parser/directives.network -index 5bd80dece8..781269d960 100644 ---- a/test/fuzz/fuzz-network-parser/directives.network -+++ b/test/fuzz/fuzz-network-parser/directives.network -@@ -194,6 +194,7 @@ SamplePoint= - BitRate= - RestartSec= - TripleSampling= -+Termination= - [Address] - DuplicateAddressDetection= - AutoJoin= diff --git a/meta-agl-core/recipes-core/systemd/systemd/wait-disable.conf b/meta-agl-core/recipes-core/systemd/systemd/wait-disable.conf new file mode 100644 index 000000000..e5d4f4b28 --- /dev/null +++ b/meta-agl-core/recipes-core/systemd/systemd/wait-disable.conf @@ -0,0 +1,3 @@ +[Service] +ExecStart= +ExecStart=/usr/bin/true diff --git a/meta-agl-core/recipes-core/systemd/systemd/wired.network b/meta-agl-core/recipes-core/systemd/systemd/wired.network index 3559b0155..425610a3f 100644 --- a/meta-agl-core/recipes-core/systemd/systemd/wired.network +++ b/meta-agl-core/recipes-core/systemd/systemd/wired.network @@ -1,5 +1,8 @@ [Match] Name=eth* en* +KernelCommandLine=!nbdroot +KernelCommandLine=!nfsroot +KernelCommandLine=!ip [Network] DHCP=yes diff --git a/meta-agl-core/recipes-core/systemd/systemd_aglcore.inc b/meta-agl-core/recipes-core/systemd/systemd_aglcore.inc index 51a5ff45f..9681329be 100644 --- a/meta-agl-core/recipes-core/systemd/systemd_aglcore.inc +++ b/meta-agl-core/recipes-core/systemd/systemd_aglcore.inc @@ -1,34 +1,36 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/systemd:" SRC_URI += "\ - file://0002-network-add-CAN-Termination-tristate-option.patch \ file://e2fsck.conf \ - file://canbus-can.network \ - ${@bb.utils.contains('VIRTUAL-RUNTIME_net_manager','systemd','file://wired.network','',d)} \ + file://wait-disable.conf \ + file://wired.network \ " -# enable networkd/resolved support -PACKAGECONFIG:append:pn-systemd = " \ +# Enable networkd/resolved support if using systemd for network management +PACKAGECONFIG:append = " \ ${@bb.utils.contains('VIRTUAL-RUNTIME_net_manager','systemd','networkd resolved','',d)} \ + iptc \ " +# SPEC-737: connmand also has a NTP client which races with systemd-timesyncd +PACKAGECONFIG:remove = "timesyncd" + +# Enable systemd-coredump when agl-devel is set on +PACKAGECONFIG:append:agl-devel = " coredump" + do_install:append() { # Install /etc/e2fsck.conf to avoid boot stuck by wrong clock time install -m 644 -p -D ${WORKDIR}/e2fsck.conf ${D}${sysconfdir}/e2fsck.conf - # Install canbus network script - install -m 0644 ${WORKDIR}/canbus-can.network ${D}${nonarch_base_libdir}/systemd/network/60-canbus-can.network - - if ${@bb.utils.contains('VIRTUAL-RUNTIME_net_manager','systemd','true','false',d)}; then + if [ "${VIRTUAL-RUNTIME_net_manager}" = "systemd" ]; then # Install DHCP configuration for Ethernet adapters install -m 644 ${WORKDIR}/wired.network ${D}${sysconfdir}/systemd/network + elif [ "${VIRTUAL-RUNTIME_net_manager}" = "connman" ]; then + # Disable systemd-networkd-wait-online by default + install -d ${D}${systemd_system_unitdir}/systemd-networkd-wait-online.service.d + install -m 0644 ${WORKDIR}/wait-disable.conf ${D}${systemd_system_unitdir}/systemd-networkd-wait-online.service.d/ fi } FILES:${PN} += "${sysconfdir}/e2fsck.conf " -# SPEC-737: connmand also has a NTP client which races with systemd-timesyncd -PACKAGECONFIG:remove = "timesyncd" - -# Enable systemd-coredump when agl-devel is set on -PACKAGECONFIG:append:agl-devel = " coredump" diff --git a/meta-agl-core/recipes-devtools/qemu/qemu_%.bbappend b/meta-agl-core/recipes-devtools/qemu/qemu_%.bbappend new file mode 100644 index 000000000..980783236 --- /dev/null +++ b/meta-agl-core/recipes-devtools/qemu/qemu_%.bbappend @@ -0,0 +1 @@ +require ${@bb.utils.contains('AGL_FEATURES', 'aglcore', '${BPN}_aglcore.inc', '', d)} diff --git a/meta-agl-core/recipes-devtools/qemu/qemu_aglcore.inc b/meta-agl-core/recipes-devtools/qemu/qemu_aglcore.inc new file mode 100644 index 000000000..77d461a7f --- /dev/null +++ b/meta-agl-core/recipes-devtools/qemu/qemu_aglcore.inc @@ -0,0 +1,5 @@ +PACKAGECONFIG:append = " \ + aio \ + libusb \ + ${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)} \ +" diff --git a/meta-agl-core/recipes-graphics/libsdl2/libsdl2_%.bbappend b/meta-agl-core/recipes-graphics/libsdl2/libsdl2_%.bbappend new file mode 100644 index 000000000..48e50788e --- /dev/null +++ b/meta-agl-core/recipes-graphics/libsdl2/libsdl2_%.bbappend @@ -0,0 +1 @@ +require ${@bb.utils.contains('AGL_FEATURES', 'aglcore', 'libsdl2_aglcore.inc', '', d)} diff --git a/meta-agl-core/recipes-graphics/libsdl2/libsdl2_aglcore.inc b/meta-agl-core/recipes-graphics/libsdl2/libsdl2_aglcore.inc new file mode 100644 index 000000000..7652e1843 --- /dev/null +++ b/meta-agl-core/recipes-graphics/libsdl2/libsdl2_aglcore.inc @@ -0,0 +1,3 @@ +# Make sure opengl is disabled, as using wayland implies gles2 in the +# libsdl2 PACKAGECONFIG definitions. +PACKAGECONFIG:remove = "opengl" diff --git a/meta-agl-core/recipes-graphics/wayland/agl-compositor-init.bb b/meta-agl-core/recipes-graphics/wayland/agl-compositor-init.bb new file mode 100644 index 000000000..d8baf91f9 --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/agl-compositor-init.bb @@ -0,0 +1,61 @@ +SUMMARY = "Startup systemd unit for the AGL Wayland compositor" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +inherit systemd + +# Reuse include file from upstream weston since we have the same requirements +require recipes-graphics/wayland/required-distro-features.inc + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +SRC_URI = "file://agl-compositor.service \ + file://agl-compositor.socket \ + file://agl-compositor-autologin \ + file://agl-compositor.conf.in \ +" + +S = "${WORKDIR}" + +AGL_COMPOSITOR_ARGS ?= " --config ${sysconfdir}/xdg/weston/weston.ini --idle-time=0" +AGL_COMPOSITOR_USE_PIXMAN ??= "0" + +AGL_COMPOSITOR_ARGS:append = " ${@bb.utils.contains("DISTRO_FEATURES", "agl-devel", " --debug", "",d)}" +AGL_COMPOSITOR_ARGS:append = " ${@bb.utils.contains("WESTON_USE_PIXMAN", "1", " --use-pixman", "",d)}" + +do_install() { + # Install systemd service + install -D -p -m0644 ${WORKDIR}/agl-compositor.service ${D}${systemd_system_unitdir}/agl-compositor.service + install -D -p -m0644 ${WORKDIR}/agl-compositor.socket ${D}${systemd_system_unitdir}/agl-compositor.socket + if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then + install -D -p -m0644 ${WORKDIR}/agl-compositor-autologin ${D}${sysconfdir}/pam.d/agl-compositor-autologin + fi + + # Install systemd service drop-in with extra configuration + files=agl-compositor.conf.in + for f in ${files}; do + g=${f%.in} + if [ "${f}" != "${g}" ]; then + sed -e "s,@AGL_COMPOSITOR_ARGS@,${AGL_COMPOSITOR_ARGS},g" \ + ${WORKDIR}/${f} > ${WORKDIR}/${g} + fi + done + install -d ${D}${systemd_system_unitdir}/agl-compositor.service.d + install -m644 ${WORKDIR}/agl-compositor.conf ${D}/${systemd_system_unitdir}/agl-compositor.service.d/agl-compositor.conf +} + +FILES:${PN} += "\ + ${systemd_system_unitdir}/agl-compositor.service \ + ${systemd_system_unitdir}/agl-compositor.socket \ + ${systemd_system_unitdir}/agl-compositor.service.d \ + ${sysconfdir}/default/agl-compositor \ + ${sysconfdir}/pam.d/ \ + " + +CONFFILES:${PN} += "${sysconfdir}/default/agl-compositor" + +RDEPENDS:${PN} = "agl-users agl-compositor weston-ini" + +RCONFLICTS:${PN} = "weston-init" + +SYSTEMD_SERVICE:${PN} = "agl-compositor.service agl-compositor.socket" diff --git a/meta-agl-core/recipes-graphics/wayland/agl-compositor-init/agl-compositor-autologin b/meta-agl-core/recipes-graphics/wayland/agl-compositor-init/agl-compositor-autologin new file mode 100644 index 000000000..f6e6d106d --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/agl-compositor-init/agl-compositor-autologin @@ -0,0 +1,11 @@ +auth required pam_nologin.so +auth required pam_unix.so try_first_pass nullok + +account required pam_nologin.so +account required pam_unix.so + +session required pam_env.so +session required pam_unix.so +-session optional pam_systemd.so type=wayland class=user desktop=weston +-session optional pam_loginuid.so + diff --git a/meta-agl-core/recipes-graphics/wayland/agl-compositor-init/agl-compositor.conf.in b/meta-agl-core/recipes-graphics/wayland/agl-compositor-init/agl-compositor.conf.in new file mode 100644 index 000000000..2918c410c --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/agl-compositor-init/agl-compositor.conf.in @@ -0,0 +1,3 @@ +[Service] +ExecStart= +ExecStart=/usr/bin/agl-compositor @AGL_COMPOSITOR_ARGS@ diff --git a/meta-agl-core/recipes-graphics/wayland/agl-compositor-init/agl-compositor.service b/meta-agl-core/recipes-graphics/wayland/agl-compositor-init/agl-compositor.service new file mode 100644 index 000000000..4ee14de27 --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/agl-compositor-init/agl-compositor.service @@ -0,0 +1,72 @@ +# This is a system unit for launching AGL compositor with auto-login as the +# user configured here. +# +# AGL compositor and Weston must be built with systemd support, and your +# weston.ini must load the plugin systemd-notify.so. +# +# Attention: +# If you will add new tty dependency setting, you need to update +# agl-compositor-guest.conf. +[Unit] +Description=AGL compositor +Documentation=man:weston(1) man:weston.ini(5) +Documentation=http://wayland.freedesktop.org/ + +# Make sure we are started after logins are permitted. +Requires=systemd-user-sessions.service +After=systemd-user-sessions.service + +# D-Bus is necessary for contacting logind. Logind is required. +Wants=dbus.socket +After=dbus.socket + +# Ensure the socket is present +Requires=agl-compositor.socket + +# Since we are part of the graphical session, make sure we are started before +# it is complete. +Before=graphical.target + +# Prevent starting on systems without virtual consoles, Weston requires one +# for now. +ConditionPathExists=/dev/tty0 + +[Service] +# Requires systemd-notify.so Weston plugin. +Type=notify +EnvironmentFile=-/etc/default/agl-compositor +ExecStart=/usr/bin/agl-compositor --modules=systemd-notify.so + +# Watchdog setup +TimeoutStartSec=60 +WatchdogSec=20 + +# The user to run as. +User=agl-driver +Group=agl-driver + +# Make sure the working directory is the users home directory +WorkingDirectory=/home/agl-driver + +# Set up a full user session for the user +PAMName=agl-compositor-autologin + +# A virtual terminal is needed. +TTYPath=/dev/tty7 +TTYReset=yes +TTYVHangup=yes +TTYVTDisallocate=yes + +# Fail to start if not controlling the tty. +StandardInput=tty-fail +StandardOutput=journal +StandardError=journal + +# Log this user with utmp, letting it show up with commands 'w' and 'who'. +UtmpIdentifier=tty7 +UtmpMode=user + +[Install] +# Note: If you only want weston to start on-demand, remove this line with a +# service drop file +WantedBy=graphical.target diff --git a/meta-agl-core/recipes-graphics/wayland/agl-compositor-init/agl-compositor.socket b/meta-agl-core/recipes-graphics/wayland/agl-compositor-init/agl-compositor.socket new file mode 100644 index 000000000..ef9769ff7 --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/agl-compositor-init/agl-compositor.socket @@ -0,0 +1,10 @@ +# +# Weston must be built with systemd support, and your weston.ini must load +# the plugin systemd-notify.so. + +[Unit] +Description=agl-compositor, a Wayland compositor, as a systemd user service +Documentation=https://docs.automotivelinux.org/en/master/#5_Component_Documentation/1_agl-compositor/ + +[Socket] +ListenStream=%t/wayland-0 diff --git a/meta-agl-core/recipes-graphics/wayland/agl-compositor_git.bb b/meta-agl-core/recipes-graphics/wayland/agl-compositor_git.bb index 2156c7839..3596cbb06 100644 --- a/meta-agl-core/recipes-graphics/wayland/agl-compositor_git.bb +++ b/meta-agl-core/recipes-graphics/wayland/agl-compositor_git.bb @@ -8,29 +8,47 @@ SECTION = "x11" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://COPYING;md5=fac6abe0003c4d142ff8fa1f18316df0" -DEPENDS = "wayland wayland-protocols wayland-native weston \ - ${@bb.utils.contains('AGL_FEATURES', 'waltham-remoting', 'waltham waltham-transmitter-plugin', '', d)}" +DEPENDS = "wayland wayland-protocols wayland-native weston" SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/agl-compositor.git;protocol=https;branch=${AGL_BRANCH}" -SRCREV = "ba86e440b28d1ade0b264ee4afd789faff56b30c" +SRCREV = "d5ecd12729734b788546e0d80edc492454bec251" +AGL_BRANCH:aglnext = "next" +SRCREV:aglnext = "${AUTOREV}" -PV = "0.0.10+git${SRCPV}" +AGL_COMPOSITOR_VERSION = "0.0.24" + +PV = "${AGL_COMPOSITOR_VERSION}+git${SRCPV}" S = "${WORKDIR}/git" PACKAGECONFIG ?= "" PACKAGECONFIG[policy-rba] = "-Dpolicy-default=rba,,librba,librba rba-config" PACKAGECONFIG[policy-deny-all] = "-Dpolicy-default=deny-all,," +PACKAGECONFIG[grpc-proxy] = "-Dgrpc-proxy=true,-Dgrpc-proxy=false,grpc grpc-native,grpc agl-shell-grpc-server" inherit meson pkgconfig python3native +# Reuse include file from upstream weston since we have the same requirements +require recipes-graphics/wayland/required-distro-features.inc + +PACKAGES =+ "agl-shell-grpc-server" + +LDFLAGS:append:riscv64 = " -Wl,--no-as-needed -latomic -Wl,--as-needed" + FILES:${PN} = " \ ${bindir}/agl-compositor \ ${bindir}/agl-screenshooter \ ${libdir}/agl-compositor/libexec_compositor.so.0 \ - ${libdir}/agl-compositor/libexec_compositor.so.0.0.0 \ + ${libdir}/agl-compositor/libexec_compositor.so.${AGL_COMPOSITOR_VERSION} \ " -RDEPENDS:${PN} += " ${@bb.utils.contains('AGL_FEATURES', 'waltham-remoting', 'waltham waltham-transmitter-plugin', '', d)}" +FILES:agl-shell-grpc-server = " \ + ${libdir}/agl-compositor/agl-shell-grpc-server \ +" + +RDEPENDS:${PN} += " \ + agl-compositor-init \ + xkeyboard-config \ +" FILES:${PN}-dev += " \ ${datadir}/agl-compositor/protocols/agl-shell.xml \ diff --git a/meta-agl-core/recipes-graphics/wayland/native-shell-client_git.bb b/meta-agl-core/recipes-graphics/wayland/native-shell-client_git.bb new file mode 100644 index 000000000..8afa75deb --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/native-shell-client_git.bb @@ -0,0 +1,16 @@ +SUMMARY = "Minimal agl-shell Wayland protocol client" + +HOMEPAGE = "https://gerrit.automotivelinux.org/gerrit/q/project:src%252Fnative-shell-client" +SECTION = "x11" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=3b90ee643ce04400848a8f0deb492a4a" + +DEPENDS = "wayland wayland-protocols wayland-native agl-compositor" + +SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/native-shell-client.git;protocol=https;branch=${AGL_BRANCH}" +SRCREV = "43c907756f8eb5c3ac0d4f24b962285968389b89" + +PV = "0.0.1+git${SRCPV}" +S = "${WORKDIR}/git" + +inherit meson pkgconfig diff --git a/meta-agl-core/recipes-graphics/wayland/waltham-transmitter-plugin.bb b/meta-agl-core/recipes-graphics/wayland/waltham-transmitter-plugin.bb deleted file mode 100644 index 466985f41..000000000 --- a/meta-agl-core/recipes-graphics/wayland/waltham-transmitter-plugin.bb +++ /dev/null @@ -1,17 +0,0 @@ -DESCRIPTION = "Waltham transmitter is a libweston plug-in that adds support for receiving input events from a surface streamed on a remote output" -HOMEPAGE = "https://gerrit.automotivelinux.org/gerrit/src/waltham-transmitter-plugin.git" - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;md5=f21c9af4de068fb53b83f0b37d262ec3" - -DEPENDS += "wayland wayland-native waltham weston" - -SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/waltham-transmitter-plugin.git;protocol=https;branch=${AGL_BRANCH}" -SRCREV = "c9d23a045e6cb46c023c15f8189ef3ee8b1ddf20" - -S = "${WORKDIR}/git" - -inherit meson pkgconfig python3native - -FILES:${PN} += "${libdir}/*" -FILES:${PN} += "${bindir}/*" diff --git a/meta-agl-core/recipes-graphics/wayland/waltham/0001-Use-python3-instead-of-2.patch b/meta-agl-core/recipes-graphics/wayland/waltham/0001-Use-python3-instead-of-2.patch deleted file mode 100644 index 32c2df3c4..000000000 --- a/meta-agl-core/recipes-graphics/wayland/waltham/0001-Use-python3-instead-of-2.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 6ecdf10a10929164f3cbdb754ae91d27576e5036 Mon Sep 17 00:00:00 2001 -From: Marius Vlad <marius.vlad@collabora.com> -Date: Fri, 16 Oct 2020 18:57:38 +0300 -Subject: [PATCH] Use python3 instead of 2 - -Signed-off-by: Marius Vlad <marius.vlad@collabora.com> ---- - configure.ac | 2 +- - tools/gen.py | 6 +++--- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 5f65a6b..94b8644 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -32,7 +32,7 @@ AC_SUBST(VERSION_INFO) - # Check for programs - AC_PROG_CC - AC_PROG_CC_STDC --AC_CHECK_PROGS([PYTHON2], [python2 python]) -+AC_CHECK_PROGS([PYTHON3], [python3 python]) - PKG_PROG_PKG_CONFIG() - - AC_ARG_ENABLE(gprof, -diff --git a/tools/gen.py b/tools/gen.py -index 19e8baa..64c5870 100755 ---- a/tools/gen.py -+++ b/tools/gen.py -@@ -1,4 +1,4 @@ --#!/usr/bin/env python2 -+#!/usr/bin/env python3 - # -*- coding: utf-8 -*- - - # Copyright © 2013-2014 Collabora, Ltd. -@@ -562,11 +562,11 @@ try: - opts, args = getopt.getopt(sys.argv[1:], "hp:i:o:t:m:", - ["preamble=", "input=", "output=", "type=", "mode="]) - except getopt.GetoptError: -- print 'gen.py -p <preamblefile> -i <inputfile> -o <outputfile> -t <type> -m <mode>' -+ print('gen.py -p <preamblefile> -i <inputfile> -o <outputfile> -t <type> -m <mode>') - sys.exit(2) - for opt, arg in opts: - if opt == '-h': -- print 'gen.py -p <preamblefile> -i <inputfile> -o <outputfile> -t <type> -m <mode>' -+ print('gen.py -p <preamblefile> -i <inputfile> -o <outputfile> -t <type> -m <mode>') - sys.exit() - elif opt in ("-p", "--preamble"): - preamble_files.append(arg) --- -2.28.0 - diff --git a/meta-agl-core/recipes-graphics/wayland/waltham/0001-waltham-Fix-compile-build-error.patch b/meta-agl-core/recipes-graphics/wayland/waltham/0001-waltham-Fix-compile-build-error.patch deleted file mode 100644 index 354bcbc15..000000000 --- a/meta-agl-core/recipes-graphics/wayland/waltham/0001-waltham-Fix-compile-build-error.patch +++ /dev/null @@ -1,55 +0,0 @@ -From cc87dddc2cdc0c20b053e3da1197efd671b4f50c Mon Sep 17 00:00:00 2001 -From: Marius Vlad <marius.vlad@collabora.com> -Date: Wed, 23 Sep 2020 22:33:50 +0300 -Subject: [PATCH 1/2] waltham: Fix compile build error - -Newer compilers will complain about the fact debug_message is declared -multiple times: - -multiple definition of `debug_message'; -.libs/marshaller.o:/home/mvlad/src/native-agl-weston8/waltham/waltham/src/waltham/marshaller_log.h:35: -first defined here multiple definition of `debug_message'; -.libs/marshaller.o:/home/mvlad/src/native-agl-weston8/waltham/waltham/src/waltham/marshaller_log.h:35: -first defined here /usr/bin/ld: -.libs/client-serialice.o:/home/mvlad/src/native-agl-weston8/waltham/waltham/src/waltham/marshaller_log.h:35: -multiple definition of `debug_message'; -.libs/marshaller.o:/home/mvlad/src/native-agl-weston8/waltham/waltham/src/waltham/marshaller_log.h:35: -first defined here - -Bug-AGL: SPEC-3649 - -Signed-off-by: Marius Vlad <marius.vlad@collabora.com> ---- - src/waltham/marshaller_log.h | 2 +- - src/waltham/waltham-util.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/waltham/marshaller_log.h b/src/waltham/marshaller_log.h -index 8254914..ffa87c1 100644 ---- a/src/waltham/marshaller_log.h -+++ b/src/waltham/marshaller_log.h -@@ -32,7 +32,7 @@ - /* Comment/uncomment to disable/enable debugging log */ - #define DEBUG - //#define PROFILE --int debug_message; -+extern int debug_message; - - #ifdef DEBUG - static inline void DEBUG_STAMP (void) { -diff --git a/src/waltham/waltham-util.c b/src/waltham/waltham-util.c -index 410b114..8f898f8 100644 ---- a/src/waltham/waltham-util.c -+++ b/src/waltham/waltham-util.c -@@ -34,7 +34,7 @@ - #include "waltham-connection.h" - #include "waltham-private.h" - --int debug_message; -+extern int debug_message; - - static void - wth_pfx_print(const char *pfx, const char *fmt, va_list argp) --- -2.28.0 - diff --git a/meta-agl-core/recipes-graphics/wayland/waltham/0002-commandxml-Add-support-wthp_app_id-interface.patch b/meta-agl-core/recipes-graphics/wayland/waltham/0002-commandxml-Add-support-wthp_app_id-interface.patch deleted file mode 100644 index 5aefb922b..000000000 --- a/meta-agl-core/recipes-graphics/wayland/waltham/0002-commandxml-Add-support-wthp_app_id-interface.patch +++ /dev/null @@ -1,70 +0,0 @@ -From d30005429fe92daa14151c2a6175d5cf19506cac Mon Sep 17 00:00:00 2001 -From: Marius Vlad <marius.vlad@collabora.com> -Date: Wed, 7 Oct 2020 16:36:38 +0300 -Subject: [PATCH 2/2] commandxml: Add support wthp_app_id interface - -With it, we hang off the app_id which we can use to pass it to the -receiver side. - -Bug-AGL: SPEC-3601 - -Signed-off-by: Marius Vlad <marius.vlad@collabora.com> ---- - data/command.xml | 29 +++++++++++++++++++++++++++++ - src/waltham/header-preamble.txt | 1 + - 2 files changed, 30 insertions(+) - -diff --git a/data/command.xml b/data/command.xml -index a03082b..cb53f75 100644 ---- a/data/command.xml -+++ b/data/command.xml -@@ -1814,6 +1814,35 @@ - - </interface> - -+ <interface name="wthp_ivi_app_id" version="1"> -+ <description summary="create ivi-style surfaces"> -+ This interface is exposed as a global singleton. -+ This interface is implemented by servers that provide IVI-style user interfaces. -+ It allows clients to associate an ivi_surface with wthp_surface. -+ </description> -+ -+ <enum name="error"> -+ <entry name="role" value="0" summary="given wthp_surface has another role"/> -+ </enum> -+ -+ <request name="surface_create"> -+ <description summary="create ivi_surface with app_id in ivi compositor"> -+ This request gives the wthp_surface the role of an IVI Surface. Creating more than -+ one ivi_surface for a wthp_surface is not allowed. Note, that this still allows the -+ following example: -+ -+ 1. create a wthp_surface -+ 2. create ivi_surface for the wthp_surface -+ 3. destroy the ivi_surface -+ -+ </description> -+ <arg name="app_id" type="string"/> -+ <arg name="surface" type="object" interface="wthp_surface"/> -+ <arg name="id" type="new_id" interface="wthp_ivi_surface"/> -+ </request> -+ -+ </interface> -+ - <interface name="dummy" version="1"> - <request name="dummy_request"> - </request> -diff --git a/src/waltham/header-preamble.txt b/src/waltham/header-preamble.txt -index df765cc..2409859 100644 ---- a/src/waltham/header-preamble.txt -+++ b/src/waltham/header-preamble.txt -@@ -50,5 +50,6 @@ struct wthp_touch; - - struct wthp_ivi_surface; - struct wthp_ivi_application; -+struct wthp_ivi_app_id; - - struct dummy; --- -2.28.0 - diff --git a/meta-agl-core/recipes-graphics/wayland/waltham_%.bbappend b/meta-agl-core/recipes-graphics/wayland/waltham_%.bbappend deleted file mode 100644 index 302eba4d2..000000000 --- a/meta-agl-core/recipes-graphics/wayland/waltham_%.bbappend +++ /dev/null @@ -1,7 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" - -SRC_URI:append = "\ - file://0001-waltham-Fix-compile-build-error.patch \ - file://0002-commandxml-Add-support-wthp_app_id-interface.patch \ - file://0001-Use-python3-instead-of-2.patch \ - " diff --git a/meta-agl-core/recipes-graphics/wayland/waltham_git.bb b/meta-agl-core/recipes-graphics/wayland/waltham_git.bb deleted file mode 100644 index 2a2592d40..000000000 --- a/meta-agl-core/recipes-graphics/wayland/waltham_git.bb +++ /dev/null @@ -1,16 +0,0 @@ -DESCRIPTION = "Waltham is a network IPC library designed to resemble Wayland both protocol and protocol-API wise" -HOMEPAGE = "https://github.com/waltham/waltham" - -LICENSE = "MIT" -LIC_FILES_CHKSUM = " \ - file://LICENSE;md5=e8ad01a5182f2c1b3a2640e9ea268264 \ -" -SRCREV = "1de58c3ff746ddaba7584d760c5454243723d3ca" -SRC_URI = "git://github.com/wmizuno/waltham.git \ - " -S = "${WORKDIR}/git" - -inherit autotools pkgconfig - -DEPENDS += "libdrm virtual/kernel wayland" -RDEPENDS:${PN} += "libdrm"
\ No newline at end of file diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf.bb b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf.bb index c635d7b2f..0611ec5b4 100644 --- a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf.bb +++ b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf.bb @@ -9,11 +9,16 @@ SRC_URI = " \ file://hdmi-a-1-90.cfg \ file://hdmi-a-1-180.cfg \ file://hdmi-a-1-270.cfg \ - file://remote-output.cfg \ - file://transmitter-output.cfg.in \ + file://hdmi-a-2-0.cfg \ + file://hdmi-a-2-90.cfg \ + file://hdmi-a-2-180.cfg \ + file://hdmi-a-2-270.cfg \ + file://remote-output.cfg.in \ file://virtual-0.cfg \ + file://virtual-90.cfg \ file://virtual-180.cfg \ file://virtual-270.cfg \ + file://grpc-proxy.cfg \ " S = "${WORKDIR}" @@ -21,27 +26,26 @@ S = "${WORKDIR}" inherit update-alternatives # Default primary display/orientation fragment -WESTON_DISPLAYS ?= "hdmi-a-1-270" +WESTON_DISPLAYS ?= "hdmi-a-1-90" # Configuration fragments to use in weston.ini.* # Note that some may be replaced/removed when building the landscape # configuration. -WESTON_FRAGMENTS = "core shell ${WESTON_DISPLAYS}" +WESTON_FRAGMENTS = "core shell grpc-proxy ${WESTON_DISPLAYS}" # On-target weston.ini directory weston_ini_dir = "${sysconfdir}/xdg/weston" # Options for the user to change in local.conf -# e.g. TRANSMITTER_OUTPUT_MODE = "1080x1488" -TRANSMITTER_OUTPUT_MODE ??= "640x720@30" -TRANSMITTER_OUTPUT_HOST ??= "192.168.20.99" -TRANSMITTER_OUTPUT_PORT ??= "5005" +# e.g. REMOTING_OUTPUT_MODE = "1080x1488" +REMOTING_OUTPUT_MODE ??= "640x720@30" +REMOTING_OUTPUT_HOST ??= "192.168.10.3" +REMOTING_OUTPUT_PORT ??= "5005" do_configure() { - sed -e "s#mode=.*#mode=${TRANSMITTER_OUTPUT_MODE}#" \ - -e "s#host=.*#host=${TRANSMITTER_OUTPUT_HOST}#" \ - -e "s#port=.*#port=${TRANSMITTER_OUTPUT_PORT}#" \ - ${WORKDIR}/transmitter-output.cfg.in > ${WORKDIR}/transmitter-output.cfg + sed -e "s#host=.*#host=${REMOTING_OUTPUT_HOST}#" \ + -e "s#port=.*#port=${REMOTING_OUTPUT_PORT}#" \ + ${WORKDIR}/remote-output.cfg.in > ${WORKDIR}/remote-output.cfg } do_compile() { @@ -54,16 +58,22 @@ do_compile() { done sed -i -e '$ d' ${WORKDIR}/weston.ini.default + cat ${WORKDIR}/weston.ini.default > ${WORKDIR}/weston.ini.default-no-activate + # Do it again, but filter fragments to configure for landscape # and a corresponding landscape-inverted that is 180 degrees # rotated. rm -f ${WORKDIR}/weston.ini.landscape + rm -f ${WORKDIR}/weston.ini.landscape-inverted for F in ${WESTON_FRAGMENTS}; do INVF=$F if echo $F | grep '^hdmi-a-1-\(90\|270\)$'; then F="hdmi-a-1-0" INVF="hdmi-a-1-180" - elif echo $F | grep '^virtual-270$'; then + elif echo $F | grep '^hdmi-a-2-\(90\|270\)$'; then + F="hdmi-a-2-0" + INVF="hdmi-a-2-180" + elif echo $F | grep '^virtual-90$'; then F="virtual-0" INVF="virtual-180" fi @@ -74,11 +84,15 @@ do_compile() { done sed -i -e '$ d' ${WORKDIR}/weston.ini.landscape sed -i -e '$ d' ${WORKDIR}/weston.ini.landscape-inverted + + cat ${WORKDIR}/weston.ini.landscape > ${WORKDIR}/weston.ini.landscape-no-activate } do_install:append() { install -d ${D}${weston_ini_dir} install -m 0644 ${WORKDIR}/weston.ini.default ${D}${weston_ini_dir}/ + install -m 0644 ${WORKDIR}/weston.ini.default-no-activate ${D}${weston_ini_dir}/ + install -m 0644 ${WORKDIR}/weston.ini.landscape-no-activate ${D}${weston_ini_dir}/ install -m 0644 ${WORKDIR}/weston.ini.landscape ${D}${weston_ini_dir}/ install -m 0644 ${WORKDIR}/weston.ini.landscape-inverted ${D}${weston_ini_dir}/ } @@ -94,7 +108,6 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" ALTERNATIVE_LINK_NAME[weston.ini] = "${weston_ini_dir}/weston.ini" -RDEPENDS:${PN} = "weston-init" RPROVIDES:${PN} = "weston-ini" RCONFLICTS:${PN} = "${PN}-landscape" ALTERNATIVE:${PN} = "weston.ini" @@ -104,7 +117,6 @@ PACKAGE_BEFORE_PN += "${PN}-landscape" FILES:${PN}-landscape = "${weston_ini_dir}/weston.ini.landscape" -RDEPENDS:${PN}-landscape = "weston-init" RPROVIDES:${PN}-landscape = "weston-ini" RCONFLICTS:${PN}-landscape = "${PN}" ALTERNATIVE:${PN}-landscape = "weston.ini" @@ -114,8 +126,31 @@ PACKAGE_BEFORE_PN += "${PN}-landscape-inverted" FILES:${PN}-landscape-inverted = "${weston_ini_dir}/weston.ini.landscape-inverted" -RDEPENDS:${PN}-landscape-inverted = "weston-init" RPROVIDES:${PN}-landscape-inverted = "weston-ini" RCONFLICTS:${PN}-landscape-inverted = "${PN}" ALTERNATIVE:${PN}-landscape-inverted = "weston.ini" ALTERNATIVE_TARGET_${PN}-landscape-inverted = "${weston_ini_dir}/weston.ini.landscape-inverted" + +# no activation by default +PACKAGE_BEFORE_PN += "${PN}-no-activate" + +FILES:${PN}-no-activate = "${weston_ini_dir}/weston.ini.default-no-activate" + +RPROVIDES:${PN}-no-activate = "weston-ini" +RCONFLICTS:${PN}-no-activate = "${PN}" +ALTERNATIVE:${PN}-no-activate = "weston.ini" +ALTERNATIVE_TARGET_${PN}-no-activate = "${weston_ini_dir}/weston.ini.default-no-activate" + +# landscape, no activation by default +PACKAGE_BEFORE_PN += "${PN}-landscape-no-activate" + +FILES:${PN}-landscape-no-activate = "${weston_ini_dir}/weston.ini.landscape-no-activate" + +RPROVIDES:${PN}-landscape-no-activate = "weston-ini" +RCONFLICTS:${PN}-landscape-no-activate = "${PN}" +ALTERNATIVE:${PN}-landscape-no-activate = "weston.ini" +ALTERNATIVE_TARGET_${PN}-landscape-no-activate = "${weston_ini_dir}/weston.ini.landscape-no-activate" + +# This is a settings-only package, we do not need a development package +# (and its fixed dependency to ${PN} being installed) +PACKAGES:remove = "${PN}-dev ${PN}-staticdev" diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf.bbappend b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf.bbappend index c4cf6c152..746bde339 100644 --- a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf.bbappend +++ b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf.bbappend @@ -3,10 +3,10 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" PACKAGE_ARCH = "${MACHINE_ARCH}" WESTON_DISPLAYS:append = "${@bb.utils.contains("DISTRO_FEATURES", "weston-remoting", " remote-output", "", d)}" -WESTON_DISPLAYS:append = "${@bb.utils.contains("AGL_FEATURES", "waltham-remoting", " transmitter-output", "", d)}" # For virtual machines and intel-corei7-64 we want to support both the HDMI-A-1 # and Virtual-1 outputs. This allows us to run virtual images on real hardware # and vice versa. -WESTON_DISPLAYS:append:qemuall = " virtual-270" -WESTON_DISPLAYS:append:intel-corei7-64 = " virtual-270" +WESTON_DISPLAYS:append:qemuall = " virtual-90" +WESTON_DISPLAYS:append:intel-corei7-64 = " virtual-90" +WESTON_DISPLAYS:append:virtio-aarch64 = " virtual-90" diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/core.cfg b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/core.cfg index 90774ed79..28f90752d 100644 --- a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/core.cfg +++ b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/core.cfg @@ -1,4 +1,6 @@ [core] backend=drm-backend.so require-input=false +idle-time=0 modules=systemd-notify.so +activate-by-default=false diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/grpc-proxy.cfg b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/grpc-proxy.cfg new file mode 100644 index 000000000..14805b969 --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/grpc-proxy.cfg @@ -0,0 +1,4 @@ + +[shell-client-ext] +command=/usr/lib/agl-compositor/agl-shell-grpc-server + diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-1-180.cfg b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-1-180.cfg index 7648c779b..b6f4329ef 100644 --- a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-1-180.cfg +++ b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-1-180.cfg @@ -1,4 +1,4 @@ # A display is connected to HDMI-A-1 [output] name=HDMI-A-1 -transform=180 +transform=rotate-180 diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-1-270.cfg b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-1-270.cfg index dffc2b6dd..187f2c7bd 100644 --- a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-1-270.cfg +++ b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-1-270.cfg @@ -3,4 +3,4 @@ # of the GeChic display or the Dell display. [output] name=HDMI-A-1 -transform=270 +transform=rotate-270 diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-1-90.cfg b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-1-90.cfg index 88a692a1b..5ee9c1904 100644 --- a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-1-90.cfg +++ b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-1-90.cfg @@ -3,4 +3,4 @@ # display used in some instances. [output] name=HDMI-A-1 -transform=90 +transform=rotate-90 diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-2-0.cfg b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-2-0.cfg new file mode 100644 index 000000000..4d5d51c03 --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-2-0.cfg @@ -0,0 +1,5 @@ +# A display is connected to HDMI-A-1 and needs to be rotated 90 degrees +# to have a proper orientation of the homescreen. For example, the 'eGalax' +# display used in some instances. +[output] +name=HDMI-A-2 diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-2-180.cfg b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-2-180.cfg new file mode 100644 index 000000000..ffdc5fe60 --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-2-180.cfg @@ -0,0 +1,6 @@ +# A display is connected to HDMI-A-1 and needs to be rotated 90 degrees +# to have a proper orientation of the homescreen. For example, the 'eGalax' +# display used in some instances. +[output] +name=HDMI-A-2 +transform=rotate-180 diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-2-270.cfg b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-2-270.cfg new file mode 100644 index 000000000..76fc77acd --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-2-270.cfg @@ -0,0 +1,6 @@ +# A display is connected to HDMI-A-1 and needs to be rotated 90 degrees +# to have a proper orientation of the homescreen. For example, the 'eGalax' +# display used in some instances. +[output] +name=HDMI-A-2 +transform=rotate-270 diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-2-90.cfg b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-2-90.cfg new file mode 100644 index 000000000..9172a1c6a --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/hdmi-a-2-90.cfg @@ -0,0 +1,6 @@ +# A display is connected to HDMI-A-1 and needs to be rotated 90 degrees +# to have a proper orientation of the homescreen. For example, the 'eGalax' +# display used in some instances. +[output] +name=HDMI-A-2 +transform=rotate-90 diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/remote-output.cfg b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/remote-output.cfg.in index f69a2e096..940cbdd0c 100644 --- a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/remote-output.cfg +++ b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/remote-output.cfg.in @@ -1,5 +1,5 @@ [remote-output] name=remote-1 mode=640x720@30 -host=192.168.20.99 +host=192.168.10.3 port=5005 diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/shell.cfg b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/shell.cfg index 975e539e6..8d16ba5d7 100644 --- a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/shell.cfg +++ b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/shell.cfg @@ -1,3 +1,3 @@ [shell] -locking=true +locking=false panel-position=none diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/transmitter-output.cfg.in b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/transmitter-output.cfg.in deleted file mode 100644 index e77f74ec0..000000000 --- a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/transmitter-output.cfg.in +++ /dev/null @@ -1,5 +0,0 @@ -[transmitter-output] -name=transmitter-1 -mode=640x720@30 -host=192.168.20.99 -port=5005 diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual-180.cfg b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual-180.cfg index 34a741d40..0363b6339 100644 --- a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual-180.cfg +++ b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual-180.cfg @@ -1,4 +1,4 @@ [output] name=Virtual-1 mode=1920x1080 -transform=180 +transform=rotate-180 diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual-270.cfg b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual-270.cfg index 0e5b536a6..c3f72f495 100644 --- a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual-270.cfg +++ b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual-270.cfg @@ -1,4 +1,4 @@ [output] name=Virtual-1 mode=1920x1080 -transform=270 +transform=rotate-270 diff --git a/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual-90.cfg b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual-90.cfg new file mode 100644 index 000000000..96d9c3a04 --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/weston-ini-conf/virtual-90.cfg @@ -0,0 +1,4 @@ +[output] +name=Virtual-1 +mode=1920x1080 +transform=rotate-90 diff --git a/meta-agl-core/recipes-graphics/wayland/weston/0001-backend-drm-make-sure-all-buffers-are-released-when-.patch b/meta-agl-core/recipes-graphics/wayland/weston/0001-backend-drm-make-sure-all-buffers-are-released-when-.patch new file mode 100644 index 000000000..fc2f35bd6 --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/weston/0001-backend-drm-make-sure-all-buffers-are-released-when-.patch @@ -0,0 +1,71 @@ +From 6d9e9dfa0479abc0ed7921a4ebf42228c0da7533 Mon Sep 17 00:00:00 2001 +From: Michael Olbrich <m.olbrich@pengutronix.de> +Date: Wed, 22 Jun 2022 08:58:21 +0200 +Subject: [PATCH] backend-drm: make sure all buffers are released when an + output is removed + +When an output is destroyed then the output state is freed immediately. In this +case, the plane state is only partially destroyed because it is the currently +active state. This includes the buffer reference. + +Without the output, the plane will not be updated any more until it is used by a +different output (if possible) or the output returns and the plane is used +again. +As a result, the buffer reference is kept for a long time. This will cause some +applications to stall because weston now keeps two buffers (the one here and +another one for a different output where the application is now displayed). + +To avoid this, do a synchronous commit that disables the output. The output +needs to be disabled anyways and this way the current state contains no +buffers that would remain. + +`device->state_invalid = true` in drm_output_detach_crtc() is no longer +needed, because drm_output_detach_crtc() is called only when initialization +failed and the crtc was not yet used or in drm_output_deinit() when the +crtc was already disabled with the new synchronous commit. + +Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> +(cherry picked from commit f5a4fb5abcb8aeb6b078b6235834cc4ab6176c26) + +Upstream-Status: Pending + +--- + libweston/backend-drm/drm.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index 42787702..8425b0e9 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -1769,14 +1769,11 @@ drm_output_attach_crtc(struct drm_output *output) + static void + drm_output_detach_crtc(struct drm_output *output) + { +- struct drm_backend *b = output->backend; + struct drm_crtc *crtc = output->crtc; + + crtc->output = NULL; + output->crtc = NULL; + +- /* Force resetting unused CRTCs */ +- b->state_invalid = true; + } + + static int +@@ -1839,6 +1836,13 @@ drm_output_deinit(struct weston_output *base) + { + struct drm_output *output = to_drm_output(base); + struct drm_backend *b = to_drm_backend(base->compositor); ++ struct drm_pending_state *pending; ++ ++ if (!b->shutting_down) { ++ pending = drm_pending_state_alloc(b); ++ drm_output_get_disable_state(pending, output); ++ drm_pending_state_apply_sync(pending); ++ } + + if (b->use_pixman) + drm_output_fini_pixman(output); +-- +2.39.2 + diff --git a/meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-Migrate-weston_seat_init-release-to-public.patch b/meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-Migrate-weston_seat_init-release-to-public.patch deleted file mode 100644 index 02af7cbaf..000000000 --- a/meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-Migrate-weston_seat_init-release-to-public.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 4534fcab54409b08faf4445ed6780136b58afb63 Mon Sep 17 00:00:00 2001 -From: Marius Vlad <marius.vlad@collabora.com> -Date: Mon, 28 Sep 2020 22:51:00 +0300 -Subject: [PATCH 1/2] libweston: Migrate weston_seat_init/release to public - headers - -weston_seat_init/release needed for creating weston plug-ins that want -manage seat/input on their own. - -Signed-off-by: Marius Vlad <marius.vlad@collabora.com> ---- - include/libweston/libweston.h | 25 +++++++++++++++++++++++++ - libweston/libweston-internal.h | 31 +++---------------------------- - 2 files changed, 28 insertions(+), 28 deletions(-) - -diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h -index 54ea008..59541f2 100644 ---- a/include/libweston/libweston.h -+++ b/include/libweston/libweston.h -@@ -2053,6 +2053,31 @@ void - weston_timeline_refresh_subscription_objects(struct weston_compositor *wc, - void *object); - -+/* input, seat */ -+void -+weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec, -+ const char *seat_name); -+void -+weston_seat_release(struct weston_seat *seat); -+ -+void -+weston_seat_init_pointer(struct weston_seat *seat); -+ -+int -+weston_seat_init_keyboard(struct weston_seat *seat, struct xkb_keymap *keymap); -+ -+void -+weston_seat_init_touch(struct weston_seat *seat); -+ -+void -+weston_seat_release_keyboard(struct weston_seat *seat); -+ -+void -+weston_seat_release_pointer(struct weston_seat *seat); -+ -+void -+weston_seat_release_touch(struct weston_seat *seat); -+ - #ifdef __cplusplus - } - #endif -diff --git a/libweston/libweston-internal.h b/libweston/libweston-internal.h -index 66c38e8..f5c4c2c 100644 ---- a/libweston/libweston-internal.h -+++ b/libweston/libweston-internal.h -@@ -168,44 +168,19 @@ weston_plane_init(struct weston_plane *plane, - void - weston_plane_release(struct weston_plane *plane); - --/* weston_seat */ -- - struct clipboard * - clipboard_create(struct weston_seat *seat); - --void --weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec, -- const char *seat_name); -- --void --weston_seat_repick(struct weston_seat *seat); -+/* weston_seat */ - - void --weston_seat_release(struct weston_seat *seat); -+weston_seat_update_keymap(struct weston_seat *seat, struct xkb_keymap *keymap); - - void - weston_seat_send_selection(struct weston_seat *seat, struct wl_client *client); - - void --weston_seat_init_pointer(struct weston_seat *seat); -- --int --weston_seat_init_keyboard(struct weston_seat *seat, struct xkb_keymap *keymap); -- --void --weston_seat_init_touch(struct weston_seat *seat); -- --void --weston_seat_release_keyboard(struct weston_seat *seat); -- --void --weston_seat_release_pointer(struct weston_seat *seat); -- --void --weston_seat_release_touch(struct weston_seat *seat); -- --void --weston_seat_update_keymap(struct weston_seat *seat, struct xkb_keymap *keymap); -+weston_seat_repick(struct weston_seat *seat); - - void - wl_data_device_set_keyboard_focus(struct weston_seat *seat); --- -2.28.0 - diff --git a/meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-Send-name-description-update-wl_output-to-.patch b/meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-Send-name-description-update-wl_output-to-.patch new file mode 100644 index 000000000..4e0e2c587 --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-Send-name-description-update-wl_output-to-.patch @@ -0,0 +1,117 @@ +From 5361d157ff6b11d5cb7a9f989abe5f376c9e2efa Mon Sep 17 00:00:00 2001 +From: Marius Vlad <marius.vlad@collabora.com> +Date: Wed, 24 Aug 2022 11:43:06 +0300 +Subject: [PATCH] libweston: Send name,description, update wl_output to ver 4 + +These have been in wayland a while back with version 1.20.0. + +We also need to update the test client helper with this bump, as +those bind to version 4. + +Upstream-Status: Pending + +Signed-off-by: Marius Vlad <marius.vlad@collabora.com> +--- + libweston/compositor.c | 14 +++++++++++++- + tests/weston-test-client-helper.c | 18 ++++++++++++++++++ + tests/weston-test-client-helper.h | 2 ++ + 3 files changed, 33 insertions(+), 1 deletion(-) + +diff --git a/libweston/compositor.c b/libweston/compositor.c +index 1670c50..af7c71e 100644 +--- a/libweston/compositor.c ++++ b/libweston/compositor.c +@@ -184,6 +184,12 @@ weston_mode_switch_send_events(struct weston_head *head, + if (version >= WL_OUTPUT_SCALE_SINCE_VERSION && scale_changed) + wl_output_send_scale(resource, output->current_scale); + ++ if (version >= WL_OUTPUT_NAME_SINCE_VERSION) ++ wl_output_send_name(resource, head->name); ++ ++ if (version >= WL_OUTPUT_DESCRIPTION_SINCE_VERSION) ++ wl_output_send_description(resource, head->model); ++ + if (version >= WL_OUTPUT_DONE_SINCE_VERSION) + wl_output_send_done(resource); + } +@@ -5198,6 +5204,12 @@ bind_output(struct wl_client *client, + mode->refresh); + } + ++ if (version >= WL_OUTPUT_NAME_SINCE_VERSION) ++ wl_output_send_name(resource, head->name); ++ ++ if (version >= WL_OUTPUT_DESCRIPTION_SINCE_VERSION) ++ wl_output_send_description(resource, head->model); ++ + if (version >= WL_OUTPUT_DONE_SINCE_VERSION) + wl_output_send_done(resource); + } +@@ -5206,7 +5218,7 @@ static void + weston_head_add_global(struct weston_head *head) + { + head->global = wl_global_create(head->compositor->wl_display, +- &wl_output_interface, 3, ++ &wl_output_interface, 4, + head, bind_output); + } + +diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c +index 01c4b80..8369c40 100644 +--- a/tests/weston-test-client-helper.c ++++ b/tests/weston-test-client-helper.c +@@ -715,6 +715,20 @@ output_handle_scale(void *data, + output->scale = scale; + } + ++static void ++output_handle_name(void *data, struct wl_output *wl_output, const char *name) ++{ ++ struct output *output = data; ++ output->name = strdup(name); ++} ++ ++static void ++output_handle_description(void *data, struct wl_output *wl_output, const char *desc) ++{ ++ struct output *output = data; ++ output->name = strdup(desc); ++} ++ + static void + output_handle_done(void *data, + struct wl_output *wl_output) +@@ -729,6 +743,8 @@ static const struct wl_output_listener output_listener = { + output_handle_mode, + output_handle_done, + output_handle_scale, ++ output_handle_name, ++ output_handle_description, + }; + + static void +@@ -737,6 +753,8 @@ output_destroy(struct output *output) + assert(wl_proxy_get_version((struct wl_proxy *)output->wl_output) >= 3); + wl_output_release(output->wl_output); + wl_list_remove(&output->link); ++ free(output->name); ++ free(output->desc); + free(output); + } + +diff --git a/tests/weston-test-client-helper.h b/tests/weston-test-client-helper.h +index 8e1505d..9e05009 100644 +--- a/tests/weston-test-client-helper.h ++++ b/tests/weston-test-client-helper.h +@@ -163,6 +163,8 @@ struct output { + int height; + int scale; + int initialized; ++ char *name; ++ char *desc; + }; + + struct buffer { +-- +2.35.1 + diff --git a/meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-desktop-xdg-shell-Add-tiled-orientation-st.patch b/meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-desktop-xdg-shell-Add-tiled-orientation-st.patch new file mode 100644 index 000000000..02349c098 --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-desktop-xdg-shell-Add-tiled-orientation-st.patch @@ -0,0 +1,171 @@ +From 6ab4713d3eba589aa1f39eee2b48c81906d7ba87 Mon Sep 17 00:00:00 2001 +From: Marius Vlad <marius.vlad@collabora.com> +Date: Tue, 16 Aug 2022 13:34:19 +0300 +Subject: [PATCH] libweston/desktop/xdg-shell: Add tiled orientation states + +With the help of a newly introduced function, weston_desktop_surface_set_orientation(), +this patch adds missing tiled states from the xdg-shell protocol. +The orientation state is passed on as a bitmask enumeration flag, which the +shell can set, allowing multiple tiling states at once. + +These new states are incorporated the same way as the others, retaining +the set state, but also avoiding sending new configure events if nothing +changed since previously acked data. + +Upstream-Status: Pending + +Signed-off-by: Marius Vlad <marius.vlad@collabora.com> +(cherry-picked from 37a3025d893def991dec59587d17672aa3bf967a) + +Note that this was actually ported because libweston-desktop is not +embedded into libweston and the structure changed in upstream. +--- + include/libweston-desktop/libweston-desktop.h | 11 ++++++ + libweston-desktop/internal.h | 2 + + libweston-desktop/surface.c | 10 +++++ + libweston-desktop/xdg-shell.c | 38 +++++++++++++++++++ + 4 files changed, 61 insertions(+) + +diff --git a/include/libweston-desktop/libweston-desktop.h b/include/libweston-desktop/libweston-desktop.h +index 3e7ac73..c296d16 100644 +--- a/include/libweston-desktop/libweston-desktop.h ++++ b/include/libweston-desktop/libweston-desktop.h +@@ -44,6 +44,14 @@ enum weston_desktop_surface_edge { + WESTON_DESKTOP_SURFACE_EDGE_BOTTOM_RIGHT = 10, + }; + ++enum weston_top_level_tiled_orientation { ++ WESTON_TOP_LEVEL_TILED_ORIENTATION_NONE = 0 << 0, ++ WESTON_TOP_LEVEL_TILED_ORIENTATION_LEFT = 1 << 1, ++ WESTON_TOP_LEVEL_TILED_ORIENTATION_RIGHT = 1 << 2, ++ WESTON_TOP_LEVEL_TILED_ORIENTATION_TOP = 1 << 3, ++ WESTON_TOP_LEVEL_TILED_ORIENTATION_BOTTOM = 1 << 4, ++}; ++ + struct weston_desktop; + struct weston_desktop_client; + struct weston_desktop_surface; +@@ -163,6 +171,9 @@ void + weston_desktop_surface_set_size(struct weston_desktop_surface *surface, + int32_t width, int32_t height); + void ++weston_desktop_surface_set_orientation(struct weston_desktop_surface *surface, ++ enum weston_top_level_tiled_orientation tile_orientation); ++void + weston_desktop_surface_close(struct weston_desktop_surface *surface); + void + weston_desktop_surface_add_metadata_listener(struct weston_desktop_surface *surface, +diff --git a/libweston-desktop/internal.h b/libweston-desktop/internal.h +index 2606d27..8afdede 100644 +--- a/libweston-desktop/internal.h ++++ b/libweston-desktop/internal.h +@@ -100,6 +100,8 @@ struct weston_desktop_surface_implementation { + void *user_data, bool resizing); + void (*set_size)(struct weston_desktop_surface *surface, + void *user_data, int32_t width, int32_t height); ++ void (*set_orientation)(struct weston_desktop_surface *surface, ++ void *user_data, enum weston_top_level_tiled_orientation tiled_orientation); + void (*committed)(struct weston_desktop_surface *surface, void *user_data, + int32_t sx, int32_t sy); + void (*update_position)(struct weston_desktop_surface *surface, +diff --git a/libweston-desktop/surface.c b/libweston-desktop/surface.c +index 433f08a..6b3f4ae 100644 +--- a/libweston-desktop/surface.c ++++ b/libweston-desktop/surface.c +@@ -506,6 +506,16 @@ weston_desktop_surface_set_size(struct weston_desktop_surface *surface, int32_t + width, height); + } + ++WL_EXPORT void ++weston_desktop_surface_set_orientation(struct weston_desktop_surface *surface, ++ enum weston_top_level_tiled_orientation tile_orientation) ++{ ++ if (surface->implementation->set_orientation != NULL) ++ surface->implementation->set_orientation(surface, ++ surface->implementation_data, ++ tile_orientation); ++} ++ + WL_EXPORT void + weston_desktop_surface_close(struct weston_desktop_surface *surface) + { +diff --git a/libweston-desktop/xdg-shell.c b/libweston-desktop/xdg-shell.c +index ff76c39..1e49147 100644 +--- a/libweston-desktop/xdg-shell.c ++++ b/libweston-desktop/xdg-shell.c +@@ -94,6 +94,7 @@ struct weston_desktop_xdg_toplevel_state { + bool fullscreen; + bool resizing; + bool activated; ++ uint32_t tiled_orientation; + }; + + struct weston_desktop_xdg_toplevel_configure { +@@ -624,6 +625,29 @@ weston_desktop_xdg_toplevel_send_configure(struct weston_desktop_xdg_toplevel *t + s = wl_array_add(&states, sizeof(uint32_t)); + *s = XDG_TOPLEVEL_STATE_ACTIVATED; + } ++ if (toplevel->pending.state.tiled_orientation & ++ WESTON_TOP_LEVEL_TILED_ORIENTATION_LEFT) { ++ s = wl_array_add(&states, sizeof(uint32_t)); ++ *s = XDG_TOPLEVEL_STATE_TILED_LEFT; ++ } ++ ++ if (toplevel->pending.state.tiled_orientation & ++ WESTON_TOP_LEVEL_TILED_ORIENTATION_RIGHT) { ++ s = wl_array_add(&states, sizeof(uint32_t)); ++ *s = XDG_TOPLEVEL_STATE_TILED_RIGHT; ++ } ++ ++ if (toplevel->pending.state.tiled_orientation & ++ WESTON_TOP_LEVEL_TILED_ORIENTATION_TOP) { ++ s = wl_array_add(&states, sizeof(uint32_t)); ++ *s = XDG_TOPLEVEL_STATE_TILED_TOP; ++ } ++ ++ if (toplevel->pending.state.tiled_orientation & ++ WESTON_TOP_LEVEL_TILED_ORIENTATION_BOTTOM) { ++ s = wl_array_add(&states, sizeof(uint32_t)); ++ *s = XDG_TOPLEVEL_STATE_TILED_BOTTOM; ++ } + + xdg_toplevel_send_configure(toplevel->resource, + toplevel->pending.size.width, +@@ -686,6 +710,16 @@ weston_desktop_xdg_toplevel_set_size(struct weston_desktop_surface *dsurface, + weston_desktop_xdg_surface_schedule_configure(&toplevel->base); + } + ++static void ++weston_desktop_xdg_toplevel_set_orientation(struct weston_desktop_surface *surface, void *user_data, ++ enum weston_top_level_tiled_orientation tiled_orientation) ++{ ++ struct weston_desktop_xdg_toplevel *toplevel = user_data; ++ ++ toplevel->pending.state.tiled_orientation = tiled_orientation; ++ weston_desktop_xdg_surface_schedule_configure(&toplevel->base); ++} ++ + static void + weston_desktop_xdg_toplevel_committed(struct weston_desktop_xdg_toplevel *toplevel, + int32_t sx, int32_t sy) +@@ -1096,6 +1130,9 @@ weston_desktop_xdg_toplevel_state_compare(struct weston_desktop_xdg_toplevel *to + return false; + if (toplevel->pending.state.resizing != configured.state.resizing) + return false; ++ if (toplevel->pending.state.tiled_orientation != ++ configured.state.tiled_orientation) ++ return false; + + if (toplevel->pending.size.width == configured.size.width && + toplevel->pending.size.height == configured.size.height) +@@ -1440,6 +1477,7 @@ static const struct weston_desktop_surface_implementation weston_desktop_xdg_sur + .set_resizing = weston_desktop_xdg_toplevel_set_resizing, + .set_activated = weston_desktop_xdg_toplevel_set_activated, + .set_size = weston_desktop_xdg_toplevel_set_size, ++ .set_orientation = weston_desktop_xdg_toplevel_set_orientation, + + .get_maximized = weston_desktop_xdg_toplevel_get_maximized, + .get_fullscreen = weston_desktop_xdg_toplevel_get_fullscreen, +-- +2.35.1 + diff --git a/meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-weston-log-Add-a-iterator-helper-for-debug.patch b/meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-weston-log-Add-a-iterator-helper-for-debug.patch new file mode 100644 index 000000000..5b7a4ca76 --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-weston-log-Add-a-iterator-helper-for-debug.patch @@ -0,0 +1,227 @@ +From d5168b8eb0d881a0a6029c0b348a739147317238 Mon Sep 17 00:00:00 2001 +From: Marius Vlad <marius.vlad@collabora.com> +Date: Mon, 29 May 2023 16:30:02 +0300 +Subject: [PATCH] libweston/weston-log: Add a iterator helper for debug scope + +This adds three new helpers: one to iterate over all debug scopes +created/added and other two are for simpler getters for the scope name +and the description. + +Included with this change is also a simple test to retrieve them. + +This is an alternative to using the debug scope list advertised when +using the weston-debug private extension. libweston users can use this +directly to know which scopes they can subscribe to, and there's no need +to have a client implementation for the weston-debug protocol. + +Signed-off-by: Marius Vlad <marius.vlad@collabora.com> +--- + include/libweston/weston-log.h | 10 ++++ + libweston/weston-log.c | 63 +++++++++++++++++++++++ + tests/iterate-debug-scopes-test.c | 84 +++++++++++++++++++++++++++++++ + tests/meson.build | 6 +++ + 4 files changed, 163 insertions(+) + create mode 100644 tests/iterate-debug-scopes-test.c + +diff --git a/include/libweston/weston-log.h b/include/libweston/weston-log.h +index aeb7768b..70f41675 100644 +--- a/include/libweston/weston-log.h ++++ b/include/libweston/weston-log.h +@@ -134,6 +134,16 @@ weston_log_subscription_iterate(struct weston_log_scope *scope, + void + weston_log_flight_recorder_display_buffer(FILE *file); + ++const char * ++weston_log_scope_get_description(struct weston_log_scope *scope); ++ ++const char * ++weston_log_scope_get_name(struct weston_log_scope *scope); ++ ++struct weston_log_scope * ++weston_log_scopes_iterate(struct weston_log_context *log_ctx, ++ struct weston_log_scope *nscope); ++ + #ifdef __cplusplus + } + #endif +diff --git a/libweston/weston-log.c b/libweston/weston-log.c +index 276fde26..8b4c78a5 100644 +--- a/libweston/weston-log.c ++++ b/libweston/weston-log.c +@@ -1009,3 +1009,66 @@ weston_log_subscription_iterate(struct weston_log_scope *scope, + + return container_of(node, struct weston_log_subscription, source_link); + } ++ ++/** Iterate over all debug scopes added to a weston_log_context ++ * ++ * @param log_ctx the log context ++ * @param nscope the iterator, use NULL to start from the head of the list ++ * @returns the next log scope from list added to weston_log_ctx ++ * ++ * Note that that \c nscope needs to be NULL-initialized before calling ++ * this function. ++ * ++ * This helper can be used by libweston users to grab all the debug scopes ++ * created. This would be an alternative to using weston-debug private ++ * extension. ++ * ++ */ ++WL_EXPORT struct weston_log_scope * ++weston_log_scopes_iterate(struct weston_log_context *log_ctx, ++ struct weston_log_scope *nscope) ++{ ++ struct wl_list *list; ++ struct wl_list *node; ++ ++ assert(log_ctx); ++ ++ list = &log_ctx->scope_list; ++ ++ if (nscope) { ++ node = nscope->compositor_link.next; ++ } else { ++ node = list->next; ++ } ++ ++ assert(node); ++ assert(!nscope || node != &nscope->compositor_link); ++ ++ if (node == list) ++ return NULL; ++ ++ return container_of(node, struct weston_log_scope, compositor_link); ++} ++ ++/** Helper to retrieve, in human readable form, the name of a log scope ++ * ++ * @param scope the scope in question ++ * @returns the name of the scope as a pointer to a string ++ */ ++WL_EXPORT const char * ++weston_log_scope_get_name(struct weston_log_scope *scope) ++{ ++ return scope->name; ++} ++ ++/** Helper to retreive, in human reable form, the description of a log scope ++ * ++ * @param scope the scope in question ++ * @returns the description of the scope as pointer to a string ++ * ++ */ ++WL_EXPORT const char * ++weston_log_scope_get_description(struct weston_log_scope *scope) ++{ ++ return scope->desc; ++} +diff --git a/tests/iterate-debug-scopes-test.c b/tests/iterate-debug-scopes-test.c +new file mode 100644 +index 00000000..82c6c5c8 +--- /dev/null ++++ b/tests/iterate-debug-scopes-test.c +@@ -0,0 +1,84 @@ ++/* ++ * Copyright 2023 Collabora, Ltd. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining ++ * a copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sublicense, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject to ++ * the following conditions: ++ * ++ * The above copyright notice and this permission notice (including the ++ * next paragraph) shall be included in all copies or substantial ++ * portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS ++ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ++ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ++ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ++ * SOFTWARE. ++ */ ++#include "config.h" ++ ++#include <unistd.h> ++#include <assert.h> ++#include <stdlib.h> ++#include <stdio.h> ++#include <string.h> ++ ++#include <libweston/weston-log.h> ++#include "weston-test-client-helper.h" ++#include "weston-test-fixture-compositor.h" ++ ++ ++static enum test_result_code ++fixture_setup(struct weston_test_harness *harness) ++{ ++ struct compositor_setup setup; ++ ++ compositor_setup_defaults(&setup); ++ setup.shell = SHELL_TEST_DESKTOP; ++ ++ return weston_test_harness_execute_as_plugin(harness, &setup); ++} ++ ++DECLARE_FIXTURE_SETUP(fixture_setup); ++ ++static void ++iterate_debug_scopes(struct weston_compositor *compositor) ++{ ++ struct weston_log_scope *nscope = NULL; ++ const char *test_harness_scope = "test-harness-plugin"; ++ bool found_test_harness_debug_scope = false; ++ struct weston_log_context *log_ctx = compositor->weston_log_ctx; ++ ++ weston_log("Printing available debug scopes:\n"); ++ ++ while ((nscope = weston_log_scopes_iterate(log_ctx, nscope))) { ++ const char *scope_name; ++ const char *desc_name; ++ ++ scope_name = weston_log_scope_get_name(nscope); ++ assert(scope_name); ++ ++ desc_name = weston_log_scope_get_description(nscope); ++ assert(desc_name); ++ ++ weston_log("\tscope name: %s, desc: %s\n", scope_name, desc_name); ++ ++ if (strcmp(test_harness_scope, scope_name) == 0) ++ found_test_harness_debug_scope = true; ++ } ++ weston_log("\n"); ++ ++ assert(found_test_harness_debug_scope); ++} ++ ++PLUGIN_TEST(iterate_default_debug_scopes) ++{ ++ iterate_debug_scopes(compositor); ++} +diff --git a/tests/meson.build b/tests/meson.build +index d8e96e77..e52ff5a6 100644 +--- a/tests/meson.build ++++ b/tests/meson.build +@@ -224,6 +224,12 @@ tests = [ + ], + 'dep_objs': [ dep_lib_desktop ] + }, ++ { 'name': 'iterate-debug-scopes', ++ 'sources': [ ++ 'iterate-debug-scopes-test.c', ++ ], ++ 'dep_objs': [ dep_libweston_public ] ++ }, + ] + + tests_standalone = [ +-- +2.40.1 + diff --git a/meta-agl-core/recipes-graphics/wayland/weston/0001-simple-touch-Add-maximized-fullscreen-states.patch b/meta-agl-core/recipes-graphics/wayland/weston/0001-simple-touch-Add-maximized-fullscreen-states.patch new file mode 100644 index 000000000..53a620ef7 --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/weston/0001-simple-touch-Add-maximized-fullscreen-states.patch @@ -0,0 +1,138 @@ +From 666300564093838c7d6a723fbce7e3b1a719e873 Mon Sep 17 00:00:00 2001 +From: Marius Vlad <marius.vlad@collabora.com> +Date: Thu, 22 Dec 2022 18:27:14 +0200 +Subject: [PATCH 1/3] simple-touch: Add maximized/fullscreen states + +Helpful to have other states like maximized or fullscreen for +the simple-touch client. + +Upstream-Status: Pending + +Signed-off-by: Marius Vlad <marius.vlad@collabora.com> +--- + clients/simple-touch.c | 55 ++++++++++++++++++++++++++++++++++++------ + 1 file changed, 48 insertions(+), 7 deletions(-) + +diff --git a/clients/simple-touch.c b/clients/simple-touch.c +index 6559aa24d..e32013161 100644 +--- a/clients/simple-touch.c ++++ b/clients/simple-touch.c +@@ -64,9 +64,13 @@ struct touch { + struct xdg_toplevel *xdg_toplevel; + struct buffer *buffer; + int width, height; ++ int init_width, init_height; + bool running; + bool wait_for_configure; ++ bool needs_buffer_update; + bool has_argb; ++ bool maximized; ++ bool fullscreen; + }; + + static struct buffer * +@@ -111,7 +115,7 @@ create_shm_buffer(struct touch *touch) + } + + static void +-initial_redraw(void *data) ++redraw(void *data) + { + struct touch *touch = data; + struct buffer *buffer = NULL; +@@ -119,6 +123,9 @@ initial_redraw(void *data) + buffer = create_shm_buffer(touch); + assert(buffer); + ++ if (touch->buffer) ++ free(touch->buffer); ++ + touch->buffer = buffer; + + /* paint the "work-area" */ +@@ -283,9 +290,10 @@ handle_xdg_surface_configure(void *data, struct xdg_surface *surface, + + xdg_surface_ack_configure(surface, serial); + +- if (touch->wait_for_configure) { +- initial_redraw(touch); ++ if (touch->wait_for_configure || touch->needs_buffer_update) { ++ redraw(touch); + touch->wait_for_configure = false; ++ touch->needs_buffer_update = false; + } + } + +@@ -340,9 +348,40 @@ static const struct wl_registry_listener registry_listener = { + + static void + handle_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel, +- int32_t width, int32_t height, +- struct wl_array *state) ++ int32_t width, int32_t height, struct wl_array *states) + { ++ struct touch *touch = data; ++ uint32_t *p; ++ ++ touch->fullscreen = false; ++ touch->maximized = false; ++ ++ wl_array_for_each(p, states) { ++ uint32_t state = *p; ++ switch (state) { ++ case XDG_TOPLEVEL_STATE_FULLSCREEN: ++ touch->fullscreen = true; ++ break; ++ case XDG_TOPLEVEL_STATE_MAXIMIZED: ++ touch->maximized = true; ++ break; ++ } ++ } ++ ++ if (width > 0 && height > 0) { ++ if (!touch->fullscreen && !touch->maximized) { ++ touch->init_width = width; ++ touch->init_width = height; ++ } ++ touch->width = width; ++ touch->height = height; ++ } else if (!touch->fullscreen && !touch->maximized) { ++ touch->width = touch->init_width; ++ touch->height = touch->init_height; ++ ++ } ++ ++ touch->needs_buffer_update = true; + } + + static void +@@ -371,6 +410,7 @@ touch_create(int width, int height) + assert(touch->display); + + touch->has_argb = false; ++ touch->buffer = NULL; + touch->registry = wl_display_get_registry(touch->display); + wl_registry_add_listener(touch->registry, ®istry_listener, touch); + wl_display_dispatch(touch->display); +@@ -386,8 +426,8 @@ touch_create(int width, int height) + exit(1); + } + +- touch->width = width; +- touch->height = height; ++ touch->init_width = width; ++ touch->init_height = height; + touch->surface = wl_compositor_create_surface(touch->compositor); + + touch->xdg_surface = +@@ -403,6 +443,7 @@ touch_create(int width, int height) + xdg_toplevel_set_title(touch->xdg_toplevel, "simple-touch"); + xdg_toplevel_set_app_id(touch->xdg_toplevel, "simple-touch"); + touch->wait_for_configure = true; ++ touch->needs_buffer_update = false; + wl_surface_commit(touch->surface); + + touch->running = true; +-- +2.35.1 + diff --git a/meta-agl-core/recipes-graphics/wayland/weston/0005-correctly-tear-down-drm-backend.patch b/meta-agl-core/recipes-graphics/wayland/weston/0005-correctly-tear-down-drm-backend.patch deleted file mode 100644 index cb122590b..000000000 --- a/meta-agl-core/recipes-graphics/wayland/weston/0005-correctly-tear-down-drm-backend.patch +++ /dev/null @@ -1,37 +0,0 @@ -commit 5130a8c21a9deea54e8f7c96a3a5049e2d60a210 -Author: Marius Vlad <marius.vlad@collabora.com> -Date: Thu Jul 30 14:47:32 2020 +0300 - -backend-drm: Correctly tear down the DRM backend - -It seem that we skipped to put back in TEXT mode the tty, in case a DRM -device node wasn't present at that time, or it isn't present at all. This -orders the destroy part correctly as to handle that case as well. - -As a side effect, as the tty will still be set to GRAPHICS mode we will -require a manual change of the tty number, which might be not possible -on all systems. Properly putting back the tty to TEXT mode should avoid -that, and allows to re-use the same tty no in case the DRM device has -been created at a later point in time. - -Upstream-Status: Backport -Signed-off-by: Marius Vlad <marius.vlad@collabora.com> -Signed-off-by: Scott Murray <scott.murray@konsulko.com> - -diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c -index 980a12da..1cf61a33 100644 ---- a/libweston/backend-drm/drm.c -+++ b/libweston/backend-drm/drm.c -@@ -3031,10 +3031,10 @@ err_sprite: - destroy_sprites(b); - err_udev_dev: - udev_device_unref(drm_device); --err_launcher: -- weston_launcher_destroy(compositor->launcher); - err_udev: - udev_unref(b->udev); -+err_launcher: -+ weston_launcher_destroy(compositor->launcher); - err_compositor: - weston_compositor_shutdown(compositor); - free(b); diff --git a/meta-agl-core/recipes-graphics/wayland/weston_8.0.%.bbappend b/meta-agl-core/recipes-graphics/wayland/weston_10.0.%.bbappend index f627f5cb2..685894116 100644 --- a/meta-agl-core/recipes-graphics/wayland/weston_8.0.%.bbappend +++ b/meta-agl-core/recipes-graphics/wayland/weston_10.0.%.bbappend @@ -1 +1 @@ -require ${@bb.utils.contains('AGL_FEATURES', 'aglcore', 'weston_8.0_aglcore.inc', '', d)} +require ${@bb.utils.contains('AGL_FEATURES', 'aglcore', 'weston_10.0_aglcore.inc', '', d)} diff --git a/meta-agl-core/recipes-graphics/wayland/weston_10.0_aglcore.inc b/meta-agl-core/recipes-graphics/wayland/weston_10.0_aglcore.inc new file mode 100644 index 000000000..a19e0f344 --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/weston_10.0_aglcore.inc @@ -0,0 +1,33 @@ +FILESEXTRAPATHS:append := ":${THISDIR}/weston" + +# Workaround for incorrect upstream definition +PACKAGECONFIG[remoting] = "-Dremoting=true,-Dremoting=false,gstreamer1.0 gstreamer1.0-plugins-base" +PACKAGECONFIG[headless] = "-Dbackend-headless=true" +PACKAGECONFIG:append = "${@bb.utils.contains('DISTRO_FEATURES', 'weston-remoting', ' remoting', '', d)}" + +SRC_URI:append = "file://0001-libweston-Send-name-description-update-wl_output-to-.patch \ + file://0001-libweston-desktop-xdg-shell-Add-tiled-orientation-st.patch \ + file://0001-simple-touch-Add-maximized-fullscreen-states.patch \ + file://0001-backend-drm-make-sure-all-buffers-are-released-when-.patch \ + file://0001-libweston-weston-log-Add-a-iterator-helper-for-debug.patch \ +" + +# Split weston-terminal out of the main package to allow installing it +# separately for use with other compositors. The icons, etc. that end +# up in /usr/share/weston are also split out into a separate package +# since they are required for weston-terminal and some of the programs +# packaged in weston-examples in addition to ivi-shell in the main +# package. + +PACKAGE_BEFORE_PN += "${PN}-data ${PN}-terminal" + +FILES:${PN}-data = "${datadir}/weston" + +FILES:${PN}-terminal = "${bindir}/weston-terminal" +RDEPENDS:${PN}-terminal += "weston-data liberation-fonts" + +RDEPENDS:${PN}-examples += "weston-data" + +FILES:${PN}:remove = "weston-terminal" +RDEPENDS:${PN}:remove = "liberation-fonts" +RDEPENDS:${PN} += "weston-data weston-terminal" diff --git a/meta-agl-core/recipes-graphics/wayland/weston_8.0_aglcore.inc b/meta-agl-core/recipes-graphics/wayland/weston_8.0_aglcore.inc deleted file mode 100644 index 598215e7e..000000000 --- a/meta-agl-core/recipes-graphics/wayland/weston_8.0_aglcore.inc +++ /dev/null @@ -1,15 +0,0 @@ -FILESEXTRAPATHS:append := ":${THISDIR}/weston" - -SRC_URI:append = "\ - file://0005-correctly-tear-down-drm-backend.patch \ - " - -# Workaround for incorrect upstream definition -PACKAGECONFIG[remoting] = "-Dremoting=true,-Dremoting=false,gstreamer1.0 gstreamer1.0-plugins-base" -PACKAGECONFIG[remoting] = "-Dremoting=true,-Dremoting=false,gstreamer1.0 gstreamer1.0-plugins-base" -PACKAGECONFIG[headless] = "-Dbackend-headless=true" -PACKAGECONFIG:append = "${@bb.utils.contains('DISTRO_FEATURES', 'weston-remoting', ' remoting', '', d)}" -PACKAGECONFIG:append = "${@bb.utils.contains('AGL_FEATURES', 'waltham-remoting', ' remoting', '', d)}" - -# seat management is only for waltham-transmitter-plugin -SRC_URI:append = "${@bb.utils.contains('AGL_FEATURES', 'waltham-remoting', 'file://0001-libweston-Migrate-weston_seat_init-release-to-public.patch', '', d)}" diff --git a/meta-agl-core/recipes-kernel/linux/linux-4.14/Smack-Handle-CGROUP2-in-the-same-way-that-CGROUP.patch b/meta-agl-core/recipes-kernel/linux/linux-4.14/Smack-Handle-CGROUP2-in-the-same-way-that-CGROUP.patch deleted file mode 100644 index c595dfdf5..000000000 --- a/meta-agl-core/recipes-kernel/linux/linux-4.14/Smack-Handle-CGROUP2-in-the-same-way-that-CGROUP.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 63f5acdf097b7baca8d0f7056a037f8811b48aaa Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh> -Date: Tue, 27 Feb 2018 17:06:21 +0100 -Subject: [PATCH] Smack: Handle CGROUP2 in the same way that CGROUP -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The new file system CGROUP2 isn't actually handled -by smack. This changes makes Smack treat equally -CGROUP and CGROUP2 items. - -Signed-off-by: José Bollo <jose.bollo@iot.bzh> ---- - security/smack/smack_lsm.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c -index 03fdecba93bb..5d77ed04422c 100644 ---- a/security/smack/smack_lsm.c -+++ b/security/smack/smack_lsm.c -@@ -3431,6 +3431,7 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode) - if (opt_dentry->d_parent == opt_dentry) { - switch (sbp->s_magic) { - case CGROUP_SUPER_MAGIC: -+ case CGROUP2_SUPER_MAGIC: - /* - * The cgroup filesystem is never mounted, - * so there's no opportunity to set the mount -@@ -3474,6 +3475,7 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode) - switch (sbp->s_magic) { - case SMACK_MAGIC: - case CGROUP_SUPER_MAGIC: -+ case CGROUP2_SUPER_MAGIC: - /* - * Casey says that it's a little embarrassing - * that the smack file system doesn't do --- -2.14.3 - diff --git a/meta-agl-core/recipes-kernel/linux/linux-4.14/Smack-Privilege-check-on-key-operations.patch b/meta-agl-core/recipes-kernel/linux/linux-4.14/Smack-Privilege-check-on-key-operations.patch deleted file mode 100644 index 4100bb8fd..000000000 --- a/meta-agl-core/recipes-kernel/linux/linux-4.14/Smack-Privilege-check-on-key-operations.patch +++ /dev/null @@ -1,109 +0,0 @@ -Smack: Privilege check on key operations - -Operations on key objects are subjected to Smack policy -even if the process is privileged. This is inconsistent -with the general behavior of Smack and may cause issues -with authentication by privileged daemons. This patch -allows processes with CAP_MAC_OVERRIDE to access keys -even if the Smack rules indicate otherwise. - -Reported-by: Jose Bollo <jobol@nonadev.net> -Signed-off-by: Casey Schaufler <casey@schaufler-ca.com> ---- - security/smack/smack.h | 1 + - security/smack/smack_access.c | 40 +++++++++++++++++++++++++++++----------- - security/smack/smack_lsm.c | 4 ++++ - 3 files changed, 34 insertions(+), 11 deletions(-) - -diff --git a/security/smack/smack.h b/security/smack/smack.h -index 6a71fc7..f7db791 100644 ---- a/security/smack/smack.h -+++ b/security/smack/smack.h -@@ -321,6 +321,7 @@ struct smack_known *smk_import_entry(const char *, int); - void smk_insert_entry(struct smack_known *skp); - struct smack_known *smk_find_entry(const char *); - bool smack_privileged(int cap); -+bool smack_privileged_cred(int cap, const struct cred *cred); - void smk_destroy_label_list(struct list_head *list); - - /* -diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c -index 1a30041..141ffac 100644 ---- a/security/smack/smack_access.c -+++ b/security/smack/smack_access.c -@@ -623,26 +623,24 @@ struct smack_known *smack_from_secid(const u32 secid) - LIST_HEAD(smack_onlycap_list); - DEFINE_MUTEX(smack_onlycap_lock); - --/* -+/** -+ * smack_privileged_cred - are all privilege requirements met by cred -+ * @cap: The requested capability -+ * @cred: the credential to use -+ * - * Is the task privileged and allowed to be privileged - * by the onlycap rule. - * - * Returns true if the task is allowed to be privileged, false if it's not. - */ --bool smack_privileged(int cap) -+bool smack_privileged_cred(int cap, const struct cred *cred) - { -- struct smack_known *skp = smk_of_current(); -+ struct task_smack *tsp = cred->security; -+ struct smack_known *skp = tsp->smk_task; - struct smack_known_list_elem *sklep; - int rc; - -- /* -- * All kernel tasks are privileged -- */ -- if (unlikely(current->flags & PF_KTHREAD)) -- return true; -- -- rc = cap_capable(current_cred(), &init_user_ns, cap, -- SECURITY_CAP_AUDIT); -+ rc = cap_capable(cred, &init_user_ns, cap, SECURITY_CAP_AUDIT); - if (rc) - return false; - -@@ -662,3 +660,23 @@ bool smack_privileged(int cap) - - return false; - } -+ -+/** -+ * smack_privileged - are all privilege requirements met -+ * @cap: The requested capability -+ * -+ * Is the task privileged and allowed to be privileged -+ * by the onlycap rule. -+ * -+ * Returns true if the task is allowed to be privileged, false if it's not. -+ */ -+bool smack_privileged(int cap) -+{ -+ /* -+ * All kernel tasks are privileged -+ */ -+ if (unlikely(current->flags & PF_KTHREAD)) -+ return true; -+ -+ return smack_privileged_cred(cap, current_cred()); -+} -diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c -index 30f2c3d..03fdecb 100644 ---- a/security/smack/smack_lsm.c -+++ b/security/smack/smack_lsm.c -@@ -4369,6 +4369,10 @@ static int smack_key_permission(key_ref_t key_ref, - */ - if (tkp == NULL) - return -EACCES; -+ -+ if (smack_privileged_cred(CAP_MAC_OVERRIDE, cred)) -+ return 0; -+ - #ifdef CONFIG_AUDIT - smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_KEY); - ad.a.u.key_struct.key = keyp->serial; - diff --git a/meta-agl-core/recipes-kernel/linux/linux-agl-4.14.inc b/meta-agl-core/recipes-kernel/linux/linux-agl-4.14.inc index 8476f343b..9ab3d34af 100644 --- a/meta-agl-core/recipes-kernel/linux/linux-agl-4.14.inc +++ b/meta-agl-core/recipes-kernel/linux/linux-agl-4.14.inc @@ -1,13 +1,5 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/linux-4.14:" -#------------------------------------------------------------------------- -# smack patches for kernels keys - -SRC_URI:append:with-lsm-smack = "\ - file://Smack-Privilege-check-on-key-operations.patch \ - file://Smack-Handle-CGROUP2-in-the-same-way-that-CGROUP.patch \ - " - SRC_URI:append = "\ file://net-sch_generic-add-if_afp.h-header-to-get-ARPHRD_CA.patch \ file://net-sch_generic-Use-pfifo_fast-as-fallback-scheduler.patch \ diff --git a/meta-agl-core/recipes-kernel/linux/linux-agl-config.inc b/meta-agl-core/recipes-kernel/linux/linux-agl-config.inc index a5e9c375a..e42ae823d 100644 --- a/meta-agl-core/recipes-kernel/linux/linux-agl-config.inc +++ b/meta-agl-core/recipes-kernel/linux/linux-agl-config.inc @@ -39,6 +39,10 @@ AGL_KCONFIG_FRAGMENTS += " \ can-bus.cfg \ fanotify.cfg \ overlayfs.cfg \ + audit.cfg \ + ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux.cfg', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-required.cfg', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-sandbox.cfg', '', d)} \ " AGL_KCONFIG_FRAGMENTS += " ${@bb.utils.contains('AGL_XEN_GUEST_WANTED','1','xen_domu.cfg','',d)}" @@ -66,6 +70,10 @@ AGL_KCONFIG_FRAGMENTS:append:qemuall = " \ qemu-drm.cfg \ " +AGL_KCONFIG_FRAGMENTS:append:virtio-all = " \ + sound-hda.cfg \ +" + # Configuration for using the ARM virt machine (and not versatilepb) AGL_KCONFIG_FRAGMENTS:append:qemuarm = " qemuarm.cfg" @@ -73,7 +81,7 @@ AGL_KCONFIG_FRAGMENTS:append:qemuarm = " qemuarm.cfg" # OVERRIDES save us some c'n'p below ... OVERRIDES:prepend:qemux86 = "virtualmachine:" OVERRIDES:prepend:qemux86-64 = "virtualmachine:" -AGL_KCONFIG_FRAGMENTS:append_virtualmachine = " vbox-vmware-sata.cfg" +AGL_KCONFIG_FRAGMENTS:append:virtualmachine = " vbox-vmware-sata.cfg" # Extra configuration for using qemux86-64 image on physical hardware AGL_KCONFIG_FRAGMENTS:append:qemux86-64 = " \ diff --git a/meta-agl-core/recipes-kernel/linux/linux/audit.cfg b/meta-agl-core/recipes-kernel/linux/linux/audit.cfg new file mode 100644 index 000000000..7decc799c --- /dev/null +++ b/meta-agl-core/recipes-kernel/linux/linux/audit.cfg @@ -0,0 +1,2 @@ +CONFIG_AUDIT=y +CONFIG_AUDIT_GENERIC=y diff --git a/meta-agl-core/recipes-kernel/linux/linux/selinux.cfg b/meta-agl-core/recipes-kernel/linux/linux/selinux.cfg new file mode 100644 index 000000000..5998111e3 --- /dev/null +++ b/meta-agl-core/recipes-kernel/linux/linux/selinux.cfg @@ -0,0 +1,16 @@ +CONFIG_NETWORK_SECMARK=y +CONFIG_EXT2_FS_SECURITY=y +CONFIG_EXT3_FS_SECURITY=y +CONFIG_EXT4_FS_SECURITY=y +CONFIG_JFS_SECURITY=y +CONFIG_REISERFS_FS_SECURITY=y +CONFIG_JFFS2_FS_SECURITY=y +CONFIG_SECURITY=y +CONFIG_SECURITYFS=y +CONFIG_SECURITY_NETWORK=y +CONFIG_SECURITY_SELINUX=y +CONFIG_SECURITY_SELINUX_BOOTPARAM=y +CONFIG_SECURITY_SELINUX_DISABLE=y +CONFIG_SECURITY_SELINUX_DEVELOP=y +CONFIG_SECURITY_SELINUX_AVC_STATS=y +CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=1 diff --git a/meta-agl-core/recipes-kernel/linux/linux/systemd-required.cfg b/meta-agl-core/recipes-kernel/linux/linux/systemd-required.cfg new file mode 100644 index 000000000..3586a17bb --- /dev/null +++ b/meta-agl-core/recipes-kernel/linux/linux/systemd-required.cfg @@ -0,0 +1,43 @@ +CONFIG_TMPFS=y +CONFIG_TMPFS_XATTR=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_AUTOFS_FS=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_BLK_DEV_BSG=y +CONFIG_BLK_CGROUP=y +CONFIG_CGROUPS=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CGROUP_FREEZER=y +CONFIG_CGROUP_PERF=y +CONFIG_CGROUP_PIDS=y +CONFIG_CGROUP_SCHED=y +CONFIG_RT_GROUP_SCHED=n +CONFIG_SCHED_DEBUG=y +CONFIG_SCHEDSTATS=y +CONFIG_FAIR_GROUP_SCHED=y +CONFIG_INOTIFY_USER=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EPOLL=y +CONFIG_NET=y +CONFIG_UNIX=y +CONFIG_PROC_FS=y +CONFIG_SYSFS=y +CONFIG_SYSFS_DEPRECATED=n +CONFIG_FHANDLE=y +CONFIG_CRYPTO_USER_API_HASH=y +CONFIG_CRYPTO_HMAC=y +CONFIG_CRYPTO_SHA256=y +CONFIG_UEVENT_HELPER_PATH="" +CONFIG_FW_LOADER_USER_HELPER=n +CONFIG_DMIID=y +CONFIG_NAMESPACES=y +CONFIG_NET_NS=y +CONFIG_USER_NS=y +CONFIG_SECCOMP=y +CONFIG_SECCOMP_FILTER=y +CONFIG_CHECKPOINT_RESTORE=y +CONFIG_CFS_BANDWIDTH=y diff --git a/meta-agl-core/recipes-kernel/linux/linux/systemd-sandbox.cfg b/meta-agl-core/recipes-kernel/linux/linux/systemd-sandbox.cfg new file mode 100644 index 000000000..d451d554c --- /dev/null +++ b/meta-agl-core/recipes-kernel/linux/linux/systemd-sandbox.cfg @@ -0,0 +1,9 @@ +CONFIG_BPF=y +CONFIG_BPF_SYSCALL=y +CONFIG_NET_CLS_BPF=m +CONFIG_NET_ACT_BPF=m +CONFIG_BPF_JIT=y +CONFIG_HAVE_EBPF_JIT=y +CONFIG_BPF_EVENTS=y +CONFIG_BPF_LSM=y +CONFIG_CGROUP_BPF=y diff --git a/meta-agl-core/recipes-kernel/linux/linux/x86-extra-graphic-devices.cfg b/meta-agl-core/recipes-kernel/linux/linux/x86-extra-graphic-devices.cfg index d2b64de67..e7d99e5ac 100644 --- a/meta-agl-core/recipes-kernel/linux/linux/x86-extra-graphic-devices.cfg +++ b/meta-agl-core/recipes-kernel/linux/linux/x86-extra-graphic-devices.cfg @@ -11,11 +11,9 @@ CONFIG_NOUVEAU_DEBUG=5 CONFIG_NOUVEAU_DEBUG_DEFAULT=3 CONFIG_DRM_NOUVEAU_BACKLIGHT=y CONFIG_DRM_VGEM=m -CONFIG_DRM_VMWGFX=m +CONFIG_DRM_VMWGFX=y CONFIG_DRM_VMWGFX_FBCON=y CONFIG_DRM_GMA500=m -CONFIG_DRM_GMA600=y -CONFIG_DRM_GMA3600=y CONFIG_DRM_UDL=m CONFIG_FB_DEFERRED_IO=y CONFIG_FB_BACKLIGHT=y diff --git a/meta-agl-core/recipes-multimedia/gstreamer1.0-plugins-bad/files/0001-Added-appid-and-title-support.patch b/meta-agl-core/recipes-multimedia/gstreamer1.0-plugins-bad/files/0001-Added-appid-and-title-support.patch new file mode 100644 index 000000000..f4139ff2c --- /dev/null +++ b/meta-agl-core/recipes-multimedia/gstreamer1.0-plugins-bad/files/0001-Added-appid-and-title-support.patch @@ -0,0 +1,166 @@ +From 2de455486403a710cb6896b0052b4cd7e46d83a2 Mon Sep 17 00:00:00 2001 +From: Marius Vlad <marius.vlad@collabora.com> +Date: Thu, 10 Aug 2023 14:20:48 +0300 +Subject: [PATCH] ext/wayland: Add title/appid support + +Bug-AGL: SPEC-4870 +Signed-off-by: Marius Vlad <marius.vlad@collabora.com> +--- + ext/wayland/gstwaylandsink.c | 43 ++++++++++++++++++++++++++++++++++-- + ext/wayland/gstwaylandsink.h | 2 ++ + ext/wayland/wlwindow.c | 10 ++++++++- + ext/wayland/wlwindow.h | 2 +- + 4 files changed, 53 insertions(+), 4 deletions(-) + +diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c +index 0761304..8913ee2 100644 +--- a/ext/wayland/gstwaylandsink.c ++++ b/ext/wayland/gstwaylandsink.c +@@ -63,7 +63,9 @@ enum + { + PROP_0, + PROP_DISPLAY, +- PROP_FULLSCREEN ++ PROP_FULLSCREEN, ++ PROP_APP_ID, ++ PROP_TITLE + }; + + GST_DEBUG_CATEGORY (gstwayland_debug); +@@ -212,6 +214,16 @@ gst_wayland_sink_class_init (GstWaylandSinkClass * klass) + "Whether the surface should be made fullscreen ", FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + ++ g_object_class_install_property (gobject_class, PROP_APP_ID, ++ g_param_spec_string ("appid", "Top-level application id", "Wayland " ++ "appid, as xdg_shell::set_app_id", ++ NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); ++ ++ g_object_class_install_property (gobject_class, PROP_TITLE, ++ g_param_spec_string ("title", "Top-level title", "Wayland " ++ "title, xdg_shell::set_title", ++ NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); ++ + gst_type_mark_as_plugin_api (GST_TYPE_WAYLAND_VIDEO, 0); + } + +@@ -246,6 +258,16 @@ gst_wayland_sink_get_property (GObject * object, + g_value_set_string (value, sink->display_name); + GST_OBJECT_UNLOCK (sink); + break; ++ case PROP_APP_ID: ++ GST_OBJECT_LOCK (sink); ++ g_value_set_string (value, sink->app_id); ++ GST_OBJECT_UNLOCK (sink); ++ break; ++ case PROP_TITLE: ++ GST_OBJECT_LOCK (sink); ++ g_value_set_string (value, sink->title); ++ GST_OBJECT_UNLOCK (sink); ++ break; + case PROP_FULLSCREEN: + GST_OBJECT_LOCK (sink); + g_value_set_boolean (value, sink->fullscreen); +@@ -269,6 +291,16 @@ gst_wayland_sink_set_property (GObject * object, + sink->display_name = g_value_dup_string (value); + GST_OBJECT_UNLOCK (sink); + break; ++ case PROP_APP_ID: ++ GST_OBJECT_LOCK (sink); ++ sink->app_id = g_value_dup_string (value); ++ GST_OBJECT_UNLOCK (sink); ++ break; ++ case PROP_TITLE: ++ GST_OBJECT_LOCK (sink); ++ sink->title = g_value_dup_string (value); ++ GST_OBJECT_UNLOCK (sink); ++ break; + case PROP_FULLSCREEN: + GST_OBJECT_LOCK (sink); + gst_wayland_sink_set_fullscreen (sink, g_value_get_boolean (value)); +@@ -291,12 +323,18 @@ gst_wayland_sink_finalize (GObject * object) + gst_buffer_unref (sink->last_buffer); + if (sink->display) + g_object_unref (sink->display); ++ if (sink->title) ++ g_object_unref (sink->title); ++ if (sink->app_id) ++ g_object_unref (sink->app_id); + if (sink->window) + g_object_unref (sink->window); + if (sink->pool) + gst_object_unref (sink->pool); + + g_free (sink->display_name); ++ g_free (sink->title); ++ g_free (sink->app_id); + + g_mutex_clear (&sink->display_lock); + g_mutex_clear (&sink->render_lock); +@@ -718,7 +756,8 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer) + if (!sink->window) { + /* if we were not provided a window, create one ourselves */ + sink->window = gst_wl_window_new_toplevel (sink->display, +- &sink->video_info, sink->fullscreen, &sink->render_lock); ++ &sink->video_info, sink->fullscreen, sink->app_id, sink->title, ++ &sink->render_lock); + g_signal_connect_object (sink->window, "closed", + G_CALLBACK (on_window_closed), sink, 0); + } +diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h +index 7aabb6f..4db00e5 100644 +--- a/ext/wayland/gstwaylandsink.h ++++ b/ext/wayland/gstwaylandsink.h +@@ -63,6 +63,8 @@ struct _GstWaylandSink + gboolean fullscreen; + + gchar *display_name; ++ gchar *app_id; ++ gchar *title; + + gboolean redraw_pending; + GMutex render_lock; +diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c +index 66df0fc..ad2d3f3 100644 +--- a/ext/wayland/wlwindow.c ++++ b/ext/wayland/wlwindow.c +@@ -254,7 +254,7 @@ gst_wl_window_ensure_fullscreen (GstWlWindow * window, gboolean fullscreen) + + GstWlWindow * + gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info, +- gboolean fullscreen, GMutex * render_lock) ++ gboolean fullscreen, gchar *app_id, gchar *title, GMutex * render_lock) + { + GstWlWindow *window; + +@@ -287,6 +287,14 @@ gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info, + + /* Finally, commit the xdg_surface state as toplevel */ + window->configured = FALSE; ++ if (app_id) ++ xdg_toplevel_set_app_id (window->xdg_toplevel, app_id); ++ else ++ xdg_toplevel_set_app_id (window->xdg_toplevel, "ext.wayland.waylandsink"); ++ if (title) ++ xdg_toplevel_set_title (window->xdg_toplevel, title); ++ else ++ xdg_toplevel_set_title (window->xdg_toplevel, "ext.wayland.waylandsink"); + wl_surface_commit (window->area_surface); + wl_display_flush (display->display); + +diff --git a/ext/wayland/wlwindow.h b/ext/wayland/wlwindow.h +index 303c336..64399b3 100644 +--- a/ext/wayland/wlwindow.h ++++ b/ext/wayland/wlwindow.h +@@ -83,7 +83,7 @@ GType gst_wl_window_get_type (void); + void gst_wl_window_ensure_fullscreen (GstWlWindow * window, + gboolean fullscreen); + GstWlWindow *gst_wl_window_new_toplevel (GstWlDisplay * display, +- const GstVideoInfo * info, gboolean fullscreen, GMutex * render_lock); ++ const GstVideoInfo * info, gboolean fullscreen, gchar * app_id, gchar *title, GMutex * render_lock); + GstWlWindow *gst_wl_window_new_in_surface (GstWlDisplay * display, + struct wl_surface * parent, GMutex * render_lock); + +-- +2.35.1 + diff --git a/meta-agl-core/recipes-multimedia/gstreamer1.0-plugins-bad/files/rcar-gen3/0001-Added-appid-and-title-support.patch b/meta-agl-core/recipes-multimedia/gstreamer1.0-plugins-bad/files/rcar-gen3/0001-Added-appid-and-title-support.patch new file mode 100644 index 000000000..72b924337 --- /dev/null +++ b/meta-agl-core/recipes-multimedia/gstreamer1.0-plugins-bad/files/rcar-gen3/0001-Added-appid-and-title-support.patch @@ -0,0 +1,166 @@ +From df64f7e34d01a03957d78317ef9a1cf6d6b95055 Mon Sep 17 00:00:00 2001 +From: Marius Vlad <marius.vlad@collabora.com> +Date: Wed, 9 Aug 2023 14:34:19 +0300 +Subject: [PATCH] Added appid and title support + +Bug-AGL: SPEC-4870 +Signed-off-by: Marius Vlad <marius.vlad@collabora.com> +--- + ext/wayland/gstwaylandsink.c | 43 ++++++++++++++++++++++++++++++++++-- + ext/wayland/gstwaylandsink.h | 2 ++ + ext/wayland/wlwindow.c | 10 ++++++++- + ext/wayland/wlwindow.h | 2 +- + 4 files changed, 53 insertions(+), 4 deletions(-) + +diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c +index 4918154..f743cf2 100644 +--- a/ext/wayland/gstwaylandsink.c ++++ b/ext/wayland/gstwaylandsink.c +@@ -66,7 +66,9 @@ enum + PROP_DISPLAY, + PROP_FULLSCREEN, + PROP_USE_SUBSURFACE, +- PROP_SUPPRESS_INTERLACE ++ PROP_SUPPRESS_INTERLACE, ++ PROP_APP_ID, ++ PROP_TITLE + }; + + #define DEFAULT_USE_SUBSURFACE TRUE +@@ -229,6 +231,16 @@ gst_wayland_sink_class_init (GstWaylandSinkClass * klass) + DEFAULT_SUPPRESS_INTERLACE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + ++ g_object_class_install_property (gobject_class, PROP_APP_ID, ++ g_param_spec_string ("appid", "Top-level application id", "Wayland " ++ "appid, as xdg_shell::set_app_id", ++ NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); ++ ++ g_object_class_install_property (gobject_class, PROP_TITLE, ++ g_param_spec_string ("title", "Top-level title", "Wayland " ++ "title, xdg_shell::set_title", ++ NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); ++ + gst_type_mark_as_plugin_api (GST_TYPE_WAYLAND_VIDEO, 0); + } + +@@ -266,6 +278,16 @@ gst_wayland_sink_get_property (GObject * object, + g_value_set_string (value, sink->display_name); + GST_OBJECT_UNLOCK (sink); + break; ++ case PROP_APP_ID: ++ GST_OBJECT_LOCK (sink); ++ g_value_set_string (value, sink->app_id); ++ GST_OBJECT_UNLOCK (sink); ++ break; ++ case PROP_TITLE: ++ GST_OBJECT_LOCK (sink); ++ g_value_set_string (value, sink->title); ++ GST_OBJECT_UNLOCK (sink); ++ break; + case PROP_FULLSCREEN: + GST_OBJECT_LOCK (sink); + g_value_set_boolean (value, sink->fullscreen); +@@ -298,6 +320,16 @@ gst_wayland_sink_set_property (GObject * object, + sink->display_name = g_value_dup_string (value); + GST_OBJECT_UNLOCK (sink); + break; ++ case PROP_APP_ID: ++ GST_OBJECT_LOCK (sink); ++ sink->app_id = g_value_dup_string (value); ++ GST_OBJECT_UNLOCK (sink); ++ break; ++ case PROP_TITLE: ++ GST_OBJECT_LOCK (sink); ++ sink->title = g_value_dup_string (value); ++ GST_OBJECT_UNLOCK (sink); ++ break; + case PROP_FULLSCREEN: + GST_OBJECT_LOCK (sink); + gst_wayland_sink_set_fullscreen (sink, g_value_get_boolean (value)); +@@ -331,12 +363,18 @@ gst_wayland_sink_finalize (GObject * object) + gst_buffer_unref (sink->last_buffer); + if (sink->display) + g_object_unref (sink->display); ++ if (sink->title) ++ g_object_unref (sink->title); ++ if (sink->app_id) ++ g_object_unref (sink->app_id); + if (sink->window) + g_object_unref (sink->window); + if (sink->pool) + gst_object_unref (sink->pool); + + g_free (sink->display_name); ++ g_free (sink->title); ++ g_free (sink->app_id); + + g_mutex_clear (&sink->display_lock); + g_mutex_clear (&sink->render_lock); +@@ -768,7 +806,8 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer) + if (!sink->window) { + /* if we were not provided a window, create one ourselves */ + sink->window = gst_wl_window_new_toplevel (sink->display, +- &sink->video_info, sink->fullscreen, &sink->render_lock); ++ &sink->video_info, sink->fullscreen, sink->app_id, sink->title, ++ &sink->render_lock); + g_signal_connect_object (sink->window, "closed", + G_CALLBACK (on_window_closed), sink, 0); + } +diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h +index 46ea538..e6c94ae 100644 +--- a/ext/wayland/gstwaylandsink.h ++++ b/ext/wayland/gstwaylandsink.h +@@ -64,6 +64,8 @@ struct _GstWaylandSink + gboolean fullscreen; + + gchar *display_name; ++ gchar *app_id; ++ gchar *title; + + gboolean redraw_pending; + GMutex render_lock; +diff --git a/ext/wayland/wlwindow.c b/ext/wayland/wlwindow.c +index 3aace87..16faec8 100644 +--- a/ext/wayland/wlwindow.c ++++ b/ext/wayland/wlwindow.c +@@ -255,7 +255,7 @@ gst_wl_window_ensure_fullscreen (GstWlWindow * window, gboolean fullscreen) + + GstWlWindow * + gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info, +- gboolean fullscreen, GMutex * render_lock) ++ gboolean fullscreen, gchar *app_id, gchar *title, GMutex * render_lock) + { + GstWlWindow *window; + +@@ -288,6 +288,14 @@ gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info, + + /* Finally, commit the xdg_surface state as toplevel */ + window->configured = FALSE; ++ if (app_id) ++ xdg_toplevel_set_app_id (window->xdg_toplevel, app_id); ++ else ++ xdg_toplevel_set_app_id (window->xdg_toplevel, "ext.wayland.waylandsink"); ++ if (title) ++ xdg_toplevel_set_title (window->xdg_toplevel, title); ++ else ++ xdg_toplevel_set_title (window->xdg_toplevel, "ext.wayland.waylandsink"); + wl_surface_commit (window->area_surface); + wl_display_flush (display->display); + +diff --git a/ext/wayland/wlwindow.h b/ext/wayland/wlwindow.h +index 034a5a5..6b525c8 100644 +--- a/ext/wayland/wlwindow.h ++++ b/ext/wayland/wlwindow.h +@@ -84,7 +84,7 @@ GType gst_wl_window_get_type (void); + void gst_wl_window_ensure_fullscreen (GstWlWindow * window, + gboolean fullscreen); + GstWlWindow *gst_wl_window_new_toplevel (GstWlDisplay * display, +- const GstVideoInfo * info, gboolean fullscreen, GMutex * render_lock); ++ const GstVideoInfo * info, gboolean fullscreen, gchar * app_id, gchar *title, GMutex * render_lock); + GstWlWindow *gst_wl_window_new_in_surface (GstWlDisplay * display, + struct wl_surface * parent, GMutex * render_lock); + +-- +2.35.1 + diff --git a/meta-agl-core/recipes-multimedia/gstreamer1.0-plugins-bad/gstreamer1.0-plugins-bad_%.bbappend b/meta-agl-core/recipes-multimedia/gstreamer1.0-plugins-bad/gstreamer1.0-plugins-bad_%.bbappend new file mode 100644 index 000000000..96bbdc34b --- /dev/null +++ b/meta-agl-core/recipes-multimedia/gstreamer1.0-plugins-bad/gstreamer1.0-plugins-bad_%.bbappend @@ -0,0 +1 @@ +require ${@bb.utils.contains('AGL_FEATURES', 'aglcore', 'gstreamer1.0-plugins-bad_aglcore.inc', '', d)} diff --git a/meta-agl-core/recipes-multimedia/gstreamer1.0-plugins-bad/gstreamer1.0-plugins-bad_aglcore.inc b/meta-agl-core/recipes-multimedia/gstreamer1.0-plugins-bad/gstreamer1.0-plugins-bad_aglcore.inc new file mode 100644 index 000000000..97a0c1688 --- /dev/null +++ b/meta-agl-core/recipes-multimedia/gstreamer1.0-plugins-bad/gstreamer1.0-plugins-bad_aglcore.inc @@ -0,0 +1,9 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +AGL_PATCHES = "file://0001-Added-appid-and-title-support.patch" + +# Above patch fails to apply against NXP's forked version, disable +# for now +AGL_PATCHES:use-nxp-bsp = "" + +SRC_URI:append = " ${AGL_PATCHES}" diff --git a/meta-agl-core/recipes-platform/images/agl-image-boot.bb b/meta-agl-core/recipes-platform/images/agl-image-boot.bb index 6e2b89324..dde6a18db 100644 --- a/meta-agl-core/recipes-platform/images/agl-image-boot.bb +++ b/meta-agl-core/recipes-platform/images/agl-image-boot.bb @@ -1,9 +1,5 @@ -SUMMARY = "An AGL small image just capable of allowing a device to boot." - -require agl-image-boot.inc - +SUMMARY = "A small image just capable of allowing a device to boot." LICENSE = "MIT" -IMAGE_INSTALL:append = "\ - packagegroup-agl-image-boot \ - " +inherit agl-core-image + diff --git a/meta-agl-core/recipes-platform/images/agl-image-boot.inc b/meta-agl-core/recipes-platform/images/agl-image-boot.inc deleted file mode 100644 index 60d671bca..000000000 --- a/meta-agl-core/recipes-platform/images/agl-image-boot.inc +++ /dev/null @@ -1,7 +0,0 @@ -IMAGE_LINGUAS = " " - -inherit core-image - -IMAGE_INSTALL = "packagegroup-agl-core-boot ${CORE_IMAGE_EXTRA_INSTALL}" - -IMAGE_ROOTFS_SIZE ?= "8192" diff --git a/meta-agl-core/recipes-platform/images/agl-image-compositor.bb b/meta-agl-core/recipes-platform/images/agl-image-compositor.bb new file mode 100644 index 000000000..b78536be8 --- /dev/null +++ b/meta-agl-core/recipes-platform/images/agl-image-compositor.bb @@ -0,0 +1,15 @@ +SUMMARY = "A very basic Wayland image with agl-compositor" +LICENSE = "MIT" + +require agl-image-minimal.bb + +inherit features_check + +REQUIRED_DISTRO_FEATURES = "wayland" + +SYSTEMD_DEFAULT_TARGET = "graphical.target" + +IMAGE_INSTALL += " \ + packagegroup-agl-graphical-compositor \ + ${@bb.utils.contains('DISTRO_FEATURES', 'agl-devel', 'weston-examples', '', d)} \ +" diff --git a/meta-agl-core/recipes-platform/images/agl-image-core-autobuilder.bb b/meta-agl-core/recipes-platform/images/agl-image-core-autobuilder.bb index 3a887a5c0..eec1cf54c 100644 --- a/meta-agl-core/recipes-platform/images/agl-image-core-autobuilder.bb +++ b/meta-agl-core/recipes-platform/images/agl-image-core-autobuilder.bb @@ -1,16 +1,14 @@ SUMMARY = "A very basic Wayland image with a terminal" +LICENSE = "MIT" -require agl-image-weston.inc +require agl-image-weston.bb -LICENSE = "MIT" +IMAGE_FEATURES += "splash" -IMAGE_INSTALL:append = "\ - packagegroup-agl-profile-graphical \ +IMAGE_INSTALL += " \ busybox \ - psplash \ gdb \ gperf \ - weston \ weston-examples \ curl \ ptest-runner \ diff --git a/meta-agl-core/recipes-platform/images/agl-image-minimal-crosssdk.bb b/meta-agl-core/recipes-platform/images/agl-image-minimal-crosssdk.bb index 8c5aae1bf..6aa308273 100644 --- a/meta-agl-core/recipes-platform/images/agl-image-minimal-crosssdk.bb +++ b/meta-agl-core/recipes-platform/images/agl-image-minimal-crosssdk.bb @@ -1,18 +1,9 @@ -SUMMARY = "Cross SDK of Full AGL Distribution for core profile" - -DESCRIPTION = "SDK image for full AGL Distribution for IVI profile. \ -It includes the full meta-toolchain, plus developement headers and libraries \ -to form a standalone cross SDK." - require agl-image-minimal.bb +SUMMARY = "Cross SDK of minimal AGL Distribution for core profile" +DESCRIPTION = "SDK image for AGL core distribution. \ +It includes the full toolchain, plus developement headers and libraries \ +to form a standalone cross SDK." LICENSE = "MIT" -require agl-image-minimal-crosssdk.inc - -inherit populate_sdk - -# Task do_populate_sdk and do_rootfs can't be exec simultaneously. -# Both exec "createrepo" on the same directory, and so one of them -# can failed (randomly). -addtask do_populate_sdk after do_rootfs +inherit agl-crosssdk diff --git a/meta-agl-core/recipes-platform/images/agl-image-minimal-crosssdk.inc b/meta-agl-core/recipes-platform/images/agl-image-minimal-crosssdk.inc deleted file mode 100644 index 8695d8d4b..000000000 --- a/meta-agl-core/recipes-platform/images/agl-image-minimal-crosssdk.inc +++ /dev/null @@ -1,24 +0,0 @@ -IMAGE_FEATURES:append = " dev-pkgs" -IMAGE_INSTALL:append = " kernel-dev kernel-devsrc" - - - - - - -# FIXME: -# Always include the test widgets -#IMAGE_FEATURES:append = " agl-test-wgt" -# -# Required dependencies for app and test builds -#TOOLCHAIN_HOST_TASK += " \ -# nativesdk-lua \ -# " -# -# Required dependencies for app and test builds -#TOOLCHAIN_TARGET_TASK += " \ -# lua-dev \ -# lua-staticdev \ -# libafb-helpers-staticdev \ -# libappcontroller-staticdev \ -# " diff --git a/meta-agl-core/recipes-platform/images/agl-image-minimal.bb b/meta-agl-core/recipes-platform/images/agl-image-minimal.bb index 52cc06aeb..4e54e93ed 100644 --- a/meta-agl-core/recipes-platform/images/agl-image-minimal.bb +++ b/meta-agl-core/recipes-platform/images/agl-image-minimal.bb @@ -1,9 +1,9 @@ SUMMARY = "An AGL small image just capable of allowing a device to boot." +LICENSE = "MIT" -require agl-image-minimal.inc +inherit agl-core-image -LICENSE = "MIT" +IMAGE_INSTALL = "packagegroup-agl-image-minimal ${CORE_IMAGE_EXTRA_INSTALL}" -IMAGE_INSTALL:append = "\ - packagegroup-agl-image-minimal \ - " +IMAGE_ROOTFS_SIZE ?= "8192" +IMAGE_ROOTFS_EXTRA_SPACE:append = "${@bb.utils.contains("DISTRO_FEATURES", "systemd", " + 4096", "", d)}" diff --git a/meta-agl-core/recipes-platform/images/agl-image-minimal.inc b/meta-agl-core/recipes-platform/images/agl-image-minimal.inc deleted file mode 100644 index 50b6336de..000000000 --- a/meta-agl-core/recipes-platform/images/agl-image-minimal.inc +++ /dev/null @@ -1 +0,0 @@ -require agl-image-boot.inc diff --git a/meta-agl-core/recipes-platform/images/agl-image-weston.bb b/meta-agl-core/recipes-platform/images/agl-image-weston.bb index 7e9f8814e..d902020cc 100644 --- a/meta-agl-core/recipes-platform/images/agl-image-weston.bb +++ b/meta-agl-core/recipes-platform/images/agl-image-weston.bb @@ -1,9 +1,15 @@ SUMMARY = "A very basic Wayland image with a terminal" +LICENSE = "MIT" -require agl-image-weston.inc +require agl-image-minimal.bb -LICENSE = "MIT" +inherit features_check + +REQUIRED_DISTRO_FEATURES = "wayland" + +SYSTEMD_DEFAULT_TARGET = "graphical.target" -IMAGE_INSTALL:append = "\ - packagegroup-agl-profile-graphical \ - " +IMAGE_INSTALL += " \ + packagegroup-agl-graphical-weston \ + ${@bb.utils.contains('DISTRO_FEATURES', 'agl-devel', 'weston-examples', '', d)} \ +" diff --git a/meta-agl-core/recipes-platform/images/agl-image-weston.inc b/meta-agl-core/recipes-platform/images/agl-image-weston.inc deleted file mode 100644 index cef3bf64e..000000000 --- a/meta-agl-core/recipes-platform/images/agl-image-weston.inc +++ /dev/null @@ -1,7 +0,0 @@ -require recipes-platform/images/agl-image-minimal.inc - -IMAGE_FEATURES += "splash package-management ssh-server-dropbear" - -inherit features_check - -REQUIRED_DISTRO_FEATURES = "wayland" diff --git a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-boot.bb b/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-boot.bb index fe1ee7b8c..28a734548 100644 --- a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-boot.bb +++ b/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-boot.bb @@ -16,6 +16,7 @@ VIRTUAL-RUNTIME_rngd ?= "rng-tools" RDEPENDS:${PN} = "\ packagegroup-core-boot \ + packagegroup-machine-base \ ${VIRTUAL-RUNTIME_rngd} \ " diff --git a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-connectivity.bb b/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-connectivity.bb index 5dd274026..aeee0f8d3 100644 --- a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-connectivity.bb +++ b/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-connectivity.bb @@ -12,7 +12,8 @@ ALLOW_EMPTY:${PN} = "1" PKGGROUP_ZEROCONF = "${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'packagegroup-base-zeroconf', '', d)}" RDEPENDS:${PN} += "\ - ${@bb.utils.contains('VIRTUAL-RUNTIME_net_manager','connman','connman connman-client connman-tests \ - connman-tools connman-ncurses' ,'',d)} \ + ${@bb.utils.contains('VIRTUAL-RUNTIME_net_manager','connman','connman connman-client connman-conf \ + connman-wait-online connman-tests connman-tools connman-ncurses' ,'',d)} \ ${@bb.utils.contains('AGL_FEATURES', 'agl-devel', '${PKGGROUP_ZEROCONF}', '', d)} \ + systemd-conf-canbus \ " diff --git a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-devel.bb b/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-devel.bb index f3e2a9eff..887604ec3 100644 --- a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-devel.bb +++ b/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-devel.bb @@ -10,20 +10,14 @@ RDEPENDS:${PN} = "\ vim \ lsof \ gdb \ - valgrind \ screen \ usbutils \ rsync \ pstree \ procps \ libxslt-bin \ - gcc-sanitizers \ pciutils \ - " + openssh-sftp-server \ + zstd \ +" -# needs meta-oe present -#RRECOMMENDS:${PN} = "\ -# jq \ -# htop \ -# tree \ -#" diff --git a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-os-commonlibs.bb b/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-os-commonlibs.bb deleted file mode 100644 index 0ee63e82a..000000000 --- a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-os-commonlibs.bb +++ /dev/null @@ -1,14 +0,0 @@ -SUMMARY = "The packages of middlewares for AGL IVI profile" -DESCRIPTION = "The set of packages required by Operating System and Common libraries Subsystem" -LICENSE = "MIT" - -inherit packagegroup - -PACKAGES = "\ - packagegroup-agl-core-os-commonlibs \ - " - -ALLOW_EMPTY:${PN} = "1" - -RDEPENDS:${PN} += "\ - " diff --git a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-security.bb b/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-security.bb deleted file mode 100644 index 7532f4cd7..000000000 --- a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-security.bb +++ /dev/null @@ -1,14 +0,0 @@ -SUMMARY = "The packages of middlewares for AGL IVI profile" -DESCRIPTION = "The set of packages required by Operating System and Common libraries Subsystem" -LICENSE = "MIT" - -inherit packagegroup - -PACKAGES = "\ - packagegroup-agl-core-security \ - " - -ALLOW_EMPTY:${PN} = "1" - -RDEPENDS:${PN} += "\ - " diff --git a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-graphical-compositor.bb b/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-graphical-compositor.bb new file mode 100644 index 000000000..b2c7d8ec8 --- /dev/null +++ b/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-graphical-compositor.bb @@ -0,0 +1,9 @@ +DESCRIPTION = "The minimal set of packages required for the AGL compositor" +LICENSE = "MIT" + +inherit packagegroup + +RDEPENDS:${PN} += " \ + agl-compositor \ + agl-compositor-init \ +" diff --git a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-graphical-multimedia.bb b/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-graphical-multimedia.bb deleted file mode 100644 index f9903d942..000000000 --- a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-graphical-multimedia.bb +++ /dev/null @@ -1,16 +0,0 @@ -SUMMARY = "The software for application framework of AGL IVI profile" -DESCRIPTION = "A set of packages belong to AGL application framework which required by \ -Multimedia Subsystem" - -LICENSE = "MIT" - -inherit packagegroup - -PACKAGES = "\ - packagegroup-agl-graphical-multimedia \ - " - -RDEPENDS:${PN} += "\ - alsa-utils \ - gstreamer1.0-meta-base \ - " diff --git a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-graphical-weston.bb b/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-graphical-weston.bb index 859303049..96f09d5ab 100644 --- a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-graphical-weston.bb +++ b/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-graphical-weston.bb @@ -1,17 +1,9 @@ -DESCRIPTION = "The minimal set of packages required for Wayland support" +DESCRIPTION = "The minimal set of packages required for the Weston compositor" LICENSE = "MIT" inherit packagegroup -PACKAGES = "\ - packagegroup-agl-graphical-weston \ - " - -ALLOW_EMPTY:${PN} = "1" - RDEPENDS:${PN} += " \ - weston \ - weston-init \ - weston-examples \ - " - + weston \ + weston-init \ +" diff --git a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-boot.bb b/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-boot.bb deleted file mode 100644 index 8b2cfbb31..000000000 --- a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-boot.bb +++ /dev/null @@ -1,18 +0,0 @@ -DESCRIPTION = "The minimal set of packages required by AGL" -LICENSE = "MIT" - -inherit packagegroup - -PACKAGES = "\ - packagegroup-agl-image-boot \ - " - -ALLOW_EMPTY:${PN} = "1" - -RDEPENDS:${PN} += "\ - packagegroup-agl-core-boot \ - packagegroup-machine-base \ - " - -RDEPENDS:${PN} += "\ - " diff --git a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-minimal.bb b/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-minimal.bb index 1a51a9bf1..a60cbab21 100644 --- a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-minimal.bb +++ b/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-minimal.bb @@ -12,13 +12,7 @@ ALLOW_EMPTY:${PN} = "1" RDEPENDS:${PN} += "\ packagegroup-agl-core-boot \ - packagegroup-machine-base \ - " - -RDEPENDS:${PN} += "\ packagegroup-agl-core-connectivity \ - packagegroup-agl-core-os-commonlibs \ - packagegroup-agl-core-security \ " RDEPENDS:profile-agl-minimal = "${PN}" diff --git a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-profile-graphical.bb b/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-profile-graphical.bb index 2b708603b..b92e760ae 100644 --- a/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-profile-graphical.bb +++ b/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-profile-graphical.bb @@ -1,5 +1,5 @@ SUMMARY = "The middleware for AGL IVI profile" -DESCRIPTION = "The set of packages required for AGL IVI Distribution" +DESCRIPTION = "The base set of packages required for a AGL IVI Distribution" LICENSE = "MIT" inherit packagegroup @@ -7,16 +7,11 @@ inherit packagegroup PACKAGES = "\ packagegroup-agl-profile-graphical \ profile-graphical \ - " - -ALLOW_EMPTY:${PN} = "1" +" RDEPENDS:${PN} += "\ packagegroup-agl-image-minimal \ - packagegroup-agl-graphical-weston \ - packagegroup-agl-graphical-multimedia \ + packagegroup-agl-graphical-compositor \ " -# FIXME: Removed due to issues building against weston 5.0.0: -# waltham-transmitter RDEPENDS:profile-graphical = "${PN}" diff --git a/meta-agl-core/recipes-support/ptest-runner/ptest-runner/0007-WIP-Initial-LAVA-support.patch b/meta-agl-core/recipes-support/ptest-runner/ptest-runner/0007-WIP-Initial-LAVA-support.patch index 6232c4fa4..14c90b714 100644 --- a/meta-agl-core/recipes-support/ptest-runner/ptest-runner/0007-WIP-Initial-LAVA-support.patch +++ b/meta-agl-core/recipes-support/ptest-runner/ptest-runner/0007-WIP-Initial-LAVA-support.patch @@ -1,7 +1,7 @@ -From 11b29ce444610a07067a89b38e9e85c2162bbf67 Mon Sep 17 00:00:00 2001 +From 552f06e025493f7e634ea9e27489861b88f45555 Mon Sep 17 00:00:00 2001 From: Tim Orling <timothy.t.orling@linux.intel.com> Date: Mon, 15 Oct 2018 18:30:42 -0700 -Subject: [PATCH 7/7] [WIP] Initial LAVA support +Subject: [PATCH] Initial LAVA support Linaro Automated Validation Architecture (LAVA) launches a test suite on the target but thereafter only observes stdout. @@ -17,10 +17,22 @@ emitted to stdout: It is valid to have a measurement without units, but not units without a measurement. +Upstream-Status: Pending + Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com> [updated for ptest-runner 2.3.2] +[updated for ptest-runner 2.4.1] +[updated for ptest-runner 2.4.2] Signed-off-by: Scott Murray <scott.murray@konsulko.com> + --- + flags.h | 10 ++++++++++ + main.c | 9 ++++++++- + utils.c | 15 +++++++++++++++ + utils.h | 2 +- + 4 files changed, 34 insertions(+), 2 deletions(-) + create mode 100644 flags.h + diff --git a/flags.h b/flags.h new file mode 100644 index 0000000..0dac223 @@ -38,7 +50,7 @@ index 0000000..0dac223 + +#endif /* __FLAGS_H__ */ diff --git a/main.c b/main.c -index 01d60f7..165370f 100644 +index 31e4dd5..f12d6d6 100644 --- a/main.c +++ b/main.c @@ -38,6 +38,7 @@ @@ -49,7 +61,7 @@ index 01d60f7..165370f 100644 #ifndef DEFAULT_DIRECTORY #define DEFAULT_DIRECTORY "/usr/lib" -@@ -74,8 +75,9 @@ main(int argc, char *argv[]) +@@ -130,8 +131,9 @@ main(int argc, char *argv[]) opts.timeout = DEFAULT_TIMEOUT; opts.ptests = NULL; opts.xml_filename = NULL; @@ -59,8 +71,8 @@ index 01d60f7..165370f 100644 + while ((opt = getopt(argc, argv, "d:e:lt:x:Lh")) != -1) { switch (opt) { case 'd': - free(opts.directory); -@@ -122,6 +124,11 @@ main(int argc, char *argv[]) + free(opts.dirs[0]); +@@ -156,6 +158,11 @@ main(int argc, char *argv[]) opts.xml_filename = strdup(optarg); CHECK_ALLOCATION(opts.xml_filename, 1, 1); break; @@ -73,18 +85,18 @@ index 01d60f7..165370f 100644 print_usage(stdout, argv[0]); exit(1); diff --git a/utils.c b/utils.c -index a8ba190..19f9efa 100644 +index a67ac11..0c081ce 100644 --- a/utils.c +++ b/utils.c -@@ -47,6 +47,7 @@ +@@ -49,6 +49,7 @@ #include "ptest_list.h" #include "utils.h" +#include "flags.h" #define GET_STIME_BUF_SIZE 1024 - #define WAIT_CHILD_POLL_TIMEOUT_MS 200 -@@ -439,6 +440,7 @@ run_ptests(struct ptest_list *head, const struct ptest_options opts, + #define WAIT_CHILD_BUF_MAX_SIZE 1024 +@@ -483,6 +484,7 @@ run_ptests(struct ptest_list *head, const struct ptest_options opts, fprintf(fp, "START: %s\n", progname); PTEST_LIST_ITERATE_START(head, p) char *ptest_dir = strdup(p->run_ptest); @@ -92,13 +104,7 @@ index a8ba190..19f9efa 100644 if (ptest_dir == NULL) { rc = -1; break; -@@ -480,11 +482,15 @@ run_ptests(struct ptest_list *head, const struct ptest_options opts, - int status; - int fds[2]; fds[0] = pipefd_stdout[0]; fds[1] = pipefd_stderr[0]; - FILE *fps[2]; fps[0] = fp; fps[1] = fp_stderr; -+ char result[5]; // pass\0, fail\0, skip\0 - - if (setpgid(child, pgid) == -1) { +@@ -525,6 +527,9 @@ run_ptests(struct ptest_list *head, const struct ptest_options opts, fprintf(fp, "ERROR: setpgid() failed, %s\n", strerror(errno)); } @@ -108,11 +114,13 @@ index a8ba190..19f9efa 100644 sttime = time(NULL); fprintf(fp, "%s\n", get_stime(stime, GET_STIME_BUF_SIZE, sttime)); fprintf(fp, "BEGIN: %s\n", ptest_dir); -@@ -506,6 +512,14 @@ run_ptests(struct ptest_list *head, const struct ptest_options opts, +@@ -548,6 +553,16 @@ run_ptests(struct ptest_list *head, const struct ptest_options opts, fprintf(fp, "END: %s\n", ptest_dir); fprintf(fp, "%s\n", get_stime(stime, GET_STIME_BUF_SIZE, entime)); + if (opts.flags & LAVA_SIGNAL_ENABLE) { ++ char result[5]; // pass\0, fail\0, skip\0 ++ + if (status) + sprintf(result, "fail"); + else @@ -121,14 +129,14 @@ index a8ba190..19f9efa 100644 + fprintf(stdout, "<LAVA_SIGNAL_TESTCASE TEST_CASE_ID=%s RESULT=%s>\n", ptest, result); + } } + free(ptest_dir); PTEST_LIST_ITERATE_END - fprintf(fp, "STOP: %s\n", progname); diff --git a/utils.h b/utils.h -index aa53707..df11e24 100644 +index 04fc666..ad702d8 100644 --- a/utils.h +++ b/utils.h -@@ -39,9 +39,9 @@ struct ptest_options { - int timeout; +@@ -42,9 +42,9 @@ struct ptest_options { + unsigned int timeout; char **ptests; char *xml_filename; + unsigned int flags; diff --git a/meta-agl-core/scripts/run-yocto-check-layer-feature-enabled.sh b/meta-agl-core/scripts/run-yocto-check-layer-feature-enabled.sh deleted file mode 100755 index fec73069e..000000000 --- a/meta-agl-core/scripts/run-yocto-check-layer-feature-enabled.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -set -x - -SCRIPTPATH="$( cd $(dirname $0) >/dev/null 2>&1 ; pwd -P )" -echo $SCRIPTPATH -AGLROOT="$SCRIPTPATH/../../.." -POKYDIR="$AGLROOT/external/poky" -TMPROOT=`mktemp -d` - -rm -rf ${TMPROOT}/testbuild-ycl || true -mkdir -p ${TMPROOT}/testbuild-ycl -cd ${TMPROOT}/testbuild-ycl - -source $POKYDIR/oe-init-build-env . - -cat << EOF >> conf/local.conf -# just define defaults -AGL_FEATURES ?= "" -AGL_EXTRA_IMAGE_FSTYPES ?= "" - -# important settings imported from poky-agl.conf -# we do not import -DISTRO_FEATURES:append = " systemd smack" -DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " sysvinit" -VIRTUAL-RUNTIME_init_manager = "systemd" - -# workaround: -# ERROR: Nothing PROVIDES 'smack' (but /home/dl9pf/AGL/master-newlayout/external/meta-openembedded/meta-oe/recipes-extended/ostree/ostree_2020.3.bb DEPENDS on or otherwise requires it) -BBMASK += "meta-openembedded/meta-oe/recipes-extended/ostree/ostree_2020.3.bb" - -AGL_FEATURES += "aglcore" - -EOF - - -yocto-check-layer \ - --dependency \ - $AGLROOT/external/meta-openembedded/meta-oe \ - -- \ - $AGLROOT/meta-agl/meta-agl-core - - -[ $? = 0 ] && rm -rf ${TMPROOT}/testbuild-ycl - -exit 0 - - --dependency \ - $AGLROOT/external/meta-openembedded/meta-oe \ - $AGLROOT/external/meta-openembedded/meta-python \ - $AGLROOT/external/meta-openembedded/meta-networking \ diff --git a/meta-agl-core/scripts/run-yocto-check-layer.sh b/meta-agl-core/scripts/run-yocto-check-layer.sh index 369ed98b4..cd9364682 100755 --- a/meta-agl-core/scripts/run-yocto-check-layer.sh +++ b/meta-agl-core/scripts/run-yocto-check-layer.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -x +#set -x SCRIPTPATH="$( cd $(dirname $0) >/dev/null 2>&1 ; pwd -P )" echo $SCRIPTPATH @@ -19,21 +19,18 @@ AGL_FEATURES ?= "" AGL_EXTRA_IMAGE_FSTYPES ?= "" # important settings imported from poky-agl.conf -# we do not import -DISTRO_FEATURES:append = " systemd smack" +# we cannot import the distro config right away +# as the initial values are poky only till the layer +# is added in +# no polkit ! +AGL_DEFAULT_DISTRO_FEATURES = "usrmerge largefile opengl wayland pam bluetooth bluez5 3g" +DISTRO_FEATURES:append = " systemd wayland pam \${AGL_DEFAULT_DISTRO_FEATURES}" DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " sysvinit" VIRTUAL-RUNTIME_init_manager = "systemd" -# workaround: -# ERROR: Nothing PROVIDES 'smack' (but /home/dl9pf/AGL/master-newlayout/external/meta-openembedded/meta-oe/recipes-extended/ostree/ostree_2020.3.bb DEPENDS on or otherwise requires it) -BBMASK += "meta-openembedded/meta-oe/recipes-extended/ostree/ostree_2020.3.bb" - EOF - -yocto-check-layer \ - --dependency \ - $AGLROOT/external/meta-openembedded/meta-oe \ +yocto-check-layer --no-auto-dependency \ -- \ $AGLROOT/meta-agl/meta-agl-core @@ -41,8 +38,3 @@ yocto-check-layer \ [ $? = 0 ] && rm -rf ${TMPROOT}/testbuild-ycl exit 0 - - --dependency \ - $AGLROOT/external/meta-openembedded/meta-oe \ - $AGLROOT/external/meta-openembedded/meta-python \ - $AGLROOT/external/meta-openembedded/meta-networking \ diff --git a/meta-agl.md b/meta-agl.md index 0affb6f73..be4369656 100755 --- a/meta-agl.md +++ b/meta-agl.md @@ -27,7 +27,6 @@ Following is a "tree" look at the layer: |-- meta-agl-ic |-- meta-agl-ivi |-- meta-agl.md -|-- meta-app-framework |-- meta-netboot |-- meta-pipewire |-- scripts @@ -47,8 +46,6 @@ in `meta-agl`: * `meta-agl-core-test`: recipes supporting qa images (separate layer due to external dependencies) * `meta-agl-ic`: Instrument Cluster platform * `meta-agl-ivi`: IVI platform -* `meta-app-framework`: Configuration and recipes supporting the AGL Application - Framework. * `meta-netboot`: Contains recipes and configuration adjustments to allow network boot through network block device (NBD) since network file system (NFS) does not support security labels. diff --git a/meta-app-framework/LICENSE b/meta-app-framework/LICENSE deleted file mode 100644 index e8758f89c..000000000 --- a/meta-app-framework/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Different components of the AGL layers are under different licenses (a mix -of MIT and GPLv2). See LICENSE.GPL-2.0-only and LICENSE.MIT for further -details of the individual licenses. - -All metadata (e.g. .bb, .bbappend, .bbclass, .inc, templates/* and similar) -is MIT licensed unless otherwise stated. -Source code included in tree for individual recipes (e.g. patches) are under -the LICENSE stated in the associated recipe (.bb file) unless otherwise stated. - -License information for any other files (scripts) is either explicitly stated -or defaults to GPL version 2 only. - -Individual files can contain the following style tags instead of the full -license text to identify their license: - - SPDX-License-Identifier: GPL-2.0-only - SPDX-License-Identifier: MIT - -This enables machine processing of license information based on the SPDX -License Identifiers that are here available: http://spdx.org/licenses/ diff --git a/meta-app-framework/LICENSE.GPL-2.0-only b/meta-app-framework/LICENSE.GPL-2.0-only deleted file mode 100644 index 5db3c0a21..000000000 --- a/meta-app-framework/LICENSE.GPL-2.0-only +++ /dev/null @@ -1,288 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - -Note: -Individual files contain the following tag instead of the full license text. - - SPDX-License-Identifier: GPL-2.0-only - -This enables machine processing of license information based on the SPDX -License Identifiers that are here available: http://spdx.org/licenses/ diff --git a/meta-app-framework/LICENSE.MIT b/meta-app-framework/LICENSE.MIT deleted file mode 100644 index a6919eb7e..000000000 --- a/meta-app-framework/LICENSE.MIT +++ /dev/null @@ -1,25 +0,0 @@ -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Note: -Individual files contain the following tag instead of the full license text. - - SPDX-License-Identifier: MIT - -This enables machine processing of license information based on the SPDX -License Identifiers that are here available: http://spdx.org/licenses/ diff --git a/meta-app-framework/README b/meta-app-framework/README index bbcd5f45a..4a7a1a175 100644..120000 --- a/meta-app-framework/README +++ b/meta-app-framework/README @@ -1,4 +1 @@ -This is meta-app-framework. - -It is an application framework building on-top of the SMACK LSM. - +README-AGL.md
\ No newline at end of file diff --git a/meta-app-framework/README-AGL.md b/meta-app-framework/README-AGL.md new file mode 100644 index 000000000..bd0c2de8f --- /dev/null +++ b/meta-app-framework/README-AGL.md @@ -0,0 +1,31 @@ +Overview +======== + +The +[AGL Project](https://www.automotivelinux.org/) is an automotive-specific +development environment that provides a Linux distribution +[AGL UCB](https://www.automotivelinux.org/software/unified-code-base). + +AGL uses layers designed to be compatible with the +[Yocto Project](https://www.yoctoproject.org) and the +[OpenEmbedded Project (OE)](https://www.openembedded.org/wiki/Main_Page). + +This section provides information about the layers used by the AGL Project: + +* **`meta-agl/meta-app-framework`**: Application (lifecycle) manager + + ``` + $ git clone https://gerrit.automotivelinux.org/gerrit/AGL/meta-agl + ``` + +Maintenance +----------- + +All patches must be submitted via the AGL Gerrit instance at +<https://gerrit.automotivelinux.org>. See this wiki page for +details: + +<https://wiki.automotivelinux.org/agl-distro/contributing> + +Layer maintainers: +* Jan-Simon Möller <jsmoeller@linuxfoundation.org> diff --git a/meta-app-framework/classes/agl-app.bbclass b/meta-app-framework/classes/agl-app.bbclass new file mode 100644 index 000000000..491a36e02 --- /dev/null +++ b/meta-app-framework/classes/agl-app.bbclass @@ -0,0 +1,83 @@ +# +# AGL application systemd unit installation class +# + +# Systemd template unit +# * agl-app, agl-app-web, agl-app-flutter valid +AGL_APP_TEMPLATE ?= "agl-app" + +# Application ID +# This is what the application will be referred to in the list +# exposed to clients by applaunchd, and generally ends up as the +# identifier used by agl-compositor for application surface +# activation. +AGL_APP_ID ?= "${BPN}" + +# Application display name +AGL_APP_NAME ?= "${AGL_APP_ID}" + +# Application executable +# * agl-app template only +# Use if the application ID and the executable name are both +# different from the package name and each other as well. +AGL_APP_EXEC ?= "${AGL_APP_ID}" + +# Web application bundle directory (non-absolute, so directory +# name under /usr/lib/wam_apps) +# * agl-app-web template only +# Use if the web application bundle installs to a directory that +# is not the same as the package name. +AGL_APP_WAM_DIR ?= "${BPN}" + +do_install:append () { + install -d ${D}${systemd_system_unitdir} + ln -s ${AGL_APP_TEMPLATE}\@.service \ + ${D}${systemd_system_unitdir}/${AGL_APP_TEMPLATE}\@${AGL_APP_ID}.service + + # NOTE: Unit & Service changes could potentially be collected + # and a single override .conf created, but things will be + # kept simple for now. + + if [ "${AGL_APP_EXEC}" != "${AGL_APP_ID}" ]; then + install -d ${D}${systemd_system_unitdir}/${AGL_APP_TEMPLATE}\@${AGL_APP_ID}.service.d + cat <<-EOF > ${D}${systemd_system_unitdir}/${AGL_APP_TEMPLATE}\@${AGL_APP_ID}.service.d/exec.conf + [Service] + ExecStart= + ExecStart=${AGL_APP_EXEC} + EOF + fi + + if [ "${AGL_APP_NAME}" != "${AGL_APP_ID}" ]; then + install -d ${D}${systemd_system_unitdir}/${AGL_APP_TEMPLATE}\@${AGL_APP_ID}.service.d + cat <<-EOF > ${D}${systemd_system_unitdir}/${AGL_APP_TEMPLATE}\@${AGL_APP_ID}.service.d/name.conf + [Unit] + Description= + Description=${AGL_APP_NAME} + EOF + fi + + if [ "${AGL_APP_TEMPLATE}" = "agl-app-web" -a "${AGL_APP_ID}" != "${BPN}" ]; then + # The application ID does not necessarily match the package name + # used in the WAM install hierarchy, and the IDs are hard-coded in + # some of the web apps, so if necessary create an override for the + # environment variable used in place of directly deriving from %i + # (which will always be the app id). + install -d ${D}${systemd_system_unitdir}/${AGL_APP_TEMPLATE}\@${AGL_APP_ID}.service.d + cat <<-EOF > ${D}${systemd_system_unitdir}/${AGL_APP_TEMPLATE}\@${AGL_APP_ID}.service.d/wam.conf + [Service] + Environment=AGL_APP_WAM_DIR=${AGL_APP_WAM_DIR} + EOF + fi + + if [ "${AGL_APP_TEMPLATE}" = "agl-app-flutter" ]; then + # Install icon if present + if [ -f ${S}/package/${AGL_APP_ID}.svg ]; then + install -d ${D}${datadir}/icons/hicolor/scalable + install -m 0644 ${S}/package/${AGL_APP_ID}.svg ${D}${datadir}/icons/hicolor/scalable/ + fi + fi +} + +FILES:${PN}:append = " ${systemd_system_unitdir} ${datadir}/icons" + +RDEPENDS:${PN}:append = " applaunchd-template-${AGL_APP_TEMPLATE}" diff --git a/meta-app-framework/classes/aglwgt.bbclass b/meta-app-framework/classes/aglwgt.bbclass deleted file mode 100644 index f42c282a7..000000000 --- a/meta-app-framework/classes/aglwgt.bbclass +++ /dev/null @@ -1,185 +0,0 @@ -# -# aglwgt bbclass -# -# Jan-Simon Moeller, jsmoeller@linuxfoundation.org -# -# This class expects a "make package" target in the makefile -# which creates the wgt files in the package/ subfolder. -# The makefile needs to use wgtpkg-pack. -# - -# 'wgtpkg-pack' in af-main-native is required. -DEPENDS:append = " af-main-native" - -# for bindings af-binder is required. -DEPENDS:append = " af-binder" - -# for bindings that use the cmake-apps-module -DEPENDS:append = " cmake-apps-module-native" - -# for hal bindings genskel is required. -DEPENDS:append = " af-binder-devtools-native" - -# Re-enable strip for qmake based projects (default value is "echo") -OE_QMAKE_STRIP = "${STRIP}" - -# Extra build arguments passed to the autobuild script invocations -AGLWGT_EXTRA_BUILD_ARGS ?= 'VERBOSE=TRUE BUILD_ARGS="${PARALLEL_MAKE}"' - -# CMake based widgets that inherit cmake.bbclass will have the -# following automatically appended to AGLWGT_EXTRA_BUILD_ARGS as -# the value of CONFIGURE_FLAGS. This definition may need to be -# extended to include more of what is passed in cmake.bbclass's -# do_configure if it is found insufficient. Using the generated -# toolchain.cmake file does fix issues with respect to finding the -# Qt5 CMake modules that seem difficult to fix otherwise, so at the -# very minimum it should be present. -AGLWGT_CMAKE_CONFIGURE_ARGS ?= "-DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake ${EXTRA_OECMAKE}" - -# Only widgets with recipe names starting with agl-service- are -# assumed to have tests by default, set this to "1" to force -# building/packaging of the test widget for other widgets. -AGLWGT_HAVE_TESTS ?= "0" - -# Whether the widget should be auto-installed on first boot -AGLWGT_AUTOINSTALL ?= "1" - -# Signature keys -# These are default keys for development purposes ! -# Change it for production. -WGTPKG_AUTOSIGN_0:agl-sign-wgts ??= "${WORKDIR}/recipe-sysroot-native/usr/share/afm/keys/developer.key.pem:${WORKDIR}/recipe-sysroot-native/usr/share/afm/certs/developer.cert.pem" -WGTPKG_AUTOSIGN_1:agl-sign-wgts ??= "${WORKDIR}/recipe-sysroot-native/usr/share/afm/keys/platform.key.pem:${WORKDIR}/recipe-sysroot-native/usr/share/afm/certs/platform.cert.pem" - -export WGTPKG_AUTOSIGN_0 -export WGTPKG_AUTOSIGN_1 - -python __anonymous () { - # NOTE: AGLWGT_CMAKE_CONFIGURE_ARGS is not updated directly here, - # but via the prefunc below to avoid issues around anonymous - # python ordering conflicts with e.g. externalsrc.bbclass. - if bb.data.inherits_class("cmake", d): - d.appendVarFlag('do_compile', 'prefuncs', ' aglwgt_cmake_configure') -} - -python aglwgt_cmake_configure () { - # Define CONFIGURE_FLAGS appropriately if cmake.bbclass has been - # inherited, see description of AGLWGT_CMAKE_CONFIGURE_ARGS above - # for more details. - cmake_config_args = d.getVar("AGLWGT_CMAKE_CONFIGURE_ARGS") - if bb.data.inherits_class("cmake", d) and cmake_config_args: - d.appendVar("AGLWGT_EXTRA_BUILD_ARGS", ' CONFIGURE_ARGS="' + cmake_config_args + '"') - d.appendVarFlag("AGLWGT_EXTRA_BUILD_ARGS", "vardeps", " AGLWGT_CMAKE_CONFIGURE_ARGS") -} - -# Placeholder to keep things like externalsrc that prefunc or append -# do_configure working as expected. -aglwgt_do_configure() { - true -} - -aglwgt_do_compile() { - bldcmd=${S}/autobuild/agl/autobuild - if [ ! -x "$bldcmd" ]; then - bbfatal "Missing autobuild/agl/autobuild script" - fi - - if [ "${S}" != "${B}" ]; then - rm -rf ${B} - mkdir -p ${B} - cd ${B} - fi - - $bldcmd package BUILD_DIR=${B}/build-release ${AGLWGT_EXTRA_BUILD_ARGS} - $bldcmd package-debug BUILD_DIR_DEBUG=${B}/build-debug ${AGLWGT_EXTRA_BUILD_ARGS} - - if echo ${BPN} | grep -q '^agl-service-' || [ "${AGLWGT_HAVE_TESTS}" = "1" ]; then - # Only try building the test widget if there's source for it, to avoid spurious errors - if [ -f ${S}/test/CMakeLists.txt ]; then - $bldcmd package-test BUILD_DIR_TEST=${B}/build-test ${AGLWGT_EXTRA_BUILD_ARGS} - fi - - # The coverage widget should always build - $bldcmd package-coverage BUILD_DIR_COVERAGE=${B}/build-coverage ${AGLWGT_EXTRA_BUILD_ARGS} - fi -} - -POST_INSTALL_LEVEL ?= "10" -POST_INSTALL_SCRIPT ?= "${POST_INSTALL_LEVEL}-${PN}.sh" - -EXTRA_WGT_POSTINSTALL ?= "" - -aglwgt_do_install() { - DEST=release - if [ "${AGLWGT_AUTOINSTALL_${PN}}" = "0" ]; then - DEST=manualinstall - fi - - wgt="$(find ${B}/build-release -maxdepth 1 -name '*.wgt'| head -n 1)" - if [ -n "$wgt" ]; then - install -d ${D}/usr/AGL/apps/$DEST - install -m 0644 $wgt ${D}/usr/AGL/apps/$DEST/ - else - bbfatal "no package found in widget directory" - fi - - for t in debug coverage test; do - if [ "$(find ${B}/build-${t} -maxdepth 1 -name *-${t}.wgt)" ]; then - install -d ${D}/usr/AGL/apps/${t} - install -m 0644 ${B}/build-${t}/*-${t}.wgt ${D}/usr/AGL/apps/${t}/ - elif [ "$t" = "debug" ]; then - # HTML5 widgets complicate things here, need to detect them and - # not error out in that case. ATM this requires looking in the - # config.xml of the release widget. - rm -rf ${B}/tmp - unzip $wgt config.xml -d ${B}/tmp - if [ -f ${B}/tmp/config.xml -a \ - ! cat ${B}/tmp/config.xml | \ - grep -q '^[[:space:]]*<content[[:space:]]\+src="[^\"]*"[[:space:]]\+type="text/html"' ]; then - bbfatal "no package found in ${t} widget directory" - fi - rm -rf ${B}/tmp - elif echo ${BPN} | grep -q '^agl-service-' || [ "${AGLWGT_HAVE_TESTS}" = "1" ]; then - if [ "$t" = "coverage" -o -f ${S}/test/CMakeLists.txt ]; then - bbfatal "no package found in ${t} widget directory" - fi - fi - done - - if [ "${AGLWGT_AUTOINSTALL}" != "0" ]; then - # For now assume autoinstall of the release versions - rm -rf ${D}/usr/AGL/apps/autoinstall - ln -sf release ${D}/usr/AGL/apps/autoinstall - - APP_FILES="" - for file in ${D}/usr/AGL/apps/autoinstall/*.wgt; do - APP_FILES="${APP_FILES} $(basename $file)"; - done - install -d ${D}/${sysconfdir}/agl-postinsts - cat > ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} <<EOF -#!/bin/sh -e -for file in ${APP_FILES}; do - /usr/bin/afm-install install /usr/AGL/apps/autoinstall/\$file -done -sync -${EXTRA_WGT_POSTINSTALL} -EOF - chmod a+x ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} - fi -} - -PACKAGES += "${PN}-test ${PN}-debug ${PN}-coverage" - -FILES:${PN} += " \ - /usr/AGL/apps/release/*.wgt \ - /usr/AGL/apps/autoinstall \ - /usr/AGL/apps/manualinstall \ - ${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} \ -" -FILES:${PN}-test = "/usr/AGL/apps/test/*.wgt" -FILES:${PN}-debug = "/usr/AGL/apps/debug/*.wgt" -FILES:${PN}-coverage = "/usr/AGL/apps/coverage/*.wgt" - -# Test widgets need the parent widget and the test framework -RDEPENDS:${PN}-test = "${PN} afb-test" - -EXPORT_FUNCTIONS do_configure do_compile do_install diff --git a/meta-app-framework/conf/include/agl-app-framework.inc b/meta-app-framework/conf/include/agl-app-framework.inc new file mode 100644 index 000000000..296f49e79 --- /dev/null +++ b/meta-app-framework/conf/include/agl-app-framework.inc @@ -0,0 +1,2 @@ +# enable the layer +AGL_FEATURES:append = " agl-app-fw" diff --git a/meta-app-framework/conf/include/agl-appfw-smack.inc b/meta-app-framework/conf/include/agl-appfw-smack.inc deleted file mode 100644 index f22fe715c..000000000 --- a/meta-app-framework/conf/include/agl-appfw-smack.inc +++ /dev/null @@ -1,24 +0,0 @@ -# enable security features (smack, cynagora) - required by Application Framework -OVERRIDES .= ":with-lsm-smack" -DISTRO_FEATURES:append = " smack xattr" -DISTRO_FEATURES_NATIVE:append = " smack xattr" - -APPFW_ENABLED = "1" - -# use tar-native to support SMACK extended attributes independently of host config -IMAGE_CMD_TAR = "tar --xattrs --xattrs-include='*'" -do_image_tar[depends] += "tar-replacement-native:do_populate_sysroot" -EXTRANATIVEPATH += "tar-native" - -# security: enable ssh server in place of dropbear to support PAM on user sessions -IMAGE_FEATURES += "ssh-server-openssh" - -# enforce copy of xattrs (to be removed, see SPEC-475) -PACKAGECONFIG:append:pn-shadow = " attr" -PACKAGECONFIG:append:pn-shadow-native = " attr" - -# set the home directory for root -ROOT_HOME = "/home/0" - -# include devel wgts in images -IMAGE_FEATURES:append = " agl-devel-wgt" diff --git a/meta-app-framework/conf/include/agl-sign-wgts.inc b/meta-app-framework/conf/include/agl-sign-wgts.inc deleted file mode 100644 index 06a7abac0..000000000 --- a/meta-app-framework/conf/include/agl-sign-wgts.inc +++ /dev/null @@ -1,3 +0,0 @@ -# allows insertion of code or items specific to developement -OVERRIDES .= ":agl-sign-wgts" -AGL_FEATURES:append = " agl-sign-wgts" diff --git a/meta-app-framework/conf/layer.conf b/meta-app-framework/conf/layer.conf index 77701bb57..85565353e 100644 --- a/meta-app-framework/conf/layer.conf +++ b/meta-app-framework/conf/layer.conf @@ -5,29 +5,9 @@ BBPATH .= ":${LAYERDIR}" BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ ${LAYERDIR}/recipes-*/*/*.bbappend" -BBFILE_COLLECTIONS += "app-framework" -BBFILE_PATTERN_app-framework = "^${LAYERDIR}/" -BBFILE_PRIORITY_app-framework = "70" +BBFILE_COLLECTIONS += "meta-app-framework" +BBFILE_PATTERN_meta-app-framework = "^${LAYERDIR}/" +BBFILE_PRIORITY_meta-app-framework = "60" -LAYERSERIES_COMPAT_app-framework = "dunfell" - -# dependency: meta-oe -LAYERDEPENDS_app-framework = "openembedded-layer" -# dependency: meta-security -LAYERDEPENDS_app-framework += "security" - -# AGL core layer is an optional requirement -LAYERRECOMMENDS_app-framework += "aglcore" -LAYERRECOMMENDS_app-framework += "qt5-layer" - -BBFILES_DYNAMIC += " \ - qt5-layer:${LAYERDIR}/dynamic-layers/meta-qt5/*/*/*.bb \ - qt5-layer:${LAYERDIR}/dynamic-layers/meta-qt5/*/*/*.bbappend \ - aglcore:${LAYERDIR}/dynamic-layers/meta-agl-core/*/*/*.bb \ - aglcore:${LAYERDIR}/dynamic-layers/meta-agl-core/*/*/*.bbappend \ -" - - -# bug in meta-security -BBMASK += "packagegroup-core-security-ptest\.bb" -#BBMASK += "meta-security/recipes-mac/smack/smack-test_1.0.bb +LAYERSERIES_COMPAT_meta-app-framework = "kirkstone" +LAYERDEPENDS_meta-app-framework = "core aglcore openembedded-layer" diff --git a/meta-app-framework/dynamic-layers/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-security.bbappend b/meta-app-framework/dynamic-layers/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-security.bbappend deleted file mode 100644 index 048154e04..000000000 --- a/meta-app-framework/dynamic-layers/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-security.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', '${PN}_appfw.inc', '', d)} diff --git a/meta-app-framework/dynamic-layers/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-security_appfw.inc b/meta-app-framework/dynamic-layers/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-security_appfw.inc deleted file mode 100644 index 52d3f0e92..000000000 --- a/meta-app-framework/dynamic-layers/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-core-security_appfw.inc +++ /dev/null @@ -1,8 +0,0 @@ -RDEPENDS:${PN}:append = "\ - smack-system-setup \ - xmlsec1 \ - cynagora \ - security-manager \ - security-manager-policy \ - agl-users \ - " diff --git a/meta-app-framework/dynamic-layers/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-boot.bbappend b/meta-app-framework/dynamic-layers/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-boot.bbappend deleted file mode 100644 index 514dde79b..000000000 --- a/meta-app-framework/dynamic-layers/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-boot.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'packagegroup-agl-image-boot_appfw.inc', '', d)} diff --git a/meta-app-framework/dynamic-layers/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-boot_appfw.inc b/meta-app-framework/dynamic-layers/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-boot_appfw.inc deleted file mode 100644 index 2499c07b5..000000000 --- a/meta-app-framework/dynamic-layers/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-boot_appfw.inc +++ /dev/null @@ -1,3 +0,0 @@ -RDEPENDS:${PN}:append = "\ - packagegroup-agl-app-framework \ - " diff --git a/meta-app-framework/dynamic-layers/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-minimal.bbappend b/meta-app-framework/dynamic-layers/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-minimal.bbappend deleted file mode 100644 index 5f890bf06..000000000 --- a/meta-app-framework/dynamic-layers/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-minimal.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'packagegroup-agl-image-minimal_appfw.inc', '', d)} diff --git a/meta-app-framework/dynamic-layers/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-minimal_appfw.inc b/meta-app-framework/dynamic-layers/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-minimal_appfw.inc deleted file mode 100644 index 2499c07b5..000000000 --- a/meta-app-framework/dynamic-layers/meta-agl-core/recipes-platform/packagegroups/packagegroup-agl-image-minimal_appfw.inc +++ /dev/null @@ -1,3 +0,0 @@ -RDEPENDS:${PN}:append = "\ - packagegroup-agl-app-framework \ - " diff --git a/meta-app-framework/dynamic-layers/meta-qt5/recipes-devtools/libafb-helpers-qt/libafb-helpers-qt_git.bb b/meta-app-framework/dynamic-layers/meta-qt5/recipes-devtools/libafb-helpers-qt/libafb-helpers-qt_git.bb deleted file mode 100644 index afbbc09b3..000000000 --- a/meta-app-framework/dynamic-layers/meta-qt5/recipes-devtools/libafb-helpers-qt/libafb-helpers-qt_git.bb +++ /dev/null @@ -1,11 +0,0 @@ -require recipes-devtools/libafb-helpers/libafb-helpers_git.inc - -DEPENDS:append = " qtwebsockets" -RDEPENDS:${PN}:append = " af-binder" - -inherit cmake_qt5 - -EXTRA_OECMAKE:append = " -DAFB_HELPERS_QT=ON -DAFB_HELPERS=OFF" - -ALLOW_EMPTY:${PN} = "1" - diff --git a/meta-app-framework/dynamic-layers/meta-qt5/recipes-devtools/libqtappfw/libqtappfw_git.bb b/meta-app-framework/dynamic-layers/meta-qt5/recipes-devtools/libqtappfw/libqtappfw_git.bb deleted file mode 100644 index dd270d048..000000000 --- a/meta-app-framework/dynamic-layers/meta-qt5/recipes-devtools/libqtappfw/libqtappfw_git.bb +++ /dev/null @@ -1,20 +0,0 @@ -SUMMARY = "AGL Qt AppFW Library" -DESCRIPTION = "libqtappfw" -HOMEPAGE = "http://docs.automotivelinux.org" -LICENSE = "Apache-2.0" -SECTION = "libs" - -BBCLASSEXTEND = "nativesdk" - -LIC_FILES_CHKSUM = "file://LICENSE;md5=ae6497158920d9524cf208c09cc4c984" - -DEPENDS += "qtbase qtdeclarative qtwebsockets" - -inherit cmake_qt5 - -SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/libqtappfw;protocol=https;branch=${AGL_BRANCH}" -SRCREV = "fe20f1b029f67dee1f790ade7a9114086f2abd38" -S = "${WORKDIR}/git/" - -# PV needs to be modified with SRCPV to work AUTOREV correctly -PV = "0.0+git${SRCPV}" diff --git a/meta-app-framework/dynamic-layers/meta-qt5/recipes-platform/packagegroups/packagegroup-agl-appfw-qt5.bb b/meta-app-framework/dynamic-layers/meta-qt5/recipes-platform/packagegroups/packagegroup-agl-appfw-qt5.bb deleted file mode 100644 index 853627622..000000000 --- a/meta-app-framework/dynamic-layers/meta-qt5/recipes-platform/packagegroups/packagegroup-agl-appfw-qt5.bb +++ /dev/null @@ -1,16 +0,0 @@ -SUMMARY = "The software for application framework of AGL IVI profile" -DESCRIPTION = "A set of packages belong to AGL application framework" - -LICENSE = "MIT" - -inherit packagegroup - -PACKAGES = "\ - packagegroup-agl-appfw-qt5 \ - " - -ALLOW_EMPTY:${PN} = "1" - -RDEPENDS:${PN} += "\ - packagegroup-agl-appfw-native \ -"
\ No newline at end of file diff --git a/meta-app-framework/recipes-config/polkit-rule-agl-app/files/50-agl-app.rules b/meta-app-framework/recipes-config/polkit-rule-agl-app/files/50-agl-app.rules new file mode 100644 index 000000000..35b9559c5 --- /dev/null +++ b/meta-app-framework/recipes-config/polkit-rule-agl-app/files/50-agl-app.rules @@ -0,0 +1,7 @@ +polkit.addRule(function(action, subject) { + if (action.id == "org.freedesktop.systemd1.manage-units" && + action.lookup("unit").indexOf("agl-app") == 0 && + subject.isInGroup("applaunchd")) { + return polkit.Result.YES; + } +}); diff --git a/meta-app-framework/recipes-config/polkit-rule-agl-app/polkit-rule-agl-app.bb b/meta-app-framework/recipes-config/polkit-rule-agl-app/polkit-rule-agl-app.bb new file mode 100644 index 000000000..57dda7787 --- /dev/null +++ b/meta-app-framework/recipes-config/polkit-rule-agl-app/polkit-rule-agl-app.bb @@ -0,0 +1,21 @@ +SUMMARY = "Rule for agl-driver to control agl-app@ services" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI = "file://50-agl-app.rules" + +DEPENDS += "polkit" + +inherit useradd features_check +REQUIRED_DISTRO_FEATURES = "polkit" + +do_install() { + install -m 700 -d ${D}${datadir}/polkit-1/rules.d + chown polkitd:root ${D}/${datadir}/polkit-1/rules.d + install -m 0644 ${WORKDIR}/50-agl-app.rules ${D}${datadir}/polkit-1/rules.d +} + +USERADD_PACKAGES = "${PN}" +USERADD_PARAM:${PN} += "--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;" + +FILES:${PN} += "${datadir}/polkit-1/rules.d/*.rules" diff --git a/meta-app-framework/recipes-connectivity/bluez5/bluez5_%.bbappend b/meta-app-framework/recipes-connectivity/bluez5/bluez5_%.bbappend deleted file mode 100644 index 20d2a68d7..000000000 --- a/meta-app-framework/recipes-connectivity/bluez5/bluez5_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'bluez5_appfw.inc', '', d)} diff --git a/meta-app-framework/recipes-connectivity/bluez5/bluez5_appfw.inc b/meta-app-framework/recipes-connectivity/bluez5/bluez5_appfw.inc deleted file mode 100644 index 7b74de980..000000000 --- a/meta-app-framework/recipes-connectivity/bluez5/bluez5_appfw.inc +++ /dev/null @@ -1,55 +0,0 @@ -# Recent bluez5 releases started limiting the capabilities of -# bluetoothd. When running on a Smack-enabled system, that change has the -# effect that bluetoothd can no longer create the input device under -# /sys because bluez5 running with label "System" has no write -# access to that. -# -# It works when running as normal root with unrestricted capabilities -# because then CAP_MAC_OVERRIDE (a Smack-specific capability) allows -# the process to ignore Smack rules. -# -# We need to ensure that bluetoothd still has that capability. -# -# To fix the issue, Patick and Casey(the Smack architect) had a talk -# about it in Ostro dev mail list. Casey has some ideas about the issue: -# "Turning off privilege is a great thing to do *so long as you don't -# really need the privilege*. In this case you really need it. -# The application package isn't written to account for Smack's use of -# CAP_MAC_OVERRIDE as the mechanism for controlling this dangerous operation. -# Yes, it would be possible to change /proc to change the Smack label on -# that particular file, but that might open other paths for exploit. -# I say give the program the required capability. The program maintainer -# may well say change the kernel handling of /proc. You're stuck in the -# middle, as both work the way they're intended and hence the system -# doesn't work. :( There isn't a way to make this work without "loosening" -# something." -# Therefore, when we we run the program with CAP_MAC_OVERRIDE, -# the whole reason for having capabilities is so the we can give a -# process the ability to bypass one kind of check without giving it the -# ability to bypass other, unrelated checks. A process with -# CAP_MAC_OVERRIDE is still constrained by the file mode bits. -# We was overly worried about granting that capability. -# When it has no other effect than excluding a process from Smack MAC enforcement, -# then adding to the process seems like the right solution for now. -# -# The conclusion from Patick and Casey is that the Smack architect give the key point -# that this is the solution preferred. -# -# Because the solution is to some extend specific to the environment -# in which connmand runs, this change is not submitted upstream -# and it can be overridden by a distro via FIX_BLUEZ5_CAPABILITIES. -# -# The related patch has been submitted to upstream too. -# upstream link: http://permalink.gmane.org/gmane.linux.bluez.kernel/67993 - -FILESEXTRAPATHS:prepend := "${THISDIR}/files:" - -SRC_URI:append:with-lsm-smack = "\ - file://bluetooth.service.conf \ -" - -FILES:${PN}:append = " ${systemd_unitdir}" - -do_install:append:with-lsm-smack() { - install -Dm0644 ${WORKDIR}/bluetooth.service.conf ${D}${systemd_unitdir}/system/bluetooth.service.d/smack.conf -} diff --git a/meta-app-framework/recipes-connectivity/bluez5/files/bluetooth.service.conf b/meta-app-framework/recipes-connectivity/bluez5/files/bluetooth.service.conf deleted file mode 100644 index b93ab4fee..000000000 --- a/meta-app-framework/recipes-connectivity/bluez5/files/bluetooth.service.conf +++ /dev/null @@ -1,2 +0,0 @@ -[Service] -CapabilityBoundingSet=CAP_MAC_OVERRIDE diff --git a/meta-app-framework/recipes-connectivity/connman/connman_%.bbappend b/meta-app-framework/recipes-connectivity/connman/connman_%.bbappend deleted file mode 100644 index 72aa9f276..000000000 --- a/meta-app-framework/recipes-connectivity/connman/connman_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'connman_appfw.inc', '', d)} diff --git a/meta-app-framework/recipes-connectivity/connman/connman_appfw.inc b/meta-app-framework/recipes-connectivity/connman/connman_appfw.inc deleted file mode 100644 index 644602021..000000000 --- a/meta-app-framework/recipes-connectivity/connman/connman_appfw.inc +++ /dev/null @@ -1,34 +0,0 @@ -# Recent ConnMan releases started limiting the capabilities of -# ConnMan. When running on a Smack-enabled system, that change has the -# effect that connmand can no longer change network settings under -# /proc/net because the Smack label of /proc is "_", and connmand -# running with label "System" has no write access to that. -# -# It works when running as normal root with unrestricted capabilities -# because then CAP_MAC_OVERRIDE (a Smack-specific capability) allows -# the process to ignore Smack rules. -# -# We need to ensure that connmand still has that capability. -# -# The alternative would be to set up fine-grained labelling of -# /proc with corresponding rules, which is considerably more work -# and also may depend on kernel changes (like supporting smackfsroot -# for procfs, which seems to be missing at the moment). -# -# Because the solution is to some extend specific to the environment -# in which connmand runs, this change is not submitted upstream -# and it can be overridden by a distro via FIX_CONNMAN_CAPABILITIES. - -FILESEXTRAPATHS:prepend := "${THISDIR}/files:" - -SRC_URI:append:with-lsm-smack = "\ - file://connman.service.conf \ -" - -RDEPENDS:${PN}:append:with-lsm-smack = " smack" - -FILES:${PN}:append = " ${systemd_unitdir}" - -do_install:append:with-lsm-smack() { - install -Dm0644 ${WORKDIR}/connman.service.conf ${D}${systemd_unitdir}/system/connman.service.d/smack.conf -} diff --git a/meta-app-framework/recipes-connectivity/connman/files/connman.service.conf b/meta-app-framework/recipes-connectivity/connman/files/connman.service.conf deleted file mode 100644 index 6ebbf6ad1..000000000 --- a/meta-app-framework/recipes-connectivity/connman/files/connman.service.conf +++ /dev/null @@ -1,4 +0,0 @@ -[Service] -CapabilityBoundingSet=CAP_MAC_OVERRIDE -ExecStartPre=+-/bin/mkdir -p /run/connman -ExecStartPre=+-/usr/bin/chsmack -t -a System::Shared /run/connman diff --git a/meta-app-framework/recipes-core/af-binder/af-binder-devtools-native_git.bb b/meta-app-framework/recipes-core/af-binder/af-binder-devtools-native_git.bb deleted file mode 100644 index 1331fb886..000000000 --- a/meta-app-framework/recipes-core/af-binder/af-binder-devtools-native_git.bb +++ /dev/null @@ -1,8 +0,0 @@ -require af-binder_${PV}.inc - -DEPENDS = "json-c-native" - -inherit cmake pkgconfig native - -EXTRA_OECMAKE:append = " -DONLY_DEVTOOLS=TRUE" - diff --git a/meta-app-framework/recipes-core/af-binder/af-binder_git.bb b/meta-app-framework/recipes-core/af-binder/af-binder_git.bb deleted file mode 100644 index 4728e47ea..000000000 --- a/meta-app-framework/recipes-core/af-binder/af-binder_git.bb +++ /dev/null @@ -1,117 +0,0 @@ -require af-binder_${PV}.inc - -DEPENDS = "file json-c libmicrohttpd systemd util-linux openssl cynara" - -inherit cmake pkgconfig - -EXTRA_OECMAKE:append:class-target = "\ - -DUNITDIR_SYSTEM=${systemd_system_unitdir} \ -" - -EXTRA_OECMAKE:append:agl-devel = " \ - -DAGL_DEVEL=ON \ - -DINCLUDE_MONITORING=ON \ - -DINCLUDE_SUPERVISOR=ON -DAFS_SUPERVISION_SOCKET=/run/platform/supervisor \ -" - -pkg_postinst:${PN}() { - mkdir -p "$D${libdir}/afb" -} - -do_install:append:agl-devel:class-target() { - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -d -m 0755 ${D}${systemd_system_unitdir}/multi-user.target.wants - ln -s ../afm-api-supervisor.service ${D}${systemd_system_unitdir}/multi-user.target.wants/afm-api-supervisor.service - fi -} - -############################################# -# main package -############################################# - -FILES:${PN}:append:agl-devel = " ${libdir}/afb/monitoring ${systemd_system_unitdir}" - -RDEPENDS:${PN}-dev += "libafbwsc-dev" - -############################################# -# intrinsic binding packages -############################################# -PACKAGES =+ "${PN}-intrinsic-bindings" -ALLOW_EMPTY:${PN}-intrinsic-bindings = "1" - -PACKAGES_DYNAMIC = "${PN}-binding-*" - -python populate_packages:prepend () { - afb_libdir = d.expand('${libdir}/afb') - postinst = d.getVar('binding_postinst', True) - pkgs = [] - - pkgs += do_split_packages(d, afb_libdir, '(.*)-api\.so$', d.expand('${PN}-binding-%s'), 'AFB binding for %s', postinst=postinst, extra_depends=d.expand('${PN}')) - pkgs += do_split_packages(d, afb_libdir, '(.*(?!-api))\.so$', d.expand('${PN}-binding-%s'), 'AFB binding for %s', postinst=postinst, extra_depends=d.expand('${PN}')) - - d.setVar('RDEPENDS:' + d.getVar('PN', True) + '-intrinsic-bindings', ' '.join(pkgs)) -} - -############################################# -# tool package -############################################# -PACKAGES =+ "${PN}-tools" - -FILES:${PN}-tools = "\ - ${bindir}/afb-client-demo \ -" - -############################################# -# setup libafbwsc package -############################################# -PACKAGES =+ "libafbwsc libafbwsc-dev" - -FILES:libafbwsc = "\ - ${libdir}/libafbwsc.so.* \ -" -FILES:libafbwsc-dev = "\ - ${includedir}/afb/afb-wsj1.h \ - ${includedir}/afb/afb-ws-client.h \ - ${libdir}/libafbwsc.so \ - ${libdir}/pkgconfig/libafbwsc.pc \ -" - -############################################# -# devtool package -############################################# -PACKAGES =+ "${PN}-devtools" - -FILES:${PN}-devtools = "\ - ${bindir}/afb-exprefs \ - ${bindir}/afb-json2c \ - ${bindir}/afb-genskel \ -" - -############################################# -# supervisor package -############################################# -PACKAGES:append:agl-devel = " ${PN}-supervisor " - -FILES:${PN}-supervisor:agl-devel = "\ - ${bindir}/afs-supervisor \ - ${systemd_system_unitdir} \ -" - -############################################# -# setup sample packages -############################################# -PACKAGES =+ "${PN}-samples" - -FILES:${PN}-samples = "\ - ${datadir}/af-binder \ -" - -############################################# -# meta package -############################################# -PACKAGES =+ "${PN}-meta" -ALLOW_EMPTY:${PN}-meta = "1" - -RDEPENDS:${PN}-meta += "${PN} ${PN}-tools libafbwsc ${PN}-intrinsic-bindings" -RDEPENDS:${PN}-meta:append:agl-devel = " ${PN}-supervisor " - diff --git a/meta-app-framework/recipes-core/af-binder/af-binder_git.inc b/meta-app-framework/recipes-core/af-binder/af-binder_git.inc deleted file mode 100644 index 50f60f7c7..000000000 --- a/meta-app-framework/recipes-core/af-binder/af-binder_git.inc +++ /dev/null @@ -1,22 +0,0 @@ -SUMMARY = "HTTP REST interface to automotive backends for HTML5 UI support" -DESCRIPTION = "Automotive-Framework-Binder Daemon provides a HTTP REST \ -interface to various automotive-oriented bindings, \ -allowing HTML5 UIs to send platform-specific requests in a secure way." - -HOMEPAGE = "https://gerrit.automotivelinux.org/gerrit/#/admin/projects/src/app-framework-binder" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE-2.0.txt;md5=3b83ef96387f14655fc854ddc3c6bd57" - -SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/app-framework-binder;protocol=https;branch=${AGL_BRANCH}" - -SRCREV = "c5c15f86d2eaaa5ac72f0ac00634a978326daae9" -PV = "${AGL_BRANCH}+git${SRCPV}" - -S = "${WORKDIR}/git" - -CFLAGS:append:agl-devel = " -DAGL_DEVEL" - -EXTRA_OECMAKE:append = "\ - -DAGLVERSION=${AGLVERSION} \ -" - diff --git a/meta-app-framework/recipes-core/af-binder/nativesdk-af-binder-devtools_git.bb b/meta-app-framework/recipes-core/af-binder/nativesdk-af-binder-devtools_git.bb deleted file mode 100644 index 334d073c2..000000000 --- a/meta-app-framework/recipes-core/af-binder/nativesdk-af-binder-devtools_git.bb +++ /dev/null @@ -1,8 +0,0 @@ -require af-binder_${PV}.inc - -DEPENDS = "nativesdk-json-c" - -inherit cmake pkgconfig nativesdk - -EXTRA_OECMAKE:append = " -DONLY_DEVTOOLS=TRUE" - diff --git a/meta-app-framework/recipes-core/af-main/af-main_git.bb b/meta-app-framework/recipes-core/af-main/af-main_git.bb deleted file mode 100644 index 8e72e4572..000000000 --- a/meta-app-framework/recipes-core/af-main/af-main_git.bb +++ /dev/null @@ -1,122 +0,0 @@ -require af-main_${PV}.inc - -# NOTE: using libcap-native and setcap in install doesn't work -# NOTE: maybe setting afm_name to agl-framework is cleaner but has implications -# NOTE: there is a hack of security for using groups and dbus (to be checked) -# NOTE: using ZIP programs creates directories with mode 777 (very bad) - -inherit cmake pkgconfig useradd systemd -BBCLASSEXTEND = "native" - -SECTION = "base" - -DEPENDS = "openssl libxml2 xmlsec1 systemd libzip json-c systemd security-manager af-binder sed m4" -DEPENDS:class-native = "openssl libxml2 xmlsec1 libzip json-c" -RDEPENDS:${PN}:class-target += "af-binder-tools nss-localuser cynagoauth" - -PACKAGE_WRITE_DEPS:append:with-lsm-smack = " smack-native libcap-native" - -EXTRA_OECMAKE:append:class-native = "\ - -DUSE_LIBZIP=1 \ - -DUSE_SIMULATION=1 \ - -DUSE_SDK=1 \ - -DAGLVERSION=${AGLVERSION} \ - -Dafm_name=${afm_name} \ - -Dafm_confdir=${afm_confdir} \ - -Dafm_datadir=${afm_datadir} \ -" - -EXTRA_OECMAKE:append:class-target = "\ - -DUSE_LIBZIP=1 \ - -DUSE_SIMULATION=0 \ - -DUSE_SDK=0 \ - -DAGLVERSION=${AGLVERSION} \ - -Dafm_name=${afm_name} \ - -Dafm_confdir=${afm_confdir} \ - -Dafm_datadir=${afm_datadir} \ - -Dsystemd_units_root=${systemd_units_root} \ - -DUNITDIR_USER=${systemd_user_unitdir} \ - -DUNITDIR_SYSTEM=${systemd_system_unitdir} \ -" - -# ------------------------ WARNING WARNING WARNNING --------------------------- -# -# ATM (FF.rc2), forcing all apps to be signed is an issue when building without -# agl-devel feature. A workaround is to define ALLOW_NO_SIGNATURE=ON for all -# builds but this must be removed later. See SPEC-1614 for more details. -# -# A variable AGL_FORBID_UNSIGNED_APPS is introduced to enable/disable this -# workaround in local.conf and allow transition to signed apps: -# * forbid unsigned apps by setting: AGL_FORBID_UNSIGNED_APPS="1" -# * [DEFAULT] allow unsigned apps: do nothing (or set: AGL_FORBID_UNSIGNED_APPS="0") -AGL_FORBID_UNSIGNED_APPS ?= "0" -# -# WORKAROUND: -EXTRA_OECMAKE:append:agl-devel = " -DAGL_DEVEL=1" -EXTRA_OECMAKE:append = " ${@bb.utils.contains('AGL_FORBID_UNSIGNED_APPS','1','','-DALLOW_NO_SIGNATURE=ON', d)}" -# -# Correct version (IMPORTANT TODO: to be restored later): -#EXTRA_OECMAKE:append:agl-devel = " -DAGL_DEVEL=1 -DALLOW_NO_SIGNATURE=ON" -# -# ------------------------ WARNING WARNING WARNNING --------------------------- - - -USERADD_PACKAGES = "${PN}" -USERADD_PARAM:${PN} = "--system --gid ${afm_name} --home-dir ${afm_datadir} ${afm_name}" -GROUPADD_PARAM:${PN} = "--system ${afm_name}" - -RDEPENDS:${PN}:append:with-lsm-smack = " smack bash" -DEPENDS:append:with-lsm-smack = " smack-native" - -do_install:append:class-target() { - install -d ${D}${bindir} - install -d -m 0775 ${D}${systemd_units_root}/system - install -d -m 0775 "${D}${systemd_units_root}/system/multi-user.target.wants" - install -d -m 0775 "${D}${systemd_units_root}/system/afm-user-session@.target.wants" - install -d -m 0775 ${D}${systemd_units_root}/user - install -d -m 0775 ${D}${systemd_units_root}/user/default.target.wants - install -d -m 0775 ${D}${systemd_units_root}/user/sockets.target.wants - install -d ${D}${afm_datadir}/applications - install -d ${D}${afm_datadir}/icons - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -d -m 0755 ${D}${systemd_system_unitdir}/multi-user.target.wants - install -d -m 0755 ${D}${systemd_system_unitdir}/sockets.target.wants - ln -sf ../afm-system-setup.service ${D}${systemd_system_unitdir}/multi-user.target.wants/afm-system-setup.service - ln -sf ../afm-system-daemon.service ${D}${systemd_system_unitdir}/multi-user.target.wants/afm-system-daemon.service - ln -sf ../afm-system-daemon.socket ${D}${systemd_system_unitdir}/sockets.target.wants/afm-system-daemon.socket - fi -} - -pkg_postinst_ontarget:${PN}() { - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - chgrp ${afm_name} $D${systemd_units_root}/system - chgrp ${afm_name} $D${systemd_units_root}/system/afm-user-session@.target.wants - chgrp ${afm_name} $D${systemd_units_root}/user/default.target.wants - chgrp ${afm_name} $D${systemd_units_root}/user/sockets.target.wants - fi - chown ${afm_name}:${afm_name} $D${afm_datadir} - chown ${afm_name}:${afm_name} $D${afm_datadir}/applications - chown ${afm_name}:${afm_name} $D${afm_datadir}/icons -} - -pkg_postinst_ontarget:${PN}:append:with-lsm-smack() { - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - chsmack -a 'System::Shared' -t $D${systemd_units_root}/system - chsmack -a 'System::Shared' -t $D${systemd_units_root}/system/afm-user-session@.target.wants - chsmack -a 'System::Shared' -t $D${systemd_units_root}/user/default.target.wants - chsmack -a 'System::Shared' -t $D${systemd_units_root}/user/sockets.target.wants - fi - chsmack -a 'System::Shared' -t $D${afm_datadir} - chsmack -a 'System::Shared' -t $D${afm_datadir}/applications - chsmack -a 'System::Shared' -t $D${afm_datadir}/icons -} -FILES:${PN} += "${systemd_units_root}/* ${systemd_system_unitdir} ${systemd_user_unitdir}" -FILES:${PN}:append:agl-sign-wgts = " ${datadir}/afm" - -PACKAGES =+ "${PN}-binding ${PN}-binding-dbg" -FILES:${PN}-binding = " ${afb_binding_dir}/afm-main-binding.so " -FILES:${PN}-binding-dbg = " ${afb_binding_dir}/.debug/afm-main-binding.so " - -PACKAGES =+ "${PN}-tools ${PN}-tools-dbg" -FILES:${PN}-tools = "${bindir}/wgtpkg-*" -FILES:${PN}-tools-dbg = "${bindir}/.debug/wgtpkg-*" diff --git a/meta-app-framework/recipes-core/af-main/af-main_git.inc b/meta-app-framework/recipes-core/af-main/af-main_git.inc deleted file mode 100644 index 11d563a34..000000000 --- a/meta-app-framework/recipes-core/af-main/af-main_git.inc +++ /dev/null @@ -1,30 +0,0 @@ -SUMMARY = "AGL Framework Main part" -DESCRIPTION = "\ -This is a core framework component for managing \ -applications, widgets, and components. \ -" - -HOMEPAGE = "https://gerrit.automotivelinux.org/gerrit/#/admin/projects/src/app-framework-main" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57" - -SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/app-framework-main;protocol=https;branch=${AGL_BRANCH}" - -SRCREV = "3ea6f4a404d2486ef1c5da55f1cd0d98c594f157" -PV = "${AGL_BRANCH}+git${SRCPV}" - -S = "${WORKDIR}/git" - -afm_name = "afm" -afm_confdir = "${sysconfdir}/${afm_name}" -afm_datadir = "/var/local/lib/${afm_name}" -afb_binding_dir = "${libdir}/afb" -systemd_units_root = "/var/local/lib/systemd" - -CFLAGS:append:agl-devel = " -DAGL_DEVEL" -# only install sample keys in agl-devel mode -# for production you need to deploy real keys -EXTRA_OECMAKE:append:agl-sign-wgts = " ${@bb.utils.contains('DISTRO_FEATURES', 'agl-devel', '-DINSTALL_SAMPLE_KEYS=ON', '-DINSTALL_SAMPLE_KEYS=OFF', d)}" - - - diff --git a/meta-app-framework/recipes-core/af-main/nativesdk-af-main_git.bb b/meta-app-framework/recipes-core/af-main/nativesdk-af-main_git.bb deleted file mode 100644 index 4564831a8..000000000 --- a/meta-app-framework/recipes-core/af-main/nativesdk-af-main_git.bb +++ /dev/null @@ -1,27 +0,0 @@ -require af-main_${PV}.inc - -inherit nativesdk cmake pkgconfig - -SECTION = "base" - -DEPENDS = "nativesdk-openssl nativesdk-libxml2 nativesdk-xmlsec1 nativesdk-libzip nativesdk-json-c" - -EXTRA_OECMAKE = "\ - -DUSE_LIBZIP=1 \ - -DUSE_SIMULATION=1 \ - -DUSE_SDK=1 \ - -DAGLVERSION=${AGLVERSION} \ - -Dafm_name=${afm_name} \ - -Dafm_confdir=${afm_confdir} \ - -Dafm_datadir=${afm_datadir} \ -" - -do_install:append() { - # remove unused .pc file we don't want to package - rm -rf ${D}/${libdir} -} - -PACKAGES = "${PN}-tools ${PN}-tools-dbg" -FILES:${PN}-tools = "${bindir}/wgtpkg-* ${afm_confdir}/*" -FILES:${PN}-tools:append:agl-sign-wgts = " ${datadir}/afm" -FILES:${PN}-tools-dbg = "${bindir}/.debug/wgtpkg-*" diff --git a/meta-app-framework/recipes-core/af-platform-setup/af-platform-setup_1.0.bb b/meta-app-framework/recipes-core/af-platform-setup/af-platform-setup_1.0.bb deleted file mode 100644 index 52c7a6534..000000000 --- a/meta-app-framework/recipes-core/af-platform-setup/af-platform-setup_1.0.bb +++ /dev/null @@ -1,16 +0,0 @@ -HOMEPAGE = "here" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" - -SRC_URI = "file://udev-shared.conf" - -S = "${WORKDIR}" - -do_install() { - d=${D}${systemd_system_unitdir}/systemd-udevd.service.d - install -d $d - install -m 0644 ${S}/udev-shared.conf $d -} - -FILES:${PN} = "${systemd_system_unitdir}" diff --git a/meta-app-framework/recipes-core/af-platform-setup/files/udev-shared.conf b/meta-app-framework/recipes-core/af-platform-setup/files/udev-shared.conf deleted file mode 100644 index cce02bc58..000000000 --- a/meta-app-framework/recipes-core/af-platform-setup/files/udev-shared.conf +++ /dev/null @@ -1,4 +0,0 @@ -[Service] -ExecStartPre=/bin/mkdir -p /run/udev -ExecStartPre=/usr/bin/chsmack -r -a System::Shared -t /run/udev - diff --git a/meta-app-framework/recipes-core/applaunchd/applaunchd/agl-app-flutter@.service b/meta-app-framework/recipes-core/applaunchd/applaunchd/agl-app-flutter@.service new file mode 100644 index 000000000..a9a2527e0 --- /dev/null +++ b/meta-app-framework/recipes-core/applaunchd/applaunchd/agl-app-flutter@.service @@ -0,0 +1,12 @@ +[Unit] +Description=%I + +[Service] +Type=simple +User=agl-driver +Environment=FLUTTER_VERSION=3.3.7 +Environment=FLUTTER_RUNTIME=release +EnvironmentFile=-/etc/default/flutter +EnvironmentFile=-/etc/default/%I +Environment=XDG_RUNTIME_DIR=/run/user/1001/ +ExecStart=/usr/bin/flutter-auto --b=/usr/share/flutter/%I/${FLUTTER_VERSION}/${FLUTTER_RUNTIME} --xdg-shell-app-id=%I diff --git a/meta-app-framework/recipes-core/applaunchd/applaunchd/agl-app-web@.service b/meta-app-framework/recipes-core/applaunchd/applaunchd/agl-app-web@.service new file mode 100644 index 000000000..e0353b6ae --- /dev/null +++ b/meta-app-framework/recipes-core/applaunchd/applaunchd/agl-app-web@.service @@ -0,0 +1,11 @@ +[Unit] +Description=%I + +[Service] +Type=simple +User=agl-driver +EnvironmentFile=-/etc/default/WebAppMgr.env +Environment=XDG_RUNTIME_DIR=/run/user/1001/ +Environment=AGL_APP_WAM_DIR=%I +ExecStart=/usr/bin/WebAppMgrCli --appid=%I --app-install-dir=/usr/lib/wam_apps/${AGL_APP_WAM_DIR}/ + diff --git a/meta-app-framework/recipes-core/applaunchd/applaunchd/agl-app@.service b/meta-app-framework/recipes-core/applaunchd/applaunchd/agl-app@.service new file mode 100644 index 000000000..234348846 --- /dev/null +++ b/meta-app-framework/recipes-core/applaunchd/applaunchd/agl-app@.service @@ -0,0 +1,8 @@ +[Unit] +Description=%I + +[Service] +Type=simple +User=agl-driver +Environment=XDG_RUNTIME_DIR=/run/user/1001/ +ExecStart=%i diff --git a/meta-app-framework/recipes-core/applaunchd/applaunchd/applaunchd.service b/meta-app-framework/recipes-core/applaunchd/applaunchd/applaunchd.service new file mode 100644 index 000000000..73d36bd0c --- /dev/null +++ b/meta-app-framework/recipes-core/applaunchd/applaunchd/applaunchd.service @@ -0,0 +1,13 @@ +[Unit] +Wants=network.target polkit.service +After=network.target polkit.service + +[Service] +Type=notify +User=applaunchd +Environment=XDG_DATA_DIRS=/usr/share +ExecStart=/usr/bin/applaunchd +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/meta-app-framework/recipes-core/applaunchd/applaunchd/no-network.conf b/meta-app-framework/recipes-core/applaunchd/applaunchd/no-network.conf new file mode 100644 index 000000000..c7c4f8a31 --- /dev/null +++ b/meta-app-framework/recipes-core/applaunchd/applaunchd/no-network.conf @@ -0,0 +1,2 @@ +[Service] +PrivateNetwork=true diff --git a/meta-app-framework/recipes-core/applaunchd/applaunchd/private-tmp.conf b/meta-app-framework/recipes-core/applaunchd/applaunchd/private-tmp.conf new file mode 100644 index 000000000..0bdba7c99 --- /dev/null +++ b/meta-app-framework/recipes-core/applaunchd/applaunchd/private-tmp.conf @@ -0,0 +1,2 @@ +[Service] +PrivateTmp=yes diff --git a/meta-app-framework/recipes-core/applaunchd/applaunchd_git.bb b/meta-app-framework/recipes-core/applaunchd/applaunchd_git.bb new file mode 100644 index 000000000..c1bafad8e --- /dev/null +++ b/meta-app-framework/recipes-core/applaunchd/applaunchd_git.bb @@ -0,0 +1,78 @@ +SUMMARY = "AGL Application Launcher service" +DESCRIPTION = "AGL Application Launcher service build with recipe method" +HOMEPAGE = "https://git.automotivelinux.org/src/applaunchd" +SECTION = "apps" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=ae6497158920d9524cf208c09cc4c984" + +DEPENDS = " \ + glib-2.0 \ + glib-2.0-native \ + protobuf-native \ + grpc-native \ + grpc \ + systemd \ +" + +PV = "2.0+git${SRCPV}" + +SRC_URI = " \ + git://gerrit.automotivelinux.org/gerrit/src/applaunchd;protocol=https;branch=${AGL_BRANCH} \ + file://applaunchd.service \ + file://agl-app@.service \ + file://agl-app-web@.service \ + file://agl-app-flutter@.service \ + file://no-network.conf \ + file://private-tmp.conf \ +" +SRCREV = "c32fe42f40d0af8b31b6113a3140f52b83be7769" + +S = "${WORKDIR}/git" + +inherit meson pkgconfig systemd useradd features_check + +REQUIRED_DISTRO_FEATURES = "systemd polkit" + +USERADD_PACKAGES = "${PN}" +USERADDEXTENSION = "useradd-staticids" +GROUPADD_PARAM:${PN} = "-g 1003 applaunchd ; " +USERADD_PARAM:${PN} = "\ + -g 1003 -u 1003 -o -d / -K PASS_MAX_DAYS=-1 applaunchd ; \ +" + +SYSTEMD_SERVICE:${PN} = "applaunchd.service" + +do_install:append() { + # Install generic template for all agl-app services + install -d ${D}${systemd_system_unitdir} + install -m 644 ${WORKDIR}/applaunchd.service ${D}${systemd_system_unitdir}/ + install -m 644 ${WORKDIR}/agl-app@.service ${D}${systemd_system_unitdir}/ + install -m 644 ${WORKDIR}/agl-app-web@.service ${D}${systemd_system_unitdir}/ + install -m 644 ${WORKDIR}/agl-app-flutter@.service ${D}${systemd_system_unitdir}/ + + # Install individual sandboxing overrides/drop-ins to be used by apps + install -d ${D}${systemd_system_unitdir}/sandboxing + install -m 644 ${WORKDIR}/no-network.conf ${D}${systemd_system_unitdir}/sandboxing/ + install -m 644 ${WORKDIR}/private-tmp.conf ${D}${systemd_system_unitdir}/sandboxing/ +} + +PACKAGE_BEFORE_PN += "${PN}-template-agl-app ${PN}-template-agl-app-web ${PN}-template-agl-app-flutter" + +FILES:${PN} += "${systemd_system_unitdir}" + +FILES:${PN}-template-agl-app = "${systemd_system_unitdir}/agl-app@.service" + +FILES:${PN}-template-agl-app-web = "${systemd_system_unitdir}/agl-app-web@.service" + +FILES:${PN}-template-agl-app-flutter = "${systemd_system_unitdir}/agl-app-flutter@.service" + +RDEPENDS:${PN} += " \ + agl-users \ + polkit-rule-agl-app \ +" + +RDEPENDS:${PN}-template-agl-app = "${PN}" + +RDEPENDS:${PN}-template-agl-app-web = "${PN}" + +RDEPENDS:${PN}-template-agl-app-flutter = "${PN}" diff --git a/meta-app-framework/recipes-core/base-files/base-files_%.bbappend b/meta-app-framework/recipes-core/base-files/base-files_%.bbappend deleted file mode 100644 index 28b08face..000000000 --- a/meta-app-framework/recipes-core/base-files/base-files_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'base-files_appfw.inc', '', d)} diff --git a/meta-app-framework/recipes-core/base-files/base-files_appfw.inc b/meta-app-framework/recipes-core/base-files/base-files_appfw.inc deleted file mode 100644 index 4c8301314..000000000 --- a/meta-app-framework/recipes-core/base-files/base-files_appfw.inc +++ /dev/null @@ -1,113 +0,0 @@ -RDEPENDS:${PN}:append:with-lsm-smack = " smack" -PACKAGE_WRITE_DEPS:append:with-lsm-smack = " smack-native" - -do_install:append() { - install -m 0700 -d ${D}/${sysconfdir}/skel - chmod -R 0700 ${D}/${sysconfdir}/skel - install -m 0700 -d ${D}/${sysconfdir}/skel/app-data - install -m 0700 -d ${D}/${sysconfdir}/skel/.config - install -m 0755 -d ${D}/var - if [ -d ${D}/usr/local ]; then - mv ${D}/usr/local ${D}/var - else - install -m 0755 -d ${D}/var/local - fi - ln -s ../var/local ${D}/usr/local -} - -do_install:append:with-lsm-smack () { - install -d ${D}/${sysconfdir}/smack/accesses.d - cat > ${D}/${sysconfdir}/smack/accesses.d/default-access-domains-no-user <<EOF -System User::App-Shared rwxat -System User::Home rwxat -EOF - chmod 0644 ${D}/${sysconfdir}/smack/accesses.d/default-access-domains-no-user -} - -pkg_postinst:${PN}:append:with-lsm-smack() { - chsmack -r -a 'User::Home' -t -D $D/${sysconfdir}/skel - chsmack -a 'User::App-Shared' -D $D/${sysconfdir}/skel/app-data - cp -rTf --preserve=all $D/${sysconfdir}/skel $D/${ROOT_HOME} -} - - - -# Install default Smack rules, copied from a running Tizen IVI 3.0. -# Corresponds to manifest file from default-access-domains in Tizen: -# https://review.tizen.org/git?p=platform/core/security/default-ac-domains.git;a=blob;f=packaging/default-ac-domains.manifest -do_install:append:with-lsm-smack () { - install -d ${D}/${sysconfdir}/smack/accesses.d - cat >${D}/${sysconfdir}/smack/accesses.d/default-access-domains <<EOF -System _ -----l -System System::Log rwxa-- -System System::Run rwxat- -System System::Shared rwxat- -System ^ rwxa-- -_ System::Run rwxat- -_ System -wx--- -^ System::Log rwxa-- -^ System::Run rwxat- -^ System rwxa-- -EOF - chmod 0644 ${D}/${sysconfdir}/smack/accesses.d/default-access-domains - - install -d ${D}/${libdir}/tmpfiles.d - cat >${D}/${libdir}/tmpfiles.d/packet-forwarding.conf <<EOF -t /proc/sys/net/ipv4/conf/all/forwarding - - - - security.SMACK64=* -t /proc/sys/net/ipv6/conf/all/forwarding - - - - security.SMACK64=* -t /proc/sys/net/ipv4/conf/default/forwarding - - - - security.SMACK64=* -t /proc/sys/net/ipv6/conf/default/forwarding - - - - security.SMACK64=* -EOF - chmod 0644 ${D}/${libdir}/tmpfiles.d/packet-forwarding.conf - - install -d ${D}/${base_libdir}/udev/rules.d - cat >${D}/${base_libdir}/udev/rules.d/85-netdev-ipconf-smacklabel.rules <<EOF -SUBSYSTEM=="net", ENV{ID_NET_NAME}=="", RUN+="/bin/sh -c '/usr/bin/chsmack -a \* /proc/sys/net/ipv4/conf/%k/*'", RUN+="/bin/sh -c '/usr/bin/chsmack -a \* /proc/sys/net/ipv6/conf/%k/*'" - -SUBSYSTEM=="net", ENV{ID_NET_NAME}!="", RUN+="/bin/sh -c '/usr/bin/chsmack -a \* /proc/sys/net/ipv4/conf/\$env{ID_NET_NAME}/*'", RUN+="/bin/sh -c '/usr/bin/chsmack -a \* /proc/sys/net/ipv6/conf/\$env{ID_NET_NAME}/*'" -EOF - chmod 0644 ${D}/${base_libdir}/udev/rules.d/85-netdev-ipconf-smacklabel.rules -} - -# Do not rely on an rpm with manifest support. Apparently that approach -# will no longer be used in Tizen 3.0. Instead set special Smack attributes -# via postinst. This is much easier to use with bitbake, too: -# - no need to maintain a patched rpm -# - works for directories which are not packaged by default when empty -RDEPENDS:${PN}:append:with-lsm-smack = " smack" -DEPENDS:append:with-lsm-smack = " smack-native" -pkg_postinst:${PN}:with-lsm-smack() { - #!/bin/sh -e - - # https://review.tizen.org/gerrit/gitweb?p=platform/upstream/filesystem.git;a=blob;f=packaging/filesystem.manifest: - # <filesystem path="/etc" label="System::Shared" type="transmutable" /> - install -d $D${sysconfdir} - # This has no effect on files installed into /etc during image construction - # because pseudo does not know the special semantic of SMACK::TRANSMUTE. - # To avoid having different xattrs on files inside /etc when pre-installed - # in an image vs. installed on a device, the xattr-images.bbclass has - # a workaround for this deficiency in pseudo. - chsmack -t $D${sysconfdir} - chsmack -a 'System::Shared' $D${sysconfdir} - - # Same for /media. Any daemon running as "System" will get write access - # to everything. - install -d $D/media - chsmack -t $D/media - chsmack -a 'System::Shared' $D/media - - # Same for /var. Any daemon running as "System" will get write access - # to everything. - install -d $D${localstatedir} - chsmack -t $D${localstatedir} - chsmack -a 'System::Shared' $D${localstatedir} - - # <filesystem path="/tmp" label="*" /> - mkdir -p $D/tmp - chsmack -a '*' $D/tmp - - # <filesystem path="/var/log" label="System::Log" type="transmutable" /> - # <filesystem path="/var/tmp" label="*" /> - # These are in a file system mounted by systemd. We patch the systemd service - # to set these attributes. -} diff --git a/meta-app-framework/recipes-core/coreutils/coreutils_%.bbappend b/meta-app-framework/recipes-core/coreutils/coreutils_%.bbappend deleted file mode 100644 index b7bf9fff4..000000000 --- a/meta-app-framework/recipes-core/coreutils/coreutils_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'coreutils_appfw.inc', '', d)} diff --git a/meta-app-framework/recipes-core/coreutils/coreutils_appfw.inc b/meta-app-framework/recipes-core/coreutils/coreutils_appfw.inc deleted file mode 100644 index 234487531..000000000 --- a/meta-app-framework/recipes-core/coreutils/coreutils_appfw.inc +++ /dev/null @@ -1,7 +0,0 @@ -# Smack patches are included in coreutils v8.22, we just need to enable them. -# The default is not deterministic (enabled if libsmack found), so disable -# explicitly otherwise. -EXTRA_OECONF_SMACK:class-target = "--disable-libsmack" -EXTRA_OECONF_SMACK:with-lsm-smack:class-target = "--enable-libsmack" -EXTRA_OECONF:append:class-target = " ${EXTRA_OECONF_SMACK}" -DEPENDS:append:with-lsm-smack:class-target = " smack" diff --git a/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0001-Integration-of-Cynara-asynchronous-security-checks.patch b/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0001-Integration-of-Cynara-asynchronous-security-checks.patch deleted file mode 100644 index 55cedb9c7..000000000 --- a/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0001-Integration-of-Cynara-asynchronous-security-checks.patch +++ /dev/null @@ -1,2309 +0,0 @@ -From ea4b650366261e4257e4b0fb95e7f48e30ef36f0 Mon Sep 17 00:00:00 2001 -From: Jacek Bukarewicz <j.bukarewicz@samsung.com> -Date: Thu, 27 Nov 2014 18:11:05 +0100 -Subject: [PATCH 1/8] Integration of Cynara asynchronous security checks -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This commit introduces basic framework for asynchronous policy -checks and Cynara integration code. Functions for checking security -policy can now return third value - BUS_RESULT_LATER denoting check -result unavailability. Whenever policy checker cannot decide on the -result of the check it is supposed to allocate DeferredMessage structure -that will be passed to the upper layers which can decide what should be -done in such situation. -Proper handling of such case will be implemented in subsequent commits. -Currently such return value results in message denial. - -Cherry picked from 4dcfb02f17247ff9de966b62182cd2e08f301238 -by José Bollo. - -Updated for dbus 1.10.20 by Scott Murray and José Bollo -Updated for dbus 1.12.16 by José Bollo - -Change-Id: I9bcbce34577e5dc2a3cecf6233a0a2b0e43e1108 -Signed-off-by: José Bollo <jose.bollo@iot.bzh> -Signed-off-by: Scott Murray <scott.murray@konsulko.com> ---- - bus/Makefile.am | 6 + - bus/activation.c | 5 +- - bus/bus.c | 124 ++++-- - bus/bus.h | 22 +- - bus/check.c | 217 ++++++++++ - bus/check.h | 68 ++++ - bus/config-parser-common.c | 6 + - bus/config-parser-common.h | 1 + - bus/config-parser-trivial.c | 2 + - bus/config-parser.c | 72 +++- - bus/connection.c | 57 ++- - bus/connection.h | 4 + - bus/cynara.c | 374 ++++++++++++++++++ - bus/cynara.h | 37 ++ - bus/dispatch.c | 46 ++- - bus/driver.h | 2 + - bus/policy.c | 195 ++++++--- - bus/policy.h | 29 +- - configure.ac | 12 + - test/Makefile.am | 1 + - .../data/invalid-config-files/badcheck-1.conf | 9 + - .../data/invalid-config-files/badcheck-2.conf | 9 + - test/data/valid-config-files/check-1.conf | 9 + - .../debug-check-some.conf.in | 18 + - 24 files changed, 1181 insertions(+), 144 deletions(-) - create mode 100644 bus/check.c - create mode 100644 bus/check.h - create mode 100644 bus/cynara.c - create mode 100644 bus/cynara.h - create mode 100644 test/data/invalid-config-files/badcheck-1.conf - create mode 100644 test/data/invalid-config-files/badcheck-2.conf - create mode 100644 test/data/valid-config-files/check-1.conf - create mode 100644 test/data/valid-config-files/debug-check-some.conf.in - -diff --git a/bus/Makefile.am b/bus/Makefile.am -index c917063..2a8a72c 100644 ---- a/bus/Makefile.am -+++ b/bus/Makefile.am -@@ -13,6 +13,7 @@ DBUS_BUS_LIBS = \ - $(THREAD_LIBS) \ - $(ADT_LIBS) \ - $(NETWORK_libs) \ -+ $(CYNARA_LIBS) \ - $(NULL) - - DBUS_LAUNCHER_LIBS = \ -@@ -30,6 +31,7 @@ AM_CPPFLAGS = \ - $(APPARMOR_CFLAGS) \ - -DDBUS_SYSTEM_CONFIG_FILE=\""$(dbusdatadir)/system.conf"\" \ - -DDBUS_COMPILATION \ -+ $(CYNARA_CFLAGS) \ - $(NULL) - - # if assertions are enabled, improve backtraces -@@ -90,6 +92,8 @@ BUS_SOURCES= \ - audit.h \ - bus.c \ - bus.h \ -+ check.c \ -+ check.h \ - config-loader-expat.c \ - config-parser.c \ - config-parser.h \ -@@ -97,6 +101,8 @@ BUS_SOURCES= \ - config-parser-common.h \ - connection.c \ - connection.h \ -+ cynara.c \ -+ cynara.h \ - desktop-file.c \ - desktop-file.h \ - $(DIR_WATCH_SOURCE) \ -diff --git a/bus/activation.c b/bus/activation.c -index 99404b9..f9c6c62 100644 ---- a/bus/activation.c -+++ b/bus/activation.c -@@ -1789,14 +1789,15 @@ bus_activation_activate_service (BusActivation *activation, - - if (auto_activation && - entry != NULL && -- !bus_context_check_security_policy (activation->context, -+ BUS_RESULT_TRUE != bus_context_check_security_policy (activation->context, - transaction, - connection, /* sender */ - NULL, /* addressed recipient */ - NULL, /* proposed recipient */ - activation_message, - entry, -- error)) -+ error, -+ NULL)) - { - _DBUS_ASSERT_ERROR_IS_SET (error); - _dbus_verbose ("activation not authorized: %s: %s\n", -diff --git a/bus/bus.c b/bus/bus.c -index 2ad8e78..6fc45d0 100644 ---- a/bus/bus.c -+++ b/bus/bus.c -@@ -38,6 +38,7 @@ - #include "apparmor.h" - #include "audit.h" - #include "dir-watch.h" -+#include "check.h" - #include <dbus/dbus-auth.h> - #include <dbus/dbus-list.h> - #include <dbus/dbus-hash.h> -@@ -67,6 +68,7 @@ struct BusContext - BusRegistry *registry; - BusPolicy *policy; - BusMatchmaker *matchmaker; -+ BusCheck *check; - BusLimits limits; - DBusRLimit *initial_fd_limit; - unsigned int fork : 1; -@@ -1003,6 +1005,10 @@ bus_context_new (const DBusString *config_file, - parser = NULL; - } - -+ context->check = bus_check_new(context, error); -+ if (context->check == NULL) -+ goto failed; -+ - dbus_server_free_data_slot (&server_data_slot); - - return context; -@@ -1127,6 +1133,12 @@ bus_context_unref (BusContext *context) - - bus_context_shutdown (context); - -+ if (context->check) -+ { -+ bus_check_unref(context->check); -+ context->check = NULL; -+ } -+ - if (context->connections) - { - bus_connections_unref (context->connections); -@@ -1256,6 +1268,12 @@ bus_context_get_loop (BusContext *context) - return context->loop; - } - -+BusCheck* -+bus_context_get_check (BusContext *context) -+{ -+ return context->check; -+} -+ - dbus_bool_t - bus_context_allow_unix_user (BusContext *context, - unsigned long uid) -@@ -1451,6 +1469,7 @@ complain_about_message (BusContext *context, - DBusConnection *proposed_recipient, - dbus_bool_t requested_reply, - dbus_bool_t log, -+ const char *privilege, - DBusError *error) - { - DBusError stack_error = DBUS_ERROR_INIT; -@@ -1480,7 +1499,8 @@ complain_about_message (BusContext *context, - dbus_set_error (&stack_error, error_name, - "%s, %d matched rules; type=\"%s\", sender=\"%s\" (%s) " - "interface=\"%s\" member=\"%s\" error name=\"%s\" " -- "requested_reply=\"%d\" destination=\"%s\" (%s)", -+ "requested_reply=\"%d\" destination=\"%s\" (%s) " -+ "privilege=\"%s\"", - complaint, - matched_rules, - dbus_message_type_to_string (dbus_message_get_type (message)), -@@ -1491,7 +1511,8 @@ complain_about_message (BusContext *context, - nonnull (dbus_message_get_error_name (message), "(unset)"), - requested_reply, - nonnull (dbus_message_get_destination (message), DBUS_SERVICE_DBUS), -- proposed_recipient_loginfo); -+ proposed_recipient_loginfo, -+ nonnull (privilege, "(n/a)")); - - /* If we hit OOM while setting the error, this will syslog "out of memory" - * which is itself an indication that something is seriously wrong */ -@@ -1519,7 +1540,7 @@ complain_about_message (BusContext *context, - * NULL for addressed_recipient may mean the bus driver, or may mean - * no destination was specified in the message (e.g. a signal). - */ --dbus_bool_t -+BusResult - bus_context_check_security_policy (BusContext *context, - BusTransaction *transaction, - DBusConnection *sender, -@@ -1527,7 +1548,8 @@ bus_context_check_security_policy (BusContext *context, - DBusConnection *proposed_recipient, - DBusMessage *message, - BusActivationEntry *activation_entry, -- DBusError *error) -+ DBusError *error, -+ BusDeferredMessage **deferred_message) - { - const char *src, *dest; - BusClientPolicy *sender_policy; -@@ -1536,6 +1558,7 @@ bus_context_check_security_policy (BusContext *context, - dbus_bool_t log; - int type; - dbus_bool_t requested_reply; -+ const char *privilege; - - type = dbus_message_get_type (message); - src = dbus_message_get_sender (message); -@@ -1565,7 +1588,7 @@ bus_context_check_security_policy (BusContext *context, - dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED, - "Message bus will not accept messages of unknown type\n"); - -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - requested_reply = FALSE; -@@ -1595,7 +1618,7 @@ bus_context_check_security_policy (BusContext *context, - if (dbus_error_is_set (&error2)) - { - dbus_move_error (&error2, error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - } - } -@@ -1624,11 +1647,11 @@ bus_context_check_security_policy (BusContext *context, - complain_about_message (context, DBUS_ERROR_ACCESS_DENIED, - "An SELinux policy prevents this sender from sending this " - "message to this recipient", -- 0, message, sender, proposed_recipient, FALSE, FALSE, error); -+ 0, message, sender, proposed_recipient, FALSE, FALSE, NULL, error); - _dbus_verbose ("SELinux security check denying send to service\n"); - } - -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - /* next verify AppArmor access controls. If allowed then -@@ -1646,7 +1669,7 @@ bus_context_check_security_policy (BusContext *context, - src ? src : DBUS_SERVICE_DBUS, - activation_entry, - error)) -- return FALSE; -+ return BUS_RESULT_FALSE; - - if (!bus_connection_is_active (sender)) - { -@@ -1660,7 +1683,7 @@ bus_context_check_security_policy (BusContext *context, - { - _dbus_verbose ("security check allowing %s message\n", - "Hello"); -- return TRUE; -+ return BUS_RESULT_TRUE; - } - else - { -@@ -1671,7 +1694,7 @@ bus_context_check_security_policy (BusContext *context, - "Client tried to send a message other than %s without being registered", - "Hello"); - -- return FALSE; -+ return BUS_RESULT_FALSE; - } - } - } -@@ -1720,20 +1743,29 @@ bus_context_check_security_policy (BusContext *context, - (proposed_recipient == NULL && recipient_policy == NULL)); - - log = FALSE; -- if (sender_policy && -- !bus_client_policy_check_can_send (sender_policy, -- context->registry, -- requested_reply, -- proposed_recipient, -- message, &toggles, &log)) -- { -- complain_about_message (context, DBUS_ERROR_ACCESS_DENIED, -- "Rejected send message", toggles, -- message, sender, proposed_recipient, requested_reply, -- (addressed_recipient == proposed_recipient), error); -- _dbus_verbose ("security policy disallowing message due to sender policy\n"); -- return FALSE; -- } -+ if (sender_policy) -+ { -+ BusResult res = bus_client_policy_check_can_send (sender, -+ sender_policy, -+ context->registry, -+ requested_reply, -+ addressed_recipient, -+ proposed_recipient, -+ message, &toggles, &log, &privilege, -+ deferred_message); -+ if (res == BUS_RESULT_FALSE) -+ { -+ complain_about_message (context, DBUS_ERROR_ACCESS_DENIED, -+ "Rejected send message", toggles, -+ message, sender, proposed_recipient, requested_reply, -+ (addressed_recipient == proposed_recipient), privilege, -+ error); -+ _dbus_verbose ("security policy disallowing message due to sender policy\n"); -+ return BUS_RESULT_FALSE; -+ } -+ else if (res == BUS_RESULT_LATER) -+ return BUS_RESULT_LATER; -+ } - - if (log) - { -@@ -1742,23 +1774,29 @@ bus_context_check_security_policy (BusContext *context, - complain_about_message (context, DBUS_ERROR_ACCESS_DENIED, - "Would reject message", toggles, - message, sender, proposed_recipient, requested_reply, -- TRUE, NULL); -+ TRUE, privilege, NULL); - } - -- if (recipient_policy && -- !bus_client_policy_check_can_receive (recipient_policy, -- context->registry, -- requested_reply, -- sender, -- addressed_recipient, proposed_recipient, -- message, &toggles)) -+ if (recipient_policy) - { -- complain_about_message (context, DBUS_ERROR_ACCESS_DENIED, -- "Rejected receive message", toggles, -- message, sender, proposed_recipient, requested_reply, -- (addressed_recipient == proposed_recipient), error); -- _dbus_verbose ("security policy disallowing message due to recipient policy\n"); -- return FALSE; -+ BusResult res; -+ res = bus_client_policy_check_can_receive (recipient_policy, -+ context->registry, -+ requested_reply, -+ sender, -+ addressed_recipient, proposed_recipient, -+ message, &toggles, &privilege, deferred_message); -+ if (res == BUS_RESULT_FALSE) -+ { -+ complain_about_message(context, DBUS_ERROR_ACCESS_DENIED, "Rejected receive message", -+ toggles, message, sender, proposed_recipient, requested_reply, -+ (addressed_recipient == proposed_recipient), privilege, error); -+ _dbus_verbose( -+ "security policy disallowing message due to recipient policy\n"); -+ return BUS_RESULT_FALSE; -+ } -+ else if (res == BUS_RESULT_LATER) -+ return BUS_RESULT_LATER; - } - - /* See if limits on size have been exceeded */ -@@ -1768,10 +1806,10 @@ bus_context_check_security_policy (BusContext *context, - { - complain_about_message (context, DBUS_ERROR_LIMITS_EXCEEDED, - "Rejected: destination has a full message queue", -- 0, message, sender, proposed_recipient, requested_reply, TRUE, -+ 0, message, sender, proposed_recipient, requested_reply, TRUE, NULL, - error); - _dbus_verbose ("security policy disallowing message due to full message queue\n"); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - /* Record that we will allow a reply here in the future (don't -@@ -1792,11 +1830,11 @@ bus_context_check_security_policy (BusContext *context, - message, error)) - { - _dbus_verbose ("Failed to record reply expectation or problem with the message expecting a reply\n"); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - _dbus_verbose ("security policy allowing message\n"); -- return TRUE; -+ return BUS_RESULT_TRUE; - } - - void -diff --git a/bus/bus.h b/bus/bus.h -index 2e0de82..82c32c8 100644 ---- a/bus/bus.h -+++ b/bus/bus.h -@@ -45,6 +45,22 @@ typedef struct BusTransaction BusTransaction; - typedef struct BusMatchmaker BusMatchmaker; - typedef struct BusMatchRule BusMatchRule; - typedef struct BusActivationEntry BusActivationEntry; -+typedef struct BusCheck BusCheck; -+typedef struct BusDeferredMessage BusDeferredMessage; -+typedef struct BusCynara BusCynara; -+ -+/** -+ * BusResult is defined as a pointer to a dummy structure to allow detection of type mismatches. -+ * The disadvantage of such solution is that now BusResult variables cannot be used in switch -+ * statement. -+ * Additionally, BUS_RESULT_TRUE is defined as 0 instead of 1 to help detect type mismatches -+ * at runtime. -+ */ -+typedef const struct BusResultStruct { int dummy; } *BusResult; -+ -+static const BusResult BUS_RESULT_TRUE = (BusResult)0x0; -+static const BusResult BUS_RESULT_FALSE = (BusResult)0x1; -+static const BusResult BUS_RESULT_LATER = (BusResult)0x2; - - typedef struct - { -@@ -101,6 +117,7 @@ BusConnections* bus_context_get_connections (BusContext - BusActivation* bus_context_get_activation (BusContext *context); - BusMatchmaker* bus_context_get_matchmaker (BusContext *context); - DBusLoop* bus_context_get_loop (BusContext *context); -+BusCheck * bus_context_get_check (BusContext *context); - dbus_bool_t bus_context_allow_unix_user (BusContext *context, - unsigned long uid); - dbus_bool_t bus_context_allow_windows_user (BusContext *context, -@@ -136,14 +153,15 @@ void bus_context_log_and_set_error (BusContext - const char *name, - const char *msg, - ...) _DBUS_GNUC_PRINTF (5, 6); --dbus_bool_t bus_context_check_security_policy (BusContext *context, -+BusResult bus_context_check_security_policy (BusContext *context, - BusTransaction *transaction, - DBusConnection *sender, - DBusConnection *addressed_recipient, - DBusConnection *proposed_recipient, - DBusMessage *message, - BusActivationEntry *activation_entry, -- DBusError *error); -+ DBusError *error, -+ BusDeferredMessage **deferred_message); - void bus_context_check_all_watches (BusContext *context); - - #endif /* BUS_BUS_H */ -diff --git a/bus/check.c b/bus/check.c -new file mode 100644 -index 0000000..5b72d31 ---- /dev/null -+++ b/bus/check.c -@@ -0,0 +1,217 @@ -+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -+/* check.c Bus security policy runtime check -+ * -+ * Copyright (C) 2014 Intel, Inc. -+ * Copyright (c) 2014 Samsung Electronics, Ltd. -+ * -+ * Licensed under the Academic Free License version 2.1 -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ * -+ */ -+ -+#include <config.h> -+#include "check.h" -+#include "connection.h" -+#include "dispatch.h" -+#include "cynara.h" -+#include "utils.h" -+#include <dbus/dbus-connection-internal.h> -+#include <dbus/dbus-message-internal.h> -+#include <dbus/dbus-internals.h> -+ -+ -+typedef struct BusCheck -+{ -+ int refcount; -+ -+ BusContext *context; -+ BusCynara *cynara; -+} BusCheck; -+ -+typedef struct BusDeferredMessage -+{ -+ int refcount; -+ -+ DBusMessage *message; -+ DBusConnection *sender; -+ DBusConnection *proposed_recipient; -+ DBusConnection *addressed_recipient; -+ dbus_bool_t full_dispatch; -+ BusDeferredMessageStatus status; -+ BusResult response; -+ BusCheckResponseFunc response_callback; -+} BusDeferredMessage; -+ -+BusCheck * -+bus_check_new (BusContext *context, DBusError *error) -+{ -+ BusCheck *check; -+ -+ check = dbus_new(BusCheck, 1); -+ if (check == NULL) -+ { -+ BUS_SET_OOM(error); -+ return NULL; -+ } -+ -+ check->refcount = 1; -+ check->context = context; -+ check->cynara = bus_cynara_new(check, error); -+ if (dbus_error_is_set(error)) -+ { -+ dbus_free(check); -+ return NULL; -+ } -+ -+ return check; -+} -+ -+BusCheck * -+bus_check_ref (BusCheck *check) -+{ -+ _dbus_assert (check->refcount > 0); -+ check->refcount += 1; -+ -+ return check; -+} -+ -+void -+bus_check_unref (BusCheck *check) -+{ -+ _dbus_assert (check->refcount > 0); -+ -+ check->refcount -= 1; -+ -+ if (check->refcount == 0) -+ { -+ bus_cynara_unref(check->cynara); -+ dbus_free(check); -+ } -+} -+ -+BusContext * -+bus_check_get_context (BusCheck *check) -+{ -+ return check->context; -+} -+ -+BusCynara * -+bus_check_get_cynara (BusCheck *check) -+{ -+ return check->cynara; -+} -+ -+BusResult -+bus_check_privilege (BusCheck *check, -+ DBusMessage *message, -+ DBusConnection *sender, -+ DBusConnection *addressed_recipient, -+ DBusConnection *proposed_recipient, -+ const char *privilege, -+ BusDeferredMessageStatus check_type, -+ BusDeferredMessage **deferred_message) -+{ -+ BusResult result = BUS_RESULT_FALSE; -+#ifdef DBUS_ENABLE_CYNARA -+ BusCynara *cynara; -+#endif -+ DBusConnection *connection; -+ -+ connection = check_type == BUS_DEFERRED_MESSAGE_CHECK_RECEIVE ? proposed_recipient : sender; -+ -+ if (!dbus_connection_get_is_connected(connection)) -+ { -+ return BUS_RESULT_FALSE; -+ } -+ -+ /* ask policy checkers */ -+#ifdef DBUS_ENABLE_CYNARA -+ cynara = bus_check_get_cynara(check); -+ result = bus_cynara_check_privilege(cynara, message, sender, addressed_recipient, -+ proposed_recipient, privilege, check_type, deferred_message); -+#endif -+ -+ if (result == BUS_RESULT_LATER && deferred_message != NULL) -+ { -+ (*deferred_message)->status |= check_type; -+ } -+ return result; -+} -+ -+BusDeferredMessage *bus_deferred_message_new (DBusMessage *message, -+ DBusConnection *sender, -+ DBusConnection *addressed_recipient, -+ DBusConnection *proposed_recipient, -+ BusResult response) -+{ -+ BusDeferredMessage *deferred_message; -+ -+ deferred_message = dbus_new(BusDeferredMessage, 1); -+ if (deferred_message == NULL) -+ { -+ return NULL; -+ } -+ -+ deferred_message->refcount = 1; -+ deferred_message->sender = sender != NULL ? dbus_connection_ref(sender) : NULL; -+ deferred_message->addressed_recipient = addressed_recipient != NULL ? dbus_connection_ref(addressed_recipient) : NULL; -+ deferred_message->proposed_recipient = proposed_recipient != NULL ? dbus_connection_ref(proposed_recipient) : NULL; -+ deferred_message->message = dbus_message_ref(message); -+ deferred_message->response = response; -+ deferred_message->status = 0; -+ deferred_message->full_dispatch = FALSE; -+ deferred_message->response_callback = NULL; -+ -+ return deferred_message; -+} -+ -+BusDeferredMessage * -+bus_deferred_message_ref (BusDeferredMessage *deferred_message) -+{ -+ _dbus_assert (deferred_message->refcount > 0); -+ deferred_message->refcount += 1; -+ return deferred_message; -+} -+ -+void -+bus_deferred_message_unref (BusDeferredMessage *deferred_message) -+{ -+ _dbus_assert (deferred_message->refcount > 0); -+ -+ deferred_message->refcount -= 1; -+ -+ if (deferred_message->refcount == 0) -+ { -+ dbus_message_unref(deferred_message->message); -+ if (deferred_message->sender != NULL) -+ dbus_connection_unref(deferred_message->sender); -+ if (deferred_message->addressed_recipient != NULL) -+ dbus_connection_unref(deferred_message->addressed_recipient); -+ if (deferred_message->proposed_recipient != NULL) -+ dbus_connection_unref(deferred_message->proposed_recipient); -+ dbus_free(deferred_message); -+ } -+} -+ -+void -+bus_deferred_message_response_received (BusDeferredMessage *deferred_message, -+ BusResult result) -+{ -+ if (deferred_message->response_callback != NULL) -+ { -+ deferred_message->response_callback(deferred_message, result); -+ } -+} -diff --git a/bus/check.h b/bus/check.h -new file mode 100644 -index 0000000..c3fcaf9 ---- /dev/null -+++ b/bus/check.h -@@ -0,0 +1,68 @@ -+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -+/* check.h Bus security policy runtime check -+ * -+ * Copyright (C) 2014 Intel, Inc. -+ * Copyright (c) 2014 Samsung Electronics, Ltd. -+ * -+ * Licensed under the Academic Free License version 2.1 -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ * -+ */ -+ -+#ifndef BUS_CHECK_H -+#define BUS_CHECK_H -+ -+#include "bus.h" -+#include "policy.h" -+ -+ -+typedef void (*BusCheckResponseFunc) (BusDeferredMessage *message, -+ BusResult result); -+ -+typedef enum { -+ BUS_DEFERRED_MESSAGE_CHECK_SEND = 1 << 0, -+ BUS_DEFERRED_MESSAGE_CHECK_RECEIVE = 1 << 1, -+ BUS_DEFERRED_MESSAGE_CHECK_OWN = 1 << 2, -+} BusDeferredMessageStatus; -+ -+ -+BusCheck *bus_check_new (BusContext *context, -+ DBusError *error); -+BusCheck *bus_check_ref (BusCheck *check); -+void bus_check_unref (BusCheck *check); -+ -+BusContext *bus_check_get_context (BusCheck *check); -+BusCynara *bus_check_get_cynara (BusCheck *check); -+BusResult bus_check_privilege (BusCheck *check, -+ DBusMessage *message, -+ DBusConnection *sender, -+ DBusConnection *addressed_recipient, -+ DBusConnection *proposed_recipient, -+ const char *privilege, -+ BusDeferredMessageStatus check_type, -+ BusDeferredMessage **deferred_message); -+ -+BusDeferredMessage *bus_deferred_message_new (DBusMessage *message, -+ DBusConnection *sender, -+ DBusConnection *addressed_recipient, -+ DBusConnection *proposed_recipient, -+ BusResult response); -+ -+BusDeferredMessage *bus_deferred_message_ref (BusDeferredMessage *deferred_message); -+void bus_deferred_message_unref (BusDeferredMessage *deferred_message); -+void bus_deferred_message_response_received (BusDeferredMessage *deferred_message, -+ BusResult result); -+#endif /* BUS_CHECK_H */ -diff --git a/bus/config-parser-common.c b/bus/config-parser-common.c -index c1c4191..e2f253d 100644 ---- a/bus/config-parser-common.c -+++ b/bus/config-parser-common.c -@@ -75,6 +75,10 @@ bus_config_parser_element_name_to_type (const char *name) - { - return ELEMENT_DENY; - } -+ else if (strcmp (name, "check") == 0) -+ { -+ return ELEMENT_CHECK; -+ } - else if (strcmp (name, "servicehelper") == 0) - { - return ELEMENT_SERVICEHELPER; -@@ -159,6 +163,8 @@ bus_config_parser_element_type_to_name (ElementType type) - return "allow"; - case ELEMENT_DENY: - return "deny"; -+ case ELEMENT_CHECK: -+ return "check"; - case ELEMENT_FORK: - return "fork"; - case ELEMENT_PIDFILE: -diff --git a/bus/config-parser-common.h b/bus/config-parser-common.h -index 382a014..9e026d1 100644 ---- a/bus/config-parser-common.h -+++ b/bus/config-parser-common.h -@@ -36,6 +36,7 @@ typedef enum - ELEMENT_LIMIT, - ELEMENT_ALLOW, - ELEMENT_DENY, -+ ELEMENT_CHECK, - ELEMENT_FORK, - ELEMENT_PIDFILE, - ELEMENT_SERVICEDIR, -diff --git a/bus/config-parser-trivial.c b/bus/config-parser-trivial.c -index dd65c6d..23dedb4 100644 ---- a/bus/config-parser-trivial.c -+++ b/bus/config-parser-trivial.c -@@ -194,6 +194,7 @@ bus_config_parser_start_element (BusConfigParser *parser, - case ELEMENT_POLICY: - case ELEMENT_LIMIT: - case ELEMENT_ALLOW: -+ case ELEMENT_CHECK: - case ELEMENT_DENY: - case ELEMENT_FORK: - case ELEMENT_PIDFILE: -@@ -316,6 +317,7 @@ bus_config_parser_content (BusConfigParser *parser, - case ELEMENT_POLICY: - case ELEMENT_LIMIT: - case ELEMENT_ALLOW: -+ case ELEMENT_CHECK: - case ELEMENT_DENY: - case ELEMENT_FORK: - case ELEMENT_PIDFILE: -diff --git a/bus/config-parser.c b/bus/config-parser.c -index be27d38..7f91469 100644 ---- a/bus/config-parser.c -+++ b/bus/config-parser.c -@@ -1318,7 +1318,7 @@ append_rule_from_element (BusConfigParser *parser, - const char *element_name, - const char **attribute_names, - const char **attribute_values, -- dbus_bool_t allow, -+ BusPolicyRuleAccess access, - DBusError *error) - { - const char *log; -@@ -1360,6 +1360,7 @@ append_rule_from_element (BusConfigParser *parser, - const char *own_prefix; - const char *user; - const char *group; -+ const char *privilege; - - BusPolicyRule *rule; - -@@ -1390,6 +1391,7 @@ append_rule_from_element (BusConfigParser *parser, - "user", &user, - "group", &group, - "log", &log, -+ "privilege", &privilege, - NULL)) - return FALSE; - -@@ -1422,6 +1424,7 @@ append_rule_from_element (BusConfigParser *parser, - - if (!(any_send_attribute || - any_receive_attribute || -+ privilege || - own || own_prefix || user || group)) - { - dbus_set_error (error, DBUS_ERROR_FAILED, -@@ -1438,7 +1441,30 @@ append_rule_from_element (BusConfigParser *parser, - element_name); - return FALSE; - } -- -+ -+ if (access == BUS_POLICY_RULE_ACCESS_CHECK) -+ { -+ if (privilege == NULL || !*privilege) -+ { -+ dbus_set_error (error, DBUS_ERROR_FAILED, -+ "On element <%s>, you must specify the privilege to be checked.", -+ element_name); -+ return FALSE; -+ } -+ } -+ else -+ { -+ if (privilege != NULL && *privilege) -+ { -+ dbus_set_error (error, DBUS_ERROR_FAILED, -+ "On element <%s>, privilege %s is used outside of a check rule.", -+ element_name, privilege); -+ return FALSE; -+ } -+ else -+ privilege = NULL; /* replace (potentially) empty string with NULL pointer, it wouldn't be used anyway */ -+ } -+ - /* Allowed combinations of elements are: - * - * base, must be all send or all receive: -@@ -1589,7 +1615,7 @@ append_rule_from_element (BusConfigParser *parser, - error)) - return FALSE; - -- rule = bus_policy_rule_new (BUS_POLICY_RULE_SEND, allow); -+ rule = bus_policy_rule_new (BUS_POLICY_RULE_SEND, access); - if (rule == NULL) - goto nomem; - -@@ -1694,7 +1720,7 @@ append_rule_from_element (BusConfigParser *parser, - error)) - return FALSE; - -- rule = bus_policy_rule_new (BUS_POLICY_RULE_RECEIVE, allow); -+ rule = bus_policy_rule_new (BUS_POLICY_RULE_RECEIVE, access); - if (rule == NULL) - goto nomem; - -@@ -1726,7 +1752,7 @@ append_rule_from_element (BusConfigParser *parser, - } - else if (own || own_prefix) - { -- rule = bus_policy_rule_new (BUS_POLICY_RULE_OWN, allow); -+ rule = bus_policy_rule_new (BUS_POLICY_RULE_OWN, access); - if (rule == NULL) - goto nomem; - -@@ -1752,7 +1778,7 @@ append_rule_from_element (BusConfigParser *parser, - { - if (IS_WILDCARD (user)) - { -- rule = bus_policy_rule_new (BUS_POLICY_RULE_USER, allow); -+ rule = bus_policy_rule_new (BUS_POLICY_RULE_USER, access); - if (rule == NULL) - goto nomem; - -@@ -1767,7 +1793,7 @@ append_rule_from_element (BusConfigParser *parser, - - if (_dbus_parse_unix_user_from_config (&username, &uid)) - { -- rule = bus_policy_rule_new (BUS_POLICY_RULE_USER, allow); -+ rule = bus_policy_rule_new (BUS_POLICY_RULE_USER, access); - if (rule == NULL) - goto nomem; - -@@ -1784,7 +1810,7 @@ append_rule_from_element (BusConfigParser *parser, - { - if (IS_WILDCARD (group)) - { -- rule = bus_policy_rule_new (BUS_POLICY_RULE_GROUP, allow); -+ rule = bus_policy_rule_new (BUS_POLICY_RULE_GROUP, access); - if (rule == NULL) - goto nomem; - -@@ -1799,7 +1825,7 @@ append_rule_from_element (BusConfigParser *parser, - - if (_dbus_parse_unix_group_from_config (&groupname, &gid)) - { -- rule = bus_policy_rule_new (BUS_POLICY_RULE_GROUP, allow); -+ rule = bus_policy_rule_new (BUS_POLICY_RULE_GROUP, access); - if (rule == NULL) - goto nomem; - -@@ -1823,6 +1849,10 @@ append_rule_from_element (BusConfigParser *parser, - _dbus_assert (pe != NULL); - _dbus_assert (pe->type == ELEMENT_POLICY); - -+ rule->privilege = _dbus_strdup (privilege); -+ if (privilege && !rule->privilege) -+ goto nomem; -+ - switch (pe->d.policy.type) - { - case POLICY_IGNORED: -@@ -1898,7 +1928,7 @@ start_policy_child (BusConfigParser *parser, - { - if (!append_rule_from_element (parser, element_name, - attribute_names, attribute_values, -- TRUE, error)) -+ BUS_POLICY_RULE_ACCESS_ALLOW, error)) - return FALSE; - - if (push_element (parser, ELEMENT_ALLOW) == NULL) -@@ -1913,7 +1943,7 @@ start_policy_child (BusConfigParser *parser, - { - if (!append_rule_from_element (parser, element_name, - attribute_names, attribute_values, -- FALSE, error)) -+ BUS_POLICY_RULE_ACCESS_DENY, error)) - return FALSE; - - if (push_element (parser, ELEMENT_DENY) == NULL) -@@ -1922,6 +1952,21 @@ start_policy_child (BusConfigParser *parser, - return FALSE; - } - -+ return TRUE; -+ } -+ else if (strcmp (element_name, "check") == 0) -+ { -+ if (!append_rule_from_element (parser, element_name, -+ attribute_names, attribute_values, -+ BUS_POLICY_RULE_ACCESS_CHECK, error)) -+ return FALSE; -+ -+ if (push_element (parser, ELEMENT_CHECK) == NULL) -+ { -+ BUS_SET_OOM (error); -+ return FALSE; -+ } -+ - return TRUE; - } - else -@@ -2284,6 +2329,7 @@ bus_config_parser_end_element (BusConfigParser *parser, - case ELEMENT_POLICY: - case ELEMENT_ALLOW: - case ELEMENT_DENY: -+ case ELEMENT_CHECK: - case ELEMENT_FORK: - case ELEMENT_SYSLOG: - case ELEMENT_KEEP_UMASK: -@@ -2600,6 +2646,7 @@ bus_config_parser_content (BusConfigParser *parser, - case ELEMENT_POLICY: - case ELEMENT_ALLOW: - case ELEMENT_DENY: -+ case ELEMENT_CHECK: - case ELEMENT_FORK: - case ELEMENT_SYSLOG: - case ELEMENT_KEEP_UMASK: -@@ -3127,6 +3174,8 @@ do_load (const DBusString *full_path, - dbus_error_init (&error); - - parser = bus_config_load (full_path, TRUE, NULL, &error); -+ if (dbus_error_is_set (&error)) -+ _dbus_verbose ("Failed to load file: %s\n", error.message); - if (parser == NULL) - { - _DBUS_ASSERT_ERROR_IS_SET (&error); -@@ -3359,6 +3408,7 @@ elements_equal (const Element *a, - case ELEMENT_LISTEN: - case ELEMENT_AUTH: - case ELEMENT_ALLOW: -+ case ELEMENT_CHECK: - case ELEMENT_DENY: - case ELEMENT_FORK: - case ELEMENT_PIDFILE: -diff --git a/bus/connection.c b/bus/connection.c -index 53605fa..b348d42 100644 ---- a/bus/connection.c -+++ b/bus/connection.c -@@ -36,6 +36,10 @@ - #include <dbus/dbus-timeout.h> - #include <dbus/dbus-connection-internal.h> - #include <dbus/dbus-internals.h> -+#ifdef DBUS_ENABLE_CYNARA -+#include <stdlib.h> -+#include <cynara-session.h> -+#endif - - /* Trim executed commands to this length; we want to keep logs readable */ - #define MAX_LOG_COMMAND_LEN 50 -@@ -116,6 +120,9 @@ typedef struct - - /** non-NULL if and only if this is a monitor */ - DBusList *link_in_monitors; -+#ifdef DBUS_ENABLE_CYNARA -+ char *cynara_session_id; -+#endif - } BusConnectionData; - - static dbus_bool_t bus_pending_reply_expired (BusExpireList *list, -@@ -129,8 +136,8 @@ static dbus_bool_t expire_incomplete_timeout (void *data); - - #define BUS_CONNECTION_DATA(connection) (dbus_connection_get_data ((connection), connection_data_slot)) - --static DBusLoop* --connection_get_loop (DBusConnection *connection) -+DBusLoop* -+bus_connection_get_loop (DBusConnection *connection) - { - BusConnectionData *d; - -@@ -354,7 +361,7 @@ add_connection_watch (DBusWatch *watch, - { - DBusConnection *connection = data; - -- return _dbus_loop_add_watch (connection_get_loop (connection), watch); -+ return _dbus_loop_add_watch (bus_connection_get_loop (connection), watch); - } - - static void -@@ -363,7 +370,7 @@ remove_connection_watch (DBusWatch *watch, - { - DBusConnection *connection = data; - -- _dbus_loop_remove_watch (connection_get_loop (connection), watch); -+ _dbus_loop_remove_watch (bus_connection_get_loop (connection), watch); - } - - static void -@@ -372,7 +379,7 @@ toggle_connection_watch (DBusWatch *watch, - { - DBusConnection *connection = data; - -- _dbus_loop_toggle_watch (connection_get_loop (connection), watch); -+ _dbus_loop_toggle_watch (bus_connection_get_loop (connection), watch); - } - - static dbus_bool_t -@@ -381,7 +388,7 @@ add_connection_timeout (DBusTimeout *timeout, - { - DBusConnection *connection = data; - -- return _dbus_loop_add_timeout (connection_get_loop (connection), timeout); -+ return _dbus_loop_add_timeout (bus_connection_get_loop (connection), timeout); - } - - static void -@@ -390,7 +397,7 @@ remove_connection_timeout (DBusTimeout *timeout, - { - DBusConnection *connection = data; - -- _dbus_loop_remove_timeout (connection_get_loop (connection), timeout); -+ _dbus_loop_remove_timeout (bus_connection_get_loop (connection), timeout); - } - - static void -@@ -448,6 +455,10 @@ free_connection_data (void *data) - - dbus_free (d->name); - -+#ifdef DBUS_ENABLE_CYNARA -+ free (d->cynara_session_id); -+#endif -+ - dbus_free (d); - } - -@@ -1078,6 +1089,22 @@ bus_connection_get_policy (DBusConnection *connection) - return d->policy; - } - -+#ifdef DBUS_ENABLE_CYNARA -+const char *bus_connection_get_cynara_session_id (DBusConnection *connection) -+{ -+ BusConnectionData *d = BUS_CONNECTION_DATA (connection); -+ _dbus_assert (d != NULL); -+ -+ if (d->cynara_session_id == NULL) -+ { -+ unsigned long pid; -+ if (dbus_connection_get_unix_process_id(connection, &pid)) -+ d->cynara_session_id = cynara_session_from_pid(pid); -+ } -+ return d->cynara_session_id; -+} -+#endif -+ - static dbus_bool_t - foreach_active (BusConnections *connections, - BusConnectionForeachFunction function, -@@ -2333,6 +2360,7 @@ bus_transaction_send_from_driver (BusTransaction *transaction, - DBusMessage *message) - { - DBusError error = DBUS_ERROR_INIT; -+ BusResult res; - - /* We have to set the sender to the driver, and have - * to check security policy since it was not done in -@@ -2370,10 +2398,11 @@ bus_transaction_send_from_driver (BusTransaction *transaction, - * if we're actively capturing messages, it's nice to log that we - * tried to send it and did not allow ourselves to do so. - */ -- if (!bus_context_check_security_policy (bus_transaction_get_context (transaction), -- transaction, -- NULL, connection, connection, -- message, NULL, &error)) -+ res = bus_context_check_security_policy (bus_transaction_get_context (transaction), -+ transaction, -+ NULL, connection, connection, message, NULL, -+ &error, NULL); -+ if (res == BUS_RESULT_FALSE) - { - if (!bus_transaction_capture_error_reply (transaction, connection, - &error, message)) -@@ -2388,6 +2417,12 @@ bus_transaction_send_from_driver (BusTransaction *transaction, - dbus_error_free (&error); - return TRUE; - } -+ else if (res == BUS_RESULT_LATER) -+ { -+ _dbus_verbose ("Cannot delay sending message from bus driver, dropping it\n"); -+ dbus_error_free (&error); -+ return TRUE; -+ } - - return bus_transaction_send (transaction, connection, message); - } -diff --git a/bus/connection.h b/bus/connection.h -index 9e253ae..71078ea 100644 ---- a/bus/connection.h -+++ b/bus/connection.h -@@ -31,6 +31,7 @@ - typedef dbus_bool_t (* BusConnectionForeachFunction) (DBusConnection *connection, - void *data); - -+DBusLoop* bus_connection_get_loop (DBusConnection *connection); - - BusConnections* bus_connections_new (BusContext *context); - BusConnections* bus_connections_ref (BusConnections *connections); -@@ -124,6 +125,9 @@ dbus_bool_t bus_connection_be_monitor (DBusConnection *connection, - BusTransaction *transaction, - DBusList **rules, - DBusError *error); -+#ifdef DBUS_ENABLE_CYNARA -+const char *bus_connection_get_cynara_session_id (DBusConnection *connection); -+#endif - - /* transaction API so we can send or not send a block of messages as a whole */ - -diff --git a/bus/cynara.c b/bus/cynara.c -new file mode 100644 -index 0000000..57a4c45 ---- /dev/null -+++ b/bus/cynara.c -@@ -0,0 +1,374 @@ -+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -+/* cynara.c Cynara runtime privilege checking -+ * -+ * Copyright (c) 2014 Samsung Electronics, Ltd. -+ * -+ * Licensed under the Academic Free License version 2.1 -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ * -+ */ -+ -+#include <config.h> -+#include "cynara.h" -+#include "check.h" -+#include "utils.h" -+ -+#include <stdio.h> -+ -+#include <dbus/dbus.h> -+#include <dbus/dbus-watch.h> -+#include <dbus/dbus-connection-internal.h> -+#include <bus/connection.h> -+#ifdef DBUS_ENABLE_CYNARA -+#include <cynara-client-async.h> -+#endif -+ -+ -+#ifdef DBUS_ENABLE_CYNARA -+typedef struct BusCynara -+{ -+ int refcount; -+ -+ BusContext *context; -+ BusCheck *check; -+ cynara_async *cynara; -+ DBusWatch *cynara_watch; -+} BusCynara; -+ -+#define USE_CYNARA_CACHE 1 -+#ifdef USE_CYNARA_CACHE -+#define CYNARA_CACHE_SIZE 1000 -+#endif -+ -+static dbus_bool_t bus_cynara_watch_callback(DBusWatch *watch, -+ unsigned int flags, -+ void *data); -+ -+static void status_callback(int old_fd, -+ int new_fd, -+ cynara_async_status status, -+ void *user_status_data); -+static void bus_cynara_check_response_callback (cynara_check_id check_id, -+ cynara_async_call_cause cause, -+ int response, -+ void *user_response_data); -+#endif -+ -+ -+BusCynara * -+bus_cynara_new(BusCheck *check, DBusError *error) -+{ -+#ifdef DBUS_ENABLE_CYNARA -+ BusContext *context; -+ BusCynara *cynara; -+ cynara_async_configuration *conf = NULL; -+ int ret; -+ -+ cynara = dbus_new(BusCynara, 1); -+ if (cynara == NULL) -+ { -+ BUS_SET_OOM(error); -+ return NULL; -+ } -+ -+ context = bus_check_get_context(check); -+ -+ cynara->refcount = 1; -+ cynara->check = check; -+ cynara->context = context; -+ cynara->cynara_watch = NULL; -+ -+ ret = cynara_async_configuration_create(&conf); -+ if (ret != CYNARA_API_SUCCESS) -+ { -+ dbus_set_error (error, DBUS_ERROR_FAILED, "Failed to create Cynara configuration"); -+ goto out; -+ } -+ -+#ifdef CYNARA_CACHE_SIZE -+ ret = cynara_async_configuration_set_cache_size(conf, CYNARA_CACHE_SIZE); -+ if (ret != CYNARA_API_SUCCESS) -+ { -+ dbus_set_error (error, DBUS_ERROR_FAILED, "Failed to Cynara cache size"); -+ goto out; -+ } -+#endif -+ -+ ret = cynara_async_initialize(&cynara->cynara, conf, &status_callback, cynara); -+ if (ret != CYNARA_API_SUCCESS) -+ { -+ dbus_set_error (error, DBUS_ERROR_FAILED, "Failed to initialize Cynara client"); -+ goto out; -+ } -+ -+out: -+ cynara_async_configuration_destroy(conf); -+ if (ret != CYNARA_API_SUCCESS) -+ { -+ dbus_free(cynara); -+ return NULL; -+ } -+ -+ return cynara; -+#else -+ return NULL; -+#endif -+} -+ -+BusCynara * -+bus_cynara_ref (BusCynara *cynara) -+{ -+#ifdef DBUS_ENABLE_CYNARA -+ _dbus_assert (cynara->refcount > 0); -+ cynara->refcount += 1; -+ -+ return cynara; -+#else -+ return NULL; -+#endif -+} -+ -+void -+bus_cynara_unref (BusCynara *cynara) -+{ -+#ifdef DBUS_ENABLE_CYNARA -+ _dbus_assert (cynara->refcount > 0); -+ -+ cynara->refcount -= 1; -+ -+ if (cynara->refcount == 0) -+ { -+ cynara_async_finish(cynara->cynara); -+ dbus_free(cynara); -+ } -+#endif -+} -+ -+BusResult -+bus_cynara_check_privilege (BusCynara *cynara, -+ DBusMessage *message, -+ DBusConnection *sender, -+ DBusConnection *addressed_recipient, -+ DBusConnection *proposed_recipient, -+ const char *privilege, -+ BusDeferredMessageStatus check_type, -+ BusDeferredMessage **deferred_message_param) -+{ -+#ifdef DBUS_ENABLE_CYNARA -+ int result; -+ unsigned long uid; -+ char *label; -+ const char *session_id; -+ char user[32]; -+ cynara_check_id check_id; -+ DBusConnection *connection = check_type == BUS_DEFERRED_MESSAGE_CHECK_RECEIVE ? proposed_recipient : sender; -+ BusDeferredMessage *deferred_message; -+ BusResult ret; -+ -+ _dbus_assert(connection != NULL); -+ -+ if (dbus_connection_get_unix_user(connection, &uid) == FALSE) -+ return BUS_RESULT_FALSE; -+ -+ if (_dbus_connection_get_linux_security_label(connection, &label) == FALSE || label == NULL) -+ { -+ _dbus_warn("Failed to obtain security label for connection\n"); -+ return BUS_RESULT_FALSE; -+ } -+ -+ session_id = bus_connection_get_cynara_session_id (connection); -+ if (session_id == NULL) -+ { -+ ret = BUS_RESULT_FALSE; -+ goto out; -+ } -+ -+ snprintf(user, sizeof(user), "%lu", uid); -+ -+#if USE_CYNARA_CACHE -+ result = cynara_async_check_cache(cynara->cynara, label, session_id, user, privilege); -+#else -+ result = CYNARA_API_CACHE_MISS; -+#endif -+ -+ switch (result) -+ { -+ case CYNARA_API_ACCESS_ALLOWED: -+ _dbus_verbose("Cynara: got ALLOWED answer from cache (client=%s session_id=%s user=%s privilege=%s)\n", -+ label, session_id, user, privilege); -+ ret = BUS_RESULT_TRUE; -+ break; -+ -+ case CYNARA_API_ACCESS_DENIED: -+ _dbus_verbose("Cynara: got DENIED answer from cache (client=%s session_id=%s user=%s privilege=%s)\n", -+ label, session_id, user, privilege); -+ ret = BUS_RESULT_FALSE; -+ break; -+ -+ case CYNARA_API_CACHE_MISS: -+ deferred_message = bus_deferred_message_new(message, sender, addressed_recipient, -+ proposed_recipient, BUS_RESULT_LATER); -+ if (deferred_message == NULL) -+ { -+ _dbus_verbose("Failed to allocate memory for deferred message\n"); -+ ret = BUS_RESULT_FALSE; -+ goto out; -+ } -+ -+ /* callback is supposed to unref deferred_message*/ -+ result = cynara_async_create_request(cynara->cynara, label, session_id, user, privilege, &check_id, -+ &bus_cynara_check_response_callback, deferred_message); -+ if (result == CYNARA_API_SUCCESS) -+ { -+ _dbus_verbose("Created Cynara request: client=%s session_id=%s user=%s privilege=%s check_id=%u " -+ "deferred_message=%p\n", label, session_id, user, privilege, (unsigned int)check_id, deferred_message); -+ if (deferred_message_param != NULL) -+ *deferred_message_param = deferred_message; -+ ret = BUS_RESULT_LATER; -+ } -+ else -+ { -+ _dbus_verbose("Error on cynara request create: %i\n", result); -+ bus_deferred_message_unref(deferred_message); -+ ret = BUS_RESULT_FALSE; -+ } -+ break; -+ default: -+ _dbus_verbose("Error when accessing Cynara cache: %i\n", result); -+ ret = BUS_RESULT_FALSE; -+ } -+out: -+ dbus_free(label); -+ return ret; -+ -+#else -+ return BUS_RESULT_FALSE; -+#endif -+} -+ -+ -+ -+#ifdef DBUS_ENABLE_CYNARA -+static void -+status_callback(int old_fd, int new_fd, cynara_async_status status, -+ void *user_status_data) -+{ -+ BusCynara *cynara = (BusCynara *)user_status_data; -+ DBusLoop *loop = bus_context_get_loop(cynara->context); -+ -+ if (cynara->cynara_watch != NULL) -+ { -+ _dbus_loop_remove_watch(loop, cynara->cynara_watch); -+ _dbus_watch_invalidate(cynara->cynara_watch); -+ _dbus_watch_unref(cynara->cynara_watch); -+ cynara->cynara_watch = NULL; -+ } -+ -+ if (new_fd != -1) -+ { -+ unsigned int flags; -+ DBusWatch *watch; -+ -+ switch (status) -+ { -+ case CYNARA_STATUS_FOR_READ: -+ flags = DBUS_WATCH_READABLE; -+ break; -+ case CYNARA_STATUS_FOR_RW: -+ flags = DBUS_WATCH_READABLE | DBUS_WATCH_WRITABLE; -+ break; -+ default: -+ /* Cynara passed unknown status - warn and add RW watch */ -+ _dbus_verbose("Cynara passed unknown status value: 0x%08X\n", (unsigned int)status); -+ flags = DBUS_WATCH_READABLE | DBUS_WATCH_WRITABLE; -+ break; -+ } -+ -+ watch = _dbus_watch_new(new_fd, flags, TRUE, &bus_cynara_watch_callback, cynara, NULL); -+ if (watch != NULL) -+ { -+ if (_dbus_loop_add_watch(loop, watch) == TRUE) -+ { -+ cynara->cynara_watch = watch; -+ return; -+ } -+ -+ _dbus_watch_invalidate(watch); -+ _dbus_watch_unref(watch); -+ } -+ -+ /* It seems like not much can be done at this point. Cynara events won't be processed -+ * until next Cynara function call triggering status callback */ -+ _dbus_verbose("Failed to add dbus watch\n"); -+ } -+} -+ -+static dbus_bool_t -+bus_cynara_watch_callback(DBusWatch *watch, -+ unsigned int flags, -+ void *data) -+{ -+ BusCynara *cynara = (BusCynara *)data; -+ int result = cynara_async_process(cynara->cynara); -+ if (result != CYNARA_API_SUCCESS) -+ _dbus_verbose("cynara_async_process returned %d\n", result); -+ -+ return result != CYNARA_API_OUT_OF_MEMORY ? TRUE : FALSE; -+} -+ -+static inline const char * -+call_cause_to_string(cynara_async_call_cause cause) -+{ -+ switch (cause) -+ { -+ case CYNARA_CALL_CAUSE_ANSWER: -+ return "ANSWER"; -+ case CYNARA_CALL_CAUSE_CANCEL: -+ return "CANCEL"; -+ case CYNARA_CALL_CAUSE_FINISH: -+ return "FINSIH"; -+ case CYNARA_CALL_CAUSE_SERVICE_NOT_AVAILABLE: -+ return "SERVICE NOT AVAILABLE"; -+ default: -+ return "INVALID"; -+ } -+} -+ -+static void -+bus_cynara_check_response_callback (cynara_check_id check_id, -+ cynara_async_call_cause cause, -+ int response, -+ void *user_response_data) -+{ -+ BusDeferredMessage *deferred_message = user_response_data; -+ BusResult result; -+ -+ _dbus_verbose("Cynara callback: check_id=%u, cause=%s response=%i response_data=%p\n", -+ (unsigned int)check_id, call_cause_to_string(cause), response, user_response_data); -+ -+ if (deferred_message == NULL) -+ return; -+ -+ if (cause == CYNARA_CALL_CAUSE_ANSWER && response == CYNARA_API_ACCESS_ALLOWED) -+ result = BUS_RESULT_TRUE; -+ else -+ result = BUS_RESULT_FALSE; -+ -+ bus_deferred_message_response_received(deferred_message, result); -+ bus_deferred_message_unref(deferred_message); -+} -+ -+#endif /* DBUS_ENABLE_CYNARA */ -diff --git a/bus/cynara.h b/bus/cynara.h -new file mode 100644 -index 0000000..c4728bb ---- /dev/null -+++ b/bus/cynara.h -@@ -0,0 +1,37 @@ -+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -+/* cynara.h Cynara runtime privilege checking -+ * -+ * Copyright (c) 2014 Samsung Electronics, Ltd. -+ * -+ * Licensed under the Academic Free License version 2.1 -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ * -+ */ -+ -+#include "bus.h" -+#include "check.h" -+ -+BusCynara *bus_cynara_new (BusCheck *check, DBusError *error); -+BusCynara *bus_cynara_ref (BusCynara *cynara); -+void bus_cynara_unref (BusCynara *cynara); -+BusResult bus_cynara_check_privilege (BusCynara *cynara, -+ DBusMessage *message, -+ DBusConnection *sender, -+ DBusConnection *addressed_recipient, -+ DBusConnection *proposed_recipient, -+ const char *privilege, -+ BusDeferredMessageStatus check_type, -+ BusDeferredMessage **deferred_message); -diff --git a/bus/dispatch.c b/bus/dispatch.c -index 19228be..d3867f7 100644 ---- a/bus/dispatch.c -+++ b/bus/dispatch.c -@@ -25,6 +25,7 @@ - - #include <config.h> - #include "dispatch.h" -+#include "check.h" - #include "connection.h" - #include "driver.h" - #include "services.h" -@@ -64,14 +65,18 @@ send_one_message (DBusConnection *connection, - DBusError *error) - { - DBusError stack_error = DBUS_ERROR_INIT; -+ BusDeferredMessage *deferred_message; -+ BusResult result; - -- if (!bus_context_check_security_policy (context, transaction, -+ result = bus_context_check_security_policy (context, transaction, - sender, - addressed_recipient, - connection, - message, - NULL, -- &stack_error)) -+ &stack_error, -+ &deferred_message); -+ if (result != BUS_RESULT_TRUE) - { - if (!bus_transaction_capture_error_reply (transaction, sender, - &stack_error, message)) -@@ -130,6 +135,8 @@ bus_dispatch_matches (BusTransaction *transaction, - BusMatchmaker *matchmaker; - DBusList *link; - BusContext *context; -+ BusDeferredMessage *deferred_message; -+ BusResult res; - - _DBUS_ASSERT_ERROR_IS_CLEAR (error); - -@@ -145,11 +152,20 @@ bus_dispatch_matches (BusTransaction *transaction, - /* First, send the message to the addressed_recipient, if there is one. */ - if (addressed_recipient != NULL) - { -- if (!bus_context_check_security_policy (context, transaction, -- sender, addressed_recipient, -- addressed_recipient, -- message, NULL, error)) -+ res = bus_context_check_security_policy (context, transaction, -+ sender, addressed_recipient, -+ addressed_recipient, -+ message, NULL, error, -+ &deferred_message); -+ if (res == BUS_RESULT_FALSE) - return FALSE; -+ else if (res == BUS_RESULT_LATER) -+ { -+ dbus_set_error (error, -+ DBUS_ERROR_ACCESS_DENIED, -+ "Rejecting message because time is needed to check security policy"); -+ return FALSE; -+ } - - if (dbus_message_contains_unix_fds (message) && - !dbus_connection_can_send_type (addressed_recipient, -@@ -374,19 +390,31 @@ bus_dispatch (DBusConnection *connection, - if (service_name && - strcmp (service_name, DBUS_SERVICE_DBUS) == 0) /* to bus driver */ - { -+ BusDeferredMessage *deferred_message; -+ BusResult res; -+ - if (!bus_transaction_capture (transaction, connection, NULL, message)) - { - BUS_SET_OOM (&error); - goto out; - } - -- if (!bus_context_check_security_policy (context, transaction, -- connection, NULL, NULL, message, -- NULL, &error)) -+ res = bus_context_check_security_policy (context, transaction, -+ connection, NULL, NULL, message, NULL, -+ &error, &deferred_message); -+ if (res == BUS_RESULT_FALSE) - { - _dbus_verbose ("Security policy rejected message\n"); - goto out; - } -+ else if (res == BUS_RESULT_LATER) -+ { -+ dbus_set_error (&error, -+ DBUS_ERROR_ACCESS_DENIED, -+ "Rejecting message because time is needed to check security policy"); -+ _dbus_verbose ("Security policy needs time to check policy. Dropping message\n"); -+ goto out; -+ } - - _dbus_verbose ("Giving message to %s\n", DBUS_SERVICE_DBUS); - if (!bus_driver_handle_message (connection, transaction, message, &error)) -diff --git a/bus/driver.h b/bus/driver.h -index ac1289d..a7297ad 100644 ---- a/bus/driver.h -+++ b/bus/driver.h -@@ -66,5 +66,7 @@ dbus_bool_t bus_driver_send_ack_reply (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, - DBusError *error); -+dbus_bool_t bus_driver_check_message_is_for_us (DBusMessage *message, -+ DBusError *error); - - #endif /* BUS_DRIVER_H */ -diff --git a/bus/policy.c b/bus/policy.c -index a37be80..7de92c6 100644 ---- a/bus/policy.c -+++ b/bus/policy.c -@@ -22,6 +22,7 @@ - */ - - #include <config.h> -+#include "check.h" - #include "policy.h" - #include "services.h" - #include "test.h" -@@ -33,7 +34,7 @@ - - BusPolicyRule* - bus_policy_rule_new (BusPolicyRuleType type, -- dbus_bool_t allow) -+ BusPolicyRuleAccess access) - { - BusPolicyRule *rule; - -@@ -43,7 +44,7 @@ bus_policy_rule_new (BusPolicyRuleType type, - - rule->type = type; - rule->refcount = 1; -- rule->allow = allow; -+ rule->access = access; - - switch (rule->type) - { -@@ -55,18 +56,19 @@ bus_policy_rule_new (BusPolicyRuleType type, - break; - case BUS_POLICY_RULE_SEND: - rule->d.send.message_type = DBUS_MESSAGE_TYPE_INVALID; -- - /* allow rules default to TRUE (only requested replies allowed) -+ * check rules default to TRUE (only requested replies are checked) - * deny rules default to FALSE (only unrequested replies denied) - */ -- rule->d.send.requested_reply = rule->allow; -+ rule->d.send.requested_reply = rule->access != BUS_POLICY_RULE_ACCESS_DENY; - break; - case BUS_POLICY_RULE_RECEIVE: - rule->d.receive.message_type = DBUS_MESSAGE_TYPE_INVALID; - /* allow rules default to TRUE (only requested replies allowed) -+ * check rules default to TRUE (only requested replies are checked) - * deny rules default to FALSE (only unrequested replies denied) - */ -- rule->d.receive.requested_reply = rule->allow; -+ rule->d.receive.requested_reply = rule->access != BUS_POLICY_RULE_ACCESS_DENY; - break; - case BUS_POLICY_RULE_OWN: - break; -@@ -122,7 +124,8 @@ bus_policy_rule_unref (BusPolicyRule *rule) - default: - _dbus_assert_not_reached ("invalid rule"); - } -- -+ -+ dbus_free (rule->privilege); - dbus_free (rule); - } - } -@@ -435,7 +438,10 @@ list_allows_user (dbus_bool_t def, - else - continue; - -- allowed = rule->allow; -+ /* We don't intend to support <check user="..." /> and <check group="..." /> -+ rules. They are treated like deny. -+ */ -+ allowed = rule->access == BUS_POLICY_RULE_ACCESS_ALLOW; - } - - return allowed; -@@ -873,18 +879,23 @@ bus_client_policy_append_rule (BusClientPolicy *policy, - return TRUE; - } - --dbus_bool_t --bus_client_policy_check_can_send (BusClientPolicy *policy, -- BusRegistry *registry, -- dbus_bool_t requested_reply, -- DBusConnection *receiver, -- DBusMessage *message, -- dbus_int32_t *toggles, -- dbus_bool_t *log) -+BusResult -+bus_client_policy_check_can_send (DBusConnection *sender, -+ BusClientPolicy *policy, -+ BusRegistry *registry, -+ dbus_bool_t requested_reply, -+ DBusConnection *addressed_recipient, -+ DBusConnection *receiver, -+ DBusMessage *message, -+ dbus_int32_t *toggles, -+ dbus_bool_t *log, -+ const char **privilege_param, -+ BusDeferredMessage **deferred_message) - { - DBusList *link; -- dbus_bool_t allowed; -- -+ BusResult result; -+ const char *privilege; -+ - /* policy->rules is in the order the rules appeared - * in the config file, i.e. last rule that applies wins - */ -@@ -892,7 +903,7 @@ bus_client_policy_check_can_send (BusClientPolicy *policy, - _dbus_verbose (" (policy) checking send rules\n"); - *toggles = 0; - -- allowed = FALSE; -+ result = BUS_RESULT_FALSE; - link = _dbus_list_get_first_link (&policy->rules); - while (link != NULL) - { -@@ -923,13 +934,14 @@ bus_client_policy_check_can_send (BusClientPolicy *policy, - /* If it's a reply, the requested_reply flag kicks in */ - if (dbus_message_get_reply_serial (message) != 0) - { -- /* for allow, requested_reply=true means the rule applies -- * only when reply was requested. requested_reply=false means -- * always allow. -+ /* for allow or check requested_reply=true means the rule applies -+ * only when reply was requested. requested_reply=false means the -+ * rule always applies - */ -- if (!requested_reply && rule->allow && rule->d.send.requested_reply && !rule->d.send.eavesdrop) -+ if (!requested_reply && rule->access != BUS_POLICY_RULE_ACCESS_DENY && rule->d.send.requested_reply && !rule->d.send.eavesdrop) - { -- _dbus_verbose (" (policy) skipping allow rule since it only applies to requested replies and does not allow eavesdropping\n"); -+ _dbus_verbose (" (policy) skipping %s rule since it only applies to requested replies and does not allow eavesdropping\n", -+ rule->access == BUS_POLICY_RULE_ACCESS_ALLOW ? "allow" : "check"); - continue; - } - -@@ -937,7 +949,7 @@ bus_client_policy_check_can_send (BusClientPolicy *policy, - * when the reply was not requested. requested_reply=true means the - * rule always applies. - */ -- if (requested_reply && !rule->allow && !rule->d.send.requested_reply) -+ if (requested_reply && rule->access == BUS_POLICY_RULE_ACCESS_DENY && !rule->d.send.requested_reply) - { - _dbus_verbose (" (policy) skipping deny rule since it only applies to unrequested replies\n"); - continue; -@@ -960,13 +972,15 @@ bus_client_policy_check_can_send (BusClientPolicy *policy, - /* The interface is optional in messages. For allow rules, if the message - * has no interface we want to skip the rule (and thus not allow); - * for deny rules, if the message has no interface we want to use the -- * rule (and thus deny). -+ * rule (and thus deny). Check rules are meant to be used like allow -+ * rules (they can grant access, but not remove it), so we treat it like -+ * allow here. - */ - dbus_bool_t no_interface; - - no_interface = dbus_message_get_interface (message) == NULL; - -- if ((no_interface && rule->allow) || -+ if ((no_interface && rule->access != BUS_POLICY_RULE_ACCESS_DENY) || - (!no_interface && - strcmp (dbus_message_get_interface (message), - rule->d.send.interface) != 0)) -@@ -1079,33 +1093,64 @@ bus_client_policy_check_can_send (BusClientPolicy *policy, - } - - /* Use this rule */ -- allowed = rule->allow; -+ switch (rule->access) -+ { -+ case BUS_POLICY_RULE_ACCESS_ALLOW: -+ result = BUS_RESULT_TRUE; -+ break; -+ case BUS_POLICY_RULE_ACCESS_DENY: -+ default: -+ result = BUS_RESULT_FALSE; -+ break; -+ case BUS_POLICY_RULE_ACCESS_CHECK: -+ result = BUS_RESULT_LATER; -+ privilege = rule->privilege; -+ break; -+ } -+ - *log = rule->d.send.log; - (*toggles)++; - -- _dbus_verbose (" (policy) used rule, allow now = %d\n", -- allowed); -+ _dbus_verbose (" (policy) used rule, result now = %d\n", -+ (int)(intptr_t)result); - } - -- return allowed; -+ if (result == BUS_RESULT_LATER) -+ { -+ BusContext *context = bus_connection_get_context(sender); -+ BusCheck *check = bus_context_get_check(context); -+ -+ result = bus_check_privilege(check, message, sender, addressed_recipient, receiver, -+ privilege, BUS_DEFERRED_MESSAGE_CHECK_SEND, deferred_message); -+ } -+ else -+ privilege = NULL; -+ -+ if (privilege_param != NULL) -+ *privilege_param = privilege; -+ -+ return result; - } - - /* See docs on what the args mean on bus_context_check_security_policy() - * comment - */ --dbus_bool_t --bus_client_policy_check_can_receive (BusClientPolicy *policy, -- BusRegistry *registry, -- dbus_bool_t requested_reply, -- DBusConnection *sender, -- DBusConnection *addressed_recipient, -- DBusConnection *proposed_recipient, -- DBusMessage *message, -- dbus_int32_t *toggles) -+BusResult -+bus_client_policy_check_can_receive (BusClientPolicy *policy, -+ BusRegistry *registry, -+ dbus_bool_t requested_reply, -+ DBusConnection *sender, -+ DBusConnection *addressed_recipient, -+ DBusConnection *proposed_recipient, -+ DBusMessage *message, -+ dbus_int32_t *toggles, -+ const char **privilege_param, -+ BusDeferredMessage **deferred_message) - { - DBusList *link; -- dbus_bool_t allowed; - dbus_bool_t eavesdropping; -+ BusResult result; -+ const char *privilege; - - eavesdropping = - addressed_recipient != proposed_recipient && -@@ -1118,7 +1163,7 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy, - _dbus_verbose (" (policy) checking receive rules, eavesdropping = %d\n", eavesdropping); - *toggles = 0; - -- allowed = FALSE; -+ result = BUS_RESULT_FALSE; - link = _dbus_list_get_first_link (&policy->rules); - while (link != NULL) - { -@@ -1141,19 +1186,21 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy, - } - } - -- /* for allow, eavesdrop=false means the rule doesn't apply when -- * eavesdropping. eavesdrop=true means always allow. -+ -+ /* for allow or check, eavesdrop=false means the rule doesn't apply when -+ * eavesdropping. eavesdrop=true means the rule always applies - */ -- if (eavesdropping && rule->allow && !rule->d.receive.eavesdrop) -+ if (eavesdropping && rule->access != BUS_POLICY_RULE_ACCESS_DENY && !rule->d.receive.eavesdrop) - { -- _dbus_verbose (" (policy) skipping allow rule since it doesn't apply to eavesdropping\n"); -+ _dbus_verbose (" (policy) skipping %s rule since it doesn't apply to eavesdropping\n", -+ rule->access == BUS_POLICY_RULE_ACCESS_ALLOW ? "allow" : "check"); - continue; - } - - /* for deny, eavesdrop=true means the rule applies only when - * eavesdropping; eavesdrop=false means always deny. - */ -- if (!eavesdropping && !rule->allow && rule->d.receive.eavesdrop) -+ if (!eavesdropping && rule->access == BUS_POLICY_RULE_ACCESS_DENY && rule->d.receive.eavesdrop) - { - _dbus_verbose (" (policy) skipping deny rule since it only applies to eavesdropping\n"); - continue; -@@ -1162,13 +1209,14 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy, - /* If it's a reply, the requested_reply flag kicks in */ - if (dbus_message_get_reply_serial (message) != 0) - { -- /* for allow, requested_reply=true means the rule applies -- * only when reply was requested. requested_reply=false means -- * always allow. -+ /* for allow or check requested_reply=true means the rule applies -+ * only when reply was requested. requested_reply=false means the -+ * rule always applies - */ -- if (!requested_reply && rule->allow && rule->d.receive.requested_reply && !rule->d.receive.eavesdrop) -+ if (!requested_reply && rule->access != BUS_POLICY_RULE_ACCESS_DENY && rule->d.send.requested_reply && !rule->d.send.eavesdrop) - { -- _dbus_verbose (" (policy) skipping allow rule since it only applies to requested replies and does not allow eavesdropping\n"); -+ _dbus_verbose (" (policy) skipping %s rule since it only applies to requested replies and does not allow eavesdropping\n", -+ rule->access == BUS_POLICY_RULE_ACCESS_DENY ? "allow" : "deny"); - continue; - } - -@@ -1176,7 +1224,7 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy, - * when the reply was not requested. requested_reply=true means the - * rule always applies. - */ -- if (requested_reply && !rule->allow && !rule->d.receive.requested_reply) -+ if (requested_reply && rule->access == BUS_POLICY_RULE_ACCESS_DENY && !rule->d.receive.requested_reply) - { - _dbus_verbose (" (policy) skipping deny rule since it only applies to unrequested replies\n"); - continue; -@@ -1199,13 +1247,13 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy, - /* The interface is optional in messages. For allow rules, if the message - * has no interface we want to skip the rule (and thus not allow); - * for deny rules, if the message has no interface we want to use the -- * rule (and thus deny). -+ * rule (and thus deny). Check rules are treated like allow rules. - */ - dbus_bool_t no_interface; - - no_interface = dbus_message_get_interface (message) == NULL; - -- if ((no_interface && rule->allow) || -+ if ((no_interface && rule->access != BUS_POLICY_RULE_ACCESS_DENY) || - (!no_interface && - strcmp (dbus_message_get_interface (message), - rule->d.receive.interface) != 0)) -@@ -1295,14 +1343,43 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy, - } - - /* Use this rule */ -- allowed = rule->allow; -+ switch (rule->access) -+ { -+ case BUS_POLICY_RULE_ACCESS_ALLOW: -+ result = BUS_RESULT_TRUE; -+ break; -+ case BUS_POLICY_RULE_ACCESS_DENY: -+ default: -+ result = BUS_RESULT_FALSE; -+ break; -+ case BUS_POLICY_RULE_ACCESS_CHECK: -+ result = BUS_RESULT_LATER; -+ privilege = rule->privilege; -+ break; -+ } -+ - (*toggles)++; - -- _dbus_verbose (" (policy) used rule, allow now = %d\n", -- allowed); -+ _dbus_verbose (" (policy) used rule, result now = %d\n", -+ (int)(intptr_t)result); - } - -- return allowed; -+ -+ if (result == BUS_RESULT_LATER) -+ { -+ BusContext *context = bus_connection_get_context(proposed_recipient); -+ BusCheck *check = bus_context_get_check(context); -+ -+ result = bus_check_privilege(check, message, sender, addressed_recipient, proposed_recipient, -+ privilege, BUS_DEFERRED_MESSAGE_CHECK_RECEIVE, deferred_message); -+ } -+ else -+ privilege = NULL; -+ -+ if (privilege_param != NULL) -+ *privilege_param = privilege; -+ -+ return result; - } - - -@@ -1354,7 +1431,7 @@ bus_rules_check_can_own (DBusList *rules, - } - - /* Use this rule */ -- allowed = rule->allow; -+ allowed = rule->access == BUS_POLICY_RULE_ACCESS_ALLOW; - } - - return allowed; -diff --git a/bus/policy.h b/bus/policy.h -index ec43ffa..f839d23 100644 ---- a/bus/policy.h -+++ b/bus/policy.h -@@ -46,6 +46,14 @@ typedef enum - BUS_POLICY_TRISTATE_TRUE - } BusPolicyTristate; - -+typedef enum -+{ -+ BUS_POLICY_RULE_ACCESS_DENY, -+ BUS_POLICY_RULE_ACCESS_ALLOW, -+ /** runtime check resulting in allow or deny */ -+ BUS_POLICY_RULE_ACCESS_CHECK -+} BusPolicyRuleAccess; -+ - /** determines whether the rule affects a connection, or some global item */ - #define BUS_POLICY_RULE_IS_PER_CLIENT(rule) (!((rule)->type == BUS_POLICY_RULE_USER || \ - (rule)->type == BUS_POLICY_RULE_GROUP)) -@@ -56,8 +64,9 @@ struct BusPolicyRule - - BusPolicyRuleType type; - -- unsigned int allow : 1; /**< #TRUE if this allows, #FALSE if it denies */ -- -+ unsigned int access : 2; /**< BusPolicyRuleAccess */ -+ char *privilege; /**< for BUS_POLICY_RULE_ACCESS_CHECK */ -+ - union - { - struct -@@ -118,7 +127,7 @@ struct BusPolicyRule - }; - - BusPolicyRule* bus_policy_rule_new (BusPolicyRuleType type, -- dbus_bool_t allow); -+ BusPolicyRuleAccess access); - BusPolicyRule* bus_policy_rule_ref (BusPolicyRule *rule); - void bus_policy_rule_unref (BusPolicyRule *rule); - -@@ -152,21 +161,27 @@ dbus_bool_t bus_policy_merge (BusPolicy *policy, - BusClientPolicy* bus_client_policy_new (void); - BusClientPolicy* bus_client_policy_ref (BusClientPolicy *policy); - void bus_client_policy_unref (BusClientPolicy *policy); --dbus_bool_t bus_client_policy_check_can_send (BusClientPolicy *policy, -+BusResult bus_client_policy_check_can_send (DBusConnection *sender, -+ BusClientPolicy *policy, - BusRegistry *registry, - dbus_bool_t requested_reply, -+ DBusConnection *addressed_recipient, - DBusConnection *receiver, - DBusMessage *message, - dbus_int32_t *toggles, -- dbus_bool_t *log); --dbus_bool_t bus_client_policy_check_can_receive (BusClientPolicy *policy, -+ dbus_bool_t *log, -+ const char **privilege_param, -+ BusDeferredMessage **deferred_message); -+BusResult bus_client_policy_check_can_receive (BusClientPolicy *policy, - BusRegistry *registry, - dbus_bool_t requested_reply, - DBusConnection *sender, - DBusConnection *addressed_recipient, - DBusConnection *proposed_recipient, - DBusMessage *message, -- dbus_int32_t *toggles); -+ dbus_int32_t *toggles, -+ const char **privilege_param, -+ BusDeferredMessage **deferred_message); - dbus_bool_t bus_client_policy_check_can_own (BusClientPolicy *policy, - const DBusString *service_name); - dbus_bool_t bus_client_policy_append_rule (BusClientPolicy *policy, -diff --git a/configure.ac b/configure.ac -index d1e3a29..11b5ffd 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1742,6 +1742,17 @@ AC_ARG_ENABLE([user-session], - AM_CONDITIONAL([DBUS_ENABLE_USER_SESSION], - [test "x$enable_user_session" = xyes]) - -+#enable cynara integration -+AC_ARG_ENABLE([cynara], [AS_HELP_STRING([--enable-cynara], [enable Cynara integration])], [], [enable_cynara=no]) -+if test "x$enable_cynara" = xyes; then -+ PKG_CHECK_MODULES([CYNARA], [cynara-client-async >= 0.6.0 cynara-session >= 0.6.0], -+ [AC_DEFINE([DBUS_ENABLE_CYNARA], [1], [Define to enable Cynara privilege checks in dbus-daemon])], -+ [AC_MSG_ERROR([libcynara-client-async and cynara-session are required to enable Cynara integration])]) -+fi -+ -+AC_SUBST([CYNARA_CFLAGS]) -+AC_SUBST([CYNARA_LIBS]) -+ - AC_CONFIG_FILES([ - Doxyfile - dbus/Version -@@ -1824,6 +1835,7 @@ echo " - Building bus stats API: ${enable_stats} - Building SELinux support: ${have_selinux} - Building AppArmor support: ${have_apparmor} -+ Building Cynara support: ${enable_cynara} - Building inotify support: ${have_inotify} - Building kqueue support: ${have_kqueue} - Building systemd support: ${have_systemd} -diff --git a/test/Makefile.am b/test/Makefile.am -index af1e13b..e6f50e1 100644 ---- a/test/Makefile.am -+++ b/test/Makefile.am -@@ -439,6 +439,7 @@ in_data = \ - data/valid-config-files/debug-allow-all.conf.in \ - data/valid-config-files/finite-timeout.conf.in \ - data/valid-config-files/forbidding.conf.in \ -+ data/valid-config-files/debug-check-some.conf.in \ - data/valid-config-files/incoming-limit.conf.in \ - data/valid-config-files/max-completed-connections.conf.in \ - data/valid-config-files/max-connections-per-user.conf.in \ -diff --git a/test/data/invalid-config-files/badcheck-1.conf b/test/data/invalid-config-files/badcheck-1.conf -new file mode 100644 -index 0000000..fad9f50 ---- /dev/null -+++ b/test/data/invalid-config-files/badcheck-1.conf -@@ -0,0 +1,9 @@ -+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" -+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> -+<busconfig> -+ <user>mybususer</user> -+ <listen>unix:path=/foo/bar</listen> -+ <policy context="default"> -+ <allow privilege="foo" send_destination="*"/> <!-- extra privilege="foo" --> -+ </policy> -+</busconfig> -diff --git a/test/data/invalid-config-files/badcheck-2.conf b/test/data/invalid-config-files/badcheck-2.conf -new file mode 100644 -index 0000000..63c7ef2 ---- /dev/null -+++ b/test/data/invalid-config-files/badcheck-2.conf -@@ -0,0 +1,9 @@ -+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" -+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> -+<busconfig> -+ <user>mybususer</user> -+ <listen>unix:path=/foo/bar</listen> -+ <policy context="default"> -+ <check send_destination="*"/> <!-- missing privilege="foo" --> -+ </policy> -+</busconfig> -diff --git a/test/data/valid-config-files/check-1.conf b/test/data/valid-config-files/check-1.conf -new file mode 100644 -index 0000000..ad71473 ---- /dev/null -+++ b/test/data/valid-config-files/check-1.conf -@@ -0,0 +1,9 @@ -+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" -+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> -+<busconfig> -+ <user>mybususer</user> -+ <listen>unix:path=/foo/bar</listen> -+ <policy context="default"> -+ <check privilege="foo" send_destination="*"/> -+ </policy> -+</busconfig> -diff --git a/test/data/valid-config-files/debug-check-some.conf.in b/test/data/valid-config-files/debug-check-some.conf.in -new file mode 100644 -index 0000000..47ee854 ---- /dev/null -+++ b/test/data/valid-config-files/debug-check-some.conf.in -@@ -0,0 +1,18 @@ -+<!-- Bus that listens on a debug pipe and doesn't create any restrictions --> -+ -+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" -+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> -+<busconfig> -+ <listen>debug-pipe:name=test-server</listen> -+ <listen>@TEST_LISTEN@</listen> -+ <servicedir>@DBUS_TEST_DATA@/valid-service-files</servicedir> -+ <policy context="default"> -+ <allow send_interface="*"/> -+ <allow receive_interface="*"/> -+ <allow own="*"/> -+ <allow user="*"/> -+ -+ <deny send_interface="org.freedesktop.TestSuite" send_member="Echo"/> -+ <check privilege="foo" send_interface="org.freedesktop.TestSuite" send_member="Echo"/> -+ </policy> -+</busconfig> --- -2.21.1 - diff --git a/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0002-Disable-message-dispatching-when-send-rule-result-is.patch b/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0002-Disable-message-dispatching-when-send-rule-result-is.patch deleted file mode 100644 index bac8cf97f..000000000 --- a/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0002-Disable-message-dispatching-when-send-rule-result-is.patch +++ /dev/null @@ -1,967 +0,0 @@ -From c2f4ba585c777b731df6b6b8a165b6cc4dc5d639 Mon Sep 17 00:00:00 2001 -From: Jacek Bukarewicz <j.bukarewicz@samsung.com> -Date: Fri, 28 Nov 2014 12:07:39 +0100 -Subject: [PATCH 2/8] Disable message dispatching when send rule result is not - known -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When unicast message is sent to addressed recipient and policy result -is not available message dispatch from the sender is disabled. -This also means that any further messages from the given connection are -put into the incoming queue without being processed. If response is received -message dispatching is resumed. This time answer is attached to the message -which is now processed synchronously. -Receive rule result unavailability is not yet handled - such messages are -rejected. Also, if message is sent to non-addressed recipient and policy result -is unknown, message is silently dropped. - -Cherry-picked from b1b87ad9f20b2052c28431b48e81073078a745ce -by Jose Bollo. - -Updated for dbus 1.10.20 by Scott Murray and José Bollo - -Signed-off-by: José Bollo <jose.bollo@iot.bzh> -Signed-off-by: Scott Murray <scott.murray@konsulko.com> ---- - bus/activation.c | 76 +++++++++++-- - bus/check.c | 109 +++++++++++++++++-- - bus/check.h | 10 ++ - bus/cynara.c | 1 - - bus/dispatch.c | 184 ++++++++++++++++++++++++++++---- - bus/dispatch.h | 2 +- - bus/driver.c | 12 ++- - dbus/dbus-connection-internal.h | 15 +++ - dbus/dbus-connection.c | 125 +++++++++++++++++++++- - dbus/dbus-list.c | 29 +++++ - dbus/dbus-list.h | 3 + - dbus/dbus-shared.h | 3 +- - 12 files changed, 528 insertions(+), 41 deletions(-) - -diff --git a/bus/activation.c b/bus/activation.c -index f9c6c62..8301b59 100644 ---- a/bus/activation.c -+++ b/bus/activation.c -@@ -32,6 +32,7 @@ - #include "services.h" - #include "test.h" - #include "utils.h" -+#include <dbus/dbus-connection-internal.h> - #include <dbus/dbus-internals.h> - #include <dbus/dbus-hash.h> - #include <dbus/dbus-list.h> -@@ -94,6 +95,8 @@ struct BusPendingActivationEntry - DBusConnection *connection; - - dbus_bool_t auto_activation; -+ -+ dbus_bool_t is_put_back; - }; - - typedef struct -@@ -1241,20 +1244,23 @@ bus_activation_send_pending_auto_activation_messages (BusActivation *activation - BusPendingActivationEntry *entry = link->data; - DBusList *next = _dbus_list_get_next_link (&pending_activation->entries, link); - -- if (entry->auto_activation && (entry->connection == NULL || dbus_connection_get_is_connected (entry->connection))) -+ if (entry->auto_activation && !entry->is_put_back && -+ (entry->connection == NULL || dbus_connection_get_is_connected (entry->connection))) - { - DBusConnection *addressed_recipient; - DBusError error; -+ BusResult res; - - dbus_error_init (&error); - - addressed_recipient = bus_service_get_primary_owners_connection (service); - - /* Resume dispatching where we left off in bus_dispatch() */ -- if (!bus_dispatch_matches (transaction, -- entry->connection, -- addressed_recipient, -- entry->activation_message, &error)) -+ res = bus_dispatch_matches (transaction, -+ entry->connection, -+ addressed_recipient, -+ entry->activation_message, &error); -+ if (res == BUS_RESULT_FALSE) - { - /* If permission is denied, we just want to return the error - * to the original method invoker; in particular, we don't -@@ -1266,11 +1272,44 @@ bus_activation_send_pending_auto_activation_messages (BusActivation *activation - bus_connection_send_oom_error (entry->connection, - entry->activation_message); - } -- - dbus_error_free (&error); - link = next; - continue; - } -+ else if (res == BUS_RESULT_LATER) -+ { -+ DBusList *putback_message_link = link; -+ DBusMessage *last_inserted_message = NULL; -+ -+ /* NULL entry->connection implies sending pending ActivationRequest message to systemd */ -+ if (entry->connection == NULL) -+ { -+ _dbus_assert_not_reached ("bus_dispatch_matches returned BUS_RESULT_LATER unexpectedly when sender is NULL"); -+ link = next; -+ continue; -+ } -+ -+ /** -+ * Getting here means that policy check result is not yet available and dispatching -+ * messages from entry->connection has been disabled. -+ * Let's put back all messages for the given connection in the incoming queue and mark -+ * this entry as put back so they are not handled twice. -+ */ -+ while (putback_message_link != NULL) -+ { -+ BusPendingActivationEntry *putback_message = putback_message_link->data; -+ if (putback_message->connection == entry->connection) -+ { -+ if (!_dbus_connection_putback_message (putback_message->connection, last_inserted_message, -+ putback_message->activation_message, &error)) -+ goto error; -+ last_inserted_message = putback_message->activation_message; -+ putback_message->is_put_back = TRUE; -+ } -+ -+ putback_message_link = _dbus_list_get_next_link(&pending_activation->entries, putback_message_link); -+ } -+ } - } - - link = next; -@@ -1287,6 +1326,19 @@ bus_activation_send_pending_auto_activation_messages (BusActivation *activation - return TRUE; - - error: -+ /* remove all messages that have been put to connections' incoming queues */ -+ link = _dbus_list_get_first_link (&pending_activation->entries); -+ while (link != NULL) -+ { -+ BusPendingActivationEntry *entry = link->data; -+ if (entry->is_put_back) -+ { -+ _dbus_connection_remove_message(entry->connection, entry->activation_message); -+ entry->is_put_back = FALSE; -+ } -+ link = _dbus_list_get_next_link(&pending_activation->entries, link); -+ } -+ - return FALSE; - } - -@@ -2079,6 +2131,7 @@ bus_activation_activate_service (BusActivation *activation, - - if (service != NULL) - { -+ BusResult res; - bus_context_log (activation->context, - DBUS_SYSTEM_LOG_INFO, "Activating via systemd: service name='%s' unit='%s' requested by '%s' (%s)", - service_name, -@@ -2086,8 +2139,17 @@ bus_activation_activate_service (BusActivation *activation, - bus_connection_get_name (connection), - bus_connection_get_loginfo (connection)); - /* Wonderful, systemd is connected, let's just send the msg */ -- retval = bus_dispatch_matches (activation_transaction, NULL, -+ res = bus_dispatch_matches (activation_transaction, NULL, - systemd, message, error); -+ -+ if (res == BUS_RESULT_TRUE) -+ retval = TRUE; -+ else -+ { -+ retval = FALSE; -+ if (res == BUS_RESULT_LATER) -+ _dbus_verbose("Unexpectedly need time to check message from bus driver to systemd - dropping the message.\n"); -+ } - } - else - { -diff --git a/bus/check.c b/bus/check.c -index 5b72d31..4b8a699 100644 ---- a/bus/check.c -+++ b/bus/check.c -@@ -55,6 +55,8 @@ typedef struct BusDeferredMessage - BusCheckResponseFunc response_callback; - } BusDeferredMessage; - -+static dbus_int32_t deferred_message_data_slot = -1; -+ - BusCheck * - bus_check_new (BusContext *context, DBusError *error) - { -@@ -67,11 +69,19 @@ bus_check_new (BusContext *context, DBusError *error) - return NULL; - } - -+ if (!dbus_message_allocate_data_slot(&deferred_message_data_slot)) -+ { -+ dbus_free(check); -+ BUS_SET_OOM(error); -+ return NULL; -+ } -+ - check->refcount = 1; - check->context = context; - check->cynara = bus_cynara_new(check, error); - if (dbus_error_is_set(error)) - { -+ dbus_message_free_data_slot(&deferred_message_data_slot); - dbus_free(check); - return NULL; - } -@@ -98,6 +108,7 @@ bus_check_unref (BusCheck *check) - if (check->refcount == 0) - { - bus_cynara_unref(check->cynara); -+ dbus_message_free_data_slot(&deferred_message_data_slot); - dbus_free(check); - } - } -@@ -114,6 +125,45 @@ bus_check_get_cynara (BusCheck *check) - return check->cynara; - } - -+static void -+bus_check_enable_dispatch_callback (BusDeferredMessage *deferred_message, -+ BusResult result) -+{ -+ _dbus_verbose("bus_check_enable_dispatch_callback called deferred_message=%p\n", deferred_message); -+ -+ deferred_message->response = result; -+ _dbus_connection_enable_dispatch(deferred_message->sender); -+} -+ -+static void -+deferred_message_free_function(void *data) -+{ -+ BusDeferredMessage *deferred_message = (BusDeferredMessage *)data; -+ bus_deferred_message_unref(deferred_message); -+} -+ -+void -+bus_deferred_message_disable_sender (BusDeferredMessage *deferred_message) -+{ -+ _dbus_assert(deferred_message != NULL); -+ _dbus_assert(deferred_message->sender != NULL); -+ -+ if (dbus_message_get_data(deferred_message->message, deferred_message_data_slot) == NULL) -+ { -+ if (dbus_message_set_data(deferred_message->message, deferred_message_data_slot, deferred_message, -+ deferred_message_free_function)) -+ bus_deferred_message_ref(deferred_message); -+ } -+ -+ _dbus_connection_disable_dispatch(deferred_message->sender); -+ deferred_message->response_callback = bus_check_enable_dispatch_callback; -+} -+ -+#ifdef DBUS_ENABLE_EMBEDDED_TESTS -+BusResult (*bus_check_test_override) (DBusConnection *connection, -+ const char *privilege); -+#endif -+ - BusResult - bus_check_privilege (BusCheck *check, - DBusMessage *message, -@@ -124,6 +174,7 @@ bus_check_privilege (BusCheck *check, - BusDeferredMessageStatus check_type, - BusDeferredMessage **deferred_message) - { -+ BusDeferredMessage *previous_deferred_message; - BusResult result = BUS_RESULT_FALSE; - #ifdef DBUS_ENABLE_CYNARA - BusCynara *cynara; -@@ -137,16 +188,54 @@ bus_check_privilege (BusCheck *check, - return BUS_RESULT_FALSE; - } - -- /* ask policy checkers */ --#ifdef DBUS_ENABLE_CYNARA -- cynara = bus_check_get_cynara(check); -- result = bus_cynara_check_privilege(cynara, message, sender, addressed_recipient, -- proposed_recipient, privilege, check_type, deferred_message); -+#ifdef DBUS_ENABLE_EMBEDDED_TESTS -+ if (bus_check_test_override) -+ return bus_check_test_override (connection, privilege); - #endif - -- if (result == BUS_RESULT_LATER && deferred_message != NULL) -+ previous_deferred_message = dbus_message_get_data(message, deferred_message_data_slot); -+ /* check if message blocked at sender's queue is being processed */ -+ if (previous_deferred_message != NULL) -+ { -+ if ((check_type & BUS_DEFERRED_MESSAGE_CHECK_SEND) && -+ !(previous_deferred_message->status & BUS_DEFERRED_MESSAGE_CHECK_SEND)) -+ { -+ /** -+ * Message has been deferred due to receive or own rule which means that sending this message -+ * is allowed - it must have been checked previously. -+ * This might happen when client calls RequestName method which depending on security -+ * policy might result in both "can_send" and "can_own" Cynara checks. -+ */ -+ result = BUS_RESULT_TRUE; -+ } -+ else -+ { -+ result = previous_deferred_message->response; -+ if (result == BUS_RESULT_LATER) -+ { -+ /* result is still not known - reuse deferred message object */ -+ if (deferred_message != NULL) -+ *deferred_message = previous_deferred_message; -+ } -+ else -+ { -+ /* result is available - we can remove deferred message from the processed message */ -+ dbus_message_set_data(message, deferred_message_data_slot, NULL, NULL); -+ } -+ } -+ } -+ else - { -- (*deferred_message)->status |= check_type; -+ /* ask policy checkers */ -+#ifdef DBUS_ENABLE_CYNARA -+ cynara = bus_check_get_cynara(check); -+ result = bus_cynara_check_privilege(cynara, message, sender, addressed_recipient, -+ proposed_recipient, privilege, check_type, deferred_message); -+#endif -+ if (result == BUS_RESULT_LATER && deferred_message != NULL) -+ { -+ (*deferred_message)->status |= check_type; -+ } - } - return result; - } -@@ -206,6 +295,12 @@ bus_deferred_message_unref (BusDeferredMessage *deferred_message) - } - } - -+BusDeferredMessageStatus -+bus_deferred_message_get_status (BusDeferredMessage *deferred_message) -+{ -+ return deferred_message->status; -+} -+ - void - bus_deferred_message_response_received (BusDeferredMessage *deferred_message, - BusResult result) -diff --git a/bus/check.h b/bus/check.h -index c3fcaf9..d177549 100644 ---- a/bus/check.h -+++ b/bus/check.h -@@ -55,6 +55,7 @@ BusResult bus_check_privilege (BusCheck *check, - BusDeferredMessageStatus check_type, - BusDeferredMessage **deferred_message); - -+ - BusDeferredMessage *bus_deferred_message_new (DBusMessage *message, - DBusConnection *sender, - DBusConnection *addressed_recipient, -@@ -65,4 +66,13 @@ BusDeferredMessage *bus_deferred_message_ref (BusDeferredMessage - void bus_deferred_message_unref (BusDeferredMessage *deferred_message); - void bus_deferred_message_response_received (BusDeferredMessage *deferred_message, - BusResult result); -+void bus_deferred_message_disable_sender (BusDeferredMessage *deferred_message); -+ -+BusDeferredMessageStatus bus_deferred_message_get_status (BusDeferredMessage *deferred_message); -+ -+#ifdef DBUS_ENABLE_EMBEDDED_TESTS -+extern BusResult (*bus_check_test_override) (DBusConnection *connection, -+ const char *privilege); -+#endif -+ - #endif /* BUS_CHECK_H */ -diff --git a/bus/cynara.c b/bus/cynara.c -index 57a4c45..77aed62 100644 ---- a/bus/cynara.c -+++ b/bus/cynara.c -@@ -36,7 +36,6 @@ - #include <cynara-client-async.h> - #endif - -- - #ifdef DBUS_ENABLE_CYNARA - typedef struct BusCynara - { -diff --git a/bus/dispatch.c b/bus/dispatch.c -index d3867f7..50a22a3 100644 ---- a/bus/dispatch.c -+++ b/bus/dispatch.c -@@ -35,6 +35,7 @@ - #include "signals.h" - #include "test.h" - #include <dbus/dbus-internals.h> -+#include <dbus/dbus-connection-internal.h> - #include <dbus/dbus-misc.h> - #include <string.h> - -@@ -122,7 +123,7 @@ send_one_message (DBusConnection *connection, - return TRUE; - } - --dbus_bool_t -+BusResult - bus_dispatch_matches (BusTransaction *transaction, - DBusConnection *sender, - DBusConnection *addressed_recipient, -@@ -158,13 +159,29 @@ bus_dispatch_matches (BusTransaction *transaction, - message, NULL, error, - &deferred_message); - if (res == BUS_RESULT_FALSE) -- return FALSE; -+ return BUS_RESULT_FALSE; - else if (res == BUS_RESULT_LATER) - { -- dbus_set_error (error, -- DBUS_ERROR_ACCESS_DENIED, -- "Rejecting message because time is needed to check security policy"); -- return FALSE; -+ BusDeferredMessageStatus status; -+ status = bus_deferred_message_get_status(deferred_message); -+ -+ if (status & BUS_DEFERRED_MESSAGE_CHECK_SEND) -+ { -+ /* send rule result not available - disable dispatching messages from the sender */ -+ bus_deferred_message_disable_sender(deferred_message); -+ return BUS_RESULT_LATER; -+ } -+ else if (status & BUS_DEFERRED_MESSAGE_CHECK_RECEIVE) -+ { -+ dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED, -+ "Rejecting message because time is needed to check security policy"); -+ return BUS_RESULT_FALSE; -+ } -+ else -+ { -+ _dbus_verbose("deferred message has no status field set to send or receive unexpectedly\n"); -+ return BUS_RESULT_FALSE; -+ } - } - - if (dbus_message_contains_unix_fds (message) && -@@ -175,14 +192,14 @@ bus_dispatch_matches (BusTransaction *transaction, - DBUS_ERROR_NOT_SUPPORTED, - "Tried to send message with Unix file descriptors" - "to a client that doesn't support that."); -- return FALSE; -- } -+ return BUS_RESULT_FALSE; -+ } - - /* Dispatch the message */ - if (!bus_transaction_send (transaction, addressed_recipient, message)) - { - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - } - -@@ -197,7 +214,7 @@ bus_dispatch_matches (BusTransaction *transaction, - &recipients)) - { - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - link = _dbus_list_get_first_link (&recipients); -@@ -219,10 +236,10 @@ bus_dispatch_matches (BusTransaction *transaction, - if (dbus_error_is_set (&tmp_error)) - { - dbus_move_error (&tmp_error, error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - else -- return TRUE; -+ return BUS_RESULT_TRUE; - } - - static DBusHandlerResult -@@ -409,10 +426,12 @@ bus_dispatch (DBusConnection *connection, - } - else if (res == BUS_RESULT_LATER) - { -- dbus_set_error (&error, -- DBUS_ERROR_ACCESS_DENIED, -- "Rejecting message because time is needed to check security policy"); -- _dbus_verbose ("Security policy needs time to check policy. Dropping message\n"); -+ /* Disable dispatching messages from the sender, -+ * roll back and dispatch the message once the policy result is available */ -+ bus_deferred_message_disable_sender(deferred_message); -+ bus_transaction_cancel_and_free (transaction); -+ transaction = NULL; -+ result = DBUS_HANDLER_RESULT_LATER; - goto out; - } - -@@ -514,8 +533,14 @@ bus_dispatch (DBusConnection *connection, - * addressed_recipient == NULL), and match it against other connections' - * match rules. - */ -- if (!bus_dispatch_matches (transaction, connection, addressed_recipient, message, &error)) -- goto out; -+ if (BUS_RESULT_LATER == bus_dispatch_matches (transaction, connection, addressed_recipient, -+ message, &error)) -+ { -+ /* Roll back and dispatch the message once the policy result is available */ -+ bus_transaction_cancel_and_free (transaction); -+ transaction = NULL; -+ result = DBUS_HANDLER_RESULT_LATER; -+ } - - out: - if (dbus_error_is_set (&error)) -@@ -5060,9 +5085,132 @@ bus_dispatch_test_conf_fail (const DBusString *test_data_dir, - } - #endif - -+typedef struct { -+ DBusTimeout *timeout; -+ DBusConnection *connection; -+ dbus_bool_t timedout; -+ int check_counter; -+} BusTestCheckData; -+ -+static BusTestCheckData *cdata; -+ -+static dbus_bool_t -+bus_dispatch_test_check_timeout (void *data) -+{ -+ _dbus_verbose ("timeout triggered - pretend that privilege check result is available\n"); -+ -+ /* should only happen once during the test */ -+ _dbus_assert (!cdata->timedout); -+ cdata->timedout = TRUE; -+ _dbus_connection_enable_dispatch (cdata->connection); -+ -+ /* don't call this again */ -+ _dbus_loop_remove_timeout (bus_connection_get_loop (cdata->connection), -+ cdata->timeout); -+ dbus_connection_unref (cdata->connection); -+ cdata->connection = NULL; -+ return TRUE; -+} -+ -+static BusResult -+bus_dispatch_test_check_override (DBusConnection *connection, -+ const char *privilege) -+{ -+ _dbus_verbose ("overriding privilege check %s #%d\n", privilege, cdata->check_counter); -+ cdata->check_counter++; -+ if (!cdata->timedout) -+ { -+ dbus_bool_t added; -+ -+ /* Should be the first privilege check for the "Echo" method. */ -+ _dbus_assert (cdata->check_counter == 1); -+ cdata->timeout = _dbus_timeout_new (1, bus_dispatch_test_check_timeout, -+ NULL, NULL); -+ _dbus_assert (cdata->timeout); -+ added = _dbus_loop_add_timeout (bus_connection_get_loop (connection), -+ cdata->timeout); -+ _dbus_assert (added); -+ cdata->connection = connection; -+ dbus_connection_ref (connection); -+ _dbus_connection_disable_dispatch (connection); -+ return BUS_RESULT_LATER; -+ } -+ else -+ { -+ /* Should only be checked one more time, and this time succeeds. */ -+ _dbus_assert (cdata->check_counter == 2); -+ return BUS_RESULT_TRUE; -+ } -+} -+ -+static dbus_bool_t -+bus_dispatch_test_check (const DBusString *test_data_dir) -+{ -+ const char *filename = "valid-config-files/debug-check-some.conf"; -+ BusContext *context; -+ DBusConnection *foo; -+ DBusError error; -+ dbus_bool_t result = TRUE; -+ BusTestCheckData data; -+ -+ /* save the config name for the activation helper */ -+ if (!setenv_TEST_LAUNCH_HELPER_CONFIG (test_data_dir, filename)) -+ _dbus_assert_not_reached ("no memory setting TEST_LAUNCH_HELPER_CONFIG"); -+ -+ dbus_error_init (&error); -+ -+ context = bus_context_new_test (test_data_dir, filename); -+ if (context == NULL) -+ return FALSE; -+ -+ foo = dbus_connection_open_private (TEST_DEBUG_PIPE, &error); -+ if (foo == NULL) -+ _dbus_assert_not_reached ("could not alloc connection"); -+ -+ if (!bus_setup_debug_client (foo)) -+ _dbus_assert_not_reached ("could not set up connection"); -+ -+ spin_connection_until_authenticated (context, foo); -+ -+ if (!check_hello_message (context, foo)) -+ _dbus_assert_not_reached ("hello message failed"); -+ -+ if (!check_double_hello_message (context, foo)) -+ _dbus_assert_not_reached ("double hello message failed"); -+ -+ if (!check_add_match (context, foo, "")) -+ _dbus_assert_not_reached ("AddMatch message failed"); -+ -+ /* -+ * Cause bus_check_send_privilege() to return BUS_RESULT_LATER in the -+ * first call, then BUS_RESULT_TRUE. -+ */ -+ cdata = &data; -+ memset (cdata, 0, sizeof(*cdata)); -+ bus_check_test_override = bus_dispatch_test_check_override; -+ -+ result = check_existent_service_auto_start (context, foo); -+ -+ _dbus_assert (cdata->check_counter == 2); -+ _dbus_assert (cdata->timedout); -+ _dbus_assert (cdata->timeout); -+ _dbus_assert (!cdata->connection); -+ _dbus_timeout_unref (cdata->timeout); -+ -+ kill_client_connection_unchecked (foo); -+ -+ bus_context_unref (context); -+ -+ return result; -+} -+ - dbus_bool_t - bus_dispatch_test (const DBusString *test_data_dir) - { -+ _dbus_verbose ("<check> tests\n"); -+ if (!bus_dispatch_test_check (test_data_dir)) -+ return FALSE; -+ - /* run normal activation tests */ - _dbus_verbose ("Normal activation tests\n"); - if (!bus_dispatch_test_conf (test_data_dir, -diff --git a/bus/dispatch.h b/bus/dispatch.h -index fb5ba7a..afba6a2 100644 ---- a/bus/dispatch.h -+++ b/bus/dispatch.h -@@ -29,7 +29,7 @@ - - dbus_bool_t bus_dispatch_add_connection (DBusConnection *connection); - void bus_dispatch_remove_connection (DBusConnection *connection); --dbus_bool_t bus_dispatch_matches (BusTransaction *transaction, -+BusResult bus_dispatch_matches (BusTransaction *transaction, - DBusConnection *sender, - DBusConnection *recipient, - DBusMessage *message, -diff --git a/bus/driver.c b/bus/driver.c -index cd0a714..f414f64 100644 ---- a/bus/driver.c -+++ b/bus/driver.c -@@ -218,6 +218,7 @@ bus_driver_send_service_owner_changed (const char *service_name, - { - DBusMessage *message; - dbus_bool_t retval; -+ BusResult res; - const char *null_service; - - _DBUS_ASSERT_ERROR_IS_CLEAR (error); -@@ -253,7 +254,16 @@ bus_driver_send_service_owner_changed (const char *service_name, - if (!bus_transaction_capture (transaction, NULL, NULL, message)) - goto oom; - -- retval = bus_dispatch_matches (transaction, NULL, NULL, message, error); -+ res = bus_dispatch_matches (transaction, NULL, NULL, message, error); -+ if (res == BUS_RESULT_TRUE) -+ retval = TRUE; -+ else -+ { -+ retval = FALSE; -+ if (res == BUS_RESULT_LATER) -+ /* should never happen */ -+ _dbus_assert_not_reached ("bus_dispatch_matches returned BUS_RESULT_LATER unexpectedly"); -+ } - dbus_message_unref (message); - - return retval; -diff --git a/dbus/dbus-connection-internal.h b/dbus/dbus-connection-internal.h -index 4835732..94b1c95 100644 ---- a/dbus/dbus-connection-internal.h -+++ b/dbus/dbus-connection-internal.h -@@ -118,6 +118,21 @@ DBUS_PRIVATE_EXPORT - dbus_bool_t _dbus_connection_get_linux_security_label (DBusConnection *connection, - char **label_p); - -+DBUS_PRIVATE_EXPORT -+void _dbus_connection_enable_dispatch (DBusConnection *connection); -+DBUS_PRIVATE_EXPORT -+void _dbus_connection_disable_dispatch (DBusConnection *connection); -+ -+DBUS_PRIVATE_EXPORT -+dbus_bool_t _dbus_connection_putback_message (DBusConnection *connection, -+ DBusMessage *after_message, -+ DBusMessage *message, -+ DBusError *error); -+ -+DBUS_PRIVATE_EXPORT -+dbus_bool_t _dbus_connection_remove_message (DBusConnection *connection, -+ DBusMessage *message); -+ - /* if DBUS_ENABLE_STATS */ - DBUS_PRIVATE_EXPORT - void _dbus_connection_get_stats (DBusConnection *connection, -diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c -index c525b6d..958968c 100644 ---- a/dbus/dbus-connection.c -+++ b/dbus/dbus-connection.c -@@ -311,7 +311,8 @@ struct DBusConnection - */ - dbus_bool_t dispatch_acquired; /**< Someone has dispatch path (can drain incoming queue) */ - dbus_bool_t io_path_acquired; /**< Someone has transport io path (can use the transport to read/write messages) */ -- -+ -+ unsigned int dispatch_disabled : 1; /**< if true, then dispatching incoming messages is stopped until enabled again */ - unsigned int shareable : 1; /**< #TRUE if libdbus owns a reference to the connection and can return it from dbus_connection_open() more than once */ - - unsigned int exit_on_disconnect : 1; /**< If #TRUE, exit after handling disconnect signal */ -@@ -439,6 +440,39 @@ _dbus_connection_wakeup_mainloop (DBusConnection *connection) - (*connection->wakeup_main_function) (connection->wakeup_main_data); - } - -+static void -+_dbus_connection_set_dispatch(DBusConnection *connection, -+ dbus_bool_t disabled) -+{ -+ CONNECTION_LOCK (connection); -+ if (connection->dispatch_disabled != disabled) -+ { -+ DBusDispatchStatus status; -+ -+ connection->dispatch_disabled = disabled; -+ status = _dbus_connection_get_dispatch_status_unlocked (connection); -+ _dbus_connection_update_dispatch_status_and_unlock (connection, status); -+ } -+ else -+ { -+ CONNECTION_UNLOCK (connection); -+ } -+} -+ -+ -+void -+_dbus_connection_enable_dispatch (DBusConnection *connection) -+{ -+ _dbus_connection_set_dispatch (connection, FALSE); -+} -+ -+void -+ _dbus_connection_disable_dispatch (DBusConnection *connection) -+{ -+ _dbus_connection_set_dispatch (connection, TRUE); -+} -+ -+ - #ifdef DBUS_ENABLE_EMBEDDED_TESTS - /** - * Gets the locks so we can examine them -@@ -4069,6 +4103,82 @@ _dbus_connection_putback_message_link_unlocked (DBusConnection *connection, - "_dbus_connection_putback_message_link_unlocked"); - } - -+dbus_bool_t -+_dbus_connection_putback_message (DBusConnection *connection, -+ DBusMessage *after_message, -+ DBusMessage *message, -+ DBusError *error) -+{ -+ DBusDispatchStatus status; -+ DBusList *message_link = _dbus_list_alloc_link (message); -+ DBusList *after_link; -+ if (message_link == NULL) -+ { -+ _DBUS_SET_OOM (error); -+ return FALSE; -+ } -+ dbus_message_ref (message); -+ -+ CONNECTION_LOCK (connection); -+ _dbus_connection_acquire_dispatch (connection); -+ HAVE_LOCK_CHECK (connection); -+ -+ after_link = _dbus_list_find_first(&connection->incoming_messages, after_message); -+ _dbus_list_insert_after_link (&connection->incoming_messages, after_link, message_link); -+ connection->n_incoming += 1; -+ -+ _dbus_verbose ("Message %p (%s %s %s '%s') put back into queue %p, %d incoming\n", -+ message_link->data, -+ dbus_message_type_to_string (dbus_message_get_type (message_link->data)), -+ dbus_message_get_interface (message_link->data) ? -+ dbus_message_get_interface (message_link->data) : -+ "no interface", -+ dbus_message_get_member (message_link->data) ? -+ dbus_message_get_member (message_link->data) : -+ "no member", -+ dbus_message_get_signature (message_link->data), -+ connection, connection->n_incoming); -+ -+ _dbus_message_trace_ref (message_link->data, -1, -1, -+ "_dbus_connection_putback_message"); -+ -+ _dbus_connection_release_dispatch (connection); -+ -+ status = _dbus_connection_get_dispatch_status_unlocked (connection); -+ _dbus_connection_update_dispatch_status_and_unlock (connection, status); -+ -+ return TRUE; -+} -+ -+dbus_bool_t -+_dbus_connection_remove_message (DBusConnection *connection, -+ DBusMessage *message) -+{ -+ DBusDispatchStatus status; -+ dbus_bool_t removed; -+ -+ CONNECTION_LOCK (connection); -+ _dbus_connection_acquire_dispatch (connection); -+ HAVE_LOCK_CHECK (connection); -+ -+ removed = _dbus_list_remove(&connection->incoming_messages, message); -+ -+ if (removed) -+ { -+ connection->n_incoming -= 1; -+ dbus_message_unref(message); -+ _dbus_verbose ("Message %p removed from incoming queue\n", message); -+ } -+ else -+ _dbus_verbose ("Message %p not found in the incoming queue\n", message); -+ -+ _dbus_connection_release_dispatch (connection); -+ -+ status = _dbus_connection_get_dispatch_status_unlocked (connection); -+ _dbus_connection_update_dispatch_status_and_unlock (connection, status); -+ return removed; -+} -+ - /** - * Returns the first-received message from the incoming message queue, - * removing it from the queue. The caller owns a reference to the -@@ -4252,8 +4362,9 @@ static DBusDispatchStatus - _dbus_connection_get_dispatch_status_unlocked (DBusConnection *connection) - { - HAVE_LOCK_CHECK (connection); -- -- if (connection->n_incoming > 0) -+ if (connection->dispatch_disabled && _dbus_connection_get_is_connected_unlocked(connection)) -+ return DBUS_DISPATCH_COMPLETE; -+ else if (connection->n_incoming > 0) - return DBUS_DISPATCH_DATA_REMAINS; - else if (!_dbus_transport_queue_messages (connection->transport)) - return DBUS_DISPATCH_NEED_MEMORY; -@@ -4716,6 +4827,8 @@ dbus_connection_dispatch (DBusConnection *connection) - - CONNECTION_LOCK (connection); - -+ if (result == DBUS_HANDLER_RESULT_LATER) -+ goto out; - if (result == DBUS_HANDLER_RESULT_NEED_MEMORY) - { - _dbus_verbose ("No memory\n"); -@@ -4838,9 +4951,11 @@ dbus_connection_dispatch (DBusConnection *connection) - connection); - - out: -- if (result == DBUS_HANDLER_RESULT_NEED_MEMORY) -+ if (result == DBUS_HANDLER_RESULT_LATER || -+ result == DBUS_HANDLER_RESULT_NEED_MEMORY) - { -- _dbus_verbose ("out of memory\n"); -+ if (result == DBUS_HANDLER_RESULT_NEED_MEMORY) -+ _dbus_verbose ("out of memory\n"); - - /* Put message back, and we'll start over. - * Yes this means handlers must be idempotent if they -diff --git a/dbus/dbus-list.c b/dbus/dbus-list.c -index 8e713c0..32ea871 100644 ---- a/dbus/dbus-list.c -+++ b/dbus/dbus-list.c -@@ -458,6 +458,35 @@ _dbus_list_remove_last (DBusList **list, - return FALSE; - } - -+/** -+ * Finds a value in the list. Returns the first link -+ * with value equal to the given data pointer. -+ * This is a linear-time operation. -+ * Returns #NULL if no value found that matches. -+ * -+ * @param list address of the list head. -+ * @param data the value to find. -+ * @returns the link if found -+ */ -+DBusList* -+_dbus_list_find_first (DBusList **list, -+ void *data) -+{ -+ DBusList *link; -+ -+ link = _dbus_list_get_first_link (list); -+ -+ while (link != NULL) -+ { -+ if (link->data == data) -+ return link; -+ -+ link = _dbus_list_get_next_link (list, link); -+ } -+ -+ return NULL; -+} -+ - /** - * Finds a value in the list. Returns the last link - * with value equal to the given data pointer. -diff --git a/dbus/dbus-list.h b/dbus/dbus-list.h -index 9350a0d..fee9f1b 100644 ---- a/dbus/dbus-list.h -+++ b/dbus/dbus-list.h -@@ -68,6 +68,9 @@ DBUS_PRIVATE_EXPORT - void _dbus_list_remove_link (DBusList **list, - DBusList *link); - DBUS_PRIVATE_EXPORT -+DBusList* _dbus_list_find_first (DBusList **list, -+ void *data); -+DBUS_PRIVATE_EXPORT - DBusList* _dbus_list_find_last (DBusList **list, - void *data); - DBUS_PRIVATE_EXPORT -diff --git a/dbus/dbus-shared.h b/dbus/dbus-shared.h -index 7ab9103..e5bfbed 100644 ---- a/dbus/dbus-shared.h -+++ b/dbus/dbus-shared.h -@@ -67,7 +67,8 @@ typedef enum - { - DBUS_HANDLER_RESULT_HANDLED, /**< Message has had its effect - no need to run more handlers. */ - DBUS_HANDLER_RESULT_NOT_YET_HANDLED, /**< Message has not had any effect - see if other handlers want it. */ -- DBUS_HANDLER_RESULT_NEED_MEMORY /**< Need more memory in order to return #DBUS_HANDLER_RESULT_HANDLED or #DBUS_HANDLER_RESULT_NOT_YET_HANDLED. Please try again later with more memory. */ -+ DBUS_HANDLER_RESULT_NEED_MEMORY, /**< Need more memory in order to return #DBUS_HANDLER_RESULT_HANDLED or #DBUS_HANDLER_RESULT_NOT_YET_HANDLED. Please try again later with more memory. */ -+ DBUS_HANDLER_RESULT_LATER /**< Message dispatch deferred due to pending policy check */ - } DBusHandlerResult; - - /* Bus names */ --- -2.21.1 - diff --git a/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0003-Handle-unavailability-of-policy-results-for-broadcas.patch b/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0003-Handle-unavailability-of-policy-results-for-broadcas.patch deleted file mode 100644 index 7d89a7496..000000000 --- a/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0003-Handle-unavailability-of-policy-results-for-broadcas.patch +++ /dev/null @@ -1,1095 +0,0 @@ -From 9d39aa9dd55680529d721a0389ce9ef579bb669a Mon Sep 17 00:00:00 2001 -From: Jacek Bukarewicz <j.bukarewicz@samsung.com> -Date: Fri, 28 Nov 2014 12:39:33 +0100 -Subject: [PATCH 3/8] Handle unavailability of policy results for broadcasts - and receive rules -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When message is sent to the addressed recipient and receive rule -result is unavailable we don't want to block the sender -as it most likely will be the privileged service, so instead we queue -it at the recipient. Any further messages sent to it will be queued to -maintain message order. Once the answer from Cynara arrives messages are -dispatched from the recipient queue. In such case full dispatch is -performed - messages are sent to addressed recipient and other -interested connections. -Messages sent to non-addressed recipients (eavesdroppers or broadcast -message recipients) are handled in a similar way. The difference is -that it is not full dispatch meaning message is sent to a single recipient. - -Cherry picked from 1e231194610892dd4360224998d91336097b05a1 by Jose Bollo - -Updated for dbus 1.10.20 by Scott Murray and José Bollo - -Signed-off-by: José Bollo <jose.bollo@iot.bzh> -Signed-off-by: Scott Murray <scott.murray@konsulko.com> ---- - bus/activation.c | 4 +- - bus/bus.c | 50 ++++++-- - bus/bus.h | 19 +++ - bus/check.c | 307 +++++++++++++++++++++++++++++++++++++++++++++++ - bus/check.h | 25 ++++ - bus/connection.c | 168 ++++++++++++++++++++++++-- - bus/connection.h | 19 ++- - bus/dispatch.c | 115 +++++++++++++++--- - bus/dispatch.h | 11 +- - bus/driver.c | 2 +- - bus/policy.c | 6 + - 11 files changed, 683 insertions(+), 43 deletions(-) - -diff --git a/bus/activation.c b/bus/activation.c -index 8301b59..d4b597c 100644 ---- a/bus/activation.c -+++ b/bus/activation.c -@@ -1259,7 +1259,7 @@ bus_activation_send_pending_auto_activation_messages (BusActivation *activation - res = bus_dispatch_matches (transaction, - entry->connection, - addressed_recipient, -- entry->activation_message, &error); -+ entry->activation_message, NULL, &error); - if (res == BUS_RESULT_FALSE) - { - /* If permission is denied, we just want to return the error -@@ -2140,7 +2140,7 @@ bus_activation_activate_service (BusActivation *activation, - bus_connection_get_loginfo (connection)); - /* Wonderful, systemd is connected, let's just send the msg */ - res = bus_dispatch_matches (activation_transaction, NULL, -- systemd, message, error); -+ systemd, message, NULL, error); - - if (res == BUS_RESULT_TRUE) - retval = TRUE; -diff --git a/bus/bus.c b/bus/bus.c -index 6fc45d0..0aa700b 100644 ---- a/bus/bus.c -+++ b/bus/bus.c -@@ -1800,17 +1800,9 @@ bus_context_check_security_policy (BusContext *context, - } - - /* See if limits on size have been exceeded */ -- if (proposed_recipient && -- ((dbus_connection_get_outgoing_size (proposed_recipient) > context->limits.max_outgoing_bytes) || -- (dbus_connection_get_outgoing_unix_fds (proposed_recipient) > context->limits.max_outgoing_unix_fds))) -- { -- complain_about_message (context, DBUS_ERROR_LIMITS_EXCEEDED, -- "Rejected: destination has a full message queue", -- 0, message, sender, proposed_recipient, requested_reply, TRUE, NULL, -- error); -- _dbus_verbose ("security policy disallowing message due to full message queue\n"); -+ if (!bus_context_check_recipient_message_limits(context, proposed_recipient, sender, message, -+ requested_reply, error)) - return BUS_RESULT_FALSE; -- } - - /* Record that we will allow a reply here in the future (don't - * bother if the recipient is the bus or this is an eavesdropping -@@ -1869,3 +1861,41 @@ bus_context_check_all_watches (BusContext *context) - _dbus_server_toggle_all_watches (server, enabled); - } - } -+ -+void -+bus_context_complain_about_message (BusContext *context, -+ const char *error_name, -+ const char *complaint, -+ int matched_rules, -+ DBusMessage *message, -+ DBusConnection *sender, -+ DBusConnection *proposed_recipient, -+ dbus_bool_t requested_reply, -+ dbus_bool_t log, -+ const char *privilege, -+ DBusError *error) -+{ -+ complain_about_message(context, error_name, complaint, matched_rules, message, sender, -+ proposed_recipient, requested_reply, log, privilege, error); -+} -+ -+dbus_bool_t bus_context_check_recipient_message_limits (BusContext *context, -+ DBusConnection *recipient, -+ DBusConnection *sender, -+ DBusMessage *message, -+ dbus_bool_t requested_reply, -+ DBusError *error) -+{ -+ if (recipient && -+ ((dbus_connection_get_outgoing_size (recipient) > context->limits.max_outgoing_bytes) || -+ (dbus_connection_get_outgoing_unix_fds (recipient) > context->limits.max_outgoing_unix_fds))) -+ { -+ complain_about_message (context, DBUS_ERROR_LIMITS_EXCEEDED, -+ "Rejected: destination has a full message queue", -+ 0, message, sender, recipient, requested_reply, TRUE, NULL, -+ error); -+ _dbus_verbose ("security policy disallowing message due to full message queue\n"); -+ return FALSE; -+ } -+ return TRUE; -+} -diff --git a/bus/bus.h b/bus/bus.h -index 82c32c8..1b08f7c 100644 ---- a/bus/bus.h -+++ b/bus/bus.h -@@ -164,4 +164,23 @@ BusResult bus_context_check_security_policy (BusContext - BusDeferredMessage **deferred_message); - void bus_context_check_all_watches (BusContext *context); - -+dbus_bool_t bus_context_check_recipient_message_limits (BusContext *context, -+ DBusConnection *recipient, -+ DBusConnection *sender, -+ DBusMessage *message, -+ dbus_bool_t requested_reply, -+ DBusError *error); -+void bus_context_complain_about_message (BusContext *context, -+ const char *error_name, -+ const char *complaint, -+ int matched_rules, -+ DBusMessage *message, -+ DBusConnection *sender, -+ DBusConnection *proposed_recipient, -+ dbus_bool_t requested_reply, -+ dbus_bool_t log, -+ const char *privilege, -+ DBusError *error); -+ -+ - #endif /* BUS_BUS_H */ -diff --git a/bus/check.c b/bus/check.c -index 4b8a699..f3d283f 100644 ---- a/bus/check.c -+++ b/bus/check.c -@@ -49,6 +49,9 @@ typedef struct BusDeferredMessage - DBusConnection *sender; - DBusConnection *proposed_recipient; - DBusConnection *addressed_recipient; -+ dbus_bool_t requested_reply; -+ int matched_rules; -+ const char *privilege; - dbus_bool_t full_dispatch; - BusDeferredMessageStatus status; - BusResult response; -@@ -135,6 +138,89 @@ bus_check_enable_dispatch_callback (BusDeferredMessage *deferred_message, - _dbus_connection_enable_dispatch(deferred_message->sender); - } - -+static void -+bus_check_queued_message_reply_callback (BusDeferredMessage *deferred_message, -+ BusResult result) -+{ -+ int status; -+ -+ _dbus_verbose("bus_check_queued_message_reply_callback called message=%p\n", deferred_message); -+ -+ if (!bus_connection_is_active(deferred_message->proposed_recipient)) -+ return; -+ -+ status = deferred_message->status; -+ -+ deferred_message->status = 0; /* mark message as not waiting for response */ -+ deferred_message->response = result; -+ -+ /* -+ * If send rule allows us to send message we still need to check receive rules. -+ */ -+ if ((status & BUS_DEFERRED_MESSAGE_CHECK_SEND) && (result == BUS_RESULT_TRUE)) -+ { -+ int toggles; -+ BusContext *context; -+ BusRegistry *registry; -+ BusClientPolicy *recipient_policy; -+ BusDeferredMessage *deferred_message_receive; -+ -+ context = bus_connection_get_context(deferred_message->proposed_recipient); -+ registry = bus_context_get_registry(context); -+ recipient_policy = bus_connection_get_policy(deferred_message->proposed_recipient); -+ -+ deferred_message->response = bus_client_policy_check_can_receive(recipient_policy, registry, -+ deferred_message->requested_reply, deferred_message->sender, -+ deferred_message->addressed_recipient, deferred_message->proposed_recipient, deferred_message->message, -+ &toggles, NULL, &deferred_message_receive); -+ if (deferred_message->response == BUS_RESULT_LATER) -+ { -+ /* replace deferred message associated with send check with the one associated with -+ * receive check */ -+ if (!bus_deferred_message_replace(deferred_message, deferred_message_receive)) -+ { -+ /* failed to replace deferred message (due to oom). Set it to rejected */ -+ deferred_message->response = BUS_RESULT_FALSE; -+ } -+ } -+ } -+ -+ bus_connection_dispatch_deferred(deferred_message->proposed_recipient); -+} -+ -+static void -+queue_deferred_message_cancel_transaction_hook (void *data) -+{ -+ BusDeferredMessage *deferred_message = (BusDeferredMessage *)data; -+ bus_connection_remove_deferred_message(deferred_message->proposed_recipient, deferred_message); -+} -+ -+ -+dbus_bool_t -+bus_deferred_message_queue_at_recipient (BusDeferredMessage *deferred_message, -+ BusTransaction *transaction, -+ dbus_bool_t full_dispatch, -+ dbus_bool_t prepend) -+{ -+ _dbus_assert(deferred_message != NULL); -+ _dbus_assert(deferred_message->proposed_recipient != NULL); -+ -+ if (!bus_connection_queue_deferred_message(deferred_message->proposed_recipient, -+ deferred_message, prepend)) -+ return FALSE; -+ -+ if (!bus_transaction_add_cancel_hook(transaction, queue_deferred_message_cancel_transaction_hook, -+ deferred_message, NULL)) -+ { -+ bus_connection_remove_deferred_message(deferred_message->proposed_recipient, deferred_message); -+ return FALSE; -+ } -+ deferred_message->response_callback = bus_check_queued_message_reply_callback; -+ deferred_message->full_dispatch = full_dispatch; -+ -+ return TRUE; -+} -+ - static void - deferred_message_free_function(void *data) - { -@@ -159,6 +245,20 @@ bus_deferred_message_disable_sender (BusDeferredMessage *deferred_message) - deferred_message->response_callback = bus_check_enable_dispatch_callback; - } - -+void -+bus_deferred_message_set_policy_check_info (BusDeferredMessage *deferred_message, -+ dbus_bool_t requested_reply, -+ int matched_rules, -+ const char *privilege) -+{ -+ _dbus_assert(deferred_message != NULL); -+ -+ deferred_message->requested_reply = requested_reply; -+ deferred_message->matched_rules = matched_rules; -+ deferred_message->privilege = privilege; -+} -+ -+ - #ifdef DBUS_ENABLE_EMBEDDED_TESTS - BusResult (*bus_check_test_override) (DBusConnection *connection, - const char *privilege); -@@ -259,6 +359,9 @@ BusDeferredMessage *bus_deferred_message_new (DBusMessage *message, - deferred_message->addressed_recipient = addressed_recipient != NULL ? dbus_connection_ref(addressed_recipient) : NULL; - deferred_message->proposed_recipient = proposed_recipient != NULL ? dbus_connection_ref(proposed_recipient) : NULL; - deferred_message->message = dbus_message_ref(message); -+ deferred_message->requested_reply = FALSE; -+ deferred_message->matched_rules = 0; -+ deferred_message->privilege = NULL; - deferred_message->response = response; - deferred_message->status = 0; - deferred_message->full_dispatch = FALSE; -@@ -295,12 +398,215 @@ bus_deferred_message_unref (BusDeferredMessage *deferred_message) - } - } - -+dbus_bool_t -+bus_deferred_message_check_message_limits (BusDeferredMessage *deferred_message, DBusError *error) -+{ -+ BusContext *context = bus_connection_get_context(deferred_message->proposed_recipient); -+ -+ return bus_context_check_recipient_message_limits(context, deferred_message->proposed_recipient, -+ deferred_message->sender, deferred_message->message, deferred_message->requested_reply, -+ error); -+} -+ -+dbus_bool_t -+bus_deferred_message_expect_method_reply(BusDeferredMessage *deferred_message, BusTransaction *transaction, DBusError *error) -+{ -+ int type = dbus_message_get_type(deferred_message->message); -+ if (type == DBUS_MESSAGE_TYPE_METHOD_CALL && -+ deferred_message->sender && -+ deferred_message->addressed_recipient && -+ deferred_message->addressed_recipient == deferred_message->proposed_recipient && /* not eavesdropping */ -+ !bus_connections_expect_reply (bus_connection_get_connections (deferred_message->sender), -+ transaction, -+ deferred_message->sender, deferred_message->addressed_recipient, -+ deferred_message->message, error)) -+ { -+ _dbus_verbose ("Failed to record reply expectation or problem with the message expecting a reply\n"); -+ return FALSE; -+ } -+ return TRUE; -+} -+ -+void -+bus_deferred_message_create_error(BusDeferredMessage *deferred_message, -+ const char *error_message, DBusError *error) -+{ -+ BusContext *context; -+ _dbus_assert (deferred_message->status == 0 && deferred_message->response == BUS_RESULT_FALSE); -+ -+ if (deferred_message->sender == NULL) -+ return; /* error won't be sent to bus driver anyway */ -+ -+ context = bus_connection_get_context(deferred_message->sender); -+ bus_context_complain_about_message(context, DBUS_ERROR_ACCESS_DENIED, "Rejected message", -+ deferred_message->matched_rules, deferred_message->message, deferred_message->sender, -+ deferred_message->proposed_recipient, deferred_message->requested_reply, FALSE, -+ deferred_message->privilege, error); -+} -+ -+BusResult -+bus_deferred_message_dispatch (BusDeferredMessage *deferred_message) -+{ -+ BusContext *context = bus_connection_get_context (deferred_message->proposed_recipient); -+ BusTransaction *transaction = bus_transaction_new (context); -+ BusResult result = BUS_RESULT_TRUE; -+ DBusError error; -+ -+ if (transaction == NULL) -+ { -+ return BUS_RESULT_FALSE; -+ } -+ -+ dbus_error_init(&error); -+ -+ if (!deferred_message->full_dispatch) -+ { -+ result = deferred_message->response; -+ if (result == BUS_RESULT_TRUE) -+ { -+ if (!bus_context_check_recipient_message_limits(context, deferred_message->proposed_recipient, -+ deferred_message->sender, deferred_message->message, deferred_message->requested_reply, &error)) -+ result = BUS_RESULT_FALSE; -+ } -+ else if (result == BUS_RESULT_LATER) -+ { -+ BusDeferredMessage *deferred_message2; -+ result = bus_context_check_security_policy (context, transaction, -+ deferred_message->sender, -+ deferred_message->addressed_recipient, -+ deferred_message->proposed_recipient, -+ deferred_message->message, NULL, NULL, -+ &deferred_message2); -+ -+ if (result == BUS_RESULT_LATER) -+ { -+ /* prepend at recipient */ -+ if (!bus_deferred_message_queue_at_recipient(deferred_message2, transaction, -+ FALSE, TRUE)) -+ result = BUS_RESULT_FALSE; -+ } -+ } -+ -+ /* silently drop messages on access denial */ -+ if (result == BUS_RESULT_TRUE) -+ { -+ if (!bus_transaction_send (transaction, deferred_message->proposed_recipient, deferred_message->message, TRUE)) -+ result = BUS_RESULT_FALSE; -+ } -+ -+ bus_transaction_execute_and_free(transaction); -+ -+ goto out; -+ } -+ -+ /* do not attempt to send message if sender has disconnected */ -+ if (deferred_message->sender != NULL && !bus_connection_is_active(deferred_message->sender)) -+ { -+ bus_transaction_cancel_and_free(transaction); -+ result = BUS_RESULT_FALSE; -+ goto out; -+ } -+ -+ result = bus_dispatch_matches(transaction, deferred_message->sender, -+ deferred_message->addressed_recipient, deferred_message->message, deferred_message, &error); -+ -+ if (result == BUS_RESULT_LATER) -+ { -+ /* Message deferring was already done in bus_dispatch_matches */ -+ bus_transaction_cancel_and_free(transaction); -+ goto out; -+ } -+ -+ /* this part is a copy & paste from bus_dispatch function. Probably can be moved to a function */ -+ if (dbus_error_is_set (&error)) -+ { -+ if (!dbus_connection_get_is_connected (deferred_message->sender)) -+ { -+ /* If we disconnected it, we won't bother to send it any error -+ * messages. -+ */ -+ _dbus_verbose ("Not sending error to connection we disconnected\n"); -+ } -+ else if (dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY)) -+ { -+ bus_connection_send_oom_error (deferred_message->sender, deferred_message->message); -+ -+ /* cancel transaction due to OOM */ -+ if (transaction != NULL) -+ { -+ bus_transaction_cancel_and_free (transaction); -+ transaction = NULL; -+ } -+ } -+ else -+ { -+ /* Try to send the real error, if no mem to do that, send -+ * the OOM error -+ */ -+ _dbus_assert (transaction != NULL); -+ if (!bus_transaction_send_error_reply (transaction, deferred_message->sender, -+ &error, deferred_message->message)) -+ { -+ bus_connection_send_oom_error (deferred_message->sender, deferred_message->message); -+ -+ /* cancel transaction due to OOM */ -+ if (transaction != NULL) -+ { -+ bus_transaction_cancel_and_free (transaction); -+ transaction = NULL; -+ } -+ } -+ } -+ } -+ -+ if (transaction != NULL) -+ { -+ bus_transaction_execute_and_free (transaction); -+ } -+ -+out: -+ dbus_error_free(&error); -+ -+ return result; -+} -+ -+dbus_bool_t -+bus_deferred_message_replace (BusDeferredMessage *old_message, BusDeferredMessage *new_message) -+{ -+ if (bus_connection_replace_deferred_message(old_message->proposed_recipient, -+ old_message, new_message)) -+ { -+ new_message->response_callback = old_message->response_callback; -+ new_message->full_dispatch = old_message->full_dispatch; -+ return TRUE; -+ } -+ return FALSE; -+} -+ -+dbus_bool_t -+bus_deferred_message_waits_for_check(BusDeferredMessage *deferred_message) -+{ -+ return deferred_message->status != 0; -+} -+ -+DBusConnection * -+bus_deferred_message_get_recipient(BusDeferredMessage *deferred_message) -+{ -+ return deferred_message->proposed_recipient; -+} -+ - BusDeferredMessageStatus - bus_deferred_message_get_status (BusDeferredMessage *deferred_message) - { - return deferred_message->status; - } - -+BusResult -+bus_deferred_message_get_response (BusDeferredMessage *deferred_message) -+{ -+ return deferred_message->response; -+} -+ - void - bus_deferred_message_response_received (BusDeferredMessage *deferred_message, - BusResult result) -@@ -310,3 +616,4 @@ bus_deferred_message_response_received (BusDeferredMessage *deferred_message, - deferred_message->response_callback(deferred_message, result); - } - } -+ -diff --git a/bus/check.h b/bus/check.h -index d177549..9c13c18 100644 ---- a/bus/check.h -+++ b/bus/check.h -@@ -64,12 +64,37 @@ BusDeferredMessage *bus_deferred_message_new (DBusMessage *messag - - BusDeferredMessage *bus_deferred_message_ref (BusDeferredMessage *deferred_message); - void bus_deferred_message_unref (BusDeferredMessage *deferred_message); -+BusResult bus_deferred_message_dispatch (BusDeferredMessage *deferred_message); -+dbus_bool_t bus_deferred_message_waits_for_check (BusDeferredMessage *deferred_message); -+DBusConnection *bus_deferred_message_get_recipient (BusDeferredMessage *deferred_message); - void bus_deferred_message_response_received (BusDeferredMessage *deferred_message, - BusResult result); -+dbus_bool_t bus_deferred_message_queue_at_recipient (BusDeferredMessage *deferred_message, -+ BusTransaction *transaction, -+ dbus_bool_t full_dispatch, -+ dbus_bool_t prepend); -+dbus_bool_t bus_deferred_message_replace (BusDeferredMessage *old_message, -+ BusDeferredMessage *new_message); - void bus_deferred_message_disable_sender (BusDeferredMessage *deferred_message); -+BusResult bus_deferred_message_get_response (BusDeferredMessage *deferred_message); - - BusDeferredMessageStatus bus_deferred_message_get_status (BusDeferredMessage *deferred_message); - -+ -+dbus_bool_t bus_deferred_message_expect_method_reply (BusDeferredMessage *deferred_message, -+ BusTransaction *transaction, -+ DBusError *error); -+void bus_deferred_message_create_error (BusDeferredMessage *deferred_message, -+ const char *error_message, -+ DBusError *error); -+void bus_deferred_message_set_policy_check_info (BusDeferredMessage *deferred_message, -+ dbus_bool_t requested_reply, -+ int matched_rules, -+ const char *privilege); -+dbus_bool_t bus_deferred_message_check_message_limits (BusDeferredMessage *deferred_message, -+ DBusError *error); -+ -+ - #ifdef DBUS_ENABLE_EMBEDDED_TESTS - extern BusResult (*bus_check_test_override) (DBusConnection *connection, - const char *privilege); -diff --git a/bus/connection.c b/bus/connection.c -index b348d42..ee93384 100644 ---- a/bus/connection.c -+++ b/bus/connection.c -@@ -31,11 +31,13 @@ - #include "expirelist.h" - #include "selinux.h" - #include "apparmor.h" -+#include "check.h" - #include <dbus/dbus-list.h> - #include <dbus/dbus-hash.h> - #include <dbus/dbus-timeout.h> - #include <dbus/dbus-connection-internal.h> - #include <dbus/dbus-internals.h> -+#include <dbus/dbus-message-internal.h> - #ifdef DBUS_ENABLE_CYNARA - #include <stdlib.h> - #include <cynara-session.h> -@@ -102,6 +104,7 @@ typedef struct - DBusMessage *oom_message; - DBusPreallocatedSend *oom_preallocated; - BusClientPolicy *policy; -+ DBusList *deferred_messages; /**< Queue of messages deferred due to pending policy check */ - - char *cached_loginfo_string; - BusSELinuxID *selinux_id; -@@ -268,6 +271,8 @@ bus_connection_disconnected (DBusConnection *connection) - bus_transaction_execute_and_free (transaction); - } - -+ bus_connection_clear_deferred_messages(connection); -+ - bus_dispatch_remove_connection (connection); - - /* no more watching */ -@@ -2307,7 +2312,7 @@ bus_transaction_capture (BusTransaction *transaction, - { - DBusConnection *recipient = link->data; - -- if (!bus_transaction_send (transaction, recipient, message)) -+ if (!bus_transaction_send (transaction, recipient, message, FALSE)) - goto out; - } - -@@ -2361,6 +2366,7 @@ bus_transaction_send_from_driver (BusTransaction *transaction, - { - DBusError error = DBUS_ERROR_INIT; - BusResult res; -+ BusDeferredMessage *deferred_message; - - /* We have to set the sender to the driver, and have - * to check security policy since it was not done in -@@ -2401,7 +2407,7 @@ bus_transaction_send_from_driver (BusTransaction *transaction, - res = bus_context_check_security_policy (bus_transaction_get_context (transaction), - transaction, - NULL, connection, connection, message, NULL, -- &error, NULL); -+ &error, &deferred_message); - if (res == BUS_RESULT_FALSE) - { - if (!bus_transaction_capture_error_reply (transaction, connection, -@@ -2419,18 +2425,20 @@ bus_transaction_send_from_driver (BusTransaction *transaction, - } - else if (res == BUS_RESULT_LATER) - { -- _dbus_verbose ("Cannot delay sending message from bus driver, dropping it\n"); - dbus_error_free (&error); -- return TRUE; -+ if (!bus_deferred_message_queue_at_recipient(deferred_message, transaction, FALSE, FALSE)) -+ return FALSE; -+ return TRUE; /* pretend to have sent it */ - } - -- return bus_transaction_send (transaction, connection, message); -+ return bus_transaction_send (transaction, connection, message, FALSE); - } - - dbus_bool_t - bus_transaction_send (BusTransaction *transaction, - DBusConnection *connection, -- DBusMessage *message) -+ DBusMessage *message, -+ dbus_bool_t deferred_dispatch) - { - MessageToSend *to_send; - BusConnectionData *d; -@@ -2456,7 +2464,28 @@ bus_transaction_send (BusTransaction *transaction, - - d = BUS_CONNECTION_DATA (connection); - _dbus_assert (d != NULL); -- -+ -+ if (!deferred_dispatch && d->deferred_messages != NULL) -+ { -+ BusDeferredMessage *deferred_message; -+ dbus_bool_t success; -+ /* sender and addressed recipient are not required at this point as we only need to send message -+ * to a single recipient without performing policy check. */ -+ deferred_message = bus_deferred_message_new (message, -+ NULL, -+ NULL, -+ connection, -+ BUS_RESULT_TRUE); -+ if (deferred_message == NULL) -+ return FALSE; -+ -+ success = bus_deferred_message_queue_at_recipient(deferred_message, transaction, -+ FALSE, FALSE); -+ bus_deferred_message_unref(deferred_message); -+ -+ return success; -+ } -+ - to_send = dbus_new (MessageToSend, 1); - if (to_send == NULL) - { -@@ -2708,6 +2737,131 @@ bus_transaction_add_cancel_hook (BusTransaction *transaction, - return TRUE; - } - -+void -+bus_connection_dispatch_deferred (DBusConnection *connection) -+{ -+ BusDeferredMessage *message; -+ -+ _dbus_return_if_fail (connection != NULL); -+ -+ while ((message = bus_connection_pop_deferred_message(connection)) != NULL) -+ { -+ bus_deferred_message_dispatch(message); -+ bus_deferred_message_unref(message); -+ } -+} -+ -+dbus_bool_t -+bus_connection_has_deferred_messages (DBusConnection *connection) -+{ -+ BusConnectionData *d = BUS_CONNECTION_DATA(connection); -+ return d->deferred_messages != NULL ? TRUE : FALSE; -+} -+ -+dbus_bool_t -+bus_connection_queue_deferred_message (DBusConnection *connection, -+ BusDeferredMessage *message, -+ dbus_bool_t prepend) -+{ -+ BusConnectionData *d = BUS_CONNECTION_DATA(connection); -+ dbus_bool_t success; -+ if (prepend) -+ success = _dbus_list_prepend(&d->deferred_messages, message); -+ else -+ success = _dbus_list_append(&d->deferred_messages, message); -+ -+ if (success) -+ { -+ bus_deferred_message_ref(message); -+ return TRUE; -+ } -+ -+ return FALSE; -+} -+ -+dbus_bool_t -+bus_connection_replace_deferred_message (DBusConnection *connection, -+ BusDeferredMessage *oldMessage, -+ BusDeferredMessage *newMessage) -+{ -+ DBusList *link; -+ BusConnectionData *d = BUS_CONNECTION_DATA(connection); -+ -+ link = _dbus_list_find_first(&d->deferred_messages, oldMessage); -+ if (link == NULL) -+ return FALSE; -+ -+ if (!_dbus_list_insert_after(&d->deferred_messages, link, newMessage)) -+ return FALSE; -+ -+ bus_deferred_message_ref(newMessage); -+ _dbus_list_remove_link(&d->deferred_messages, link); -+ bus_deferred_message_unref(oldMessage); -+ return TRUE; -+} -+ -+BusDeferredMessage * -+bus_connection_pop_deferred_message (DBusConnection *connection) -+{ -+ DBusList *link; -+ BusDeferredMessage *message; -+ BusConnectionData *d = BUS_CONNECTION_DATA(connection); -+ -+ link =_dbus_list_get_first_link(&d->deferred_messages); -+ if (link != NULL) -+ { -+ message = link->data; -+ if (!bus_deferred_message_waits_for_check(message)) -+ { -+ _dbus_list_remove_link(&d->deferred_messages, link); -+ return message; -+ } -+ } -+ -+ return NULL; -+} -+ -+dbus_bool_t -+bus_connection_putback_deferred_message (DBusConnection *connection, BusDeferredMessage *message) -+{ -+ BusConnectionData *d = BUS_CONNECTION_DATA(connection); -+ if (_dbus_list_prepend(&d->deferred_messages, message)) -+ { -+ return TRUE; -+ } -+ return FALSE; -+} -+ -+void -+bus_connection_clear_deferred_messages (DBusConnection *connection) -+{ -+ BusConnectionData *d = BUS_CONNECTION_DATA(connection); -+ DBusList *link; -+ DBusList *next; -+ BusDeferredMessage *message; -+ -+ link =_dbus_list_get_first_link(&d->deferred_messages); -+ while (link != NULL) -+ { -+ next = _dbus_list_get_next_link (&d->deferred_messages, link); -+ message = link->data; -+ -+ bus_deferred_message_unref(message); -+ _dbus_list_remove_link(&d->deferred_messages, link); -+ -+ link = next; -+ } -+} -+ -+void -+bus_connection_remove_deferred_message (DBusConnection *connection, -+ BusDeferredMessage *message) -+{ -+ BusConnectionData *d = BUS_CONNECTION_DATA(connection); -+ if (_dbus_list_remove(&d->deferred_messages, message)) -+ bus_deferred_message_unref(message); -+} -+ - int - bus_connections_get_n_active (BusConnections *connections) - { -diff --git a/bus/connection.h b/bus/connection.h -index 71078ea..97dae96 100644 ---- a/bus/connection.h -+++ b/bus/connection.h -@@ -85,6 +85,22 @@ dbus_bool_t bus_connection_preallocate_oom_error (DBusConnection *connection); - void bus_connection_send_oom_error (DBusConnection *connection, - DBusMessage *in_reply_to); - -+dbus_bool_t bus_connection_has_deferred_messages (DBusConnection *connection); -+dbus_bool_t bus_connection_queue_deferred_message (DBusConnection *connection, -+ BusDeferredMessage *message, -+ dbus_bool_t prepend); -+BusDeferredMessage *bus_connection_pop_deferred_message (DBusConnection *connection); -+dbus_bool_t bus_connection_putback_deferred_message (DBusConnection *connection, -+ BusDeferredMessage *message); -+void bus_connection_remove_deferred_message (DBusConnection *connection, -+ BusDeferredMessage *message); -+dbus_bool_t bus_connection_replace_deferred_message (DBusConnection *connection, -+ BusDeferredMessage *oldMessage, -+ BusDeferredMessage *newMessage); -+void bus_connection_dispatch_deferred (DBusConnection *connection); -+void bus_connection_clear_deferred_messages (DBusConnection *connection); -+ -+ - /* called by signals.c */ - dbus_bool_t bus_connection_add_match_rule (DBusConnection *connection, - BusMatchRule *rule); -@@ -137,7 +153,8 @@ BusTransaction* bus_transaction_new (BusContext * - BusContext* bus_transaction_get_context (BusTransaction *transaction); - dbus_bool_t bus_transaction_send (BusTransaction *transaction, - DBusConnection *connection, -- DBusMessage *message); -+ DBusMessage *message, -+ dbus_bool_t deferred_dispatch); - dbus_bool_t bus_transaction_capture (BusTransaction *transaction, - DBusConnection *connection, - DBusConnection *addressed_recipient, -diff --git a/bus/dispatch.c b/bus/dispatch.c -index 50a22a3..7d30ce4 100644 ---- a/bus/dispatch.c -+++ b/bus/dispatch.c -@@ -33,6 +33,7 @@ - #include "utils.h" - #include "bus.h" - #include "signals.h" -+#include "dispatch.h" - #include "test.h" - #include <dbus/dbus-internals.h> - #include <dbus/dbus-connection-internal.h> -@@ -77,7 +78,7 @@ send_one_message (DBusConnection *connection, - NULL, - &stack_error, - &deferred_message); -- if (result != BUS_RESULT_TRUE) -+ if (result == BUS_RESULT_FALSE) - { - if (!bus_transaction_capture_error_reply (transaction, sender, - &stack_error, message)) -@@ -112,9 +113,19 @@ send_one_message (DBusConnection *connection, - return TRUE; /* don't send it but don't return an error either */ - } - -+ if (result == BUS_RESULT_LATER) -+ { -+ if (!bus_deferred_message_queue_at_recipient(deferred_message, transaction, FALSE, FALSE)) -+ { -+ BUS_SET_OOM (error); -+ return FALSE; -+ } -+ return TRUE; /* pretend to have sent it */ -+ } -+ - if (!bus_transaction_send (transaction, - connection, -- message)) -+ message, FALSE)) - { - BUS_SET_OOM (error); - return FALSE; -@@ -124,11 +135,12 @@ send_one_message (DBusConnection *connection, - } - - BusResult --bus_dispatch_matches (BusTransaction *transaction, -- DBusConnection *sender, -- DBusConnection *addressed_recipient, -- DBusMessage *message, -- DBusError *error) -+bus_dispatch_matches (BusTransaction *transaction, -+ DBusConnection *sender, -+ DBusConnection *addressed_recipient, -+ DBusMessage *message, -+ BusDeferredMessage *dispatched_deferred_message, -+ DBusError *error) - { - DBusError tmp_error; - BusConnections *connections; -@@ -137,7 +149,6 @@ bus_dispatch_matches (BusTransaction *transaction, - DBusList *link; - BusContext *context; - BusDeferredMessage *deferred_message; -- BusResult res; - - _DBUS_ASSERT_ERROR_IS_CLEAR (error); - -@@ -153,16 +164,80 @@ bus_dispatch_matches (BusTransaction *transaction, - /* First, send the message to the addressed_recipient, if there is one. */ - if (addressed_recipient != NULL) - { -- res = bus_context_check_security_policy (context, transaction, -+ BusResult result; -+ /* To maintain message order message needs to be appended at the recipient if there are already -+ * deferred messages and we are not doing deferred dispatch -+ */ -+ if (dispatched_deferred_message == NULL && bus_connection_has_deferred_messages(addressed_recipient)) -+ { -+ deferred_message = bus_deferred_message_new(message, sender, -+ addressed_recipient, addressed_recipient, BUS_RESULT_LATER); -+ -+ if (deferred_message == NULL) -+ { -+ BUS_SET_OOM(error); -+ return BUS_RESULT_FALSE; -+ } -+ -+ if (!bus_deferred_message_queue_at_recipient(deferred_message, transaction, TRUE, FALSE)) -+ { -+ bus_deferred_message_unref(deferred_message); -+ BUS_SET_OOM(error); -+ return BUS_RESULT_FALSE; -+ } -+ -+ bus_deferred_message_unref(deferred_message); -+ return BUS_RESULT_TRUE; /* pretend to have sent it */ -+ } -+ -+ if (dispatched_deferred_message != NULL) -+ { -+ result = bus_deferred_message_get_response(dispatched_deferred_message); -+ if (result == BUS_RESULT_TRUE) -+ { -+ /* if we know the result of policy check we still need to check if message limits -+ * are not exceeded. It is also required to add entry in expected replies list if -+ * this is a method call -+ */ -+ if (!bus_deferred_message_check_message_limits(dispatched_deferred_message, error)) -+ return BUS_RESULT_FALSE; -+ -+ if (!bus_deferred_message_expect_method_reply(dispatched_deferred_message, transaction, error)) -+ return BUS_RESULT_FALSE; -+ } -+ else if (result == BUS_RESULT_FALSE) -+ { -+ bus_deferred_message_create_error(dispatched_deferred_message, "Rejected message", error); -+ return BUS_RESULT_FALSE; -+ } -+ } -+ else -+ result = BUS_RESULT_LATER; -+ -+ if (result == BUS_RESULT_LATER) -+ result = bus_context_check_security_policy (context, transaction, - sender, addressed_recipient, - addressed_recipient, - message, NULL, error, - &deferred_message); -- if (res == BUS_RESULT_FALSE) -+ -+ if (result == BUS_RESULT_FALSE) - return BUS_RESULT_FALSE; -- else if (res == BUS_RESULT_LATER) -+ else if (result == BUS_RESULT_LATER) - { - BusDeferredMessageStatus status; -+ -+ if (dispatched_deferred_message != NULL) -+ { -+ /* for deferred dispatch prepend message at the recipient */ -+ if (!bus_deferred_message_queue_at_recipient(deferred_message, transaction, TRUE, TRUE)) -+ { -+ BUS_SET_OOM(error); -+ return BUS_RESULT_FALSE; -+ } -+ return BUS_RESULT_TRUE; /* pretend to have sent it */ -+ } -+ - status = bus_deferred_message_get_status(deferred_message); - - if (status & BUS_DEFERRED_MESSAGE_CHECK_SEND) -@@ -173,13 +248,18 @@ bus_dispatch_matches (BusTransaction *transaction, - } - else if (status & BUS_DEFERRED_MESSAGE_CHECK_RECEIVE) - { -- dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED, -- "Rejecting message because time is needed to check security policy"); -- return BUS_RESULT_FALSE; -+ /* receive rule result not available - queue message at the recipient */ -+ if (!bus_deferred_message_queue_at_recipient(deferred_message, transaction, TRUE, FALSE)) -+ { -+ BUS_SET_OOM(error); -+ return BUS_RESULT_FALSE; -+ } -+ -+ return BUS_RESULT_TRUE; /* pretend to have sent it */ - } - else - { -- _dbus_verbose("deferred message has no status field set to send or receive unexpectedly\n"); -+ _dbus_verbose("deferred message has no status field set unexpectedly\n"); - return BUS_RESULT_FALSE; - } - } -@@ -196,7 +276,8 @@ bus_dispatch_matches (BusTransaction *transaction, - } - - /* Dispatch the message */ -- if (!bus_transaction_send (transaction, addressed_recipient, message)) -+ if (!bus_transaction_send(transaction, addressed_recipient, message, -+ dispatched_deferred_message != NULL ? TRUE : FALSE)) - { - BUS_SET_OOM (error); - return BUS_RESULT_FALSE; -@@ -534,7 +615,7 @@ bus_dispatch (DBusConnection *connection, - * match rules. - */ - if (BUS_RESULT_LATER == bus_dispatch_matches (transaction, connection, addressed_recipient, -- message, &error)) -+ message, NULL, &error)) - { - /* Roll back and dispatch the message once the policy result is available */ - bus_transaction_cancel_and_free (transaction); -diff --git a/bus/dispatch.h b/bus/dispatch.h -index afba6a2..f6102e8 100644 ---- a/bus/dispatch.h -+++ b/bus/dispatch.h -@@ -29,10 +29,11 @@ - - dbus_bool_t bus_dispatch_add_connection (DBusConnection *connection); - void bus_dispatch_remove_connection (DBusConnection *connection); --BusResult bus_dispatch_matches (BusTransaction *transaction, -- DBusConnection *sender, -- DBusConnection *recipient, -- DBusMessage *message, -- DBusError *error); -+BusResult bus_dispatch_matches (BusTransaction *transaction, -+ DBusConnection *sender, -+ DBusConnection *recipient, -+ DBusMessage *message, -+ BusDeferredMessage *dispatched_deferred_message, -+ DBusError *error); - - #endif /* BUS_DISPATCH_H */ -diff --git a/bus/driver.c b/bus/driver.c -index f414f64..d89a658 100644 ---- a/bus/driver.c -+++ b/bus/driver.c -@@ -254,7 +254,7 @@ bus_driver_send_service_owner_changed (const char *service_name, - if (!bus_transaction_capture (transaction, NULL, NULL, message)) - goto oom; - -- res = bus_dispatch_matches (transaction, NULL, NULL, message, error); -+ res = bus_dispatch_matches (transaction, NULL, NULL, message, NULL, error); - if (res == BUS_RESULT_TRUE) - retval = TRUE; - else -diff --git a/bus/policy.c b/bus/policy.c -index 7de92c6..483cc97 100644 ---- a/bus/policy.c -+++ b/bus/policy.c -@@ -1122,6 +1122,9 @@ bus_client_policy_check_can_send (DBusConnection *sender, - - result = bus_check_privilege(check, message, sender, addressed_recipient, receiver, - privilege, BUS_DEFERRED_MESSAGE_CHECK_SEND, deferred_message); -+ if (result == BUS_RESULT_LATER && deferred_message != NULL) -+ bus_deferred_message_set_policy_check_info(*deferred_message, requested_reply, -+ *toggles, privilege); - } - else - privilege = NULL; -@@ -1372,6 +1375,9 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy, - - result = bus_check_privilege(check, message, sender, addressed_recipient, proposed_recipient, - privilege, BUS_DEFERRED_MESSAGE_CHECK_RECEIVE, deferred_message); -+ if (result == BUS_RESULT_LATER && deferred_message != NULL) -+ bus_deferred_message_set_policy_check_info(*deferred_message, requested_reply, -+ *toggles, privilege); - } - else - privilege = NULL; --- -2.21.1 - diff --git a/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0004-Add-own-rule-result-unavailability-handling.patch b/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0004-Add-own-rule-result-unavailability-handling.patch deleted file mode 100644 index 9953dcaac..000000000 --- a/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0004-Add-own-rule-result-unavailability-handling.patch +++ /dev/null @@ -1,1505 +0,0 @@ -From 28ada62c98d74285dc22b66650b09b6c8f2c28c4 Mon Sep 17 00:00:00 2001 -From: Jacek Bukarewicz <j.bukarewicz@samsung.com> -Date: Thu, 27 Nov 2014 11:26:21 +0100 -Subject: [PATCH 4/8] Add own rule result unavailability handling -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Own rule result unavailability is handled like send rules - dispatching -messages from the sender is blocked and resumed when result becomes -available. - -Handler of "RequestName" method needs to return BUS_RESULT_LATER when -policy result is not known therefore its return type is modified. -Since bus message handlers are put into function pointer array other -message handler function singatures are also affected. - -Cherry-picked from 35ef89cd6777ea2430077fc621d21bd01df92349 by Jose.bollo - -Updated for dbus 1.10.20 by Scott Murray and José Bollo - -Signed-off-by: José Bollo <jose.bollo@iot.bzh> -Signed-off-by: Scott Murray <scott.murray@konsulko.com> ---- - bus/dispatch.c | 11 +- - bus/driver.c | 334 ++++++++++++++++++++++++++++--------------------- - bus/driver.h | 2 +- - bus/policy.c | 52 ++++++-- - bus/policy.h | 6 +- - bus/services.c | 26 ++-- - bus/services.h | 3 +- - bus/stats.c | 23 ++-- - bus/stats.h | 6 +- - 9 files changed, 283 insertions(+), 180 deletions(-) - -diff --git a/bus/dispatch.c b/bus/dispatch.c -index 7d30ce4..4b84c21 100644 ---- a/bus/dispatch.c -+++ b/bus/dispatch.c -@@ -517,8 +517,17 @@ bus_dispatch (DBusConnection *connection, - } - - _dbus_verbose ("Giving message to %s\n", DBUS_SERVICE_DBUS); -- if (!bus_driver_handle_message (connection, transaction, message, &error)) -+ res = bus_driver_handle_message (connection, transaction, message, &error); -+ if (res == BUS_RESULT_FALSE) - goto out; -+ else if (res == BUS_RESULT_LATER) -+ { -+ /* connection has been disabled in message handler */ -+ bus_transaction_cancel_and_free (transaction); -+ transaction = NULL; -+ result = DBUS_HANDLER_RESULT_LATER; -+ goto out; -+ } - } - else if (!bus_connection_is_active (connection)) /* clients must talk to bus driver first */ - { -diff --git a/bus/driver.c b/bus/driver.c -index d89a658..aaeb3b2 100644 ---- a/bus/driver.c -+++ b/bus/driver.c -@@ -420,7 +420,7 @@ create_unique_client_name (BusRegistry *registry, - return TRUE; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_hello (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -428,7 +428,7 @@ bus_driver_handle_hello (DBusConnection *connection, - { - DBusString unique_name; - BusService *service; -- dbus_bool_t retval; -+ BusResult retval; - BusRegistry *registry; - BusConnections *connections; - DBusError tmp_error; -@@ -442,7 +442,7 @@ bus_driver_handle_hello (DBusConnection *connection, - /* We already handled an Hello message for this connection. */ - dbus_set_error (error, DBUS_ERROR_FAILED, - "Already handled an Hello message"); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - /* Note that when these limits are exceeded we don't disconnect the -@@ -464,16 +464,16 @@ bus_driver_handle_hello (DBusConnection *connection, - bus_context_log (context, DBUS_SYSTEM_LOG_WARNING, "%s (%s=%d)", - tmp_error.message, limit_name, limit); - dbus_move_error (&tmp_error, error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - if (!_dbus_string_init (&unique_name)) - { - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - -- retval = FALSE; -+ retval = BUS_RESULT_FALSE; - - registry = bus_connection_get_registry (connection); - -@@ -506,7 +506,7 @@ bus_driver_handle_hello (DBusConnection *connection, - goto out_0; - - _dbus_assert (bus_connection_is_active (connection)); -- retval = TRUE; -+ retval = BUS_RESULT_TRUE; - - out_0: - _dbus_string_free (&unique_name); -@@ -558,7 +558,7 @@ bus_driver_send_welcome_message (DBusConnection *connection, - } - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_list_services (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -580,14 +580,14 @@ bus_driver_handle_list_services (DBusConnection *connection, - if (reply == NULL) - { - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - if (!bus_registry_list_services (registry, &services, &len)) - { - dbus_message_unref (reply); - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - dbus_message_iter_init_append (reply, &iter); -@@ -599,7 +599,7 @@ bus_driver_handle_list_services (DBusConnection *connection, - dbus_free_string_array (services); - dbus_message_unref (reply); - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - { -@@ -611,7 +611,7 @@ bus_driver_handle_list_services (DBusConnection *connection, - dbus_free_string_array (services); - dbus_message_unref (reply); - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - } - -@@ -624,7 +624,7 @@ bus_driver_handle_list_services (DBusConnection *connection, - dbus_free_string_array (services); - dbus_message_unref (reply); - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - ++i; - } -@@ -635,23 +635,23 @@ bus_driver_handle_list_services (DBusConnection *connection, - { - dbus_message_unref (reply); - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - if (!bus_transaction_send_from_driver (transaction, connection, reply)) - { - dbus_message_unref (reply); - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - else - { - dbus_message_unref (reply); -- return TRUE; -+ return BUS_RESULT_TRUE; - } - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_list_activatable_services (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -673,14 +673,14 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection, - if (reply == NULL) - { - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - if (!bus_activation_list_services (activation, &services, &len)) - { - dbus_message_unref (reply); - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - dbus_message_iter_init_append (reply, &iter); -@@ -692,7 +692,7 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection, - dbus_free_string_array (services); - dbus_message_unref (reply); - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - { -@@ -704,7 +704,7 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection, - dbus_free_string_array (services); - dbus_message_unref (reply); - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - } - -@@ -717,7 +717,7 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection, - dbus_free_string_array (services); - dbus_message_unref (reply); - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - ++i; - } -@@ -728,23 +728,23 @@ bus_driver_handle_list_activatable_services (DBusConnection *connection, - { - dbus_message_unref (reply); - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - if (!bus_transaction_send_from_driver (transaction, connection, reply)) - { - dbus_message_unref (reply); - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - else - { - dbus_message_unref (reply); -- return TRUE; -+ return BUS_RESULT_TRUE; - } - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_acquire_service (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -755,7 +755,8 @@ bus_driver_handle_acquire_service (DBusConnection *connection, - const char *name; - dbus_uint32_t service_reply; - dbus_uint32_t flags; -- dbus_bool_t retval; -+ BusResult retval; -+ BusResult res; - BusRegistry *registry; - - _DBUS_ASSERT_ERROR_IS_CLEAR (error); -@@ -766,20 +767,24 @@ bus_driver_handle_acquire_service (DBusConnection *connection, - DBUS_TYPE_STRING, &name, - DBUS_TYPE_UINT32, &flags, - DBUS_TYPE_INVALID)) -- return FALSE; -+ return BUS_RESULT_FALSE; - - _dbus_verbose ("Trying to own name %s with flags 0x%x\n", name, flags); - -- retval = FALSE; -+ retval = BUS_RESULT_FALSE; - reply = NULL; - - _dbus_string_init_const (&service_name, name); - -- if (!bus_registry_acquire_service (registry, connection, -- &service_name, flags, -- &service_reply, transaction, -- error)) -- goto out; -+ res = bus_registry_acquire_service (registry, connection, message, -+ &service_name, flags, -+ &service_reply, transaction, -+ error); -+ if (res != BUS_RESULT_TRUE) -+ { -+ retval = res; -+ goto out; -+ } - - reply = dbus_message_new_method_return (message); - if (reply == NULL) -@@ -800,7 +805,7 @@ bus_driver_handle_acquire_service (DBusConnection *connection, - goto out; - } - -- retval = TRUE; -+ retval = BUS_RESULT_TRUE; - - out: - if (reply) -@@ -808,7 +813,7 @@ bus_driver_handle_acquire_service (DBusConnection *connection, - return retval; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_release_service (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -818,7 +823,7 @@ bus_driver_handle_release_service (DBusConnection *connection, - DBusString service_name; - const char *name; - dbus_uint32_t service_reply; -- dbus_bool_t retval; -+ BusResult retval; - BusRegistry *registry; - - _DBUS_ASSERT_ERROR_IS_CLEAR (error); -@@ -828,11 +833,11 @@ bus_driver_handle_release_service (DBusConnection *connection, - if (!dbus_message_get_args (message, error, - DBUS_TYPE_STRING, &name, - DBUS_TYPE_INVALID)) -- return FALSE; -+ return BUS_RESULT_FALSE; - - _dbus_verbose ("Trying to release name %s\n", name); - -- retval = FALSE; -+ retval = BUS_RESULT_FALSE; - reply = NULL; - - _dbus_string_init_const (&service_name, name); -@@ -861,7 +866,7 @@ bus_driver_handle_release_service (DBusConnection *connection, - goto out; - } - -- retval = TRUE; -+ retval = BUS_RESULT_TRUE; - - out: - if (reply) -@@ -869,7 +874,7 @@ bus_driver_handle_release_service (DBusConnection *connection, - return retval; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_service_exists (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -880,7 +885,7 @@ bus_driver_handle_service_exists (DBusConnection *connection, - BusService *service; - dbus_bool_t service_exists; - const char *name; -- dbus_bool_t retval; -+ BusResult retval; - BusRegistry *registry; - - _DBUS_ASSERT_ERROR_IS_CLEAR (error); -@@ -890,9 +895,9 @@ bus_driver_handle_service_exists (DBusConnection *connection, - if (!dbus_message_get_args (message, error, - DBUS_TYPE_STRING, &name, - DBUS_TYPE_INVALID)) -- return FALSE; -+ return BUS_RESULT_FALSE; - -- retval = FALSE; -+ retval = BUS_RESULT_FALSE; - - if (strcmp (name, DBUS_SERVICE_DBUS) == 0) - { -@@ -926,7 +931,7 @@ bus_driver_handle_service_exists (DBusConnection *connection, - goto out; - } - -- retval = TRUE; -+ retval = BUS_RESULT_TRUE; - - out: - if (reply) -@@ -935,7 +940,7 @@ bus_driver_handle_service_exists (DBusConnection *connection, - return retval; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_activate_service (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -943,7 +948,7 @@ bus_driver_handle_activate_service (DBusConnection *connection, - { - dbus_uint32_t flags; - const char *name; -- dbus_bool_t retval; -+ BusResult retval; - BusActivation *activation; - - _DBUS_ASSERT_ERROR_IS_CLEAR (error); -@@ -957,10 +962,10 @@ bus_driver_handle_activate_service (DBusConnection *connection, - { - _DBUS_ASSERT_ERROR_IS_SET (error); - _dbus_verbose ("No memory to get arguments to StartServiceByName\n"); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - -- retval = FALSE; -+ retval = BUS_RESULT_FALSE; - - if (!bus_activation_activate_service (activation, connection, transaction, FALSE, - message, name, error)) -@@ -970,7 +975,7 @@ bus_driver_handle_activate_service (DBusConnection *connection, - goto out; - } - -- retval = TRUE; -+ retval = BUS_RESULT_TRUE; - - out: - return retval; -@@ -1072,13 +1077,13 @@ bus_driver_send_or_activate (BusTransaction *transaction, - return TRUE; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_update_activation_environment (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, - DBusError *error) - { -- dbus_bool_t retval; -+ BusResult retval; - BusActivation *activation; - BusContext *context; - DBusMessageIter iter; -@@ -1100,7 +1105,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection, - dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED, - "Cannot change activation environment " - "on a system bus."); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - activation = bus_connection_get_activation (connection); -@@ -1114,7 +1119,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection, - - dbus_message_iter_recurse (&iter, &dict_iter); - -- retval = FALSE; -+ retval = BUS_RESULT_FALSE; - systemd_message = NULL; - - /* Then loop through the sent dictionary, add the location of -@@ -1279,7 +1284,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection, - if (!bus_driver_send_ack_reply (connection, transaction, message, error)) - goto out; - -- retval = TRUE; -+ retval = BUS_RESULT_TRUE; - - out: - if (systemd_message != NULL) -@@ -1289,7 +1294,7 @@ bus_driver_handle_update_activation_environment (DBusConnection *connection, - return retval; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_add_match (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -1371,16 +1376,16 @@ bus_driver_handle_add_match (DBusConnection *connection, - - bus_match_rule_unref (rule); - -- return TRUE; -+ return BUS_RESULT_TRUE; - - failed: - _DBUS_ASSERT_ERROR_IS_SET (error); - if (rule) - bus_match_rule_unref (rule); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_remove_match (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -1423,16 +1428,16 @@ bus_driver_handle_remove_match (DBusConnection *connection, - - bus_match_rule_unref (rule); - -- return TRUE; -+ return BUS_RESULT_TRUE; - - failed: - _DBUS_ASSERT_ERROR_IS_SET (error); - if (rule) - bus_match_rule_unref (rule); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_get_service_owner (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -1502,7 +1507,7 @@ bus_driver_handle_get_service_owner (DBusConnection *connection, - - dbus_message_unref (reply); - -- return TRUE; -+ return BUS_RESULT_TRUE; - - oom: - BUS_SET_OOM (error); -@@ -1511,10 +1516,10 @@ bus_driver_handle_get_service_owner (DBusConnection *connection, - _DBUS_ASSERT_ERROR_IS_SET (error); - if (reply) - dbus_message_unref (reply); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_list_queued_owners (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -1606,7 +1611,7 @@ bus_driver_handle_list_queued_owners (DBusConnection *connection, - - dbus_message_unref (reply); - -- return TRUE; -+ return BUS_RESULT_TRUE; - - oom: - BUS_SET_OOM (error); -@@ -1619,10 +1624,10 @@ bus_driver_handle_list_queued_owners (DBusConnection *connection, - if (base_names) - _dbus_list_clear (&base_names); - -- return FALSE; -+ return BUS_RESULT_FALSE; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_get_connection_unix_user (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -1679,7 +1684,7 @@ bus_driver_handle_get_connection_unix_user (DBusConnection *connection, - - dbus_message_unref (reply); - -- return TRUE; -+ return BUS_RESULT_TRUE; - - oom: - BUS_SET_OOM (error); -@@ -1688,10 +1693,10 @@ bus_driver_handle_get_connection_unix_user (DBusConnection *connection, - _DBUS_ASSERT_ERROR_IS_SET (error); - if (reply) - dbus_message_unref (reply); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_get_connection_unix_process_id (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -1748,7 +1753,7 @@ bus_driver_handle_get_connection_unix_process_id (DBusConnection *connection, - - dbus_message_unref (reply); - -- return TRUE; -+ return BUS_RESULT_TRUE; - - oom: - BUS_SET_OOM (error); -@@ -1757,10 +1762,10 @@ bus_driver_handle_get_connection_unix_process_id (DBusConnection *connection, - _DBUS_ASSERT_ERROR_IS_SET (error); - if (reply) - dbus_message_unref (reply); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_get_adt_audit_session_data (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -1811,7 +1816,7 @@ bus_driver_handle_get_adt_audit_session_data (DBusConnection *connection, - - dbus_message_unref (reply); - -- return TRUE; -+ return BUS_RESULT_TRUE; - - oom: - BUS_SET_OOM (error); -@@ -1820,10 +1825,10 @@ bus_driver_handle_get_adt_audit_session_data (DBusConnection *connection, - _DBUS_ASSERT_ERROR_IS_SET (error); - if (reply) - dbus_message_unref (reply); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_get_connection_selinux_security_context (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -1872,7 +1877,7 @@ bus_driver_handle_get_connection_selinux_security_context (DBusConnection *conne - - dbus_message_unref (reply); - -- return TRUE; -+ return BUS_RESULT_TRUE; - - oom: - BUS_SET_OOM (error); -@@ -1881,10 +1886,10 @@ bus_driver_handle_get_connection_selinux_security_context (DBusConnection *conne - _DBUS_ASSERT_ERROR_IS_SET (error); - if (reply) - dbus_message_unref (reply); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_get_connection_credentials (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -1998,7 +2003,7 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection, - - dbus_message_unref (reply); - -- return TRUE; -+ return BUS_RESULT_TRUE; - - oom: - BUS_SET_OOM (error); -@@ -2012,10 +2017,10 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection, - dbus_message_unref (reply); - } - -- return FALSE; -+ return BUS_RESULT_FALSE; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_reload_config (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -2040,7 +2045,7 @@ bus_driver_handle_reload_config (DBusConnection *connection, - goto oom; - - dbus_message_unref (reply); -- return TRUE; -+ return BUS_RESULT_TRUE; - - oom: - BUS_SET_OOM (error); -@@ -2049,11 +2054,11 @@ bus_driver_handle_reload_config (DBusConnection *connection, - _DBUS_ASSERT_ERROR_IS_SET (error); - if (reply) - dbus_message_unref (reply); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - #ifdef DBUS_ENABLE_VERBOSE_MODE --static dbus_bool_t -+static BusResult - bus_driver_handle_enable_verbose (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -2073,7 +2078,7 @@ bus_driver_handle_enable_verbose (DBusConnection *connection, - _dbus_set_verbose(TRUE); - - dbus_message_unref (reply); -- return TRUE; -+ return BUS_RESULT_TRUE; - - oom: - _DBUS_ASSERT_ERROR_IS_CLEAR (error); -@@ -2082,10 +2087,10 @@ bus_driver_handle_enable_verbose (DBusConnection *connection, - - if (reply) - dbus_message_unref (reply); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_disable_verbose (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -2105,7 +2110,7 @@ bus_driver_handle_disable_verbose (DBusConnection *connection, - _dbus_set_verbose(FALSE); - - dbus_message_unref (reply); -- return TRUE; -+ return BUS_RESULT_TRUE; - - oom: - _DBUS_ASSERT_ERROR_IS_CLEAR (error); -@@ -2114,11 +2119,11 @@ bus_driver_handle_disable_verbose (DBusConnection *connection, - - if (reply) - dbus_message_unref (reply); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - #endif - --static dbus_bool_t -+static BusResult - bus_driver_handle_get_id (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -2134,7 +2139,7 @@ bus_driver_handle_get_id (DBusConnection *connection, - if (!_dbus_string_init (&uuid)) - { - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - reply = NULL; -@@ -2160,7 +2165,7 @@ bus_driver_handle_get_id (DBusConnection *connection, - - _dbus_string_free (&uuid); - dbus_message_unref (reply); -- return TRUE; -+ return BUS_RESULT_TRUE; - - oom: - _DBUS_ASSERT_ERROR_IS_CLEAR (error); -@@ -2170,10 +2175,10 @@ bus_driver_handle_get_id (DBusConnection *connection, - if (reply) - dbus_message_unref (reply); - _dbus_string_free (&uuid); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_become_monitor (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -2189,7 +2194,7 @@ bus_driver_handle_become_monitor (DBusConnection *connection, - int i; - int n_match_rules; - dbus_uint32_t flags; -- dbus_bool_t ret = FALSE; -+ BusResult ret = BUS_RESULT_FALSE; - - _DBUS_ASSERT_ERROR_IS_CLEAR (error); - -@@ -2262,10 +2267,10 @@ bus_driver_handle_become_monitor (DBusConnection *connection, - if (!bus_connection_be_monitor (connection, transaction, &rules, error)) - goto out; - -- ret = TRUE; -+ ret = BUS_RESULT_TRUE; - - out: -- if (ret) -+ if (ret == BUS_RESULT_TRUE) - _DBUS_ASSERT_ERROR_IS_CLEAR (error); - else - _DBUS_ASSERT_ERROR_IS_SET (error); -@@ -2281,7 +2286,7 @@ out: - return ret; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_get_machine_id (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -2296,7 +2301,7 @@ bus_driver_handle_get_machine_id (DBusConnection *connection, - if (!_dbus_string_init (&uuid)) - { - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - if (!_dbus_get_local_machine_uuid_encoded (&uuid, error)) -@@ -2321,7 +2326,7 @@ bus_driver_handle_get_machine_id (DBusConnection *connection, - - _dbus_string_free (&uuid); - dbus_message_unref (reply); -- return TRUE; -+ return BUS_RESULT_TRUE; - - oom: - _DBUS_ASSERT_ERROR_IS_CLEAR (error); -@@ -2335,29 +2340,30 @@ fail: - dbus_message_unref (reply); - - _dbus_string_free (&uuid); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_ping (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, - DBusError *error) - { -- return bus_driver_send_ack_reply (connection, transaction, message, error); -+ return bus_driver_send_ack_reply (connection, transaction, message, error) == TRUE -+ ? BUS_RESULT_TRUE : BUS_RESULT_FALSE; - } - --static dbus_bool_t bus_driver_handle_get (DBusConnection *connection, -+static BusResult bus_driver_handle_get (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, - DBusError *error); - --static dbus_bool_t bus_driver_handle_get_all (DBusConnection *connection, -+static BusResult bus_driver_handle_get_all (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, - DBusError *error); - --static dbus_bool_t bus_driver_handle_set (DBusConnection *connection, -+static BusResult bus_driver_handle_set (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, - DBusError *error); -@@ -2389,10 +2395,10 @@ typedef struct - const char *name; - const char *in_args; - const char *out_args; -- dbus_bool_t (* handler) (DBusConnection *connection, -- BusTransaction *transaction, -- DBusMessage *message, -- DBusError *error); -+ BusResult (* handler) (DBusConnection *connection, -+ BusTransaction *transaction, -+ DBusMessage *message, -+ DBusError *error); - MethodFlags flags; - } MessageHandler; - -@@ -2511,7 +2517,7 @@ static const PropertyHandler dbus_property_handlers[] = { - { NULL, NULL, NULL } - }; - --static dbus_bool_t bus_driver_handle_introspect (DBusConnection *, -+static BusResult bus_driver_handle_introspect (DBusConnection *, - BusTransaction *, DBusMessage *, DBusError *); - - static const MessageHandler properties_message_handlers[] = { -@@ -2763,7 +2769,7 @@ bus_driver_generate_introspect_string (DBusString *xml, - return TRUE; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_introspect (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -2784,13 +2790,13 @@ bus_driver_handle_introspect (DBusConnection *connection, - DBUS_TYPE_INVALID)) - { - _DBUS_ASSERT_ERROR_IS_SET (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - if (!_dbus_string_init (&xml)) - { - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - is_canonical_path = dbus_message_has_path (message, DBUS_PATH_DBUS); -@@ -2815,7 +2821,7 @@ bus_driver_handle_introspect (DBusConnection *connection, - dbus_message_unref (reply); - _dbus_string_free (&xml); - -- return TRUE; -+ return BUS_RESULT_TRUE; - - oom: - BUS_SET_OOM (error); -@@ -2825,10 +2831,42 @@ bus_driver_handle_introspect (DBusConnection *connection, - - _dbus_string_free (&xml); - -- return FALSE; -+ return BUS_RESULT_FALSE; - } - -+/* -+ * Set @error and return FALSE if the message is not directed to the -+ * dbus-daemon by its canonical object path. This is hardening against -+ * system services with poorly-written security policy files, which -+ * might allow sending dangerously broad equivalence classes of messages -+ * such as "anything with this assumed-to-be-safe object path". -+ * -+ * dbus-daemon is unusual in that it normally ignores the object path -+ * of incoming messages; we need to keep that behaviour for the "read" -+ * read-only method calls like GetConnectionUnixUser for backwards -+ * compatibility, but it seems safer to be more restrictive for things -+ * intended to be root-only or privileged-developers-only. -+ * -+ * It is possible that there are other system services with the same -+ * quirk as dbus-daemon. -+ */ - dbus_bool_t -+bus_driver_check_message_is_for_us (DBusMessage *message, -+ DBusError *error) -+{ -+ if (!dbus_message_has_path (message, DBUS_PATH_DBUS)) -+ { -+ dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED, -+ "Method '%s' is only available at the canonical object path '%s'", -+ dbus_message_get_member (message), DBUS_PATH_DBUS); -+ -+ return FALSE; -+ } -+ -+ return TRUE; -+} -+ -+BusResult - bus_driver_handle_message (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -2839,6 +2877,7 @@ bus_driver_handle_message (DBusConnection *connection, - const MessageHandler *mh; - dbus_bool_t found_interface = FALSE; - dbus_bool_t is_canonical_path; -+ BusResult res; - - _DBUS_ASSERT_ERROR_IS_CLEAR (error); - -@@ -2854,7 +2893,7 @@ bus_driver_handle_message (DBusConnection *connection, - transaction, - message, - error)) -- return FALSE; -+ return BUS_RESULT_FALSE; - - context = bus_connection_get_context (connection); - systemd = bus_driver_get_owner_of_name (connection, -@@ -2871,7 +2910,7 @@ bus_driver_handle_message (DBusConnection *connection, - attacker ? attacker : "(unauthenticated)", - bus_connection_get_loginfo (connection)); - /* ignore it */ -- return TRUE; -+ return BUS_RESULT_TRUE; - } - - if (!bus_context_get_systemd_activation (context)) -@@ -2879,16 +2918,16 @@ bus_driver_handle_message (DBusConnection *connection, - bus_context_log (context, DBUS_SYSTEM_LOG_WARNING, - "Ignoring unexpected ActivationFailure message " - "while not using systemd activation"); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - -- return dbus_activation_systemd_failure(bus_context_get_activation(context), message); -+ return dbus_activation_systemd_failure(bus_context_get_activation(context), message) == TRUE ? BUS_RESULT_TRUE : BUS_RESULT_FALSE; - } - - if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_CALL) - { - _dbus_verbose ("Driver got a non-method-call message, ignoring\n"); -- return TRUE; /* we just ignore this */ -+ return BUS_RESULT_TRUE; /* we just ignore this */ - } - - /* may be NULL, which means "any interface will do" */ -@@ -2953,20 +2992,27 @@ bus_driver_handle_message (DBusConnection *connection, - name, dbus_message_get_signature (message), - mh->in_args); - _DBUS_ASSERT_ERROR_IS_SET (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - -- if ((* mh->handler) (connection, transaction, message, error)) -+ res = (* mh->handler) (connection, transaction, message, error); -+ if (res == BUS_RESULT_TRUE) - { - _DBUS_ASSERT_ERROR_IS_CLEAR (error); - _dbus_verbose ("Driver handler succeeded\n"); -- return TRUE; -+ return BUS_RESULT_TRUE; - } -- else -+ else if (res == BUS_RESULT_FALSE) - { - _DBUS_ASSERT_ERROR_IS_SET (error); - _dbus_verbose ("Driver handler returned failure\n"); -- return FALSE; -+ return BUS_RESULT_FALSE; -+ } -+ else if (res == BUS_RESULT_LATER) -+ { -+ _DBUS_ASSERT_ERROR_IS_CLEAR (error); -+ _dbus_verbose ("Driver handler delayed message processing due to policy check\n"); -+ return BUS_RESULT_LATER; - } - } - } -@@ -2978,7 +3024,7 @@ bus_driver_handle_message (DBusConnection *connection, - "%s does not understand message %s", - DBUS_SERVICE_DBUS, name); - -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - void -@@ -3099,7 +3145,7 @@ interface_handler_find_property (const InterfaceHandler *ih, - return NULL; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_get (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -3120,18 +3166,18 @@ bus_driver_handle_get (DBusConnection *connection, - DBUS_TYPE_STRING, &iface, - DBUS_TYPE_STRING, &prop, - DBUS_TYPE_INVALID)) -- return FALSE; -+ return BUS_RESULT_FALSE; - - /* We only implement Properties on /org/freedesktop/DBus so far. */ - ih = bus_driver_find_interface (iface, TRUE, error); - - if (ih == NULL) -- return FALSE; -+ return BUS_RESULT_FALSE; - - handler = interface_handler_find_property (ih, prop, error); - - if (handler == NULL) -- return FALSE; -+ return BUS_RESULT_FALSE; - - context = bus_transaction_get_context (transaction); - -@@ -3159,17 +3205,17 @@ bus_driver_handle_get (DBusConnection *connection, - goto oom; - - dbus_message_unref (reply); -- return TRUE; -+ return BUS_RESULT_TRUE; - - oom: - if (reply != NULL) - dbus_message_unref (reply); - - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_get_all (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -3188,13 +3234,13 @@ bus_driver_handle_get_all (DBusConnection *connection, - if (!dbus_message_get_args (message, error, - DBUS_TYPE_STRING, &iface, - DBUS_TYPE_INVALID)) -- return FALSE; -+ return BUS_RESULT_FALSE; - - /* We only implement Properties on /org/freedesktop/DBus so far. */ - ih = bus_driver_find_interface (iface, TRUE, error); - - if (ih == NULL) -- return FALSE; -+ return BUS_RESULT_FALSE; - - context = bus_transaction_get_context (transaction); - -@@ -3229,7 +3275,7 @@ bus_driver_handle_get_all (DBusConnection *connection, - goto oom; - - dbus_message_unref (reply); -- return TRUE; -+ return BUS_RESULT_TRUE; - - oom_abandon_message: - _dbus_asv_abandon (&reply_iter, &array_iter); -@@ -3239,10 +3285,10 @@ oom: - dbus_message_unref (reply); - - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - --static dbus_bool_t -+static BusResult - bus_driver_handle_set (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -3271,15 +3317,15 @@ bus_driver_handle_set (DBusConnection *connection, - ih = bus_driver_find_interface (iface, TRUE, error); - - if (ih == NULL) -- return FALSE; -+ return BUS_RESULT_FALSE; - - handler = interface_handler_find_property (ih, prop, error); - - if (handler == NULL) -- return FALSE; -+ return BUS_RESULT_FALSE; - - /* We don't implement any properties that can be set yet. */ - dbus_set_error (error, DBUS_ERROR_PROPERTY_READ_ONLY, - "Property '%s.%s' cannot be set", iface, prop); -- return FALSE; -+ return BUS_RESULT_FALSE; - } -diff --git a/bus/driver.h b/bus/driver.h -index a7297ad..05e9886 100644 ---- a/bus/driver.h -+++ b/bus/driver.h -@@ -35,7 +35,7 @@ typedef enum - } BusDriverFound; - - void bus_driver_remove_connection (DBusConnection *connection); --dbus_bool_t bus_driver_handle_message (DBusConnection *connection, -+BusResult bus_driver_handle_message (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, - DBusError *error); -diff --git a/bus/policy.c b/bus/policy.c -index 483cc97..f6f4d85 100644 ---- a/bus/policy.c -+++ b/bus/policy.c -@@ -1390,18 +1390,21 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy, - - - --static dbus_bool_t -+static BusResult - bus_rules_check_can_own (DBusList *rules, -- const DBusString *service_name) -+ const DBusString *service_name, -+ DBusConnection *connection, -+ DBusMessage *message) - { - DBusList *link; -- dbus_bool_t allowed; -+ BusResult result; -+ const char *privilege; - - /* rules is in the order the rules appeared - * in the config file, i.e. last rule that applies wins - */ - -- allowed = FALSE; -+ result = BUS_RESULT_FALSE; - link = _dbus_list_get_first_link (&rules); - while (link != NULL) - { -@@ -1437,17 +1440,46 @@ bus_rules_check_can_own (DBusList *rules, - } - - /* Use this rule */ -- allowed = rule->access == BUS_POLICY_RULE_ACCESS_ALLOW; -+ switch (rule->access) -+ { -+ case BUS_POLICY_RULE_ACCESS_ALLOW: -+ result = BUS_RESULT_TRUE; -+ break; -+ default: -+ case BUS_POLICY_RULE_ACCESS_DENY: -+ result = BUS_RESULT_FALSE; -+ break; -+ case BUS_POLICY_RULE_ACCESS_CHECK: -+ result = BUS_RESULT_LATER; -+ privilege = rule->privilege; -+ break; -+ } - } - -- return allowed; -+ if (result == BUS_RESULT_LATER) -+ { -+ BusContext *context = bus_connection_get_context(connection); -+ BusCheck *check = bus_context_get_check(context); -+ BusDeferredMessage *deferred_message; -+ -+ result = bus_check_privilege(check, message, connection, NULL, NULL, -+ privilege, BUS_DEFERRED_MESSAGE_CHECK_OWN, &deferred_message); -+ if (result == BUS_RESULT_LATER) -+ { -+ bus_deferred_message_disable_sender(deferred_message); -+ } -+ } -+ -+ return result; - } - --dbus_bool_t -+BusResult - bus_client_policy_check_can_own (BusClientPolicy *policy, -- const DBusString *service_name) -+ const DBusString *service_name, -+ DBusConnection *connection, -+ DBusMessage *message) - { -- return bus_rules_check_can_own (policy->rules, service_name); -+ return bus_rules_check_can_own (policy->rules, service_name, connection, message); - } - - #ifdef DBUS_ENABLE_EMBEDDED_TESTS -@@ -1455,7 +1487,7 @@ dbus_bool_t - bus_policy_check_can_own (BusPolicy *policy, - const DBusString *service_name) - { -- return bus_rules_check_can_own (policy->default_rules, service_name); -+ return bus_rules_check_can_own (policy->default_rules, service_name, NULL, NULL) == BUS_RESULT_TRUE; - } - #endif /* DBUS_ENABLE_EMBEDDED_TESTS */ - -diff --git a/bus/policy.h b/bus/policy.h -index f839d23..28ce8f2 100644 ---- a/bus/policy.h -+++ b/bus/policy.h -@@ -182,8 +182,10 @@ BusResult bus_client_policy_check_can_receive (BusClientPolicy *policy, - dbus_int32_t *toggles, - const char **privilege_param, - BusDeferredMessage **deferred_message); --dbus_bool_t bus_client_policy_check_can_own (BusClientPolicy *policy, -- const DBusString *service_name); -+BusResult bus_client_policy_check_can_own (BusClientPolicy *policy, -+ const DBusString *service_name, -+ DBusConnection *connection, -+ DBusMessage *message); - dbus_bool_t bus_client_policy_append_rule (BusClientPolicy *policy, - BusPolicyRule *rule); - void bus_client_policy_optimize (BusClientPolicy *policy); -diff --git a/bus/services.c b/bus/services.c -index 127edda..586af18 100644 ---- a/bus/services.c -+++ b/bus/services.c -@@ -376,16 +376,17 @@ bus_registry_list_services (BusRegistry *registry, - return FALSE; - } - --dbus_bool_t -+BusResult - bus_registry_acquire_service (BusRegistry *registry, - DBusConnection *connection, -+ DBusMessage *message, - const DBusString *service_name, - dbus_uint32_t flags, - dbus_uint32_t *result, - BusTransaction *transaction, - DBusError *error) - { -- dbus_bool_t retval; -+ BusResult retval; - DBusConnection *old_owner_conn; - BusClientPolicy *policy; - BusService *service; -@@ -393,8 +394,9 @@ bus_registry_acquire_service (BusRegistry *registry, - BusSELinuxID *sid; - BusOwner *primary_owner; - int limit; -+ BusResult res; - -- retval = FALSE; -+ retval = BUS_RESULT_FALSE; - - if (!_dbus_validate_bus_name (service_name, 0, - _dbus_string_get_length (service_name))) -@@ -467,7 +469,8 @@ bus_registry_acquire_service (BusRegistry *registry, - _dbus_string_get_const_data (service_name), error)) - goto out; - -- if (!bus_client_policy_check_can_own (policy, service_name)) -+ res = bus_client_policy_check_can_own (policy, service_name, connection, message); -+ if (res == BUS_RESULT_FALSE) - { - dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED, - "Connection \"%s\" is not allowed to own the service \"%s\" due " -@@ -478,6 +481,11 @@ bus_registry_acquire_service (BusRegistry *registry, - _dbus_string_get_const_data (service_name)); - goto out; - } -+ else if (res == BUS_RESULT_LATER) -+ { -+ retval = BUS_RESULT_LATER; -+ goto out; -+ } - - limit = bus_context_get_max_services_per_connection (registry->context); - -@@ -603,11 +611,13 @@ bus_registry_acquire_service (BusRegistry *registry, - } - - activation = bus_context_get_activation (registry->context); -- retval = bus_activation_send_pending_auto_activation_messages (activation, -+ -+ if (bus_activation_send_pending_auto_activation_messages (activation, - service, -- transaction); -- if (!retval) -- BUS_SET_OOM (error); -+ transaction)) -+ retval = BUS_RESULT_TRUE; -+ else -+ BUS_SET_OOM (error); - - out: - return retval; -diff --git a/bus/services.h b/bus/services.h -index 056dd9f..3df3dd7 100644 ---- a/bus/services.h -+++ b/bus/services.h -@@ -50,8 +50,9 @@ void bus_registry_foreach (BusRegistry *registry - dbus_bool_t bus_registry_list_services (BusRegistry *registry, - char ***listp, - int *array_len); --dbus_bool_t bus_registry_acquire_service (BusRegistry *registry, -+BusResult bus_registry_acquire_service (BusRegistry *registry, - DBusConnection *connection, -+ DBusMessage *message, - const DBusString *service_name, - dbus_uint32_t flags, - dbus_uint32_t *result, -diff --git a/bus/stats.c b/bus/stats.c -index 1582255..c25be98 100644 ---- a/bus/stats.c -+++ b/bus/stats.c -@@ -36,7 +36,7 @@ - - #ifdef DBUS_ENABLE_STATS - --dbus_bool_t -+BusResult - bus_stats_handle_get_stats (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -51,6 +51,9 @@ bus_stats_handle_get_stats (DBusConnection *connection, - - _DBUS_ASSERT_ERROR_IS_CLEAR (error); - -+ if (!bus_driver_check_message_is_for_us (message, error)) -+ return BUS_RESULT_FALSE; -+ - context = bus_transaction_get_context (transaction); - connections = bus_context_get_connections (context); - -@@ -104,17 +107,17 @@ bus_stats_handle_get_stats (DBusConnection *connection, - goto oom; - - dbus_message_unref (reply); -- return TRUE; -+ return BUS_RESULT_TRUE; - - oom: - if (reply != NULL) - dbus_message_unref (reply); - - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - --dbus_bool_t -+BusResult - bus_stats_handle_get_connection_stats (DBusConnection *caller_connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -209,7 +212,7 @@ bus_stats_handle_get_connection_stats (DBusConnection *caller_connection, - goto oom; - - dbus_message_unref (reply); -- return TRUE; -+ return BUS_RESULT_TRUE; - - oom: - BUS_SET_OOM (error); -@@ -218,11 +221,11 @@ failed: - if (reply != NULL) - dbus_message_unref (reply); - -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - --dbus_bool_t -+BusResult - bus_stats_handle_get_all_match_rules (DBusConnection *caller_connection, - BusTransaction *transaction, - DBusMessage *message, -@@ -246,7 +249,7 @@ bus_stats_handle_get_all_match_rules (DBusConnection *caller_connection, - matchmaker = bus_context_get_matchmaker (context); - - if (!bus_registry_list_services (registry, &services, &services_len)) -- return FALSE; -+ return BUS_RESULT_FALSE; - - reply = dbus_message_new_method_return (message); - if (reply == NULL) -@@ -325,7 +328,7 @@ bus_stats_handle_get_all_match_rules (DBusConnection *caller_connection, - - dbus_message_unref (reply); - dbus_free_string_array (services); -- return TRUE; -+ return BUS_RESULT_TRUE; - - oom: - if (reply != NULL) -@@ -334,7 +337,7 @@ oom: - dbus_free_string_array (services); - - BUS_SET_OOM (error); -- return FALSE; -+ return BUS_RESULT_FALSE; - } - - #endif -diff --git a/bus/stats.h b/bus/stats.h -index dcb022c..683fa17 100644 ---- a/bus/stats.h -+++ b/bus/stats.h -@@ -25,17 +25,17 @@ - - #define BUS_INTERFACE_STATS "org.freedesktop.DBus.Debug.Stats" - --dbus_bool_t bus_stats_handle_get_stats (DBusConnection *connection, -+BusResult bus_stats_handle_get_stats (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, - DBusError *error); - --dbus_bool_t bus_stats_handle_get_connection_stats (DBusConnection *connection, -+BusResult bus_stats_handle_get_connection_stats (DBusConnection *connection, - BusTransaction *transaction, - DBusMessage *message, - DBusError *error); - --dbus_bool_t bus_stats_handle_get_all_match_rules (DBusConnection *caller_connection, -+BusResult bus_stats_handle_get_all_match_rules (DBusConnection *caller_connection, - BusTransaction *transaction, - DBusMessage *message, - DBusError *error); --- -2.21.1 - diff --git a/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0005-Perform-Cynara-runtime-policy-checks-by-default.patch b/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0005-Perform-Cynara-runtime-policy-checks-by-default.patch deleted file mode 100644 index 5f7e96a3b..000000000 --- a/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0005-Perform-Cynara-runtime-policy-checks-by-default.patch +++ /dev/null @@ -1,180 +0,0 @@ -From 1f7ba56c9ced669951061d13b06e31d96a170e37 Mon Sep 17 00:00:00 2001 -From: Jacek Bukarewicz <j.bukarewicz@samsung.com> -Date: Tue, 23 Jun 2015 11:08:48 +0200 -Subject: [PATCH 5/8] Perform Cynara runtime policy checks by default -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This change introduces http://tizen.org/privilege/internal/dbus privilege -which is supposed to be available only to trusted system resources. -Checks for this privilege are used in place of certain allow rules to -make security policy more strict. - -For system bus sending and receiving signals now requires -http://tizen.org/privilege/internal/dbus privilege. Requesting name -ownership and sending methods is still denied by default. - -For session bus http://tizen.org/privilege/internal/dbus privilege -is now required for requesting name, calling methods, sending and receiving -signals. - -Services are supposed to override these default settings to implement their -own security policy. - -Cherry picked from e8610297cf7031e94eb314a2e8c11246f4405403 by Jose Bollo - -Updated for dbus 1.10.20 by Scott Murray and José Bollo - -Signed-off-by: Jacek Bukarewicz <j.bukarewicz@samsung.com> -Signed-off-by: José Bollo <jose.bollo@iot.bzh> -Signed-off-by: Scott Murray <scott.murray@konsulko.com> ---- - bus/activation.c | 42 ++++++++++++++++++++++++++---------------- - bus/session.conf.in | 32 ++++++++++++++++++++++++++------ - bus/system.conf.in | 19 +++++++++++++++---- - 3 files changed, 67 insertions(+), 26 deletions(-) - -diff --git a/bus/activation.c b/bus/activation.c -index d4b597c..8aabeaa 100644 ---- a/bus/activation.c -+++ b/bus/activation.c -@@ -1840,22 +1840,32 @@ bus_activation_activate_service (BusActivation *activation, - } - - if (auto_activation && -- entry != NULL && -- BUS_RESULT_TRUE != bus_context_check_security_policy (activation->context, -- transaction, -- connection, /* sender */ -- NULL, /* addressed recipient */ -- NULL, /* proposed recipient */ -- activation_message, -- entry, -- error, -- NULL)) -- { -- _DBUS_ASSERT_ERROR_IS_SET (error); -- _dbus_verbose ("activation not authorized: %s: %s\n", -- error != NULL ? error->name : "(error ignored)", -- error != NULL ? error->message : "(error ignored)"); -- return FALSE; -+ entry != NULL) -+ { -+ BusResult result; -+ -+ result = bus_context_check_security_policy (activation->context, -+ transaction, -+ connection, /* sender */ -+ NULL, /* addressed recipient */ -+ NULL, /* proposed recipient */ -+ activation_message, -+ entry, -+ error, -+ NULL); -+ if (result == BUS_RESULT_FALSE) -+ { -+ _DBUS_ASSERT_ERROR_IS_SET (error); -+ _dbus_verbose ("activation not authorized: %s: %s\n", -+ error != NULL ? error->name : "(error ignored)", -+ error != NULL ? error->message : "(error ignored)"); -+ return FALSE; -+ } -+ if (result == BUS_RESULT_LATER) -+ { -+ /* TODO */ -+ _dbus_verbose ("ALERT FIX ME!!!!!!!!!!!!!!!"); -+ } - } - - /* Bypass the registry lookup if we're auto-activating, bus_dispatch would not -diff --git a/bus/session.conf.in b/bus/session.conf.in -index affa7f1..157dfb4 100644 ---- a/bus/session.conf.in -+++ b/bus/session.conf.in -@@ -27,12 +27,32 @@ - <standard_session_servicedirs /> - - <policy context="default"> -- <!-- Allow everything to be sent --> -- <allow send_destination="*" eavesdrop="true"/> -- <!-- Allow everything to be received --> -- <allow eavesdrop="true"/> -- <!-- Allow anyone to own anything --> -- <allow own="*"/> -+ <!-- By default clients require internal/dbus privilege to communicate -+ with D-Bus services and to claim name ownership. This is internal privilege that -+ is only accessible to trusted system services --> -+ <check own="*" privilege="http://tizen.org/privilege/internal/dbus" /> -+ <check send_type="method_call" privilege="http://tizen.org/privilege/internal/dbus" /> -+ <check send_type="signal" privilege="http://tizen.org/privilege/internal/dbus" /> -+ <check receive_type="signal" privilege="http://tizen.org/privilege/internal/dbus" /> -+ -+ <!-- Reply messages (method returns, errors) are allowed -+ by default --> -+ <allow send_requested_reply="true" send_type="method_return"/> -+ <allow send_requested_reply="true" send_type="error"/> -+ -+ <!-- All messages but signals may be received by default --> -+ <allow receive_type="method_call"/> -+ <allow receive_type="method_return"/> -+ <allow receive_type="error"/> -+ -+ <!-- Allow anyone to talk to the message bus --> -+ <allow send_destination="org.freedesktop.DBus"/> -+ <allow receive_sender="org.freedesktop.DBus"/> -+ -+ <!-- But disallow some specific bus services --> -+ <deny send_destination="org.freedesktop.DBus" -+ send_interface="org.freedesktop.DBus" -+ send_member="UpdateActivationEnvironment"/> - </policy> - - <!-- Include legacy configuration location --> -diff --git a/bus/system.conf.in b/bus/system.conf.in -index f139b55..19d0c04 100644 ---- a/bus/system.conf.in -+++ b/bus/system.conf.in -@@ -50,17 +50,20 @@ - <deny own="*"/> - <deny send_type="method_call"/> - -- <!-- Signals and reply messages (method returns, errors) are allowed -+ <!-- By default clients require internal/dbus privilege to send and receive signaks. -+ This is internal privilege that is only accessible to trusted system services --> -+ <check send_type="signal" privilege="http://tizen.org/privilege/internal/dbus" /> -+ <check receive_type="signal" privilege="http://tizen.org/privilege/internal/dbus" /> -+ -+ <!-- Reply messages (method returns, errors) are allowed - by default --> -- <allow send_type="signal"/> - <allow send_requested_reply="true" send_type="method_return"/> - <allow send_requested_reply="true" send_type="error"/> - -- <!-- All messages may be received by default --> -+ <!-- All messages but signals may be received by default --> - <allow receive_type="method_call"/> - <allow receive_type="method_return"/> - <allow receive_type="error"/> -- <allow receive_type="signal"/> - - <!-- Allow anyone to talk to the message bus --> - <allow send_destination="org.freedesktop.DBus" -@@ -69,6 +72,14 @@ - send_interface="org.freedesktop.DBus.Introspectable"/> - <allow send_destination="org.freedesktop.DBus" - send_interface="org.freedesktop.DBus.Properties"/> -+ <!-- If there is a need specific bus services could be protected by Cynara as well. -+ However, this can lead to deadlock during the boot process when such check is made and -+ Cynara is not yet activated (systemd calls protected method synchronously, -+ dbus daemon tries to consult Cynara, Cynara waits for systemd activation). -+ Therefore it is advised to allow root processes to use bus services. -+ Currently anyone is allowed to talk to the message bus --> -+ <allow receive_sender="org.freedesktop.DBus"/> -+ - <!-- But disallow some specific bus services --> - <deny send_destination="org.freedesktop.DBus" - send_interface="org.freedesktop.DBus" --- -2.21.1 - diff --git a/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0006-Fix-SIGSEGV-on-disconnections.patch b/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0006-Fix-SIGSEGV-on-disconnections.patch deleted file mode 100644 index e51ad7ce4..000000000 --- a/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0006-Fix-SIGSEGV-on-disconnections.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 28077faa11827e1ca7a7245ffd62ee78091b6bd2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh> -Date: Fri, 16 Aug 2019 13:29:23 +0200 -Subject: [PATCH 6/8] Fix SIGSEGV on disconnections -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Sometime, at start of the system, dbus-daemon was crashing -because a pending authorisation were reactivating a closed -connection. - -Also, clean unused function. - -Signed-off-by: José Bollo <jose.bollo@iot.bzh> ---- - bus/check.c | 5 +++++ - bus/check.h | 1 + - bus/connection.c | 14 +++----------- - bus/connection.h | 3 --- - 4 files changed, 9 insertions(+), 14 deletions(-) - -diff --git a/bus/check.c b/bus/check.c -index f3d283f..b73d08b 100644 ---- a/bus/check.c -+++ b/bus/check.c -@@ -617,3 +617,8 @@ bus_deferred_message_response_received (BusDeferredMessage *deferred_message, - } - } - -+void -+bus_deferred_message_abort (BusDeferredMessage *deferred_message) -+{ -+ deferred_message->response_callback = NULL; -+} -diff --git a/bus/check.h b/bus/check.h -index 9c13c18..d718a69 100644 ---- a/bus/check.h -+++ b/bus/check.h -@@ -93,6 +93,7 @@ void bus_deferred_message_set_policy_check_info (BusDeferredMessa - const char *privilege); - dbus_bool_t bus_deferred_message_check_message_limits (BusDeferredMessage *deferred_message, - DBusError *error); -+void bus_deferred_message_abort (BusDeferredMessage *deferred_message); - - - #ifdef DBUS_ENABLE_EMBEDDED_TESTS -diff --git a/bus/connection.c b/bus/connection.c -index ee93384..b520d57 100644 ---- a/bus/connection.c -+++ b/bus/connection.c -@@ -47,6 +47,7 @@ - #define MAX_LOG_COMMAND_LEN 50 - - static void bus_connection_remove_transactions (DBusConnection *connection); -+static void bus_connection_clear_deferred_messages (DBusConnection *connection); - - typedef struct - { -@@ -2821,17 +2822,7 @@ bus_connection_pop_deferred_message (DBusConnection *connection) - return NULL; - } - --dbus_bool_t --bus_connection_putback_deferred_message (DBusConnection *connection, BusDeferredMessage *message) --{ -- BusConnectionData *d = BUS_CONNECTION_DATA(connection); -- if (_dbus_list_prepend(&d->deferred_messages, message)) -- { -- return TRUE; -- } -- return FALSE; --} -- -+static - void - bus_connection_clear_deferred_messages (DBusConnection *connection) - { -@@ -2846,6 +2837,7 @@ bus_connection_clear_deferred_messages (DBusConnection *connection) - next = _dbus_list_get_next_link (&d->deferred_messages, link); - message = link->data; - -+ bus_deferred_message_abort(message); - bus_deferred_message_unref(message); - _dbus_list_remove_link(&d->deferred_messages, link); - -diff --git a/bus/connection.h b/bus/connection.h -index 97dae96..6af7bf1 100644 ---- a/bus/connection.h -+++ b/bus/connection.h -@@ -90,15 +90,12 @@ dbus_bool_t bus_connection_queue_deferred_message (DBusConnection *con - BusDeferredMessage *message, - dbus_bool_t prepend); - BusDeferredMessage *bus_connection_pop_deferred_message (DBusConnection *connection); --dbus_bool_t bus_connection_putback_deferred_message (DBusConnection *connection, -- BusDeferredMessage *message); - void bus_connection_remove_deferred_message (DBusConnection *connection, - BusDeferredMessage *message); - dbus_bool_t bus_connection_replace_deferred_message (DBusConnection *connection, - BusDeferredMessage *oldMessage, - BusDeferredMessage *newMessage); - void bus_connection_dispatch_deferred (DBusConnection *connection); --void bus_connection_clear_deferred_messages (DBusConnection *connection); - - - /* called by signals.c */ --- -2.21.1 - diff --git a/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0007-Switch-from-cynara-to-cynagora.patch b/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0007-Switch-from-cynara-to-cynagora.patch deleted file mode 100644 index 7a69efcd2..000000000 --- a/meta-app-framework/recipes-core/dbus-cynagora/dbus-cynagora/0007-Switch-from-cynara-to-cynagora.patch +++ /dev/null @@ -1,1048 +0,0 @@ -From 43cc361a5c32c81c0f93451bdb0ef781cd19a1cb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh> -Date: Tue, 4 Feb 2020 12:23:36 +0100 -Subject: [PATCH 7/8] Switch from cynara to cynagora -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: José Bollo <jose.bollo@iot.bzh> ---- - bus/Makefile.am | 8 +- - bus/bus.h | 2 +- - bus/check.c | 26 +- - bus/check.h | 2 +- - bus/connection.c | 27 --- - bus/connection.h | 3 - - bus/cynagora-check.c | 330 +++++++++++++++++++++++++ - bus/{cynara.h => cynagora-check.h} | 10 +- - bus/cynara.c | 373 ----------------------------- - bus/system.conf.in | 6 +- - configure.ac | 18 +- - 11 files changed, 366 insertions(+), 439 deletions(-) - create mode 100644 bus/cynagora-check.c - rename bus/{cynara.h => cynagora-check.h} (81%) - delete mode 100644 bus/cynara.c - -diff --git a/bus/Makefile.am b/bus/Makefile.am -index 2a8a72c..1720048 100644 ---- a/bus/Makefile.am -+++ b/bus/Makefile.am -@@ -13,7 +13,7 @@ DBUS_BUS_LIBS = \ - $(THREAD_LIBS) \ - $(ADT_LIBS) \ - $(NETWORK_libs) \ -- $(CYNARA_LIBS) \ -+ $(CYNAGORA_LIBS) \ - $(NULL) - - DBUS_LAUNCHER_LIBS = \ -@@ -31,7 +31,7 @@ AM_CPPFLAGS = \ - $(APPARMOR_CFLAGS) \ - -DDBUS_SYSTEM_CONFIG_FILE=\""$(dbusdatadir)/system.conf"\" \ - -DDBUS_COMPILATION \ -- $(CYNARA_CFLAGS) \ -+ $(CYNAGORA_CFLAGS) \ - $(NULL) - - # if assertions are enabled, improve backtraces -@@ -101,8 +101,8 @@ BUS_SOURCES= \ - config-parser-common.h \ - connection.c \ - connection.h \ -- cynara.c \ -- cynara.h \ -+ cynagora-check.c \ -+ cynagora-check.h \ - desktop-file.c \ - desktop-file.h \ - $(DIR_WATCH_SOURCE) \ -diff --git a/bus/bus.h b/bus/bus.h -index 1b08f7c..e167d9e 100644 ---- a/bus/bus.h -+++ b/bus/bus.h -@@ -47,7 +47,7 @@ typedef struct BusMatchRule BusMatchRule; - typedef struct BusActivationEntry BusActivationEntry; - typedef struct BusCheck BusCheck; - typedef struct BusDeferredMessage BusDeferredMessage; --typedef struct BusCynara BusCynara; -+typedef struct BusCynagora BusCynagora; - - /** - * BusResult is defined as a pointer to a dummy structure to allow detection of type mismatches. -diff --git a/bus/check.c b/bus/check.c -index b73d08b..ec30770 100644 ---- a/bus/check.c -+++ b/bus/check.c -@@ -26,7 +26,7 @@ - #include "check.h" - #include "connection.h" - #include "dispatch.h" --#include "cynara.h" -+#include "cynagora-check.h" - #include "utils.h" - #include <dbus/dbus-connection-internal.h> - #include <dbus/dbus-message-internal.h> -@@ -38,7 +38,7 @@ typedef struct BusCheck - int refcount; - - BusContext *context; -- BusCynara *cynara; -+ BusCynagora *cynagora; - } BusCheck; - - typedef struct BusDeferredMessage -@@ -81,7 +81,7 @@ bus_check_new (BusContext *context, DBusError *error) - - check->refcount = 1; - check->context = context; -- check->cynara = bus_cynara_new(check, error); -+ check->cynagora = bus_cynagora_new(check, error); - if (dbus_error_is_set(error)) - { - dbus_message_free_data_slot(&deferred_message_data_slot); -@@ -110,7 +110,7 @@ bus_check_unref (BusCheck *check) - - if (check->refcount == 0) - { -- bus_cynara_unref(check->cynara); -+ bus_cynagora_unref(check->cynagora); - dbus_message_free_data_slot(&deferred_message_data_slot); - dbus_free(check); - } -@@ -122,10 +122,10 @@ bus_check_get_context (BusCheck *check) - return check->context; - } - --BusCynara * --bus_check_get_cynara (BusCheck *check) -+BusCynagora * -+bus_check_get_cynagora (BusCheck *check) - { -- return check->cynara; -+ return check->cynagora; - } - - static void -@@ -276,8 +276,8 @@ bus_check_privilege (BusCheck *check, - { - BusDeferredMessage *previous_deferred_message; - BusResult result = BUS_RESULT_FALSE; --#ifdef DBUS_ENABLE_CYNARA -- BusCynara *cynara; -+#ifdef DBUS_ENABLE_CYNAGORA -+ BusCynagora *cynagora; - #endif - DBusConnection *connection; - -@@ -304,7 +304,7 @@ bus_check_privilege (BusCheck *check, - * Message has been deferred due to receive or own rule which means that sending this message - * is allowed - it must have been checked previously. - * This might happen when client calls RequestName method which depending on security -- * policy might result in both "can_send" and "can_own" Cynara checks. -+ * policy might result in both "can_send" and "can_own" Cynagora checks. - */ - result = BUS_RESULT_TRUE; - } -@@ -327,9 +327,9 @@ bus_check_privilege (BusCheck *check, - else - { - /* ask policy checkers */ --#ifdef DBUS_ENABLE_CYNARA -- cynara = bus_check_get_cynara(check); -- result = bus_cynara_check_privilege(cynara, message, sender, addressed_recipient, -+#ifdef DBUS_ENABLE_CYNAGORA -+ cynagora = bus_check_get_cynagora(check); -+ result = bus_cynagora_check_privilege(cynagora, message, sender, addressed_recipient, - proposed_recipient, privilege, check_type, deferred_message); - #endif - if (result == BUS_RESULT_LATER && deferred_message != NULL) -diff --git a/bus/check.h b/bus/check.h -index d718a69..ab63c18 100644 ---- a/bus/check.h -+++ b/bus/check.h -@@ -45,7 +45,7 @@ BusCheck *bus_check_ref (BusCheck *check); - void bus_check_unref (BusCheck *check); - - BusContext *bus_check_get_context (BusCheck *check); --BusCynara *bus_check_get_cynara (BusCheck *check); -+BusCynagora *bus_check_get_cynagora (BusCheck *check); - BusResult bus_check_privilege (BusCheck *check, - DBusMessage *message, - DBusConnection *sender, -diff --git a/bus/connection.c b/bus/connection.c -index b520d57..48910e0 100644 ---- a/bus/connection.c -+++ b/bus/connection.c -@@ -38,10 +38,6 @@ - #include <dbus/dbus-connection-internal.h> - #include <dbus/dbus-internals.h> - #include <dbus/dbus-message-internal.h> --#ifdef DBUS_ENABLE_CYNARA --#include <stdlib.h> --#include <cynara-session.h> --#endif - - /* Trim executed commands to this length; we want to keep logs readable */ - #define MAX_LOG_COMMAND_LEN 50 -@@ -124,9 +120,6 @@ typedef struct - - /** non-NULL if and only if this is a monitor */ - DBusList *link_in_monitors; --#ifdef DBUS_ENABLE_CYNARA -- char *cynara_session_id; --#endif - } BusConnectionData; - - static dbus_bool_t bus_pending_reply_expired (BusExpireList *list, -@@ -461,10 +454,6 @@ free_connection_data (void *data) - - dbus_free (d->name); - --#ifdef DBUS_ENABLE_CYNARA -- free (d->cynara_session_id); --#endif -- - dbus_free (d); - } - -@@ -1095,22 +1084,6 @@ bus_connection_get_policy (DBusConnection *connection) - return d->policy; - } - --#ifdef DBUS_ENABLE_CYNARA --const char *bus_connection_get_cynara_session_id (DBusConnection *connection) --{ -- BusConnectionData *d = BUS_CONNECTION_DATA (connection); -- _dbus_assert (d != NULL); -- -- if (d->cynara_session_id == NULL) -- { -- unsigned long pid; -- if (dbus_connection_get_unix_process_id(connection, &pid)) -- d->cynara_session_id = cynara_session_from_pid(pid); -- } -- return d->cynara_session_id; --} --#endif -- - static dbus_bool_t - foreach_active (BusConnections *connections, - BusConnectionForeachFunction function, -diff --git a/bus/connection.h b/bus/connection.h -index 6af7bf1..3116bcf 100644 ---- a/bus/connection.h -+++ b/bus/connection.h -@@ -138,9 +138,6 @@ dbus_bool_t bus_connection_be_monitor (DBusConnection *connection, - BusTransaction *transaction, - DBusList **rules, - DBusError *error); --#ifdef DBUS_ENABLE_CYNARA --const char *bus_connection_get_cynara_session_id (DBusConnection *connection); --#endif - - /* transaction API so we can send or not send a block of messages as a whole */ - -diff --git a/bus/cynagora-check.c b/bus/cynagora-check.c -new file mode 100644 -index 0000000..6c0c635 ---- /dev/null -+++ b/bus/cynagora-check.c -@@ -0,0 +1,330 @@ -+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ -+/* cynagora.c Cynagora runtime privilege checking -+ * -+ * Copyright (c) 2014 Samsung Electronics, Ltd. -+ * -+ * Licensed under the Academic Free License version 2.1 -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ * -+ */ -+ -+#include <config.h> -+#include "cynagora-check.h" -+#include "check.h" -+#include "utils.h" -+ -+#include <stdlib.h> -+#include <stdio.h> -+#include <errno.h> -+ -+#include <dbus/dbus.h> -+#include <dbus/dbus-watch.h> -+#include <dbus/dbus-connection-internal.h> -+#include <bus/connection.h> -+ -+#ifndef DBUS_ENABLE_CYNAGORA -+ -+BusCynagora * -+bus_cynagora_new(BusCheck *check, DBusError *error) -+{ -+ return NULL; -+} -+ -+BusCynagora * -+bus_cynagora_ref (BusCynagora *cynagora) -+{ -+ return NULL; -+} -+ -+void -+bus_cynagora_unref (BusCynagora *cynagora) -+{ -+} -+ -+BusResult -+bus_cynagora_check_privilege (BusCynagora *cynagora, -+ DBusMessage *message, -+ DBusConnection *sender, -+ DBusConnection *addressed_recipient, -+ DBusConnection *proposed_recipient, -+ const char *privilege, -+ BusDeferredMessageStatus check_type, -+ BusDeferredMessage **deferred_message_param) -+{ -+ return BUS_RESULT_FALSE; -+} -+ -+#endif -+ -+#ifdef DBUS_ENABLE_CYNAGORA -+ -+#include <time.h> -+#include <sys/epoll.h> -+ -+#include <cynagora.h> -+ -+#ifndef CYNAGORA_CACHE_SIZE -+#define CYNAGORA_CACHE_SIZE 8000 -+#endif -+ -+typedef struct BusCynagora -+{ -+ int refcount; -+ -+ BusContext *context; -+ BusCheck *check; -+ cynagora_t *cynagora; -+ DBusWatch *cynagora_watch; -+} BusCynagora; -+ -+static int async_callback(void *closure, -+ int op, -+ int fd, -+ uint32_t events); -+ -+BusCynagora * -+bus_cynagora_new(BusCheck *check, DBusError *error) -+{ -+ BusContext *context; -+ BusCynagora *cynagora; -+ int ret; -+ -+ cynagora = dbus_new(BusCynagora, 1); -+ if (cynagora == NULL) -+ { -+ BUS_SET_OOM(error); -+ return NULL; -+ } -+ -+ context = bus_check_get_context(check); -+ -+ cynagora->refcount = 1; -+ cynagora->check = check; -+ cynagora->context = context; -+ cynagora->cynagora_watch = NULL; -+ -+ ret = cynagora_create(&cynagora->cynagora, cynagora_Check, CYNAGORA_CACHE_SIZE, NULL); -+ if (ret < 0) -+ { -+ dbus_set_error (error, DBUS_ERROR_FAILED, "Failed to create Cynagora configuration"); -+ } -+ else -+ { -+ ret = cynagora_async_setup(cynagora->cynagora, async_callback, cynagora); -+ if (ret < 0) -+ { -+ dbus_set_error (error, DBUS_ERROR_FAILED, "Failed to initialize Cynagora client"); -+ } -+ else -+ { -+ return cynagora; -+ } -+ cynagora_destroy(cynagora->cynagora); -+ } -+ -+ dbus_free(cynagora); -+ return NULL; -+} -+ -+BusCynagora * -+bus_cynagora_ref (BusCynagora *cynagora) -+{ -+ _dbus_assert (cynagora->refcount > 0); -+ cynagora->refcount += 1; -+ -+ return cynagora; -+} -+ -+void -+bus_cynagora_unref (BusCynagora *cynagora) -+{ -+ _dbus_assert (cynagora->refcount > 0); -+ -+ cynagora->refcount -= 1; -+ -+ if (cynagora->refcount == 0) -+ { -+ cynagora_destroy(cynagora->cynagora); -+ dbus_free(cynagora); -+ } -+} -+ -+static void -+async_check_callback (void *closure, int status) -+{ -+ BusDeferredMessage *deferred_message = closure; -+ BusResult result; -+ -+ if (deferred_message == NULL) -+ return; -+ -+ if (status == 1) -+ result = BUS_RESULT_TRUE; -+ else -+ result = BUS_RESULT_FALSE; -+ -+ bus_deferred_message_response_received(deferred_message, result); -+ bus_deferred_message_unref(deferred_message); -+} -+ -+BusResult -+bus_cynagora_check_privilege (BusCynagora *cynagora, -+ DBusMessage *message, -+ DBusConnection *sender, -+ DBusConnection *addressed_recipient, -+ DBusConnection *proposed_recipient, -+ const char *permission, -+ BusDeferredMessageStatus check_type, -+ BusDeferredMessage **deferred_message_param) -+{ -+ int result; -+ unsigned long uid; -+ unsigned long pid; -+ char *label; -+ char user[32]; -+ char session[32]; -+ DBusConnection *connection = check_type == BUS_DEFERRED_MESSAGE_CHECK_RECEIVE ? proposed_recipient : sender; -+ BusDeferredMessage *deferred_message; -+ BusResult ret; -+ cynagora_key_t key; -+ -+ _dbus_assert(connection != NULL); -+ -+ if (dbus_connection_get_unix_user(connection, &uid) == FALSE) -+ return BUS_RESULT_FALSE; -+ -+ if (dbus_connection_get_unix_process_id(connection, &pid) == FALSE) -+ return BUS_RESULT_FALSE; -+ -+ if (_dbus_connection_get_linux_security_label(connection, &label) == FALSE || label == NULL) -+ { -+ _dbus_warn("Failed to obtain security label for connection\n"); -+ return BUS_RESULT_FALSE; -+ } -+ -+ snprintf(user, sizeof(user), "%lu", uid); -+ snprintf(session, sizeof(session), "%lu", pid); -+ -+ key.client = label; -+ key.session = session; -+ key.user = user; -+ key.permission = permission; -+ -+ result = cynagora_cache_check(cynagora->cynagora, &key); -+ switch (result) -+ { -+ case 1: -+ _dbus_verbose("Cynagora: got ALLOWED answer from cache (client=%s session_id=%s user=%s permission=%s)\n", -+ label, session_id, user, permission); -+ ret = BUS_RESULT_TRUE; -+ break; -+ -+ case 0: -+ _dbus_verbose("Cynagora: got DENIED answer from cache (client=%s session_id=%s user=%s permission=%s)\n", -+ label, session_id, user, permission); -+ ret = BUS_RESULT_FALSE; -+ break; -+ -+ default: -+ deferred_message = bus_deferred_message_new(message, sender, addressed_recipient, -+ proposed_recipient, BUS_RESULT_LATER); -+ if (deferred_message == NULL) -+ { -+ _dbus_verbose("Failed to allocate memory for deferred message\n"); -+ ret = BUS_RESULT_FALSE; -+ goto out; -+ } -+ -+ /* callback is supposed to unref deferred_message*/ -+ result = cynagora_async_check(cynagora->cynagora, &key, 1, 0, async_check_callback, deferred_message); -+ if (result == 0) -+ { -+ _dbus_verbose("Created Cynagora request: client=%s session_id=%s user=%s permission=%s " -+ "deferred_message=%p\n", label, session_id, user, permission, deferred_message); -+ if (deferred_message_param != NULL) -+ *deferred_message_param = deferred_message; -+ ret = BUS_RESULT_LATER; -+ } -+ else -+ { -+ _dbus_verbose("Error on cynagora request create: %i\n", result); -+ bus_deferred_message_unref(deferred_message); -+ ret = BUS_RESULT_FALSE; -+ } -+ break; -+ } -+out: -+ dbus_free(label); -+ return ret; -+} -+ -+static dbus_bool_t -+watch_handler_callback(DBusWatch *watch, -+ unsigned int flags, -+ void *data) -+{ -+ BusCynagora *cynagora = (BusCynagora *)data; -+ int result = cynagora_async_process(cynagora->cynagora); -+ if (result < 0) -+ _dbus_verbose("cynagora_async_process returned %d\n", result); -+ -+ return result != -ENOMEM ? TRUE : FALSE; -+} -+ -+static int -+async_callback(void *closure, int op, int fd, uint32_t events) -+{ -+ BusCynagora *cynagora = (BusCynagora *)closure; -+ DBusLoop *loop = bus_context_get_loop(cynagora->context); -+ unsigned int flags; -+ DBusWatch *watch; -+ -+ /* compute flags */ -+ flags = 0; -+ if (events & EPOLLIN) -+ flags |= DBUS_WATCH_READABLE; -+ if (events & EPOLLOUT) -+ flags |= DBUS_WATCH_WRITABLE; -+ -+ /* remove the watch if needed */ -+ watch = cynagora->cynagora_watch; -+ if (watch != NULL) -+ { -+ cynagora->cynagora_watch = NULL; -+ _dbus_loop_remove_watch(loop, watch); -+ _dbus_watch_invalidate(watch); -+ _dbus_watch_unref(watch); -+ } -+ -+ /* create the watch if needed */ -+ watch = cynagora->cynagora_watch; -+ if (op != EPOLL_CTL_DEL) -+ { -+ watch = _dbus_watch_new(fd, flags, TRUE, watch_handler_callback, cynagora, NULL); -+ if (watch == NULL) -+ return -ENOMEM; -+ if (_dbus_loop_add_watch(loop, watch) != TRUE) -+ { -+ _dbus_watch_invalidate(watch); -+ _dbus_watch_unref(watch); -+ return -ENOMEM; -+ } -+ cynagora->cynagora_watch = watch; -+ } -+ return 0; -+} -+ -+#endif /* DBUS_ENABLE_CYNAGORA */ -diff --git a/bus/cynara.h b/bus/cynagora-check.h -similarity index 81% -rename from bus/cynara.h -rename to bus/cynagora-check.h -index c4728bb..c0892c3 100644 ---- a/bus/cynara.h -+++ b/bus/cynagora-check.h -@@ -1,5 +1,5 @@ - /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ --/* cynara.h Cynara runtime privilege checking -+/* cynagora.h Cynagora runtime privilege checking - * - * Copyright (c) 2014 Samsung Electronics, Ltd. - * -@@ -24,10 +24,10 @@ - #include "bus.h" - #include "check.h" - --BusCynara *bus_cynara_new (BusCheck *check, DBusError *error); --BusCynara *bus_cynara_ref (BusCynara *cynara); --void bus_cynara_unref (BusCynara *cynara); --BusResult bus_cynara_check_privilege (BusCynara *cynara, -+BusCynagora *bus_cynagora_new (BusCheck *check, DBusError *error); -+BusCynagora *bus_cynagora_ref (BusCynagora *cynagora); -+void bus_cynagora_unref (BusCynagora *cynagora); -+BusResult bus_cynagora_check_privilege (BusCynagora *cynagora, - DBusMessage *message, - DBusConnection *sender, - DBusConnection *addressed_recipient, -diff --git a/bus/cynara.c b/bus/cynara.c -deleted file mode 100644 -index 77aed62..0000000 ---- a/bus/cynara.c -+++ /dev/null -@@ -1,373 +0,0 @@ --/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ --/* cynara.c Cynara runtime privilege checking -- * -- * Copyright (c) 2014 Samsung Electronics, Ltd. -- * -- * Licensed under the Academic Free License version 2.1 -- * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU General Public License as published by -- * the Free Software Foundation; either version 2 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU General Public License for more details. -- * -- * You should have received a copy of the GNU General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -- * -- */ -- --#include <config.h> --#include "cynara.h" --#include "check.h" --#include "utils.h" -- --#include <stdio.h> -- --#include <dbus/dbus.h> --#include <dbus/dbus-watch.h> --#include <dbus/dbus-connection-internal.h> --#include <bus/connection.h> --#ifdef DBUS_ENABLE_CYNARA --#include <cynara-client-async.h> --#endif -- --#ifdef DBUS_ENABLE_CYNARA --typedef struct BusCynara --{ -- int refcount; -- -- BusContext *context; -- BusCheck *check; -- cynara_async *cynara; -- DBusWatch *cynara_watch; --} BusCynara; -- --#define USE_CYNARA_CACHE 1 --#ifdef USE_CYNARA_CACHE --#define CYNARA_CACHE_SIZE 1000 --#endif -- --static dbus_bool_t bus_cynara_watch_callback(DBusWatch *watch, -- unsigned int flags, -- void *data); -- --static void status_callback(int old_fd, -- int new_fd, -- cynara_async_status status, -- void *user_status_data); --static void bus_cynara_check_response_callback (cynara_check_id check_id, -- cynara_async_call_cause cause, -- int response, -- void *user_response_data); --#endif -- -- --BusCynara * --bus_cynara_new(BusCheck *check, DBusError *error) --{ --#ifdef DBUS_ENABLE_CYNARA -- BusContext *context; -- BusCynara *cynara; -- cynara_async_configuration *conf = NULL; -- int ret; -- -- cynara = dbus_new(BusCynara, 1); -- if (cynara == NULL) -- { -- BUS_SET_OOM(error); -- return NULL; -- } -- -- context = bus_check_get_context(check); -- -- cynara->refcount = 1; -- cynara->check = check; -- cynara->context = context; -- cynara->cynara_watch = NULL; -- -- ret = cynara_async_configuration_create(&conf); -- if (ret != CYNARA_API_SUCCESS) -- { -- dbus_set_error (error, DBUS_ERROR_FAILED, "Failed to create Cynara configuration"); -- goto out; -- } -- --#ifdef CYNARA_CACHE_SIZE -- ret = cynara_async_configuration_set_cache_size(conf, CYNARA_CACHE_SIZE); -- if (ret != CYNARA_API_SUCCESS) -- { -- dbus_set_error (error, DBUS_ERROR_FAILED, "Failed to Cynara cache size"); -- goto out; -- } --#endif -- -- ret = cynara_async_initialize(&cynara->cynara, conf, &status_callback, cynara); -- if (ret != CYNARA_API_SUCCESS) -- { -- dbus_set_error (error, DBUS_ERROR_FAILED, "Failed to initialize Cynara client"); -- goto out; -- } -- --out: -- cynara_async_configuration_destroy(conf); -- if (ret != CYNARA_API_SUCCESS) -- { -- dbus_free(cynara); -- return NULL; -- } -- -- return cynara; --#else -- return NULL; --#endif --} -- --BusCynara * --bus_cynara_ref (BusCynara *cynara) --{ --#ifdef DBUS_ENABLE_CYNARA -- _dbus_assert (cynara->refcount > 0); -- cynara->refcount += 1; -- -- return cynara; --#else -- return NULL; --#endif --} -- --void --bus_cynara_unref (BusCynara *cynara) --{ --#ifdef DBUS_ENABLE_CYNARA -- _dbus_assert (cynara->refcount > 0); -- -- cynara->refcount -= 1; -- -- if (cynara->refcount == 0) -- { -- cynara_async_finish(cynara->cynara); -- dbus_free(cynara); -- } --#endif --} -- --BusResult --bus_cynara_check_privilege (BusCynara *cynara, -- DBusMessage *message, -- DBusConnection *sender, -- DBusConnection *addressed_recipient, -- DBusConnection *proposed_recipient, -- const char *privilege, -- BusDeferredMessageStatus check_type, -- BusDeferredMessage **deferred_message_param) --{ --#ifdef DBUS_ENABLE_CYNARA -- int result; -- unsigned long uid; -- char *label; -- const char *session_id; -- char user[32]; -- cynara_check_id check_id; -- DBusConnection *connection = check_type == BUS_DEFERRED_MESSAGE_CHECK_RECEIVE ? proposed_recipient : sender; -- BusDeferredMessage *deferred_message; -- BusResult ret; -- -- _dbus_assert(connection != NULL); -- -- if (dbus_connection_get_unix_user(connection, &uid) == FALSE) -- return BUS_RESULT_FALSE; -- -- if (_dbus_connection_get_linux_security_label(connection, &label) == FALSE || label == NULL) -- { -- _dbus_warn("Failed to obtain security label for connection\n"); -- return BUS_RESULT_FALSE; -- } -- -- session_id = bus_connection_get_cynara_session_id (connection); -- if (session_id == NULL) -- { -- ret = BUS_RESULT_FALSE; -- goto out; -- } -- -- snprintf(user, sizeof(user), "%lu", uid); -- --#if USE_CYNARA_CACHE -- result = cynara_async_check_cache(cynara->cynara, label, session_id, user, privilege); --#else -- result = CYNARA_API_CACHE_MISS; --#endif -- -- switch (result) -- { -- case CYNARA_API_ACCESS_ALLOWED: -- _dbus_verbose("Cynara: got ALLOWED answer from cache (client=%s session_id=%s user=%s privilege=%s)\n", -- label, session_id, user, privilege); -- ret = BUS_RESULT_TRUE; -- break; -- -- case CYNARA_API_ACCESS_DENIED: -- _dbus_verbose("Cynara: got DENIED answer from cache (client=%s session_id=%s user=%s privilege=%s)\n", -- label, session_id, user, privilege); -- ret = BUS_RESULT_FALSE; -- break; -- -- case CYNARA_API_CACHE_MISS: -- deferred_message = bus_deferred_message_new(message, sender, addressed_recipient, -- proposed_recipient, BUS_RESULT_LATER); -- if (deferred_message == NULL) -- { -- _dbus_verbose("Failed to allocate memory for deferred message\n"); -- ret = BUS_RESULT_FALSE; -- goto out; -- } -- -- /* callback is supposed to unref deferred_message*/ -- result = cynara_async_create_request(cynara->cynara, label, session_id, user, privilege, &check_id, -- &bus_cynara_check_response_callback, deferred_message); -- if (result == CYNARA_API_SUCCESS) -- { -- _dbus_verbose("Created Cynara request: client=%s session_id=%s user=%s privilege=%s check_id=%u " -- "deferred_message=%p\n", label, session_id, user, privilege, (unsigned int)check_id, deferred_message); -- if (deferred_message_param != NULL) -- *deferred_message_param = deferred_message; -- ret = BUS_RESULT_LATER; -- } -- else -- { -- _dbus_verbose("Error on cynara request create: %i\n", result); -- bus_deferred_message_unref(deferred_message); -- ret = BUS_RESULT_FALSE; -- } -- break; -- default: -- _dbus_verbose("Error when accessing Cynara cache: %i\n", result); -- ret = BUS_RESULT_FALSE; -- } --out: -- dbus_free(label); -- return ret; -- --#else -- return BUS_RESULT_FALSE; --#endif --} -- -- -- --#ifdef DBUS_ENABLE_CYNARA --static void --status_callback(int old_fd, int new_fd, cynara_async_status status, -- void *user_status_data) --{ -- BusCynara *cynara = (BusCynara *)user_status_data; -- DBusLoop *loop = bus_context_get_loop(cynara->context); -- -- if (cynara->cynara_watch != NULL) -- { -- _dbus_loop_remove_watch(loop, cynara->cynara_watch); -- _dbus_watch_invalidate(cynara->cynara_watch); -- _dbus_watch_unref(cynara->cynara_watch); -- cynara->cynara_watch = NULL; -- } -- -- if (new_fd != -1) -- { -- unsigned int flags; -- DBusWatch *watch; -- -- switch (status) -- { -- case CYNARA_STATUS_FOR_READ: -- flags = DBUS_WATCH_READABLE; -- break; -- case CYNARA_STATUS_FOR_RW: -- flags = DBUS_WATCH_READABLE | DBUS_WATCH_WRITABLE; -- break; -- default: -- /* Cynara passed unknown status - warn and add RW watch */ -- _dbus_verbose("Cynara passed unknown status value: 0x%08X\n", (unsigned int)status); -- flags = DBUS_WATCH_READABLE | DBUS_WATCH_WRITABLE; -- break; -- } -- -- watch = _dbus_watch_new(new_fd, flags, TRUE, &bus_cynara_watch_callback, cynara, NULL); -- if (watch != NULL) -- { -- if (_dbus_loop_add_watch(loop, watch) == TRUE) -- { -- cynara->cynara_watch = watch; -- return; -- } -- -- _dbus_watch_invalidate(watch); -- _dbus_watch_unref(watch); -- } -- -- /* It seems like not much can be done at this point. Cynara events won't be processed -- * until next Cynara function call triggering status callback */ -- _dbus_verbose("Failed to add dbus watch\n"); -- } --} -- --static dbus_bool_t --bus_cynara_watch_callback(DBusWatch *watch, -- unsigned int flags, -- void *data) --{ -- BusCynara *cynara = (BusCynara *)data; -- int result = cynara_async_process(cynara->cynara); -- if (result != CYNARA_API_SUCCESS) -- _dbus_verbose("cynara_async_process returned %d\n", result); -- -- return result != CYNARA_API_OUT_OF_MEMORY ? TRUE : FALSE; --} -- --static inline const char * --call_cause_to_string(cynara_async_call_cause cause) --{ -- switch (cause) -- { -- case CYNARA_CALL_CAUSE_ANSWER: -- return "ANSWER"; -- case CYNARA_CALL_CAUSE_CANCEL: -- return "CANCEL"; -- case CYNARA_CALL_CAUSE_FINISH: -- return "FINSIH"; -- case CYNARA_CALL_CAUSE_SERVICE_NOT_AVAILABLE: -- return "SERVICE NOT AVAILABLE"; -- default: -- return "INVALID"; -- } --} -- --static void --bus_cynara_check_response_callback (cynara_check_id check_id, -- cynara_async_call_cause cause, -- int response, -- void *user_response_data) --{ -- BusDeferredMessage *deferred_message = user_response_data; -- BusResult result; -- -- _dbus_verbose("Cynara callback: check_id=%u, cause=%s response=%i response_data=%p\n", -- (unsigned int)check_id, call_cause_to_string(cause), response, user_response_data); -- -- if (deferred_message == NULL) -- return; -- -- if (cause == CYNARA_CALL_CAUSE_ANSWER && response == CYNARA_API_ACCESS_ALLOWED) -- result = BUS_RESULT_TRUE; -- else -- result = BUS_RESULT_FALSE; -- -- bus_deferred_message_response_received(deferred_message, result); -- bus_deferred_message_unref(deferred_message); --} -- --#endif /* DBUS_ENABLE_CYNARA */ -diff --git a/bus/system.conf.in b/bus/system.conf.in -index 19d0c04..81c39c8 100644 ---- a/bus/system.conf.in -+++ b/bus/system.conf.in -@@ -72,10 +72,10 @@ - send_interface="org.freedesktop.DBus.Introspectable"/> - <allow send_destination="org.freedesktop.DBus" - send_interface="org.freedesktop.DBus.Properties"/> -- <!-- If there is a need specific bus services could be protected by Cynara as well. -+ <!-- If there is a need specific bus services could be protected by Cynagora as well. - However, this can lead to deadlock during the boot process when such check is made and -- Cynara is not yet activated (systemd calls protected method synchronously, -- dbus daemon tries to consult Cynara, Cynara waits for systemd activation). -+ Cynagora is not yet activated (systemd calls protected method synchronously, -+ dbus daemon tries to consult Cynagora, Cynagora waits for systemd activation). - Therefore it is advised to allow root processes to use bus services. - Currently anyone is allowed to talk to the message bus --> - <allow receive_sender="org.freedesktop.DBus"/> -diff --git a/configure.ac b/configure.ac -index 11b5ffd..df9341c 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1742,16 +1742,16 @@ AC_ARG_ENABLE([user-session], - AM_CONDITIONAL([DBUS_ENABLE_USER_SESSION], - [test "x$enable_user_session" = xyes]) - --#enable cynara integration --AC_ARG_ENABLE([cynara], [AS_HELP_STRING([--enable-cynara], [enable Cynara integration])], [], [enable_cynara=no]) --if test "x$enable_cynara" = xyes; then -- PKG_CHECK_MODULES([CYNARA], [cynara-client-async >= 0.6.0 cynara-session >= 0.6.0], -- [AC_DEFINE([DBUS_ENABLE_CYNARA], [1], [Define to enable Cynara privilege checks in dbus-daemon])], -- [AC_MSG_ERROR([libcynara-client-async and cynara-session are required to enable Cynara integration])]) -+#enable cynagora integration -+AC_ARG_ENABLE([cynagora], [AS_HELP_STRING([--enable-cynagora], [enable Cynagora integration])], [], [enable_cynagora=no]) -+if test "x$enable_cynagora" = xyes; then -+ PKG_CHECK_MODULES([CYNAGORA], [cynagora], -+ [AC_DEFINE([DBUS_ENABLE_CYNAGORA], [1], [Define to enable Cynagora privilege checks in dbus-daemon])], -+ [AC_MSG_ERROR([libcynagora is required to enable Cynagora integration])]) - fi - --AC_SUBST([CYNARA_CFLAGS]) --AC_SUBST([CYNARA_LIBS]) -+AC_SUBST([CYNAGORA_CFLAGS]) -+AC_SUBST([CYNAGORA_LIBS]) - - AC_CONFIG_FILES([ - Doxyfile -@@ -1835,7 +1835,7 @@ echo " - Building bus stats API: ${enable_stats} - Building SELinux support: ${have_selinux} - Building AppArmor support: ${have_apparmor} -- Building Cynara support: ${enable_cynara} -+ Building Cynagora support: ${enable_cynagora} - Building inotify support: ${have_inotify} - Building kqueue support: ${have_kqueue} - Building systemd support: ${have_systemd} --- -2.21.1 - diff --git a/meta-app-framework/recipes-core/dbus-cynagora/dbus_1.12.20.bbappend b/meta-app-framework/recipes-core/dbus-cynagora/dbus_1.12.20.bbappend deleted file mode 100644 index 028c734aa..000000000 --- a/meta-app-framework/recipes-core/dbus-cynagora/dbus_1.12.20.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'dbus_appfw.inc', '', d)} diff --git a/meta-app-framework/recipes-core/dbus-cynagora/dbus_appfw.inc b/meta-app-framework/recipes-core/dbus-cynagora/dbus_appfw.inc deleted file mode 100644 index 4efeef7b8..000000000 --- a/meta-app-framework/recipes-core/dbus-cynagora/dbus_appfw.inc +++ /dev/null @@ -1,15 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/dbus-cynagora:" - -SRC_URI:append:class-target = "\ - file://0001-Integration-of-Cynara-asynchronous-security-checks.patch \ - file://0002-Disable-message-dispatching-when-send-rule-result-is.patch \ - file://0003-Handle-unavailability-of-policy-results-for-broadcas.patch \ - file://0004-Add-own-rule-result-unavailability-handling.patch \ - file://0005-Perform-Cynara-runtime-policy-checks-by-default.patch \ - file://0006-Fix-SIGSEGV-on-disconnections.patch \ - file://0007-Switch-from-cynara-to-cynagora.patch \ -" - -DEPENDS:append:class-target = " cynagora smack" -EXTRA_OECONF:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES','smack','--enable-cynagora --disable-selinux','',d)}" - diff --git a/meta-app-framework/recipes-core/nss-localuser/nss-localuser_0.1.bb b/meta-app-framework/recipes-core/nss-localuser/nss-localuser_0.1.bb deleted file mode 100644 index 93d2a2034..000000000 --- a/meta-app-framework/recipes-core/nss-localuser/nss-localuser_0.1.bb +++ /dev/null @@ -1,39 +0,0 @@ -SUMMARY = "Name Service Switch module for resolving the local user hostname" - -DESCRIPTION = "plugin for the GNU Name Service Switch (NSS) \ -functionality of the GNU C Library (`glibc`) providing host name \ -resolution for *"localuser"* family of virtual hostnames." - -HOMEPAGE = "https://git.automotivelinux.org/src/nss-localuser/" - -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=79ad77111c398994735201536a4749ba" - -SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/nss-localuser;protocol=https;branch=${AGL_BRANCH}" -SRCREV = "66803c6fdb609ed83a78b9194ecb23e9c1b773e7" -PV = "${AGL_BRANCH}+git${SRCPV}" - -RDEPENDS:${PN} = "base-files" - -S = "${WORKDIR}/git" - -do_compile() { - make -} - -do_install() { - make nssdir=${D}${libdir} install -} - -pkg_postinst_ontarget:${PN} () { - sed -e '/^hosts:/s/\<localuser\>\s*//' \ - -e 's/\(^hosts:\s\s*\)\(.*\)/\1localuser \2/' \ - -i $D${sysconfdir}/nsswitch.conf -} - -pkg_prerm:${PN} () { - sed -e '/^hosts:/s/\<localuser\>\s*//' \ - -i $D${sysconfdir}/nsswitch.conf -} - -INSANE_SKIP:${PN} = "ldflags" diff --git a/meta-app-framework/recipes-core/shadow/shadow_%.bbappend b/meta-app-framework/recipes-core/shadow/shadow_%.bbappend deleted file mode 100644 index 70a0c3c82..000000000 --- a/meta-app-framework/recipes-core/shadow/shadow_%.bbappend +++ /dev/null @@ -1,3 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'shadow_appfw.inc', '', d)} - - diff --git a/meta-app-framework/recipes-core/shadow/shadow_appfw.inc b/meta-app-framework/recipes-core/shadow/shadow_appfw.inc deleted file mode 100644 index d41c996e9..000000000 --- a/meta-app-framework/recipes-core/shadow/shadow_appfw.inc +++ /dev/null @@ -1,3 +0,0 @@ -do_install:append() { - sed -i '/^UMASK/s:^.*$:UMASK 077:' ${D}${sysconfdir}/login.defs -} diff --git a/meta-app-framework/recipes-core/smack-system-setup/files/55-udev-smack-default.rules b/meta-app-framework/recipes-core/smack-system-setup/files/55-udev-smack-default.rules deleted file mode 100644 index eca65292f..000000000 --- a/meta-app-framework/recipes-core/smack-system-setup/files/55-udev-smack-default.rules +++ /dev/null @@ -1,27 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="null", SECLABEL{smack}="*" -KERNEL=="zero", SECLABEL{smack}="*" -KERNEL=="console", SECLABEL{smack}="*" -KERNEL=="kmsg", SECLABEL{smack}="*" -KERNEL=="video*", SECLABEL{smack}="*" -KERNEL=="card*", SECLABEL{smack}="*" -KERNEL=="ptmx", SECLABEL{smack}="*" -KERNEL=="tty", SECLABEL{smack}="*" -KERNEL=="rfkill", SECLABEL{smack}="*" - -SUBSYSTEM=="most_cdev_aim", SECLABEL{smack}="*" - -SUBSYSTEM=="graphics", GROUP="video", SECLABEL{smack}="*" -SUBSYSTEM=="drm", GROUP="video", SECLABEL{smack}="*" -SUBSYSTEM=="dvb", GROUP="video", SECLABEL{smack}="*" -SUBSYSTEM=="sound", GROUP="audio", SECLABEL{smack}="*" - -SUBSYSTEM=="tty", KERNEL=="ptmx", GROUP="tty", MODE="0666", SECLABEL{smack}="*" -SUBSYSTEM=="tty", KERNEL=="tty", GROUP="tty", MODE="0666", SECLABEL{smack}="*" -SUBSYSTEM=="tty", KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620", SECLABEL{smack}="*" -SUBSYSTEM=="vc", KERNEL=="vcs*|vcsa*", GROUP="tty", SECLABEL{smack}="*" -KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout", SECLABEL{smack}="*" - -SUBSYSTEM=="input", KERNEL=="mouse*|mice|event*", MODE="0640", SECLABEL{smack}="*" -SUBSYSTEM=="input", KERNEL=="ts[0-9]*|uinput", MODE="0640", SECLABEL{smack}="*" diff --git a/meta-app-framework/recipes-core/smack-system-setup/files/systemd-journald.service.conf b/meta-app-framework/recipes-core/smack-system-setup/files/systemd-journald.service.conf deleted file mode 100644 index 7035a1410..000000000 --- a/meta-app-framework/recipes-core/smack-system-setup/files/systemd-journald.service.conf +++ /dev/null @@ -1,16 +0,0 @@ -# Run systemd-journald with the hat ("^") Smack label. -# -# The journal daemon needs global read access to gather information -# about the services spawned by systemd. The hat label is intended -# for this purpose. The journal daemon is the only part of the -# System domain that needs read access to the User domain. Giving -# the journal daemon the hat label means that we can remove the -# System domain's read access to the User domain and we can avoid -# hard-coding a specific label name for that domain. -# -# Original author: Casey Schaufler <casey@schaufler-ca.com> -# -# This is considered a configuration change and thus distro specific. -[Service] -SmackProcessLabel=^ - diff --git a/meta-app-framework/recipes-core/smack-system-setup/files/systemd-tmpfiles-setup.service.conf b/meta-app-framework/recipes-core/smack-system-setup/files/systemd-tmpfiles-setup.service.conf deleted file mode 100644 index db43c8c51..000000000 --- a/meta-app-framework/recipes-core/smack-system-setup/files/systemd-tmpfiles-setup.service.conf +++ /dev/null @@ -1,2 +0,0 @@ -[Service] -ExecStartPost=/bin/sh -c '([ ! -d /var/tmp ] || chsmack -L -a \"*\" /var/tmp) && ([ ! -d /var/log ] || chsmack -L -a System::Log /var/log && chsmack -L -t /var/log)' diff --git a/meta-app-framework/recipes-core/smack-system-setup/files/tmp.mount.conf b/meta-app-framework/recipes-core/smack-system-setup/files/tmp.mount.conf deleted file mode 100644 index 388986e82..000000000 --- a/meta-app-framework/recipes-core/smack-system-setup/files/tmp.mount.conf +++ /dev/null @@ -1,12 +0,0 @@ -# Mount /tmp publicly accessable. Based on patch by Michael Demeter <michael.demeter@intel.com>. -# Upstream systemd temporarily had SmackFileSystemRoot for this (https://github.com/systemd/systemd/pull/1664), -# but it was removed again (https://github.com/systemd/systemd/issues/1696) because -# util-linux mount will ignore smackfsroot when Smack is not active. However, -# busybox is not that intelligent. -# -# When using busybox mount, adding smackfsroot=* and booting without -# Smack (i.e. security=none), tmp.mount will fail with an error about -# "Bad mount option smackfsroot". -[Mount] -Options=smackfsroot=* - diff --git a/meta-app-framework/recipes-core/smack-system-setup/smack-system-setup_1.bb b/meta-app-framework/recipes-core/smack-system-setup/smack-system-setup_1.bb deleted file mode 100644 index b74f462b4..000000000 --- a/meta-app-framework/recipes-core/smack-system-setup/smack-system-setup_1.bb +++ /dev/null @@ -1,28 +0,0 @@ -DESCRIPTION = "setup of a system using smack" -LICENSE = "GPLv2" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" - -SRC_URI = "\ - file://55-udev-smack-default.rules \ - file://systemd-journald.service.conf \ - file://systemd-tmpfiles-setup.service.conf \ - file://tmp.mount.conf \ -" - -RDEPENDS:${PN}:append:with-lsm-smack = " smack" - -do_install:append:with-lsm-smack() { - # tuning systemd units - install -Dm0644 ${WORKDIR}/systemd-tmpfiles-setup.service.conf \ - ${D}${systemd_unitdir}/system/systemd-tmpfiles-setup.service.d/smack.conf - install -Dm0644 ${WORKDIR}/systemd-journald.service.conf \ - ${D}${systemd_unitdir}/system/systemd-journald.service.d/smack.conf - install -Dm0644 ${WORKDIR}/tmp.mount.conf \ - ${D}${systemd_unitdir}/system/tmp.mount.d/smack.conf - - # add udev rules - install -Dm0644 ${WORKDIR}/55-udev-smack-default.rules \ - ${D}${sysconfdir}/udev/rules.d/55-udev-smack-default.rules -} - -FILES:${PN} += "${systemd_unitdir}" diff --git a/meta-app-framework/recipes-core/systemd/systemd/0001-Switch-Smack-label-earlier.patch b/meta-app-framework/recipes-core/systemd/systemd/0001-Switch-Smack-label-earlier.patch deleted file mode 100644 index 46445be73..000000000 --- a/meta-app-framework/recipes-core/systemd/systemd/0001-Switch-Smack-label-earlier.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 6cc74075797edb6f698cb7f312bb1c3d8cc6cb28 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh> -Date: Thu, 12 Oct 2017 17:17:56 +0200 -Subject: [PATCH] Switch Smack label earlier -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Switching label after removing capability isn't -possible. - -Change-Id: Ib7dac8f071f36119520ed3205d743c1e3df3cd5e -Signed-off-by: José Bollo <jose.bollo@iot.bzh> ---- - src/core/execute.c | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/src/core/execute.c b/src/core/execute.c -index d72e5bf08..0abffd569 100644 ---- a/src/core/execute.c -+++ b/src/core/execute.c -@@ -2707,6 +2707,13 @@ static int exec_child( - } - } - -+ r = setup_smack(context, command); -+ if (r < 0) { -+ *exit_status = EXIT_SMACK_PROCESS_LABEL; -+ *error_message = strdup("Failed to set SMACK process label"); -+ return r; -+ } -+ - if (!cap_test_all(context->capability_bounding_set)) { - r = capability_bounding_set_drop(context->capability_bounding_set, false); - if (r < 0) { -@@ -2775,13 +2782,6 @@ static int exec_child( - } - #endif - -- r = setup_smack(context, command); -- if (r < 0) { -- *exit_status = EXIT_SMACK_PROCESS_LABEL; -- *error_message = strdup("Failed to set SMACK process label"); -- return r; -- } -- - #ifdef HAVE_APPARMOR - if (context->apparmor_profile && mac_apparmor_use()) { - r = aa_change_onexec(context->apparmor_profile); --- -2.14.3 - diff --git a/meta-app-framework/recipes-core/systemd/systemd_2%.bbappend b/meta-app-framework/recipes-core/systemd/systemd_2%.bbappend deleted file mode 100644 index 11b1df9bb..000000000 --- a/meta-app-framework/recipes-core/systemd/systemd_2%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'systemd_appfw.inc', '', d)} diff --git a/meta-app-framework/recipes-core/systemd/systemd_appfw.inc b/meta-app-framework/recipes-core/systemd/systemd_appfw.inc deleted file mode 100644 index 8aa72c570..000000000 --- a/meta-app-framework/recipes-core/systemd/systemd_appfw.inc +++ /dev/null @@ -1,40 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/systemd:" - -# Ensures systemd runs with label "System" -EXTRA_OEMESON:append:with-lsm-smack = " -Dsmack-run-label=System" - -################################################################################## -# Maintaining trivial, non-upstreamable configuration changes as patches -# is tedious. But in same cases (like early mounting of special directories) -# the configuration has to be in code. We make these changes here directly. -################################################################################## -do_patch[prefuncs] += "patch_systemd" -do_patch[vardeps] += "patch_systemd" -patch_systemd() { - # Handling of /run and /sys/fs/cgroup. Make /run a transmuting directory to - # enable systemd communications with services in the User domain. - # Original patch by Michael Demeter <michael.demeter@intel.com>. - # - # We simplify the patching by touching only lines which check the result of - # mac_smack_use(). Those are the ones which are used when Smack is active. - # - # smackfsroot=* on /sys/fs/cgroup may be upstreamable, but smackfstransmute=System::Run - # is too distro specific (depends on Smack rules) and thus has to remain here. - sed -i -e 's;\("/sys/fs/cgroup", *"[^"]*", *"[^"]*\)\(.*mac_smack_use.*\);\1,smackfsroot=*\2;' \ - -e 's;\("/run", *"[^"]*", *"[^"]*\)\(.*mac_smack_use.*\);\1,smackfstransmute=System::Run\2;' \ - ${S}/src/core/mount-setup.c -} - -################################################################################## -# What follows is temporary. -# This is a solution to the Bug-AGL SPEC-539 -# (see https://jira.automotivelinux.org/browse/SPEC-539). -# -# It renames the file "touchscreen.rules" to "55-touchscreen.rules" -# This comes with the recipe systemd_230/234 of poky (meta/recipes-core/systemd) -# It should be removed when poky changes. -################################################################################## -do_install:prepend() { - mv ${WORKDIR}/touchscreen.rules ${WORKDIR}/55-touchscreen.rules || true -} - diff --git a/meta-app-framework/recipes-core/util-linux/util-linux_%.bbappend b/meta-app-framework/recipes-core/util-linux/util-linux_%.bbappend deleted file mode 100644 index 3894f57cc..000000000 --- a/meta-app-framework/recipes-core/util-linux/util-linux_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'util-linux_appfw.inc', '', d)} diff --git a/meta-app-framework/recipes-core/util-linux/util-linux_appfw.inc b/meta-app-framework/recipes-core/util-linux/util-linux_appfw.inc deleted file mode 100644 index 7399aa44d..000000000 --- a/meta-app-framework/recipes-core/util-linux/util-linux_appfw.inc +++ /dev/null @@ -1,8 +0,0 @@ -# Enabling Smack support in util-linux enables special support -# in [lib]mount for Smack mount options: they get removed if -# Smack is not active in the current kernel. Important for -# booting with "security=none" when userspace otherwise is -# compiled to use Smack. - -PACKAGECONFIG:append:with-lsm-smack:class-target = " smack" -PACKAGECONFIG[smack] = "--with-smack, --without-smack" diff --git a/meta-app-framework/recipes-devtools/cmake-apps-module/cmake-apps-module_git.bb b/meta-app-framework/recipes-devtools/cmake-apps-module/cmake-apps-module_git.bb deleted file mode 100644 index 4164171ff..000000000 --- a/meta-app-framework/recipes-devtools/cmake-apps-module/cmake-apps-module_git.bb +++ /dev/null @@ -1,20 +0,0 @@ -SUMMARY = "CMake module to ease development of apps" -DESCRIPTION = "This is a migration of former app-templates git submodule which let you \ -ease the development of apps and widget building." -HOMEPAGE = "https://gerrit.automotivelinux.org/gerrit/#/admin/projects/src/cmake-apps-module" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" -SECTION = "apps" - -SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/cmake-apps-module;protocol=https;branch=${AGL_BRANCH}" -SRCREV = "7c03348d9c2de43684fa69c3c9e227b25daceaaa" - -PV = "${AGLVERSION}" -S = "${WORKDIR}/git" - -inherit cmake - -FILES:${PN} += " ${datadir}/*/Modules/CMakeAfbTemplates*" - -BBCLASSEXTEND = "native nativesdk" - diff --git a/meta-app-framework/recipes-devtools/json-c/json-c_%.bbappend b/meta-app-framework/recipes-devtools/json-c/json-c_%.bbappend deleted file mode 100644 index 051f66aaf..000000000 --- a/meta-app-framework/recipes-devtools/json-c/json-c_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'json-c_appfw.inc', '', d)} diff --git a/meta-app-framework/recipes-devtools/json-c/json-c_appfw.inc b/meta-app-framework/recipes-devtools/json-c/json-c_appfw.inc deleted file mode 100644 index c15548c55..000000000 --- a/meta-app-framework/recipes-devtools/json-c/json-c_appfw.inc +++ /dev/null @@ -1 +0,0 @@ -EXTRA_OECONF:append = " --enable-threading" diff --git a/meta-app-framework/recipes-devtools/libafb-helpers/libafb-helpers_git.bb b/meta-app-framework/recipes-devtools/libafb-helpers/libafb-helpers_git.bb deleted file mode 100644 index 9ca32fdda..000000000 --- a/meta-app-framework/recipes-devtools/libafb-helpers/libafb-helpers_git.bb +++ /dev/null @@ -1,8 +0,0 @@ -require libafb-helpers_git.inc - -inherit cmake - -RDEPENDS:${PN}:append = " af-binder" - -ALLOW_EMPTY:${PN} = "1" - diff --git a/meta-app-framework/recipes-devtools/libafb-helpers/libafb-helpers_git.inc b/meta-app-framework/recipes-devtools/libafb-helpers/libafb-helpers_git.inc deleted file mode 100644 index 664f622a6..000000000 --- a/meta-app-framework/recipes-devtools/libafb-helpers/libafb-helpers_git.inc +++ /dev/null @@ -1,14 +0,0 @@ -SUMMARY = "AFB helpers library" -DESCRIPTION = "AFB helpers library to ease JSON object manipulation and binding interaction" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" - -SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/libafb-helpers;protocol=https;branch=${AGL_BRANCH}" -SRCREV = "16b77f6cea24332fffb75b6dcccb76f59565ed44" - -PV = "${AGLVERSION}" -S = "${WORKDIR}/git" - -DEPENDS:append = " af-binder jq" - diff --git a/meta-app-framework/recipes-devtools/libappcontroller/libappcontroller_git.bb b/meta-app-framework/recipes-devtools/libappcontroller/libappcontroller_git.bb deleted file mode 100644 index 74fe08144..000000000 --- a/meta-app-framework/recipes-devtools/libappcontroller/libappcontroller_git.bb +++ /dev/null @@ -1,19 +0,0 @@ -SUMMARY = "Controller library for an Application Framework" -DESCRIPTION = "Controller library to be used to easily create a binding for AGL App Framework" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" - -SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/libappcontroller;protocol=https;branch=${AGL_BRANCH}" -SRCREV = "1bef31c8bbad27f4914484c5007b2e199fb073d4" - -PV = "${AGLVERSION}" -S = "${WORKDIR}/git" - -DEPENDS:append = " af-binder libafb-helpers lua" -RDEPENDS:${PN}:append = " af-binder lua" - -inherit cmake - -ALLOW_EMPTY:${PN} = "1" - diff --git a/meta-app-framework/recipes-devtools/packagegroups/nativesdk-packagegroup-sdk-host.bbappend b/meta-app-framework/recipes-devtools/packagegroups/nativesdk-packagegroup-sdk-host.bbappend deleted file mode 100644 index 837b85392..000000000 --- a/meta-app-framework/recipes-devtools/packagegroups/nativesdk-packagegroup-sdk-host.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'nativesdk-packagegroup-sdk-host_appfw.inc', '', d)} diff --git a/meta-app-framework/recipes-devtools/packagegroups/nativesdk-packagegroup-sdk-host_appfw.inc b/meta-app-framework/recipes-devtools/packagegroups/nativesdk-packagegroup-sdk-host_appfw.inc deleted file mode 100644 index 27ee7cf52..000000000 --- a/meta-app-framework/recipes-devtools/packagegroups/nativesdk-packagegroup-sdk-host_appfw.inc +++ /dev/null @@ -1,5 +0,0 @@ -RDEPENDS:${PN}:append = " \ - nativesdk-af-main-tools \ - nativesdk-af-binder-devtools \ - nativesdk-cmake-apps-module \ -" diff --git a/meta-app-framework/recipes-devtools/run-postinsts/run-postinsts/ldconfig-wait.conf b/meta-app-framework/recipes-devtools/run-postinsts/run-postinsts/ldconfig-wait.conf deleted file mode 100644 index d706cc5f7..000000000 --- a/meta-app-framework/recipes-devtools/run-postinsts/run-postinsts/ldconfig-wait.conf +++ /dev/null @@ -1,2 +0,0 @@ -[Unit] -After=ldconfig.service diff --git a/meta-app-framework/recipes-devtools/run-postinsts/run-postinsts_%.bbappend b/meta-app-framework/recipes-devtools/run-postinsts/run-postinsts_%.bbappend deleted file mode 100644 index 6b9025dc5..000000000 --- a/meta-app-framework/recipes-devtools/run-postinsts/run-postinsts_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'run-postinsts_appfw.inc', '', d)} diff --git a/meta-app-framework/recipes-devtools/run-postinsts/run-postinsts_appfw.inc b/meta-app-framework/recipes-devtools/run-postinsts/run-postinsts_appfw.inc deleted file mode 100644 index 07b958aea..000000000 --- a/meta-app-framework/recipes-devtools/run-postinsts/run-postinsts_appfw.inc +++ /dev/null @@ -1,14 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/run-postinsts:" - -SRC_URI:append = " file://ldconfig-wait.conf" - -do_configure:append() { - if ! grep -q StandardOutput= ${WORKDIR}/run-postinsts.service; then - sed -i '/ExecStart=/iStandardOutput=journal+console' ${WORKDIR}/run-postinsts.service - fi -} - -do_install:append() { - install -d ${D}${sysconfdir}/systemd/system/run-postinsts.service.d - install -m 0644 ${WORKDIR}/ldconfig-wait.conf ${D}${sysconfdir}/systemd/system/run-postinsts.service.d -} diff --git a/meta-app-framework/recipes-graphics/wayland/wayland/0001-Change-socket-mode-add-rw-for-group.patch b/meta-app-framework/recipes-graphics/wayland/wayland/0001-Change-socket-mode-add-rw-for-group.patch deleted file mode 100644 index d0dcb45af..000000000 --- a/meta-app-framework/recipes-graphics/wayland/wayland/0001-Change-socket-mode-add-rw-for-group.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 9162f7d4cfeec7103474e8703218b3679ca9ed10 Mon Sep 17 00:00:00 2001 -From: Ronan Le Martret <ronan.lemartret@iot.bzh> -Date: Tue, 18 Apr 2017 13:53:26 +0200 -Subject: [PATCH] Change socket mode:add rw for group - -Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh> -[Updated for 1.18.0 to remove fuzz] -Signed-off-by: Scott Murray <scott.murray@konsulko.com> - ---- - src/wayland-server.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/src/wayland-server.c b/src/wayland-server.c -index 3f48dfe..fbccb45 100644 ---- a/src/wayland-server.c -+++ b/src/wayland-server.c -@@ -1528,7 +1528,10 @@ _wl_display_add_socket(struct wl_display *display, struct wl_socket *s) - wl_log("bind() failed with error: %s\n", strerror(errno)); - return -1; - } -- -+ if (chmod(s->addr.sun_path, 0660) < 0) { -+ wl_log("chmod() failed with error: %m\n"); -+ return -1; -+ } - if (listen(s->fd, 128) < 0) { - wl_log("listen() failed with error: %s\n", strerror(errno)); - return -1; diff --git a/meta-app-framework/recipes-graphics/wayland/wayland_%.bbappend b/meta-app-framework/recipes-graphics/wayland/wayland_%.bbappend deleted file mode 100644 index 50cad0354..000000000 --- a/meta-app-framework/recipes-graphics/wayland/wayland_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'wayland_appfw.inc', '', d)} diff --git a/meta-app-framework/recipes-graphics/wayland/wayland_appfw.inc b/meta-app-framework/recipes-graphics/wayland/wayland_appfw.inc deleted file mode 100644 index a1d55a17d..000000000 --- a/meta-app-framework/recipes-graphics/wayland/wayland_appfw.inc +++ /dev/null @@ -1,5 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/wayland:" - -SRC_URI:append = "\ - file://0001-Change-socket-mode-add-rw-for-group.patch \ - " diff --git a/meta-app-framework/recipes-graphics/wayland/weston/0001-Allow-regular-users-to-launch-Weston_7.0.0.patch b/meta-app-framework/recipes-graphics/wayland/weston/0001-Allow-regular-users-to-launch-Weston_7.0.0.patch deleted file mode 100644 index 362f6b064..000000000 --- a/meta-app-framework/recipes-graphics/wayland/weston/0001-Allow-regular-users-to-launch-Weston_7.0.0.patch +++ /dev/null @@ -1,51 +0,0 @@ -Allow regular users to launch Weston - -Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh> -[Reworked for Weston 7.0.0 switch to meson] -Signed-off-by: Scott Murray <scott.murray@konsulko.com> - -diff --git a/libweston/launcher-direct.c b/libweston/launcher-direct.c -index 9fa329b6..8e218804 100644 ---- a/libweston/launcher-direct.c -+++ b/libweston/launcher-direct.c -@@ -291,8 +291,10 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor * - { - struct launcher_direct *launcher; - -+#ifndef ENABLE_USER_START - if (geteuid() != 0) - return -EINVAL; -+#endif - - launcher = zalloc(sizeof(*launcher)); - if (launcher == NULL) -diff --git a/libweston/meson.build b/libweston/meson.build -index d8d3fc07..0d39ebf1 100644 ---- a/libweston/meson.build -+++ b/libweston/meson.build -@@ -216,6 +216,10 @@ if get_option('weston-launch') - meson.add_install_script('echo', 'REMINDER: You are installing weston-launch, please make it setuid-root.') - endif - -+if get_option('enable-user-start') -+ config_h.set('ENABLE_USER_START', '1') -+endif -+ - subdir('renderer-gl') - subdir('backend-drm') - subdir('backend-fbdev') -diff --git a/meson_options.txt b/meson_options.txt -index d5bf1d54..c93f31d1 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -217,3 +217,10 @@ option( - value: false, - description: 'Generate documentation' - ) -+ -+option( -+ 'enable-user-start', -+ type: 'boolean', -+ value: true, -+ description: 'Tests: enable start as non-root user' -+) diff --git a/meta-app-framework/recipes-graphics/wayland/weston/smack-weston b/meta-app-framework/recipes-graphics/wayland/weston/smack-weston deleted file mode 100644 index 63a32405a..000000000 --- a/meta-app-framework/recipes-graphics/wayland/weston/smack-weston +++ /dev/null @@ -1,8 +0,0 @@ -System System::Weston rwxa-- -System::Weston System rwx--- -System::Weston System::Shared rwx--- -System::Weston System::Run rwxat- -System::Weston System::Log rwxa-- -System::Weston _ r-x--l -System::Weston User::Home r-x--l -System::Weston User::App-Shared rwxat- diff --git a/meta-app-framework/recipes-graphics/wayland/weston_8.0.%.bbappend b/meta-app-framework/recipes-graphics/wayland/weston_8.0.%.bbappend deleted file mode 100644 index 00bb510bf..000000000 --- a/meta-app-framework/recipes-graphics/wayland/weston_8.0.%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'weston_8.0_appfw.inc', '', d)} diff --git a/meta-app-framework/recipes-graphics/wayland/weston_8.0_appfw.inc b/meta-app-framework/recipes-graphics/wayland/weston_8.0_appfw.inc deleted file mode 100644 index a72f22430..000000000 --- a/meta-app-framework/recipes-graphics/wayland/weston_8.0_appfw.inc +++ /dev/null @@ -1,19 +0,0 @@ -FILESEXTRAPATHS:append := ":${THISDIR}/weston" - -SRC_URI:append = "\ - file://0001-Allow-regular-users-to-launch-Weston_7.0.0.patch \ - file://smack-weston \ - " - -EXTRA_OEMESON:append = " -Denable-user-start=true" - -do_install:append() { - if ${@bb.utils.contains('DISTRO_FEATURES', 'smack', 'true', 'false', d)}; then - # Install SMACK rules - install -D -m 0644 ${WORKDIR}/smack-weston ${D}${sysconfdir}/smack/accesses.d/weston - fi -} - -FILES:${PN}:append = "\ - ${sysconfdir}/smack/accesses.d/* \ -" diff --git a/meta-app-framework/recipes-kernel/linux/linux-%.bbappend b/meta-app-framework/recipes-kernel/linux/linux-%.bbappend deleted file mode 100644 index 807da11f1..000000000 --- a/meta-app-framework/recipes-kernel/linux/linux-%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'linux-appfw.inc', '', d) if bb.data.inherits_class('kernel', d) else ''} diff --git a/meta-app-framework/recipes-kernel/linux/linux-appfw.inc b/meta-app-framework/recipes-kernel/linux/linux-appfw.inc deleted file mode 100644 index 68fb35882..000000000 --- a/meta-app-framework/recipes-kernel/linux/linux-appfw.inc +++ /dev/null @@ -1,23 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/linux:" - -# Enable SMACK support without making it the default explicitly. -AGL_KCONFIG_FRAGMENTS += "smack.cfg" - -# Enable SMACK as default LSM, can be overridden by changing this -# variable to e.g. "". -# -# NOTE: -# We use a different fragment for kernels older than 5.x that predate -# the switch to using CONFIG_LSM instead of CONFIG_DEFAULT_SECURITY. -# For simplicity, logic to handle the change being made in 5.1 instead -# of 5.0 has been omitted; in practice this should not be a problem -# since no current BSPs have been seen that use 5.0.x. If a BSP -# kernel recipe does not set LINUX_VERSION, the kernel being 5.x or -# newer is assumed as the default behavior. -LINUX_VERSION_MAJOR = "${@(d.getVar('LINUX_VERSION') or "5.x").split('.')[0]}" -SMACK_DEFAULT_SUFFIX = "${@'' if int(d.getVar('LINUX_VERSION_MAJOR') or 0) >= 5 else '-old'}" -SMACK_DEFAULT_SECURITY ??= "smack-default-lsm${SMACK_DEFAULT_SUFFIX}.cfg" -AGL_KCONFIG_FRAGMENTS += "${SMACK_DEFAULT_SECURITY}" - -# Enable audit support -AGL_KCONFIG_FRAGMENTS += "audit.cfg" diff --git a/meta-app-framework/recipes-kernel/linux/linux/audit.cfg b/meta-app-framework/recipes-kernel/linux/linux/audit.cfg deleted file mode 100644 index 214dbe33f..000000000 --- a/meta-app-framework/recipes-kernel/linux/linux/audit.cfg +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_AUDIT=y -CONFIG_AUDITSYSCALL=y diff --git a/meta-app-framework/recipes-kernel/linux/linux/smack-default-lsm-old.cfg b/meta-app-framework/recipes-kernel/linux/linux/smack-default-lsm-old.cfg deleted file mode 100644 index b5c48454e..000000000 --- a/meta-app-framework/recipes-kernel/linux/linux/smack-default-lsm-old.cfg +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_DEFAULT_SECURITY="smack" -CONFIG_DEFAULT_SECURITY_SMACK=y diff --git a/meta-app-framework/recipes-kernel/linux/linux/smack-default-lsm.cfg b/meta-app-framework/recipes-kernel/linux/linux/smack-default-lsm.cfg deleted file mode 100644 index 4791ebab3..000000000 --- a/meta-app-framework/recipes-kernel/linux/linux/smack-default-lsm.cfg +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_DEFAULT_SECURITY_SMACK=y -CONFIG_LSM="lockdown,yama,loadpin,safesetid,integrity,smack,selinux,tomoyo,apparmor" diff --git a/meta-app-framework/recipes-kernel/linux/linux/smack.cfg b/meta-app-framework/recipes-kernel/linux/linux/smack.cfg deleted file mode 100644 index 45a92f148..000000000 --- a/meta-app-framework/recipes-kernel/linux/linux/smack.cfg +++ /dev/null @@ -1,9 +0,0 @@ -CONFIG_IP_NF_SECURITY=m -CONFIG_IP6_NF_SECURITY=m -CONFIG_EXT2_FS_SECURITY=y -CONFIG_EXT3_FS_SECURITY=y -CONFIG_EXT4_FS_SECURITY=y -CONFIG_SECURITY=y -CONFIG_SECURITY_SMACK=y -CONFIG_SECURITY_SMACK_APPEND_SIGNALS=y -CONFIG_TMPFS_XATTR=y diff --git a/meta-app-framework/recipes-platform/packagegroups/packagegroup-agl-app-framework-examples.bb b/meta-app-framework/recipes-platform/packagegroups/packagegroup-agl-app-framework-examples.bb deleted file mode 100644 index 1c904211b..000000000 --- a/meta-app-framework/recipes-platform/packagegroups/packagegroup-agl-app-framework-examples.bb +++ /dev/null @@ -1,14 +0,0 @@ -SUMMARY = "AGL Application Framework examples" -DESCRIPTION = "The set of examples associated to the AGL Application Framework" -LICENSE = "MIT" - -inherit packagegroup - -PACKAGES = "\ - packagegroup-agl-app-framework-examples \ - " - -ALLOW_EMPTY:${PN} = "1" - -RDEPENDS:${PN} += "\ - " diff --git a/meta-app-framework/recipes-platform/packagegroups/packagegroup-agl-app-framework.bb b/meta-app-framework/recipes-platform/packagegroups/packagegroup-agl-app-framework.bb deleted file mode 100644 index 866f2e0e3..000000000 --- a/meta-app-framework/recipes-platform/packagegroups/packagegroup-agl-app-framework.bb +++ /dev/null @@ -1,19 +0,0 @@ -SUMMARY = "AGL Application Framework core packages" -DESCRIPTION = "The set of packages required by the AGL Application Framework" -LICENSE = "MIT" - -inherit packagegroup - -PACKAGES_${PN} = "\ - packagegroup-agl-app-framework \ - " - -ALLOW_EMPTY:${PN} = "1" - -RDEPENDS:${PN} = "\ - af-binder \ - libafbwsc \ - af-main \ - nss-localuser \ - af-platform-setup \ - " diff --git a/meta-app-framework/recipes-platform/packagegroups/packagegroup-agl-appfw-native.bb b/meta-app-framework/recipes-platform/packagegroups/packagegroup-agl-appfw-native.bb deleted file mode 100644 index bdd967ae8..000000000 --- a/meta-app-framework/recipes-platform/packagegroups/packagegroup-agl-appfw-native.bb +++ /dev/null @@ -1,16 +0,0 @@ -SUMMARY = "The software for application framework of AGL IVI profile" -DESCRIPTION = "A set of packages belong to AGL application framework which required by \ -Native App Fw Subsystem" - -LICENSE = "MIT" - -inherit packagegroup - -PACKAGES = "\ - packagegroup-agl-appfw-native \ - " - -ALLOW_EMPTY:${PN} = "1" - -RDEPENDS:${PN} += "\ - " diff --git a/meta-app-framework/recipes-platform/packagegroups/packagegroup-security-framework.bb b/meta-app-framework/recipes-platform/packagegroups/packagegroup-security-framework.bb deleted file mode 100644 index 449ce6432..000000000 --- a/meta-app-framework/recipes-platform/packagegroups/packagegroup-security-framework.bb +++ /dev/null @@ -1,22 +0,0 @@ -SUMMARY = "Security middleware components" -LICENSE = "MIT" - -inherit packagegroup - -# Install Cynara and security-manager by default if (and only if) -# Smack is enabled. -# -# Cynara does not have a hard dependency on Smack security, -# but is meant to be used with it. security-manager however -# links against smack and expects Smack to be active, -# so we do not have any choice. -# -# Without configuration, security-manager is not usable. We use -# the policy packaged from the upstream source code here. Adapting -# it for the distro can be done by patching that source. -RDEPENDS:${PN}:append:with-lsm-smack = " \ - cynagora \ - security-manager \ - security-manager-policy \ - smack-system-setup \ -" diff --git a/meta-app-framework/recipes-security/audit/audit/0001-lib-i386_table.h-add-new-syscall.patch b/meta-app-framework/recipes-security/audit/audit/0001-lib-i386_table.h-add-new-syscall.patch deleted file mode 100644 index 6e1827c08..000000000 --- a/meta-app-framework/recipes-security/audit/audit/0001-lib-i386_table.h-add-new-syscall.patch +++ /dev/null @@ -1,42 +0,0 @@ -From df878b92e01f4d1c3de7f7d8229cea6a431509eb Mon Sep 17 00:00:00 2001 -From: Mingli Yu <mingli.yu@windriver.com> -Date: Wed, 19 Feb 2020 15:23:40 +0800 -Subject: [PATCH] lib/i386_table.h: add new syscall - -On 32bit system, -After upgrade glibc to 2.31 - # strace -o /tmp/test.log date -s 09:16:45 - # tail -f /tmp/test.log - close(3) = 0 - stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=114, ...}) = 0 - clock_settime64(CLOCK_REALTIME, {tv_sec=1582103805, tv_nsec=0}) = 0 - fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(0x4, 0x40), ...}) = 0 - ioctl(1, TCGETS, {B115200 opost isig icanon echo ...}) = 0 - write(1, "Wed Feb 19 09:16:45 UTC 2020\n", 29) = 29 - close(1) = 0 - close(2) = 0 - exit_group(0) = ? - +++ exited with 0 +++ - -It means the clock_settime64 syscall is used, so -add the syscall. - -Upstream-Status: Submitted [https://github.com/linux-audit/audit-userspace/pull/116] - -Signed-off-by: Mingli Yu <mingli.yu@windriver.com> ---- - lib/i386_table.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/lib/i386_table.h b/lib/i386_table.h -index 1a64c88..65fd4d9 100644 ---- a/lib/i386_table.h -+++ b/lib/i386_table.h -@@ -405,3 +405,4 @@ _S(383, "statx") - _S(384, "arch_prctl") - _S(385, "io_pgetevents") - _S(386, "rseq") -+_S(404, "clock_settime64") --- -2.7.4 - diff --git a/meta-app-framework/recipes-security/audit/audit/Add-substitue-functions-for-strndupa-rawmemchr.patch b/meta-app-framework/recipes-security/audit/audit/Add-substitue-functions-for-strndupa-rawmemchr.patch deleted file mode 100644 index bb6c61e80..000000000 --- a/meta-app-framework/recipes-security/audit/audit/Add-substitue-functions-for-strndupa-rawmemchr.patch +++ /dev/null @@ -1,133 +0,0 @@ -From bdcdc3dff4469aac88e718bd15958d5ed4b9392a Mon Sep 17 00:00:00 2001 -From: Steve Grubb <sgrubb@redhat.com> -Date: Tue, 26 Feb 2019 18:33:33 -0500 -Subject: [PATCH] Add substitue functions for strndupa & rawmemchr - -Upstream-Status: Backport -[https://github.com/linux-audit/audit-userspace/commit/d579a08bb1cde71f939c13ac6b2261052ae9f77e] ---- - auparse/auparse.c | 12 +++++++++++- - auparse/interpret.c | 9 ++++++++- - configure.ac | 14 +++++++++++++- - src/ausearch-lol.c | 12 +++++++++++- - 4 files changed, 43 insertions(+), 4 deletions(-) - -diff --git a/auparse/auparse.c b/auparse/auparse.c -index 650db02..2e1c737 100644 ---- a/auparse/auparse.c -+++ b/auparse/auparse.c -@@ -1,5 +1,5 @@ - /* auparse.c -- -- * Copyright 2006-08,2012-17 Red Hat Inc., Durham, North Carolina. -+ * Copyright 2006-08,2012-19 Red Hat Inc., Durham, North Carolina. - * All Rights Reserved. - * - * This library is free software; you can redistribute it and/or -@@ -1118,6 +1118,16 @@ static int str2event(char *s, au_event_t *e) - return 0; - } - -+#ifndef HAVE_STRNDUPA -+static inline char *strndupa(const char *old, size_t n) -+{ -+ size_t len = strnlen(old, n); -+ char *tmp = alloca(len + 1); -+ tmp[len] = 0; -+ return memcpy(tmp, old, len); -+} -+#endif -+ - /* Returns 0 on success and 1 on error */ - static int extract_timestamp(const char *b, au_event_t *e) - { -diff --git a/auparse/interpret.c b/auparse/interpret.c -index 51c4a5e..67b7b77 100644 ---- a/auparse/interpret.c -+++ b/auparse/interpret.c -@@ -853,6 +853,13 @@ err_out: - return print_escaped(id->val); - } - -+// rawmemchr is faster. Let's use it if we have it. -+#ifdef HAVE_RAWMEMCHR -+#define STRCHR rawmemchr -+#else -+#define STRCHR strchr -+#endif -+ - static const char *print_proctitle(const char *val) - { - char *out = (char *)print_escaped(val); -@@ -863,7 +870,7 @@ static const char *print_proctitle(const char *val) - // Proctitle has arguments separated by NUL bytes - // We need to write over the NUL bytes with a space - // so that we can see the arguments -- while ((ptr = rawmemchr(ptr, '\0'))) { -+ while ((ptr = STRCHR(ptr, '\0'))) { - if (ptr >= end) - break; - *ptr = ' '; -diff --git a/configure.ac b/configure.ac -index 54bdbf1..aef07fb 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1,7 +1,7 @@ - dnl - define([AC_INIT_NOTICE], - [### Generated automatically using autoconf version] AC_ACVERSION [ --### Copyright 2005-18 Steve Grubb <sgrubb@redhat.com> -+### Copyright 2005-19 Steve Grubb <sgrubb@redhat.com> - ### - ### Permission is hereby granted, free of charge, to any person obtaining a - ### copy of this software and associated documentation files (the "Software"), -@@ -72,6 +72,18 @@ dnl; posix_fallocate is used in audisp-remote - AC_CHECK_FUNCS([posix_fallocate]) - dnl; signalfd is needed for libev - AC_CHECK_FUNC([signalfd], [], [ AC_MSG_ERROR([The signalfd system call is necessary for auditd]) ]) -+dnl; check if rawmemchr is available -+AC_CHECK_FUNCS([rawmemchr]) -+dnl; check if strndupa is available -+AC_LINK_IFELSE( -+ [AC_LANG_SOURCE( -+ [[ -+ #define _GNU_SOURCE -+ #include <string.h> -+ int main() { (void) strndupa("test", 10); return 0; }]])], -+ [AC_DEFINE(HAVE_STRNDUPA, 1, [Let us know if we have it or not])], -+ [] -+) - - ALLWARNS="" - ALLDEBUG="-g" -diff --git a/src/ausearch-lol.c b/src/ausearch-lol.c -index 5d17a72..758c33e 100644 ---- a/src/ausearch-lol.c -+++ b/src/ausearch-lol.c -@@ -1,6 +1,6 @@ - /* - * ausearch-lol.c - linked list of linked lists library --* Copyright (c) 2008,2010,2014,2016 Red Hat Inc., Durham, North Carolina. -+* Copyright (c) 2008,2010,2014,2016,2019 Red Hat Inc., Durham, North Carolina. - * All Rights Reserved. - * - * This software may be freely redistributed and/or modified under the -@@ -152,6 +152,16 @@ static int compare_event_time(event *e1, event *e2) - return 0; - } - -+#ifndef HAVE_STRNDUPA -+static inline char *strndupa(const char *old, size_t n) -+{ -+ size_t len = strnlen(old, n); -+ char *tmp = alloca(len + 1); -+ tmp[len] = 0; -+ return memcpy(tmp, old, len); -+} -+#endif -+ - /* - * This function will look at the line and pick out pieces of it. - */ --- -2.7.4 - diff --git a/meta-app-framework/recipes-security/audit/audit/Fixed-swig-host-contamination-issue.patch b/meta-app-framework/recipes-security/audit/audit/Fixed-swig-host-contamination-issue.patch deleted file mode 100644 index 7c2699540..000000000 --- a/meta-app-framework/recipes-security/audit/audit/Fixed-swig-host-contamination-issue.patch +++ /dev/null @@ -1,57 +0,0 @@ -From a07271f1cce82122610b622bcea4a8a37528f321 Mon Sep 17 00:00:00 2001 -From: Li xin <lixin.fnst@cn.fujitsu.com> -Date: Sun, 19 Jul 2015 02:42:58 +0900 -Subject: [PATCH] audit: Fixed swig host contamination issue - -The audit build uses swig to generate a python wrapper. -Unfortunately, the swig info file references host include -directories. Some of these were previously noticed and -eliminated, but the one fixed here was not. - -Upstream-Status: Inappropriate [embedded specific] - -Signed-off-by: Anders Hedlund <anders.hedlund@windriver.com> -Signed-off-by: Joe Slater <jslater@windriver.com> -Signed-off-by: Yi Zhao <yi.zhao@windriver.com> ---- - bindings/swig/python3/Makefile.am | 3 ++- - bindings/swig/src/auditswig.i | 2 +- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/bindings/swig/python3/Makefile.am b/bindings/swig/python3/Makefile.am -index 9938418..fa46aac 100644 ---- a/bindings/swig/python3/Makefile.am -+++ b/bindings/swig/python3/Makefile.am -@@ -22,6 +22,7 @@ - CONFIG_CLEAN_FILES = *.loT *.rej *.orig - AM_CFLAGS = -fPIC -DPIC -fno-strict-aliasing $(PYTHON3_CFLAGS) - AM_CPPFLAGS = -I. -I$(top_builddir) -I${top_srcdir}/lib $(PYTHON3_INCLUDES) -+STDINC ?= /usr/include - LIBS = $(top_builddir)/lib/libaudit.la - SWIG_FLAGS = -python -py3 -modern - SWIG_INCLUDES = -I. -I$(top_builddir) -I${top_srcdir}/lib $(PYTHON3_INCLUDES) -@@ -37,7 +38,7 @@ _audit_la_DEPENDENCIES =${top_srcdir}/lib/libaudit.h ${top_builddir}/lib/libaudi - _audit_la_LIBADD = ${top_builddir}/lib/libaudit.la - nodist__audit_la_SOURCES = audit_wrap.c - audit.py audit_wrap.c: ${srcdir}/../src/auditswig.i -- swig -o audit_wrap.c ${SWIG_FLAGS} ${SWIG_INCLUDES} ${srcdir}/../src/auditswig.i -+ swig -o audit_wrap.c ${SWIG_FLAGS} ${SWIG_INCLUDES} -I$(STDINC) ${srcdir}/../src/auditswig.i - - CLEANFILES = audit.py* audit_wrap.c *~ - -diff --git a/bindings/swig/src/auditswig.i b/bindings/swig/src/auditswig.i -index 7ebb373..424fb68 100644 ---- a/bindings/swig/src/auditswig.i -+++ b/bindings/swig/src/auditswig.i -@@ -39,7 +39,7 @@ signed - #define __attribute(X) /*nothing*/ - typedef unsigned __u32; - typedef unsigned uid_t; --%include "/usr/include/linux/audit.h" -+%include "linux/audit.h" - #define __extension__ /*nothing*/ - #include <stdint.h> - %include "../lib/libaudit.h" --- -2.7.4 - diff --git a/meta-app-framework/recipes-security/audit/audit/audit-volatile.conf b/meta-app-framework/recipes-security/audit/audit/audit-volatile.conf deleted file mode 100644 index 9cbe1547a..000000000 --- a/meta-app-framework/recipes-security/audit/audit/audit-volatile.conf +++ /dev/null @@ -1 +0,0 @@ -d /var/log/audit 0750 root root - diff --git a/meta-app-framework/recipes-security/audit/audit/auditd b/meta-app-framework/recipes-security/audit/audit/auditd deleted file mode 100755 index cda2e43d4..000000000 --- a/meta-app-framework/recipes-security/audit/audit/auditd +++ /dev/null @@ -1,153 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: auditd -# Required-Start: $local_fs -# Required-Stop: $local_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Audit Daemon -# Description: Collects audit information from Linux 2.6 Kernels. -### END INIT INFO - -# Author: Philipp Matthias Hahn <pmhahn@debian.org> -# Based on Debians /etc/init.d/skeleton and Auditds init.d/auditd.init - -# June, 2012: Adopted for yocto <amy.fong@windriver.com> - -# PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/sbin:/bin:/usr/sbin:/usr/bin -DESC="audit daemon" -NAME=auditd -DAEMON=/sbin/auditd -PIDFILE=/var/run/"$NAME".pid -SCRIPTNAME=/etc/init.d/"$NAME" - -# Exit if the package is not installed -[ -x "$DAEMON" ] || exit 0 - -# Read configuration variable file if it is present -[ -r /etc/default/"$NAME" ] && . /etc/default/"$NAME" - -. /etc/default/rcS - -. /etc/init.d/functions - -# -# Function that starts the daemon/service -# -do_start() -{ - # Return - # 0 if daemon has been started - # 1 if daemon was already running - # 2 if daemon could not be started - start-stop-daemon -S --quiet --pidfile "$PIDFILE" --exec "$DAEMON" --test > /dev/null \ - || return 1 - start-stop-daemon -S --quiet --pidfile "$PIDFILE" --exec "$DAEMON" -- \ - $EXTRAOPTIONS \ - || return 2 - if [ -f /etc/audit/audit.rules ] - then - /sbin/auditctl -R /etc/audit/audit.rules >/dev/null - fi -} - -# -# Function that stops the daemon/service -# -do_stop() -{ - # Return - # 0 if daemon has been stopped - # 1 if daemon was already stopped - # 2 if daemon could not be stopped - # other if a failure occurred - start-stop-daemon -K --quiet --pidfile "$PIDFILE" --name "$NAME" - RETVAL="$?" - [ "$RETVAL" = 2 ] && return 2 - # Many daemons don't delete their pidfiles when they exit. - rm -f "$PIDFILE" - rm -f /var/run/audit_events - # Remove watches so shutdown works cleanly - case "$AUDITD_CLEAN_STOP" in - no|NO) ;; - *) /sbin/auditctl -D >/dev/null ;; - esac - return "$RETVAL" -} - -# -# Function that sends a SIGHUP to the daemon/service -# -do_reload() { - start-stop-daemon -K --signal HUP --quiet --pidfile $PIDFILE --name $NAME - return 0 -} - -if [ ! -e /var/log/audit ]; then - mkdir -p /var/log/audit - [ -x /sbin/restorecon ] && /sbin/restorecon -F /var/log/audit -fi - -case "$1" in - start) - [ "$VERBOSE" != no ] && echo "Starting $DESC" "$NAME" - do_start - case "$?" in - 0|1) [ "$VERBOSE" != no ] && echo 0 ;; - 2) [ "$VERBOSE" != no ] && echo 1 ;; - esac - ;; - stop) - [ "$VERBOSE" != no ] && echo "Stopping $DESC" "$NAME" - do_stop - case "$?" in - 0|1) [ "$VERBOSE" != no ] && echo 0 ;; - 2) [ "$VERBOSE" != no ] && echo 1 ;; - esac - ;; - reload|force-reload) - echo "Reloading $DESC" "$NAME" - do_reload - echo $? - ;; - restart) - echo "Restarting $DESC" "$NAME" - do_stop - case "$?" in - 0|1) - do_start - case "$?" in - 0) echo 0 ;; - 1) echo 1 ;; # Old process is still running - *) echo 1 ;; # Failed to start - esac - ;; - *) - # Failed to stop - echo 1 - ;; - esac - ;; - rotate) - echo "Rotating $DESC logs" "$NAME" - start-stop-daemon -K --signal USR1 --quiet --pidfile "$PIDFILE" --name "$NAME" - echo $? - ;; - status) - pidofproc "$DAEMON" >/dev/null - status=$? - if [ $status -eq 0 ]; then - echo "$NAME is running." - else - echo "$NAME is not running." - fi - exit $status - ;; - *) - echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|rotate|status}" >&2 - exit 3 - ;; -esac - -: diff --git a/meta-app-framework/recipes-security/audit/audit/auditd.service b/meta-app-framework/recipes-security/audit/audit/auditd.service deleted file mode 100644 index ebc079897..000000000 --- a/meta-app-framework/recipes-security/audit/audit/auditd.service +++ /dev/null @@ -1,20 +0,0 @@ -[Unit] -Description=Security Auditing Service -DefaultDependencies=no -After=local-fs.target -Conflicts=shutdown.target -Before=sysinit.target shutdown.target -After=systemd-tmpfiles-setup.service - -[Service] -ExecStart=/sbin/auditd -n -## To use augenrules, copy this file to /etc/systemd/system/auditd.service -## and uncomment the next line and delete/comment out the auditctl line. -## Then copy existing rules to /etc/audit/rules.d/ -## Not doing this last step can cause loss of existing rules -#ExecStartPost=-/sbin/augenrules --load -ExecStartPost=-/sbin/auditctl -R /etc/audit/audit.rules -ExecReload=/bin/kill -HUP $MAINPID - -[Install] -WantedBy=multi-user.target diff --git a/meta-app-framework/recipes-security/audit/audit_2.8.5.bb b/meta-app-framework/recipes-security/audit/audit_2.8.5.bb deleted file mode 100644 index 19cc688fb..000000000 --- a/meta-app-framework/recipes-security/audit/audit_2.8.5.bb +++ /dev/null @@ -1,106 +0,0 @@ -SUMMARY = "User space tools for kernel auditing" -DESCRIPTION = "The audit package contains the user space utilities for \ -storing and searching the audit records generated by the audit subsystem \ -in the Linux kernel." -HOMEPAGE = "http://people.redhat.com/sgrubb/audit/" -SECTION = "base" -LICENSE = "GPLv2+ & LGPLv2+" -LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" - -SRC_URI = "git://github.com/linux-audit/${BPN}-userspace.git;branch=2.8_maintenance \ - file://Add-substitue-functions-for-strndupa-rawmemchr.patch \ - file://Fixed-swig-host-contamination-issue.patch \ - file://0001-lib-i386_table.h-add-new-syscall.patch \ - file://auditd \ - file://auditd.service \ - file://audit-volatile.conf \ -" - -S = "${WORKDIR}/git" -SRCREV = "5fae55c1ad15b3cefe6890eba7311af163e9133c" - -inherit autotools python3native update-rc.d systemd - -UPDATERCPN = "auditd" -INITSCRIPT_NAME = "auditd" -INITSCRIPT_PARAMS = "defaults" - -SYSTEMD_PACKAGES = "auditd" -SYSTEMD_SERVICE:auditd = "auditd.service" - -DEPENDS += "python3 tcp-wrappers libcap-ng linux-libc-headers swig-native" - -EXTRA_OECONF += "--without-prelude \ - --with-libwrap \ - --enable-gssapi-krb5=no \ - --with-libcap-ng=yes \ - --with-python3=yes \ - --libdir=${base_libdir} \ - --sbindir=${base_sbindir} \ - --without-python \ - --without-golang \ - --disable-zos-remote \ - " -EXTRA_OECONF:append:arm = " --with-arm=yes" -EXTRA_OECONF:append:aarch64 = " --with-aarch64=yes" - -EXTRA_OEMAKE += "PYLIBVER='python${PYTHON_BASEVERSION}' \ - PYINC='${STAGING_INCDIR}/$(PYLIBVER)' \ - pyexecdir=${libdir}/python${PYTHON_BASEVERSION}/site-packages \ - STDINC='${STAGING_INCDIR}' \ - pkgconfigdir=${libdir}/pkgconfig \ - " - -SUMMARY:audispd-plugins = "Plugins for the audit event dispatcher" -DESCRIPTION:audispd-plugins = "The audispd-plugins package provides plugins for the real-time \ -interface to the audit system, audispd. These plugins can do things \ -like relay events to remote machines or analyze events for suspicious \ -behavior." - -PACKAGES =+ "audispd-plugins" -PACKAGES += "auditd ${PN}-python" - -FILES:${PN} = "${sysconfdir}/libaudit.conf ${base_libdir}/libaudit.so.1* ${base_libdir}/libauparse.so.*" -FILES:auditd += "${bindir}/* ${base_sbindir}/* ${sysconfdir}/*" -FILES:audispd-plugins += "${sysconfdir}/audisp/audisp-remote.conf \ - ${sysconfdir}/audisp/plugins.d/au-remote.conf \ - ${sbindir}/audisp-remote ${localstatedir}/spool/audit \ - " -FILES:${PN}-dbg += "${libdir}/python${PYTHON_BASEVERSION}/*/.debug" -FILES:${PN}-python = "${libdir}/python${PYTHON_BASEVERSION}" - -CONFFILES:auditd += "${sysconfdir}/audit/audit.rules" -RDEPENDS:auditd += "bash" - -do_install:append() { - rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.a - rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.la - - # reuse auditd config - [ ! -e ${D}/etc/default ] && mkdir ${D}/etc/default - mv ${D}/etc/sysconfig/auditd ${D}/etc/default - rmdir ${D}/etc/sysconfig/ - - # replace init.d - install -D -m 0755 ${WORKDIR}/auditd ${D}/etc/init.d/auditd - rm -rf ${D}/etc/rc.d - - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - install -d ${D}${sysconfdir}/tmpfiles.d/ - install -m 0644 ${WORKDIR}/audit-volatile.conf ${D}${sysconfdir}/tmpfiles.d/ - fi - - # install systemd unit files - install -d ${D}${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/auditd.service ${D}${systemd_unitdir}/system - - # audit-2.5 doesn't install any rules by default, so we do that here - mkdir -p ${D}/etc/audit ${D}/etc/audit/rules.d - cp ${S}/rules/10-base-config.rules ${D}/etc/audit/rules.d/audit.rules - - chmod 750 ${D}/etc/audit ${D}/etc/audit/rules.d - chmod 640 ${D}/etc/audit/auditd.conf ${D}/etc/audit/rules.d/audit.rules - - # Based on the audit.spec "Copy default rules into place on new installation" - cp ${D}/etc/audit/rules.d/audit.rules ${D}/etc/audit/audit.rules -} diff --git a/meta-app-framework/recipes-security/cynagoauth/cynagoauth_0.1.bb b/meta-app-framework/recipes-security/cynagoauth/cynagoauth_0.1.bb deleted file mode 100644 index d76181c98..000000000 --- a/meta-app-framework/recipes-security/cynagoauth/cynagoauth_0.1.bb +++ /dev/null @@ -1,23 +0,0 @@ -DESCRIPTION = "OAuth server using cynagora backend" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3b83ef96387f14655fc854ddc3c6bd57" - -SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/cynagoauth.git;protocol=https;branch=${AGL_BRANCH}" -SRCREV = "26a5dbddf3a9bfde481a6fcd2aae16c7ecba665f" -PV = "0.1+git${SRCPV}" - -S = "${WORKDIR}/git" - -DEPENDS = "json-c libmicrohttpd openssl cynagora" - -inherit cmake - -EXTRA_OECMAKE += " \ - -DDEFAULTHOSTS=:7777 \ - -DDEFAULTURL=http://localhost:7777/tok \ - -DUNITDIR_SYSTEM=${systemd_system_unitdir} \ -" - -FILES:${PN} += "${systemd_system_unitdir}" - - diff --git a/meta-app-framework/recipes-security/cynagora/cynagora-cynara-compat_2.1.bb b/meta-app-framework/recipes-security/cynagora/cynagora-cynara-compat_2.1.bb deleted file mode 100644 index 55edbcebe..000000000 --- a/meta-app-framework/recipes-security/cynagora/cynagora-cynara-compat_2.1.bb +++ /dev/null @@ -1,30 +0,0 @@ -DESCRIPTION = "Cynara service with client libraries" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://Apache-2.0;md5=3b83ef96387f14655fc854ddc3c6bd57" - -SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/cynagora;protocol=https;branch=${AGL_BRANCH}" -SRCREV = "7d7907651c42c5c32deabc17b639e0e1765eae60" -PV = "2.1+git${SRCPV}" - -S = "${WORKDIR}/git" - -inherit cmake - -PROVIDES = "cynara" -RPROVIDES:${PN} = "cynara" -DEPENDS = "libcap" -RDEPENDS:${PN} = "cynagora" - -EXTRA_OECMAKE += " \ - -DWITH_SYSTEMD=OFF \ - -DWITH_CYNARA_COMPAT=ON \ - -DDIRECT_CYNARA_COMPAT=ON \ -" - -do_install:append() { - # remove cynagora stuff - rm $(find ${D} -name '*cynagora*') - # remove stupid test - rm -r ${D}${bindir} -} - diff --git a/meta-app-framework/recipes-security/cynagora/cynagora/run-ptest b/meta-app-framework/recipes-security/cynagora/cynagora/run-ptest deleted file mode 100755 index f95f0725b..000000000 --- a/meta-app-framework/recipes-security/cynagora/cynagora/run-ptest +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -# test access to cynagora server -cynagora-admin list > /dev/null diff --git a/meta-app-framework/recipes-security/cynagora/cynagora_2.1.bb b/meta-app-framework/recipes-security/cynagora/cynagora_2.1.bb deleted file mode 100644 index 2ed1b1541..000000000 --- a/meta-app-framework/recipes-security/cynagora/cynagora_2.1.bb +++ /dev/null @@ -1,38 +0,0 @@ -DESCRIPTION = "Cynagora service and client libraries" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://Apache-2.0;md5=3b83ef96387f14655fc854ddc3c6bd57" - -SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/cynagora;protocol=https;branch=${AGL_BRANCH}" -SRCREV = "7d7907651c42c5c32deabc17b639e0e1765eae60" -PV = "2.1+git${SRCPV}" - -S = "${WORKDIR}/git" - -DEPENDS = "systemd libcap" - -inherit cmake - -EXTRA_OECMAKE += " \ - -DSYSTEMD_UNIT_DIR=${systemd_system_unitdir} \ - -DWITH_SYSTEMD=ON \ - -DWITH_CYNARA_COMPAT=OFF \ -" - -inherit useradd -USERADD_PACKAGES = "${PN}" -GROUPADD_PARAM:${PN} = "-r cynagora" -USERADD_PARAM:${PN} = "\ ---system --home ${localstatedir}/lib/empty \ ---no-create-home --shell /bin/false \ ---gid cynagora cynagora \ -" - -FILES:${PN} += "${systemd_system_unitdir}" - -PACKAGES =+ "${PN}-tools" -FILES:${PN}-tools += "${bindir}/cynagora-admin ${bindir}/cynagora-agent" -RDEPENDS:${PN}:append:agl-devel = " ${PN}-tools" - -inherit ptest -SRC_URI:append = " file://run-ptest" -RDEPENDS:${PN}-ptest:append = " ${PN}-tools" diff --git a/meta-app-framework/recipes-security/security-manager/security-manager.inc b/meta-app-framework/recipes-security/security-manager/security-manager.inc deleted file mode 100644 index c6bc123d3..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager.inc +++ /dev/null @@ -1,83 +0,0 @@ -DESCRIPTION = "Security manager and utilities" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327;beginline=3" - -inherit cmake - -B = "${S}" - -DEPENDS = " \ - attr \ - boost \ - cynara \ - icu \ - libcap \ - smack \ - sqlite3 \ - systemd \ -" - -PACKAGECONFIG ??= "" -PACKAGECONFIG[debug] = "-DCMAKE_BUILD_TYPE=DEBUG,-DCMAKE_BUILD_TYPE=RELEASE" - -TZ_SYS_DB ?= "/var/db/security-manager" - -EXTRA_OECMAKE = " \ - -DCMAKE_VERBOSE_MAKEFILE=ON \ - -DVERSION=${PV} \ - -DSYSTEMD_INSTALL_DIR=${systemd_unitdir}/system \ - -DBIN_INSTALL_DIR=${bindir} \ - -DDB_INSTALL_DIR=${TZ_SYS_DB} \ - -DLIB_INSTALL_DIR=${libdir} \ - -DSHARE_INSTALL_PREFIX=${datadir} \ - -DINCLUDE_INSTALL_DIR=${includedir} \ -" - -inherit systemd -SYSTEMD_SERVICE:${PN} = "security-manager.service" - -inherit features_check -REQUIRED_DISTRO_FEATURES += "smack" - -# The upstream source code contains the Tizen-specific policy configuration files. -# To replace them, create a security-manager.bbappend and set the following variable to a -# space-separated list of policy file names (not URIs!), for example: -# SECURITY_MANAGER_POLICY = "privilege-group.list usertype-system.profile" -# -# Leave it empty to use the upstream Tizen policy. -SECURITY_MANAGER_POLICY ?= "" -SRC_URI:append = " ${@' '.join(['file://' + x for x in d.getVar('SECURITY_MANAGER_POLICY', True).split()])}" -python do_patch:append () { - import os - import shutil - import glob - files = d.getVar('SECURITY_MANAGER_POLICY', True).split() - if files: - s = d.getVar('S', True) - workdir = d.getVar('WORKDIR', True) - for pattern in ['*.profile', '*.list']: - for old_file in glob.glob(s + '/policy/' + pattern): - os.unlink(old_file) - for file in files: - shutil.copy(file, s + '/policy') -} - -do_install:append () { - install -d ${D}/${systemd_unitdir}/system/multi-user.target.wants - ln -s ../security-manager.service ${D}/${systemd_unitdir}/system/multi-user.target.wants/security-manager.service - install -d ${D}/${systemd_unitdir}/system/sockets.target.wants - ln -s ../security-manager.socket ${D}/${systemd_unitdir}/system/sockets.target.wants/security-manager.socket -} - -RDEPENDS:${PN} += "sqlite3 cynara" -FILES:${PN} += " \ - ${systemd_unitdir} \ - ${TZ_SYS_DB} \ - ${bindir}/.security-manager-setup \ -" - -PACKAGES =+ "${PN}-policy" -FILES:${PN}-policy = " \ - ${datadir}/${PN} \ - ${bindir}/security-manager-policy-reload \ -" diff --git a/meta-app-framework/recipes-security/security-manager/security-manager/0001-Adapt-rules-to-AGL.patch b/meta-app-framework/recipes-security/security-manager/security-manager/0001-Adapt-rules-to-AGL.patch deleted file mode 100644 index 4c91f7fa3..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager/0001-Adapt-rules-to-AGL.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 935e4e4e746b5ffcda80c80097dc75c2581c1a89 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh> -Date: Wed, 19 Oct 2016 13:45:54 +0200 -Subject: [PATCH] Adapt rules to AGL -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -AGL distribution uses the repository https://github.com/01org/meta-intel-iot-security.git -as basis for the integration of security framework. The security framework -that it provides is an evolution of the security framework of tizen refited -to the distribution Ostro of Intel. This refit took the decision to simplify -the model by removing the running label "User". More can be viewed here: -https://github.com/01org/meta-intel-iot-security/pull/116 - -This commits adapt the template to the rules that are now needed -after this evolution. - -It also integrates one other evolutions: the shared label becomes User::App-Shared instead -of User::App::Shared to avoid collision with application of id "Shared". - -Change-Id: Ieb566b63f8c8e691b5f75e06499a3b576d042546 -Signed-off-by: José Bollo <jose.bollo@iot.bzh> ---- - policy/app-rules-template.smack | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/policy/app-rules-template.smack b/policy/app-rules-template.smack -index 1311169..b4cd2e3 100644 ---- a/policy/app-rules-template.smack -+++ b/policy/app-rules-template.smack -@@ -1,12 +1,10 @@ --System ~APP~ rwx -+System ~APP~ rwxa -+System ~PKG~ rwxat - ~APP~ System wx - ~APP~ System::Shared rx - ~APP~ System::Run rwxat - ~APP~ System::Log rwxa - ~APP~ _ l --User ~APP~ rwxa --User ~PKG~ rwxat --~APP~ User wx - ~APP~ User::Home rxl --~APP~ User::App::Shared rwxat -+~APP~ User::App-Shared rwxat - ~APP~ ~PKG~ rwxat --- -2.7.4 - diff --git a/meta-app-framework/recipes-security/security-manager/security-manager/0001-systemd-stop-using-compat-libs.patch b/meta-app-framework/recipes-security/security-manager/security-manager/0001-systemd-stop-using-compat-libs.patch deleted file mode 100644 index 91ce81963..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager/0001-systemd-stop-using-compat-libs.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 3d9d1d83fe298a364f51ad752c17aad461beded3 Mon Sep 17 00:00:00 2001 -From: Patrick Ohly <patrick.ohly@intel.com> -Date: Tue, 24 Mar 2015 04:54:03 -0700 -Subject: [PATCH 01/14] systemd: stop using compat libs - -libsystemd-journal and libsystemd-daemon are considered obsolete -in systemd since 2.09 and may not be available (not compiled -by default). - -The code works fine with the current libsystemd, so just -use that. - -Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> -Upstream-Status: Submitted (https://github.com/Samsung/security-manager/pull/1 ---- - src/common/CMakeLists.txt | 2 +- - src/server/CMakeLists.txt | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt -index 2da9c3e..968c7c1 100644 ---- a/src/common/CMakeLists.txt -+++ b/src/common/CMakeLists.txt -@@ -3,7 +3,7 @@ SET(COMMON_VERSION ${COMMON_VERSION_MAJOR}.0.2) - - PKG_CHECK_MODULES(COMMON_DEP - REQUIRED -- libsystemd-journal -+ libsystemd - libsmack - db-util - cynara-admin -diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt -index 753eb96..6849d76 100644 ---- a/src/server/CMakeLists.txt -+++ b/src/server/CMakeLists.txt -@@ -1,6 +1,6 @@ - PKG_CHECK_MODULES(SERVER_DEP - REQUIRED -- libsystemd-daemon -+ libsystemd - ) - - FIND_PACKAGE(Boost REQUIRED) --- -2.21.0 - diff --git a/meta-app-framework/recipes-security/security-manager/security-manager/0002-security-manager-policy-reload-do-not-depend-on-GNU-.patch b/meta-app-framework/recipes-security/security-manager/security-manager/0002-security-manager-policy-reload-do-not-depend-on-GNU-.patch deleted file mode 100644 index b6346480b..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager/0002-security-manager-policy-reload-do-not-depend-on-GNU-.patch +++ /dev/null @@ -1,36 +0,0 @@ -From a90515613f09140049b2bdf471fa83d5dd7bad1c Mon Sep 17 00:00:00 2001 -From: Patrick Ohly <patrick.ohly@intel.com> -Date: Wed, 19 Aug 2015 15:02:32 +0200 -Subject: [PATCH 02/14] security-manager-policy-reload: do not depend on GNU - sed - -\U (= make replacement uppercase) is a GNU sed extension which is not -supported by other sed implementation's (like the one from -busybox). When using busybox, the bucket for user profiles became -USER_TYPE_Uadmin instead USER_TYPE_ADMIN. - -To make SecurityManager more portable, better use tr to turn the -bucket name into uppercase. - -Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> -Upstream-Status: Submitted (https://github.com/Samsung/security-manager/pull/1 ---- - policy/security-manager-policy-reload | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/policy/security-manager-policy-reload b/policy/security-manager-policy-reload -index 274c49c..6f211c6 100755 ---- a/policy/security-manager-policy-reload -+++ b/policy/security-manager-policy-reload -@@ -33,7 +33,7 @@ END - find "$POLICY_PATH" -name "usertype-*.profile" | - while read file - do -- bucket="`echo $file | sed -r 's|.*/usertype-(.*).profile$|USER_TYPE_\U\1|'`" -+ bucket="`echo $file | sed -r 's|.*/usertype-(.*).profile$|USER_TYPE_\1|' | tr '[:lower:]' '[:upper:]'`" - - # Re-create the bucket with empty contents - cyad --delete-bucket=$bucket || true --- -2.21.0 - diff --git a/meta-app-framework/recipes-security/security-manager/security-manager/0003-Smack-rules-create-two-new-functions.patch b/meta-app-framework/recipes-security/security-manager/security-manager/0003-Smack-rules-create-two-new-functions.patch deleted file mode 100644 index d79345e01..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager/0003-Smack-rules-create-two-new-functions.patch +++ /dev/null @@ -1,117 +0,0 @@ -From a80e33bc0a10fa4bed5d0b7bf29f45dd2565d309 Mon Sep 17 00:00:00 2001 -From: Alejandro Joya <alejandro.joya.cruz@intel.com> -Date: Wed, 4 Nov 2015 19:01:35 -0600 -Subject: [PATCH 03/14] Smack-rules: create two new functions - -It let to smack-rules to create multiple set of rules -related with the privileges. - -It runs from the same bases than for a static set of rules on the -template, but let you add 1 or many templates for different cases. - -Change-Id: I14f8d4e914ad5a7ba34c96f3cb5589f0b15292de -Signed-off-by: Alejandro Joya <alejandro.joya.cruz@intel.com> ---- - src/common/include/smack-rules.h | 15 +++++++++++ - src/common/smack-rules.cpp | 44 ++++++++++++++++++++++++++++++++ - 2 files changed, 59 insertions(+) - -diff --git a/src/common/include/smack-rules.h b/src/common/include/smack-rules.h -index 91446a7..3ad9dd4 100644 ---- a/src/common/include/smack-rules.h -+++ b/src/common/include/smack-rules.h -@@ -47,6 +47,8 @@ public: - void addFromTemplate(const std::vector<std::string> &templateRules, - const std::string &appId, const std::string &pkgId); - void addFromTemplateFile(const std::string &appId, const std::string &pkgId); -+ void addFromTemplateFile(const std::string &appId, const std::string &pkgId, -+ const std::string &path); - - void apply() const; - void clear() const; -@@ -74,6 +76,19 @@ public: - */ - static void installApplicationRules(const std::string &appId, const std::string &pkgId, - const std::vector<std::string> &pkgContents); -+ /** -+ * Install privileges-specific smack rules. -+ * -+ * Function creates smack rules using predefined template. Rules are applied -+ * to the kernel and saved on persistent storage so they are loaded on system boot. -+ * -+ * @param[in] appId - application id that is beeing installed -+ * @param[in] pkgId - package id that the application is in -+ * @param[in] pkgContents - a list of all applications in the package -+ * @param[in] privileges - a list of all prvileges -+ */ -+ static void installApplicationPrivilegesRules(const std::string &appId, const std::string &pkgId, -+ const std::vector<std::string> &pkgContents, const std::vector<std::string> &privileges); - /** - * Uninstall package-specific smack rules. - * -diff --git a/src/common/smack-rules.cpp b/src/common/smack-rules.cpp -index 3629e0f..922a56f 100644 ---- a/src/common/smack-rules.cpp -+++ b/src/common/smack-rules.cpp -@@ -135,6 +135,29 @@ void SmackRules::saveToFile(const std::string &path) const - } - } - -+void SmackRules::addFromTemplateFile(const std::string &appId, -+ const std::string &pkgId, const std::string &path) -+{ -+ std::vector<std::string> templateRules; -+ std::string line; -+ std::ifstream templateRulesFile(path); -+ -+ if (!templateRulesFile.is_open()) { -+ LogError("Cannot open rules template file: " << path); -+ ThrowMsg(SmackException::FileError, "Cannot open rules template file: " << path); -+ } -+ -+ while (std::getline(templateRulesFile, line)) { -+ templateRules.push_back(line); -+ } -+ -+ if (templateRulesFile.bad()) { -+ LogError("Error reading template file: " << APP_RULES_TEMPLATE_FILE_PATH); -+ ThrowMsg(SmackException::FileError, "Error reading template file: " << APP_RULES_TEMPLATE_FILE_PATH); -+ } -+ -+ addFromTemplate(templateRules, appId, pkgId); -+} - - void SmackRules::addFromTemplateFile(const std::string &appId, - const std::string &pkgId) -@@ -223,7 +246,28 @@ std::string SmackRules::getApplicationRulesFilePath(const std::string &appId) - std::string path(tzplatform_mkpath3(TZ_SYS_SMACK, "accesses.d", ("app_" + appId).c_str())); - return path; - } -+void SmackRules::installApplicationPrivilegesRules(const std::string &appId, const std::string &pkgId, -+ const std::vector<std::string> &pkgContents, const std::vector<std::string> &privileges) -+{ -+ SmackRules smackRules; -+ std::string appPath = getApplicationRulesFilePath(appId); -+ smackRules.loadFromFile(appPath); -+ struct stat buffer; -+ for (auto privilege : privileges) { -+ if (privilege.empty()) -+ continue; -+ std::string fprivilege ( privilege + "-template.smack"); -+ std::string path(tzplatform_mkpath4(TZ_SYS_SHARE, "security-manager", "policy", fprivilege.c_str())); -+ if( stat(path.c_str(), &buffer) == 0) -+ smackRules.addFromTemplateFile(appId, pkgId, path); -+ } -+ -+ if (smack_smackfs_path() != NULL) -+ smackRules.apply(); - -+ smackRules.saveToFile(appPath); -+ updatePackageRules(pkgId, pkgContents); -+} - void SmackRules::installApplicationRules(const std::string &appId, const std::string &pkgId, - const std::vector<std::string> &pkgContents) - { --- -2.21.0 - diff --git a/meta-app-framework/recipes-security/security-manager/security-manager/0004-app-install-implement-multiple-set-of-smack-rules.patch b/meta-app-framework/recipes-security/security-manager/security-manager/0004-app-install-implement-multiple-set-of-smack-rules.patch deleted file mode 100644 index 59d4971ff..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager/0004-app-install-implement-multiple-set-of-smack-rules.patch +++ /dev/null @@ -1,34 +0,0 @@ -From a5979d9d674e400ecd7fcdf5d7589cfa0cfeb492 Mon Sep 17 00:00:00 2001 -From: Alejandro Joya <alejandro.joya.cruz@intel.com> -Date: Wed, 4 Nov 2015 19:06:23 -0600 -Subject: [PATCH 04/14] app-install: implement multiple set of smack-rules - -If it's need it could create load multiple set of smack rules -related with the privileges. -It wouldn't affect the case that only the default set of rules is need it. - -Signed-off-by: Alejandro Joya <alejandro.joya.cruz@intel.com> ---- - src/common/service_impl.cpp | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/src/common/service_impl.cpp b/src/common/service_impl.cpp -index 7fd621c..ae305d3 100644 ---- a/src/common/service_impl.cpp -+++ b/src/common/service_impl.cpp -@@ -338,6 +338,12 @@ int appInstall(const app_inst_req &req, uid_t uid) - LogDebug("Adding Smack rules for new appId: " << req.appId << " with pkgId: " - << req.pkgId << ". Applications in package: " << pkgContents.size()); - SmackRules::installApplicationRules(req.appId, req.pkgId, pkgContents); -+ /*Setup for privileges custom rules*/ -+ LogDebug("Adding Smack rules for new appId: " << req.appId << " with pkgId: " -+ << req.pkgId << ". Applications in package: " << pkgContents.size() -+ << " and Privileges"); -+ SmackRules::installApplicationPrivilegesRules(req.appId, req.pkgId, -+ pkgContents,req.privileges); - } catch (const SmackException::Base &e) { - LogError("Error while applying Smack policy for application: " << e.DumpToString()); - return SECURITY_MANAGER_API_ERROR_SETTING_FILE_LABEL_FAILED; --- -2.21.0 - diff --git a/meta-app-framework/recipes-security/security-manager/security-manager/0005-c-11-replace-deprecated-auto_ptr.patch b/meta-app-framework/recipes-security/security-manager/security-manager/0005-c-11-replace-deprecated-auto_ptr.patch deleted file mode 100644 index 0739f28c7..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager/0005-c-11-replace-deprecated-auto_ptr.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 198ba9b9782fda19803e94d2afeff91189ac27af Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jobol@nonadev.net> -Date: Wed, 13 Jan 2016 17:30:06 +0100 -Subject: [PATCH 05/14] c++11: replace deprecated auto_ptr -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Upstream-Status: Submitted [https://review.tizen.org/gerrit/#/c/56940/] - -Change-Id: Id793c784c9674eef48f346226c094bdd9f7bbda8 -Signed-off-by: José Bollo <jobol@nonadev.net> ---- - src/dpl/core/include/dpl/binary_queue.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/dpl/core/include/dpl/binary_queue.h b/src/dpl/core/include/dpl/binary_queue.h -index dd03f5e..185b6c7 100644 ---- a/src/dpl/core/include/dpl/binary_queue.h -+++ b/src/dpl/core/include/dpl/binary_queue.h -@@ -33,7 +33,7 @@ namespace SecurityManager { - * Binary queue auto pointer - */ - class BinaryQueue; --typedef std::auto_ptr<BinaryQueue> BinaryQueueAutoPtr; -+typedef std::unique_ptr<BinaryQueue> BinaryQueueAutoPtr; - - /** - * Binary stream implemented as constant size bucket list --- -2.21.0 - diff --git a/meta-app-framework/recipes-security/security-manager/security-manager/0006-socket-manager-removes-tizen-specific-call.patch b/meta-app-framework/recipes-security/security-manager/security-manager/0006-socket-manager-removes-tizen-specific-call.patch deleted file mode 100644 index 3b8aad98c..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager/0006-socket-manager-removes-tizen-specific-call.patch +++ /dev/null @@ -1,47 +0,0 @@ -From ec098bf03cea23350ca7d1ea2ad88b9c88228943 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh> -Date: Fri, 8 Jan 2016 16:53:46 +0100 -Subject: [PATCH 06/14] socket-manager: removes tizen specific call -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The function 'smack_fgetlabel' is specific to Tizen -and is no more maintained upstream. - -Upstream-Status: Accepted [https://review.tizen.org/gerrit/#/c/56507/] - -Change-Id: I3802742b1758efe37b33e6d968ff727d68f2fd1f -Signed-off-by: José Bollo <jobol@nonadev.net> ---- - src/server/main/socket-manager.cpp | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/src/server/main/socket-manager.cpp b/src/server/main/socket-manager.cpp -index 94c54c6..5e1a79b 100644 ---- a/src/server/main/socket-manager.cpp -+++ b/src/server/main/socket-manager.cpp -@@ -30,6 +30,7 @@ - #include <sys/types.h> - #include <sys/socket.h> - #include <sys/smack.h> -+#include <linux/xattr.h> - #include <sys/un.h> - #include <sys/stat.h> - #include <unistd.h> -@@ -493,9 +494,9 @@ int SocketManager::CreateDomainSocketHelp( - if (smack_check()) { - LogInfo("Set up smack label: " << desc.smackLabel); - -- if (0 != smack_fsetlabel(sockfd, desc.smackLabel.c_str(), SMACK_LABEL_IPIN)) { -- LogError("Error in smack_fsetlabel"); -- ThrowMsg(Exception::InitFailed, "Error in smack_fsetlabel"); -+ if (0 != smack_set_label_for_file(sockfd, XATTR_NAME_SMACKIPIN, desc.smackLabel.c_str())) { -+ LogError("Error in smack_set_label_for_file"); -+ ThrowMsg(Exception::InitFailed, "Error in smack_set_label_for_file"); - } - } else { - LogInfo("No smack on platform. Socket won't be securied with smack label!"); --- -2.21.0 - diff --git a/meta-app-framework/recipes-security/security-manager/security-manager/0007-removes-dependency-to-libslp-db-utils.patch b/meta-app-framework/recipes-security/security-manager/security-manager/0007-removes-dependency-to-libslp-db-utils.patch deleted file mode 100644 index bad99d25a..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager/0007-removes-dependency-to-libslp-db-utils.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 9d0791dab4b4df086374c5c0ba2a6558e10e81c1 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh> -Date: Mon, 16 Nov 2015 15:56:27 +0100 -Subject: [PATCH 07/14] removes dependency to libslp-db-utils - -Change-Id: I90471e77d20e04bae58cc42eb2639e4aef97fdec ---- - src/common/CMakeLists.txt | 3 ++- - src/dpl/db/src/sql_connection.cpp | 17 +---------------- - 2 files changed, 3 insertions(+), 17 deletions(-) - -diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt -index 968c7c1..9ae376f 100644 ---- a/src/common/CMakeLists.txt -+++ b/src/common/CMakeLists.txt -@@ -5,7 +5,8 @@ PKG_CHECK_MODULES(COMMON_DEP - REQUIRED - libsystemd - libsmack -- db-util -+ sqlite3 -+ icu-i18n - cynara-admin - cynara-client - ) -diff --git a/src/dpl/db/src/sql_connection.cpp b/src/dpl/db/src/sql_connection.cpp -index fdb4fe4..f49a6dc 100644 ---- a/src/dpl/db/src/sql_connection.cpp -+++ b/src/dpl/db/src/sql_connection.cpp -@@ -26,7 +26,6 @@ - #include <memory> - #include <dpl/noncopyable.h> - #include <dpl/assert.h> --#include <db-util.h> - #include <unistd.h> - #include <cstdio> - #include <cstdarg> -@@ -606,16 +605,7 @@ void SqlConnection::Connect(const std::string &address, - - // Connect to database - int result; -- if (type & Flag::UseLucene) { -- result = db_util_open_with_options( -- address.c_str(), -- &m_connection, -- flag, -- NULL); -- -- m_usingLucene = true; -- LogPedantic("Lucene index enabled"); -- } else { -+ (void)type; - result = sqlite3_open_v2( - address.c_str(), - &m_connection, -@@ -624,7 +614,6 @@ void SqlConnection::Connect(const std::string &address, - - m_usingLucene = false; - LogPedantic("Lucene index disabled"); -- } - - if (result == SQLITE_OK) { - LogPedantic("Connected to DB"); -@@ -653,11 +642,7 @@ void SqlConnection::Disconnect() - - int result; - -- if (m_usingLucene) { -- result = db_util_close(m_connection); -- } else { - result = sqlite3_close(m_connection); -- } - - if (result != SQLITE_OK) { - const char *error = sqlite3_errmsg(m_connection); --- -2.21.0 - diff --git a/meta-app-framework/recipes-security/security-manager/security-manager/0008-Fix-gcc6-build.patch b/meta-app-framework/recipes-security/security-manager/security-manager/0008-Fix-gcc6-build.patch deleted file mode 100644 index 5ece7ef4f..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager/0008-Fix-gcc6-build.patch +++ /dev/null @@ -1,38 +0,0 @@ -From a1d9b40b4fa2e73d31a53e398c286bffeaae1732 Mon Sep 17 00:00:00 2001 -From: Ronan <ronan.lemartret@iot.bzh> -Date: Wed, 12 Oct 2016 17:48:55 +0200 -Subject: [PATCH 08/14] Fix gcc6 build - -Signed-off-by: ronan <ronan@ot.bzh> ---- - src/client/client-security-manager.cpp | 1 + - src/common/include/privilege_db.h | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/src/client/client-security-manager.cpp b/src/client/client-security-manager.cpp -index 74a6b30..347cddd 100644 ---- a/src/client/client-security-manager.cpp -+++ b/src/client/client-security-manager.cpp -@@ -46,6 +46,7 @@ - #include <service_impl.h> - #include <security-manager.h> - #include <client-offline.h> -+#include <linux/xattr.h> - - static const char *EMPTY = ""; - -diff --git a/src/common/include/privilege_db.h b/src/common/include/privilege_db.h -index 4d73d90..08fb9d6 100644 ---- a/src/common/include/privilege_db.h -+++ b/src/common/include/privilege_db.h -@@ -32,6 +32,7 @@ - #include <map> - #include <stdbool.h> - #include <string> -+#include <vector> - - #include <dpl/db/sql_connection.h> - #include <tzplatform_config.h> --- -2.21.0 - diff --git a/meta-app-framework/recipes-security/security-manager/security-manager/0009-Fix-Cmake-conf-for-gcc6-build.patch b/meta-app-framework/recipes-security/security-manager/security-manager/0009-Fix-Cmake-conf-for-gcc6-build.patch deleted file mode 100644 index 706eb1a93..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager/0009-Fix-Cmake-conf-for-gcc6-build.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 382379d74221bcc60a0ab70d63430a1c0587b2ec Mon Sep 17 00:00:00 2001 -From: Ronan <ronan.lemartret@iot.bzh> -Date: Thu, 13 Oct 2016 11:37:47 +0200 -Subject: [PATCH 09/14] Fix Cmake conf for gcc6 build - -Signed-off-by: Ronan <ronan.lemartret@iot.bzh> ---- - src/cmd/CMakeLists.txt | 4 +--- - src/server/CMakeLists.txt | 1 - - 2 files changed, 1 insertion(+), 4 deletions(-) - -diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt -index ee9a160..aa7a12c 100644 ---- a/src/cmd/CMakeLists.txt -+++ b/src/cmd/CMakeLists.txt -@@ -1,8 +1,6 @@ - FIND_PACKAGE(Boost REQUIRED COMPONENTS program_options) - --INCLUDE_DIRECTORIES(SYSTEM -- ${Boost_INCLUDE_DIRS} -- ) -+ - - INCLUDE_DIRECTORIES( - ${INCLUDE_PATH} -diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt -index 6849d76..9598037 100644 ---- a/src/server/CMakeLists.txt -+++ b/src/server/CMakeLists.txt -@@ -8,7 +8,6 @@ FIND_PACKAGE(Threads REQUIRED) - - INCLUDE_DIRECTORIES(SYSTEM - ${SERVER_DEP_INCLUDE_DIRS} -- ${Boost_INCLUDE_DIRS} - ${Threads_INCLUDE_DIRS} - ) - --- -2.21.0 - diff --git a/meta-app-framework/recipes-security/security-manager/security-manager/0010-gcc-7-requires-include-functional-for-std-function.patch b/meta-app-framework/recipes-security/security-manager/security-manager/0010-gcc-7-requires-include-functional-for-std-function.patch deleted file mode 100644 index 0f48c5f68..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager/0010-gcc-7-requires-include-functional-for-std-function.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 8e93699c0f225716f3cd5eff790270ae9e3880f9 Mon Sep 17 00:00:00 2001 -From: Changhyeok Bae <changhyeok.bae@gmail.com> -Date: Sun, 17 Dec 2017 15:40:58 +0000 -Subject: [PATCH 10/14] gcc-7 requires include <functional> for std::function - -Signed-off-by: Changhyeok Bae <changhyeok.bae@gmail.com> ---- - src/client/client-common.cpp | 1 + - src/common/smack-labels.cpp | 1 + - src/dpl/core/src/binary_queue.cpp | 1 + - 3 files changed, 3 insertions(+) - -diff --git a/src/client/client-common.cpp b/src/client/client-common.cpp -index 883ab8d..1babdf7 100644 ---- a/src/client/client-common.cpp -+++ b/src/client/client-common.cpp -@@ -31,6 +31,7 @@ - #include <sys/xattr.h> - #include <linux/xattr.h> - #include <unistd.h> -+#include <functional> - - #include <dpl/log/log.h> - #include <dpl/serialization.h> -diff --git a/src/common/smack-labels.cpp b/src/common/smack-labels.cpp -index 0294a42..1598099 100644 ---- a/src/common/smack-labels.cpp -+++ b/src/common/smack-labels.cpp -@@ -29,6 +29,7 @@ - #include <sys/xattr.h> - #include <linux/xattr.h> - #include <memory> -+#include <functional> - #include <fts.h> - #include <cstring> - #include <string> -diff --git a/src/dpl/core/src/binary_queue.cpp b/src/dpl/core/src/binary_queue.cpp -index 72817a6..838409f 100644 ---- a/src/dpl/core/src/binary_queue.cpp -+++ b/src/dpl/core/src/binary_queue.cpp -@@ -26,6 +26,7 @@ - #include <malloc.h> - #include <cstring> - #include <new> -+#include <functional> - - namespace SecurityManager { - BinaryQueue::BinaryQueue() : --- -2.21.0 - diff --git a/meta-app-framework/recipes-security/security-manager/security-manager/0011-Fix-gcc8-warning-error-Werror-catch-value.patch b/meta-app-framework/recipes-security/security-manager/security-manager/0011-Fix-gcc8-warning-error-Werror-catch-value.patch deleted file mode 100644 index 5c679fc26..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager/0011-Fix-gcc8-warning-error-Werror-catch-value.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 243b7ffee16558d7cb9b411f49380138efeffca9 Mon Sep 17 00:00:00 2001 -From: Stephane Desneux <stephane.desneux@iot.bzh> -Date: Fri, 1 Feb 2019 12:26:17 +0000 -Subject: [PATCH 11/14] Fix gcc8 warning/error [-Werror=catch-value=] - -Fixes the following warning/error during compile: - -src/dpl/core/src/assert.cpp:61:14: error: catching polymorphic type 'class SecurityManager::Exception' by value [-Werror=catch-value=] -| } catch (Exception) { -| ^~~~~~~~~ - -Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh> ---- - src/dpl/core/src/assert.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/dpl/core/src/assert.cpp b/src/dpl/core/src/assert.cpp -index 63538a2..fc60ce9 100644 ---- a/src/dpl/core/src/assert.cpp -+++ b/src/dpl/core/src/assert.cpp -@@ -58,7 +58,7 @@ void AssertProc(const char *condition, - INTERNAL_LOG("### Function: " << function); - INTERNAL_LOG( - "################################################################################"); -- } catch (Exception) { -+ } catch (Exception const&) { - // Just ignore possible double errors - } - --- -2.21.0 - diff --git a/meta-app-framework/recipes-security/security-manager/security-manager/0012-Avoid-casting-from-const-T-to-void.patch b/meta-app-framework/recipes-security/security-manager/security-manager/0012-Avoid-casting-from-const-T-to-void.patch deleted file mode 100644 index 91ccf9ee2..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager/0012-Avoid-casting-from-const-T-to-void.patch +++ /dev/null @@ -1,122 +0,0 @@ -From 5ee51d38575f289c2bf37ed817ef680ed47bb320 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh> -Date: Fri, 1 Feb 2019 15:37:44 +0100 -Subject: [PATCH 12/14] Avoid casting from "const T&" to "void*" -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Latest version of g++ refuse the cast - - reinterpret_cast<void (Service::*)(void*)>(serviceFunction) - -I made no investigation to know if the problem -is coming from the const or not. - -Signed-off-by: José Bollo <jose.bollo@iot.bzh> ---- - src/server/main/include/service-thread.h | 42 ++++++++++-------------- - 1 file changed, 18 insertions(+), 24 deletions(-) - -diff --git a/src/server/main/include/service-thread.h b/src/server/main/include/service-thread.h -index 964d168..61fdda8 100644 ---- a/src/server/main/include/service-thread.h -+++ b/src/server/main/include/service-thread.h -@@ -94,7 +94,7 @@ public: - Join(); - while (!m_eventQueue.empty()){ - auto front = m_eventQueue.front(); -- delete front.eventPtr; -+ delete front; - m_eventQueue.pop(); - } - } -@@ -104,34 +104,28 @@ public: - Service *servicePtr, - void (Service::*serviceFunction)(const T &)) - { -- EventDescription description; -- description.serviceFunctionPtr = -- reinterpret_cast<void (Service::*)(void*)>(serviceFunction); -- description.servicePtr = servicePtr; -- description.eventFunctionPtr = &ServiceThread::EventCall<T>; -- description.eventPtr = new T(event); -+ EventCallerBase *ec = new EventCaller<T>(event, servicePtr, serviceFunction); - { - std::lock_guard<std::mutex> lock(m_eventQueueMutex); -- m_eventQueue.push(description); -+ m_eventQueue.push(ec); - } - m_waitCondition.notify_one(); - } - - protected: - -- struct EventDescription { -- void (Service::*serviceFunctionPtr)(void *); -- Service *servicePtr; -- void (ServiceThread::*eventFunctionPtr)(const EventDescription &event); -- GenericEvent* eventPtr; -+ struct EventCallerBase { -+ virtual void fire() = 0; -+ virtual ~EventCallerBase() {} - }; - - template <class T> -- void EventCall(const EventDescription &desc) { -- auto fun = reinterpret_cast<void (Service::*)(const T&)>(desc.serviceFunctionPtr); -- const T& eventLocale = *(static_cast<T*>(desc.eventPtr)); -- (desc.servicePtr->*fun)(eventLocale); -- } -+ struct EventCaller : public EventCallerBase { -+ T *event; Service *target; void (Service::*function)(const T&); -+ EventCaller(const T &e, Service *c, void (Service::*f)(const T&)) : event(new T(e)), target(c), function(f) {} -+ ~EventCaller() { delete event; } -+ void fire() { (target->*function)(*event); } -+ }; - - static void ThreadLoopStatic(ServiceThread *ptr) { - ptr->ThreadLoop(); -@@ -139,33 +133,33 @@ protected: - - void ThreadLoop(){ - for (;;) { -- EventDescription description = {NULL, NULL, NULL, NULL}; -+ EventCallerBase *ec = NULL; - { - std::unique_lock<std::mutex> ulock(m_eventQueueMutex); - if (m_quit) - return; - if (!m_eventQueue.empty()) { -- description = m_eventQueue.front(); -+ ec = m_eventQueue.front(); - m_eventQueue.pop(); - } else { - m_waitCondition.wait(ulock); - } - } - -- if (description.eventPtr != NULL) { -+ if (ec != NULL) { - UNHANDLED_EXCEPTION_HANDLER_BEGIN - { -- (this->*description.eventFunctionPtr)(description); -- delete description.eventPtr; -+ ec->fire(); - } - UNHANDLED_EXCEPTION_HANDLER_END -+ delete ec; - } - } - } - - std::thread m_thread; - std::mutex m_eventQueueMutex; -- std::queue<EventDescription> m_eventQueue; -+ std::queue<EventCallerBase*> m_eventQueue; - std::condition_variable m_waitCondition; - - State m_state; --- -2.21.0 - diff --git a/meta-app-framework/recipes-security/security-manager/security-manager/0013-Removing-tizen-platform-config.patch b/meta-app-framework/recipes-security/security-manager/security-manager/0013-Removing-tizen-platform-config.patch deleted file mode 100644 index fb6215923..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager/0013-Removing-tizen-platform-config.patch +++ /dev/null @@ -1,259 +0,0 @@ -From 6c96a39ba7a7763ccd47e379dbfd8d376164985f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh> -Date: Mon, 16 Nov 2015 14:26:25 +0100 -Subject: [PATCH 13/14] Removing tizen-platform-config - -Change-Id: Ic832a2b75229517b09faba969c27fb1a4b490121 ---- - CMakeLists.txt | 16 +++++++- - db/CMakeLists.txt | 2 +- - policy/CMakeLists.txt | 1 + - ...load => security-manager-policy-reload.in} | 4 +- - src/common/file-lock.cpp | 4 +- - src/common/include/file-lock.h | 1 - - src/common/include/privilege_db.h | 3 +- - src/common/service_impl.cpp | 39 ++++++------------- - src/common/smack-rules.cpp | 12 ++---- - 9 files changed, 37 insertions(+), 45 deletions(-) - rename policy/{security-manager-policy-reload => security-manager-policy-reload.in} (94%) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 28790d8..37a43cc 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -49,7 +49,7 @@ ADD_DEFINITIONS("-Wall") # Generate all warnings - ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings - - STRING(REGEX MATCH "([^.]*)" API_VERSION "${VERSION}") --ADD_DEFINITIONS("-DAPI_VERSION=\"$(API_VERSION)\"") -+ADD_DEFINITIONS("-DAPI_VERSION=\"${API_VERSION}\"") - - ADD_DEFINITIONS("-DSMACK_ENABLED") - -@@ -58,6 +58,20 @@ IF (CMAKE_BUILD_TYPE MATCHES "DEBUG") - ADD_DEFINITIONS("-DBUILD_TYPE_DEBUG") - ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG") - -+SET(DATADIR "/usr/share/security-manager" CACHE STRING "path to data directory") -+SET(SMACKRULESDIR "/etc/smack/accesses.d" CACHE STRING "path to Smack rules directory") -+SET(LOCKDIR "/var/run/lock" CACHE STRING "path to lock directory") -+SET(DB_INSTALL_DIR "/var/db/security-manager" CACHE STRING "path to database directory") -+SET(DB_FILENAME ".security-manager.db" CACHE STRING "basename of database") -+SET(GLOBALUSER "userapp" CACHE STRING "name of the global user") -+ -+ADD_DEFINITIONS("-DDATADIR=\"${DATADIR}\"") -+ADD_DEFINITIONS("-DSMACKRULESDIR=\"${SMACKRULESDIR}\"") -+ADD_DEFINITIONS("-DLOCKDIR=\"${LOCKDIR}\"") -+ADD_DEFINITIONS("-DDB_INSTALL_DIR=\"${DB_INSTALL_DIR}\"") -+ADD_DEFINITIONS("-DDB_FILENAME=\"${DB_FILENAME}\"") -+ADD_DEFINITIONS("-DGLOBALUSER=\"${GLOBALUSER}\"") -+ - ADD_SUBDIRECTORY(src) - ADD_SUBDIRECTORY(pc) - ADD_SUBDIRECTORY(systemd) -diff --git a/db/CMakeLists.txt b/db/CMakeLists.txt -index 9e8ffcc..d7af1a0 100644 ---- a/db/CMakeLists.txt -+++ b/db/CMakeLists.txt -@@ -1,4 +1,4 @@ --SET(TARGET_DB ".security-manager.db") -+SET(TARGET_DB "$(DB_FILENAME)") - - ADD_CUSTOM_COMMAND( - OUTPUT ${TARGET_DB} ${TARGET_DB}-journal -diff --git a/policy/CMakeLists.txt b/policy/CMakeLists.txt -index bd08edc..626a2bd 100644 ---- a/policy/CMakeLists.txt -+++ b/policy/CMakeLists.txt -@@ -1,4 +1,5 @@ - FILE(GLOB USERTYPE_POLICY_FILES usertype-*.profile) -+CONFIGURE_FILE(security-manager-policy-reload.in security-manager-policy-reload @ONLY) - INSTALL(FILES ${USERTYPE_POLICY_FILES} DESTINATION ${SHARE_INSTALL_PREFIX}/security-manager/policy) - INSTALL(FILES "app-rules-template.smack" DESTINATION ${SHARE_INSTALL_PREFIX}/security-manager/policy) - INSTALL(FILES "privilege-group.list" DESTINATION ${SHARE_INSTALL_PREFIX}/security-manager/policy) -diff --git a/policy/security-manager-policy-reload b/policy/security-manager-policy-reload.in -similarity index 94% -rename from policy/security-manager-policy-reload -rename to policy/security-manager-policy-reload.in -index 6f211c6..c1bc4e2 100755 ---- a/policy/security-manager-policy-reload -+++ b/policy/security-manager-policy-reload.in -@@ -1,8 +1,8 @@ - #!/bin/sh -e - --POLICY_PATH=/usr/share/security-manager/policy -+POLICY_PATH=@DATADIR@/policy - PRIVILEGE_GROUP_MAPPING=$POLICY_PATH/privilege-group.list --DB_FILE=`tzplatform-get TZ_SYS_DB | cut -d= -f2`/.security-manager.db -+DB_FILE=@DB_INSTALL_DIR@/@DB_FILENAME@ - - # Create default buckets - while read bucket default_policy -diff --git a/src/common/file-lock.cpp b/src/common/file-lock.cpp -index 6f3996c..88d2092 100644 ---- a/src/common/file-lock.cpp -+++ b/src/common/file-lock.cpp -@@ -30,9 +30,7 @@ - - namespace SecurityManager { - --char const * const SERVICE_LOCK_FILE = tzplatform_mkpath3(TZ_SYS_RUN, -- "lock", -- "security-manager.lock"); -+char const * const SERVICE_LOCK_FILE = LOCKDIR "/security-manager.lock"; - - FileLocker::FileLocker(const std::string &lockFile, bool blocking) - { -diff --git a/src/common/include/file-lock.h b/src/common/include/file-lock.h -index 604b019..21a86a0 100644 ---- a/src/common/include/file-lock.h -+++ b/src/common/include/file-lock.h -@@ -29,7 +29,6 @@ - - #include <dpl/exception.h> - #include <dpl/noncopyable.h> --#include <tzplatform_config.h> - - namespace SecurityManager { - -diff --git a/src/common/include/privilege_db.h b/src/common/include/privilege_db.h -index 08fb9d6..3344987 100644 ---- a/src/common/include/privilege_db.h -+++ b/src/common/include/privilege_db.h -@@ -35,14 +35,13 @@ - #include <vector> - - #include <dpl/db/sql_connection.h> --#include <tzplatform_config.h> - - #ifndef PRIVILEGE_DB_H_ - #define PRIVILEGE_DB_H_ - - namespace SecurityManager { - --const char *const PRIVILEGE_DB_PATH = tzplatform_mkpath(TZ_SYS_DB, ".security-manager.db"); -+const char *const PRIVILEGE_DB_PATH = DB_INSTALL_DIR "/" DB_FILENAME; - - enum class QueryType { - EGetPkgPrivileges, -diff --git a/src/common/service_impl.cpp b/src/common/service_impl.cpp -index ae305d3..42150fe 100644 ---- a/src/common/service_impl.cpp -+++ b/src/common/service_impl.cpp -@@ -32,7 +32,6 @@ - #include <algorithm> - - #include <dpl/log/log.h> --#include <tzplatform_config.h> - - #include "protocols.h" - #include "privilege_db.h" -@@ -131,7 +130,13 @@ static inline int validatePolicy(policy_entry &policyEntry, std::string uidStr, - - static uid_t getGlobalUserId(void) - { -- static uid_t globaluid = tzplatform_getuid(TZ_SYS_GLOBALAPP_USER); -+ static uid_t globaluid = 0; -+ if (!globaluid) { -+ struct passwd pw, *p; -+ char buf[4096]; -+ int rc = getpwnam_r(GLOBALUSER, &pw, buf, sizeof buf, &p); -+ globaluid = (rc || p == NULL) ? 555 : p->pw_uid; -+ } - return globaluid; - } - -@@ -161,37 +166,17 @@ static inline bool isSubDir(const char *parent, const char *subdir) - - static bool getUserAppDir(const uid_t &uid, std::string &userAppDir) - { -- struct tzplatform_context *tz_ctx = nullptr; -- -- if (tzplatform_context_create(&tz_ctx)) -- return false; -- -- if (tzplatform_context_set_user(tz_ctx, uid)) { -- tzplatform_context_destroy(tz_ctx); -- tz_ctx = nullptr; -+ struct passwd pw, *p; -+ char buf[4096]; -+ int rc = getpwuid_r(uid, &pw, buf, sizeof buf, &p); -+ if (rc || p == NULL) - return false; -- } -- -- enum tzplatform_variable id = -- (uid == getGlobalUserId()) ? TZ_SYS_RW_APP : TZ_USER_APP; -- const char *appDir = tzplatform_context_getenv(tz_ctx, id); -- if (!appDir) { -- tzplatform_context_destroy(tz_ctx); -- tz_ctx = nullptr; -- return false; -- } -- -- userAppDir = appDir; -- -- tzplatform_context_destroy(tz_ctx); -- tz_ctx = nullptr; -- -+ userAppDir = p->pw_dir; - return true; - } - - static inline bool installRequestAuthCheck(const app_inst_req &req, uid_t uid, bool &isCorrectPath, std::string &appPath) - { -- std::string userHome; - std::string userAppDir; - std::stringstream correctPath; - -diff --git a/src/common/smack-rules.cpp b/src/common/smack-rules.cpp -index 922a56f..c2e0041 100644 ---- a/src/common/smack-rules.cpp -+++ b/src/common/smack-rules.cpp -@@ -34,7 +34,6 @@ - #include <memory> - - #include <dpl/log/log.h> --#include <tzplatform_config.h> - - #include "smack-labels.h" - #include "smack-rules.h" -@@ -43,7 +42,7 @@ namespace SecurityManager { - - const char *const SMACK_APP_LABEL_TEMPLATE = "~APP~"; - const char *const SMACK_PKG_LABEL_TEMPLATE = "~PKG~"; --const char *const APP_RULES_TEMPLATE_FILE_PATH = tzplatform_mkpath4(TZ_SYS_SHARE, "security-manager", "policy", "app-rules-template.smack"); -+const char *const APP_RULES_TEMPLATE_FILE_PATH = DATADIR "/policy/app-rules-template.smack"; - const char *const SMACK_APP_IN_PACKAGE_PERMS = "rwxat"; - - SmackRules::SmackRules() -@@ -237,14 +236,12 @@ void SmackRules::generatePackageCrossDeps(const std::vector<std::string> &pkgCon - - std::string SmackRules::getPackageRulesFilePath(const std::string &pkgId) - { -- std::string path(tzplatform_mkpath3(TZ_SYS_SMACK, "accesses.d", ("pkg_" + pkgId).c_str())); -- return path; -+ return SMACKRULESDIR "/pkg_" + pkgId; - } - - std::string SmackRules::getApplicationRulesFilePath(const std::string &appId) - { -- std::string path(tzplatform_mkpath3(TZ_SYS_SMACK, "accesses.d", ("app_" + appId).c_str())); -- return path; -+ return SMACKRULESDIR "/app_" + appId; - } - void SmackRules::installApplicationPrivilegesRules(const std::string &appId, const std::string &pkgId, - const std::vector<std::string> &pkgContents, const std::vector<std::string> &privileges) -@@ -256,8 +253,7 @@ void SmackRules::installApplicationPrivilegesRules(const std::string &appId, con - for (auto privilege : privileges) { - if (privilege.empty()) - continue; -- std::string fprivilege ( privilege + "-template.smack"); -- std::string path(tzplatform_mkpath4(TZ_SYS_SHARE, "security-manager", "policy", fprivilege.c_str())); -+ std::string path = DATADIR "/policy/" + privilege + "-template.smack"; - if( stat(path.c_str(), &buffer) == 0) - smackRules.addFromTemplateFile(appId, pkgId, path); - } --- -2.21.0 - diff --git a/meta-app-framework/recipes-security/security-manager/security-manager/0014-Ensure-post-install-initialization-of-database.patch b/meta-app-framework/recipes-security/security-manager/security-manager/0014-Ensure-post-install-initialization-of-database.patch deleted file mode 100644 index 542a387d2..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager/0014-Ensure-post-install-initialization-of-database.patch +++ /dev/null @@ -1,78 +0,0 @@ -From c7f9d14e38a1b6d40b2fffa01433a3025eff9abd Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh> -Date: Tue, 26 Nov 2019 12:34:39 +0100 -Subject: [PATCH 14/14] Ensure post install initialization of database -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Creation of the database was made during image creation, -leading to issue with SOTA. This adds the creation on -need before launching the service. - -Change-Id: Idfd0676bd87d39f7c10eaafd63f3a318f675c972 -Signed-off-by: José Bollo <jose.bollo@iot.bzh> ---- - db/CMakeLists.txt | 14 ++++++-------- - db/security-manager-setup | 14 ++++++++++++++ - systemd/security-manager.service.in | 1 + - 3 files changed, 21 insertions(+), 8 deletions(-) - create mode 100644 db/security-manager-setup - -diff --git a/db/CMakeLists.txt b/db/CMakeLists.txt -index d7af1a0..dcf5bc8 100644 ---- a/db/CMakeLists.txt -+++ b/db/CMakeLists.txt -@@ -1,12 +1,10 @@ --SET(TARGET_DB "$(DB_FILENAME)") -- - ADD_CUSTOM_COMMAND( -- OUTPUT ${TARGET_DB} ${TARGET_DB}-journal -- COMMAND sqlite3 ${TARGET_DB} <db.sql -- ) -+ OUTPUT .security-manager-setup -+ COMMAND sed '/--DB\.SQL--/r db.sql' security-manager-setup > .security-manager-setup -+ DEPENDS security-manager-setup db.sql -+) - - # Add a dummy build target to trigger building of ${TARGET_DB} --ADD_CUSTOM_TARGET(DB ALL DEPENDS ${TARGET_DB}) -+ADD_CUSTOM_TARGET(DB ALL DEPENDS .security-manager-setup) - --INSTALL(FILES ${TARGET_DB} DESTINATION ${DB_INSTALL_DIR}) --INSTALL(FILES ${TARGET_DB}-journal DESTINATION ${DB_INSTALL_DIR}) -+INSTALL(PROGRAMS .security-manager-setup DESTINATION ${BIN_INSTALL_DIR}) -diff --git a/db/security-manager-setup b/db/security-manager-setup -new file mode 100644 -index 0000000..5675baf ---- /dev/null -+++ b/db/security-manager-setup -@@ -0,0 +1,14 @@ -+#!/bin/sh -+ -+if test -f "$1"; then exit; fi -+set -e -+dbdir="$(dirname "$1")" -+dbfile="$(basename "$1")" -+test -n "$dbfile" -+test -n "$dbdir" -+mkdir -p "$dbdir" -+cd "$dbdir" -+sqlite3 "$dbfile" << END-OF-CAT -+--DB.SQL-- -+END-OF-CAT -+ -diff --git a/systemd/security-manager.service.in b/systemd/security-manager.service.in -index 23fd1b2..2bf97d7 100644 ---- a/systemd/security-manager.service.in -+++ b/systemd/security-manager.service.in -@@ -3,5 +3,6 @@ Description=Start the security manager - - [Service] - Type=notify -+ExecStartPre=@BIN_INSTALL_DIR@/.security-manager-setup @DB_INSTALL_DIR@/@DB_FILENAME@ - ExecStart=@BIN_INSTALL_DIR@/security-manager - Sockets=security-manager.socket --- -2.21.0 - diff --git a/meta-app-framework/recipes-security/security-manager/security-manager/0015-Restrict-socket-accesses.patch b/meta-app-framework/recipes-security/security-manager/security-manager/0015-Restrict-socket-accesses.patch deleted file mode 100644 index d9949193b..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager/0015-Restrict-socket-accesses.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 7cffcd61378a9d7c0e7db5691b2da3a37448c969 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh> -Date: Thu, 30 Jan 2020 09:19:25 +0100 -Subject: [PATCH 15/15] Restrict socket accesses -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Ensure that only members of the group and the owner can access -the security manager. - -Bug-AGL: SPEC-3146 - -Change-Id: I68ce6523db4bfd4707c3680555c3cb0cf8858ef2 -Signed-off-by: José Bollo <jose.bollo@iot.bzh> ---- - systemd/security-manager.socket | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/systemd/security-manager.socket b/systemd/security-manager.socket -index af1c1da..b401f77 100644 ---- a/systemd/security-manager.socket -+++ b/systemd/security-manager.socket -@@ -1,6 +1,6 @@ - [Socket] - ListenStream=/run/security-manager.socket --SocketMode=0777 -+SocketMode=0660 - SmackLabelIPIn=* - SmackLabelIPOut=@ - --- -2.21.1 - diff --git a/meta-app-framework/recipes-security/security-manager/security-manager_%.bbappend b/meta-app-framework/recipes-security/security-manager/security-manager_%.bbappend deleted file mode 100644 index ba3365f12..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager_%.bbappend +++ /dev/null @@ -1,13 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/security-manager:" - -EXTRA_OECMAKE =+ " -DGLOBALUSER=afm" - -SRC_URI += " \ - file://0001-Adapt-rules-to-AGL.patch \ -" - -do_install:append() { - # Needed for wayland-0 socket access and memfd usage - echo "~APP~ System::Weston rw" >> ${D}${datadir}/security-manager/policy/app-rules-template.smack - echo "System::Weston ~APP~ rw" >> ${D}${datadir}/security-manager/policy/app-rules-template.smack -} diff --git a/meta-app-framework/recipes-security/security-manager/security-manager_git.bb b/meta-app-framework/recipes-security/security-manager/security-manager_git.bb deleted file mode 100644 index b34973519..000000000 --- a/meta-app-framework/recipes-security/security-manager/security-manager_git.bb +++ /dev/null @@ -1,27 +0,0 @@ -require security-manager.inc - -PV = "1.0.2+git${SRCPV}" -SRCREV = "860305a595d681d650024ad07b3b0977e1fcb0a6" -SRC_URI += "git://github.com/Samsung/security-manager.git" -S = "${WORKDIR}/git" - -SRC_URI += " \ - file://0001-systemd-stop-using-compat-libs.patch \ - file://0002-security-manager-policy-reload-do-not-depend-on-GNU-.patch \ - file://0003-Smack-rules-create-two-new-functions.patch \ - file://0004-app-install-implement-multiple-set-of-smack-rules.patch \ - file://0005-c-11-replace-deprecated-auto_ptr.patch \ - file://0006-socket-manager-removes-tizen-specific-call.patch \ - file://0007-removes-dependency-to-libslp-db-utils.patch \ - file://0008-Fix-gcc6-build.patch \ - file://0009-Fix-Cmake-conf-for-gcc6-build.patch \ - file://0010-gcc-7-requires-include-functional-for-std-function.patch \ - file://0011-Fix-gcc8-warning-error-Werror-catch-value.patch \ - file://0012-Avoid-casting-from-const-T-to-void.patch \ - file://0013-Removing-tizen-platform-config.patch \ - file://0014-Ensure-post-install-initialization-of-database.patch \ - file://0015-Restrict-socket-accesses.patch \ -" - -# Use make with cmake and not ninja -OECMAKE_GENERATOR = "Unix Makefiles" diff --git a/meta-app-framework/recipes-security/xmlsec1/xmlsec1_1.%.bbappend b/meta-app-framework/recipes-security/xmlsec1/xmlsec1_1.%.bbappend deleted file mode 100644 index afbc16c30..000000000 --- a/meta-app-framework/recipes-security/xmlsec1/xmlsec1_1.%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'xmlsec1_appfw.inc', '', d)} diff --git a/meta-app-framework/recipes-security/xmlsec1/xmlsec1_appfw.inc b/meta-app-framework/recipes-security/xmlsec1/xmlsec1_appfw.inc deleted file mode 100644 index 09820be2f..000000000 --- a/meta-app-framework/recipes-security/xmlsec1/xmlsec1_appfw.inc +++ /dev/null @@ -1,4 +0,0 @@ -# Disable nss to avoid build issues on native -PACKAGECONFIG = "gnutls libgcrypt openssl des" - -BBCLASSEXTEND = "native nativesdk" diff --git a/meta-app-framework/recipes-support/libcap/libcap/removing-capability-enforcement.patch b/meta-app-framework/recipes-support/libcap/libcap/removing-capability-enforcement.patch deleted file mode 100644 index fa359fa87..000000000 --- a/meta-app-framework/recipes-support/libcap/libcap/removing-capability-enforcement.patch +++ /dev/null @@ -1,87 +0,0 @@ -From c34b2725817d4fd1fd6878bbb16617cb9e3e3a70 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo@iot.bzh> -Date: Fri, 22 Jan 2016 16:23:59 +0100 -Subject: [PATCH] removing capability enforcement - -Signed-off-by: ronan <ronan@iot.bzh> - -Change-Id: Idb724192ceab176a611bbed45c0ebc9c8eb5dd30 ---- - progs/setcap.c | 45 +-------------------------------------------- - 1 file changed, 1 insertion(+), 44 deletions(-) - -diff --git a/progs/setcap.c b/progs/setcap.c -index 7304343..71999b6 100644 ---- a/progs/setcap.c -+++ b/progs/setcap.c -@@ -58,11 +58,9 @@ static int read_caps(int quiet, const char *filename, char *buffer) - - int main(int argc, char **argv) - { -- int tried_to_cap_setfcap = 0; - char buffer[MAXCAP+1]; - int retval, quiet=0, verify=0; - cap_t mycaps; -- cap_value_t capflag; - - if (argc < 3) { - usage(); -@@ -150,54 +148,13 @@ int main(int argc, char **argv) - printf("%s: OK\n", *argv); - } - } else { -- if (!tried_to_cap_setfcap) { -- capflag = CAP_SETFCAP; -- -- /* -- * Raise the effective CAP_SETFCAP. -- */ -- if (cap_set_flag(mycaps, CAP_EFFECTIVE, 1, &capflag, CAP_SET) -- != 0) { -- perror("unable to manipulate CAP_SETFCAP - " -- "try a newer libcap?"); -- exit(1); -- } -- if (cap_set_proc(mycaps) != 0) { -- perror("unable to set CAP_SETFCAP effective capability"); -- exit(1); -- } -- tried_to_cap_setfcap = 1; -- } - retval = cap_set_file(*++argv, cap_d); - if (retval != 0) { -- int explained = 0; - int oerrno = errno; --#ifdef linux -- cap_value_t cap; -- cap_flag_value_t per_state; -- -- for (cap = 0; -- cap_get_flag(cap_d, cap, CAP_PERMITTED, &per_state) != -1; -- cap++) { -- cap_flag_value_t inh_state, eff_state; -- -- cap_get_flag(cap_d, cap, CAP_INHERITABLE, &inh_state); -- cap_get_flag(cap_d, cap, CAP_EFFECTIVE, &eff_state); -- if ((inh_state | per_state) != eff_state) { -- fprintf(stderr, "NOTE: Under Linux, effective file capabilities must either be empty, or\n" -- " exactly match the union of selected permitted and inheritable bits.\n"); -- explained = 1; -- break; -- } -- } --#endif /* def linux */ -- - fprintf(stderr, - "Failed to set capabilities on file `%s' (%s)\n", - argv[0], strerror(oerrno)); -- if (!explained) { -- usage(); -- } -+ - } - } - if (cap_d) { --- -2.6.6 - diff --git a/meta-app-framework/recipes-support/libcap/libcap_%.bbappend b/meta-app-framework/recipes-support/libcap/libcap_%.bbappend deleted file mode 100644 index 6107ee7f6..000000000 --- a/meta-app-framework/recipes-support/libcap/libcap_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'libcap_appfw.inc', '', d)} diff --git a/meta-app-framework/recipes-support/libcap/libcap_appfw.inc b/meta-app-framework/recipes-support/libcap/libcap_appfw.inc deleted file mode 100644 index a33fd99b2..000000000 --- a/meta-app-framework/recipes-support/libcap/libcap_appfw.inc +++ /dev/null @@ -1,3 +0,0 @@ -FILESEXTRAPATHS:append:class-native := ":${THISDIR}/libcap" -# FIXME: It needs to be determined if this is still required -#SRC_URI:append:class-native = " file://removing-capability-enforcement.patch" diff --git a/meta-app-framework/recipes-support/libzip/libzip_%.bbappend b/meta-app-framework/recipes-support/libzip/libzip_%.bbappend deleted file mode 100644 index d559c2fbe..000000000 --- a/meta-app-framework/recipes-support/libzip/libzip_%.bbappend +++ /dev/null @@ -1 +0,0 @@ -require ${@bb.utils.contains('APPFW_ENABLED', '1', 'libzip_appfw.inc', '', d)} diff --git a/meta-app-framework/recipes-support/libzip/libzip_appfw.inc b/meta-app-framework/recipes-support/libzip/libzip_appfw.inc deleted file mode 100644 index 5174650b1..000000000 --- a/meta-app-framework/recipes-support/libzip/libzip_appfw.inc +++ /dev/null @@ -1 +0,0 @@ -BBCLASSEXTEND += "native nativesdk" diff --git a/meta-app-framework/recipes-test/afb-test/afb-test_git.bb b/meta-app-framework/recipes-test/afb-test/afb-test_git.bb deleted file mode 100644 index 6fd1424e4..000000000 --- a/meta-app-framework/recipes-test/afb-test/afb-test_git.bb +++ /dev/null @@ -1,25 +0,0 @@ -SUMMARY = "Binding embedding test framework to test others binding" -DESCRIPTION = "This make testing binding running with Application Framework binder \ -easier by simply test verb return as well as event reception." -HOMEPAGE = "https://gerrit.automotivelinux.org/gerrit/#/admin/projects/apps/app-afb-test" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" -SECTION = "apps" - -SRC_URI = "git://gerrit.automotivelinux.org/gerrit/apps/app-afb-test;protocol=https;branch=${AGL_BRANCH}" -SRCREV = "${AGL_APP_REVISION}" - -DEPENDS += "lua libafb-helpers libappcontroller" -RDEPENDS:${PN} += "lua bash jq" -RDEPENDS:${PN}-ptest += "af-binder" - -PV = "${AGLVERSION}" -S = "${WORKDIR}/git" - -inherit cmake aglwgt pkgconfig ptest - -do_install:append() { - install -d ${D}${bindir} - install -m 775 ${S}/afm-test.target.sh ${D}${bindir}/afm-test -} - diff --git a/meta-app-framework/recipes-test/afb-test/files/run-ptest b/meta-app-framework/recipes-test/afb-test/files/run-ptest deleted file mode 100644 index 883939a83..000000000 --- a/meta-app-framework/recipes-test/afb-test/files/run-ptest +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -afm-test /usr/AGL/apps/testwgt/aftest-test.wgt diff --git a/meta-app-framework/scripts/run-yocto-check-layer-enabled-flags.sh b/meta-app-framework/scripts/run-yocto-check-layer-enabled-flags.sh deleted file mode 100755 index 762a79e83..000000000 --- a/meta-app-framework/scripts/run-yocto-check-layer-enabled-flags.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -set -x -SCRIPTPATH="$( cd $(dirname $0) >/dev/null 2>&1 ; pwd -P )" -echo $SCRIPTPATH -AGLROOT="$SCRIPTPATH/../../.." -POKYDIR="$AGLROOT/external/poky" -TMPROOT="/tmp" - -rm -rf ${TMPROOT}/testbuild-ycl || true -mkdir -p ${TMPROOT}/testbuild-ycl -cd ${TMPROOT}/testbuild-ycl - -source $POKYDIR/oe-init-build-env . - -cat << EOF >> conf/local.conf -# just define defaults -AGL_FEATURES ?= "" -AGL_EXTRA_IMAGE_FSTYPES ?= "" - -# important settings imported from poky-agl.conf -# we do not import -DISTRO_FEATURES:append = " systemd smack" -DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " sysvinit" -VIRTUAL-RUNTIME_init_manager = "systemd" - -# skip unnecessary in yocto-check-layer - aka FIXME upstream -BBMASK += "meta-security/recipes-mac/smack/smack-test_1.0.bb" -BBMASK += "packagegroup-core-security-ptest.bb" - -# missing in upstream recipes ... aka FIXME upstream -BBCLASSEXTEND:pn-libzip = "native nativesdk" -BBCLASSEXTEND:pn-xmlsec1 = "native nativesdk" - -DISTRO_FEATURES:append = " appfw smack " - -EOF - - -yocto-check-layer \ - --dependency $AGLROOT/external/meta-openembedded/meta-oe \ - $AGLROOT/external/meta-security \ - $AGLROOT/external/meta-openembedded/meta-python \ - $AGLROOT/external/meta-openembedded/meta-networking \ - $AGLROOT/external/meta-openembedded/meta-perl \ - $AGLROOT/external/meta-qt5/ \ - -- \ - $AGLROOT/meta-agl/meta-app-framework/ - -[ $? = 0 ] && rm -rf ${TMPROOT}/testbuild-ycl - - diff --git a/meta-app-framework/scripts/run-yocto-check-layer.sh b/meta-app-framework/scripts/run-yocto-check-layer.sh index c324d64f9..cbe35ed8d 100755 --- a/meta-app-framework/scripts/run-yocto-check-layer.sh +++ b/meta-app-framework/scripts/run-yocto-check-layer.sh @@ -1,10 +1,11 @@ #!/bin/bash -set -x +#set -x + SCRIPTPATH="$( cd $(dirname $0) >/dev/null 2>&1 ; pwd -P )" echo $SCRIPTPATH AGLROOT="$SCRIPTPATH/../../.." POKYDIR="$AGLROOT/external/poky" -TMPROOT="/tmp" +TMPROOT=`mktemp -d` rm -rf ${TMPROOT}/testbuild-ycl || true mkdir -p ${TMPROOT}/testbuild-ycl @@ -18,32 +19,25 @@ AGL_FEATURES ?= "" AGL_EXTRA_IMAGE_FSTYPES ?= "" # important settings imported from poky-agl.conf -# we do not import -DISTRO_FEATURES:append = " systemd smack" +# we cannot import the distro config right away +# as the initial values are poky only till the layer +# is added in + +AGL_DEFAULT_DISTRO_FEATURES := "usrmerge largefile opengl wayland pam bluetooth bluez5 3g polkit" +DISTRO_FEATURES:append := " systemd wayland pam \${AGL_DEFAULT_DISTRO_FEATURES}" DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " sysvinit" VIRTUAL-RUNTIME_init_manager = "systemd" -# skip unnecessary in yocto-check-layer - aka FIXME upstream -BBMASK += "meta-security/recipes-mac/smack/smack-test_1.0.bb" -BBMASK += "packagegroup-core-security-ptest.bb" - -# missing in upstream recipes ... aka FIXME upstream -BBCLASSEXTEND:pn-libzip = "native nativesdk" -BBCLASSEXTEND:pn-xmlsec1 = "native nativesdk" - EOF +yocto-check-layer --no-auto-dependency \ + --dependency \ + $AGLROOT/meta-agl/meta-agl-core \ + $AGLROOT/external/meta-openembedded/meta-oe \ + -- \ + $AGLROOT/meta-agl/meta-app-framework -yocto-check-layer \ - --dependency $AGLROOT/external/meta-openembedded/meta-oe \ - $AGLROOT/external/meta-security \ - $AGLROOT/external/meta-openembedded/meta-python \ - $AGLROOT/external/meta-openembedded/meta-networking \ - $AGLROOT/external/meta-openembedded/meta-perl \ - $AGLROOT/external/meta-qt5/ \ - -- \ - $AGLROOT/meta-agl/meta-app-framework/ [ $? = 0 ] && rm -rf ${TMPROOT}/testbuild-ycl - +exit 0 diff --git a/meta-netboot/README b/meta-netboot/README index 7efa22650..a30238b9d 100644 --- a/meta-netboot/README +++ b/meta-netboot/README @@ -3,6 +3,19 @@ meta-netboot This layer contains some recipes and configuration adjustments to allow network boot through NBD (network block device). +Maintenance +----------- + +All patches must be submitted via the AGL Gerrit instance at +https://gerrit.automotivelinux.org. See this wiki page for +details: + +https://wiki.automotivelinux.org/agl-distro/contributing + +Layer maintainers: + Jan-Simon Möller <jsmoeller@linuxfoundation.org> + + Content and usage ----------------- @@ -59,7 +72,7 @@ setenv bootargs_root 'root=/dev/ram0 ramdisk_size=16384 ip=dhcp' setenv bootargs_video 'vmalloc=384M video=HDMI-A-1:1920x1080-32@60' setenv serverip '<your_serverip>' setenv 'bootdaddr' '0x48000000' -setenv 'bootdfile' 'Image-r8a7795-h3ulcb.dtb' +setenv 'bootdfile' 'Image-r8a77951-ulcb.dtb' setenv 'bootdload_net' 'tftp ${bootdaddr} h3ulcb/${bootdfile}' setenv 'bootkaddr' '0x48080000' setenv 'bootkfile' 'Image' diff --git a/meta-netboot/conf/include/agl-netboot.inc b/meta-netboot/conf/include/agl-netboot.inc index 555629537..2c1307e81 100644 --- a/meta-netboot/conf/include/agl-netboot.inc +++ b/meta-netboot/conf/include/agl-netboot.inc @@ -1,3 +1,6 @@ INHERIT += "netboot" -IMAGE_INSTALL:append:netboot = " curl" +IMAGE_INSTALL:append:netboot = " \ + curl \ + ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'resolv-conf-relabel policycoreutils-loadpolicy', '', d)} \ +" diff --git a/meta-netboot/conf/layer.conf b/meta-netboot/conf/layer.conf index 2af752805..ddf63c4a2 100644 --- a/meta-netboot/conf/layer.conf +++ b/meta-netboot/conf/layer.conf @@ -9,5 +9,5 @@ BBFILE_COLLECTIONS += "meta-netboot" BBFILE_PATTERN_meta-netboot = "^${LAYERDIR}/" BBFILE_PRIORITY_meta-netboot = "60" -LAYERSERIES_COMPAT_meta-netboot = "dunfell" +LAYERSERIES_COMPAT_meta-netboot = "kirkstone" LAYERDEPENDS_meta-netboot = "core networking-layer" diff --git a/meta-netboot/recipes-core/initramfs-netboot/files/init.sh b/meta-netboot/recipes-core/initramfs-netboot/files/init.sh index 2b8bc63d0..87a1acb80 100644 --- a/meta-netboot/recipes-core/initramfs-netboot/files/init.sh +++ b/meta-netboot/recipes-core/initramfs-netboot/files/init.sh @@ -21,7 +21,6 @@ EOF # global variables -SMACK=n NBD_SERVER= NBD_PORT=10809 NBD_DEV=/dev/nbd0 @@ -109,17 +108,6 @@ check_debug "Debug point 1. Exit to continue initrd script (mount NBD device)." log_info "NBD parameters: device $NBD_DEV, server $NBD_SERVER:$NBD_PORT" -# check if smack is active (and if so, mount smackfs) -grep -q smackfs /proc/filesystems && { - SMACK=y - - do_mount_fs smackfs /sys/fs/smackfs - - # adjust current label and network label - echo System >/proc/self/attr/current - echo System >/sys/fs/smackfs/ambient -} - # start nbd client try=5 while :;do @@ -165,9 +153,24 @@ fi # also use /proc/net/pnp to generate /etc/resolv.conf rm -f /etc/resolv.conf grep -v bootserver /proc/net/pnp | sed 's/^domain/search/g' >/etc/resolv.conf -chsmack -A /etc/resolv.conf -# unmount tmp and run to let systemd remount them with correct smack labels (SPEC-2596) +# Do SELinux relabeling if required, to avoid a reboot that would complicate CI +if [ -f /.autorelabel ]; then + # Nothing SELinux related works w/o the fs mounted + do_mount_fs selinuxfs /sys/fs/selinux + + # Labeling requires the policy to be loaded + log_info "Loading SELinux policy" + /usr/sbin/load_policy + + /usr/bin/selinux-autorelabel.sh + + # Will get remounted by systemd startup, unmount to keep that behavior + # more like the non-netboot case. + umount /sys/fs/selinux +fi + +# unmount tmp and run to let systemd remount them log_info "Unmounting /tmp and /run" umount /tmp umount /run diff --git a/meta-netboot/recipes-core/initramfs-netboot/initramfs-netboot_1.0.bb b/meta-netboot/recipes-core/initramfs-netboot/initramfs-netboot_1.0.bb index 264b21492..dd61a1ea8 100644 --- a/meta-netboot/recipes-core/initramfs-netboot/initramfs-netboot_1.0.bb +++ b/meta-netboot/recipes-core/initramfs-netboot/initramfs-netboot_1.0.bb @@ -8,14 +8,14 @@ S = "${WORKDIR}" RDEPENDS:${PN} += "nbd-client" do_install() { - install -dm 0755 ${D}/etc - touch ${D}/etc/initrd-release + install -dm 0755 ${D}${sysconfdir} + touch ${D}${sysconfdir}/initrd-release install -dm 0755 ${D}/dev - install -dm 0755 ${D}/sbin - install -m 0755 ${WORKDIR}/init.sh ${D}/sbin/init + install -dm 0755 ${D}${sbindir} + install -m 0755 ${WORKDIR}/init.sh ${D}${sbindir}/init } inherit allarch -FILES:${PN} += " /dev /etc/initrd-release /sbin/init " +FILES:${PN} += " /dev ${sysconfdir}/initrd-release ${sbindir}/init " diff --git a/meta-netboot/recipes-core/systemd/files/resolv-conf-relabel.service b/meta-netboot/recipes-core/systemd/files/resolv-conf-relabel.service new file mode 100644 index 000000000..5d9216cc2 --- /dev/null +++ b/meta-netboot/recipes-core/systemd/files/resolv-conf-relabel.service @@ -0,0 +1,14 @@ +[Unit] +Description=SELinux resolv.conf relabeling +DefaultDependencies=no +ConditionKernelCommandLine=ip +ConditionKernelCommandLine=nbd.server +After=local-fs.target +Before=sysinit.target + +[Service] +Type=oneshot +ExecStart=/usr/sbin/restorecon -Fi /etc/resolv.conf + +[Install] +WantedBy=sysinit.target diff --git a/meta-netboot/recipes-core/systemd/resolv-conf-relabel.bb b/meta-netboot/recipes-core/systemd/resolv-conf-relabel.bb new file mode 100644 index 000000000..36d096b44 --- /dev/null +++ b/meta-netboot/recipes-core/systemd/resolv-conf-relabel.bb @@ -0,0 +1,21 @@ +SUMMARY = "System unit to relabel resolve.conf" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI = "file://resolv-conf-relabel.service" + +inherit systemd allarch features_check + +SYSTEMD_SERVICE:${PN} = "${BPN}.service" + +REQUIRED_DISTRO_FEATURES = "systemd" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +do_install() { + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/resolv-conf-relabel.service ${D}${systemd_system_unitdir}/ +} + +FILES:${PN} += "${systemd_system_unitdir}" diff --git a/meta-netboot/scripts/run-yocto-check-layer-flags-enabled.sh b/meta-netboot/scripts/run-yocto-check-layer-flags-enabled.sh deleted file mode 100755 index cf7a75a30..000000000 --- a/meta-netboot/scripts/run-yocto-check-layer-flags-enabled.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -#set -x - -SCRIPTPATH="$( cd $(dirname $0) >/dev/null 2>&1 ; pwd -P )" -echo $SCRIPTPATH -AGLROOT="$SCRIPTPATH/../../.." -POKYDIR="$AGLROOT/external/poky" -TMPROOT=`mktemp -d` - -rm -rf ${TMPROOT}/testbuild-ycl || true -mkdir -p ${TMPROOT}/testbuild-ycl -cd ${TMPROOT}/testbuild-ycl - -source $POKYDIR/oe-init-build-env . - -cat << EOF >> conf/local.conf -# just define defaults -AGL_FEATURES ?= "" -AGL_EXTRA_IMAGE_FSTYPES ?= "" - -# important settings imported from poky-agl.conf -# we do not import -DISTRO_FEATURES:append = " systemd smack" -DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " sysvinit" -VIRTUAL-RUNTIME_init_manager = "systemd" - -# workaround -# ERROR: Nothing PROVIDES 'smack' (but meta-openembedded/meta-oe/recipes-extended/ostree/ostree_2020.3.bb DEPENDS on or otherwise requires it) -BBMASK += "meta-oe/recipes-extended/ostree/ostree_2020.3.bb" - -NETBOOT_ENABLED = "1" -NETBOOT_FSTYPES ??= "ext4.gz" - -EOF - - -yocto-check-layer \ - --dependency \ - $AGLROOT/external/meta-openembedded/meta-oe \ - $AGLROOT/external/meta-openembedded/meta-python \ - $AGLROOT/external/meta-openembedded/meta-networking \ - -- \ - $AGLROOT/meta-agl/meta-netboot/ - - -[ $? = 0 ] && rm -rf ${TMPROOT}/testbuild-ycl diff --git a/meta-netboot/scripts/run-yocto-check-layer.sh b/meta-netboot/scripts/run-yocto-check-layer.sh index 09e655afb..979c76838 100755 --- a/meta-netboot/scripts/run-yocto-check-layer.sh +++ b/meta-netboot/scripts/run-yocto-check-layer.sh @@ -19,26 +19,26 @@ AGL_FEATURES ?= "" AGL_EXTRA_IMAGE_FSTYPES ?= "" # important settings imported from poky-agl.conf -# we do not import -DISTRO_FEATURES:append = " systemd smack" +# we cannot import the distro config right away +# as the initial values are poky only till the layer +# is added in + +AGL_DEFAULT_DISTRO_FEATURES = "usrmerge largefile opengl wayland pam bluetooth bluez5 3g polkit" +DISTRO_FEATURES:append = " systemd wayland pam \${AGL_DEFAULT_DISTRO_FEATURES}" DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " sysvinit" VIRTUAL-RUNTIME_init_manager = "systemd" -# workaround -# ERROR: Nothing PROVIDES 'smack' (but meta-openembedded/meta-oe/recipes-extended/ostree/ostree_2020.3.bb DEPENDS on or otherwise requires it) -BBMASK += "meta-oe/recipes-extended/ostree/ostree_2020.3.bb" - - EOF - -yocto-check-layer \ +yocto-check-layer --no-auto-dependency \ --dependency \ - $AGLROOT/external/meta-openembedded/meta-oe \ - $AGLROOT/external/meta-openembedded/meta-python \ - $AGLROOT/external/meta-openembedded/meta-networking \ + $AGLROOT/external/meta-openembedded/meta-oe \ + $AGLROOT/external/meta-openembedded/meta-python \ + $AGLROOT/external/meta-openembedded/meta-networking \ -- \ - $AGLROOT/meta-agl/meta-netboot/ + $AGLROOT/meta-agl/meta-netboot [ $? = 0 ] && rm -rf ${TMPROOT}/testbuild-ycl + +exit 0 diff --git a/meta-pipewire/README b/meta-pipewire/README index 410262e3a..3df3a289c 100644 --- a/meta-pipewire/README +++ b/meta-pipewire/README @@ -1,3 +1,16 @@ -This is meta-pipewire. +meta-pipewire +============= -This layer holds the sound manager 'pipewire' and 'wireplumber'. +This layer holds the sound manager 'pipewire' and session manager 'wireplumber'. + +Maintenance +----------- + +All patches must be submitted via the AGL Gerrit instance at +https://gerrit.automotivelinux.org. See this wiki page for +details: + +https://wiki.automotivelinux.org/agl-distro/contributing + +Layer maintainers: + Jan-Simon Möller <jsmoeller@linuxfoundation.org> diff --git a/meta-pipewire/conf/include/agl-pipewire.inc b/meta-pipewire/conf/include/agl-pipewire.inc index 0c585adb0..03b419c2a 100644 --- a/meta-pipewire/conf/include/agl-pipewire.inc +++ b/meta-pipewire/conf/include/agl-pipewire.inc @@ -1,2 +1 @@ DISTRO_FEATURES:append = " pipewire" -PREFERRED_RPROVIDER_virtual/wireplumber-config = "wireplumber-config-agl" diff --git a/meta-pipewire/conf/layer.conf b/meta-pipewire/conf/layer.conf index a4965e5e8..639a3ef43 100644 --- a/meta-pipewire/conf/layer.conf +++ b/meta-pipewire/conf/layer.conf @@ -9,13 +9,8 @@ BBFILE_COLLECTIONS += "meta-pipewire" BBFILE_PATTERN_meta-pipewire = "^${LAYERDIR}/" BBFILE_PRIORITY_meta-pipewire = "71" -LAYERSERIES_COMPAT_meta-pipewire = "dunfell" +LAYERSERIES_COMPAT_meta-pipewire = "kirkstone" LAYERDEPENDS_meta-pipewire = "openembedded-layer" -BBFILES_DYNAMIC += " \ - app-framework:${LAYERDIR}/dynamic-layers/meta-app-framework/*/*/*.bb \ - app-framework:${LAYERDIR}/dynamic-layers/meta-app-framework/*/*/*.bbappend \ -" - # LICENSE_PATH += "${LAYERDIR}/licenses" diff --git a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-apis/agl-service-audiomixer/agl-service-audiomixer_git.bb b/meta-pipewire/dynamic-layers/meta-app-framework/recipes-apis/agl-service-audiomixer/agl-service-audiomixer_git.bb deleted file mode 100644 index f7235c177..000000000 --- a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-apis/agl-service-audiomixer/agl-service-audiomixer_git.bb +++ /dev/null @@ -1,17 +0,0 @@ -SUMMARY = "Audio Mixer Service Binding" -DESCRIPTION = "AGL Audio Mixer Service Binding" -SECTION = "apps" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://LICENSE;beginline=3;md5=e8ad01a5182f2c1b3a2640e9ea268264" - -PV = "0.1+git${SRCPV}" - -SRC_URI = "git://gerrit.automotivelinux.org/gerrit/apps/agl-service-audiomixer.git;protocol=https;branch=${AGL_BRANCH}" -SRCREV = "${AGL_APP_REVISION}" - -S = "${WORKDIR}/git" - -inherit cmake aglwgt pkgconfig - -DEPENDS += "pipewire wireplumber json-c" -RDEPENDS:${PN} = "agl-service-signal-composer" diff --git a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-core/packagegroups/packagegroup-pipewire.bbappend b/meta-pipewire/dynamic-layers/meta-app-framework/recipes-core/packagegroups/packagegroup-pipewire.bbappend deleted file mode 100644 index 691236d41..000000000 --- a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-core/packagegroups/packagegroup-pipewire.bbappend +++ /dev/null @@ -1,3 +0,0 @@ -RDEPENDS:${PN} += " \ - agl-service-audiomixer \ - " diff --git a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/pipewire/pipewire/0001-modules-add-new-access-seclabel-module.patch b/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/pipewire/pipewire/0001-modules-add-new-access-seclabel-module.patch deleted file mode 100644 index 17cb6ec79..000000000 --- a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/pipewire/pipewire/0001-modules-add-new-access-seclabel-module.patch +++ /dev/null @@ -1,263 +0,0 @@ -From b6854927aaf5e5970178ed9b0c6647bb759f2092 Mon Sep 17 00:00:00 2001 -From: George Kiagiadakis <george.kiagiadakis@collabora.com> -Date: Tue, 16 Feb 2021 17:26:20 +0200 -Subject: [PATCH] modules: add new access-seclabel module - -This module allows access control based on the security label -of the client. It is tailored for use with the semantics of SMACK - -Upstream-Status: Inappropriate [smack specific] - ---- - src/modules/meson.build | 10 ++ - src/modules/module-access-seclabel.c | 220 +++++++++++++++++++++++++++ - 2 files changed, 230 insertions(+) - create mode 100644 src/modules/module-access-seclabel.c - -diff --git a/src/modules/meson.build b/src/modules/meson.build -index f51aa29c..21b52d49 100644 ---- a/src/modules/meson.build -+++ b/src/modules/meson.build -@@ -56,6 +56,16 @@ pipewire_module_echo_cancel = shared_library('pipewire-module-echo-cancel', - dependencies : [mathlib, dl_lib, pipewire_dep, webrtc_dep], - ) - -+pipewire_module_access_seclabel = shared_library('pipewire-module-access-seclabel', -+ [ 'module-access-seclabel.c' ], -+ c_args : pipewire_module_c_args, -+ include_directories : [configinc, spa_inc], -+ install : true, -+ install_dir : modules_install_dir, -+ install_rpath: modules_install_dir, -+ dependencies : [mathlib, dl_lib, pipewire_dep], -+) -+ - pipewire_module_profiler = shared_library('pipewire-module-profiler', - [ 'module-profiler.c', - 'module-profiler/protocol-native.c', ], -diff --git a/src/modules/module-access-seclabel.c b/src/modules/module-access-seclabel.c -new file mode 100644 -index 00000000..3739f2e4 ---- /dev/null -+++ b/src/modules/module-access-seclabel.c -@@ -0,0 +1,220 @@ -+/* PipeWire -+ * -+ * Copyright © 2018 Wim Taymans -+ * Copyright © 2021 Collabora Ltd. -+ * @author George Kiagiadakis <george.kiagiadakis@collabora.com> -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining a -+ * copy of this software and associated documentation files (the "Software"), -+ * to deal in the Software without restriction, including without limitation -+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, -+ * and/or sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the next -+ * paragraph) shall be included in all copies or substantial portions of the -+ * Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -+ * DEALINGS IN THE SOFTWARE. -+ */ -+ -+#include <string.h> -+#include <stdio.h> -+#include <errno.h> -+#include <sys/types.h> -+#include <sys/stat.h> -+#include <sys/vfs.h> -+#include <fcntl.h> -+#include <unistd.h> -+ -+#include "config.h" -+ -+#include <spa/utils/result.h> -+#include <spa/utils/json.h> -+ -+#include <pipewire/impl.h> -+#include <pipewire/private.h> -+ -+#define NAME "access-seclabel" -+ -+#define MODULE_USAGE "[ seclabel.allowed=<cmd-line> ] " \ -+ "[ seclabel.rejected=<cmd-line> ] " \ -+ "[ seclabel.restricted=<cmd-line> ] " \ -+ -+static const struct spa_dict_item module_props[] = { -+ { PW_KEY_MODULE_AUTHOR, "George Kiagiadakis <george.kiagiadakis@collabora.com>" }, -+ { PW_KEY_MODULE_DESCRIPTION, "Perform access check based on the security label" }, -+ { PW_KEY_MODULE_USAGE, MODULE_USAGE }, -+ { PW_KEY_MODULE_VERSION, PACKAGE_VERSION }, -+}; -+ -+struct impl { -+ struct pw_context *context; -+ struct pw_properties *properties; -+ -+ struct spa_hook context_listener; -+ struct spa_hook module_listener; -+}; -+ -+static int check_label(const char *label, const char *str) -+{ -+ char key[1024]; -+ int res = 0; -+ struct spa_json it[2]; -+ -+ spa_json_init(&it[0], str, strlen(str)); -+ if ((res = spa_json_enter_array(&it[0], &it[1])) <= 0) -+ goto exit; -+ -+ res = 0; -+ while (spa_json_get_string(&it[1], key, sizeof(key)) > 0) { -+ if (strcmp(label, key) == 0) { -+ res = 1; -+ break; -+ } -+ } -+exit: -+ return res; -+} -+ -+static void -+context_check_access(void *data, struct pw_impl_client *client) -+{ -+ struct impl *impl = data; -+ struct pw_permission permissions[1]; -+ struct spa_dict_item items[2]; -+ const struct pw_properties *props; -+ const char *str, *access, *label = NULL; -+ int res; -+ -+ if ((props = pw_impl_client_get_properties(client)) != NULL) { -+ if ((str = pw_properties_get(props, PW_KEY_ACCESS)) != NULL) { -+ pw_log_info(NAME " client %p: has already access: '%s'", client, str); -+ return; -+ } -+ label = pw_properties_get(props, PW_KEY_SEC_LABEL); -+ } -+ -+ if (!label) { -+ pw_log_info(NAME " client %p: has no security label", client); -+ return; -+ } -+ -+ if (impl->properties && (str = pw_properties_get(impl->properties, "seclabel.allowed")) != NULL) { -+ res = check_label(label, str); -+ if (res < 0) { -+ pw_log_warn(NAME" %p: client %p allowed check failed: %s", -+ impl, client, spa_strerror(res)); -+ } else if (res > 0) { -+ access = "allowed"; -+ goto granted; -+ } -+ } -+ -+ if (impl->properties && (str = pw_properties_get(impl->properties, "seclabel.rejected")) != NULL) { -+ res = check_label(label, str); -+ if (res < 0) { -+ pw_log_warn(NAME" %p: client %p rejected check failed: %s", -+ impl, client, spa_strerror(res)); -+ } else if (res > 0) { -+ res = -EACCES; -+ access = "rejected"; -+ goto rejected; -+ } -+ } -+ -+ if (impl->properties && (str = pw_properties_get(impl->properties, "seclabel.restricted")) != NULL) { -+ res = check_label(label, str); -+ if (res < 0) { -+ pw_log_warn(NAME" %p: client %p restricted check failed: %s", -+ impl, client, spa_strerror(res)); -+ } -+ else if (res > 0) { -+ pw_log_debug(NAME" %p: restricted client %p added", impl, client); -+ access = "restricted"; -+ goto wait_permissions; -+ } -+ } -+ -+ return; -+ -+granted: -+ pw_log_info(NAME" %p: client %p '%s' access granted", impl, client, access); -+ items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, access); -+ pw_impl_client_update_properties(client, &SPA_DICT_INIT(items, 1)); -+ -+ permissions[0] = PW_PERMISSION_INIT(PW_ID_ANY, PW_PERM_ALL); -+ pw_impl_client_update_permissions(client, 1, permissions); -+ return; -+ -+wait_permissions: -+ pw_log_info(NAME " %p: client %p wait for '%s' permissions", -+ impl, client, access); -+ items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, access); -+ pw_impl_client_update_properties(client, &SPA_DICT_INIT(items, 1)); -+ return; -+ -+rejected: -+ pw_resource_error(pw_impl_client_get_core_resource(client), res, access); -+ items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, access); -+ pw_impl_client_update_properties(client, &SPA_DICT_INIT(items, 1)); -+ return; -+} -+ -+static const struct pw_context_events context_events = { -+ PW_VERSION_CONTEXT_EVENTS, -+ .check_access = context_check_access, -+}; -+ -+static void module_destroy(void *data) -+{ -+ struct impl *impl = data; -+ -+ spa_hook_remove(&impl->context_listener); -+ spa_hook_remove(&impl->module_listener); -+ -+ if (impl->properties) -+ pw_properties_free(impl->properties); -+ -+ free(impl); -+} -+ -+static const struct pw_impl_module_events module_events = { -+ PW_VERSION_IMPL_MODULE_EVENTS, -+ .destroy = module_destroy, -+}; -+ -+SPA_EXPORT -+int pipewire__module_init(struct pw_impl_module *module, const char *args) -+{ -+ struct pw_context *context = pw_impl_module_get_context(module); -+ struct pw_properties *props; -+ struct impl *impl; -+ -+ impl = calloc(1, sizeof(struct impl)); -+ if (impl == NULL) -+ return -errno; -+ -+ pw_log_debug(NAME" module %p: new %s", impl, args); -+ -+ if (args) -+ props = pw_properties_new_string(args); -+ else -+ props = NULL; -+ -+ impl->context = context; -+ impl->properties = props; -+ -+ pw_context_add_listener(context, &impl->context_listener, &context_events, impl); -+ pw_impl_module_add_listener(module, &impl->module_listener, &module_events, impl); -+ -+ pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); -+ -+ return 0; -+} diff --git a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/pipewire/pipewire/pipewire.conf b/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/pipewire/pipewire/pipewire.conf deleted file mode 100644 index 5857c4861..000000000 --- a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/pipewire/pipewire/pipewire.conf +++ /dev/null @@ -1,56 +0,0 @@ -context.properties = { - core.daemon = true - core.name = pipewire-0 - support.dbus = false - link.max-buffers = 16 - - # 1=error, 2=warning, 3=info, 4=debug, 5=trace - log.level = 2 - - ## Properties for the DSP configuration. - default.clock.rate = 48000 - default.clock.quantum = 1024 - default.clock.min-quantum = 512 - default.clock.max-quantum = 8192 -} - -context.spa-libs = { - audio.convert.* = audioconvert/libspa-audioconvert - api.alsa.* = alsa/libspa-alsa - api.v4l2.* = v4l2/libspa-v4l2 - support.* = support/libspa-support -} - -context.modules = [ - { name = libpipewire-module-protocol-native } - { name = libpipewire-module-metadata } - { name = libpipewire-module-spa-device-factory } - { name = libpipewire-module-spa-node-factory } - { name = libpipewire-module-client-node } - { name = libpipewire-module-client-device } - { name = libpipewire-module-adapter } - { name = libpipewire-module-link-factory } - { name = libpipewire-module-session-manager } - - # allow clients with the "System" SMACK label - # such a client is also the session manager (wireplumber) - { - name = libpipewire-module-access-seclabel - args= { - seclabel.allowed = [ System ] - } - } - - # and restrict all other clients - { - name = libpipewire-module-access - args= { - access.force = restricted - } - } - - # The profile module. Allows application to access profiler - # and performance data. It provides an interface that is used - # by pw-top and pw-profiler. - #{ name = libpipewire-module-profiler } -] diff --git a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/pipewire/pipewire/pipewire.service b/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/pipewire/pipewire/pipewire.service deleted file mode 100644 index b37fe2551..000000000 --- a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/pipewire/pipewire/pipewire.service +++ /dev/null @@ -1,24 +0,0 @@ -[Unit] -Description=Multimedia Service -Requires=pipewire.socket - -[Service] -LockPersonality=yes -MemoryDenyWriteExecute=yes -NoNewPrivileges=yes -RestrictNamespaces=yes -SystemCallArchitectures=native -SystemCallFilter=@system-service -Type=simple -ExecStart=/usr/bin/pipewire -Restart=on-failure -RuntimeDirectory=pipewire -RuntimeDirectoryPreserve=yes -User=pipewire -Environment=PIPEWIRE_RUNTIME_DIR=%t/pipewire -SmackProcessLabel=System::Pipewire -UMask=0077 - -[Install] -Also=pipewire.socket -WantedBy=default.target diff --git a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/pipewire/pipewire/pipewire.socket b/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/pipewire/pipewire/pipewire.socket deleted file mode 100644 index a83435be4..000000000 --- a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/pipewire/pipewire/pipewire.socket +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=Multimedia System - -[Socket] -Priority=6 -Backlog=5 -ListenStream=%t/pipewire/pipewire-0 -SocketUser=pipewire -SocketGroup=pipewire -SocketMode=0666 -SmackLabel=* -SmackLabelIPIn=System -SmackLabelIPOut=System - -[Install] -WantedBy=sockets.target diff --git a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/pipewire/pipewire/smack-pipewire b/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/pipewire/pipewire/smack-pipewire deleted file mode 100644 index 8d5b541ff..000000000 --- a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/pipewire/pipewire/smack-pipewire +++ /dev/null @@ -1,8 +0,0 @@ -System System::Pipewire rwxa-- -System::Pipewire System -wx--- -System::Pipewire System::Shared r-x--- -System::Pipewire System::Run rwxat- -System::Pipewire System::Log rwxa-- -System::Pipewire _ r-x--l -System::Pipewire User::Home r-x--l -System::Pipewire User::App-Shared rwxat- diff --git a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/pipewire/pipewire_0.3.30.bbappend b/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/pipewire/pipewire_0.3.30.bbappend deleted file mode 100644 index d0d7e9d29..000000000 --- a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/pipewire/pipewire_0.3.30.bbappend +++ /dev/null @@ -1,34 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/pipewire:" - -SRC_URI:append= "\ - file://0001-modules-add-new-access-seclabel-module.patch \ - file://pipewire.conf \ - file://pipewire.service \ - file://pipewire.socket \ - file://smack-pipewire \ -" - -do_install:append() { - # replace the original config with our smack-aware config - mkdir -p ${D}${sysconfdir}/pipewire/ - install -m 0644 ${WORKDIR}/pipewire.conf ${D}${sysconfdir}/pipewire/pipewire.conf - - if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then - # remove the original unit files shipped by pipewire - rm -rf ${D}${systemd_system_unitdir}/pipewire.* - - # install our own system-level templates - mkdir -p ${D}${systemd_system_unitdir}/ - install -m 0644 ${WORKDIR}/pipewire.service ${D}${systemd_system_unitdir}/pipewire.service - install -m 0644 ${WORKDIR}/pipewire.socket ${D}${systemd_system_unitdir}/pipewire.socket - - # install smack rules - mkdir -p ${D}${sysconfdir}/smack/accesses.d - install -m 0644 ${WORKDIR}/smack-pipewire ${D}${sysconfdir}/smack/accesses.d/pipewire - fi -} - -FILES:${PN}:append = "\ - ${sysconfdir}/smack/accesses.d/* \ - ${sysconfdir}/pipewire/pipewire.conf \ -" diff --git a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/wireplumber/wireplumber-config-agl/50-access-agl.lua b/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/wireplumber/wireplumber-config-agl/50-access-agl.lua deleted file mode 100644 index 10b3d7ae3..000000000 --- a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/wireplumber/wireplumber-config-agl/50-access-agl.lua +++ /dev/null @@ -1 +0,0 @@ -load_access("smack") diff --git a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/wireplumber/wireplumber-config-agl/access-smack.lua b/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/wireplumber/wireplumber-config-agl/access-smack.lua deleted file mode 100644 index a662a0f20..000000000 --- a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/wireplumber/wireplumber-config-agl/access-smack.lua +++ /dev/null @@ -1,17 +0,0 @@ -clients_om = ObjectManager { - Interest { - type = "client", - Constraint { "pipewire.access", "=", "restricted" }, - } -} - -clients_om:connect("object-added", function (om, client) - local smack_label = client["global-properties"]["pipewire.sec.label"] - - if smack_label:match("^User::App::.+") then - -- FIXME: apps can work with less permissions - client:update_permissions { ["any"] = "all" } - end -end) - -clients_om:activate() diff --git a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/wireplumber/wireplumber-config-agl_git.bbappend b/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/wireplumber/wireplumber-config-agl_git.bbappend deleted file mode 100644 index 106de4f6a..000000000 --- a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-multimedia/wireplumber/wireplumber-config-agl_git.bbappend +++ /dev/null @@ -1,15 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/wireplumber-config-agl:" - -SRC_URI += "\ - file://50-access-agl.lua \ - file://access-smack.lua \ -" - -do_install:append() { - # install smack-specific config - config_dir="${D}${sysconfdir}/wireplumber/config.lua.d/" - access_dir="${D}${sysconfdir}/wireplumber/scripts/access/" - mkdir -p ${access_dir} - install -m 0644 ${WORKDIR}/50-access-agl.lua ${config_dir} - install -m 0644 ${WORKDIR}/access-smack.lua ${access_dir} -} diff --git a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-security/cynagora/cynagora_%.bbappend b/meta-pipewire/dynamic-layers/meta-app-framework/recipes-security/cynagora/cynagora_%.bbappend deleted file mode 100644 index 9dbf47afc..000000000 --- a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-security/cynagora/cynagora_%.bbappend +++ /dev/null @@ -1,4 +0,0 @@ -do_install:append() { - echo "System::Pipewire * * http://tizen.org/privilege/internal/dbus yes forever" >> ${D}${sysconfdir}/security/cynagora.initial -} - diff --git a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-security/security-manager/security-manager_%.bbappend b/meta-pipewire/dynamic-layers/meta-app-framework/recipes-security/security-manager/security-manager_%.bbappend deleted file mode 100644 index 6ab9d07ef..000000000 --- a/meta-pipewire/dynamic-layers/meta-app-framework/recipes-security/security-manager/security-manager_%.bbappend +++ /dev/null @@ -1,3 +0,0 @@ -do_install:append() { - echo "~APP~ System::Pipewire rw" >> ${D}${datadir}/security-manager/policy/app-rules-template.smack -} diff --git a/meta-pipewire/recipes-core/packagegroups/packagegroup-pipewire-base.bb b/meta-pipewire/recipes-core/packagegroups/packagegroup-pipewire-base.bb new file mode 100644 index 000000000..1d20b4705 --- /dev/null +++ b/meta-pipewire/recipes-core/packagegroups/packagegroup-pipewire-base.bb @@ -0,0 +1,16 @@ +SUMMARY = "PipeWire Media Server Base" +DESCRIPTION = "The set of packages required to use PipeWire API in AGL" +LICENSE = "MIT" + +inherit packagegroup + +PACKAGES = "\ + packagegroup-pipewire-base \ + " + +RDEPENDS:${PN} += "\ + pipewire-spa-plugins-meta \ + pipewire-modules-meta \ + ${@bb.utils.contains('DISTRO_FEATURES', 'agl-devel', 'pipewire-tools pipewire-spa-tools alsa-utils', '', d)} \ + pipewire-alsa \ +" diff --git a/meta-pipewire/recipes-core/packagegroups/packagegroup-pipewire.bb b/meta-pipewire/recipes-core/packagegroups/packagegroup-pipewire.bb index b56723b2b..e7ad14258 100644 --- a/meta-pipewire/recipes-core/packagegroups/packagegroup-pipewire.bb +++ b/meta-pipewire/recipes-core/packagegroups/packagegroup-pipewire.bb @@ -6,6 +6,7 @@ inherit packagegroup PACKAGES = "\ packagegroup-pipewire \ + packagegroup-pipewire-tools \ " RDEPENDS:${PN} += "\ @@ -15,5 +16,9 @@ RDEPENDS:${PN} += "\ pipewire-alsa \ gstreamer1.0-pipewire \ wireplumber \ - ${@bb.utils.contains('DISTRO_FEATURES', 'agl-devel', 'pipewire-tools pipewire-spa-tools', '', d)} \ " + +RDEPENDS:${PN}-tools += "\ + pipewire-tools \ + pipewire-spa-tools \ +"
\ No newline at end of file diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-alsa-plugin-allow-specifying-a-media.role-on-the-vir.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-alsa-plugin-allow-specifying-a-media.role-on-the-vir.patch deleted file mode 100644 index c6cf373c2..000000000 --- a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-alsa-plugin-allow-specifying-a-media.role-on-the-vir.patch +++ /dev/null @@ -1,124 +0,0 @@ -From ff019936a70262c176a4bd950bc80ab84d2a71b0 Mon Sep 17 00:00:00 2001 -From: George Kiagiadakis <george.kiagiadakis@collabora.com> -Date: Tue, 22 Jun 2021 13:23:22 +0300 -Subject: [PATCH] alsa plugin: allow specifying a media.role on the virtual - device name - -So that we can do: - aplay -D pipewire:ROLE=Music music.wav - aplay -D pipewire:ROLE=Notification notice.wav - -Upstream-Status: Backport [from master/0.3.31] ---- - pipewire-alsa/alsa-plugins/pcm_pipewire.c | 14 +++++++++++++- - pipewire-alsa/conf/50-pipewire.conf | 11 ++++++++++- - 2 files changed, 23 insertions(+), 2 deletions(-) - -diff --git a/pipewire-alsa/alsa-plugins/pcm_pipewire.c b/pipewire-alsa/alsa-plugins/pcm_pipewire.c -index 86792d2c7..6ace1b689 100644 ---- a/pipewire-alsa/alsa-plugins/pcm_pipewire.c -+++ b/pipewire-alsa/alsa-plugins/pcm_pipewire.c -@@ -59,6 +59,7 @@ typedef struct { - - char *node_name; - char *target; -+ char *role; - - int fd; - int error; -@@ -509,6 +510,9 @@ static int snd_pcm_pipewire_prepare(snd_pcm_ioplug_t *io) - pw_properties_set(props, PW_KEY_MEDIA_CATEGORY, - io->stream == SND_PCM_STREAM_PLAYBACK ? - "Playback" : "Capture"); -+ if (pw->role != NULL && -+ pw_properties_get(props, PW_KEY_MEDIA_ROLE) == NULL) -+ pw_properties_setf(props, PW_KEY_MEDIA_ROLE, "%s", pw->role); - - pw->stream = pw_stream_new(pw->core, pw->node_name, props); - if (pw->stream == NULL) -@@ -958,6 +962,7 @@ static int snd_pcm_pipewire_open(snd_pcm_t **pcmp, const char *name, - const char *server_name, - const char *playback_node, - const char *capture_node, -+ const char *role, - snd_pcm_stream_t stream, - int mode, - uint32_t flags, -@@ -1013,6 +1018,8 @@ static int snd_pcm_pipewire_open(snd_pcm_t **pcmp, const char *name, - pw->target = capture_node ? strdup(capture_node) : NULL; - } - -+ pw->role = (role && *role) ? strdup(role) : NULL; -+ - pw->main_loop = pw_thread_loop_new("alsa-pipewire", NULL); - if (pw->main_loop == NULL) { - err = -errno; -@@ -1091,6 +1098,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(pipewire) - const char *server_name = NULL; - const char *playback_node = NULL; - const char *capture_node = NULL; -+ const char *role = NULL; - snd_pcm_format_t format = SND_PCM_FORMAT_UNKNOWN; - int rate = 0; - int channels = 0; -@@ -1125,6 +1133,10 @@ SND_PCM_PLUGIN_DEFINE_FUNC(pipewire) - snd_config_get_string(n, &capture_node); - continue; - } -+ if (spa_streq(id, "role")) { -+ snd_config_get_string(n, &role); -+ continue; -+ } - if (spa_streq(id, "exclusive")) { - if (snd_config_get_bool(n)) - flags |= PW_STREAM_FLAG_EXCLUSIVE; -@@ -1174,7 +1186,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(pipewire) - } - - err = snd_pcm_pipewire_open(pcmp, name, node_name, server_name, playback_node, -- capture_node, stream, mode, flags, rate, format, -+ capture_node, role, stream, mode, flags, rate, format, - channels, period_bytes); - - return err; -diff --git a/pipewire-alsa/conf/50-pipewire.conf b/pipewire-alsa/conf/50-pipewire.conf -index 2c6f2d259..f7e58472b 100644 ---- a/pipewire-alsa/conf/50-pipewire.conf -+++ b/pipewire-alsa/conf/50-pipewire.conf -@@ -3,9 +3,10 @@ - defaults.pipewire.server "pipewire-0" - defaults.pipewire.node "-1" - defaults.pipewire.exclusive false -+defaults.pipewire.role "" - - pcm.pipewire { -- @args [ SERVER NODE EXCLUSIVE ] -+ @args [ SERVER NODE EXCLUSIVE ROLE ] - @args.SERVER { - type string - default { -@@ -27,6 +28,13 @@ pcm.pipewire { - name defaults.pipewire.exclusive - } - } -+ @args.ROLE { -+ type string -+ default { -+ @func refer -+ name defaults.pipewire.role -+ } -+ } - - - type pipewire -@@ -34,6 +42,7 @@ pcm.pipewire { - playback_node $NODE - capture_node $NODE - exclusive $EXCLUSIVE -+ role $ROLE - hint { - show on - description "PipeWire Sound Server" --- -2.30.2 - diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-null-sink-make-the-timerfd-non-blocking.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-null-sink-make-the-timerfd-non-blocking.patch deleted file mode 100644 index 71e526f86..000000000 --- a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-null-sink-make-the-timerfd-non-blocking.patch +++ /dev/null @@ -1,43 +0,0 @@ -From c633004bf310998580ff8944c59d94689d6fca87 Mon Sep 17 00:00:00 2001 -From: George Kiagiadakis <george.kiagiadakis@collabora.com> -Date: Thu, 1 Jul 2021 11:37:01 +0300 -Subject: [PATCH] null-sink: make the timerfd non-blocking - -Fixes #1377 - -Upstream-Status: Backport [from master/0.3.32] -Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com> ---- - spa/plugins/support/null-audio-sink.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/spa/plugins/support/null-audio-sink.c b/spa/plugins/support/null-audio-sink.c -index e9588f1e2..12e671db8 100644 ---- a/spa/plugins/support/null-audio-sink.c -+++ b/spa/plugins/support/null-audio-sink.c -@@ -221,8 +221,11 @@ static void on_timeout(struct spa_source *source) - spa_log_trace(this->log, "timeout"); - - if (spa_system_timerfd_read(this->data_system, -- this->timer_source.fd, &expirations) < 0) -+ this->timer_source.fd, &expirations) < 0) { -+ if (errno == EAGAIN) -+ return; - perror("read timerfd"); -+ } - - nsec = this->next_time; - -@@ -818,7 +821,8 @@ impl_init(const struct spa_handle_factory *factory, - - this->timer_source.func = on_timeout; - this->timer_source.data = this; -- this->timer_source.fd = spa_system_timerfd_create(this->data_system, CLOCK_MONOTONIC, SPA_FD_CLOEXEC); -+ this->timer_source.fd = spa_system_timerfd_create(this->data_system, CLOCK_MONOTONIC, -+ SPA_FD_CLOEXEC | SPA_FD_NONBLOCK); - this->timer_source.mask = SPA_IO_IN; - this->timer_source.rmask = 0; - this->timerspec.it_value.tv_sec = 0; --- -2.30.2 - diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-systemd-Do-not-override-rootprefix.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-systemd-Do-not-override-rootprefix.patch new file mode 100644 index 000000000..45d09e6b0 --- /dev/null +++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0001-systemd-Do-not-override-rootprefix.patch @@ -0,0 +1,35 @@ +From 2501972518a67b1710998452d164cd077a4370f1 Mon Sep 17 00:00:00 2001 +From: Scott Murray <scott.murray@konsulko.com> +Date: Thu, 17 Mar 2022 10:44:00 -0400 +Subject: [PATCH] systemd: Do not override rootprefix + +Do not override rootprefix with the value of prefix when querying +systemdsystemunitdir from the systemd pkgconfig, as doing so forces +the assumption that the system is running with usrmerge, which may +not be the case. Instead, rely on the systemd.pc correctly +representing the desired install locations. + +Reworked version of change in: + +https://git.automotivelinux.org/AGL/meta-agl/tree/meta-pipewire/recipes-multimedia/pipewire/pipewire/0012-Miscellanous-changes-to-account-for-lower-version-of.patch + +Upstream-Status: Pending + +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +--- + src/daemon/systemd/system/meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/daemon/systemd/system/meson.build b/src/daemon/systemd/system/meson.build +index 84ca0b068..6956f2be3 100644 +--- a/src/daemon/systemd/system/meson.build ++++ b/src/daemon/systemd/system/meson.build +@@ -1,4 +1,4 @@ +-systemd_system_services_dir = systemd.get_variable('systemdsystemunitdir', pkgconfig_define : [ 'rootprefix', prefix]) ++systemd_system_services_dir = systemd.get_variable('systemdsystemunitdir') + if get_option('systemd-system-unit-dir') != '' + systemd_system_services_dir = get_option('systemd-system-unit-dir') + endif +-- +2.35.1 + diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0002-node-driver-make-the-timerfd-non-blocking.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0002-node-driver-make-the-timerfd-non-blocking.patch deleted file mode 100644 index 5a59d8676..000000000 --- a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0002-node-driver-make-the-timerfd-non-blocking.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 5aa9c953909b936ba215ebca77461a17160f59fb Mon Sep 17 00:00:00 2001 -From: George Kiagiadakis <george.kiagiadakis@collabora.com> -Date: Thu, 1 Jul 2021 11:50:40 +0300 -Subject: [PATCH] node-driver: make the timerfd non-blocking - -Relates to #1377 - -Upstream-Status: Backport [from master/0.3.32] -Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com> ---- - spa/plugins/support/node-driver.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/spa/plugins/support/node-driver.c b/spa/plugins/support/node-driver.c -index 34533d0d9..32964110d 100644 ---- a/spa/plugins/support/node-driver.c -+++ b/spa/plugins/support/node-driver.c -@@ -119,8 +119,11 @@ static void on_timeout(struct spa_source *source) - spa_log_trace(this->log, "timeout"); - - if (spa_system_timerfd_read(this->data_system, -- this->timer_source.fd, &expirations) < 0) -+ this->timer_source.fd, &expirations) < 0) { -+ if (errno == EAGAIN) -+ return; - perror("read timerfd"); -+ } - - nsec = this->next_time; - -@@ -349,7 +352,8 @@ impl_init(const struct spa_handle_factory *factory, - - this->timer_source.func = on_timeout; - this->timer_source.data = this; -- this->timer_source.fd = spa_system_timerfd_create(this->data_system, CLOCK_MONOTONIC, SPA_FD_CLOEXEC); -+ this->timer_source.fd = spa_system_timerfd_create(this->data_system, CLOCK_MONOTONIC, -+ SPA_FD_CLOEXEC | SPA_FD_NONBLOCK); - this->timer_source.mask = SPA_IO_IN; - this->timer_source.rmask = 0; - this->timerspec.it_value.tv_sec = 0; --- -2.30.2 - diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire_0.3.30.bb b/meta-pipewire/recipes-multimedia/pipewire/pipewire_1.0.0.bb index 08f0eba35..641c97e8f 100644 --- a/meta-pipewire/recipes-multimedia/pipewire/pipewire_0.3.30.bb +++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire_1.0.0.bb @@ -20,7 +20,8 @@ SECTION = "multimedia" DEPENDS = "dbus" -SRCREV = "e857856be7b64d562cdcc01c43933218a68b225e" +# v1.0.0(El Presidente) +SRCREV = "4debdcd40b055b3eaa83a8f4443aa990ea566bfe" SRC_URI = "git://gitlab.freedesktop.org/pipewire/pipewire.git;branch=master;protocol=https" S = "${WORKDIR}/git" @@ -52,6 +53,11 @@ USERADD_PARAM:${PN} = "--system --home / --no-create-home \ # instance does. # # manpage generation requires xmltoman, which is not available. +# +# Dont build any session managers along with pipewire +# wireplumber is the session manger used in AGL and it will +# be build in a different recipe +# EXTRA_OEMESON += " \ -Daudiotestsrc=enabled \ -Devl=disabled \ @@ -63,6 +69,7 @@ EXTRA_OEMESON += " \ -Dvulkan=disabled \ -Dlibcamera=disabled \ -Dman=disabled \ + -Dsession-managers=[] \ " PACKAGECONFIG ??= "\ @@ -88,6 +95,7 @@ PACKAGECONFIG[systemd] = "-Dsystemd=enabled -Dsystemd-system-service=enabled ,-D PACKAGECONFIG[v4l2] = "-Dv4l2=enabled,-Dv4l2=disabled,udev" PACKAGECONFIG[pipewire-alsa] = "-Dpipewire-alsa=enabled,-Dpipewire-alsa=disabled,alsa-lib" PACKAGECONFIG[pipewire-jack] = "-Dpipewire-jack=enabled -Dlibjack-path=${libdir}/${PW_MODULE_SUBDIR}/jack,-Dpipewire-jack=disabled,jack,,,jack" +PACKAGECONFIG[pipewire-v4l2] = "-Dpipewire-v4l2=enabled -Dpipewire-v4l2=${libdir}/${PW_MODULE_SUBDIR}/v4l2,-Dpipewire-v4l2=disabled,v4l2" PACKAGESPLITFUNCS:prepend = " split_dynamic_packages " PACKAGESPLITFUNCS:append = " set_dynamic_metapkg_rdepends " @@ -206,7 +214,7 @@ PACKAGES =+ "\ ${PN}-pulse \ ${PN}-alsa \ ${PN}-jack \ - ${PN}-media-session \ + ${PN}-v4l2 \ ${PN}-spa-plugins \ ${PN}-spa-plugins-meta \ ${PN}-spa-tools \ @@ -222,9 +230,20 @@ SYSTEMD_SERVICE:${PN} = "pipewire.service" CONFFILES:${PN} += "${datadir}/pipewire/pipewire.conf" FILES:${PN} = " \ ${datadir}/pipewire/pipewire.conf \ + ${datadir}/pipewire/filter-chain.conf \ ${datadir}/pipewire/filter-chain \ ${systemd_user_unitdir}/pipewire.* \ + ${systemd_system_unitdir}/pipewire* \ ${bindir}/pipewire \ + ${datadir}/pipewire/pipewire-avb.conf \ + ${bindir}/pipewire-avb \ + ${datadir}/pipewire/pipewire-aes67.conf \ + ${bindir}/pipewire-aes67 \ + ${datadir}/pipewire/pipewire.conf.avail \ + ${datadir}/pipewire/pipewire-pulse.conf.avail \ + ${datadir}/pipewire/client-rt.conf.avail \ + ${datadir}/pipewire/client.conf.avail \ + ${sysconfdir}/security/limits.d \ " FILES:${PN}-dev += " \ @@ -234,6 +253,8 @@ FILES:${PN}-dev += " \ CONFFILES:libpipewire += "${datadir}/pipewire/client.conf" FILES:libpipewire = " \ ${datadir}/pipewire/client.conf \ + ${datadir}/pipewire/client-rt.conf \ + ${datadir}/pipewire/minimal.conf \ ${libdir}/libpipewire-*.so.* \ " # Add the bare minimum modules and plugins required to be able @@ -268,25 +289,21 @@ FILES:${PN}-alsa = "\ ${datadir}/alsa/alsa.conf.d/* \ " +#lib to emulate v4l2 system calls on top of PipeWire +FILES:${PN}-v4l2 = "\ + ${libdir}/${PW_MODULE_SUBDIR}/v4l2/libpw-v4l2.so \ +" + # jack drop-in libraries to redirect audio to pipewire CONFFILES:${PN}-jack = "${datadir}/pipewire/jack.conf" FILES:${PN}-jack = "\ ${datadir}/pipewire/jack.conf \ ${libdir}/${PW_MODULE_SUBDIR}/jack/libjack*.so.* \ " - -# Example session manager. Not intended for use in production. -CONFFILES:${PN}-media-session = "${datadir}/pipewire/media-session.d/*" -SYSTEMD_SERVICE:${PN}-media-session = "pipewire-media-session.service" -FILES:${PN}-media-session = " \ - ${bindir}/pipewire-media-session \ - ${datadir}/pipewire/media-session.d/* \ - ${systemd_system_unitdir}/pipewire-media-session.service \ -" -RPROVIDES:${PN}-media-session = "virtual/pipewire-sessionmanager" - # Dynamic packages (see set_dynamic_metapkg_rdepends). -FILES:${PN}-spa-plugins = "" +FILES:${PN}-spa-plugins-bluez5 += " \ + ${datadir}/${SPA_SUBDIR}/bluez5/bluez-hardware.conf \ +" RRECOMMENDS:${PN}-spa-plugins += "${PN}-spa-plugins-meta" FILES:${PN}-spa-tools = " \ diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire_0.3.30.bbappend b/meta-pipewire/recipes-multimedia/pipewire/pipewire_1.0.0.bbappend index 53e4bb4b3..beb7c0817 100644 --- a/meta-pipewire/recipes-multimedia/pipewire/pipewire_0.3.30.bbappend +++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire_1.0.0.bbappend @@ -1,3 +1,7 @@ +SRC_URI += "\ + file://0001-systemd-Do-not-override-rootprefix.patch \ +" + PACKAGECONFIG = "\ ${@bb.utils.contains('DISTRO_FEATURES', 'bluez5', 'bluez', '', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'alsa', 'alsa pipewire-alsa', '', d)} \ @@ -6,17 +10,11 @@ PACKAGECONFIG = "\ gstreamer v4l2 \ " -SRC_URI += "\ - file://0001-alsa-plugin-allow-specifying-a-media.role-on-the-vir.patch \ - file://0001-null-sink-make-the-timerfd-non-blocking.patch \ - file://0002-node-driver-make-the-timerfd-non-blocking.patch \ -" - do_install:append() { # install symlinks to alsalib configuration files for i in 50-pipewire.conf 99-pipewire-default.conf; do if [ -f ${D}${datadir}/alsa/alsa.conf.d/${i} ]; then - mkdir -p ${D}${sysconfdir}/alsa/conf.d + install -d ${D}${sysconfdir}/alsa/conf.d ln -s ${datadir}/alsa/alsa.conf.d/${i} ${D}${sysconfdir}/alsa/conf.d/${i} fi done diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/99-load-modules.lua b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/99-load-modules.lua deleted file mode 100644 index 70251aebe..000000000 --- a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/99-load-modules.lua +++ /dev/null @@ -1,27 +0,0 @@ --- Enable local & bluetooth audio devices -alsa_monitor.enable() -bluez_monitor.enable() - --- Load policy -default_policy.enable() - --- Implements storing metadata about objects in RAM -load_module("metadata") - --- Keeps track of the "default" sources and sinks -load_module("default-nodes", { - -- do not store runtime user changes in $HOME - ["use-persistent-storage"] = false, -}) - --- Selects default routes on devices that advertise routes -load_script("default-routes.lua", { - -- do not store runtime user changes in $HOME - ["use-persistent-storage"] = false, -}) - --- Automatically suspends idle nodes after 3 seconds -load_script("suspend-node.lua") - --- Automatically sets device profiles to 'On' -load_module("device-activation") diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/alsa-suspend.lua b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/alsa-suspend.lua new file mode 100644 index 000000000..55edd12cf --- /dev/null +++ b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/alsa-suspend.lua @@ -0,0 +1,45 @@ +-- WirePlumber +-- +-- This script mutes all ALSA sinks when the "suspend.playback" metadata +-- key is set to 1; compliments pipewire-ic-ipc and the respective support +-- for handling "suspend.playback" in the policy scripts +-- +-- Copyright © 2021 Collabora Ltd. +-- @author George Kiagiadakis <george.kiagiadakis@collabora.com> +-- +-- SPDX-License-Identifier: MIT + +mixer_api = Plugin.find("mixer-api") + +nodes_om = ObjectManager { + Interest { type = "node", + Constraint { "media.class", "matches", "Audio/Sink" }, + Constraint { "object.path", "matches", "alsa:pcm:*" }, + }, +} + +metadata_om = ObjectManager { + Interest { type = "metadata", + Constraint { "metadata.name", "=", "default" }, + } +} + +metadata_om:connect("object-added", function (om, metadata) + metadata:connect("changed", function (m, subject, key, t, value) + if key == "suspend.playback" then + local suspended = (value == "1") + + Log.info(string.format("%s ALSA nodes for IC sound", + suspended and "muting" or "unmuting")) + + for n in nodes_om:iterate() do + mixer_api:call("set-volume", n["bound-id"], { + ["mute"] = suspended, + }) + end + end + end) +end) + +nodes_om:activate() +metadata_om:activate() diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/bluetooth.conf b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/bluetooth.conf new file mode 100644 index 000000000..9077e3f45 --- /dev/null +++ b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/bluetooth.conf @@ -0,0 +1,74 @@ +# WirePlumber daemon context configuration # + +context.properties = { + ## Properties to configure the PipeWire context and some modules + + application.name = "WirePlumber Bluetooth" + log.level = 2 + wireplumber.script-engine = lua-scripting + wireplumber.export-core = true + + #mem.mlock-all = false + #support.dbus = true +} + +context.spa-libs = { + #<factory-name regex> = <library-name> + # + # Used to find spa factory names. It maps an spa factory name + # regular expression to a library name that should contain + # that factory. + # + api.bluez5.* = bluez5/libspa-bluez5 + audio.convert.* = audioconvert/libspa-audioconvert + support.* = support/libspa-support +} + +context.modules = [ + #{ name = <module-name> + # [ args = { <key> = <value> ... } ] + # [ flags = [ [ ifexists ] [ nofail ] ] + #} + # + # PipeWire modules to load. + # If ifexists is given, the module is ignored when it is not found. + # If nofail is given, module initialization failures are ignored. + # + + # The native communication protocol. + { name = libpipewire-module-protocol-native } + + # Allows creating nodes that run in the context of the + # client. Is used by all clients that want to provide + # data to PipeWire. + { name = libpipewire-module-client-node } + + # Allows creating devices that run in the context of the + # client. Is used by the session manager. + { name = libpipewire-module-client-device } + + # Makes a factory for wrapping nodes in an adapter with a + # converter and resampler. + { name = libpipewire-module-adapter } + + # Allows applications to create metadata objects. It creates + # a factory for Metadata objects. + { name = libpipewire-module-metadata } + + # Provides factories to make session manager objects. + { name = libpipewire-module-session-manager } +] + +wireplumber.components = [ + #{ name = <component-name>, type = <component-type> } + # + # WirePlumber components to load + # + + # The lua scripting engine + { name = libwireplumber-module-lua-scripting, type = module } + + # The lua configuration file + # Other components are loaded from there + { name = bluetooth.lua, type = config/lua } +] diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/30-bluez-monitor.lua b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/bluetooth.lua.d/30-bluez-monitor.lua index fab9ac0e4..530f4cc62 100644 --- a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/30-bluez-monitor.lua +++ b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/bluetooth.lua.d/30-bluez-monitor.lua @@ -3,13 +3,15 @@ bluez_monitor = {} bluez_monitor.properties = { - -- Enable mSBC support, disabled by default. Be aware that - -- mSBC is not expected to work on all headset + adapter combinations. - -- This can be overloaded for a specific device and native backend - -- in rules section. - --["bluez5.msbc-support"] = false, + -- These features do not work on all headsets, so they are enabled + -- by default based on the hardware database. They can also be + -- forced on/off for all devices by the following options: - --["bluez5.sbc-xq-support"] = true, + --["bluez5.enable-sbc-xq"] = true, + --["bluez5.enable-msbc"] = true, + --["bluez5.enable-hw-volume"] = true, + + -- See bluez-hardware.conf for the hardware database. -- Enabled headset roles (default: [ hsp_hs hfp_ag ]), this -- property only applies to native backend. Currently some headsets @@ -23,7 +25,11 @@ bluez_monitor.properties = { ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]", -- Enabled A2DP codecs (default: all). - --["bluez5.codecs"] = "[ sbc aac ldac aptx aptx_hd ]", + --["bluez5.codecs"] = "[ sbc sbc_xq aac ldac aptx aptx_hd aptx_ll aptx_ll_duplex faststream faststream_duplex ]", + + -- HFP/HSP backend (default: native). + -- Available values: any, none, hsphfpd, ofono, native + ["bluez5.hfphsp-backend"] = "ofono", -- Properties for the A2DP codec configuration --["bluez5.default.rate"] = 48000, @@ -50,9 +56,6 @@ bluez_monitor.rules = { --["bluez5.auto-connect"] = "[ hfp_hf hsp_hs a2dp_sink hfp_ag hsp_ag a2dp_source ]", ["bluez5.auto-connect"] = "[ hfp_hf hsp_hs a2dp_sink ]", - -- Overload mSBC support for native backend and a specific device. - --["bluez5.msbc-support"] = false, - -- Hardware volume control (default: [ hfp_ag hsp_ag a2dp_source ]) --["bluez5.hw-volume"] = "[ hfp_hf hsp_hs a2dp_sink hfp_ag hsp_ag a2dp_source ]", @@ -101,9 +104,7 @@ bluez_monitor.rules = { }, } -function bluez_monitor.enable() - load_monitor("bluez", { - properties = bluez_monitor.properties, - rules = bluez_monitor.rules, - }) -end +load_monitor("bluez", { + properties = bluez_monitor.properties, + rules = bluez_monitor.rules, +}) diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/30-alsa-monitor.lua b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/30-alsa-monitor.lua index 75a169675..75a169675 100644 --- a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/30-alsa-monitor.lua +++ b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/30-alsa-monitor.lua diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/30-v4l2-monitor.lua b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/30-v4l2-monitor.lua new file mode 100644 index 000000000..a4eb58ac8 --- /dev/null +++ b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/30-v4l2-monitor.lua @@ -0,0 +1,48 @@ +-- V4L2 monitor config file -- + +v4l2_monitor = {} +v4l2_monitor.properties = {} + +v4l2_monitor.rules = { + -- An array of matches/actions to evaluate. + { + -- Rules for matching a device or node. It is an array of + -- properties that all need to match the regexp. If any of the + -- matches work, the actions are executed for the object. + matches = { + { + -- This matches all cards. + { "device.name", "matches", "v4l2_device.*" }, + }, + }, + -- Apply properties on the matched object. + apply_properties = { + -- ["device.nick"] = "My Device", + }, + }, + { + matches = { + { + -- Matches all sources. + { "node.name", "matches", "v4l2_input.*" }, + }, + { + -- Matches all sinks. + { "node.name", "matches", "v4l2_output.*" }, + }, + }, + apply_properties = { + --["node.nick"] = "My Node", + --["priority.driver"] = 100, + --["priority.session"] = 100, + --["node.pause-on-idle"] = false, + }, + }, +} + +function v4l2_monitor.enable() + load_monitor("v4l2", { + properties = v4l2_monitor.properties, + rules = v4l2_monitor.rules, + }) +end diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/40-device-defaults.lua b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/40-device-defaults.lua new file mode 100644 index 000000000..e0d332422 --- /dev/null +++ b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/40-device-defaults.lua @@ -0,0 +1,26 @@ +device_defaults = {} + +device_defaults.properties = { + -- store preferences to the file system and restore them at startup; + -- when set to false, default nodes and routes are selected based on + -- their priorities and any runtime changes do not persist after restart + ["use-persistent-storage"] = false, +} + +function device_defaults.enable() + -- Selects appropriate default nodes and enables saving and restoring them + load_module("default-nodes", device_defaults.properties) + + -- Selects appropriate default routes ("ports" in pulseaudio terminology) + -- and enables saving and restoring them together with + -- their properties (per-route/port volume levels, channel maps, etc) + load_script("policy-device-routes.lua", device_defaults.properties) + + if device_defaults.properties["use-persistent-storage"] then + -- Enables functionality to save and restore default device profiles + load_module("default-profile") + + -- Save and restore stream-specific properties + load_script("restore-stream.lua") + end +end diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/90-enable-all.lua b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/90-enable-all.lua new file mode 100644 index 000000000..ecb7da476 --- /dev/null +++ b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/host.lua.d/90-enable-all.lua @@ -0,0 +1,20 @@ +-- Provide the "default" pw_metadata, which stores +-- dynamic properties of pipewire objects in RAM +load_module("metadata") + +-- Load devices +alsa_monitor.enable() +v4l2_monitor.enable() + +-- Track/store/restore user choices about devices +device_defaults.enable() + +-- Automatically suspends idle nodes after 3 seconds +load_script("suspend-node.lua") + +-- Automatically sets device profiles to 'On' +load_script("policy-device-profile.lua") + +-- Mute ALSA sinks when requested by pipewire-ic-ipc +load_module("mixer-api") +load_script("alsa-suspend.lua") diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/wireplumber.conf b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/wireplumber.conf index 530393e23..46ad11302 100644 --- a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/wireplumber.conf +++ b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/wireplumber.conf @@ -57,6 +57,47 @@ context.modules = [ # Provides factories to make session manager objects. { name = libpipewire-module-session-manager } + + { name = libpipewire-module-filter-chain + args = { + node.description = "Equalizer Sink" + media.name = "Equalizer Sink" + filter.graph = { + nodes = [ + { + type = builtin + name = bass + label = bq_lowshelf + # the cut off freq of the bass filter can be adjusted here. + control = { "Freq" = 250.0 "Q" = 1.0 "Gain" = 0.0 } + } + { + type = builtin + name = treble + label = bq_peaking + # the cut off freq of the treble filter can be adjusted here. + control = { "Freq" = 6000.0 "Q" = 1.0 "Gain" = 0.0 } + } + ] + links = [ + { output = "bass:Out" input = "treble:In" } + ] + } + audio.channels = 2 + audio.position = [ FL FR ] + capture.props = { + node.name = "eq-sink" + media.class = Audio/Sink + # select the endpoint to which the node is attached + target.endpoint = "endpoint.multimedia" + node.passive = true + } + playback.props = { + node.name = "eq-output-stream" + node.passive = true + } + } + } ] wireplumber.components = [ @@ -70,5 +111,5 @@ wireplumber.components = [ # The lua configuration file(s) # Other components are loaded from there - { name = config.lua, type = config/lua } + { name = host.lua, type = config/lua } ] diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl_git.bb b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl_git.bb index 2b77df7f2..22ffe5bf3 100644 --- a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl_git.bb +++ b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl_git.bb @@ -6,11 +6,11 @@ SECTION = "multimedia" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" SRC_URI = "\ + file://bluetooth.lua.d/ \ + file://host.lua.d/ \ file://00-functions.lua \ - file://10-default-policy.lua \ - file://30-alsa-monitor.lua \ - file://30-bluez-monitor.lua \ - file://99-load-modules.lua \ + file://alsa-suspend.lua \ + file://bluetooth.conf \ file://wireplumber.conf \ file://wireplumber-bluetooth.conf \ " @@ -19,26 +19,43 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" do_configure[noexec] = "1" do_compile[noexec] = "1" do_install:append() { - config_dir="${D}${sysconfdir}/wireplumber/config.lua.d/" + config_dir="${D}${sysconfdir}/wireplumber/" + scripts_dir="${D}${datadir}/wireplumber/scripts/" dbus_config_dir="${D}${sysconfdir}/dbus-1/system.d/" + systemd_dir="${D}${sysconfdir}/systemd/system/pipewire.service.wants/" install -d ${config_dir} install -m 0644 ${WORKDIR}/00-functions.lua ${config_dir} - install -m 0644 ${WORKDIR}/10-default-policy.lua ${config_dir} - install -m 0644 ${WORKDIR}/30-alsa-monitor.lua ${config_dir} - install -m 0644 ${WORKDIR}/30-bluez-monitor.lua ${config_dir} - install -m 0644 ${WORKDIR}/99-load-modules.lua ${config_dir} - install -m 0644 ${WORKDIR}/wireplumber.conf ${D}${sysconfdir}/wireplumber/ + # config of the main (host) instance + install -d ${config_dir}/host.lua.d/ + ln -s ../00-functions.lua ${config_dir}/host.lua.d/00-functions.lua + install -m 0644 ${WORKDIR}/host.lua.d/*.lua ${config_dir}/host.lua.d/ + install -m 0644 ${WORKDIR}/wireplumber.conf ${config_dir} + # config of the bluetooth instance + install -d ${config_dir}/bluetooth.lua.d/ + ln -s ../00-functions.lua ${config_dir}/bluetooth.lua.d/00-functions.lua + install -m 0644 ${WORKDIR}/bluetooth.lua.d/*.lua ${config_dir}/bluetooth.lua.d/ + install -m 0644 ${WORKDIR}/bluetooth.conf ${config_dir} + + # install the alsa-suspend script, loaded by the main instance + install -d ${scripts_dir} + install -m 0644 ${WORKDIR}/alsa-suspend.lua ${scripts_dir} + + # install dbus daemon configuration install -d ${dbus_config_dir} install -m 0644 ${WORKDIR}/wireplumber-bluetooth.conf ${dbus_config_dir} + + # enable additional systemd services + install -d ${systemd_dir} + ln -s ${systemd_system_unitdir}/wireplumber@.service ${systemd_dir}/wireplumber@bluetooth.service } FILES:${PN} += "\ - ${sysconfdir}/wireplumber/* \ + ${sysconfdir}/* \ + ${datadir}/wireplumber/* \ " CONFFILES:${PN} += "\ - ${sysconfdir}/wireplumber/* \ + ${sysconfdir}/* \ " -RPROVIDES:${PN} += "virtual/wireplumber-config" diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-policy-config-agl/00-functions.lua b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-policy-config-agl/00-functions.lua new file mode 100644 index 000000000..7e1794df0 --- /dev/null +++ b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-policy-config-agl/00-functions.lua @@ -0,0 +1,27 @@ +components = {} + +function load_module(m) + if not components[m] then + components[m] = { "libwireplumber-module-" .. m, type = "module" } + end +end + +function load_pw_module(m) + if not components[m] then + components[m] = { "libpipewire-module-" .. m, type = "pw_module" } + end +end + +function load_script(s, a) + if not components[s] then + components[s] = { s, type = "script/lua", args = a } + end +end + +function load_monitor(s, a) + load_script("monitors/" .. s .. ".lua", a) +end + +function load_access(s, a) + load_script("access/access-" .. s .. ".lua", a) +end diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-policy-config-agl/policy.conf b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-policy-config-agl/policy.conf new file mode 100644 index 000000000..42f714849 --- /dev/null +++ b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-policy-config-agl/policy.conf @@ -0,0 +1,73 @@ +# WirePlumber daemon context configuration # + +context.properties = { + ## Properties to configure the PipeWire context and some modules + + application.name = "WirePlumber Policy" + log.level = 2 + wireplumber.script-engine = lua-scripting + wireplumber.export-core = false + + #mem.mlock-all = false + #support.dbus = true +} + +context.spa-libs = { + #<factory-name regex> = <library-name> + # + # Used to find spa factory names. It maps an spa factory name + # regular expression to a library name that should contain + # that factory. + # + audio.convert.* = audioconvert/libspa-audioconvert + support.* = support/libspa-support +} + +context.modules = [ + #{ name = <module-name> + # [ args = { <key> = <value> ... } ] + # [ flags = [ [ ifexists ] [ nofail ] ] + #} + # + # PipeWire modules to load. + # If ifexists is given, the module is ignored when it is not found. + # If nofail is given, module initialization failures are ignored. + # + + # The native communication protocol. + { name = libpipewire-module-protocol-native } + + # Allows creating nodes that run in the context of the + # client. Is used by all clients that want to provide + # data to PipeWire. + { name = libpipewire-module-client-node } + + # Allows creating devices that run in the context of the + # client. Is used by the session manager. + { name = libpipewire-module-client-device } + + # Makes a factory for wrapping nodes in an adapter with a + # converter and resampler. + { name = libpipewire-module-adapter } + + # Allows applications to create metadata objects. It creates + # a factory for Metadata objects. + { name = libpipewire-module-metadata } + + # Provides factories to make session manager objects. + { name = libpipewire-module-session-manager } +] + +wireplumber.components = [ + #{ name = <component-name>, type = <component-type> } + # + # WirePlumber components to load + # + + # The lua scripting engine + { name = libwireplumber-module-lua-scripting, type = module } + + # The lua configuration file + # Other components are loaded from there + { name = policy.lua, type = config/lua } +] diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/10-default-policy.lua b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-policy-config-agl/policy.lua.d/10-default-policy.lua index f71b31316..6814fce4d 100644 --- a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-config-agl/10-default-policy.lua +++ b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-policy-config-agl/policy.lua.d/10-default-policy.lua @@ -1,10 +1,13 @@ --- Default policy config file -- +-- Policy config file -- -default_policy = {} +policy_config = {} -default_policy.endpoints = { +policy_config.endpoints = { -- [endpoint name] = { endpoint properties } - + ["endpoint.capture"] = { + ["media.class"] = "Audio/Source", + ["role"] = "Capture", + }, ["endpoint.multimedia"] = { ["media.class"] = "Audio/Sink", ["role"] = "Multimedia", @@ -39,19 +42,31 @@ default_policy.endpoints = { }, } -default_policy.policy = { +policy_config.policy = { ["move"] = false, -- moves session items when metadata target.node changes ["follow"] = true, -- moves session items to the default device when it has changed + -- Set to 'true' to disable channel splitting & merging on nodes and enable + -- passthrough of audio in the same format as the format of the device. + -- Note that this breaks JACK support; it is generally not recommended + ["audio.no-dsp"] = false, + -- how much to lower the volume of lower priority streams when ducking - -- note that this is a linear volume modifier (not cubic as in the mixer) + -- note that this is a linear volume modifier (not cubic as in pulseaudio) ["duck.level"] = 0.2, ["roles"] = { + ["Capture"] = { + ["alias"] = { "Multimedia", "Music", "Voice", "Capture" }, + ["priority"] = 25, + ["action.default"] = "cork", + ["action.Capture"] = "mix", + ["media.class"] = "Audio/Source", + }, ["Multimedia"] = { ["alias"] = { "Movie", "Music", "Game" }, ["priority"] = 25, - ["action.default"] = "cork", + ["action.default"] = "mix", }, ["Speech-Low"] = { ["priority"] = 30, @@ -92,33 +107,31 @@ default_policy.policy = { }, } -function default_policy.enable() - -- Session item factories, building blocks for the session management graph - -- Do not disable these unless you really know what you are doing - load_module("si-node") - load_module("si-audio-adapter") - load_module("si-standard-link") - load_module("si-audio-endpoint") +-- Session item factories, building blocks for the session management graph +-- Do not disable these unless you really know what you are doing +load_module("si-node") +load_module("si-audio-adapter") +load_module("si-standard-link") +load_module("si-audio-endpoint") - -- API to access default nodes from scripts - load_module("default-nodes-api") +-- API to access default nodes from scripts +load_module("default-nodes-api") - -- API to access mixer controls, needed for volume ducking - load_module("mixer-api") +-- API to access mixer controls, needed for volume ducking +load_module("mixer-api") - -- Create endpoints statically at startup - load_script("static-endpoints.lua", default_policy.endpoints) +-- Create endpoints statically at startup +load_script("static-endpoints.lua", policy_config.endpoints) - -- Create session items for nodes that appear in the graph - load_script("create-item.lua") +-- Create session items for nodes that appear in the graph +load_script("create-item.lua", policy_config.policy) - -- Link nodes to each other to make media flow in the graph - load_script("policy-node.lua", default_policy.policy) +-- Link nodes to each other to make media flow in the graph +load_script("policy-node.lua", policy_config.policy) - -- Link client nodes with endpoints to make media flow in the graph - load_script("policy-endpoint-client.lua", default_policy.policy) - load_script("policy-endpoint-client-links.lua", default_policy.policy) +-- Link client nodes with endpoints to make media flow in the graph +load_script("policy-endpoint-client.lua", policy_config.policy) +load_script("policy-endpoint-client-links.lua", policy_config.policy) - -- Link endpoints with device nodes to make media flow in the graph - load_script("policy-endpoint-device.lua", default_policy.policy) -end +-- Link endpoints with device nodes to make media flow in the graph +load_script("policy-endpoint-device.lua", policy_config.policy) diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-policy-config-agl_git.bb b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-policy-config-agl_git.bb new file mode 100644 index 000000000..1a031160e --- /dev/null +++ b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber-policy-config-agl_git.bb @@ -0,0 +1,41 @@ +SUMMARY = "AGL configuration file for wireplumber policy" +HOMEPAGE = "https://gitlab.freedesktop.org/gkiagia/wireplumber" +BUGTRACKER = "https://jira.automotivelinux.org" +AUTHOR = "Ashok Sidipotu <ashok.sidipotu@collabora.com>" +SECTION = "multimedia" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" +SRC_URI = "\ + file://policy.lua.d \ + file://00-functions.lua \ + file://policy.conf \ +" +PACKAGE_ARCH = "${MACHINE_ARCH}" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" +do_install:append() { + config_dir="${D}${sysconfdir}/wireplumber/" + systemd_dir="${D}${sysconfdir}/systemd/system/pipewire.service.wants" + + install -d ${config_dir} + install -m 0644 ${WORKDIR}/00-functions.lua ${config_dir} + + # config of the policy instance + install -d ${config_dir}/policy.lua.d/ + ln -s ../00-functions.lua ${config_dir}/policy.lua.d/00-functions.lua + install -m 0644 ${WORKDIR}/policy.lua.d/*.lua ${config_dir}/policy.lua.d/ + install -m 0644 ${WORKDIR}/policy.conf ${config_dir} + + # enable additional systemd services + install -d ${systemd_dir} + ln -s ${systemd_system_unitdir}/wireplumber@.service ${systemd_dir}/wireplumber@policy.service +} + +FILES:${PN} += "\ + ${sysconfdir}/* \ + ${datadir}/wireplumber/* \ +" +CONFFILES:${PN} += "\ + ${sysconfdir}/* \ +" diff --git a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber_git.bb b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber_git.bb index 6f21b258c..a04f115c3 100644 --- a/meta-pipewire/recipes-multimedia/wireplumber/wireplumber_git.bb +++ b/meta-pipewire/recipes-multimedia/wireplumber/wireplumber_git.bb @@ -14,9 +14,14 @@ DEPENDS = "glib-2.0 glib-2.0-native pipewire lua" SRC_URI = "\ git://gitlab.freedesktop.org/pipewire/wireplumber.git;protocol=https;branch=master \ " -SRCREV = "4af7e2bd68c4862bb707b62edf7557df56dad10f" +# v0.4.17 +SRCREV = "d3eb77b292655cef333a8f4cab4e861415bc37c2" -PV = "0.4.0" +# patches to be able to compile with lower version of meson that is available in AGL. +SRC_URI += "\ +" + +PV = "0.4.17" S = "${WORKDIR}/git" WPAPI="0.4" @@ -38,7 +43,7 @@ PACKAGECONFIG[systemd] = "-Dsystemd=enabled -Dsystemd-system-service=true -Dsyst do_configure:prepend() { # relax meson version requirement # we only need 0.54 when building with -Dsystem-lua=false - sed "s/meson_version : '>= 0.54.0'/meson_version : '>= 0.51.0'/" ${S}/meson.build > ${S}/tmp.build + sed "s/meson_version : '>= 0.56.0'/meson_version : '>= 0.53.2'/" ${S}/meson.build > ${S}/tmp.build mv -f ${S}/tmp.build ${S}/meson.build } @@ -53,11 +58,10 @@ FILES:${PN} = "\ ${bindir}/wpctl \ ${bindir}/wpexec \ ${libdir}/wireplumber-${WPAPI}/* \ - ${datadir}/wireplumber/* \ + ${datadir}/wireplumber/scripts/* \ + ${datadir}/zsh/* \ ${systemd_system_unitdir}/* \ " -RPROVIDES:${PN} += "virtual/pipewire-sessionmanager" -RDEPENDS:${PN} += "virtual/wireplumber-config" FILES:lib${PN}-${WPAPI} = "\ ${libdir}/libwireplumber-${WPAPI}.so.* \ @@ -65,8 +69,17 @@ FILES:lib${PN}-${WPAPI} = "\ FILES:${PN}-config += "\ ${sysconfdir}/wireplumber/* \ + ${datadir}/wireplumber/*conf \ + ${datadir}/wireplumber/common/* \ + ${datadir}/wireplumber/main.lua.d/* \ + ${datadir}/wireplumber/bluetooth.lua.d/* \ + ${datadir}/wireplumber/policy.lua.d/* \ " -CONFFILES:${PN}-config += "\ - ${sysconfdir}/wireplumber/* \ -" -RPROVIDES:${PN}-config += "virtual/wireplumber-config" +do_install:append() { + rm -rf ${D}${sysconfdir}/wireplumber/ + rm -f ${D}${datadir}/wireplumber/*conf + rm -rf ${D}${datadir}/wireplumber/common + rm -rf ${D}${datadir}/wireplumber/main.lua.d + rm -rf ${D}${datadir}/wireplumber/bluetooth.lua.d + rm -rf ${D}${datadir}/wireplumber/policy.lua.d +} diff --git a/meta-pipewire/scripts/run-yocto-check-layer.sh b/meta-pipewire/scripts/run-yocto-check-layer.sh index 894153917..0e911a145 100755 --- a/meta-pipewire/scripts/run-yocto-check-layer.sh +++ b/meta-pipewire/scripts/run-yocto-check-layer.sh @@ -19,17 +19,24 @@ AGL_FEATURES ?= "" AGL_EXTRA_IMAGE_FSTYPES ?= "" # important settings imported from poky-agl.conf -# we do not import -DISTRO_FEATURES:append = " systemd smack" +# we cannot import the distro config right away +# as the initial values are poky only till the layer +# is added in + +AGL_DEFAULT_DISTRO_FEATURES = "usrmerge largefile opengl wayland pam bluetooth bluez5 3g polkit" +DISTRO_FEATURES:append = " systemd wayland pam \${AGL_DEFAULT_DISTRO_FEATURES}" DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " sysvinit" VIRTUAL-RUNTIME_init_manager = "systemd" EOF - -yocto-check-layer \ +yocto-check-layer --no-auto-dependency \ + --dependency \ + $AGLROOT/external/meta-openembedded/meta-oe \ -- \ $AGLROOT/meta-agl/meta-pipewire [ $? = 0 ] && rm -rf ${TMPROOT}/testbuild-ycl + +exit 0 diff --git a/scripts/.aglsetup_genconfig.bash b/scripts/.aglsetup_genconfig.bash index cf06622ba..c7ed92e47 100755 --- a/scripts/.aglsetup_genconfig.bash +++ b/scripts/.aglsetup_genconfig.bash @@ -559,12 +559,12 @@ infon "Generating setup file: $BUILDDIR/agl-init-build-env ... " cat <<EOF >$BUILDDIR/agl-init-build-env . $METADIR/external/poky/oe-init-build-env $BUILDDIR if [ -n "\$DL_DIR" ]; then - BB_ENV_EXTRAWHITE="\$BB_ENV_EXTRAWHITE DL_DIR" + BB_ENV_PASSTHROUGH_ADDITIONS="\$BB_ENV_PASSTHROUGH_ADDITIONS DL_DIR" fi if [ -n "\$SSTATE_DIR" ]; then - BB_ENV_EXTRAWHITE="\$BB_ENV_EXTRAWHITE SSTATE_DIR" + BB_ENV_PASSTHROUGH_ADDITIONS="\$BB_ENV_PASSTHROUGH_ADDITIONS SSTATE_DIR" fi -export BB_ENV_EXTRAWHITE +export BB_ENV_PASSTHROUGH_ADDITIONS unset TEMPLATECONF EOF info "OK" diff --git a/scripts/ci-yocto-check-layer.sh b/scripts/ci-yocto-check-layer.sh new file mode 100755 index 000000000..c22114356 --- /dev/null +++ b/scripts/ci-yocto-check-layer.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +pushd . + +pushd meta-agl-core +./scripts/run-yocto-check-layer.sh +popd + +pushd meta-netboot +./scripts/run-yocto-check-layer.sh +popd + +pushd meta-pipewire +./scripts/run-yocto-check-layer.sh +popd + +pushd meta-app-framework +./scripts/run-yocto-check-layer.sh +popd + +popd
\ No newline at end of file diff --git a/scripts/envsetup.sh b/scripts/envsetup.sh index 27b1de19a..f13256a8c 100644 --- a/scripts/envsetup.sh +++ b/scripts/envsetup.sh @@ -75,7 +75,7 @@ else | To support the newest/upcoming features, please use the script aglsetup.sh. | ------------------------------------------------------------------------------ EOF - . $SOURCEDIR/aglsetup.sh -m $1 -b $BUILD_DIR agl-devel agl-netboot agl-appfw-smack agl-demo + . $SOURCEDIR/aglsetup.sh -m $1 -b $BUILD_DIR agl-devel agl-netboot agl-demo rc=$? unset SOURCEDIR unset BUILD_DIR diff --git a/templates/base/01_setup_pkg_revision.sh b/templates/base/01_setup_pkg_revision.sh index cba278d18..a9e4ceb8c 100644 --- a/templates/base/01_setup_pkg_revision.sh +++ b/templates/base/01_setup_pkg_revision.sh @@ -36,7 +36,7 @@ EOF cat <<'EOF' >> $LOCALCONF PKGR = "${PR}${EXTENDPRAUTO}.${AGL_PR}" PKGV = "${@ '${PV}'.replace('AUTOINC','${AGL_PR}')}" -BB_HASHBASE_WHITELIST:append = " PKGR PKGV" +BB_BASEHASH_IGNORE_VARS:append = " PKGR PKGV" EOF ;; value:*) @@ -44,7 +44,7 @@ EOF cat <<'EOF' >> $LOCALCONF PKGR = "${PR}${EXTENDPRAUTO}.${AGL_PR}" PKGV = "${@ '${PV}'.replace('AUTOINC','${AGL_PR}')}" -BB_HASHBASE_WHITELIST:append = " PKGR PKGV" +BB_BASEHASH_IGNORE_VARS:append = " PKGR PKGV" EOF ;; none) diff --git a/templates/base/bblayers.conf.sample b/templates/base/bblayers.conf.sample index f5680622c..e3c5fcc65 100644 --- a/templates/base/bblayers.conf.sample +++ b/templates/base/bblayers.conf.sample @@ -15,6 +15,7 @@ METADIR := "${@os.path.abspath('##OEROOT##/../..')}" YOCTO_LAYERS = " \ ${METADIR}/external/poky/meta \ ${METADIR}/external/poky/meta-poky \ + ${METADIR}/external/meta-lts-mixins_rust \ " # this is added for the boards where necessary, not globally # ${METADIR}/external/poky/meta-yocto-bsp \ @@ -25,7 +26,6 @@ YOCTO_LAYERS = " \ #----------------------------------------------------- AGL_CORE_LAYERS = " \ ${METADIR}/meta-agl/meta-agl-core \ - ${METADIR}/meta-agl/meta-agl-core-test \ ${METADIR}/meta-agl/meta-agl-bsp \ " @@ -40,12 +40,19 @@ AGL_CORE_DEPENDENCY_LAYERS = " \ AGL_META_NETWORKING ?= "" AGL_META_PYTHON ?= "" AGL_META_FILESYSTEMS ?= "" +AGL_META_MULTIMEDIA ?= "" AGL_META_VIRTUALIZATION ?= "" +AGL_META_CLANG ?= "" +AGL_META_QT5 ?= "" + AGL_OTHER_DEPENDENCY_LAYERS = " \ ${AGL_META_NETWORKING} \ ${AGL_META_PYTHON} \ ${AGL_META_FILESYSTEMS} \ + ${AGL_META_MULTIMEDIA} \ ${AGL_META_VIRTUALIZATION} \ + ${AGL_META_CLANG} \ + ${AGL_META_QT5} \ " #################### diff --git a/templates/base/local.conf.sample b/templates/base/local.conf.sample index 337321ec0..7f2c0b11a 100644 --- a/templates/base/local.conf.sample +++ b/templates/base/local.conf.sample @@ -149,11 +149,8 @@ EXTRA_IMAGE_FEATURES ?= "debug-tweaks" # enable extra features. Some available options which can be included in this variable # are: # - 'buildstats' collect build statistics -# - 'image-mklibs' to reduce shared library files size for an image # - 'image-prelink' in order to prelink the filesystem image -# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink -# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended -USER_CLASSES ?= "buildstats image-mklibs image-prelink" +USER_CLASSES ?= "buildstats image-prelink" # # Runtime testing of images @@ -189,7 +186,7 @@ PATCHRESOLVE = "noop" # # Monitor the disk space during the build. If there is less that 1GB of space or less # than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully -# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard halt # of the build. The reason for this is that running completely out of space can corrupt # files and damages the build in ways which may not be easily recoverable. # It's necesary to monitor /tmp, if there is no space left the build will fail @@ -199,10 +196,10 @@ BB_DISKMON_DIRS ??= "\ STOPTASKS,${DL_DIR},1G,100K \ STOPTASKS,${SSTATE_DIR},1G,100K \ STOPTASKS,/tmp,100M,100K \ - ABORT,${TMPDIR},100M,1K \ - ABORT,${DL_DIR},100M,1K \ - ABORT,${SSTATE_DIR},100M,1K \ - ABORT,/tmp,10M,1K" + HALT,${TMPDIR},100M,1K \ + HALT,${DL_DIR},100M,1K \ + HALT,${SSTATE_DIR},100M,1K \ + HALT,/tmp,10M,1K" # # Shared-state files from other locations @@ -340,4 +337,4 @@ PACKAGECONFIG:append:pn-qemu-system-native = " sdl" # CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to # track the version of this file when it was generated. This can safely be ignored if # this doesn't mean anything to you. -CONF_VERSION = "1" +CONF_VERSION = "2" diff --git a/templates/feature/agl-app-framework/50_bblayers.conf.inc b/templates/feature/agl-app-framework/50_bblayers.conf.inc new file mode 100644 index 000000000..e6eacd9d8 --- /dev/null +++ b/templates/feature/agl-app-framework/50_bblayers.conf.inc @@ -0,0 +1,4 @@ + +BBLAYERS =+ " \ + ${METADIR}/meta-agl/meta-app-framework \ + " diff --git a/templates/feature/agl-app-framework/50_local.conf.inc b/templates/feature/agl-app-framework/50_local.conf.inc new file mode 100644 index 000000000..ce541a7b0 --- /dev/null +++ b/templates/feature/agl-app-framework/50_local.conf.inc @@ -0,0 +1,2 @@ +#see meta-agl/meta-app-framework/conf/include/agl-app-framework.inc +require conf/include/agl-app-framework.inc diff --git a/templates/feature/agl-appfw-smack/50_bblayers.conf.inc b/templates/feature/agl-appfw-smack/50_bblayers.conf.inc deleted file mode 100644 index 2e79797e8..000000000 --- a/templates/feature/agl-appfw-smack/50_bblayers.conf.inc +++ /dev/null @@ -1,12 +0,0 @@ -AGL_APPFW_LAYERS = " \ - ${METADIR}/external/meta-security \ - ${METADIR}/external/meta-openembedded/meta-perl \ - ${METADIR}/meta-agl/meta-app-framework \ - " - -BBLAYERS =+ "${AGL_APPFW_LAYERS}" - -# Indirection to avoid duplicate inclusions of the same folder into BBLAYERS -# the evaluation is in the bblayers.conf.sample in meta-agl/templates/base -AGL_META_PYTHON = "${METADIR}/external/meta-openembedded/meta-python" -AGL_META_NETWORKING = "${METADIR}/external/meta-openembedded/meta-networking" diff --git a/templates/feature/agl-appfw-smack/50_local.conf.inc b/templates/feature/agl-appfw-smack/50_local.conf.inc deleted file mode 100644 index 8282a1cae..000000000 --- a/templates/feature/agl-appfw-smack/50_local.conf.inc +++ /dev/null @@ -1 +0,0 @@ -require conf/include/agl-appfw-smack.inc diff --git a/templates/feature/agl-appfw-smack/README_feature_agl-appfw-smack.md b/templates/feature/agl-appfw-smack/README_feature_agl-appfw-smack.md deleted file mode 100644 index c96edac38..000000000 --- a/templates/feature/agl-appfw-smack/README_feature_agl-appfw-smack.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -description: Feature agl-appfw-smack -authors: Jan-Simon Möller <jsmoeller@linuxfoundation.org>, José Bollo <jose.bollo@iot.bzh>, Ronan Le Martret <ronan.lemartret@iot.bzh>, Stephane Desneux <stephane.desneux@iot.bzh> ---- - -### Feature agl-appfw-smack - -*Description is missing - please complete file meta-agl/templates/feature/agl-appfw-smack/README_feature_agl-appfw-smack.md* - diff --git a/templates/feature/agl-ci-change-features-nogfx/included.dep b/templates/feature/agl-ci-change-features-nogfx/included.dep index 64e2103ca..27e9852f7 100644 --- a/templates/feature/agl-ci-change-features-nogfx/included.dep +++ b/templates/feature/agl-ci-change-features-nogfx/included.dep @@ -1 +1 @@ -agl-demo agl-devel agl-netboot agl-pipewire agl-cloudproxy agl-buildstats agl-ptest +agl-demo agl-devel agl-netboot agl-pipewire agl-buildstats agl-ptest diff --git a/templates/feature/agl-ci-change-features/included.dep b/templates/feature/agl-ci-change-features/included.dep index 64e2103ca..27e9852f7 100644 --- a/templates/feature/agl-ci-change-features/included.dep +++ b/templates/feature/agl-ci-change-features/included.dep @@ -1 +1 @@ -agl-demo agl-devel agl-netboot agl-pipewire agl-cloudproxy agl-buildstats agl-ptest +agl-demo agl-devel agl-netboot agl-pipewire agl-buildstats agl-ptest diff --git a/templates/feature/agl-ci/99_local.conf.inc b/templates/feature/agl-ci/99_local.conf.inc index 3083c0168..1ff8c571b 100644 --- a/templates/feature/agl-ci/99_local.conf.inc +++ b/templates/feature/agl-ci/99_local.conf.inc @@ -1,4 +1,4 @@ -DISTRO_FEATURES:append = " AGLCI" +AGL_FEATURES:append = " AGLCI" # opencv seems to have a parallel make bug # ...contrib/modules/xfeatures2d/test/test_features2d.cpp:51:10: fatal error: features2d/test/test_detectors_regression.impl.hpp: No such file or directory PARALLEL_MAKE:pn-opencv = "-j 1" @@ -24,9 +24,9 @@ INHERIT += "buildstats-summary" AGL_HOST_PRSERV ?= "10.30.72.18" AGL_HOST_HASHSERV ?= "10.30.72.18" -BB_HASHSERVE = "${AGL_HOST_HASHSERV}:8686" +BB_HASHSERVE = "${AGL_HOST_HASHSERV}:8383" BB_SIGNATURE_HANDLER = "OEEquivHash" -PRSERV_HOST = "${AGL_HOST_PRSERV}:8585" +PRSERV_HOST = "${AGL_HOST_PRSERV}:8181" IMAGE_INSTALL:append = " curl" diff --git a/templates/feature/agl-ci/included.dep b/templates/feature/agl-ci/included.dep new file mode 100644 index 000000000..21543697b --- /dev/null +++ b/templates/feature/agl-ci/included.dep @@ -0,0 +1 @@ +agl-create-spdx diff --git a/templates/feature/agl-create-spdx/50_local.conf.inc b/templates/feature/agl-create-spdx/50_local.conf.inc new file mode 100644 index 000000000..2dd5314f3 --- /dev/null +++ b/templates/feature/agl-create-spdx/50_local.conf.inc @@ -0,0 +1,2 @@ +#see meta-agl/meta-agl/conf/include/agl-devel.inc +require conf/include/agl-create-spdx.inc diff --git a/templates/feature/agl-create-spdx/README_feature_agl-create-spdx.md b/templates/feature/agl-create-spdx/README_feature_agl-create-spdx.md new file mode 100644 index 000000000..332a9dbd5 --- /dev/null +++ b/templates/feature/agl-create-spdx/README_feature_agl-create-spdx.md @@ -0,0 +1,7 @@ +--- +description: Feature agl-create-spdx +authors: Jan-Simon Moeller <jsmoeller@linuxfoundation.rg> +--- + +### Feature agl-create-spdx +Activation of the create-spdx class in oe-core. diff --git a/templates/feature/agl-gplv2/50_bblayers.conf.inc b/templates/feature/agl-gplv2/50_bblayers.conf.inc deleted file mode 100644 index a0f26980d..000000000 --- a/templates/feature/agl-gplv2/50_bblayers.conf.inc +++ /dev/null @@ -1 +0,0 @@ -BBLAYERS =+ "${METADIR}/external/meta-gplv2" diff --git a/templates/feature/agl-gplv2/50_local.conf.inc b/templates/feature/agl-gplv2/50_local.conf.inc deleted file mode 100644 index 8e0d5df74..000000000 --- a/templates/feature/agl-gplv2/50_local.conf.inc +++ /dev/null @@ -1,2 +0,0 @@ -#see meta-agl/meta-agl/conf/include/agl-gplv2.inc -require conf/include/agl-gplv2.inc diff --git a/templates/feature/agl-gplv2/README_feature_agl-gplv2.md b/templates/feature/agl-gplv2/README_feature_agl-gplv2.md deleted file mode 100644 index ffbe331b8..000000000 --- a/templates/feature/agl-gplv2/README_feature_agl-gplv2.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -description: Feature agl-gplv2 -authors: Jan-Simon Möller <jsmoeller@linuxfoundation.org>, Martin Kelly <mkelly@xevo.com> ---- - -### Feature agl-gplv2 - -*Description is missing - please complete file meta-agl/templates/feature/agl-gplv2/README_feature_agl-gplv2.md* - diff --git a/templates/feature/agl-hmi-framework/50_local.conf.inc b/templates/feature/agl-hmi-framework/50_local.conf.inc deleted file mode 100644 index fdff3dbe8..000000000 --- a/templates/feature/agl-hmi-framework/50_local.conf.inc +++ /dev/null @@ -1,4 +0,0 @@ -# In order to enable the hmi-framework features , -# enables the following line: -# -AGL_FEATURES:append = " agl-hmi-framework" diff --git a/templates/feature/agl-hmi-framework/README_feature_agl-hmi-framework.md b/templates/feature/agl-hmi-framework/README_feature_agl-hmi-framework.md deleted file mode 100644 index e298023d9..000000000 --- a/templates/feature/agl-hmi-framework/README_feature_agl-hmi-framework.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -description: Feature agl-hmi-framework -authors: Jan-Simon Möller <jsmoeller@linuxfoundation.org>, Scott Murray <scott.murray@konsulko.com> ---- - -### Feature agl-hmi-framework - -*Description is missing - please complete file meta-agl/templates/feature/agl-hmi-framework/README_feature_agl-hmi-framework.md* - diff --git a/templates/feature/agl-ptest/90_local.conf.inc b/templates/feature/agl-ptest/90_local.conf.inc index 6341b012a..dcaf72ab3 100644 --- a/templates/feature/agl-ptest/90_local.conf.inc +++ b/templates/feature/agl-ptest/90_local.conf.inc @@ -1,7 +1,7 @@ # Enabling ptest in image ... -OVERRIDES .= ":agl-ptest" +OVERRIDES:append = ":agl-ptest" DISTRO_FEATURES:append = " ptest" EXTRA_IMAGE_FEATURES:append = " ptest-pkgs" IMAGE_INSTALL:append = " lua-ptest xmlsec1-ptest libxml2-ptest" diff --git a/templates/feature/agl-selinux/50_bblayers.conf.inc b/templates/feature/agl-selinux/50_bblayers.conf.inc new file mode 100644 index 000000000..b17e292e9 --- /dev/null +++ b/templates/feature/agl-selinux/50_bblayers.conf.inc @@ -0,0 +1,5 @@ +AGL_META_PYTHON = "${METADIR}/external/meta-openembedded/meta-python" + +BBLAYERS =+ " \ + ${METADIR}/external/meta-selinux \ + " diff --git a/templates/feature/agl-selinux/50_local.conf.inc b/templates/feature/agl-selinux/50_local.conf.inc new file mode 100644 index 000000000..4aaac2d14 --- /dev/null +++ b/templates/feature/agl-selinux/50_local.conf.inc @@ -0,0 +1,2 @@ +#see meta-agl/meta-agl/conf/include/agl-selinux.inc +require conf/include/agl-selinux.inc diff --git a/templates/feature/agl-selinux/README_feature_agl-selinux.md b/templates/feature/agl-selinux/README_feature_agl-selinux.md new file mode 100644 index 000000000..c48ce06b0 --- /dev/null +++ b/templates/feature/agl-selinux/README_feature_agl-selinux.md @@ -0,0 +1,9 @@ +--- +description: Feature agl-selinux +authors: Scott Murray <scott.murray@konsulko.com> +--- + +### Feature agl-selinux + +Enables building with SELinux enabled, with the default mode +being permissive. diff --git a/templates/feature/agl-sign-wgts/50_local.conf.inc b/templates/feature/agl-sign-wgts/50_local.conf.inc deleted file mode 100644 index fb1f6ab1a..000000000 --- a/templates/feature/agl-sign-wgts/50_local.conf.inc +++ /dev/null @@ -1,2 +0,0 @@ -#see meta-agl/meta-agl/conf/include/agl-sign-wgts.inc -require conf/include/agl-sign-wgts.inc diff --git a/templates/feature/agl-sign-wgts/README_feature_agl-sign-wgts.md b/templates/feature/agl-sign-wgts/README_feature_agl-sign-wgts.md deleted file mode 100644 index 5e3b4b12c..000000000 --- a/templates/feature/agl-sign-wgts/README_feature_agl-sign-wgts.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -description: Feature agl-sign-wgts -authors: José Bollo <jose.bollo@iot.bzh>, ---- - -### Feature agl-sign-wgts - -Activation of the signature of wgt files diff --git a/templates/feature/agl-sota/50_bblayers.conf.inc b/templates/feature/agl-sota/50_bblayers.conf.inc deleted file mode 100644 index f3623354c..000000000 --- a/templates/feature/agl-sota/50_bblayers.conf.inc +++ /dev/null @@ -1,3 +0,0 @@ -BBLAYERS =+ " \ - ${METADIR}/external/meta-updater \ - " diff --git a/templates/feature/agl-sota/50_local.conf.inc b/templates/feature/agl-sota/50_local.conf.inc deleted file mode 100644 index 8019022c4..000000000 --- a/templates/feature/agl-sota/50_local.conf.inc +++ /dev/null @@ -1,8 +0,0 @@ -# See meta-updater/conf/distro/sota.conf.inc -INHERIT += "sota" -DISTRO_FEATURES:append = " sota usrmerge" -DISTRO_FEATURES_NATIVE:append = " sota" -AGL_DEFAULT_INITRAMFS_FSTYPES = "cpio.gz" -# Netboot is not obeying usrmerge distro feature -# therefore it is not compatible with agl-sota -CONFLICT_DISTRO_FEATURES += "netboot" diff --git a/templates/feature/agl-sota/50_setup.sh b/templates/feature/agl-sota/50_setup.sh deleted file mode 100644 index 76cb016f2..000000000 --- a/templates/feature/agl-sota/50_setup.sh +++ /dev/null @@ -1,26 +0,0 @@ - -cat <<EOF >> ${BUILDDIR}/conf/bblayers.conf - -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -# fragment { -# ${METADIR}/meta-agl/templates/feature/agl-sota/50_setup.sh -# -EOF - -case ${MACHINE} in - "qemux86-64") - echo "BBLAYERS =+ \"\${METADIR}/external/meta-updater-qemux86-64\"" >> ${BUILDDIR}/conf/bblayers.conf;; - "raspberrypi4") - echo "BBLAYERS =+ \"\${METADIR}/external/meta-updater-raspberrypi\"" >> ${BUILDDIR}/conf/bblayers.conf;; - *) - echo "#No extra SOTA feature layer for MACHINE ${MACHINE}" >> ${BUILDDIR}/conf/bblayers.conf;; -esac - - -cat <<EOF >> ${BUILDDIR}/conf/bblayers.conf - -# -# } -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - -EOF diff --git a/templates/feature/agl-sota/README_feature_agl-sota.md b/templates/feature/agl-sota/README_feature_agl-sota.md deleted file mode 100644 index beeffc234..000000000 --- a/templates/feature/agl-sota/README_feature_agl-sota.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -description: Feature agl-sota -authors: Anton Gerasimov <anton@advancedtelematic.com>, Changhyeok Bae <changhyeok.bae@gmail.com>, Jan-Simon Moeller <jsmoeller@linuxfoundation.org>, Jan-Simon Möller <jsmoeller@linuxfoundation.org>, Leon Anavi <leon.anavi@konsulko.com>, Phil Wise <phil@advancedtelematic.com>, Ronan Le Martret <ronan.lemartret@iot.bzh> ---- - -### Feature agl-sota - -*Description is missing - please complete file meta-agl/templates/feature/agl-sota/README_feature_agl-sota.md* - diff --git a/templates/feature/agl-weston-waltham-remoting/50_local.conf.inc b/templates/feature/agl-weston-waltham-remoting/50_local.conf.inc deleted file mode 100644 index d965eae6f..000000000 --- a/templates/feature/agl-weston-waltham-remoting/50_local.conf.inc +++ /dev/null @@ -1 +0,0 @@ -AGL_FEATURES:append = " waltham-remoting" diff --git a/templates/feature/agl-weston-waltham-remoting/README_feature_agl-weston-waltham-remoting.md b/templates/feature/agl-weston-waltham-remoting/README_feature_agl-weston-waltham-remoting.md deleted file mode 100644 index 416ff3f26..000000000 --- a/templates/feature/agl-weston-waltham-remoting/README_feature_agl-weston-waltham-remoting.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -description: Feature agl-weston-waltham-remoting -authors: Marius Vlad <marius.vlad@collabora.com> ---- - -### Feature agl-weston-waltham-remoting - -Enables remote display configuration using libWeston's remoting plug-in -for remote output and remote input using waltham-transmitter-plug-in. diff --git a/templates/feature/agl-weston-waltham-remoting/included.dep b/templates/feature/agl-weston-waltham-remoting/included.dep deleted file mode 100644 index 82639da07..000000000 --- a/templates/feature/agl-weston-waltham-remoting/included.dep +++ /dev/null @@ -1 +0,0 @@ -agl-demo diff --git a/templates/machine/am62xx-evm/50_bblayers.conf.inc b/templates/machine/am62xx-evm/50_bblayers.conf.inc new file mode 100644 index 000000000..6ef08c43e --- /dev/null +++ b/templates/machine/am62xx-evm/50_bblayers.conf.inc @@ -0,0 +1,5 @@ +BBLAYERS =+ "\ + ${METADIR}/bsp/meta-arm/meta-arm \ + ${METADIR}/bsp/meta-arm/meta-arm-toolchain \ + ${METADIR}/bsp/meta-ti/meta-ti-bsp \ + " diff --git a/templates/machine/am62xx-evm/50_local.conf.inc b/templates/machine/am62xx-evm/50_local.conf.inc new file mode 100644 index 000000000..782d11a76 --- /dev/null +++ b/templates/machine/am62xx-evm/50_local.conf.inc @@ -0,0 +1,3 @@ +MACHINE = "am62xx-evm" +#see meta-agl/meta-agl-bsp/conf/include/agl_am62xx-evm.inc +require conf/include/agl_am62xx-evm.inc diff --git a/templates/machine/aws-ec2-arm64/50_bblayers.conf.inc b/templates/machine/aws-ec2-arm64/50_bblayers.conf.inc new file mode 100644 index 000000000..4e619cde0 --- /dev/null +++ b/templates/machine/aws-ec2-arm64/50_bblayers.conf.inc @@ -0,0 +1,8 @@ +AGL_META_PYTHON = "${METADIR}/external/meta-openembedded/meta-python" +AGL_META_MULTIMEDIA = "${METADIR}/external/meta-openembedded/meta-multimedia" +AGL_META_NETWORKING = "${METADIR}/external/meta-openembedded/meta-networking" +AGL_META_VIRTUALIZATION = "${METADIR}/external/meta-virtualization" + +BBLAYERS =+ "\ + ${METADIR}/bsp/meta-aws \ + " diff --git a/templates/machine/aws-ec2-arm64/50_local.conf.inc b/templates/machine/aws-ec2-arm64/50_local.conf.inc new file mode 100644 index 000000000..ca20e0bf2 --- /dev/null +++ b/templates/machine/aws-ec2-arm64/50_local.conf.inc @@ -0,0 +1,21 @@ +MACHINE = "aws-ec2-arm64" + +VIRTUAL-RUNTIME_initscripts = "systemd-compat-units" +IMAGE_INSTALL:append = " cloud-init" +DISTRO_FEATURES:append = " virtualization" + + +# can we shuffle this out so CI still works +INHERIT += "extrausers" +# Hardening: Locking the root password. Creating the user without password for ssh key-based login only +EXTRA_USERS_PARAMS = "usermod -L root; useradd -p '*' user" + +EXTRA_IMAGE_FEATURES:append = " ssh-server-openssh" + +# Forcing removal of debug-tweakes as that leads to reversing some sshd_config hardening done in our bbappend when do_rootfs runs +EXTRA_IMAGE_FEATURES:remove = "debug-tweaks" + +AGL_DEFAULT_IMAGE_FSTYPES := "wic.vhd" + +# workaround bug in cloud-init leading to empty cloud-init-systemd package +PACKAGES:pn-cloud-init:forcevariable = "cloud-init-src cloud-init-dbg cloud-init-staticdev cloud-init-dev cloud-init-doc cloud-init-locale cloud-init-systemd cloud-init" diff --git a/templates/machine/aws-ec2-x86-64/50_bblayers.conf.inc b/templates/machine/aws-ec2-x86-64/50_bblayers.conf.inc new file mode 100644 index 000000000..4e619cde0 --- /dev/null +++ b/templates/machine/aws-ec2-x86-64/50_bblayers.conf.inc @@ -0,0 +1,8 @@ +AGL_META_PYTHON = "${METADIR}/external/meta-openembedded/meta-python" +AGL_META_MULTIMEDIA = "${METADIR}/external/meta-openembedded/meta-multimedia" +AGL_META_NETWORKING = "${METADIR}/external/meta-openembedded/meta-networking" +AGL_META_VIRTUALIZATION = "${METADIR}/external/meta-virtualization" + +BBLAYERS =+ "\ + ${METADIR}/bsp/meta-aws \ + " diff --git a/templates/machine/aws-ec2-x86-64/50_local.conf.inc b/templates/machine/aws-ec2-x86-64/50_local.conf.inc new file mode 100644 index 000000000..58b4b087d --- /dev/null +++ b/templates/machine/aws-ec2-x86-64/50_local.conf.inc @@ -0,0 +1,21 @@ +MACHINE = "aws-ec2-x86-64" + +VIRTUAL-RUNTIME_initscripts = "systemd-compat-units" +IMAGE_INSTALL:append = " cloud-init" +DISTRO_FEATURES:append = " virtualization" + + +# can we shuffle this out so CI still works +INHERIT += "extrausers" +# Hardening: Locking the root password. Creating the user without password for ssh key-based login only +EXTRA_USERS_PARAMS = "usermod -L root; useradd -p '*' user" + +EXTRA_IMAGE_FEATURES:append = " ssh-server-openssh" + +# Forcing removal of debug-tweakes as that leads to reversing some sshd_config hardening done in our bbappend when do_rootfs runs +EXTRA_IMAGE_FEATURES:remove = "debug-tweaks" + +AGL_DEFAULT_IMAGE_FSTYPES := "wic.vhd" + +# workaround bug in cloud-init leading to empty cloud-init-systemd package +PACKAGES:pn-cloud-init:forcevariable = "cloud-init-src cloud-init-dbg cloud-init-staticdev cloud-init-dev cloud-init-doc cloud-init-locale cloud-init-systemd cloud-init" diff --git a/templates/machine/bbe/50_bblayers.conf.inc b/templates/machine/bbe/50_bblayers.conf.inc index 6e6a6c951..c94c1db8f 100644 --- a/templates/machine/bbe/50_bblayers.conf.inc +++ b/templates/machine/bbe/50_bblayers.conf.inc @@ -1,7 +1,7 @@ BBLAYERS =+ " \ ${METADIR}/bsp/meta-arm/meta-arm \ ${METADIR}/bsp/meta-arm/meta-arm-toolchain \ - ${METADIR}/bsp/meta-ti \ + ${METADIR}/bsp/meta-ti/meta-ti-bsp \ ${METADIR}/bsp/meta-sancloud \ ${METADIR}/bsp/meta-rtlwifi \ " diff --git a/templates/machine/beaglebone-ai64/50_bblayers.conf.inc b/templates/machine/beaglebone-ai64/50_bblayers.conf.inc new file mode 100644 index 000000000..6ef08c43e --- /dev/null +++ b/templates/machine/beaglebone-ai64/50_bblayers.conf.inc @@ -0,0 +1,5 @@ +BBLAYERS =+ "\ + ${METADIR}/bsp/meta-arm/meta-arm \ + ${METADIR}/bsp/meta-arm/meta-arm-toolchain \ + ${METADIR}/bsp/meta-ti/meta-ti-bsp \ + " diff --git a/templates/machine/beaglebone-ai64/50_local.conf.inc b/templates/machine/beaglebone-ai64/50_local.conf.inc new file mode 100644 index 000000000..80d4aac97 --- /dev/null +++ b/templates/machine/beaglebone-ai64/50_local.conf.inc @@ -0,0 +1,3 @@ +MACHINE = "beaglebone-ai64" +#see meta-agl/meta-agl-bsp/conf/include/agl_beaglebone-ai64.inc +require conf/include/agl_beaglebone-ai64.inc diff --git a/templates/machine/beaglebone-ai64/README_machine_beaglebone-ai64.md b/templates/machine/beaglebone-ai64/README_machine_beaglebone-ai64.md new file mode 100644 index 000000000..7edf758a5 --- /dev/null +++ b/templates/machine/beaglebone-ai64/README_machine_beaglebone-ai64.md @@ -0,0 +1,9 @@ +--- +description: Machine beaglebone-ai64 +authors: Denys Dmytriyenko <denys@konsulko.com> +--- + +### Machine beaglebone-ai64 + +BeagleBoard.org BeagleBone AI-64 (uses Texas Instruments J721e/TDA4VM SoC). + diff --git a/templates/machine/beaglebone/50_bblayers.conf.inc b/templates/machine/beaglebone/50_bblayers.conf.inc index 6152217d3..6ef08c43e 100644 --- a/templates/machine/beaglebone/50_bblayers.conf.inc +++ b/templates/machine/beaglebone/50_bblayers.conf.inc @@ -1,5 +1,5 @@ BBLAYERS =+ "\ ${METADIR}/bsp/meta-arm/meta-arm \ ${METADIR}/bsp/meta-arm/meta-arm-toolchain \ - ${METADIR}/bsp/meta-ti \ + ${METADIR}/bsp/meta-ti/meta-ti-bsp \ " diff --git a/templates/machine/beagleplay/50_bblayers.conf.inc b/templates/machine/beagleplay/50_bblayers.conf.inc new file mode 100644 index 000000000..6ef08c43e --- /dev/null +++ b/templates/machine/beagleplay/50_bblayers.conf.inc @@ -0,0 +1,5 @@ +BBLAYERS =+ "\ + ${METADIR}/bsp/meta-arm/meta-arm \ + ${METADIR}/bsp/meta-arm/meta-arm-toolchain \ + ${METADIR}/bsp/meta-ti/meta-ti-bsp \ + " diff --git a/templates/machine/beagleplay/50_local.conf.inc b/templates/machine/beagleplay/50_local.conf.inc new file mode 100644 index 000000000..334f81819 --- /dev/null +++ b/templates/machine/beagleplay/50_local.conf.inc @@ -0,0 +1,3 @@ +MACHINE = "beagleplay" +#see meta-agl/meta-agl-bsp/conf/include/agl_beagleplay.inc +require conf/include/agl_beagleplay.inc diff --git a/templates/machine/beagleplay/README_machine_beagleplay.md b/templates/machine/beagleplay/README_machine_beagleplay.md new file mode 100644 index 000000000..d4528fba2 --- /dev/null +++ b/templates/machine/beagleplay/README_machine_beagleplay.md @@ -0,0 +1,9 @@ +--- +description: Machine beagleplay +authors: Denys Dmytriyenko <denys@konsulko.com> +--- + +### Machine beagleplay + +BeagleBoard.org BeaglePlay (uses Texas Instruments AM625x SoC). + diff --git a/templates/machine/dragonboard-410c/50_bblayers.conf.inc b/templates/machine/dragonboard-410c/50_bblayers.conf.inc deleted file mode 100644 index 41fe36719..000000000 --- a/templates/machine/dragonboard-410c/50_bblayers.conf.inc +++ /dev/null @@ -1,2 +0,0 @@ -BBLAYERS =+ "${METADIR}/bsp/meta-qcom" -BBMASK += "bsp/meta-qcom/openembedded-layer/recipes-navigation/gpsd" diff --git a/templates/machine/dragonboard-410c/50_local.conf.inc b/templates/machine/dragonboard-410c/50_local.conf.inc deleted file mode 100644 index f717fd8ee..000000000 --- a/templates/machine/dragonboard-410c/50_local.conf.inc +++ /dev/null @@ -1,3 +0,0 @@ -MACHINE = "dragonboard-410c" -#see meta-agl/meta-agl-bsp/conf/include/agl_dragonboard-410c.inc -require conf/include/agl_dragonboard-410c.inc diff --git a/templates/machine/dragonboard-410c/README_machine_dragonboard-410c.md b/templates/machine/dragonboard-410c/README_machine_dragonboard-410c.md deleted file mode 100644 index 047e08c28..000000000 --- a/templates/machine/dragonboard-410c/README_machine_dragonboard-410c.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -description: Machine dragonboard-410c -authors: Jan-Simon Möller <jsmoeller@linuxfoundation.org>, Kotaro Hashimoto <Hashimoto.Kotaro@ds.MitsubishiElectric.co.jp>, Stephane Desneux <stephane.desneux@iot.bzh> ---- - -### Machine dragonboard-410c - -*Description is missing - please complete file meta-agl/templates/machine/dragonboard-410c/README_machine_dragonboard-410c.md* - diff --git a/templates/machine/dragonboard-820c/50_bblayers.conf.inc b/templates/machine/dragonboard-820c/50_bblayers.conf.inc deleted file mode 100644 index f3b96cbb6..000000000 --- a/templates/machine/dragonboard-820c/50_bblayers.conf.inc +++ /dev/null @@ -1 +0,0 @@ -BBLAYERS =+ "${METADIR}/bsp/meta-qcom" diff --git a/templates/machine/dragonboard-820c/50_local.conf.inc b/templates/machine/dragonboard-820c/50_local.conf.inc deleted file mode 100644 index 1cd53d60c..000000000 --- a/templates/machine/dragonboard-820c/50_local.conf.inc +++ /dev/null @@ -1,3 +0,0 @@ -MACHINE = "dragonboard-820c" -#see meta-agl/meta-agl-bsp/conf/include/agl_dragonboard-410c.inc -require conf/include/agl_dragonboard-820c.inc diff --git a/templates/machine/dragonboard-820c/README_machine_dragonboard-820c.md b/templates/machine/dragonboard-820c/README_machine_dragonboard-820c.md deleted file mode 100644 index 73d9532c3..000000000 --- a/templates/machine/dragonboard-820c/README_machine_dragonboard-820c.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -description: Machine dragonboard-820c -authors: Jan-Simon Möller <jsmoeller@linuxfoundation.org> ---- - -### Machine dragonboard-820c - -*Description is missing - please complete file meta-agl/templates/machine/dragonboard-820c/README_machine_dragonboard-820c.md* - diff --git a/templates/machine/ebisu/50_bblayers.conf.inc b/templates/machine/ebisu/50_bblayers.conf.inc index 16397c2eb..e06bd413d 100644 --- a/templates/machine/ebisu/50_bblayers.conf.inc +++ b/templates/machine/ebisu/50_bblayers.conf.inc @@ -1,3 +1,4 @@ BBLAYERS =+ "\ ${METADIR}/bsp/meta-renesas/meta-rcar-gen3 \ + ${METADIR}/external/poky/meta-yocto-bsp \ " diff --git a/templates/machine/j7-evm/50_bblayers.conf.inc b/templates/machine/generic-arm64/50_bblayers.conf.inc index 6152217d3..05e60f69b 100644 --- a/templates/machine/j7-evm/50_bblayers.conf.inc +++ b/templates/machine/generic-arm64/50_bblayers.conf.inc @@ -1,5 +1,4 @@ BBLAYERS =+ "\ ${METADIR}/bsp/meta-arm/meta-arm \ ${METADIR}/bsp/meta-arm/meta-arm-toolchain \ - ${METADIR}/bsp/meta-ti \ " diff --git a/templates/machine/generic-arm64/50_local.conf.inc b/templates/machine/generic-arm64/50_local.conf.inc new file mode 100644 index 000000000..3918af8dd --- /dev/null +++ b/templates/machine/generic-arm64/50_local.conf.inc @@ -0,0 +1,2 @@ +MACHINE = "generic-arm64" + diff --git a/templates/machine/generic-arm64/README_machine_generic-arm64.md b/templates/machine/generic-arm64/README_machine_generic-arm64.md new file mode 100644 index 000000000..22dcb1fec --- /dev/null +++ b/templates/machine/generic-arm64/README_machine_generic-arm64.md @@ -0,0 +1,10 @@ +--- +description: Machine generic-arm64 +authors: Jan-Simon Moeller <jsmoeller@linuxfoundation.org> +--- + +### Machine generic-arm64 + +This is a standard aarch64 (ARM 64bit) machine for use with 'SystemReady' +(aka UEFI) systems. + diff --git a/templates/machine/h3-salvator-x/50_bblayers.conf.inc b/templates/machine/h3-salvator-x/50_bblayers.conf.inc index 16397c2eb..e06bd413d 100644 --- a/templates/machine/h3-salvator-x/50_bblayers.conf.inc +++ b/templates/machine/h3-salvator-x/50_bblayers.conf.inc @@ -1,3 +1,4 @@ BBLAYERS =+ "\ ${METADIR}/bsp/meta-renesas/meta-rcar-gen3 \ + ${METADIR}/external/poky/meta-yocto-bsp \ " diff --git a/templates/machine/h3ulcb-kf/50_bblayers.conf.inc b/templates/machine/h3ulcb-kf/50_bblayers.conf.inc index 61d472ab1..25e36b019 100644 --- a/templates/machine/h3ulcb-kf/50_bblayers.conf.inc +++ b/templates/machine/h3ulcb-kf/50_bblayers.conf.inc @@ -1,4 +1,5 @@ BBLAYERS =+ "\ ${METADIR}/bsp/meta-renesas/meta-rcar-gen3 \ ${METADIR}/meta-agl/meta-agl-bsp/meta-rcar-gen3-adas \ + ${METADIR}/external/poky/meta-yocto-bsp \ " diff --git a/templates/machine/h3ulcb-nogfx/50_bblayers.conf.inc b/templates/machine/h3ulcb-nogfx/50_bblayers.conf.inc index 16397c2eb..e06bd413d 100644 --- a/templates/machine/h3ulcb-nogfx/50_bblayers.conf.inc +++ b/templates/machine/h3ulcb-nogfx/50_bblayers.conf.inc @@ -1,3 +1,4 @@ BBLAYERS =+ "\ ${METADIR}/bsp/meta-renesas/meta-rcar-gen3 \ + ${METADIR}/external/poky/meta-yocto-bsp \ " diff --git a/templates/machine/h3ulcb/50_bblayers.conf.inc b/templates/machine/h3ulcb/50_bblayers.conf.inc index 16397c2eb..e06bd413d 100644 --- a/templates/machine/h3ulcb/50_bblayers.conf.inc +++ b/templates/machine/h3ulcb/50_bblayers.conf.inc @@ -1,3 +1,4 @@ BBLAYERS =+ "\ ${METADIR}/bsp/meta-renesas/meta-rcar-gen3 \ + ${METADIR}/external/poky/meta-yocto-bsp \ " diff --git a/templates/machine/hsdk/40_bblayers.conf.inc b/templates/machine/hsdk/40_bblayers.conf.inc deleted file mode 100644 index e3954fef3..000000000 --- a/templates/machine/hsdk/40_bblayers.conf.inc +++ /dev/null @@ -1,2 +0,0 @@ -# Use meta-synopsys layer for ARC HSDK board -BBLAYERS =+ "${METADIR}/bsp/meta-synopsys" diff --git a/templates/machine/hsdk/50_local.conf.inc b/templates/machine/hsdk/50_local.conf.inc deleted file mode 100644 index 61f77435e..000000000 --- a/templates/machine/hsdk/50_local.conf.inc +++ /dev/null @@ -1,2 +0,0 @@ -MACHINE = "hsdk" -require conf/include/agl_hsdk.inc diff --git a/templates/machine/hsdk/README_machine_hsdk.md b/templates/machine/hsdk/README_machine_hsdk.md deleted file mode 100644 index 30e56d13b..000000000 --- a/templates/machine/hsdk/README_machine_hsdk.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -description: Machine hsdk -authors: Evgeniy Didin <didin@synopsys.com>, Jan-Simon Möller <jsmoeller@linuxfoundation.org> ---- - -### Machine hsdk - -*Description is missing - please complete file meta-agl/templates/machine/hsdk/README_machine_hsdk.md* - diff --git a/templates/machine/imx8mqevk-viv/40_bblayers.conf.inc b/templates/machine/imx8mq-evk-viv/40_bblayers.conf.inc index edcb6a3a2..edcb6a3a2 100644 --- a/templates/machine/imx8mqevk-viv/40_bblayers.conf.inc +++ b/templates/machine/imx8mq-evk-viv/40_bblayers.conf.inc diff --git a/templates/machine/imx8mq-evk-viv/50_local.conf.inc b/templates/machine/imx8mq-evk-viv/50_local.conf.inc new file mode 100644 index 000000000..7504c1120 --- /dev/null +++ b/templates/machine/imx8mq-evk-viv/50_local.conf.inc @@ -0,0 +1,3 @@ +MACHINE = "imx8mq-evk" +#see meta-agl/meta-agl-bsp/conf/include/agl_imx8mq-evk-viv.inc +require conf/include/agl_imx8mq-evk-viv.inc diff --git a/templates/machine/imx8mqevk-viv/50_setup.sh b/templates/machine/imx8mq-evk-viv/50_setup.sh index eefd1eb7f..eefd1eb7f 100644 --- a/templates/machine/imx8mqevk-viv/50_setup.sh +++ b/templates/machine/imx8mq-evk-viv/50_setup.sh diff --git a/templates/machine/imx8mqevk-viv/README_machine_imx8mqevk-viv.md b/templates/machine/imx8mq-evk-viv/README_machine_imx8mq-evk-viv.md index be30e00fe..be30e00fe 100644 --- a/templates/machine/imx8mqevk-viv/README_machine_imx8mqevk-viv.md +++ b/templates/machine/imx8mq-evk-viv/README_machine_imx8mq-evk-viv.md diff --git a/templates/machine/imx8mqevk/40_bblayers.conf.inc b/templates/machine/imx8mq-evk/40_bblayers.conf.inc index edcb6a3a2..edcb6a3a2 100644 --- a/templates/machine/imx8mqevk/40_bblayers.conf.inc +++ b/templates/machine/imx8mq-evk/40_bblayers.conf.inc diff --git a/templates/machine/imx8mq-evk/50_local.conf.inc b/templates/machine/imx8mq-evk/50_local.conf.inc new file mode 100644 index 000000000..8a178e28b --- /dev/null +++ b/templates/machine/imx8mq-evk/50_local.conf.inc @@ -0,0 +1,3 @@ +MACHINE = "imx8mq-evk" +#see meta-agl/meta-agl-bsp/conf/include/agl_imx8mq-evk.inc +require conf/include/agl_imx8mq-evk.inc diff --git a/templates/machine/imx8mqevk/50_setup.sh b/templates/machine/imx8mq-evk/50_setup.sh index eefd1eb7f..eefd1eb7f 100644 --- a/templates/machine/imx8mqevk/50_setup.sh +++ b/templates/machine/imx8mq-evk/50_setup.sh diff --git a/templates/machine/imx8mqevk/README_machine_imx8mqevk.md b/templates/machine/imx8mq-evk/README_machine_imx8mq-evk.md index 5d2bcbd37..ea9ddacce 100644 --- a/templates/machine/imx8mqevk/README_machine_imx8mqevk.md +++ b/templates/machine/imx8mq-evk/README_machine_imx8mq-evk.md @@ -3,11 +3,11 @@ description: i.MX8MQ EVK with etnaviv GPU driver authors: Scott Murray <scott.murray@konsulko.com> --- -### Machine imx8mqevk +### Machine imx8mq-evk i.MX8MQ EVK and EVKB boards with etnaviv GPU driver support. Note that etnaviv on the GC7000L GPU in the i.MX8MQ is currently still -a work in progress, the imx8mqevk-viv template using the NXP Vivante +a work in progress, the imx8mq-evk-viv template using the NXP Vivante driver may be a better choice for those not interested in etnaviv debugging and development. diff --git a/templates/machine/imx8mqevk-viv/50_local.conf.inc b/templates/machine/imx8mqevk-viv/50_local.conf.inc deleted file mode 100644 index e9668c307..000000000 --- a/templates/machine/imx8mqevk-viv/50_local.conf.inc +++ /dev/null @@ -1,3 +0,0 @@ -MACHINE = "imx8mqevk" -#see meta-agl/meta-agl-bsp/conf/include/agl_imx8mqevk-viv.inc -require conf/include/agl_imx8mqevk-viv.inc diff --git a/templates/machine/imx8mqevk/50_local.conf.inc b/templates/machine/imx8mqevk/50_local.conf.inc deleted file mode 100644 index 5f9b95943..000000000 --- a/templates/machine/imx8mqevk/50_local.conf.inc +++ /dev/null @@ -1,3 +0,0 @@ -MACHINE = "imx8mqevk" -#see meta-agl/meta-agl-bsp/conf/include/agl_imx8mqevk.inc -require conf/include/agl_imx8mqevk.inc diff --git a/templates/machine/j7-evm/50_local.conf.inc b/templates/machine/j7-evm/50_local.conf.inc deleted file mode 100644 index 1a81cb7ed..000000000 --- a/templates/machine/j7-evm/50_local.conf.inc +++ /dev/null @@ -1,3 +0,0 @@ -MACHINE = "j7-evm" -#see meta-agl/meta-agl-bsp/conf/include/agl_j7-evm.inc -require conf/include/agl_j7-evm.inc diff --git a/templates/machine/j7-evm/README_machine_j7-evm.md b/templates/machine/j7-evm/README_machine_j7-evm.md deleted file mode 100644 index f1441a301..000000000 --- a/templates/machine/j7-evm/README_machine_j7-evm.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -description: Machine j7-evm -authors: Scott Murray <scott.murray@konsulko.com> ---- - -### Machine j7-evm - -*Description is missing - please complete file meta-agl/templates/machine/dra7xx-evm/README_machine_j7-evm.md* - diff --git a/templates/machine/j721e-evm/50_bblayers.conf.inc b/templates/machine/j721e-evm/50_bblayers.conf.inc new file mode 100644 index 000000000..6ef08c43e --- /dev/null +++ b/templates/machine/j721e-evm/50_bblayers.conf.inc @@ -0,0 +1,5 @@ +BBLAYERS =+ "\ + ${METADIR}/bsp/meta-arm/meta-arm \ + ${METADIR}/bsp/meta-arm/meta-arm-toolchain \ + ${METADIR}/bsp/meta-ti/meta-ti-bsp \ + " diff --git a/templates/machine/j721e-evm/50_local.conf.inc b/templates/machine/j721e-evm/50_local.conf.inc new file mode 100644 index 000000000..917ca73a7 --- /dev/null +++ b/templates/machine/j721e-evm/50_local.conf.inc @@ -0,0 +1,3 @@ +MACHINE = "j721e-evm" +#see meta-agl/meta-agl-bsp/conf/include/agl_j721e-evm.inc +require conf/include/agl_j721e-evm.inc diff --git a/templates/machine/j721e-evm/README_machine_j721e-evm.md b/templates/machine/j721e-evm/README_machine_j721e-evm.md new file mode 100644 index 000000000..c6f7320d6 --- /dev/null +++ b/templates/machine/j721e-evm/README_machine_j721e-evm.md @@ -0,0 +1,9 @@ +--- +description: Machine j721e-evm +authors: Scott Murray <scott.murray@konsulko.com> +--- + +### Machine j721e-evm + +Texas Instruments J721e EVM (formerly J7 EVM). + diff --git a/templates/machine/m3-salvator-x/50_bblayers.conf.inc b/templates/machine/m3-salvator-x/50_bblayers.conf.inc index 16397c2eb..e06bd413d 100644 --- a/templates/machine/m3-salvator-x/50_bblayers.conf.inc +++ b/templates/machine/m3-salvator-x/50_bblayers.conf.inc @@ -1,3 +1,4 @@ BBLAYERS =+ "\ ${METADIR}/bsp/meta-renesas/meta-rcar-gen3 \ + ${METADIR}/external/poky/meta-yocto-bsp \ " diff --git a/templates/machine/m3ulcb-kf/50_bblayers.conf.inc b/templates/machine/m3ulcb-kf/50_bblayers.conf.inc index 61d472ab1..25e36b019 100644 --- a/templates/machine/m3ulcb-kf/50_bblayers.conf.inc +++ b/templates/machine/m3ulcb-kf/50_bblayers.conf.inc @@ -1,4 +1,5 @@ BBLAYERS =+ "\ ${METADIR}/bsp/meta-renesas/meta-rcar-gen3 \ ${METADIR}/meta-agl/meta-agl-bsp/meta-rcar-gen3-adas \ + ${METADIR}/external/poky/meta-yocto-bsp \ " diff --git a/templates/machine/m3ulcb-nogfx/50_bblayers.conf.inc b/templates/machine/m3ulcb-nogfx/50_bblayers.conf.inc index 16397c2eb..e06bd413d 100644 --- a/templates/machine/m3ulcb-nogfx/50_bblayers.conf.inc +++ b/templates/machine/m3ulcb-nogfx/50_bblayers.conf.inc @@ -1,3 +1,4 @@ BBLAYERS =+ "\ ${METADIR}/bsp/meta-renesas/meta-rcar-gen3 \ + ${METADIR}/external/poky/meta-yocto-bsp \ " diff --git a/templates/machine/m3ulcb/50_bblayers.conf.inc b/templates/machine/m3ulcb/50_bblayers.conf.inc index 16397c2eb..e06bd413d 100644 --- a/templates/machine/m3ulcb/50_bblayers.conf.inc +++ b/templates/machine/m3ulcb/50_bblayers.conf.inc @@ -1,3 +1,4 @@ BBLAYERS =+ "\ ${METADIR}/bsp/meta-renesas/meta-rcar-gen3 \ + ${METADIR}/external/poky/meta-yocto-bsp \ " diff --git a/templates/machine/nitrogen6x/40_bblayers.conf.inc b/templates/machine/nitrogen6x/40_bblayers.conf.inc deleted file mode 100644 index a4323be1a..000000000 --- a/templates/machine/nitrogen6x/40_bblayers.conf.inc +++ /dev/null @@ -1,6 +0,0 @@ -# This must be parsed after qt5, etc. layers so that they are correctly -# recognized by meta-freescale/dynamic-layers -BBLAYERS =+ "\ - ${METADIR}/bsp/meta-freescale \ - ${METADIR}/bsp/meta-freescale-3rdparty \ - " diff --git a/templates/machine/nitrogen6x/50_local.conf.inc b/templates/machine/nitrogen6x/50_local.conf.inc deleted file mode 100644 index f8178bbd1..000000000 --- a/templates/machine/nitrogen6x/50_local.conf.inc +++ /dev/null @@ -1,3 +0,0 @@ -MACHINE = "nitrogen6x" -#see meta-agl/meta-agl-bsp/conf/include/agl_nitrogen6x.inc -require conf/include/agl_nitrogen6x.inc diff --git a/templates/machine/nitrogen6x/50_setup.sh b/templates/machine/nitrogen6x/50_setup.sh deleted file mode 100644 index eefd1eb7f..000000000 --- a/templates/machine/nitrogen6x/50_setup.sh +++ /dev/null @@ -1,2 +0,0 @@ -find_and_ack_eula $METADIR/bsp/meta-freescale EULA -export EULA_FLAG_NAME="ACCEPT_FSL_EULA" diff --git a/templates/machine/nitrogen6x/README_machine_nitrogen6x.md b/templates/machine/nitrogen6x/README_machine_nitrogen6x.md deleted file mode 100644 index 9994de052..000000000 --- a/templates/machine/nitrogen6x/README_machine_nitrogen6x.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -description: Machine nitrogen6x -authors: Jan-Simon Möller <jsmoeller@linuxfoundation.org>, Mihail Grigorov <michael.grigorov@konsulko.com>, Nathan Illerbrun <nathani@validmanufacturing.com>, Scott Murray <scott.murray@konsulko.com> ---- - -### Machine nitrogen6x - -*Description is missing - please complete file meta-agl/templates/machine/nitrogen6x/README_machine_nitrogen6x.md* - diff --git a/templates/machine/raspberrypi5/50_bblayers.conf.inc b/templates/machine/raspberrypi5/50_bblayers.conf.inc new file mode 100644 index 000000000..2e677dd8a --- /dev/null +++ b/templates/machine/raspberrypi5/50_bblayers.conf.inc @@ -0,0 +1 @@ +BBLAYERS =+ "${METADIR}/bsp/meta-raspberrypi" diff --git a/templates/machine/raspberrypi5/50_local.conf.inc b/templates/machine/raspberrypi5/50_local.conf.inc new file mode 100644 index 000000000..9ee2644ab --- /dev/null +++ b/templates/machine/raspberrypi5/50_local.conf.inc @@ -0,0 +1,4 @@ +MACHINE = "raspberrypi5" + +#see meta-agl/meta-agl-bsp/conf/include/agl_raspberrypi5.inc +require conf/include/agl_raspberrypi5.inc diff --git a/templates/machine/s4sk/50_bblayers.conf.inc b/templates/machine/s4sk/50_bblayers.conf.inc new file mode 100644 index 000000000..0cc25a9ab --- /dev/null +++ b/templates/machine/s4sk/50_bblayers.conf.inc @@ -0,0 +1,7 @@ +BBLAYERS =+ "\ + ${METADIR}/bsp/meta-renesas/meta-rcar-gateway \ + ${METADIR}/external/poky/meta-yocto-bsp \ + " + +AGL_META_PYTHON = "${METADIR}/external/meta-openembedded/meta-python" + diff --git a/templates/machine/s4sk/50_local.conf.inc b/templates/machine/s4sk/50_local.conf.inc new file mode 100644 index 000000000..b804b3845 --- /dev/null +++ b/templates/machine/s4sk/50_local.conf.inc @@ -0,0 +1,4 @@ +MACHINE = "s4sk" +#see meta-agl/meta-agl-bsp/conf/include/agl_s4sk.inc +require conf/include/agl_s4sk.inc + diff --git a/templates/machine/s4sk/README_machine_s4sk.md b/templates/machine/s4sk/README_machine_s4sk.md new file mode 100644 index 000000000..275be67a6 --- /dev/null +++ b/templates/machine/s4sk/README_machine_s4sk.md @@ -0,0 +1,11 @@ +--- +description: Machine s4sk +authors: Loc Nguyen <loc.nguyen.wt@renesas.com> +--- + +### Machine s4sk + +Renesas RCar Gen4 "s4sk" board. + +* [R-Car S4 Starter Kit website](https://www.renesas.com/us/en/products/automotive-products/automotive-system-chips-socs/y-ask-rcar-s4-1000base-t-r-car-s4-starter-kit) +* [elinux S4 Starter Kit](https://elinux.org/R-Car/Boards/S4SK) diff --git a/templates/machine/unmatched/50_bblayers.conf.inc b/templates/machine/unmatched/50_bblayers.conf.inc new file mode 100644 index 000000000..03565bafd --- /dev/null +++ b/templates/machine/unmatched/50_bblayers.conf.inc @@ -0,0 +1,6 @@ +# This is the original place, but we need to tweak layer.conf +BBLAYERS =+ "${METADIR}/bsp/meta-sifive" + +# For now, tweak the layer's compatibility to allow using with kirkstone, +# since we know it works without major issues. +LAYERSERIES_COMPAT_meta-sifive:append = " kirkstone" diff --git a/templates/machine/unmatched/50_local.conf.inc b/templates/machine/unmatched/50_local.conf.inc new file mode 100644 index 000000000..c4d2b3ae5 --- /dev/null +++ b/templates/machine/unmatched/50_local.conf.inc @@ -0,0 +1,4 @@ +MACHINE = "unmatched" + +#see meta-agl/meta-agl-bsp/conf/include/agl_raspberrypi4.inc +require conf/include/agl_unmatched.inc |