From eda84d25d819824d641cf89af1e4d61a5e946744 Mon Sep 17 00:00:00 2001 From: amanarora_09 Date: Fri, 22 Jul 2022 15:58:23 +0200 Subject: meta-offline-voice-agent: Enable layer for offline voice recognition - This enables offline voice recognition in AGL - Can successfully run vosk API and vosk websocket server Changes: - Create a new layer: meta-offline-voice-recognition - Create recipes for the the Vosk library, API, websocket server and model - Create feature template for the layer (agl-offline-voice-agent) - Add all required packages to IMAGE_INSTALL - ptest enable recipe python3-vosk-api - Few fixes Bug-AGL: SPEC-4497 Change-Id: Icb290ceee22e2c3a51cbd67f7431701795f1201b Signed-off-by: amanarora_09 --- .../files/0001-Modify-makefile-for-yocto.patch | 44 ++++++++++++++++ .../recipes-blas/openblas/openblas_git.bb | 61 ++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 meta-offline-voice-agent/recipes-blas/openblas/files/0001-Modify-makefile-for-yocto.patch create mode 100644 meta-offline-voice-agent/recipes-blas/openblas/openblas_git.bb (limited to 'meta-offline-voice-agent/recipes-blas') diff --git a/meta-offline-voice-agent/recipes-blas/openblas/files/0001-Modify-makefile-for-yocto.patch b/meta-offline-voice-agent/recipes-blas/openblas/files/0001-Modify-makefile-for-yocto.patch new file mode 100644 index 00000000..4adb7939 --- /dev/null +++ b/meta-offline-voice-agent/recipes-blas/openblas/files/0001-Modify-makefile-for-yocto.patch @@ -0,0 +1,44 @@ +From bc9476ad859b7e582b89f532f5e84771d6e026d2 Mon Sep 17 00:00:00 2001 +From: Yongjoo Ahn +Date: Fri, 16 Oct 2020 14:22:38 +0900 +Subject: [PATCH] Modify makefile for yocto + +- Modify makefile for yocto make build support + +Signed-off-by: Yongjoo Ahn +--- + Makefile.install | 4 ++-- + Makefile.system | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/Makefile.install b/Makefile.install +index dad869f4..1bfdb94b 100644 +--- a/Makefile.install ++++ b/Makefile.install +@@ -128,8 +128,8 @@ endif + + #Generating openblas.pc + @echo Generating openblas.pc in "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)" +- @echo 'libdir='$(OPENBLAS_LIBRARY_DIR) > "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc" +- @echo 'includedir='$(OPENBLAS_INCLUDE_DIR) >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc" ++ @echo 'libdir='$(libdir) > "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc" ++ @echo 'includedir='$(includedir) >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc" + @echo 'openblas_config= USE_64BITINT='$(USE_64BITINT) 'DYNAMIC_ARCH='$(DYNAMIC_ARCH) 'DYNAMIC_OLDER='$(DYNAMIC_OLDER) 'NO_CBLAS='$(NO_CBLAS) 'NO_LAPACK='$(NO_LAPACK) 'NO_LAPACKE='$(NO_LAPACKE) 'NO_AFFINITY='$(NO_AFFINITY) 'USE_OPENMP='$(USE_OPENMP) $(CORE) 'MAX_THREADS='$(NUM_THREADS)>> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc" + @echo 'version='$(VERSION) >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc" + @echo 'extralib='$(EXTRALIB) >> "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)/openblas.pc" +diff --git a/Makefile.system b/Makefile.system +index 8d78b420..4d1eab68 100644 +--- a/Makefile.system ++++ b/Makefile.system +@@ -1184,7 +1184,7 @@ endif + + KERNELDIR = $(TOPDIR)/kernel/$(ARCH) + +-include $(TOPDIR)/Makefile.$(ARCH) ++# include $(TOPDIR)/Makefile.$(ARCH) + + CCOMMON_OPT += -UASMNAME -UASMFNAME -UNAME -UCNAME -UCHAR_NAME -UCHAR_CNAME + CCOMMON_OPT += -DASMNAME=$(FU)$(*F) -DASMFNAME=$(FU)$(*F)$(BU) -DNAME=$(*F)$(BU) -DCNAME=$(*F) -DCHAR_NAME=\"$(*F)$(BU)\" -DCHAR_CNAME=\"$(*F)\" +-- +2.17.1 + diff --git a/meta-offline-voice-agent/recipes-blas/openblas/openblas_git.bb b/meta-offline-voice-agent/recipes-blas/openblas/openblas_git.bb new file mode 100644 index 00000000..84e76542 --- /dev/null +++ b/meta-offline-voice-agent/recipes-blas/openblas/openblas_git.bb @@ -0,0 +1,61 @@ +DESCRIPTION = "OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version." +SUMMARY = "OpenBLAS : An optimized BLAS library" +HOMEPAGE = "http://www.openblas.net/" +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENSE;md5=5adf4792c949a00013ce25d476a2abc0" + +SRC_URI = "\ + git://github.com/xianyi/OpenBLAS;protocol=https;branch=develop \ +" + +# tag 0.3.20 +SRCREV = "0b678b19dc03f2a999d6e038814c4c50b9640a4e" +S = "${WORKDIR}/git" + +DEPENDS += "libgfortran" + +def map_arch(d): + import re + arch = d.getVar('TARGET_ARCH', True) + if re.match('i.86$', arch): return 'ATOM' + elif re.match('x86_64$', arch): return 'ATOM' + elif re.match('aarch32$', arch): return 'CORTEXA9' + elif re.match('aarch64$', arch): return 'ARMV8' + return 'CORTEXA15' + +def map_bits(d): + import re + arch = d.getVar('TARGET_ARCH', True) + if re.match('i.86$', arch): return 32 + elif re.match('x86_64$', arch): return 64 + elif re.match('aarch32$', arch): return 32 + elif re.match('aarch64$', arch): return 64 + return 32 + +EXTRA_OEMAKE = "\ + BUILD_WITHOUT_LAPACK=OFF \ + HOSTCC=${BUILD_CC} \ + CROSS=1 \ + CROSS_SUFFIX=${TARGET_PREFIX} \ + BINARY=${@map_bits(d)} \ + TARGET=${@map_arch(d)} \ + OPENBLAS_LIBRARY_DIR=${D}${libdir} \ + DYNAMIC_ARCH=ON \ + BUILD_STATIC_LIBS=ON \ + USE_LOCKING=1 \ + USE_THREAD=0 \ +" + +do_install() { + oe_runmake PREFIX=${D}${prefix} install + rm -rf ${D}${bindir} ${D}${libdir}/cmake + # fixup pkgconfig file + sed -i -e "s#libdir=/.*#libdir=${libdir}#" ${D}${libdir}/pkgconfig/openblas.pc + sed -i -e "s#includedir=/.*#includedir=${includedir}#" ${D}${libdir}/pkgconfig/openblas.pc + + cat ${D}${libdir}/pkgconfig/openblas.pc + +} + +FILES:${PN}-dev = "${includedir} ${libdir}/lib${PN}.so" +FILES:${PN} = "${libdir}/*" -- cgit 1.2.3-korg