Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
lspci in initramfs [SOLVED, kind-of]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
marco1475
n00b
n00b


Joined: 10 Oct 2005
Posts: 55
Location: Hunt Valley, MD

PostPosted: Sun May 03, 2009 1:25 am    Post subject: lspci in initramfs [SOLVED, kind-of] Reply with quote

Hi,

My notebook has two graphics cards, Intel on-board and nVidia GeForce, and a hardware switch toggles between them. I would like to detect which of the cards is currently active in my initramfs. However, it seems that the lspci executable (part of the pciutils package) is not self-sufficient /static and simply copying it to the initramfs and calling it in the init script does not work. (I tried compiling the ebuild with LDFLAGS="-s -static", but that did not work because I "attempted static link of dynamic object `lib/libpci.so.3.0.2'".)

Does anyone have an idea how I can get lspci into the initramfs? All I need is to call:
Code:
lspci|grep -c nVidia
Thanks,
_________________
marco1475


Last edited by marco1475 on Sun May 03, 2009 4:21 am; edited 1 time in total
Back to top
View user's profile Send private message
marco1475
n00b
n00b


Joined: 10 Oct 2005
Posts: 55
Location: Hunt Valley, MD

PostPosted: Sun May 03, 2009 4:21 am    Post subject: Reply with quote

Alright, I solved it. The problem were, as usual the dependencies of lspci, because it needs to be self-sufficient in the initramfs. So you can either compile it statically (I haven't found a way) or you go the brute force method and copy all the libraries it depends on into your iniramfs. After a bit of Googling I came across the very useful "ldd" command, which lists all the dependencies of an executable. A simple call of
Code:
ldd /usr/sbin/lspci
then yielded the libraries I needed. After that it was just a matter of copying them into the initramfs.

If somebody has a better way of finding out whether an nVidia card is present in the system, please let me know. Thanks,
_________________
marco1475
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum