2016年7月18日 星期一

compile kernel with minimum modules

Use the option localmodconfig to minize the modules.
But any change in hardware will make it need to be compiled again.
# get linux kernel source code
$ wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.15.tar.xz
$ tar -xvf linux-4.4.15.tar.xz
$ cd linux-4.4.15
$ make mrproper
$ cp /boot/config-$(uname -r) .config
$ make oldconfig
$ make localmodconfig
# compile kernel. revision is the tag you can customize. -j4 means using 4 threads
$ sudo fakeroot make-kpkg --initrd --revision=4.4.localmodconfig kernel_image kernel_headers -j4
# wait for a while

# you will find linux-headers-4.4.15_4.4.localmodconfig_amd64.deb and linux-image-4.4.15_4.4.localmodconfig_amd64.deb outside
$ ls ../linux*
# install them
$sudo dpkg -i ../linux*localmodconfig_amd64.deb

沒有留言:

張貼留言