编译并加载linux-3.13.8的过程
2016-03-31 08:24
471 查看
准备工作:
主机:ubuntu 14.04
说明:在ubuntu系统中可以使用apt代替apt-get使用
downloads linux-3.13.8.tar
sudo cp linux-3.13.8.tar /usr/src
tar xvf linux-3.13.8
cd linux-3.13.8
make mrproper 将残留的.o等文件清空
将原系统/boot/config-*-generic 拷贝到/linux-3.13.8(自己配置则跳过该步)
make menuconfig->load->config-*
/*
*如果第一次使用make menuconfig出现了上边错误
*Unablle to find the ncurses libraries or the requiresheader files
*则输入命令:sudo apt install libncurses5-dev
*/
exit->save (重命名为.config)
ls -a 可以看到存在了.config文件(系统版本和编译的版本差异不宜过大,以免产生不兼容)
=========================================================================
开始编译
make > /dev/null(可以使用j参数设置多核加速编译)
/*将编译链接信息定向到/dev/null,仅在终端打印警告或者错误信息*/
编译成功,在arch/x86_64(自己编译的目录)下生成了一个bzImage文件,另外在根目录下生成了一组文件
====================================================================================
安装模块
开始安装模块make modules_install(省去了以上三个步骤)
成功后在/lib/modules/下会产生一个模块
在/boot目录下会产生三个文件
=====================================================================================
使用grub引导系统进入新内核
添加启动项:
/etc/default/grub中的配置决定了grub.cfg
/etc/default/grub参数如下:
修改上述参数
GRUB_DEFAULT=0//该参数决定了启动的时候默认的内核启动项
GRUB_HIDDEN_TIMEOUT=10//修改系统启动过程等待的时间
修改后执行update-grub,若出现warning,则是因为参数修改时的问题
/*******************************************************************************
*Wait this many seconds before displaying the menu. If<ESC> is *
* pressed during that time, displaythe menu and wait for input *
* according to `GRUB_TIMEOUT'. If ahotkey associated with a menu *
* entry is pressed, boot theassociated menu entry immediately. If *
* the timeout expires before either ofthese happens, display the *
* menu for the number of secondsspecified in `GRUB_TIMEOUT' before*
* booting the default entry. *
* If you set `GRUB_HIDDEN_TIMEOUT',you should also set *
* `GRUB_TIMEOUT=0' so that the menu isnot displayed at all unless *
* <ESC> is pressed. *
* This option is unset by default, andis deprecated in favour of *
* the less confusing`GRUB_TIMEOUT_STYLE=countdown' or *
* `GRUB_TIMEOUT_STYLE=hidden'. *
********************************************************************************/
根据上边的说明知道,必须先将GRUB_TIMEOUT的默认值改成0,然后才能将
GRUB_HIDDEN_TIMEOUT值修改成10,并且执行update-grup不产生警告.
update-grub
打开grub.cfg,可以看到linux-3.13.8模块已经添加
重新启动 ESC进入启动(虚拟机按shift),第二个ubuntu advance可以选择进入编译好的内核
主机:ubuntu 14.04
说明:在ubuntu系统中可以使用apt代替apt-get使用
downloads linux-3.13.8.tar
sudo cp linux-3.13.8.tar /usr/src
tar xvf linux-3.13.8
cd linux-3.13.8
make mrproper 将残留的.o等文件清空
将原系统/boot/config-*-generic 拷贝到/linux-3.13.8(自己配置则跳过该步)
make menuconfig->load->config-*
/*
*如果第一次使用make menuconfig出现了上边错误
*Unablle to find the ncurses libraries or the requiresheader files
*则输入命令:sudo apt install libncurses5-dev
*/
exit->save (重命名为.config)
ls -a 可以看到存在了.config文件(系统版本和编译的版本差异不宜过大,以免产生不兼容)
=========================================================================
开始编译
make > /dev/null(可以使用j参数设置多核加速编译)
/*将编译链接信息定向到/dev/null,仅在终端打印警告或者错误信息*/
编译成功,在arch/x86_64(自己编译的目录)下生成了一个bzImage文件,另外在根目录下生成了一组文件
====================================================================================
安装模块
开始安装模块make modules_install(省去了以上三个步骤)
成功后在/lib/modules/下会产生一个模块
在/boot目录下会产生三个文件
=====================================================================================
使用grub引导系统进入新内核
添加启动项:
/etc/default/grub中的配置决定了grub.cfg
/etc/default/grub参数如下:
修改上述参数
GRUB_DEFAULT=0//该参数决定了启动的时候默认的内核启动项
GRUB_HIDDEN_TIMEOUT=10//修改系统启动过程等待的时间
修改后执行update-grub,若出现warning,则是因为参数修改时的问题
/*******************************************************************************
*Wait this many seconds before displaying the menu. If<ESC> is *
* pressed during that time, displaythe menu and wait for input *
* according to `GRUB_TIMEOUT'. If ahotkey associated with a menu *
* entry is pressed, boot theassociated menu entry immediately. If *
* the timeout expires before either ofthese happens, display the *
* menu for the number of secondsspecified in `GRUB_TIMEOUT' before*
* booting the default entry. *
* If you set `GRUB_HIDDEN_TIMEOUT',you should also set *
* `GRUB_TIMEOUT=0' so that the menu isnot displayed at all unless *
* <ESC> is pressed. *
* This option is unset by default, andis deprecated in favour of *
* the less confusing`GRUB_TIMEOUT_STYLE=countdown' or *
* `GRUB_TIMEOUT_STYLE=hidden'. *
********************************************************************************/
根据上边的说明知道,必须先将GRUB_TIMEOUT的默认值改成0,然后才能将
GRUB_HIDDEN_TIMEOUT值修改成10,并且执行update-grup不产生警告.
update-grub
打开grub.cfg,可以看到linux-3.13.8模块已经添加
重新启动 ESC进入启动(虚拟机按shift),第二个ubuntu advance可以选择进入编译好的内核
相关文章推荐
- git_2-linux
- linux 字符串操作
- linux环境变量
- CentOS引发的MySQL问题
- 做高算踩到的坑
- linux中,某文件的权限是:drw-r--r--,用数值形式表示该权限,则该八进制数为多少?
- 红帽虚拟化RHEV-PXE批量安装RHEV-H
- 实现虚拟机上面的linux系统和windows主机的通信
- Linux 基本命令不能用的解决方法
- Linux五种IO模型性能分析
- Linux下文件重命名、创建、删除、修改及保存文件
- Linux内核分析——第六周学习笔记20135308
- Linux中Python 环境软件包安装步骤
- 微软发布“Ubuntu on Windows” 项目,Linux 程序可原生运行于 Windows 10 中
- Linux 的一些常用命令(不定时更新)
- CentOS7下为Firefox安装、更新、卸载FlashPlayer
- CentOS7下为Eclipse添加快捷菜单
- Linux下定时器的使用
- Linux下配置Mysql允许远程访问
- linux svn服务器配置