SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2012-02-24 10:02:23

xaos52
The Good Doctor
From: Planet of the @s
Registered: 2011-06-24
Posts: 4,602

How to compile the kernel from source.

apt-get install git build-essential

Last edited by xaos52 (2012-02-25 15:08:49)

Offline

Be excellent to each other!

#2 2012-02-24 14:17:45

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: How to compile the kernel from source.

thank you xaos! big_smile

Offline

#3 2012-02-25 11:39:36

Vansgo
#! Die Hard
Registered: 2011-05-02
Posts: 1,580
Website

Re: How to compile the kernel from source.

Curious, How to best un-compile as well -

I have compiled Kernels with apt and want to completely remove all related files for some Kernels as no longer needed - for this I used aptitude. However, I noticed /lib/modules and /usr/share still have related files after this removal:

:~$ sudo aptitude remove linux-image-3.2.0-6.dmz.1-liquorix-686 linux-headers-3.2.0-5.dmz.1-liquorix-686

So, how does one complete a better clean-up if desired to remove all Kernel files after install?

Offline

#4 2012-02-25 14:32:06

xaos52
The Good Doctor
From: Planet of the @s
Registered: 2011-06-24
Posts: 4,602

Re: How to compile the kernel from source.

As far as I know, you can not compile a kernel with apt nor aptitude. Both tools install the binary packages.

For removing a package completely use the command

sudo apt-get --purge remove <package name>

I am not sure if removing and purging a kernel removes the associated /lib/modules/kernel-version.
I would have to test if it does.
What I am sure of is that you can remove the directory manually with

sudo rm -rf /lib/modules/<kernel-version-you-want-to-remove>

hth

Offline

#5 2012-02-25 14:55:08

Vansgo
#! Die Hard
Registered: 2011-05-02
Posts: 1,580
Website

Re: How to compile the kernel from source.

Offline

#6 2012-02-25 14:56:28

Unia
#! Octo-portal-pussy
From: The Netherlands
Registered: 2010-07-17
Posts: 4,634
Website

Re: How to compile the kernel from source.

Xaos, how about putting all terminal commands in code tags? That would make this good guide clear to follow

Offline

#7 2012-02-25 14:57:31

xaos52
The Good Doctor
From: Planet of the @s
Registered: 2011-06-24
Posts: 4,602

Re: How to compile the kernel from source.

Compiling allows you to test newer kernels that are not available as binary packages yet. Normally there is no advantage, except if you have brand new hardware that is not, or not well supported in the binary package yet.

Offline

#8 2012-02-25 16:56:07

Vansgo
#! Die Hard
Registered: 2011-05-02
Posts: 1,580
Website

Re: How to compile the kernel from source.

Offline

#9 2012-02-25 17:08:06

xaos52
The Good Doctor
From: Planet of the @s
Registered: 2011-06-24
Posts: 4,602

Re: How to compile the kernel from source.

I do not know if this is a bug or if it is a safety measure to prevent you from removing the modules inadvertently.

If you are sure you want these removed, then do:

sudo rm -rf /lib/modules/2.6.33.7.2-rt30...
sudo apt-get --purge remove ....

hth

Offline

#10 2012-02-25 17:50:12

Vansgo
#! Die Hard
Registered: 2011-05-02
Posts: 1,580
Website

Re: How to compile the kernel from source.

Offline

#11 2012-02-25 17:56:35

xaos52
The Good Doctor
From: Planet of the @s
Registered: 2011-06-24
Posts: 4,602

Re: How to compile the kernel from source.

sudo rm -rf linux
sudo rm -rf .git

Last edited by xaos52 (2012-02-25 17:57:54)

Offline

#12 2012-02-25 18:07:36

Vansgo
#! Die Hard
Registered: 2011-05-02
Posts: 1,580
Website

Re: How to compile the kernel from source.

curious, could one use this compile method to get a 3.2 liquorix i686 Kernel working by changing the source in step 1 of install?

Offline

#13 2012-02-25 18:42:45

mynis01
#! Die Hard
From: 127.0.0.1
Registered: 2010-07-02
Posts: 2,005

Re: How to compile the kernel from source.

Offline

#14 2012-02-25 19:00:33

Vansgo
#! Die Hard
Registered: 2011-05-02
Posts: 1,580
Website

Re: How to compile the kernel from source.

Offline

#15 2012-02-25 19:16:41

kd5ob
#! CrunchBanger
From: Oklahoma
Registered: 2012-02-02
Posts: 208

Re: How to compile the kernel from source.

This is a good lesson.  But, I find it funny that we could compile kernel modules using aptitude such as the Broadcom in the past yet, they have no aptitude .deb setup which would invoke automatically as you've suggested.  Break for menu and so on.....

Maybe Debian wouldn't do this but, perhaps in the future Crunch Bang could.  It could be one of their MARKS.

Offline

#16 2012-02-26 17:51:47

Vansgo
#! Die Hard
Registered: 2011-05-02
Posts: 1,580
Website

Re: How to compile the kernel from source.

Offline

#17 2012-03-22 16:29:55

Marceau
#! CrunchBanger
Registered: 2012-01-09
Posts: 103

Re: How to compile the kernel from source.

Pretty awesome! I've now rolled my own kernel and am using it as we speak. smile

I did follow a slightly different procedure though, as git was unbearably slow for me (20-30KB/s).

I downloaded the most recent mainline 3.3 from kernel.org, unzipped it in a folder, put a terminal in that folder and then followed the commands you wrote

cp /boot/config-$(uname -r) .config

make localmodconfig

make -j4 deb-pkg

I just installed the deb packages by double-clicking them. A habit from the old days, I guess.

I wonder though, if you don't mind my asking, what does "cp /boot/config-$(uname -r) .config" actually do? Am I right in guessing it just copies the config of the currently installed kernel to the source directory? How does its presence/absence influence the make process?

Offline

#18 2012-03-22 16:40:57

xaos52
The Good Doctor
From: Planet of the @s
Registered: 2011-06-24
Posts: 4,602

Re: How to compile the kernel from source.

Your guess is correct.
It influences the localmodconfig: Only questions that are not answered in the current config are asked.

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: bleh

Debian Logo