在上一篇博客:在Ubuntu上编译特定版本的Linux Kernel_蛐蛐蛐的博客-优快云博客中,我介绍了编译Linux Kernel源码的基本过程,但是如果按照menuconfig默认选项来编译的话,生成的binary file个数很少,明显和源码的规模不符。那怎么编译其中的所有源码呢?这里有朋友进行了解释:
How to make all features compile to modules in kernel compilation? - Stack Overflow
也就是说,首先执行:
make allmodconfig
再执行:
sudo make -j 10
这样生成的.o和.ko文件会多很多,那么我们相应地改一下上篇博客中提到的python代码:
import os
import shutil
for dirpath, dirnames, filenames in os.walk('linux'):
for each_file in filenames:
if(each_file.endswith('.o') or each_file.endswith('.ko') ):
path=os.path.join(dirpath,each_file)
shutil.copyfile(path, 'linux-binaries/'+each_file)
一共有三万多个binary,这样算下来应该有超过60万个function,这个数字是差不多靠谱的。就简单总结这么多。