LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 06-26-2011, 09:43 PM   #1
yaplej
Member
 
Registered: Apr 2009
Distribution: CentOS, Ubuntu, openSuSE
Posts: 165
Blog Entries: 1

Rep: Reputation: 22
LKM for multiple kernel versions


I have a kernel module that works for kernel versions < 2.6.20 but there were some changes in that version that cause it to break. I already know how to fix the code but in my source but how can I check the kernel version and swap the code? I dont want to just update the code because I still need it to work for both kernel versions.

Thanks.
 
Old 01-27-2012, 01:10 PM   #2
yaplej
Member
 
Registered: Apr 2009
Distribution: CentOS, Ubuntu, openSuSE
Posts: 165

Original Poster
Blog Entries: 1

Rep: Reputation: 22
Just in case someone else needs to know I figured this out.

Code:
#if (LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 20))
/*
 *Code for kernel 2.6.20
 */
#else
/*
 *Code for all others
 */
#endif
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible LKM Trojan install kernel 2.6.0 cxel91a Linux - Security 8 12-13-2010 05:19 PM
Multiple Versions of Kernel On A Desktop rohan_shah53 Linux - Desktop 7 11-27-2010 04:15 AM
LKM in 2.6 w/o the kernel source to intercept the IP packet and process in kernel sp csvk Linux - Networking 0 10-12-2007 02:20 PM
gcc versions compatibility with kernel versions.. mahesh_manthapuri SUSE / openSUSE 1 03-22-2006 12:28 AM
Unable boot multiple kernel versions off of Redhat machine liangjz Linux - Newbie 3 03-16-2004 10:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 02:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration