基于高通sdx12平台,简单介绍编译(bitbake)

高通sdx12平台:bitbake

  • 编译介绍
    • Audio machine、platform、dai等单独编译介绍
  • 新添加bb文件

编译介绍

1、编译环境配置脚本
基于高通sdx12平台,简单介绍编译(bitbake)_第1张图片

Audio machine、platform、dai等单独编译介绍

对于machine驱动,platform驱动,dai驱动等,高通在x12上放在了ap侧的vendor下面,隔离出去,单独编译kernel是编译不到audio相关得这部分kernel代码,如下:

在这里插入图片描述
但是我们也可以单独去编译ap侧得kernel侧audio相关得东西,编译命令如下:

source build/conf/set_bb_env.sh
bitbake -c compile -f audiodlkm -v

编译后生成得是ko文件,我们push到板子里面就可以了,

Z:\10_sdx12\sdx12-le-1-0\apps_proc\poky\build\tmp-glibc\work\sdxnightjar-oe-linux-gnueabi\audiodlkm\git-r0\image\lib\modules\5.4.86-debug\extra
基于高通sdx12平台,简单介绍编译(bitbake)_第2张图片

push到如下路径,重启即可:

/lib/modules/5.4.86-perf/extra

板子/etc/modules-load-d/路径下有 audio_load.conf文件,开机得时候,会加载这些ko

#Install under /etc/modules-load-d/ path
q6_notifier_dlkm
apr_dlkm
adsp_loader_dlkm
q6_dlkm
platform_dlkm
native_dlkm
pinctrl_wcd_dlkm
swr_dlkm
stub_dlkm
wcd_core_dlkm
mbhc_dlkm
wcd9xxx_dlkm
swr_ctrl_dlkm
wcd934x_dlkm
wsa881x_dlkm
machine_dlkm

开机得时候,会执行如下脚本,在脚本中会把放在lib下得ko都insmod

meta-qti-audio/recipes/audio_dlkm_kernel/files/sdxnightjar/start_audio_le


export MODULE_BASE=/lib/modules/`uname -r`/
set -e

case "$1" in
  start)
        echo -n "Starting/Loading audio module: "

        echo "audio:start/load" > /dev/kmsg
        insmod $MODULE_BASE/extra/q6_notifier_dlkm.ko
        insmod $MODULE_BASE/extra/snd_event_dlkm.ko
        insmod $MODULE_BASE/extra/apr_dlkm.ko
        insmod $MODULE_BASE/extra/adsp_loader_dlkm.ko
        echo 1 > /sys/kernel/boot_adsp/boot
        insmod $MODULE_BASE/extra/q6_dlkm.ko
        insmod $MODULE_BASE/extra/platform_dlkm.ko
        insmod $MODULE_BASE/extra/native_dlkm.ko
        ##insmod $MODULE_BASE/extra/swr_dlkm.ko
        insmod $MODULE_BASE/extra/stub_dlkm.ko
        insmod $MODULE_BASE/extra/wcd_core_dlkm.ko
        ##insmod $MODULE_BASE/extra/mbhc_dlkm.ko
        ##insmod $MODULE_BASE/extra/wcd9xxx_dlkm.ko
        ##insmod $MODULE_BASE/extra/swr_ctrl_dlkm.ko
        ##insmod $MODULE_BASE/extra/wcd9335_dlkm.ko
        ##insmod $MODULE_BASE/extra/wsa881x_dlkm.ko
        ##insmod $MODULE_BASE/extra/nau8822_dlkm.ko
        insmod $MODULE_BASE/extra/machine_dlkm.ko

        echo "done loading audio_kernel module"
        ;;
  stop)
        echo -n "Bypassing Unloading of  audio_kernel modules "
        echo 0 > /sys/kernel/boot_adsp/boot
        ;;
  restart)
        $0 stop
        $0 start
        ;;
  *)
        echo "Usage { start | stop | restart}" >&2
        exit 1
        ;;
esac

exit 0

新添加bb文件

1、加入.c文件和makefile

vendor\qcom\opensource\kernel-tests\mm-audio\audioucm

基于高通sdx12平台,简单介绍编译(bitbake)_第3张图片
makefile如下:

SRC=$(wildcard ./*.c)
target=audioucm
all:
	#mkdir -p target
	$(CC) $(SRC) -o $(target) -rdynamic -ldl
clean:
	rm -rf target	

2、加入对应得bb文件

sdx12-ap\poky\meta-qti-audio\recipes\audioucm

基于高通sdx12平台,简单介绍编译(bitbake)_第4张图片

bb文件如下:

inherit qcommon

DESCRIPTION = "init acdb"
LICENSE = "Apache-2.0"
PR = "r0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/${LICENSE};md5=89aea4e17d99a7cacdbeed46a0096b10"

FILES_${PN} += "${bindir}/*"

SRC_URI = "file://vendor/qcom/opensource/kernel-tests/mm-audio/audioucm/"

S = "${WORKDIR}/vendor/qcom/opensource/kernel-tests/mm-audio/audioucm"

prefix="/etc"

do_compile () {
	echo ${S}
    export CC=${BUILD_CC}
    export CXX=${BUILD_CXX}
    export LD=${BUILD_LD}
    export AR=${BUILD_AR}
    oe_runmake all  #这里调用makefile进行编译
}
#这里install到板子中的
do_install() {
  install -d ${D}${bindir}/
  install -m 0755 ${S}/audioucm ${D}${bindir}/
}

(bb文件可以拷贝其他文件得,仿照着写)

3、单独编译,进行验证

  • cd到 sdx12-le-1-0/apps_proc/poky 目录
  • source build/conf/set_bb_env.sh
  • bitbake -c compile -f audioucm(编译,加入-v打印log到窗口)
  • bitbake -c install -f audioucm(install到板子中)
  • bitbake -c package -f audioucm (audioucm单独打包)

这个时候,在如下路径中会有 image目录出现,并且在你指定的路径有你需要的可执行文件,说明ok了

apps_proc\poky\build\tmp-glibc\work\sdxnightjar-oe-linux-gnueabi\audioucm\git-r0

4、单独编译,安装ok后,这个时候需要在编译的最后,把可执行文件等打包到镜像中

apps_proc\poky\meta-qti-audio\recipes-products\images\sdxnightjar\sdxnightjar-base-image.inc

修改sdxnightjar-base-image.inc文件

# Rootfs creation.

#IMAGE_INSTALL += "init-audio"

# Following packages support only 32-bit compilation.
# When 32-bit multilib is enabled, compile them with lib32- prefix.

#IMAGE_INSTALL += "${@bb.utils.contains('MULTILIB_VARIANTS', 'lib32', 'lib32-audiohal', 'audiohal', d)}"
IMAGE_INSTALL += "${@bb.utils.contains('MULTILIB_VARIANTS', 'lib32', 'lib32-tinyalsa', 'tinyalsa', d)}"
IMAGE_INSTALL += "${@bb.utils.contains('MULTILIB_VARIANTS', 'lib32', 'lib32-tinycompress', 'tinycompress', d)}"
IMAGE_INSTALL += "${@bb.utils.contains('MULTILIB_VARIANTS', 'lib32', 'lib32-qahw', 'qahw', d)}"
IMAGE_INSTALL += "${@bb.utils.contains('MULTILIB_VARIANTS', 'lib32', 'lib32-audiodlkm', 'audiodlkm', d)}"
IMAGE_INSTALL += "${@bb.utils.contains('MULTILIB_VARIANTS', 'lib32', 'lib32-init-audio', 'init-audio', d)}"
#IMAGE_INSTALL += "${@bb.utils.contains('MULTILIB_VARIANTS', 'lib32', 'lib32-alsa-intf', 'alsa-intf', d)}"
#加入下面行
IMAGE_INSTALL += "${@bb.utils.contains('MULTILIB_VARIANTS', 'lib32', 'lib32-audioucm', 'audioucm', d)}" 

错误1:
这里遇到了一个问题!!!,split_and_strip_files 报错,报错如下

ERROR: audioucm-git-r0 do_package: Fatal errors occurred in subprocesses:
Command ‘[‘arm-oe-linux-gnueabi-objcopy’, ‘–only-keep-debug’, ‘/fwork1/madingguo/10_sdx12/sdx12-le-1-0/apps_proc/poky/build/tmp-glibc/work/sdxnightjar-oe-linux-gnueabi/audioucm/git-r0/package/etc/audioucm’, ‘/fwork1/madingguo/10_sdx12/sdx12-le-1-0/apps_proc/poky/build/tmp-glibc/work/sdxnightjar-oe-linux-gnueabi/audioucm/git-r0/package/etc/.debug/audioucm’]’ returned non-zero exit status 1: Traceback (most recent call last):
File “/fwork1/madingguo/10_sdx12/sdx12-le-1-0/apps_proc/poky/meta/lib/oe/utils.py”, line 272, in run
ret = self._target(*self._args, **self._kwargs)
File “/fwork1/madingguo/10_sdx12/sdx12-le-1-0/apps_proc/poky/meta/classes/package.bbclass”, line 414, in splitdebuginfo
subprocess.check_output([objcopy, ‘–only-keep-debug’, file, debugfile], stderr=subprocess.STDOUT)
File “/usr/lib/python3.5/subprocess.py”, line 626, in check_output
**kwargs).stdout
File “/usr/lib/python3.5/subprocess.py”, line 708, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ‘[‘arm-oe-linux-gnueabi-objcopy’, ‘–only-keep-debug’, ‘/fwork1/madingguo/10_sdx12/sdx12-le-1-0/apps_proc/poky/build/tmp-glibc/work/sdxnightjar-oe-linux-gnueabi/audioucm/git-r0/package/etc/audioucm’, ‘/fwork1/madingguo/10_sdx12/sdx12-le-1-0/apps_proc/poky/build/tmp-glibc/work/sdxnightjar-oe-linux-gnueabi/audioucm/git-r0/package/etc/.debug/audioucm’]’ returned non-zero exit status 1
ERROR: audioucm-git-r0 do_package: Function failed: split_and_strip_files
ERROR: Logfile of failure stored in: /fwork1/madingguo/10_sdx12/sdx12-le-1-0/apps_proc/poky/build/tmp-glibc/work/sdxnightjar-oe-linux-gnueabi/audioucm/git-r0/temp/log.do_package.108572

根据错误log可以看到,会把audioucm命令拷贝到.debug的一个目录下面,但是我们没有生成这个目录,因此在split_and_strip_files函数中就报错了

查找到的资料如下:
基于高通sdx12平台,简单介绍编译(bitbake)_第5张图片

在bb文件中加入下面配置,来抑制split_and_strip_files,即可

INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
INHIBIT_PACKAGE_STRIP = "1"
PACKAGES = "${PN}"

错误2:
还可能会遇到do_package_qa报错,那么跳过即可

do_package_qa[noexec] = “1”

你可能感兴趣的:(驱动,sdx12,编译,linux,audio,驱动)