LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-06-2008, 08:54 AM   #1
GTrax
Member
 
Registered: Oct 2005
Location: UK
Distribution: Mint
Posts: 258

Rep: Reputation: 37
Questions about Headers


Hi Folks
Just because I am trying things where I never went before..

From the repositories (Debian, Ubuntu, Mepis, etc) it is possible to get "kernel-sources-<various_versions>"
One can also get "kernel-headers-<various_versions>"

As I understood it, headers are the C files with a ".h" extension that are called in to be included by the C programs to make available functions necessary for that program.

1. Does installing the kernel-sources package automatically include all the header files needed?

2. Does one need to install the kernel-headers package available separately?

3. What kinds of applications compiling can be done having the headers available only?

4. When compiling a new kernel, is the kernel-sources package enough?

Thanks G
 
Old 12-06-2008, 09:57 AM   #2
jdines
LQ Newbie
 
Registered: Jul 2008
Posts: 19

Rep: Reputation: 0
Kernel headers packages are a subset of the kernel source. You only need one of them. If you are not compiling a custom kernel, and are not interested in looking at / changing the code in the kernel you can install the kernel headers package rather than the kernel source and save disk space and download times.

You don't use the kernel headers to compile applications (except in VERY rare cases, like for example <a href=http://valgrind.org/>valgrind</a> or similar applications that deal with the kernel. Most likelty you will neverr need them, as you should use your package manner. It is seldom necessary to build from the source these days. If you use a decent distribution only very esoteric applications will be unavailable from the distributions repositories.

You will need the actual tools required to build the kernel of course, such as GCC (the compiler), but beyond that the source package - (and a lot of research and perseverance) - is all that is required to build a custom kernel.
 
Old 12-06-2008, 10:03 AM   #3
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
The kernel headers define the interface between the userspace (regular) programs and the kernel. They were pulled out of the kernel itself to ensure that the interface stays the same between different kernel versions, so that programs do not need to be changed or recompiled when the kernel itself changes.

1) Installing the kernel source should install any dependant packages, including the appropriate version of the kernel headers.

2) No, if you use Synaptic or apt-get, the dependencies will be installed automatically. This also has the advantage that the system can automatically uninstall the headers package if the source package is removed (unless something else depends on it).

3) You only need the kernel headers to recompile any program. Obviously, you still need the kernel source to recompile the kernel itself, but that's the only thing it's used for.

4) You still need the headers to compile the kernel. But you shouldn't need to worry about that since the headers package will be automatically installed as a dependency.
 
Old 12-06-2008, 10:14 AM   #4
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
I don't have answers to all of those questions, but I will say that you should not install new kernel headers unless you have a good reason to, because doing so will cause issues with gcc.
 
Old 12-07-2008, 07:29 AM   #5
GTrax
Member
 
Registered: Oct 2005
Location: UK
Distribution: Mint
Posts: 258

Original Poster
Rep: Reputation: 37
My thanks to all of you folk.

I have 4 Distros, each on their own partitions, and the GRUB menu.lst for the first of them gets to be the place we can choose which to boot. Obviously one is the main tructes stable one, and the rest are being tried out for curiosity. The Windows chunk has been commented out so long I have reformatted its space.

Most times, I am happy with the kernel the Distro comes with. Making a custom kernel is not so hard if one follows all the instructions. Getting it accepted by the rest of a pre-installed system is more awkward.

I wanted a low-latency kernel for real-time audio.
Is it possible to turn on/off or redefine just about any kernel configuration line simply by putting the new value as a kernel boot option on the boot command - instead of doing a whole recompile just to knobble one thing?

(In this case to set the TICK from 250Hz to 1000H)
 
Old 12-07-2008, 09:31 AM   #6
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Take a look here for all possible kernel parameters:
http://www.kernel.org/doc/Documentat...parameters.txt

Some things cannot be changed dynamically on boot like this, one of those things seems to be the Tick that you're talking about, I don't see it on there.
 
Old 12-08-2008, 11:54 AM   #7
GTrax
Member
 
Registered: Oct 2005
Location: UK
Distribution: Mint
Posts: 258

Original Poster
Rep: Reputation: 37
Thanks for the link.

I can see in it that the CONFIG_NO_HZ=y kernel setting can be done by passing the nohz=y (or n) to switch on or off the "tickless mode". This is the default anyway.

Unfortunately, the other parameter cannot be tweaked so easily. This is a snippet from the kernel config file copy kept in /boot.
Quote:
# CONFIG_HZ_100 is not set
# CONFIG_HZ_250 is not set
CONFIG_HZ_300=y
# CONFIG_HZ_1000 is not set
CONFIG_HZ=300
CONFIG_HZ=1000, it seems, can only be had by recompiling. I am unsure whether using tickless mode would make the other parameter unnecessary.

Either way, I am not going to be messing with this rather nice MEPIS to get there. Instead, my dodgy kernels will be confined to a different partition. Also, I am thinking that crux or slack or some other distro more dedicated to real-time tasks would be a better way.
 
Old 12-08-2008, 01:29 PM   #8
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
Examples for #3 - Kernel Headers Only.

nVidia Proprietary video drivers
ndiswrapper
Wireless card Drivers
etc..

for a decent list you could simply type m-a (provide you have module assistant installed) Choose the SELECT menu option, and then browse the list of various modules you can compile, using the Debian module assistant method.

I typically shortcut to install kernel headers when needed in Debian..
aptitude update
m-a update
m-a prepare


the current headers for my running kernel, are downloaded, installed and linked and I am ready to compile my module.
 
Old 12-08-2008, 01:55 PM   #9
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
There are only a few options to change if you want to make your kernel low-latency. As usual there is a balance between throughput and latency.

When configuring your kernel go to and change the following:
Processor type and features --->

Preemption Model (Preemptible Kernel (Low-Latency Desktop))
Preempt The Big Kernel Lock
Timer frequency (1000 HZ)

That's all 3 of them, then recompile, install it, and possibly modify bootloader options as necessary.
 
Old 12-08-2008, 05:51 PM   #10
GTrax
Member
 
Registered: Oct 2005
Location: UK
Distribution: Mint
Posts: 258

Original Poster
Rep: Reputation: 37
Thanks H_TeXMeX_H.

I did exactly that.
Compiling a kernel is not as fearsome as some may think. Getting it to boot is also straightforward. Using make menuconfig also give the opportunity to lose huge piles of compiled stuff that will never be needed, for hardware that just is not present.

The problems arrive with certain software - eg. the NVidia graphics card driver module won't play. So un-install the NVidia, and start again, to recompile a nVidia module with the new kernel.

Besides the 3 options you mention, one can set up priorities to favor certain processes (eg. real-time 192kH sampling multichannel audio cards). This would not be appropriate in a mailserver (say). I am still reading the tips on how to do it.
Also, the way to get high throughput is to assign the highest priorities to the slowest intermittent processes. This is not always intuitively obvious.

In this case, incoming streams of (satellite data) to the soundcards cannot be interrupted unless the departures are too swift to trouble the buffering. At 1000Hz, the desktop and screen response will be fast, as will real-time audio/video. This is bound to be at the expense of some other processes.
 
Old 12-08-2008, 06:08 PM   #11
GTrax
Member
 
Registered: Oct 2005
Location: UK
Distribution: Mint
Posts: 258

Original Poster
Rep: Reputation: 37
for farslayer

When you have compiled your module, what is the next essential step to ensure it gets loaded - or do you have to load the special ones when you invoke the applications that need them?

Thanks ..
G
 
Old 12-08-2008, 09:21 PM   #12
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
man modprobe
man modules


those should cover manually loading a module, and having a module load automatically at boot time.

others of related interest: insmod, lsmod, modinfo, modprobe.conf

is there a particular module you are interested in ? webcam, wireless, video, other ?
 
Old 12-09-2008, 02:41 AM   #13
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Quote:
Originally Posted by GTrax View Post
The problems arrive with certain software - eg. the NVidia graphics card driver module won't play. So un-install the NVidia, and start again, to recompile a nVidia module with the new kernel.

In this case, incoming streams of (satellite data) to the soundcards cannot be interrupted unless the departures are too swift to trouble the buffering. At 1000Hz, the desktop and screen response will be fast, as will real-time audio/video. This is bound to be at the expense of some other processes.
Yes, that is a small downside, that all modules must be re-compiled, one being the nvidia drivers.

You'll have to make decisions as to whether you want throughput or low-latency/real-time.

The lower the Timer frequency the fewer timer interrupts, the higher the throughput, what you would want on a server, something like 100 or 250 Hz. 300 Hz is the minimum recommended for multimedia work.

Preempting the Big Kernel Lock is optional, and does make the kernel more low-latency.

The Preemption Model goes from greatest throughput No Forced Preemption (Server), to less latency Voluntary Kernel Preemption (Desktop) and medium throughput, to Preemptible Kernel (Low-Latency Desktop).
 
  


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
looking for the following headers... aq_mishu Programming 18 10-31-2008 07:55 PM
2.6.22.6 headers saimike Debian 11 09-11-2007 05:50 PM
Linux headers. Basic questions m4mach Linux - General 1 08-03-2007 12:13 PM
kernel headers questions Embiggens Debian 7 04-29-2005 01:44 AM
what are headers? mep]-[isto Linux - Newbie 7 12-14-2003 05:26 PM

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

All times are GMT -5. The time now is 06:37 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