From c125f72d8d26077089c87a81939b833c5e7abc7f Mon Sep 17 00:00:00 2001 From: Esben Haabendal <esben@geanix.com> Date: Fri, 3 Mar 2023 16:56:16 +0100 Subject: [PATCH] openharmony-standard: Use udev to set binder and ashmem permissions Signed-off-by: Esben Haabendal <esben@geanix.com> --- recipes-openharmony/openharmony/files/40-ashmem.rules | 1 + recipes-openharmony/openharmony/files/40-binder.rules | 1 + .../openharmony/files/openharmony-preinit | 4 ---- .../openharmony/openharmony-standard_3.0.bb | 10 ++++++++++ 4 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 recipes-openharmony/openharmony/files/40-ashmem.rules create mode 100644 recipes-openharmony/openharmony/files/40-binder.rules diff --git a/recipes-openharmony/openharmony/files/40-ashmem.rules b/recipes-openharmony/openharmony/files/40-ashmem.rules new file mode 100644 index 00000000..6bea00b8 --- /dev/null +++ b/recipes-openharmony/openharmony/files/40-ashmem.rules @@ -0,0 +1 @@ +KERNEL=="ashmem", MODE="0666" diff --git a/recipes-openharmony/openharmony/files/40-binder.rules b/recipes-openharmony/openharmony/files/40-binder.rules new file mode 100644 index 00000000..b7ad4d95 --- /dev/null +++ b/recipes-openharmony/openharmony/files/40-binder.rules @@ -0,0 +1 @@ +KERNEL=="binder*", MODE="0666" diff --git a/recipes-openharmony/openharmony/files/openharmony-preinit b/recipes-openharmony/openharmony/files/openharmony-preinit index 8bcfaa9a..cac8b97f 100644 --- a/recipes-openharmony/openharmony/files/openharmony-preinit +++ b/recipes-openharmony/openharmony/files/openharmony-preinit @@ -83,10 +83,6 @@ mkdir -p /usr/lib/dri chmod -R 777 /data -# /dev/binder and /dev/ashmem need to be rw for all users -chmod 666 /dev/binder -chmod 666 /dev/ashmem - # /dev/dri/card0 needs to be rw for all users if [ -c /dev/dri/card0 ]; then chmod 666 /dev/dri/card0 diff --git a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb index c1bfbe4b..fdb0b5e4 100644 --- a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb +++ b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb @@ -413,6 +413,16 @@ copy_subsystem_config_json_file() { inherit systemd SYSTEMD_AUTO_ENABLE = "enable" +SRC_URI += "file://40-binder.rules" +SRC_URI += "file://40-ashmem.rules" +do_install_udev_rules() { + mkdir -p ${D}${nonarch_base_libdir}/udev/rules.d + install -m 644 -t ${D}${nonarch_base_libdir}/udev/rules.d \ + ${WORKDIR}/40-binder.rules \ + ${WORKDIR}/40-ashmem.rules +} +do_install[postfuncs] += "do_install_udev_rules" + # OpenHarmony pre-init package and its systemd service # Used to create folders needed by OH services and components PACKAGES =+ "${PN}-openharmony-preinit" -- GitLab