Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-27-2005, 03:03 PM   #1
Registered: Jul 2003
Location: Pensacola,Florida
Distribution: Mandrake 9.1
Posts: 41

Rep: Reputation: 15
"/usr/src/linux" should you use it

I got the impression a while back that using "/usr/src/linux" causes problem and you shouldn't use it as a link. I am only seeing everyone using links to "/usr/src/linux". Has someone changed their mind?
Old 04-27-2005, 03:13 PM   #2
Registered: Aug 2003
Location: Edinburgh, Scotland
Distribution: Gentoo
Posts: 246

Rep: Reputation: 30
There's nothing actually wrong with having /usr/src/linux be a link to the source tree it just isn't the canonical location anymore (that's /lib/modules/`uname -r`/build). I generally build kernels in /usr/src/linux-`uname -r` with /usr/src/linux being a symlink to the current kernel. It's quicker to type and I know what it means however scripts shouldn't use it as there's no guarantee that it exists or is correct (the /lib/modules path is created by kernel makefiles (make modules_install I think) and so is (almost) guaranteed to be correct).
Old 04-27-2005, 03:18 PM   #3
Senior Member
Registered: Jul 2003
Location: Wellington, NZ
Distribution: mainly slackware
Posts: 1,289

Rep: Reputation: 52
I generally go by what the README in my source files says. Like for making the kernel:
When compiling the kernel all output files will per default be
stored together with the kernel source code.
Using the option "make O=output/dir" allow you to specify an alternate
place for the output files (including .config).
kernel source code: /usr/src/linux-2.6.N
build directory: /home/name/build/kernel

To configure and build the kernel use:
cd /usr/src/linux-2.6.N
make O=/home/name/build/kernel menuconfig
make O=/home/name/build/kernel
sudo make O=/home/name/build/kernel modules_install install

Please note: If the 'O=output/dir' option is used then it must be
used for all invocations of make.
Old 04-28-2005, 05:28 AM   #4
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 5,395

Rep: Reputation: 409Reputation: 409Reputation: 409Reputation: 409Reputation: 409
Why not just extract the kernel sources in /home/name/build/kernel in this case ?
Old 04-28-2005, 08:27 AM   #5
Senior Member
Registered: Jul 2003
Location: Wellington, NZ
Distribution: mainly slackware
Posts: 1,289

Rep: Reputation: 52
Originally posted by keefaz
Why not just extract the kernel sources in /home/name/build/kernel in this case ?
I have done that in the past but prefer the proper place with root ownership. If I want to start again I know I have the untouched kernel source still in /usr/src. It's the german in me!
Old 04-29-2005, 06:22 AM   #6
Senior Member
Registered: Mar 2004
Location: england
Distribution: Debian, Mint, Puppy, Raspbian
Posts: 3,421

Rep: Reputation: 200Reputation: 200Reputation: 200
I have two levels of indirection:

/usr/src/linux -> /home/blah/blah/kernel/linux/src
/home/blah/blah/kernel/linux -> ./linux/2.6.10

non-root ownership of course! Then just 'sudo make install' (safer)

never had problems.
nvidia compiles OK anyway.

Can then switch patch levels and everything easily.
Just need to change the last from say 2.6.9 to 2.6.10 nothing else to do.

I can also switch compiling between distros as my home is a partition of course
and I don't lose the state if I do an install.

you can always do a make clean to get back to original (or make a tar.bz2 b4 you compile)
Old 04-30-2005, 02:11 AM   #7
Senior Member
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 52
the prohabition against using /usr/src/linux is something old
once a glibc developer practice of having some of the user space includes as symlinks to i think /usr/src/linux/asm or something got mistakenly bled into some distributions..
this caused the kernel developers to freak out and declare /usr/src/linux as a wrong thing

since /usr/src/linux is something left over from the very begining of building linux systems people sometimes associate these old wrongs with /usr/src/linux itself

there are still to this day especially solaris style builds and third paty junk like nvidia drivers that look for currently running linux kernel headers in /usr/src/linux so it can be a big help to have it there

just make sure if you use it you keep it current with what kernel you are running

on modern systems /usr/src/linux is not a problem

often people say scripts from outside Linux circles shouldn't use it but they do and it causes no harm so i don't see the problem.

a box without /usr/src/linux well just feels like some preconfigured appliance used to deliver adds to it's user ala M$


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
problem "make"ing gtk+ "/usr/bin/env: perl -w" caid Linux - Newbie 8 07-29-2005 05:51 AM
Compromised? Files "/usr/lib.hwm", "/usr/lib.pwd", "/usr/lib.pwi" Klaus Pforte Linux - Security 4 09-29-2004 12:33 AM
what is "S" instead of "X" in the file permission when i look at /usr/bin/chsh? Linux_interest Linux - Newbie 4 08-28-2004 10:22 AM
/usr/libexec/ Shared object "" not found lxxy *BSD 1 12-04-2003 01:01 PM
Creating /usr/src/linux-<xx> from kernel.<xx>.src.rpm jmourik Linux - Newbie 2 02-19-2003 04:24 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:25 PM.

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