linuxhh 2020-01-08
下载源码,然后转到源码目录(或者新建一个目录,在该目录下运行make?-C?/usr/src/linux?O=`pwd`); ?????将当前运行内核的config文件拷过来(位置在/boot?目录下,config*等文件),重命名为.config; ????在编译内核之前,需要确认.config中,以下编译选项是否打开: ????(1)CONFIG_DEBUG_INFO?,必须打开该选项,否则crash会出现以下错误: ?????????????crash?no?debugging?data?available ????(2)CONFIG_STRICT_DEVMEM,必须打开该选项,否则crash会出现以下错误: ??????????????crash:?read?error:?kernel?virtual?address:?c0670680??type:?"kernel_config_data" ??????????????WARNING:?cannot?read?kernel_config_data ??????????????crash:?read?error:?kernel?virtual?address:?c066bb68??type:?"cpu_possible_mask" ?????设置完毕,开始编译,依次运行如下命令: ?????(1)?make?bzImage ?????(2)?make?modules ?????(3)?make?modules_install ?????(4)?make?install?(运行该命令后,会在/boot目录下生成我们自己的vmlinuz) 4.??生成initrd ???????转到/boot?目录下,运行update-initramfs?-c?-k?[version]?,如我编译的内核为2.6.38.6,则生成的 vmlinuz为vmlinuz-2.6.38.6,?运行update-initramfs?-c?-k?2.6.38.6生成的为initrd.img-2.6.38.6;