diff options
author | Ming Liu <ming.liu@toradex.com> | 2022-05-02 14:49:52 +0200 |
---|---|---|
committer | Francesco Dolcini <francesco.dolcini@toradex.com> | 2022-05-10 07:03:18 +0000 |
commit | 9e5c0e3043a7c49fb71276a0f6604047129eafdc (patch) | |
tree | 668aae7d8aa995eb2ec27e2d0e1c8c4246df1762 /recipes-bsp/alsa-state/alsa-state.bbappend | |
parent | 2cd96b80efd4a73a12d2c63ef46d0de8d31babf3 (diff) |
alsa-state: set up asound configs dynamically for verdin-imx8 boards
We need set up asound.conf and asound.state dynamitically at runtime
since the Verdin Development/Dahlia boards are using different ones.
To achieve that, we now introduce a on-target package postinst script
to set up them at runtime by checking /proc/device-tree/model to
determine which config files should be used.
Related-to: ELB-4349
Signed-off-by: Ming Liu <ming.liu@toradex.com>
Diffstat (limited to 'recipes-bsp/alsa-state/alsa-state.bbappend')
-rw-r--r-- | recipes-bsp/alsa-state/alsa-state.bbappend | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/recipes-bsp/alsa-state/alsa-state.bbappend b/recipes-bsp/alsa-state/alsa-state.bbappend index 51f5749..5a1cef7 100644 --- a/recipes-bsp/alsa-state/alsa-state.bbappend +++ b/recipes-bsp/alsa-state/alsa-state.bbappend @@ -1,4 +1,40 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/alsa-state/:" -#make this machine specific, as we have different codecs with different settings +# make this machine specific, as we have different codecs with different settings PACKAGE_ARCH_tdx = "${MACHINE_ARCH}" + +SRC_URI_append_mx8m_tdx = " \ + file://asound-dev.conf \ + file://asound-dahlia.conf \ + file://asound-dev.state \ + file://asound-dahlia.state \ +" + +FILES_${PN} += "${sysconfdir}/asound-*.conf" + +do_install_append_mx8m_tdx () { + # Remove the default asound.conf, we need set up asound.conf dynamically + # at runtime to support both dev/dahlia boards. + rm -f ${D}${sysconfdir}/asound.conf + rm -f ${D}${localstatedir}/lib/alsa/asound.state + install -m 0644 ${WORKDIR}/asound-*.conf ${D}${sysconfdir} + install -m 0644 ${WORKDIR}/asound-*.state ${D}${localstatedir}/lib/alsa +} + +# Invalidate the default pkg_postinst in oe-core, this ensures our ontarget +# postinst to be the only one to run during package installation. +pkg_postinst_${PN}_mx8m_tdx () { +} + +pkg_postinst_ontarget_${PN}_mx8m_tdx () { + if grep -q "Development" /proc/device-tree/model; then + board="dev" + else + board="dahlia" + fi + + mv /etc/asound-$board.conf /etc/asound.conf + mv /var/lib/alsa/asound-$board.state /var/lib/alsa/asound.state + rm -f /etc/asound-*.conf + rm -f /var/lib/alsa/asound-*.state +} |