# Ubuntu – How to compile a kernel identical to apt-get install linux-image-xxx

compilingdriversgitkernelversions

I download kernel source from git://kernel.ubuntu.com/…/ubuntu/ubuntu-trusty.git. I need to compile version 4.4.0-31-generic on 14.04.4 lts 64bit, so I clone and checkout branch Ubuntu-lts-4.4.0-31.50-xxx-14.04.1.I use config-4.4.0-31-generic as config file from linux-image-4.4.0-31-generic package. After I compiled, I realize kernel version is 4.4.13 in Makefile and I found arbitrary kernel version config item seems not take effect and installed modules is more than 5000 but package in linux-image-4.4.0-31-generic just contain about 1000 modules. The modules I installed size is around 3G, the package just 39M. Am I did it a wrong way?

fakeroot debian/rules clean