升级Linux内核的操作已经变得很简单,基本的几个命令即可搞定:make menuconfig、make、make modules、make modules_install、make install。除了这几个常用选项,make命令还有另外的几个选项对于我们也是十分有帮助,在内核源码树目录下执行make help可以看到这些选项,不过下面还是介绍几个我认为比较有用的选项:
1,make V=1,这个选项能显示出编译过程中的详细信息,即是verbose编译模式,在之前的《显示make编译信息》文章里曾介绍过修改makefile来达到这个目的,但make V=1更简单方便,而make V=0或直接make(V=0是默认值)则是quiet编译模式,只会显示出简单的编译信息。
1 | [root@localhost linux-2.6.30]# make V=1 |
2,make dir/:指定编译目标,编译指定的某个目录:
1 | [root@localhost linux-2.6.30]# make drivers/scsi/ |
3,make dir/file.ko:指定编译目标,编译指定的某个模块:
1 | [root@localhost linux-2.6.30]# make drivers/net/igb/igb.ko |
4,make dir/file.[ois]:指定编译目标,编译指定的某个文件为目标文件、头文件展开文件、汇编文件:
1 2 3 | [root@localhost linux-2.6.30]# make drivers/net/igb/igb_main.o [root@localhost linux-2.6.30]# make drivers/net/igb/igb_main.i [root@localhost linux-2.6.30]# make drivers/net/igb/igb_main.s |
5,make checkstack:函数栈静态检查
6,make includecheck:头文件重复静态检查
最后看下命令make help执行的显示信息:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | [root@localhost linux-2.6.30]# make help Cleaning targets: clean - Remove most generated files but keep the config and enough build support to build external modules mrproper - Remove all generated files + config + various backup files distclean - mrproper + remove editor backup and patch files Configuration targets: config - Update current config utilising a line-oriented program menuconfig - Update current config utilising a menu based program xconfig - Update current config utilising a QT based front-end gconfig - Update current config utilising a GTK based front-end oldconfig - Update current config utilising a provided .config as base silentoldconfig - Same as oldconfig, but quietly randconfig - New config with random answer to all options defconfig - New config with default answer to all options allmodconfig - New config selecting modules when possible allyesconfig - New config where all options are accepted with yes allnoconfig - New config where all options are answered with no Other generic targets: all - Build all targets marked with [*] * vmlinux - Build the bare kernel * modules - Build all modules modules_install - Install all modules to INSTALL_MOD_PATH ( default : /) firmware_install- Install all firmware to INSTALL_FW_PATH ( default : $(INSTALL_MOD_PATH)/lib/firmware) dir/ - Build all files in dir and below dir/file.[ois] - Build specified target only dir/file.ko - Build module including final link modules_prepare - Set up for building external modules tags/TAGS - Generate tags file for editors cscope - Generate cscope index kernelrelease - Output the release version string kernelversion - Output the version stored in Makefile headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH ( default : /usr/src/linux-2.6.30/usr) Static analysers checkstack - Generate a list of stack hogs namespacecheck - Name space analysis on compiled kernel versioncheck - Sanity check on version.h usage includecheck - Check for duplicate included header files export_report - List the usages of all exported symbols headers_check - Sanity check on exported headers headerdep - Detect inclusion cycles in headers Kernel packaging: rpm-pkg - Build both source and binary RPM kernel packages binrpm-pkg - Build only the binary kernel package deb-pkg - Build the kernel as an deb package tar-pkg - Build the kernel as an uncompressed tarball targz-pkg - Build the kernel as a gzip compressed tarball tarbz2-pkg - Build the kernel as a bzip2 compressed tarball Documentation targets: Linux kernel internal documentation in different formats: htmldocs - HTML pdfdocs - PDF psdocs - Postscript xmldocs - XML DocBook mandocs - man pages installmandocs - install man pages generated by mandocs cleandocs - clean all generated DocBook files Architecture specific targets (x86): * bzImage - Compressed kernel image (arch/x86/boot/bzImage) install - Install kernel using (your) ~/bin/installkernel or (distribution) /sbin/installkernel or install to $(INSTALL_PATH) and run lilo fdimage - Create 1.4MB boot floppy image (arch/x86/boot/fdimage) fdimage144 - Create 1.4MB boot floppy image (arch/x86/boot/fdimage) fdimage288 - Create 2.8MB boot floppy image (arch/x86/boot/fdimage) isoimage - Create a boot CD-ROM image (arch/x86/boot/image.iso) bzdisk/fdimage*/isoimage also accept: FDARGS= "..." arguments for the booted kernel FDINITRD=file initrd for the booted kernel i386_defconfig - Build for i386 x86_64_defconfig - Build for x86_64 make V=0|1 [targets] 0 => quiet build ( default ), 1 => verbose build make V=2 [targets] 2 => give reason for rebuild of target make O=dir [targets] Locate all output files in "dir" , including .config make C=1 [targets] Check all c source with $CHECK (sparse by default ) make C=2 [targets] Force check of all c source with $CHECK Execute "make" or "make all" to build all targets marked with [*] For further info see the ./README file [root@localhost linux-2.6.30]# |