How to build Custom Kernel in LMDE

Write tutorials here
More tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Do not start a support topic here please, Before you post please read this

How to build Custom Kernel in LMDE

Postby mmix on Sat Jul 06, 2013 11:20 pm

$ sudo apt-get install build-essential ncurses-base ncurses-dev fakeroot kernel-package

# download kernel source https://www.kernel.org/
$ wget https://www.kernel.org/pub/linux/kernel ... .10.tar.xz

$ tar xf linux-3.10.tar.xz

$ cd linux-3.10

$ cp /boot/config-3.2.0-4-amd64 .config

$ make oldconfig

<hit "Enter" Key until meet the shell>

$ export CONCURRENCY_LEVEL=4

$ fakeroot make-kpkg --initrd kernel_image kernel_headers modules_image

$ cd ..

$ sudo dpkg -i linux-headers-3.10.0_3.10.0-10.00.Custom_amd64.deb

$ sudo dpkg -i linux-image-3.10.0_3.10.0-10.00.Custom_amd64.deb

reboot

--
PS: removed following line, it can be ignored.
//don't need to clean if extract new kernel archieve
$ fakeroot make-kpkg clean
Last edited by mmix on Sat Oct 18, 2014 9:53 pm, edited 3 times in total.
mmix
Level 2
Level 2
 
Posts: 75
Joined: Tue Oct 09, 2012 11:02 am

Linux Mint is funded by ads and donations.
 

Re: How to build Custom Kernel in LMDE

Postby RJVB on Mon Jan 06, 2014 4:48 am

Hello,

This worked (almost) like a treat, except that there's one difference with the "official" Mint packages. The official kernel headers are installed in separate /usr/src/*-common and /usr/src/*-amd64 trees, with /lib/modules/3.10*/source pointing to the former and /lib/modules/3.10*/build pointing to the latter. In my custom built packages, all headers are installed in a single tree in /usr/src. I presume that might be OK, but the modules source and build point both to the real kernel source directory in which I did the build. Somewhere I consider that an error because IMHO the whole point with packages is that they ought to be standalone, and not depend on the build context ...

Could it be that dpkg is "clever" to detect the presence of the full build tree and link to that instead of to the installed headers (as it would when the full build tree is not present)?

I should add that during the installation of the headers package, dpkg did complain that the corresponding /lib/modules tree was not available. Curiously I did not see this message when I installed the linux-headers-3.10-all package from the server, when it installed the rt headers (I don't have the rt kernel installed).

Another issue: somehow make-kpkg did not catch the presence of "illegal" (uppercase ...) characters in the local version string BEFORE spending hours compiling the whole thing, but only when it started to create the packages. Not fun if you have no idea that this might happen, esp. since changing the local version string requires rebuilding a significant portion of the tree (I'd say about 1/7th, around 14%). I seem to have understood from googling that this ought to have been caught at the start, any ideas why that didn't happen?

One thing that I do appreciate is that update-initramfs now takes an acceptable time. When I followed the traditional route (make xconfig && make && make modules_install install), generating the initramfs took about 30 minutes (!) on this netbook, mostly spent compressing a huge file. Size and thus generation time are now down to what they are for the distribution kernels.
RJVB
Level 2
Level 2
 
Posts: 54
Joined: Tue Jul 03, 2012 1:50 pm

How to build Custom Kernel in LMDE

Postby romanyacik on Mon Feb 10, 2014 11:10 pm

These are good instructions! works in main edition as well, but I've known the process take a long time.
romanyacik
Level 1
Level 1
 
Posts: 11
Joined: Thu May 10, 2012 10:23 am

Re: How to build Custom Kernel in LMDE

Postby jamaica on Thu Aug 14, 2014 4:06 am

romanyacik wrote:These are good instructions! works in main edition as well, but I've known the process take a long time.


Try to add the -j <jobs> option to make-kpkg. Replace <jobs> by the number of cpu-cores + 1. This should speed up the build process by doing multiple jobs (makefile tasks) parallel.
Example (with 2 cpu-cores):
$ fakeroot make-kpkg -j 3 --initrd kernel_image kernel_headers modules_image
jamaica
Level 1
Level 1
 
Posts: 6
Joined: Tue Apr 29, 2014 4:34 am

Re: How to build Custom Kernel in LMDE

Postby apemanx on Fri Aug 15, 2014 1:49 am

So, just to make sure before I jump in and try this (Always wanted to).
If I build this custom kernel to its .deb format, i simply install it. Good.

Then, will there be updates in the future that I have to avoid? Or should I rebuild every time - (I wouldn't mind doing it).

how do I make sure that RJVB's comments/suggestions are included into mmix's instructions?

Thanks! Looks great this!
Breaking and fixing is learning! This knowledge gained gives power. And power gives you freedom if used with wisdom!
User avatar
apemanx
Level 2
Level 2
 
Posts: 64
Joined: Tue Aug 12, 2014 1:21 am
Location: South Africa

Re: How to build Custom Kernel in LMDE

Postby apemanx on Tue Aug 19, 2014 3:14 am

Found this... 9th August post

Can anyone verify the correctness? It looks good enough for me to try?
http://www.tecmint.com/install-kernel-3-16-in-debian/
Breaking and fixing is learning! This knowledge gained gives power. And power gives you freedom if used with wisdom!
User avatar
apemanx
Level 2
Level 2
 
Posts: 64
Joined: Tue Aug 12, 2014 1:21 am
Location: South Africa

Re: How to build Custom Kernel in LMDE

Postby mmix on Sat Oct 18, 2014 9:58 pm

when too much time spent to compile kernel,
there is something wrong about debian way automatic compilation.
http://forums.debian.net/viewtopic.php?f=3&t=102982

in arch linux, the automatic installation is much shorter and stable.
https://plan9assembler.wordpress.com/20 ... d-revisit/
mmix
Level 2
Level 2
 
Posts: 75
Joined: Tue Oct 09, 2012 11:02 am

Linux Mint is funded by ads and donations.
 

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 4 guests