Wednesday, May 1, 2024
 Popular · Latest · Hot · Upcoming
41
rated 0 times [  41] [ 0]  / answers: 1 / hits: 102505  / 2 Years ago, thu, july 21, 2022, 1:08:28

I'm interested in compiling a new kernel under Ubuntu 12.04 x86 64 bit.



I found this wiki page which is basically a mirror for this blog and there are a lot of steps (git, etc.) that appear useless to me.



With earlier releases/distros, I used to create a .config file and modify a Makefile if I needed to, then just run make and it's done.



Is there is a simple way to do this under Ubuntu?


More From » kernel

 Answers
7

1. Use apt-get source to download the Ubuntu version of the kernel



apt-get source linux-image-$(uname -r)


gives a folder that contains, for example:




linux-3.2.0 linux_3.2.0-26.41.dsc
linux_3.2.0-26.41.diff.gz linux_3.2.0.orig.tar.gz


The bolded diff includes all the Ubuntu/Debian customizations.



2. To build a stock kernel with your own .config, use the "old-fashioned" Debian make-kpkg method



This is the alternate old-fashioned way described in the wiki:



sudo apt-get install kernel-package


If you are compiling a kernel for the first time:



sudo apt-get build-dep linux-image-$(uname -r)


Then cd into the source directory (here, linux-3.2.0), and either run make oldconfig to create .config file with your running kernel's configuration, or copy a third-part .config to this directory.



Depending on whether you want a text or graphical config, install:



(Text)



sudo apt-get install libncurses5 libncurses5-dev


(Graphical)



sudo apt-get install qt3-dev-tools libqt3-mt-dev


And then run:



(Text)



make menuconfig


(Graphical)



make xconfig


When done, just run:



fakeroot make-kpkg -j N --initrd --append-to-version=my-very-own-kernel kernel-image kernel-headers


where N is how many jobs to run in parallel (usually the number of CPUs you have), and my-very-own-kernel is a custom string to identify this build.



When done, the kernel image and header files will be ready as debs in the parent directory; you can install them with sudo dpkg -i, which will also take care of adding GRUB entries, etc.


[#36876] Thursday, July 21, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
adedes

Total Points: 454
Total Questions: 114
Total Answers: 111

Location: Turks and Caicos Islands
Member since Fri, May 8, 2020
4 Years ago
;