Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[HOWTO] Install kernel sources manually
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
genstef
Retired Dev
Retired Dev


Joined: 13 Jun 2004
Posts: 668
Location: M/Bay/Germany

PostPosted: Sat Jan 29, 2005 4:13 pm    Post subject: [HOWTO] Install kernel sources manually Reply with quote

What will you learn?
- where to install a kernel manually
- how to satisfy portage deps, without a kernel installed
- how to patch a kernel

Why would one want to install kernels manually when there are so many kernel packages in portage?

Well there are some reasons:
- portage developers are too slow for you, you dont want to wait some days before you install a new release candidate
- the portage tree does not contain your favourite patchset
- portage is too slow in merging for you, you want to do it manually to save all the overhead
- portage monitors all installed files, you dont want that for kernels, because you build them and the .o files wont get unmerged when you want to uninstall
- the constant gentoo-dev-sources revision bumps get on your nerves


Where to get the kernel sources?
kernel.org is the headquarters of the linux kernel. The download labelled with "F" at the right side is the full tarball, which will be the base for our installation:
Code:
cd /usr/portage/distfiles
wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.10.tar.bz2


Where to place the kernel sources?

Usually kernel sourcs are in /usr/src/linux. To allow it to have more than one kernel source installed for testing or different versions, that is not a directory but a symlink that points to the source tree. The source tree directory will be named linux-VERSION. The tarball does the naming automatically for you, so only the symlink is left:
Code:
cd /usr/src
tar xjf /usr/portage/distfiles/linux-2.6.10.tar.bz2

you will have a directory linux-2.6.10 now, so we link "linux" to it:
Code:
ln -s linux-2.6.10 linux


How to patch the kernel sources?
You sure want to apply some patches to your sources, for more performance or some other improvements. We will take -ck performance patchset as example:
Code:
cd /usr/portage/distfiles
wget http://ck.kolivas.org/patches/2.6/2.6.10/2.6.10-ck5/patch-2.6.10-ck5.bz2
cd /usr/src/linux-2.6.10
bzcat /usr/portage/distfiles/patch-2.6.10-ck5.bz2 | patch -p1

You can use "gzcat" for ".gz"-files and "cat" for .patch or .diff or patches w/ o ending.
Now we can rename the source directory to reflect the new name:
Code:
cd /usr/src
mv linux-2.6.10 linux-2.6.10-ck5
rm linux
ln -s linux-2.6.10-ck5 linux

Now your new manually installed ck-kernel should be ready for building!

How do I tell portage that I installed my sources manually?
When you have not emerge'd a kernel source, portage wants to install it, when you emerge alsa for example.
To avoid that we will "provide" a kernel source:
Code:
mkdir /etc/portage/profile
echo "sys-kernel/vanilla-sources-2.6.99" >> /etc/portage/profile/package.provided
echo "virtual/alsa sys-kernel/vanilla-sources" >> /etc/portage/profile/virtuals
echo "virtual/linux-sources sys-kernel/vanilla-sources" >> /etc/portage/profile/virtuals


Last edited by genstef on Tue Mar 29, 2005 9:03 pm; edited 1 time in total
Back to top
View user's profile Send private message
texas1emt
Guru
Guru


Joined: 27 Oct 2003
Posts: 352
Location: San Antonio, TX

PostPosted: Tue Feb 01, 2005 9:16 pm    Post subject: Reply with quote

Dang, that is pretty sweet. Good post :)
_________________
M. Hayden - San Antonio, TX
Back to top
View user's profile Send private message
carneboy
n00b
n00b


Joined: 11 May 2004
Posts: 63
Location: Riverside, CA

PostPosted: Tue Feb 01, 2005 10:00 pm    Post subject: Reply with quote

good to see it all summed up in one place
Back to top
View user's profile Send private message
truekaiser
l33t
l33t


Joined: 05 Mar 2004
Posts: 801

PostPosted: Tue Feb 01, 2005 10:53 pm    Post subject: Reply with quote

i thought the dev's were trying to stop people from useing 'insane' kernels?
Back to top
View user's profile Send private message
Bols
Tux's lil' helper
Tux's lil' helper


Joined: 15 May 2004
Posts: 112

PostPosted: Tue Feb 01, 2005 11:03 pm    Post subject: Reply with quote

Just what I wanted! :wink: Thanks...

Great Howto, it would be a good idea to post it on the wiki if genstef agrees, don't you think?


Last edited by Bols on Tue Feb 01, 2005 11:08 pm; edited 1 time in total
Back to top
View user's profile Send private message
freelight
Apprentice
Apprentice


Joined: 12 Jun 2004
Posts: 295
Location: NYC, NY, USA

PostPosted: Tue Feb 01, 2005 11:05 pm    Post subject: Reply with quote

truekaiser wrote:
i thought the dev's were trying to stop people from useing 'insane' kernels?


Only on production systems. As I understand it, Gentoo devs have no problem with people using expermental stuff on test systems and other no-big-deal-if-it-blows-up environments.

Oh, and thanks for the post! I can't believe I haven't thought of telling portage to leave my kernel alone that way.
Back to top
View user's profile Send private message
truekaiser
l33t
l33t


Joined: 05 Mar 2004
Posts: 801

PostPosted: Tue Feb 01, 2005 11:12 pm    Post subject: Reply with quote

is there a way other then this to tell portage to ignore the 'r(insert number here)' releases? i don't like haveing two of the same kernel around just because one went stable on a non x86 cpu.
Back to top
View user's profile Send private message
texas1emt
Guru
Guru


Joined: 27 Oct 2003
Posts: 352
Location: San Antonio, TX

PostPosted: Tue Feb 01, 2005 11:17 pm    Post subject: Reply with quote

truekaiser wrote:
is there a way other then this to tell portage to ignore the 'r(insert number here)' releases? i don't like haveing two of the same kernel around just because one went stable on a non x86 cpu.


Just toss something like ">=sys-kernel/gentoo-dev-sources-2.6.10-r4" in your /etc/portage/package.mask. That tells gentoo you don't want -r4 or anything any higher no matter what.

Code:
echo ">=sys-kernel/gentoo-dev-sources-2.6.10-r4" >> /etc/portage/package.mask

_________________
M. Hayden - San Antonio, TX
Back to top
View user's profile Send private message
truekaiser
l33t
l33t


Joined: 05 Mar 2004
Posts: 801

PostPosted: Wed Feb 02, 2005 1:23 am    Post subject: Reply with quote

texas1emt wrote:
truekaiser wrote:
is there a way other then this to tell portage to ignore the 'r(insert number here)' releases? i don't like haveing two of the same kernel around just because one went stable on a non x86 cpu.


Just toss something like ">=sys-kernel/gentoo-dev-sources-2.6.10-r4" in your /etc/portage/package.mask. That tells gentoo you don't want -r4 or anything any higher no matter what.

Code:
echo ">=sys-kernel/gentoo-dev-sources-2.6.10-r4" >> /etc/portage/package.mask


so that would block any 2.6.10 kernel with a r number higher then 4 but if a 2.6.11 comes out and becomes stable on x86 it would ask for a upgrade?
Back to top
View user's profile Send private message
texas1emt
Guru
Guru


Joined: 27 Oct 2003
Posts: 352
Location: San Antonio, TX

PostPosted: Wed Feb 02, 2005 1:30 am    Post subject: Reply with quote

truekaiser wrote:
So that would block any 2.6.10 kernel with a r number higher then 4 but if a 2.6.11 comes out and becomes stable on x86 i would ask for a upgrade?


AFAIK, yes. I think the portage interprets -2.6.10-rX and -2.6.11-rX being as different as fluxbox and nano.
_________________
M. Hayden - San Antonio, TX
Back to top
View user's profile Send private message
genstef
Retired Dev
Retired Dev


Joined: 13 Jun 2004
Posts: 668
Location: M/Bay/Germany

PostPosted: Wed Feb 02, 2005 6:49 am    Post subject: Reply with quote

truekaiser wrote:
i thought the dev's were trying to stop people from useing 'insane' kernels?

Why is it insane? I think its the sanest way to install a kernel .. ;)

Bols wrote:
Just what I wanted! :wink: Thanks...

Great Howto, it would be a good idea to post it on the wiki if genstef agrees, don't you think?

Can you please post it to the wiki? Maybe someone wants to make some modifications I do not yet know of.
Back to top
View user's profile Send private message
Agilo
n00b
n00b


Joined: 01 Jan 2004
Posts: 38
Location: The Netherlands

PostPosted: Wed Feb 02, 2005 8:14 am    Post subject: Reply with quote

I don't know about the rest, but I tend to compile and install critical or otherwise important applications such as Linux/Apache/PHP/ALSA/etc myself (that is to say, not letting Portage do it.)
Configuring and compiling a kernel is not so hard if you know your own hardware.
_________________
- Agilo (Alessandro Lo-Presti)
Back to top
View user's profile Send private message
genstef
Retired Dev
Retired Dev


Joined: 13 Jun 2004
Posts: 668
Location: M/Bay/Germany

PostPosted: Wed Feb 02, 2005 2:03 pm    Post subject: Reply with quote

How to configure a kernel manually is covered in the gentoo handbook already:
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=7#doc_chap3
Back to top
View user's profile Send private message
Bols
Tux's lil' helper
Tux's lil' helper


Joined: 15 May 2004
Posts: 112

PostPosted: Wed Feb 02, 2005 11:38 pm    Post subject: Reply with quote

genstef wrote:
Bols wrote:
Just what I wanted! :wink: Thanks...

Great Howto, it would be a good idea to post it on the wiki if genstef agrees, don't you think?

Can you please post it to the wiki? Maybe someone wants to make some modifications I do not yet know of.


Ok, I have just post it on the Wiki. :wink:
Feel free to bring modifications to it!

http://gentoo-wiki.com/HOWTO_Install_kernel_sources_manually

I'll translate it to French tomorrow if I've the time...

Thanks Genstef for this howto (and also for the acx100 ebuild that I use), you did a great job! 8)
Back to top
View user's profile Send private message
EDDI
n00b
n00b


Joined: 09 Feb 2004
Posts: 12
Location: Karlsruhe, Germany

PostPosted: Tue Mar 29, 2005 11:08 am    Post subject: Re: [HOWTO] Install kernel sources manually Reply with quote

thank you for this nice howto. I just used it today and found a missing s, without that s it didn't work for me, so i added it.

Code:

echo "sys-kernel/vanilla-sources-2.6.99" >> /etc/portage/profile/package.provided


at the wikipage it was already correct.
Back to top
View user's profile Send private message
genstef
Retired Dev
Retired Dev


Joined: 13 Jun 2004
Posts: 668
Location: M/Bay/Germany

PostPosted: Tue Mar 29, 2005 9:04 pm    Post subject: Reply with quote

I corrected the typo, thanks!
Back to top
View user's profile Send private message
yngwin
Retired Dev
Retired Dev


Joined: 19 Dec 2002
Posts: 4572
Location: Suzhou, China

PostPosted: Tue Mar 29, 2005 9:32 pm    Post subject: Reply with quote

Wouldn't it be just as easy to make a custom ebuild for the kernel + patch you desire? That way you don't have to fool portage.
_________________
"Those who deny freedom to others deserve it not for themselves." - Abraham Lincoln
Free Culture | Defective by Design | EFF
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks 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