Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clean only selected modules before building linux kernel

I have a situation here where I need to build same kernel against different configs. Now I was trying to build the kernel without doing a make clean but this gives me problem. There is possibility that one config has some drivers as built in and other may have same drive as a module. In my case, I want to avoid make clean to save time! Compiling a fresh kernel takes allot time and since, I've compiled the same kernel before with only few driver/modules changed, I would like to know any alternate option than cleaning the whole kernel.

Thanks!

like image 272
Vinay Tiwary Avatar asked Nov 15 '25 09:11

Vinay Tiwary


2 Answers

You don’t have to rebuild the complete kernel if you are just working on a few modules. However, if your module requires changes to .config then do the steps below everytime to get a module built for a specific .config

modify/copy the .config as per the requirement into the src dir
make prepare
make scripts
make modules_prepare
make M=drivers/<some driver>
make M=drivers/<some driver> clean
like image 166
askb Avatar answered Nov 18 '25 21:11

askb


Lets say you just want to compile wireless module only. Now its files are under Linux_kernel/net/wireless folder

to compile only wireless modules.

cd Linux_kernel
make ARCH=arm modules M=$(pwd)/net/wireless/

It will generate two modules

Linux_kernel/net/wireless/cfg80211.ko

Linux_kernel/net/wireless/lib80211.ko

Now to clean these module

make ARCH=arm modules M=$(pwd)/net/wireless/ clean
like image 23
Jeegar Patel Avatar answered Nov 18 '25 20:11

Jeegar Patel