[alsa-devel] gitcompile fail
Hi
I am unable to compile ALSA from fresh git clones. Please would you advise me?
My procedure:
mkdir $HOME/Projects/tiwai cd $HOME/Projects/tiwai git clone git://github.com/tiwai/alsa-driver-build.git git clone git://github.com/tiwai/sound.git cd alsa-driver-build git checkout build cd alsa ./utils/setup-alsa-kernel -c ../../sound ./gitcompile --with-debug=full --enable-dynamic-minors --with-moddir=updates
Problems start with setup-alsa-kernel:
mark@erudite:~/Projects/tiwai/alsa-driver-build/alsa$ ./utils/setup-alsa-kernel -c ../../sound cp: cannot stat '../../sound/Documentation/sound/alsa': No such file or directory cp: cannot stat '../../sound/Documentation/DocBook/alsa-driver-api.tmpl': No such file or directory cp: cannot stat '../../sound/Documentation/DocBook/writing-an-alsa-driver.tmpl': No such file or directory cp: cannot create hard link 'alsa-kernel/Documentation/DocBook' to '../../sound/Documentation/DocBook/stylesheet.xsl': No such file or directory
So I try to gitcompile anyway:
mark@erudite:~/Projects/tiwai/alsa-driver-build/alsa$ ./gitcompile --with-debug=full --enable-dynamic-minors --with-moddir=updates gcc utils/mod-deps.c -o utils/mod-deps utils/mod-deps.c: In function ‘output_card_list’: utils/mod-deps.c:1086:4: warning: format not a string literal and no format arguments [-Wformat-security] printf(card_name); ^ utils/mod-deps --basedir /home/mark/Projects/tiwai/alsa-driver-build/alsa/alsa-kernel --hiddendir /home/mark/Projects/tiwai/alsa-driver-build/alsa --versiondep /home/mark/Projects/tiwai/alsa-driver-build/alsa/kconfig-vers --makeconf
toplevel.config.in
can't handle 'default SND_SEQUENCER && SND_RAWMIDI', translating as depends on can't handle 'default SND_SEQUENCER && SND_OPL3_LIB', translating as depends on can't handle 'default SND_SEQUENCER && SND_OPL4_LIB', translating as depends on can't handle 'default SND_SEQUENCER && SND_SBAWE', translating as depends on can't handle 'default SND_SEQUENCER && SND_EMU10K1', translating as depends on can't handle word INPUT=y properly, supposing it's OK can't handle word INPUT=SND_ES1968 properly, supposing it's OK can't handle word VIDEO_V4L2=y properly, supposing it's OK can't handle word VIDEO_V4L2=SND_ES1968 properly, supposing it's OK can't handle word VIDEO_V4L2=y properly, supposing it's OK can't handle word VIDEO_V4L2=SND_FM801 properly, supposing it's OK can't handle word INPUT=y properly, supposing it's OK can't handle word INPUT=SND_MAESTRO3 properly, supposing it's OK can't handle word INPUT=y properly, supposing it's OK can't handle word INPUT=SND_HDA properly, supposing it's OK can't handle word SND_HDA_INPUT_BEEP=y properly, supposing it's OK can't handle word INPUT=y properly, supposing it's OK can't handle word INPUT=SND_USB_CAIAQ properly, supposing it's OK Wrong condition = Makefile:152: recipe for target 'toplevel.config.in' failed make: *** [toplevel.config.in] Error 1 mark@erudite:~/Projects/tiwai/alsa-driver-build/alsa$
I have successfully compiled ALSA at various times in the past (years ago), and have intermittently worked on developing a driver for an old device. I'd very much like to finish that off and submit it now, but I'm struggling to get out of the starting blocks! You kind assistance is greatly appreciated.
Regards Mark Brand
Thank you sincerely for your response, Clemens.
Please forgive my noobness, but is a full kernel compilation necessary? I'm running Ubuntu 16.04 with 4.4.0-57-lowlatency kernel and my module is closely based on the existing mtpav driver. I believe I know where to place my source file, and what modifications to make to the appropriate Kconfig and Makefile. I recall being able to specify which modules I wanted to compile in arguments to ./configure (followed by make modules), but I don't see that option anymore. Please, could someone point me in the direction of a valid, step-by-step procedure? Every set of instructions that I've been able to find seems to now be out of date.
Thank you again, in anticipation (and apologies too!) Mark Brand ________________________________________ From: Clemens Ladisch [clemens@ladisch.de] Sent: Saturday, January 07, 2017 11:09 AM To: Brand, Mark (Mr) (Summerstrand Campus South); alsa-devel@alsa-project.org Subject: Re: [alsa-devel] gitcompile fail
Mark Brand wrote:
git clone git://github.com/tiwai/alsa-driver-build.git
Don't use that. The ALSA drivers are part of the kernel; just compile the kernel normally.
git clone git://github.com/tiwai/sound.git
This is a kernel repository.
Regards, Clemens
Hi,
On Jan 7 2016 23:14, Mark Brand wrote:
Thank you sincerely for your response, Clemens.
Please forgive my noobness, but is a full kernel compilation necessary? I'm running Ubuntu 16.04 with 4.4.0-57-lowlatency kernel and my module is closely based on the existing mtpav driver. I believe I know where to place my source file, and what modifications to make to the appropriate Kconfig and Makefile. I recall being able to specify which modules I wanted to compile in arguments to ./configure (followed by make modules), but I don't see that option anymore. Please, could someone point me in the direction of a valid, step-by-step procedure? Every set of instructions that I've been able to find seems to now be out of date.
I use Ubuntu in my development for out-of-tree sources of ALSA firewire stack[0].
Roughly, you don't necessarily compile a full kernel just for a few modules, because kernel supports out-of-tree build for such modules. In Ubuntu, 'linux-headers-xxx' package is available to build the modules for installed kernel. In your case, it's 'linux-headers-4.4.0-57-lowlatency' package[1].
When installing this package, you can see '/lib/modules/4.4.0-57-lowlatency/build'[2]. In each directory of kernel source, you can build modules just included in the directory. In your case: (Current working directory is top level of kernel source tree) $ cd sound/drivers/ $ make -C /lib/modules/4.4.0-57-lowlatency/build M=$(pwd) snd-mtpav.ko
Of course, packages related to kernel build should be installed, for example, installing 'kernel-package' meta package.
When success to build, you can see 'snd-mtpav.ko' in the directory. Next, you need to put the module into a correct path for module seeking. In rough way, replace '/lib/modules/4.8.0-32-generic/kernel/sound/drivers/snd-mtpav.ko' with it. The, execute 'depmod -a' to generate the latest dependency and mapping file of installed modules.
But I don't recommend the replacement, because the original module comes from 'linux-image-extra-4.8.0-32-generic' in Ubuntu official repository. This way confuses package manager a bit. Therefore, it's better to make '/lib/modules/4.8.0-32-generic/updates' directory and put the new module into it. I don't know the reason but this directory has priority for module seeking to the original one.
Finally, you can load the new module. It's better to check that output of modinfo includes the new path for the module. This is a sample of my case.
$ modinfo snd-firewire-motu filename: /lib/modules/4.8.0-32-generic/updates/dkms/snd-firewire-motu.ko ...
If you get used to these instructions, please investigate to apply DKMS[3]. It will strongly help this kind of your work.
[0] https://github.com/takaswie/snd-firewire-improve [1] http://packages.ubuntu.com/xenial/linux-headers-4.4.0-57-lowlatency [2] as a symbolic link to '/usr/src/linux-headers-4.8.0-32-generic/'. [3] https://github.com/dell/dkms
Regards
Takashi Sakamoto
Hi Takashi (and all)
This is brilliant, perfect, thank you! And thank you sincerely for taking the time to put these instructions together for me. I am embarrassed to say that I need a little more help. I am using the official Ubuntu linux-4.4.0 source tree (copied to my $HOME/Projects folder), with appropriate config obtained from "make oldconfig". Your instructions:
(Current working directory is top level of kernel source tree) - ($HOME/Projects/linux-4.4.0) $ cd sound/drivers/ $ make -C /lib/modules/4.4.0-57-lowlatency/build M=$(pwd) snd-mtpav.ko
This produces snd-mtpav.ko perfectly as expected. Now I want to compile my own module called snd-mq8portse.ko (which is a device substantially similar to the mtpav). I have successfully built this working driver in the past, but under an older build arrangement (which stopped working at some point). I add my source file (mq8portse.c) to $HOME/Projects/linux-4.4.0/sound/drivers, and make the following additions to the Makefile in that folder:
snd-mq8portse-objs := mq8portse.o
obj-$(CONFIG_SND_MQ8PORTSE) += snd-mq8portse.o
I also make the following addition to Kconfig in the same folder (again following the model provided by SND_MTPAV):
config SND_MQ8PORTSE tristate "MusicQuest 8Port/SE multiport MIDI" select SND_RAWMIDI help To use a MusicQuest 8Port/SE multiport MIDI adapter connected to the parallel port, say Y here and make sure that the standard parallel port driver isn't used for the port.
To compile this driver as a module, choose M here: the module will be called snd-mq8portse.
I now enable my new module for compilation by make menuconfig in the source tree root. This adds the line CONFIG_SND_MQ8PORTSE=m to .config in that folder. Now I try to compile my new module:
$ cd sound/drivers/ $ make -C /lib/modules/4.4.0-57-lowlatency/build M=$(pwd) snd-mq8portse.ko
I get:
make: Entering directory '/usr/src/linux-headers-4.4.0-57-lowlatency' make[1]: *** No rule to make target 'snd-mq8portse.o'. Stop. Makefile:1590: recipe for target 'snd-mq8portse.ko' failed make: *** [snd-mq8portse.ko] Error 2 make: Leaving directory '/usr/src/linux-headers-4.4.0-57-lowlatency'
So my question is this: how (or where) do I add rules to make my module? Am I modifying the correct Makefile/Kconfig/.config? Is there some other step I'm missing?
Once again, I apologise sincerely for all the chatter, and thank you for your patience.
Kind regards Mark Brand ________________________________________ From: Takashi Sakamoto [o-takashi@sakamocchi.jp] Sent: Sunday, January 08, 2017 1:25 AM To: Brand, Mark (Mr) (Summerstrand Campus South); alsa-devel@alsa-project.org Subject: Re: gitcompile fail
Hi,
On Jan 7 2016 23:14, Mark Brand wrote:
Thank you sincerely for your response, Clemens.
Please forgive my noobness, but is a full kernel compilation necessary? I'm running Ubuntu 16.04 with 4.4.0-57-lowlatency kernel and my module is closely based on the existing mtpav driver. I believe I know where to place my source file, and what modifications to make to the appropriate Kconfig and Makefile. I recall being able to specify which modules I wanted to compile in arguments to ./configure (followed by make modules), but I don't see that option anymore. Please, could someone point me in the direction of a valid, step-by-step procedure? Every set of instructions that I've been able to find seems to now be out of date.
I use Ubuntu in my development for out-of-tree sources of ALSA firewire stack[0].
Roughly, you don't necessarily compile a full kernel just for a few modules, because kernel supports out-of-tree build for such modules. In Ubuntu, 'linux-headers-xxx' package is available to build the modules for installed kernel. In your case, it's 'linux-headers-4.4.0-57-lowlatency' package[1].
When installing this package, you can see '/lib/modules/4.4.0-57-lowlatency/build'[2]. In each directory of kernel source, you can build modules just included in the directory. In your case: (Current working directory is top level of kernel source tree) $ cd sound/drivers/ $ make -C /lib/modules/4.4.0-57-lowlatency/build M=$(pwd) snd-mtpav.ko
Of course, packages related to kernel build should be installed, for example, installing 'kernel-package' meta package.
When success to build, you can see 'snd-mtpav.ko' in the directory. Next, you need to put the module into a correct path for module seeking. In rough way, replace '/lib/modules/4.8.0-32-generic/kernel/sound/drivers/snd-mtpav.ko' with it. The, execute 'depmod -a' to generate the latest dependency and mapping file of installed modules.
But I don't recommend the replacement, because the original module comes from 'linux-image-extra-4.8.0-32-generic' in Ubuntu official repository. This way confuses package manager a bit. Therefore, it's better to make '/lib/modules/4.8.0-32-generic/updates' directory and put the new module into it. I don't know the reason but this directory has priority for module seeking to the original one.
Finally, you can load the new module. It's better to check that output of modinfo includes the new path for the module. This is a sample of my case.
$ modinfo snd-firewire-motu filename: /lib/modules/4.8.0-32-generic/updates/dkms/snd-firewire-motu.ko ...
If you get used to these instructions, please investigate to apply DKMS[3]. It will strongly help this kind of your work.
[0] https://github.com/takaswie/snd-firewire-improve [1] http://packages.ubuntu.com/xenial/linux-headers-4.4.0-57-lowlatency [2] as a symbolic link to '/usr/src/linux-headers-4.8.0-32-generic/'. [3] https://github.com/dell/dkms
Regards
Takashi Sakamoto
Hi,
On Jan 9 2017 00:19, Mark Brand wrote:
I now enable my new module for compilation by make menuconfig in the source tree root. This adds the line CONFIG_SND_MQ8PORTSE=m to .config in that folder.
When working with out-of-tree sources, no need to care of .config and Kconfig on the tree, because built-tree already includes relevant information about it. In your case, '/usr/src/linux-headers-4.4.0-57-lowlatency/' is the built-tree, including enough stuffs for module building.
So what you need is to give CONFIG_SND_MQ8PORTSE=m to Make environment of the built-tree. Let's try:
$ CONFIG_SND_MQ8PORTSE=m make -C /lib/modules/$(uname -r)/build M=$(pwd) snd-mq8portse.ko
Kernel build system, called Kbuild, is enough complicated to me. So I cannot explain about the overall. Documentation in 'Documentation/kbuild/kbuild.txt'[0] and 'Documentation/kbuild/modules.txt'[1] will help you for more detail and good entry points into kernel world.
[0] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Document... [1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Document...
Regards
Takashi Sakamoto
participants (3)
-
Clemens Ladisch
-
Mark Brand
-
Takashi Sakamoto