linux 内核代码精简
2013-07-19 18:25
375 查看
#为了提高性能,文件系统一般都是以 relatime形式挂载进来的,见:/etc/fstab
#更新一下mtime,这样,编译过程中用到的文件的atime都会被更新
find . -exec touch -m {} \; && touch ../tag
make mrproper && make allnoconfig && make menuconfig
#在allnoconfig的基础下,通过menuconfig加入如下配置,以方便调试
************************************************************
General setup
--Initial RAM filesystem and RAM disk (initramfs/initrd) support
Executable file formats / Enulations
--Kernel support for ELF binaries
Networking support
Kernel hacking
--Kernel debugging
--Compile the kernel with debug info
--Compile the kernel with frame pointers
************************************************************
make #编译,大约需要10分钟
#删除编译过程中没有用到的文件
find . -type f ! -anewer ../tag | grep -v '/\.svn' | xargs rm
#删除所有空目录
loop=found; while [ ! -z $loop ]; do loop=$(find . -type d | grep -v '/\.svn' | while read dirname; do cnt=$(ls $dirname | wc -l); if [ 0 -eq $cnt ]; then rm -rf $dirname; echo -n found; fi; done;); done;
结果上面处理的代码可以再次变量
清理不包含源文件和头文件的目录:
find . -type d | while read dirname; do cnt=`find $dirname -name '*.[cSh]' | wc -l`; if [ 0 -eq $cnt ]; then rm -rf $dirname; fi; done;
#更新一下mtime,这样,编译过程中用到的文件的atime都会被更新
find . -exec touch -m {} \; && touch ../tag
make mrproper && make allnoconfig && make menuconfig
#在allnoconfig的基础下,通过menuconfig加入如下配置,以方便调试
************************************************************
General setup
--Initial RAM filesystem and RAM disk (initramfs/initrd) support
Executable file formats / Enulations
--Kernel support for ELF binaries
Networking support
Kernel hacking
--Kernel debugging
--Compile the kernel with debug info
--Compile the kernel with frame pointers
************************************************************
make #编译,大约需要10分钟
#删除编译过程中没有用到的文件
find . -type f ! -anewer ../tag | grep -v '/\.svn' | xargs rm
#删除所有空目录
loop=found; while [ ! -z $loop ]; do loop=$(find . -type d | grep -v '/\.svn' | while read dirname; do cnt=$(ls $dirname | wc -l); if [ 0 -eq $cnt ]; then rm -rf $dirname; echo -n found; fi; done;); done;
结果上面处理的代码可以再次变量
清理不包含源文件和头文件的目录:
find . -type d | while read dirname; do cnt=`find $dirname -name '*.[cSh]' | wc -l`; if [ 0 -eq $cnt ]; then rm -rf $dirname; fi; done;
相关文章推荐
- linux 内核代码精简
- Linux内核工程导论——如何贡献内核代码
- Linux内核源码分析-链表代码分析
- 一个简单的Linux内核代码整合到一个文件的Java程序
- linux 内核代码构架图
- win7 变WIFI热点 & 在线Linux 内核代码
- 研读linux内核代码--倡议书
- Linux 0.1 版本内核 bootsect.s 代码解析
- 《linux 内核完全剖析》 signal.c 代码分析笔记
- linux内核代码数量增长情况
- linux 内核源代码情景分析——linux 内核源码中的汇编语言代码
- Linux0.11内核--启动引导代码分析bootsect.s
- Linux内核2.6.14源码分析-双向循环链表代码分析(巨详细)
- 使用linux 内核中代码之--list
- linux 内核启动代码解释网站
- 简单谈一点linux内核中套接字的bind机制--2.6.30内核代码的改进
- 嵌入式Linux内核移植相关代码分析
- Linux内核2.6.14源码分析-双向循环链表代码分析
- 为AM335x移植Linux内核主线代码(4)booting-without-of.txt学习笔记上
- linux 内核代码分析1 TI am335x