LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 04-06-2015, 04:03 AM   #1
marvic_32
LQ Newbie
 
Registered: Apr 2015
Posts: 18

Rep: Reputation: Disabled
Need to build the Kernel?


Hi All,

I have edited a file option.c from this location /drivers/usb/serial/option.c
Do i have build kernel?
Is there any way that i can compile this file?

Appreciate for the answers.

Thank You.
 
Old 04-06-2015, 07:54 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931
It depends whether or not the USB serial driver is a module or internal to the kernel. Odds are that it is included in the kernel. Whether you have to rebuild your kernel or your modules, that's the capability which you need. What you need to do first is find what kernel you do have and obtain all the source for it to be able to execute a build.
 
Old 04-06-2015, 10:38 AM   #3
marvic_32
LQ Newbie
 
Registered: Apr 2015
Posts: 18

Original Poster
Rep: Reputation: Disabled
Thanks rtmistler for your replay. I have added a #define for the new device in option.c, Do i have to build the kernel for couple of line? Is there is way to compile the option.c and replace the object file?
 
Old 04-06-2015, 11:04 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931
If it's part of the kernel you have to rebuild the kernel because the result is one file.

If it's included as a module then you can rebuild just the one module, but you'd have to rebuild the entire module that uses that source. For instance a serial USB driver module may use a large number of source files, including that one, and therefore you'd have to rebuild that entire driver module.

My belief though is that a core file like USB serial is likely included in the kernel.
 
Old 04-06-2015, 11:58 AM   #5
marvic_32
LQ Newbie
 
Registered: Apr 2015
Posts: 18

Original Poster
Rep: Reputation: Disabled
What about in this case, can i rebuild this option.c?
What is the procedure?
 
Old 04-07-2015, 01:14 AM   #6
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Read kernel howto from TLDP site.
 
Old 04-07-2015, 02:29 AM   #7
marvic_32
LQ Newbie
 
Registered: Apr 2015
Posts: 18

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by veerain View Post
Read kernel howto from TLDP site.
Not opening,

After replacing the new object file (optiom.ko) to old file (option.ko), will there be any issues?
 
Old 04-07-2015, 02:43 AM   #8
marvic_32
LQ Newbie
 
Registered: Apr 2015
Posts: 18

Original Poster
Rep: Reputation: Disabled
Do i have to build only option.c or entire Serial folder .c files or USB folder files?
 
Old 04-07-2015, 03:12 AM   #9
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,454

Rep: Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353Reputation: 2353
The process of building a .ko module is more involved than a simple compiled .c file. I would look for a way to rebuild the directory and let 'make' do it if at all possible.

I understand you not opening the kernel howto, but you might at least grok the index to see if he has comments on this buried somewhere. Once you understand the university reports system, it's easier to find your way around a howto. Nothing significant can go in the first half of the document; Things never get shortened or removed, only added; It's 'never mind the quality - feel the width!'
 
Old 04-07-2015, 05:24 AM   #10
marvic_32
LQ Newbie
 
Registered: Apr 2015
Posts: 18

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by veerain View Post
Read kernel howto from TLDP site.
Thanks, Now its opening.
 
Old 04-07-2015, 05:26 AM   #11
marvic_32
LQ Newbie
 
Registered: Apr 2015
Posts: 18

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by business_kid View Post
The process of building a .ko module is more involved than a simple compiled .c file. I would look for a way to rebuild the directory and let 'make' do it if at all possible.

I understand you not opening the kernel howto, but you might at least grok the index to see if he has comments on this buried somewhere. Once you understand the university reports system, it's easier to find your way around a howto. Nothing significant can go in the first half of the document; Things never get shortened or removed, only added; It's 'never mind the quality - feel the width!'
Thanks, for replay. Any issues will arise after building and replacing it (all in directory)?
 
Old 04-07-2015, 05:44 AM   #12
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931
Quote:
Originally Posted by marvic_32 View Post
Thanks, for replay. Any issues will arise after building and replacing it (all in directory)?
You should keep a backup of the original by renaming that to like <name>.ko.sav, put the new one in, owned by root and privileged as the other files are. Then you can reboot to test it.
 
Old 04-07-2015, 08:00 AM   #13
marvic_32
LQ Newbie
 
Registered: Apr 2015
Posts: 18

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rtmistler View Post
You should keep a backup of the original by renaming that to like <name>.ko.sav, put the new one in, owned by root and privileged as the other files are. Then you can reboot to test it.
Do i have to compile one option.c file or All Serial folder files?

I have to this on Raspberry PI, any build tools required or any setup is required?
 
Old 04-07-2015, 08:08 AM   #14
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931
MODERATOR: Recommend this thread get moved to the Linus - Embedded and Single Board Computer forum

Quote:
Originally Posted by marvic_32 View Post
Do i have to compile one option.c file or All Serial folder files?

I have to this on Raspberry PI, any build tools required or any setup is required?
Yeah, you need to have the capability to build the kernel and modules for your Raspberry Pi and also the capability to build that on a different system, thus using a cross compiler.

This isn't a simple one-step thing you're asking by the way.

General overview: http://elinux.org/RPi_Kernel_Compilation
Very good tutorial: http://sysprogs.com/VisualKernel/tut...y/buildkernel/

I recommend you follow that tutorial and give it a very honest try. At least read the overview and tutorial to discover just how involved this subject is.
 
Old 04-07-2015, 08:52 AM   #15
marvic_32
LQ Newbie
 
Registered: Apr 2015
Posts: 18

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rtmistler View Post
MODERATOR: Recommend this thread get moved to the Linus - Embedded and Single Board Computer forum



Yeah, you need to have the capability to build the kernel and modules for your Raspberry Pi and also the capability to build that on a different system, thus using a cross compiler.

This isn't a simple one-step thing you're asking by the way.

General overview: http://elinux.org/RPi_Kernel_Compilation
Very good tutorial: http://sysprogs.com/VisualKernel/tut...y/buildkernel/

I recommend you follow that tutorial and give it a very honest try. At least read the overview and tutorial to discover just how involved this subject is.
Thanks, i had compiled Linux from the sources but this time it looked liked a bit deep surgery. So took suggestions of you people.

Finally, Do i have to compile one file or entire folder?

Thank You.
 
  


Reply



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
A rather odd kernel build error while building a powerpc version of kernel 3.0.3 bloggins666 Linux - Kernel 2 01-29-2015 10:08 AM
Unable to build kernel RPM with 'custom name'. (need not kernel but kernel-something) RattleSn@ke Linux - Kernel 1 01-12-2011 06:30 PM
Which is the kernel build directory? I Can't find kernel build files crabsody Debian 7 01-09-2007 04:48 AM
LXer: Howto: build Linux kernel module against installed kernel w/o full kernel source tree LXer Syndicated Linux News 0 09-03-2006 08:21 PM
New FAQ topic: Should I edit my kernel configuration?/Should I build a custom kernel? chort *BSD 10 09-10-2004 11:15 PM

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

All times are GMT -5. The time now is 09:55 AM.

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