[opensuse] Proper way to compile kernel modules for opensuse-11.1
Hello, I am trying to track down a problem with DVB-S receivers. (Details are at http://linuxtv.org/pipermail/linux-dvb/2009-February/031788.html if anybody is interested). The problem appears to be related either to hardware or to the driver. So I'd like to dive into the driver to track it further down. So I need to know what is the proper way to compile the driver for 11.1. I guess there might be some suse-related patches or something. I know debian/ubuntu have module-assistant, so building modules from the source packages is pretty easy. Does such a thing also exist for opensuse? Can somebody point me to a howto or something? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Josef Wolf wrote:
Hello,
I am trying to track down a problem with DVB-S receivers. (Details are at http://linuxtv.org/pipermail/linux-dvb/2009-February/031788.html if anybody is interested). The problem appears to be related either to hardware or to the driver. So I'd like to dive into the driver to track it further down.
So I need to know what is the proper way to compile the driver for 11.1. I guess there might be some suse-related patches or something. I know debian/ubuntu have module-assistant, so building modules from the source packages is pretty easy. Does such a thing also exist for opensuse? Can somebody point me to a howto or something?
Joseph, Presently, I compile the fglrx.ko (ATI driver kernel module) and the vboxdrv.ko (Virtualbox driver kernel module). The compilation for any kernel module is the same. You have to have the kernel source installed and the compilers. If you start yast/software management and then choose filter: "Patterns" you can then select the following patterns to get what you need: Console Tools (not strictly required, but adds useful utilities) Base Development C/C+ Development RPM Build Environment (same as Console Tools) Linux Kernel Development You will then have what you need. Then you will need the source code for the driver you want to compile against the kernel. If it comes as an RPM many of the drivers are built through the 'post-install' script that accompanies the RPM. Before I build a kernel module, I prep the kernel source. (another not strictly required step, because the suse kernel is already prepped, but something I consider to be the "correct" way to do it). To prep the kernel, just: cd /usr/src/linux make mrproper make cloneconfig > /dev/null 2>&1 make modules_prepare make clean You can eliminate the redirections '> /dev/null 2>&1' if you want to watch reams of text scroll by. After the kernel source is prepped, then you are ready to compile whatever you have against the kernel to produce and new driver (i.e. kernel module) Good Luck. -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Sat, Feb 07, 2009 at 10:13:23PM -0600, David C. Rankin wrote: [ ... ]
Console Tools (not strictly required, but adds useful utilities) Base Development C/C+ Development RPM Build Environment (same as Console Tools) Linux Kernel Development [ ... ] cd /usr/src/linux make mrproper make cloneconfig > /dev/null 2>&1 make modules_prepare make clean [ ... ]
Thank you for the great explanation, David! But how do I build a rpm from that? I notice that the modules I am interested in are contained in kernel-default-2.6.27.7-9.1 and kernel-default-extra-2.6.27.7-9.1, so I guess I need to re-build those two rpm's? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Josef Wolf wrote:
On Sat, Feb 07, 2009 at 10:13:23PM -0600, David C. Rankin wrote:
[ ... ]
Console Tools (not strictly required, but adds useful utilities) Base Development C/C+ Development RPM Build Environment (same as Console Tools) Linux Kernel Development [ ... ] cd /usr/src/linux make mrproper make cloneconfig > /dev/null 2>&1 make modules_prepare make clean [ ... ]
Thank you for the great explanation, David!
But how do I build a rpm from that? I notice that the modules I am interested in are contained in kernel-default-2.6.27.7-9.1 and kernel-default-extra-2.6.27.7-9.1, so I guess I need to re-build those two rpm's?
I'm sure there is a way to compile the individual drivers, but that's beyond me. If the drivers are contained in the kernel packages, you can make the changes you need and then just recompile the 2 kernel rpms, the modules will be rebuilt. If you want to tear the kernel configure script apart and see how/when they get built, that's an exercise I'll leave for you.;-) -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hello, On Mon, 09 Feb 2009, David C. Rankin wrote: [..]
I'm sure there is a way to compile the individual drivers, but that's beyond me.
make drivers/path/foo.ko -dnh -- I love deadlines. I like the whooshing sound they make as they fly by. -- Douglas Adams -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Saturday, 2009-02-07 at 22:13 -0600, David C. Rankin wrote: ...
Before I build a kernel module, I prep the kernel source. (another not strictly required step, because the suse kernel is already prepped, but something I consider to be the "correct" way to do it). To prep the kernel, just:
cd /usr/src/linux make mrproper make cloneconfig > /dev/null 2>&1
Per /usr/src/linux/README.SUSE, just install kernel-source.$ARCH.rpm, then run "make cloneconfig". Mr Proper is not required. There is a section there on building aditional modules. They recomend "make prepare". - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkmO1PgACgkQtTMYHG2NR9XbHwCfWEEQIE/DYF2N9N9KjBRDV7MT P8IAnjfVR99kyFu4lToWTOf1q6Zq4OY3 =VX6T -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Sat, 07 Feb 2009 22:13:23 -0600, you wrote:
something I consider to be the "correct" way to do it). To prep the kernel, just:
cd /usr/src/linux make mrproper make cloneconfig > /dev/null 2>&1 make modules_prepare make clean
That's obsolete since some time :) It's simply cd /usr/src/linux-obj/<architecture>/<kernel_flavour> make modules_prepare make clean Philipp -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Philipp Thomas wrote:
On Sat, 07 Feb 2009 22:13:23 -0600, you wrote:
something I consider to be the "correct" way to do it). To prep the kernel, just:
cd /usr/src/linux make mrproper make cloneconfig > /dev/null 2>&1 make modules_prepare make clean
That's obsolete since some time :) It's simply
cd /usr/src/linux-obj/<architecture>/<kernel_flavour> make modules_prepare make clean
Philipp
But then I don't get to see all the pretty text scroll by in the cloneconfig setp :-( -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday, 2009-02-09 at 14:01 -0600, David C. Rankin wrote:
Philipp Thomas wrote:
That's obsolete since some time :) It's simply
cd /usr/src/linux-obj/<architecture>/<kernel_flavour> make modules_prepare make clean
But then I don't get to see all the pretty text scroll by in the cloneconfig setp :-(
I think you need cloneconfig, or equivalent. For example, there is a copy of the .config file of each kernel flavour somewhere -- the "somewhere" is documented somewhere :-) -- sorry, I forgot where, I prefer running cloneconfig, but it is easy to find. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkmQ0S0ACgkQtTMYHG2NR9XpKACfTt1zvy+DtjvBwGaSUfIomABO h94AoIi8Ma7QcK7x99/tMUSGr3KgmxAc =vWJx -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Carlos E. R. wrote:
On Monday, 2009-02-09 at 14:01 -0600, David C. Rankin wrote:
Philipp Thomas wrote:
That's obsolete since some time :) It's simply
cd /usr/src/linux-obj/<architecture>/<kernel_flavour> make modules_prepare make clean
But then I don't get to see all the pretty text scroll by in the cloneconfig setp :-(
I think you need cloneconfig, or equivalent. For example, there is a copy of the .config file of each kernel flavour somewhere -- the "somewhere" is documented somewhere :-) -- sorry, I forgot where, I prefer running cloneconfig, but it is easy to find.
-- Cheers, Carlos E. R.
Great, Then going back the my original post, the only thing that I can get rid of and that isn't required anymore is make mrproper cd /usr/src/linux --> make mrproper <-- make cloneconfig > /dev/null 2>&1 make modules_prepare make clean Looking further: $ make mrproper The main reason for doing this is that some files do not automatically get rebuilt, which can lead to failed builds, or at worst, a buggy kernel. In the 2.4.x series, a few dozen lines of rm -f commands will appear as all generated files get removed. The 2.6.x process is less noisy and returns only a few CLEAN messages. Please note that it is generally safe to omit the make mrproper step during subsequent rebuilds. http://www.digitalhermit.com/linux/Kernel-Build-HOWTO.html A bit more in comparison is: _Target_ Description_ clean Removes most of the files generated by the kernel build system, but keeps the kernel configuration. mrproper Removes all of the generated files by the kernel build system, including the configuration and some various backup files. distclean Does everything mrproper does and removes some editor backup and patch leftover files. http://www.kernel.org/pub/linux/kernel/people/gregkh/lkn/lkn_pdf/ch10.pdf For those that are interested, the 11 chapter set of pdfs contained in the http://www.kernel.org/pub/linux/kernel/people/gregkh/lkn/lkn_pdf/ directory are an excellent set of kernel references. It is a 12/06 revision. They cover: Chapter 1, Introduction Chapter 2, Requirements for Building and Using the Kernel Chapter 3, Retrieving the Kernel Source Chapter 4, Configuring and Building Chapter 5, Installing and Booting from a Kernel Chapter 6, Upgrading a Kernel Chapter 7, Customizing a Kernel Chapter 8, Kernel Configuration Recipes Chapter 9, Kernel Boot Command-Line Parameter Reference Chapter 10, Kernel Build Command-Line Reference Chapter 11, Kernel Configuration Option Reference Appendix A, Helpful Utilities Appendix B, Bibliography So I guess the consensus is that make mrproper isn't strictly needed subsequent to the initial build unless unexplained problems arise, but it can't hurt to do it. Considering it takes less than 6.5 seconds and it could prevent problem and it can't hurt anything, I'm leaving it in my build process ;-) [00:17 ecstasy:/usr/src/linux] # time make mrproper real 0m6.436s user 0m2.148s sys 0m2.096s [00:18 ecstasy:/usr/src/linux] # make cloneconfig > /dev/null 2>&1 [00:20 ecstasy:/usr/src/linux] # make modules_prepare scripts/kconfig/conf -s arch/x86/Kconfig CHK include/linux/version.h UPD include/linux/version.h CHK include/linux/utsrelease.h UPD include/linux/utsrelease.h SYMLINK include/asm -> include/asm-x86 CC arch/x86/kernel/asm-offsets.s GEN include/asm-x86/asm-offsets.h CALL scripts/checksyscalls.sh HOSTCC scripts/genksyms/genksyms.o SHIPPED scripts/genksyms/lex.c SHIPPED scripts/genksyms/parse.h SHIPPED scripts/genksyms/keywords.c HOSTCC scripts/genksyms/lex.o scripts/genksyms/lex.c:1487: warning: ‘input’ defined but not used SHIPPED scripts/genksyms/parse.c HOSTCC scripts/genksyms/parse.o HOSTLD scripts/genksyms/genksyms CC scripts/mod/empty.o HOSTCC scripts/mod/mk_elfconfig MKELF scripts/mod/elfconfig.h HOSTCC scripts/mod/file2alias.o HOSTCC scripts/mod/modpost.o HOSTCC scripts/mod/sumversion.o HOSTLD scripts/mod/modpost HOSTCC scripts/kallsyms HOSTCC scripts/conmakehash HOSTCC scripts/bin2c [00:20 ecstasy:/usr/src/linux] # make clean CLEAN /usr/src/linux-2.6.25.20-0.1 CLEAN .tmp_versions -- David C. Rankin, J.D.,P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (5)
-
Carlos E. R.
-
David C. Rankin
-
David Haller
-
Josef Wolf
-
Philipp Thomas