I have a source tarball: ap-kernelmodule-1.0.14-13.tar.gz
I have to compile a kernel module out of it and was instructed to install development tools for my Ubuntu version (which is 12.10).
The format is: sudo apt-get install linux-headers-$(uname -r) build-essential
Question #1: what is uname
?
(When I installed Ubuntu, I input sharon as my name and which is also my account name. Whenever I open a terminal window, the words sharon@sharon:
appear)
Based on the format, I should input:
sudo apt-get install linux-headers-$(sharon -r) build-essential
or
sudo apt-get install linux-headers-$sharon -r build-essential
Question #2: Which of the above is correct?
(I am new to Linux and Ubuntu; hence detailed instructions are appreciated)
Do not copy my commands, you must type them in and use your tab key becuase my kernel may be different than yours. I explain play by play:
Open up a terminal and type:
This update gives your computer a heads up of files you may need. But no files download, only information on what can be downloaded. If you didn't do this first, you may not have the latest link to security updates or the latest versions of software.
As you type, press the tab key, to finish your command. Start typing the command that will install
build-essential
. Once you get this far stop:The next part that should appear will be your Linux kernel. So open another terminal and type this:
You should see something like this:
Now go back to the other terminal and press tab as type. You should see your kernel pop up. Choose that one.
Now type a space and add build-essential (don't forget use your tab for completion).
Now hit enter and files will download that help you compile code.
uname
is a command which must be entered at the commandline. So if you open a terminal and typeuname
it outputs the wordLinux
. In the command you mentioned you find-r
. This is an option touname
. It instructsuname
to print the kernel release number. So it will basically print out some numbers (like 3.2.0-41-amd64).You should enter the command
like it is written. The
$(something)
tells your commandline (better word would be shell) to execute the commandsomething
and insert the output of that command.So in your
uname
case (assuming that the number I wrote is correct, which might not be in your case) the command which is executed issudo apt-get install linux-headers-3.2.0-41-amd64 build-essential
. Basically you could just look for your kernel version and insert it manually.As you now see none of your versions is correct. The solution looks a bit different.