Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Gentoo Chat
  • Search

automaticly link /usr/src/linux to last kernel emerged

Opinions, ideas and thoughts about Gentoo. Anything and everything about Gentoo except support questions.
Post Reply
  • Print view
Advanced search
19 posts • Page 1 of 1
Author
Message
ewan.paton
Veteran
Veteran
User avatar
Posts: 1219
Joined: Tue Jul 29, 2003 12:21 am
Location: glasgow, scotland
Contact:
Contact ewan.paton
Website

automaticly link /usr/src/linux to last kernel emerged

  • Quote

Post by ewan.paton » Fri Feb 20, 2004 2:54 am

i realise it is important to know how to link the correct source to /usr/src/linux but i was just wondering if it were possible/a good idea to automaticly link the last emerged source to linux i cant see any problems but what do i know
Giay tay nam | Giay nam cao cap | Giay luoi
Top
Fitzsimmons
Guru
Guru
User avatar
Posts: 415
Joined: Wed Jan 01, 2003 10:21 pm
Location: Waterloo, Ontario, Canada
Contact:
Contact Fitzsimmons
Website

  • Quote

Post by Fitzsimmons » Fri Feb 20, 2004 5:28 am

You want /usr/src/linux to point to the kernel currently in use, which may or may not be the one you just merged. Having it changed automatically could cause a lot of frustration. I can already see myself completely forgetting that portage automatcially changes my /usr/src/linux link and wondering why the hell my programs/custom modules/etc. weren't compiling/working. Changing it manually ensures user awareness. I could understand where you were coming from if it were a long and difficult proccess, but it isn't. Two commands max.
Top
ewan.paton
Veteran
Veteran
User avatar
Posts: 1219
Joined: Tue Jul 29, 2003 12:21 am
Location: glasgow, scotland
Contact:
Contact ewan.paton
Website

  • Quote

Post by ewan.paton » Fri Feb 20, 2004 6:03 am

partialy lazyness and partialy remembering when i was a newbie trying to figure out how to do it before good documentation and also i switch kernels sometimes and forget to relink

i thought about writing a startup script along these lines but dont know the code,just the logic.

1 get exact kernel version (uname -r)
2 if symlink points to a dir with the same name exit
3 if not test if a dir does exist, if not exit
4 remove old link make new one and exit

anyone got an idea what to do now?
Giay tay nam | Giay nam cao cap | Giay luoi
Top
Athas
Guru
Guru
User avatar
Posts: 394
Joined: Thu Sep 04, 2003 6:00 pm
Location: Brøndby, Denmark
Contact:
Contact Athas
Website

  • Quote

Post by Athas » Fri Feb 20, 2004 7:19 am

I would absolutely hate it if my machine started moving around files by itself. I don't really see the big problem, I mean, you only have to type

Code: Select all

ln -sf linux version linux
If people can't do that, then there's no way they're going to be able to run Gentoo GNU/Linux anyway.
Emacs-optimized danish console keymap - My .emacs
Climacs - next generation Emacs.
Top
NiklasH
Apprentice
Apprentice
User avatar
Posts: 211
Joined: Fri Aug 30, 2002 7:52 am
Location: On top of something
Contact:
Contact NiklasH
Website

  • Quote

Post by NiklasH » Fri Feb 20, 2004 8:39 am

I have had this for a long time in my /etc/conf.d/local.start:

Code: Select all

ln -sf /usr/src/linux-`uname -r` /usr/src/linux

if ! [ -e /lib/modules/`uname -r`/video/nvidia.o ] ;
then
emerge nvidia-kernel nvidia-glx
modprobe nvidia
fi
, to automatically get the nvidia modules loaded for my new kernel.
Works fine for me.
Banana Republic
Top
Fitzsimmons
Guru
Guru
User avatar
Posts: 415
Joined: Wed Jan 01, 2003 10:21 pm
Location: Waterloo, Ontario, Canada
Contact:
Contact Fitzsimmons
Website

  • Quote

Post by Fitzsimmons » Sat Feb 21, 2004 7:36 am

Well there ya go. You can take that script and put it in your local.start. But it certainly doesn't belong in portage.
Top
Ateo
Advocate
Advocate
Posts: 2022
Joined: Mon Jun 02, 2003 11:47 pm
Location: Vegas Baby!

  • Quote

Post by Ateo » Sat Feb 21, 2004 9:51 am

NiklasH wrote:I have had this for a long time in my /etc/conf.d/local.start:

Code: Select all

ln -sf /usr/src/linux-`uname -r` /usr/src/linux

if ! [ -e /lib/modules/`uname -r`/video/nvidia.o ] ;
then
emerge nvidia-kernel nvidia-glx
modprobe nvidia
fi
, to automatically get the nvidia modules loaded for my new kernel.
Works fine for me.
You're only emerging a package. Do you realize that when you compile programs, some programs use that symlink to compile to?
Top
NiklasH
Apprentice
Apprentice
User avatar
Posts: 211
Joined: Fri Aug 30, 2002 7:52 am
Location: On top of something
Contact:
Contact NiklasH
Website

  • Quote

Post by NiklasH » Sat Feb 21, 2004 3:58 pm

Yes, but that package uses the /usr/src/linux symlink to put the nvidia module. And why would I want a program that compiles against the kernel to compile against something other than the running kernel?
Banana Republic
Top
nerdbert
l33t
l33t
User avatar
Posts: 981
Joined: Sun Feb 09, 2003 3:59 pm
Location: Berlin
Contact:
Contact nerdbert
Website

  • Quote

Post by nerdbert » Sat Feb 21, 2004 8:42 pm

NiklasH wrote:Yes, but that package uses the /usr/src/linux symlink to put the nvidia module. And why would I want a program that compiles against the kernel to compile against something other than the running kernel?
that's not a problem if you always compile it right after emerging.
But if you e.g. use 2.6 and you still have gentoo-sources in your world file it might lead to confusion after emerging world.
This shouldn't become standard, but I can perfectly understand that some people like this to be integrated into kernel ebuilds.

NiklasH: You only reboot rarely, don't you?
I'm really wondering what Lovechild is doing nowadays...
Top
NiklasH
Apprentice
Apprentice
User avatar
Posts: 211
Joined: Fri Aug 30, 2002 7:52 am
Location: On top of something
Contact:
Contact NiklasH
Website

  • Quote

Post by NiklasH » Sat Feb 21, 2004 9:24 pm

Nope, I turn off my computer almost every night.
Haven't had any problems.
And what kind of confusion would it lead to? If i keep the symlink to an old kernel, it could also cause trouble if I compile some new program against it.
The only programs that could run into troubles are the ones that install their own modules, as far as I can tell. And they aren't that many, at least not on my system.

Could anyone explain why I need to keep the symlink to a kernel that is never used anymore? According to Linus T., that symlink is a relic that shouldn't be used, anyway. Programs should check the kernel version and compile against the correct source tree by themselves.

Tell me if I'm off base here, but that seems more logical to me.
Banana Republic
Top
nerdbert
l33t
l33t
User avatar
Posts: 981
Joined: Sun Feb 09, 2003 3:59 pm
Location: Berlin
Contact:
Contact nerdbert
Website

  • Quote

Post by nerdbert » Sat Feb 21, 2004 10:01 pm

NiklasH wrote:Nope, I turn off my computer almost every night.
Haven't had any problems.
I didn't expect you to have any problems, but it must take quite some time to boot whenever you've changed your kernel or you decided to boot an alternative kernel. That's why I assumed you don't reboot quite often.
NiklasH wrote: And what kind of confusion would it lead to? If i keep the symlink to an old kernel, it could also cause trouble if I compile some new program against it.
I already said it: If you happen to use a 2.6 kernel and you still have 2.4 in your world file. Let's assume you just did an emerge world and there is an update to 2.4 and another one to nvidia-kernel. If you include a symlink change into the kernel ebuild this will lead to a new nvidia module compiled for a 2.4 kernel. The nvidia-kernel ebuild removes "old" instances, so you won't have nvidia.ko in your /lib/modules/2.6.<whatever>. That's the confusion I'm talking about.
NiklasH wrote: The only programs that could run into troubles are the ones that install their own modules, as far as I can tell. And they aren't that many, at least not on my system.
I've only got 2 myself (nvidia-kernel and at76c503a). But the current setup is quite convenient IMO - I don't want to count the report requests this new ebuild would cause ("I just emerged X and after modprobing it I'm told that Module doesn't exists).
I'm really wondering what Lovechild is doing nowadays...
Top
NiklasH
Apprentice
Apprentice
User avatar
Posts: 211
Joined: Fri Aug 30, 2002 7:52 am
Location: On top of something
Contact:
Contact NiklasH
Website

  • Quote

Post by NiklasH » Sat Feb 21, 2004 10:16 pm

nerdbert wrote:
NiklasH wrote:Nope, I turn off my computer almost every night.
Haven't had any problems.
I didn't expect you to have any problems, but it must take quite some time to boot whenever you've changed your kernel or you decided to boot an alternative kernel. That's why I assumed you don't reboot quite often.
Maybe I'm too tired to see what you mean, but I don't. My computer boots in about 20-30 seconds, if that's what you mean? And I tend to use one kernel until another one comes along that seems neat. And then I of course use make oldconfig.
And I like more to get the nvidia drivers automatically merged if I use another kernel than having to do it manually. That way, only about half a minute is added to the boot time, instead of a few minutes doing it by hand.
NiklasH wrote: And what kind of confusion would it lead to? If i keep the symlink to an old kernel, it could also cause trouble if I compile some new program against it.
I already said it: If you happen to use a 2.6 kernel and you still have 2.4 in your world file. Let's assume you just did an emerge world and there is an update to 2.4 and another one to nvidia-kernel. If you include a symlink change into the kernel ebuild this will lead to a new nvidia module compiled for a 2.4 kernel. The nvidia-kernel ebuild removes "old" instances, so you won't have nvidia.ko in your /lib/modules/2.6.<whatever>. That's the confusion I'm talking about.
I'm not talking about the kernel ebuild. I'm talking about rebooting into another kernel. The script I use is in my local.start, for precisely that reason: that the module is removed from other kernels.
NiklasH wrote: The only programs that could run into troubles are the ones that install their own modules, as far as I can tell. And they aren't that many, at least not on my system.
I've only got 2 myself (nvidia-kernel and at76c503a). But the current setup is quite convenient IMO - I don't want to count the report requests this new ebuild would cause ("I just emerged X and after modprobing it I'm told that Module doesn't exists).
Maybe we're not talking about the same thing? Are you talking about changing the symlink in the ebuild? If that's the case, then we agree: I don't want it in the ebuild either. But that wasn't in my original post, OTOH. :)
Banana Republic
Top
nerdbert
l33t
l33t
User avatar
Posts: 981
Joined: Sun Feb 09, 2003 3:59 pm
Location: Berlin
Contact:
Contact nerdbert
Website

  • Quote

Post by nerdbert » Sat Feb 21, 2004 10:35 pm

I don't really know if we're talking about the same thing. I'll try to clarify my point:

Whenever your script leads to a reemerge of nvidia-kernel and nvidia-glx it takes more than 30s to boot. I've got more than 1 kernel in my grub.conf and whenever I want to boot a different one this would really take a while.
But I like your additions to local.start and I can perfectly understand why you use this.

If you want to have an automatic link created whenever you emerge a new kernel (I'm also tired - wasn't this ewan.paton's suggestion?) this might be realized in the kernel's ebuild. IMO it just doesn't make sense in the average case scenario, because people tend to emerge kernels they don't really use.
I'm really wondering what Lovechild is doing nowadays...
Top
ewan.paton
Veteran
Veteran
User avatar
Posts: 1219
Joined: Tue Jul 29, 2003 12:21 am
Location: glasgow, scotland
Contact:
Contact ewan.paton
Website

  • Quote

Post by ewan.paton » Sun Feb 22, 2004 12:04 am

yeh the ebuild to make symlink was a stupid idea, i think the idea of startup script is a lot more useful. i was just being lazy and wanted to type as little as posible, the scrip alows me to change kernels often and not have remeber or type stuff
Giay tay nam | Giay nam cao cap | Giay luoi
Top
nerdbert
l33t
l33t
User avatar
Posts: 981
Joined: Sun Feb 09, 2003 3:59 pm
Location: Berlin
Contact:
Contact nerdbert
Website

  • Quote

Post by nerdbert » Sun Feb 22, 2004 1:25 am

ewan.paton wrote:yeh the ebuild to make symlink was a stupid idea, i think the idea of startup script is a lot more useful. i was just being lazy and wanted to type as little as posible, the scrip alows me to change kernels often and not have remeber or type stuff
it's not a stupid idea to include it in an ebuild - I just believe it doesn't make sense to have it as a default option :wink:
I'm actually thinking about using NiklasH's script. If I add some lines it might also make sense to me to run it at default level.
I'm really wondering what Lovechild is doing nowadays...
Top
NiklasH
Apprentice
Apprentice
User avatar
Posts: 211
Joined: Fri Aug 30, 2002 7:52 am
Location: On top of something
Contact:
Contact NiklasH
Website

  • Quote

Post by NiklasH » Sun Feb 22, 2004 5:54 am

nerdbert wrote:I don't really know if we're talking about the same thing. I'll try to clarify my point:

Whenever your script leads to a reemerge of nvidia-kernel and nvidia-glx it takes more than 30s to boot. I've got more than 1 kernel in my grub.conf and whenever I want to boot a different one this would really take a while.
But I like your additions to local.start and I can perfectly understand why you use this.

If you want to have an automatic link created whenever you emerge a new kernel (I'm also tired - wasn't this ewan.paton's suggestion?) this might be realized in the kernel's ebuild. IMO it just doesn't make sense in the average case scenario, because people tend to emerge kernels they don't really use.
Then I think we pretty much agree :)
And my script only does an emerge when the nvidia module is missing, so it doesn't do anything other than you would do youself after rebooting to a different kernel.
Banana Republic
Top
TheEternalVortex
Apprentice
Apprentice
User avatar
Posts: 207
Joined: Tue Oct 15, 2002 6:38 am
Location: San Jose, CA
Contact:
Contact TheEternalVortex
Website

  • Quote

Post by TheEternalVortex » Sun Feb 22, 2004 8:47 am

I have a script that compiles the latest kernel I've installed (since I tend to do 2-3 a week). To change the symlink automatically you can do this (taken from the script):
cd /usr/src
KERNEL=`ls --sort=time -1 | head -n 1`
rm linux 2> /dev/null
ln -s $KERNEL linux
-- Andy
Top
gigatexal
n00b
n00b
Posts: 44
Joined: Tue Oct 07, 2003 12:38 am
Location: Rexburg, Idaho

  • Quote

Post by gigatexal » Thu Mar 11, 2004 6:20 am

I am planning on running both the latest gs 2.4 kernel and the latest 2.6 kernel, will I have to re-symlink the things everytime I boot to a different kernel?

alex
_________________
Alex

amd64 3000 (socket 754)
1GB ram
asus k8v deluxe
80GB hdd
ati 9500 pro
gentoo 2005.1 and winxp
Top
Fitzsimmons
Guru
Guru
User avatar
Posts: 415
Joined: Wed Jan 01, 2003 10:21 pm
Location: Waterloo, Ontario, Canada
Contact:
Contact Fitzsimmons
Website

  • Quote

Post by Fitzsimmons » Thu Mar 11, 2004 1:01 pm

I am fairly certain you only need to re-link the kernel if you are trying to build against it.
Top
Post Reply
  • Print view

19 posts • Page 1 of 1

Return to “Gentoo Chat”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy