From 3c47c38fd19ebd0f9493ec7cc8ad05ebff1d0e94 Mon Sep 17 00:00:00 2001 From: Jan-Simon Möller Date: Fri, 7 Dec 2018 15:50:58 +0100 Subject: Move hal configuration files into own repository MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... and own recipe This allows to manage the various types of configuration files independently of the source code as these might not always fit into the git repo context-wise. Initial recipe is 4a-hal-device-config.bb . This is re-using the same mechanism as previously used. Samples for alternative implementations and vendor hals are included as well to explore improved ways of handling the multipe configuration files possible. Bug-AGL: SPEC-2011 Change-Id: Ib04b5c4e7b764bed85dbceb50a62a8c6fd031c5a Signed-off-by: Jan-Simon Möller (cherry picked from commit fd78578b11990bc885651c52690dbcf9169bd7ac) --- .../4a-hal-device-config-alternatives.README | 3 ++ .../4a-hal-device-config-alternatives.bbexample | 57 +++++++++++++++++++++ .../4a-hal-device-config.README | 4 ++ .../4a-hal-device-config/4a-hal-device-config.bb | 58 ++++++++++++++++++++++ .../4a-hal-vendor-config.README | 3 ++ .../4a-hal-vendor-config.bbexample | 46 +++++++++++++++++ .../4a-hal-device-config/files/deploy-hal-udev.sh | 4 ++ .../files/udev-sample-rule.rules | 1 + .../4a-hal-generic/4a-hal-generic_git.bb | 35 ++----------- .../4a-hal-unicens/4a-hal-unicens_git.bb | 4 +- 10 files changed, 182 insertions(+), 33 deletions(-) create mode 100644 meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config-alternatives.README create mode 100644 meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config-alternatives.bbexample create mode 100644 meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config.README create mode 100644 meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config.bb create mode 100644 meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-vendor-config.README create mode 100644 meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-vendor-config.bbexample create mode 100755 meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/files/deploy-hal-udev.sh create mode 100644 meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/files/udev-sample-rule.rules diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config-alternatives.README b/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config-alternatives.README new file mode 100644 index 00000000..689f9bf8 --- /dev/null +++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config-alternatives.README @@ -0,0 +1,3 @@ +This is a sample on how the update-alternative system can be used to select +the highest priority hal given. +Downside ... always only one file is possible in the etc folder. No HAL_LIST. diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config-alternatives.bbexample b/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config-alternatives.bbexample new file mode 100644 index 00000000..3bafc3bb --- /dev/null +++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config-alternatives.bbexample @@ -0,0 +1,57 @@ +SUMMARY = "4A - Generic HAL device configuration" +DESCRIPTION = "Generic HAL device configuration in 4A (AGL Advanced Audio Agent)" +HOMEPAGE = "https://git.automotivelinux.org/src/4a-hal-configs/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" + +SRC_URI = "gitsm://gerrit.automotivelinux.org/gerrit/src/4a-hal-configs;protocol=https;branch=${AGL_BRANCH}" +SRCREV = "45f205076573a858348c10a52d31382f31deaf55" + +PV = "0.1+git${SRCPV}" +S = "${WORKDIR}/git" + +# The package is machine-specific due to variable config content +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit afb-system update-alternative +# This defines INSTALL_PREFIX = "/usr/libexec/agl/" + +# no configure needed +do_configure[noexec] = "1" +# no compile needed +do_compile[noexec] = "1" + + +# when no specific HAL is defined, use a generic usb one +4A_DEFAULT_HAL ??= "2ch-generic-usb" + +# for specific machines, activate only known HAL +4A_DEFAULT_HAL_m3ulcb ?= "rcar-m3" +# Downside: only one file at a time! +4A_DEFAULT_HAL_h3ulcb ?= "rcar-m3" +4A_DEFAULT_HAL_intel-corei7-64 ?= "intel-minnow" +4A_DEFAULT_HAL_qemux86-64 ?= "intel-qemu" + +# Due to bug SPEC-1610, default hal for RPI3 is not active yet +# 4A_DEFAULT_HAL_raspberrypi3 ?= "raspberry-pi-3" + +do_install () { + # get pkgdir for 4a-hal + PKGDIR=${D}/${INSTALL_PREFIX}/4a-hal + + install -d -m 0755 ${PKGDIR}/etc.available + cp -ar ${S}/*/*.json ${PKGDIR}/etc.available/ + chown -R root:root ${PKGDIR}/ +} + +# we define a '4a-default-hal' alternative with a low default priority +# you can deploy your own hal with a higher prio +ALTERNATIVE_${PN} = "4a-default-hal" +ALTERNATIVE_PRIORITY = "10" +ALTERNATIVE_LINK_NAME[4a-default-hal] = "${INSTALL_PREFIX}/4a-hal/etc/4a-default-hal.json" +ALTERNATIVE_TARGET[4a-default-hal] = "${INSTALL_PREFIX}/4a-hal/etc.available/hal-4a-${4A_DEFAULT_HAL}.json" + + +RPROVIDES_${PN} += "virtual/4a-default-hal" \ No newline at end of file diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config.README b/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config.README new file mode 100644 index 00000000..602486a4 --- /dev/null +++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config.README @@ -0,0 +1,4 @@ +To keep it simple. + +Just expose 4A_HAL_LIST as-is to conf/local.conf so the user can actually choose any json file. + diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config.bb b/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config.bb new file mode 100644 index 00000000..a1c6154b --- /dev/null +++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config.bb @@ -0,0 +1,58 @@ +SUMMARY = "4A - Generic HAL device configuration" +DESCRIPTION = "Generic HAL device configuration in 4A (AGL Advanced Audio Agent)" +HOMEPAGE = "https://git.automotivelinux.org/src/4a-hal-configs/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" + +SRC_URI = "gitsm://gerrit.automotivelinux.org/gerrit/src/4a-hal-configs;protocol=https;branch=${AGL_BRANCH}" +SRCREV = "45f205076573a858348c10a52d31382f31deaf55" + +PV = "0.1+git${SRCPV}" +S = "${WORKDIR}/git" + +# The package is machine-specific due to variable config content +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit afb-system +# This defines INSTALL_PREFIX = "/usr/libexec/agl/" + +# no configure needed +do_configure[noexec] = "1" + +# no compile needed +do_compile[noexec] = "1" + +# when no specific HAL is defined, use a generic usb one +4A_HAL_LIST ??= "2ch-generic-usb" + +# for specific machines, activate only known HALs +4A_HAL_LIST_m3ulcb ?= "rcar-m3 rcar-m3kf" +4A_HAL_LIST_h3ulcb ?= "rcar-m3 rcar-m3kf" +4A_HAL_LIST_intel-corei7-64 ?= "intel-minnow intel-upsquared-hdmi" +4A_HAL_LIST_qemux86-64 ?= "intel-qemu" + +# Due to bug SPEC-1610, default hal for RPI3 is not active yet +# 4A_HAL_LIST_raspberrypi3 ?= "raspberry-pi-3" + +do_install () { + + # get pkgdir for 4a-hal + PKGDIR=${D}/${INSTALL_PREFIX}/4a-hal + + install -d -m 0755 ${PKGDIR} + install -d -m 0755 ${PKGDIR}/etc + install -d -m 0755 ${PKGDIR}/etc.available + + cp -ar ${S}/*/*.json ${PKGDIR}/etc.available/ + chown -R root:root ${PKGDIR}/etc.available + + for x in ${4A_HAL_LIST}; do + hal=hal-4a-$x.json + cp -v $PKGDIR/etc.available/${hal} $PKGDIR/etc/ + done +} + + +RPROVIDES_${PN} += "virtual/4a-default-hal" \ No newline at end of file diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-vendor-config.README b/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-vendor-config.README new file mode 100644 index 00000000..29531ccd --- /dev/null +++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-vendor-config.README @@ -0,0 +1,3 @@ +This is a sample how a vendor can: +- inject his own hal (as file hal-4a-myhal.json) +- set PREFERRED_RPROVIDER_virtual/4a-default-hal = "4a-hal-vendor-config" on conf/local.conf diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-vendor-config.bbexample b/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-vendor-config.bbexample new file mode 100644 index 00000000..105ab1fa --- /dev/null +++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-vendor-config.bbexample @@ -0,0 +1,46 @@ +SUMMARY = "4A - Vendor HAL device configuration" +DESCRIPTION = "Vendor HAL device configuration in 4A (AGL Advanced Audio Agent)" +HOMEPAGE = "https://example.com/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" + +SRC_URI = "file://hal-4a-myhal.json" + +PV = "0.1" +S = "${WORKDIR}/" + +# The package is machine-specific due to variable config content +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit afb-system +# This defines INSTALL_PREFIX = "/usr/libexec/agl/" + +# no configure needed +do_configure[noexec] = "1" + +# no compile needed +do_compile[noexec] = "1" + +# use our local hal +4A_HAL_LIST = "myhal" + +do_install () { + + # get pkgdir for 4a-hal + PKGDIR=${D}/${INSTALL_PREFIX}/4a-hal + + install -d -m 0755 ${PKGDIR}/etc.available + + cp -ar ${S}/*.json ${PKGDIR}/etc.available/ + chown -R root:root ${PKGDIR}/etc.available + + for x in ${4A_HAL_LIST}; do + hal=hal-4a-$x.json + cp -v $PKGDIR/etc.available/${hal} $PKGDIR/etc/ + done +} + + +RPROVIDES_${PN} += "virtual/4a-default-hal" \ No newline at end of file diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/files/deploy-hal-udev.sh b/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/files/deploy-hal-udev.sh new file mode 100755 index 00000000..f031d58b --- /dev/null +++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/files/deploy-hal-udev.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +rm /usr/libexec/agl/4a-hal/etc/* +cp /usr/libexec/agl/4a-hal/etc.available/$i /usr/libexec/agl/4a-hal/etc/ diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/files/udev-sample-rule.rules b/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/files/udev-sample-rule.rules new file mode 100644 index 00000000..d2d16a17 --- /dev/null +++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/files/udev-sample-rule.rules @@ -0,0 +1 @@ +ACTION=="add", SUBSYSTEM=="usb", SOMEOTHERMATCH="bar", RUN+="/usr/bin/deploy-hal-udev.sh hal-4a-greenbox.json" diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-generic/4a-hal-generic_git.bb b/meta-audio-4a-framework/recipes-multimedia/4a-hal-generic/4a-hal-generic_git.bb index f5eb6e9f..34860c61 100644 --- a/meta-audio-4a-framework/recipes-multimedia/4a-hal-generic/4a-hal-generic_git.bb +++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-generic/4a-hal-generic_git.bb @@ -16,39 +16,12 @@ S = "${WORKDIR}/git" inherit afb-system-cmake -# FIXME: -#FILES_${PN}-dev += "${INSTALL_PREFIX}/4a-hal/htdocs" -#FILES_${PN} += "${INSTALL_PREFIX}/afb-aaaa" -#FILES_${PN} += "${INSTALL_PREFIX}/lib" - -# The package is machine-specific due to variable config content -PACKAGE_ARCH = "${MACHINE_ARCH}" - -# when no specific HAL is defined, use a generic usb one -4A_HAL_LIST ??= "2ch-generic-usb" - -# for specific machines, activate only known HALs -4A_HAL_LIST_m3ulcb ?= "rcar-m3 rcar-m3kf" -4A_HAL_LIST_h3ulcb ?= "rcar-m3 rcar-m3kf" -4A_HAL_LIST_intel-corei7-64 ?= "intel-minnow intel-upsquared-hdmi" -4A_HAL_LIST_qemux86-64 ?= "intel-qemu" - -# Due to bug SPEC-1610, default hal for RPI3 is not active yet -# 4A_HAL_LIST_raspberrypi3 ?= "raspberry-pi-3" - -### TODO: this list should be completed for more machines - do_install_append () { # get pkgdir - note that '4a-hal' comes from project ${project_git_repo}/conf.d/cmake/config.cmake PKGDIR=${D}/${INSTALL_PREFIX}/4a-hal - # move all config files to a 'available' dir - mv $PKGDIR/etc $PKGDIR/etc.available - - # then install only required hals files in the etc folder - mkdir -p $PKGDIR/etc - for x in ${4A_HAL_LIST}; do - hal=hal-4a-$x.json - mv -v $PKGDIR/etc.available/${hal} $PKGDIR/etc/ - done + # transition: provided by separate package + rm -rf $PKGDIR/etc } + +RDEPENDS_${PN} += "virtual/4a-default-hal" diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-unicens/4a-hal-unicens_git.bb b/meta-audio-4a-framework/recipes-multimedia/4a-hal-unicens/4a-hal-unicens_git.bb index bc95bc8a..a76cd592 100644 --- a/meta-audio-4a-framework/recipes-multimedia/4a-hal-unicens/4a-hal-unicens_git.bb +++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-unicens/4a-hal-unicens_git.bb @@ -22,8 +22,8 @@ do_install_append () { # get pkgdir - note that '4a-hal' comes from project ${project_git_repo}/conf.d/cmake/config.cmake PKGDIR=${D}/${INSTALL_PREFIX}/4a-hal - # move all config files to a 'available' dir - mv $PKGDIR/etc $PKGDIR/etc.available + # transition: provided by separate package + rm -rf $PKGDIR/etc } -- cgit 1.2.3-korg