diff options
Diffstat (limited to 'recipes-support/fastrpc')
7 files changed, 276 insertions, 0 deletions
diff --git a/recipes-support/fastrpc/fastrpc/0001-apps_std_fopen_with_env-account-for-domain-kinds-whe.patch b/recipes-support/fastrpc/fastrpc/0001-apps_std_fopen_with_env-account-for-domain-kinds-whe.patch new file mode 100644 index 0000000..1206c6e --- /dev/null +++ b/recipes-support/fastrpc/fastrpc/0001-apps_std_fopen_with_env-account-for-domain-kinds-whe.patch @@ -0,0 +1,128 @@ +From 771c3bc695a18b3bdedea6fac44b3e71708cc540 Mon Sep 17 00:00:00 2001 +From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> +Date: Sat, 6 Mar 2021 04:25:01 +0300 +Subject: [PATCH] apps_std_fopen_with_env: account for domain kinds when + looking for data + +Currenty apps_std_fopen_with_env() will care about domain only in the +fallback path when looking into /dsp/ dir (/dsp/adsp, /dsp/cdsp, etc). +Account for different domains when looking for the file in the path (so +that e.g. cDSP files will be looked up in the /usr/lib/rfsa/cdsp +directory rather than the default /usr/lib/rfsa/adsp). + +Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> +Change-Id: I1dac61d36edc9e8ff1fdc2d56f968d2578f10399 +--- + src/apps_std_imp.c | 60 ++++++++++++++++++++++------------------------ + 1 file changed, 28 insertions(+), 32 deletions(-) + +diff --git a/src/apps_std_imp.c b/src/apps_std_imp.c +index d2559c60d2d6..701d799f5608 100644 +--- a/src/apps_std_imp.c ++++ b/src/apps_std_imp.c +@@ -662,6 +662,7 @@ __QAIC_IMPL_EXPORT int __QAIC_IMPL(apps_std_fopen_with_env)(const char* envvarna + char *absName = NULL; + uint16 absNameLen = 0; + int domain; ++ const char *dspName = NULL; + + VERIFYC(NULL != mode, AEE_EINVALIDMODE); + VERIFYC(NULL != delim, AEE_EINVALIDFORMAT); +@@ -670,8 +671,23 @@ __QAIC_IMPL_EXPORT int __QAIC_IMPL(apps_std_fopen_with_env)(const char* envvarna + VERIFY(0 == (nErr = get_dirlist_from_env(envvarname, &dirListBuf ))); + VERIFYC(NULL != (dirList = dirListBuf), AEE_EMEMPTR); + ++ domain = get_domain_id() & DOMAIN_ID_MASK; ++ ++ if (domain == ADSP_DOMAIN_ID){ ++ dspName = "adsp"; ++ } else if (domain == MDSP_DOMAIN_ID){ ++ dspName = "mdsp"; ++ } else if (domain == SDSP_DOMAIN_ID){ ++ dspName = "sdsp"; ++ } else if (domain == CDSP_DOMAIN_ID) { ++ dspName = "cdsp"; ++ } else { ++ dspName = "adsp"; ++ } ++ + while(dirList) + { ++ int dirNameLen; + pos = strstr(dirList, delim); + dirName = dirList; + if (pos) { +@@ -682,10 +698,13 @@ __QAIC_IMPL_EXPORT int __QAIC_IMPL(apps_std_fopen_with_env)(const char* envvarna + } + + // Account for slash char +- absNameLen = std_strlen(dirName) + std_strlen(name) + 2; ++ dirNameLen = std_strlen(dirName); ++ absNameLen = dirNameLen + std_strlen(name) + 2; + VERIFYC(NULL != (absName = (char*)malloc(sizeof(char) * absNameLen)), AEE_ENOMEMORY); + if ('\0' != *dirName) { + std_strlcpy(absName, dirName, absNameLen); ++ if (!std_strcmp(absName + dirNameLen - 4, "adsp")) ++ std_memscpy(absName + dirNameLen - 4, 4, dspName, 4); + std_strlcat(absName, "/", absNameLen); + std_strlcat(absName, name, absNameLen); + } else { +@@ -699,47 +718,24 @@ __QAIC_IMPL_EXPORT int __QAIC_IMPL(apps_std_fopen_with_env)(const char* envvarna + goto bail; + } + } +- domain = get_domain_id() & DOMAIN_ID_MASK; + + #ifdef ANDROID_P + absNameLen = std_strlen("/vendor/dsp/adsp/") + std_strlen(name) + 1; + VERIFYC(NULL != (absName = (char*)malloc(sizeof(char) * absNameLen)), AEE_ENOMEMORY); + +- if (domain == ADSP_DOMAIN_ID){ +- std_strlcpy(absName, "/vendor/dsp/adsp/", absNameLen); +- std_strlcat(absName, name,absNameLen); +- } else if (domain == MDSP_DOMAIN_ID){ +- std_strlcpy(absName, "/vendor/dsp/mdsp/", absNameLen); +- std_strlcat(absName, name,absNameLen); +- } else if (domain == SDSP_DOMAIN_ID){ +- std_strlcpy(absName, "/vendor/dsp/sdsp/", absNameLen); +- std_strlcat(absName, name,absNameLen); +- } else if (domain == CDSP_DOMAIN_ID) { +- std_strlcpy(absName, "/vendor/dsp/cdsp/", absNameLen); +- std_strlcat(absName, name,absNameLen); +- } else { +- absName[0] = '\0'; +- } ++ std_strlcpy(absName, "/vendor/dsp/", absNameLen); ++ std_strlcat(absName, dspName, absNameLen); ++ std_strlcat(absName, "/", absNameLen); ++ std_strlcat(absName, name,absNameLen); + nErr = apps_std_fopen(absName, mode, psout); + #else + absNameLen = std_strlen("/dsp/adsp/") + std_strlen(name) + 1; + VERIFYC(NULL != (absName = (char*)malloc(sizeof(char) * absNameLen)), AEE_ENOMEMORY); + +- if (domain == ADSP_DOMAIN_ID){ +- std_strlcpy(absName, "/dsp/adsp/", absNameLen); +- std_strlcat(absName, name,absNameLen); +- } else if (domain == MDSP_DOMAIN_ID){ +- std_strlcpy(absName, "/dsp/mdsp/", absNameLen); +- std_strlcat(absName, name,absNameLen); +- } else if (domain == SDSP_DOMAIN_ID){ +- std_strlcpy(absName, "/dsp/sdsp/", absNameLen); +- std_strlcat(absName, name,absNameLen); +- } else if (domain == CDSP_DOMAIN_ID) { +- std_strlcpy(absName, "/dsp/cdsp/", absNameLen); +- std_strlcat(absName, name,absNameLen); +- } else { +- absName[0] = '\0'; +- } ++ std_strlcpy(absName, "/dsp/", absNameLen); ++ std_strlcat(absName, dspName, absNameLen); ++ std_strlcat(absName, "/", absNameLen); ++ std_strlcat(absName, name,absNameLen); + nErr = apps_std_fopen(absName, mode, psout); + #endif + bail: +-- +2.30.0 + diff --git a/recipes-support/fastrpc/fastrpc/adsprpcd.service b/recipes-support/fastrpc/fastrpc/adsprpcd.service new file mode 100644 index 0000000..c2b09bf --- /dev/null +++ b/recipes-support/fastrpc/fastrpc/adsprpcd.service @@ -0,0 +1,9 @@ +[Unit] +Description=aDSP RPC daemon + +[Service] +Type=exec +ExecStart=/usr/bin/adsprpcd + +[Install] +WantedBy=multi-user.target diff --git a/recipes-support/fastrpc/fastrpc/cdsprpcd.service b/recipes-support/fastrpc/fastrpc/cdsprpcd.service new file mode 100644 index 0000000..39b7300 --- /dev/null +++ b/recipes-support/fastrpc/fastrpc/cdsprpcd.service @@ -0,0 +1,9 @@ +[Unit] +Description=cDSP RPC daemon + +[Service] +Type=exec +ExecStart=/usr/bin/cdsprpcd + +[Install] +WantedBy=multi-user.target diff --git a/recipes-support/fastrpc/fastrpc/mount-dsp.sh b/recipes-support/fastrpc/fastrpc/mount-dsp.sh new file mode 100644 index 0000000..61ff0f7 --- /dev/null +++ b/recipes-support/fastrpc/fastrpc/mount-dsp.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +set -e + +modprobe socinfo || true + +if [ -r /sys/devices/soc0/machine ] ; then + MACHINE=`cat /sys/devices/soc0/machine` + case $MACHINE in + QRB2210) + WHAT=/lib/firmware/qcom/qrb2210/dspso.bin + ;; + QRB4210) + WHAT=/lib/firmware/qcom/qrb4210/dspso.bin + ;; + SM8250|QRB5165) + WHAT=/lib/firmware/qcom/sm8250/dspso.bin + ;; + APQ8096) + WHAT=/lib/firmware/qcom/msm8996/adspso.bin + ;; + esac +fi + +if [ -z "$WHAT" -o ! -r "$WHAT" ] ; then + i=0 + while ! [ -d /dev/disk/by-partlabel ] ; do + i=$(( $i + 1)) + [ $i -gt 30 ] && break; + sleep 1 + done + + if [ -h /dev/disk/by-partlabel/dsp_a ] ; then + WHAT=/dev/disk/by-partlabel/dsp_a + else + WHAT=/dev/disk/by-partlabel/dsp + fi +fi + +if [ -e "$WHAT" ] ; then + mount $WHAT /usr/lib/rfsa -o ro +else + echo "Not mounting /usr/lib/rfsa, partition/image not found" 1>&2 +fi diff --git a/recipes-support/fastrpc/fastrpc/sdsprpcd.service b/recipes-support/fastrpc/fastrpc/sdsprpcd.service new file mode 100644 index 0000000..fd37cfa --- /dev/null +++ b/recipes-support/fastrpc/fastrpc/sdsprpcd.service @@ -0,0 +1,9 @@ +[Unit] +Description=sDSP RPC daemon + +[Service] +Type=exec +ExecStart=/usr/bin/sdsprpcd + +[Install] +WantedBy=multi-user.target diff --git a/recipes-support/fastrpc/fastrpc/usr-lib-rfsa.service b/recipes-support/fastrpc/fastrpc/usr-lib-rfsa.service new file mode 100644 index 0000000..f5fc76a --- /dev/null +++ b/recipes-support/fastrpc/fastrpc/usr-lib-rfsa.service @@ -0,0 +1,16 @@ +[Unit] +Description=Mount DSP partition to /usr/lib/rfsa +DefaultDependencies=false +Before=umount.target local-fs.target +After=local-pre-fs.target +Conflicts=umount.target + +[Service] +Type=oneshot +RemainAfterExit=Yes +TimeoutSec=0 +ExecStart=/usr/sbin/mount-dsp.sh +ExecStop=/bin/umount /usr/lib/rfsa + +[Install] +WantedBy=local-fs.target diff --git a/recipes-support/fastrpc/fastrpc_git.bb b/recipes-support/fastrpc/fastrpc_git.bb new file mode 100644 index 0000000..9c9282c --- /dev/null +++ b/recipes-support/fastrpc/fastrpc_git.bb @@ -0,0 +1,61 @@ +HOMEPAGE = "https://git.codelinaro.org/linaro/qcomlt/fastrpc.git" +SUMMARY = "Qualcomm FastRPC applications and library" +SECTION = "devel" + +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://src/fastrpc_apps_user.c;beginline=1;endline=29;md5=f94f3a7beba14ae2f59f817e9634f891" + +SRCREV = "06ef0e7ae56b9f7dde53fb92e8a4bc5a843af8a8" +SRC_URI = "\ + git://git.codelinaro.org/linaro/qcomlt/fastrpc.git;branch=automake;protocol=https \ + file://0001-apps_std_fopen_with_env-account-for-domain-kinds-whe.patch \ + file://adsprpcd.service \ + file://cdsprpcd.service \ + file://sdsprpcd.service \ + file://usr-lib-rfsa.service \ + file://mount-dsp.sh \ +" + +PV = "0.0+${SRCPV}" + +S = "${WORKDIR}/git" + +inherit autotools systemd + +PACKAGES += "${PN}-systemd" +RRECOMMENDS:${PN} += "${PN}-systemd" + +SYSTEMD_PACKAGES = "${PN} ${PN}-systemd" + +SYSTEMD_SERVICE:${PN} = "usr-lib-rfsa.service" + +SYSTEMD_SERVICE:${PN}-systemd = "adsprpcd.service cdsprpcd.service sdsprpcd.service" +SYSTEMD_AUTO_ENABLE:${PN}-systemd = "disable" + +do_install:append() { + install -d ${D}${libdir}/rfsa + + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${UNPACKDIR}/usr-lib-rfsa.service ${D}${systemd_unitdir}/system + install -m 0644 ${UNPACKDIR}/adsprpcd.service ${D}${systemd_unitdir}/system + install -m 0644 ${UNPACKDIR}/cdsprpcd.service ${D}${systemd_unitdir}/system + install -m 0644 ${UNPACKDIR}/sdsprpcd.service ${D}${systemd_unitdir}/system + + install -d ${D}${sbindir} + install -m 0755 ${UNPACKDIR}/mount-dsp.sh ${D}${sbindir} +} + +FILES:${PN} += " \ + ${libdir}/rfsa \ + ${libdir}/libadsp_default_listener.so \ + ${libdir}/libcdsp_default_listener.so \ + ${libdir}/libsdsp_default_listener.so \ + ${libdir}/libadsprpc.so \ + ${libdir}/libcdsprpc.so \ + ${libdir}/libsdsprpc.so \ +" + +FILES:${PN}-dev:remove = "${FILES_SOLIBSDEV}" + +# We need to include lib*dsprpc.so into fastrpc for compatibility with Hexagon SDK +ERROR_QA:remove = "dev-so" |