-3

Can any one here help me with the steps to compile a Linux kernel in my Ubuntu virtual Machine with a step by step procedure?

I want to customize the kernel too.

1

One can build the default Ubuntu kernels easily using the follow two methods.

  1. To build a Xenial kernel:

Install tools:

sudo apt-get build-dep linux
sudo apt-get install build-essential fakeroot kernel-wedge

Clone the kernel source:

git clone https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/xenial

Build the kernel:

cd xenial
fakeroot debian/rules clean
debian/rules build
fakeroot debian/rules binary-headers binary-generic

(as a kernel team developer I use the above to build kernels for my development work).

  1. One can build mainstream kernels for Ubuntu quite easily:

Install tools:

sudo apt-get build-dep linux
sudo apt-get install build-essential fakeroot kernel-wedge

Clone the linux repo:

git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
cd linux

Copy a Ubuntu config file from /boot to the linux source, the follow uses your current kernel config:

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

And build the kernel deb packages:

make deb-pkg INSTALL_MOD_STRIP=1 -j $(nproc)
|improve this answer|||||
  • For the mainline git method there were a bunch of make file changes as of kernel 4.3 and I had to change make deb-pkg ... to make bindeb-pkg.... I'm not familiar with the INSTALL_MOD_STRIP=1 option. See also here. – Doug Smythies Dec 31 '16 at 18:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.