Configuring ALSA dummy output / building kernel modules?

Hi all,

I'm trying to set up ALSA with a dummy driver, so I can play around with audio streaming. I've been trying to follow the instructions here:
> http://www.alsa-project.org/main/index. … dule-dummy">http://www.alsa-project.org/main/index.php/Matrix:Module-dummy
but not getting very far. To be honest hacking about with kernel modules is a bit beyond me.

The docs at the link seem to be suggesting that I need to compile a kernel module to get a dummy sound driver. First hurdle: I don't have the kernel sources on my linode. uname -a returns the following:
> Linux moominpapa 2.6.39.1-linode34 #1 SMP Tue Jun 21 10:29:24 EDT 2011 i686 GNU/Linux
so I downloaded the source tarball for 2.6.39.1 from kernel.org into /usr/src, unzipped it and linked /usr/src/linux to /usr/src/linux-2.6.39.1.

Now, when I try to compile the dummy sound driver, using this line from the docs referenced above:
> ./configure –with-cards=dummy --with-sequencer=yes
I get the following compile error:
> …

checking for kernel linux/version.h … no

The file /usr/src/linux/include/INCLUDEVERSIONH does not exist.

And that's where I run out of ideas.

So, some questions for the wise:
* Is there a way to set up a dummy driver for ALSA without having to compile kernel modules?

Surely there must be some APT packages for this? apt-cache searches don't return anything immediately obvious for alsa-drivers.

If I do indeed need to compile the modules, is this supported by Linode?

What am I doing wrong re: module compilation? Have I linked /usr/src/linux to the wrong place?</list></r>

9 Replies

I think you want to gunzip and copy /proc/config.gz to /usr/src/linux/.config then run 'make oldconfig' … I believe that's what creates the version.h.

As a practical matter, though, running your distro's kernel and installing its alsa dummy modules (or your own kernel, if it comes down to it) tends to work out a little better: modules are compiled to specific kernel versions, so upgrades become a bit of a bear. See http://library.linode.com/linode-platfo … -instances">http://library.linode.com/linode-platform/custom-instances for tips on that.

Thanks, hoopycat, that's a useful clue.

After spending a long time and a lot of Googling trying to get this to work today, I've adopted a different strategy: it turns out that as of 2.5, ALSA was included in the linux sources. So, no extra download needed: if you've got the kernel sources, you've got ALSA.

So, I upgraded my kernel to the newest supplied by Linode (3.0.4 at the time I write this), and downloaded the sources to 3.0.4 from kernel.org to /usr/src.

Copying the config from /proc/config.gz got the config that was used to build the current kernel. Of course, since this is a linode-supplied kernel, it doesn't have ALSA enabled by default, or any of the sound driver modules. So, I used make menuconfig to edit the config and enable these, modularised.

Then, make modules appeared to build the modules I needed. make modules_install seemed to install them to /lib/modules.

However, modinfo soundcore failed, because the modules were in /lib/modules/3.0.4, not /lib/modules/3.0.4-linode38. So I linked /lib/modules/3.0.4-linode38 to /lib/modules/3.0.4.

modinfo still failed, complaining of a missing modules.dep, so I ran depmod to create that. Finally, modinfo soundcore worked!
> filename: /lib/modules/3.0.4-linode38/kernel/sound/soundcore.ko

license: GPL

author: Alan Cox

description: Core sound module

depends:

vermagic: 3.0.4 SMP mod_unload modversions CORE2

However, modprobe snd-dummy fails.
> WARNING: All config files need .conf: /etc/modprobe.d/blacklist-modem, it will be ignored in a future release.

WARNING: All config files need .conf: /etc/modprobe.d/alsa-base, it will be ignored in a future release.

WARNING: Error inserting soundcore (/lib/modules/3.0.4-linode38/kernel/sound/soundcore.ko): Invalid module format

WARNING: Error inserting snd (/lib/modules/3.0.4-linode38/kernel/sound/core/snd.ko): Invalid module format

WARNING: Error inserting snd_timer (/lib/modules/3.0.4-linode38/kernel/sound/core/snd-timer.ko): Invalid module format

WARNING: Error inserting snd_pcm (/lib/modules/3.0.4-linode38/kernel/sound/core/snd-pcm.ko): Invalid module format

FATAL: Error inserting snd_dummy (/lib/modules/3.0.4-linode38/kernel/sound/drivers/snd-dummy.ko): Invalid module format

I don't get it. Is stock 3.0.4 really so different from 3.0.4-linode38 that modules compiled against it are incompatible?

Ah. I think I just realised what hoopycat meant about custom kernels. If I can't work out how to compile for the linode-supplied one, maybe I should just compile my own. Then at least I know the kernel'll match the modules.

You can't load kernel modules against a linode kernel, IIRC. You need to use your own kernel and load modules against it. I think.

Linode Staff

@Guspaz:

You can't load kernel modules against a linode kernel, IIRC. You need to use your own kernel and load modules against it. I think.
Incorrect. You can load modules just fine into our provided kernels - however modprobe will likely complain unless you match the kernel version string and gcc versions used to compile the kernel and the module.

-Chris

So, I finally got this to work last night. If anyone else stumbles across this thread when searching for help: the moral of the story is, if you want to load kernel modules on your Linode, by far the most painless way is to compile your own kernel using the instructions at http://library.linode.com/linode-platfo … -instances">http://library.linode.com/linode-platform/custom-instances which make the whole process pretty straightforward.

Thanks hoopycat & caker for the help along the way!

I know this thread is old, but it's the closest I've been able to find so far towards what I'm trying to accomplish. What I'm trying to do is build a Linode VM that has virtual / dummy / fake sound drivers.

I've gotten as far as prehensile in the following post …

@prehensile:

Thanks, hoopycat, that's a useful clue.

After spending a long time and a lot of Googling trying to get this to work today, I've adopted a different strategy: it turns out that as of 2.5, ALSA was included in the linux sources. So, no extra download needed: if you've got the kernel sources, you've got ALSA.

So, I upgraded my kernel to the newest supplied by Linode (3.0.4 at the time I write this), and downloaded the sources to 3.0.4 from kernel.org to /usr/src.

Copying the config from /proc/config.gz got the config that was used to build the current kernel. Of course, since this is a linode-supplied kernel, it doesn't have ALSA enabled by default, or any of the sound driver modules. So, I used make menuconfig to edit the config and enable these, modularised.

Then, make modules appeared to build the modules I needed. make modules_install seemed to install them to /lib/modules.

However, modinfo soundcore failed, because the modules were in /lib/modules/3.0.4, not /lib/modules/3.0.4-linode38. So I linked /lib/modules/3.0.4-linode38 to /lib/modules/3.0.4.

modinfo still failed, complaining of a missing modules.dep, so I ran depmod to create that. Finally, modinfo soundcore worked!
> filename: /lib/modules/3.0.4-linode38/kernel/sound/soundcore.ko

license: GPL

author: Alan Cox

description: Core sound module

depends:

vermagic: 3.0.4 SMP mod_unload modversions CORE2

However, modprobe snd-dummy fails.
> WARNING: All config files need .conf: /etc/modprobe.d/blacklist-modem, it will be ignored in a future release.

WARNING: All config files need .conf: /etc/modprobe.d/alsa-base, it will be ignored in a future release.

WARNING: Error inserting soundcore (/lib/modules/3.0.4-linode38/kernel/sound/soundcore.ko): Invalid module format

WARNING: Error inserting snd (/lib/modules/3.0.4-linode38/kernel/sound/core/snd.ko): Invalid module format

WARNING: Error inserting snd_timer (/lib/modules/3.0.4-linode38/kernel/sound/core/snd-timer.ko): Invalid module format

WARNING: Error inserting snd_pcm (/lib/modules/3.0.4-linode38/kernel/sound/core/snd-pcm.ko): Invalid module format

FATAL: Error inserting snd_dummy (/lib/modules/3.0.4-linode38/kernel/sound/drivers/snd-dummy.ko): Invalid module format

I don't get it. Is stock 3.0.4 really so different from 3.0.4-linode38 that modules compiled against it are incompatible?

… and then caker mentions what I think is the answer I need …

@caker:

@Guspaz:

You can't load kernel modules against a linode kernel, IIRC. You need to use your own kernel and load modules against it. I think.
Incorrect. You can load modules just fine into our provided kernels - however modprobe will likely complain unless you match the kernel version string and gcc versions used to compile the kernel and the module.

-Chris

… but it's not something I'm keen on. The last time I did that kind of kernel work was when 2.6 was new and I don't recall how to do that.

And then the "solution" that prehensile found …

@prehensile:

So, I finally got this to work last night. If anyone else stumbles across this thread when searching for help: the moral of the story is, if you want to load kernel modules on your Linode, by far the most painless way is to compile your own kernel using the instructions at http://library.linode.com/linode-platfo … -instances">http://library.linode.com/linode-platform/custom-instances which make the whole process pretty straightforward.

Thanks hoopycat & caker for the help along the way!

… is a dead link.

So does anybody know how I can either obtain the source code for Linode's kernel (4.5.5-x86_64-linode69 in my case), or successfully compile and load a module from the vanilla 4.5.5 Linux source?

The rest of the topic is one I am not intimately familiar with but perhaps that link was intended to take you to: https://www.linode.com/docs/tools-refer … s-distros/">https://www.linode.com/docs/tools-reference/custom-kernels-distros/

@edward01:

I think I just realised what hoopycat meant about custom kernels. If I can't work out how to compile for the linode-supplied one, maybe I should just compile my own. Then at least I know the kernel'll match the modules.

I've been able to just "force load" the modules with modprobe upon every boot of the VM as a means to circumvent the fact that the modules I've built won't automatically load.

So although not an elegant solution, this problem is now solved as far as I'm concerned.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct