gpt4 book ai didi

c - 无法链接linux内核模块:警告:“snd_device_new”未定义

转载 作者:行者123 更新时间:2023-11-30 15:40:17 26 4
gpt4 key购买 nike

我正在学习Linux内核驱动程序,试图为ADC实现SPI声音驱动程序。
该代码可能无法正常工作,但可以编译。
链接出现第一个问题,报告以下错误:

WARNING: "snd_pcm_lib_ioctl" [/home/pi/rpi/gpio/module/spi-mcp3002.ko] undefined!
WARNING: "snd_device_new" [/home/pi/rpi/gpio/module/spi-mcp3002.ko] undefined!
WARNING: "snd_pcm_lib_preallocate_pages_for_all" [/home/pi/rpi/gpio/module/spi-mcp3002.ko] undefined!
WARNING: "snd_pcm_set_ops" [/home/pi/rpi/gpio/module/spi-mcp3002.ko] undefined!
WARNING: "snd_pcm_new" [/home/pi/rpi/gpio/module/spi-mcp3002.ko] undefined!
WARNING: "snd_card_register" [/home/pi/rpi/gpio/module/spi-mcp3002.ko] undefined!
WARNING: "snd_card_create" [/home/pi/rpi/gpio/module/spi-mcp3002.ko] undefined!
WARNING: "snd_pcm_hw_constraint_integer" [/home/pi/rpi/gpio/module/spi-mcp3002.ko] undefined!
WARNING: "snd_pcm_lib_malloc_pages" [/home/pi/rpi/gpio/module/spi-mcp3002.ko] undefined!
WARNING: "snd_pcm_lib_free_pages" [/home/pi/rpi/gpio/module/spi-mcp3002.ko] undefined!
WARNING: "snd_card_free" [/home/pi/rpi/gpio/module/spi-mcp3002.ko] undefined!


源代码是 https://github.com/mpromonet/rpi/blob/master/gpio/module/spi-mcp3002.c,makefile是 https://github.com/mpromonet/rpi/blob/master/gpio/module/Makefile

我猜没有设置一些内核选项,但是哪个?

我尝试使用zcat /proc/config.gz查找禁用的选项。 grep SND | grep“ ^#”

# CONFIG_SND_DYNAMIC_MINORS is not set
# CONFIG_SND_VERBOSE_PRINTK is not set
# CONFIG_SND_DEBUG is not set
# CONFIG_SND_OPL3_LIB_SEQ is not set
# CONFIG_SND_OPL4_LIB_SEQ is not set
# CONFIG_SND_SBAWE_SEQ is not set
# CONFIG_SND_EMU10K1_SEQ is not set
# CONFIG_SND_AC97_POWER_SAVE is not set
# CONFIG_SND_ARMAACI is not set
# CONFIG_SND_ATMEL_SOC is not set
# CONFIG_SND_DESIGNWARE_I2S is not set
# CONFIG_SND_SOC_ALL_CODECS is not set
# CONFIG_SND_SIMPLE_CARD is not set


我将查看内核源代码,这些符号的定义是由什么造成的……但是,如果有人知道我也许可以保存一些内核构建:)

最佳答案

在内核本身之前构建模块,我可能会出错。符号不在Module.symvers中

重新执行模块安装和重新启动解决了问题:

make 
make module_install
reboot

关于c - 无法链接linux内核模块:警告:“snd_device_new”未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21076065/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com