linux kernel 编译

1.grab the kernel from kernel.org

wget https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.4.189.tar.gz

2. extract file

tar -xvf linux-4.4.189.tar.gz
cd linux-4.4.189

3. Install the required compilers and other tools
$ sudo apt-get install build-essential libncurses-dev bison flex libssl-dev libelf-dev
4. config part,尝试几种配置的方式

我的理解是,这几种方式,最终目标都是产生.config文件

4. 1 use current host system/使用当前宿主系统的配置

cp -v /boot/config-$(uname -r) .config
编辑.config , 直到符合需求

4. 2 修改.config配置

修改.config的几种方式

4.2.1 修改方式1 - make menuconfig/

Text based color menus, radiolists & dialogs.

make menuconfig

make menuconfig
通过对比make menuconfig前后,代码文件夹的文件变化,得知这个过程其实是编译出了mconf的程序。

4. 2.2 修改方式2-make xconfig/

X windows (Qt) based configuration tool, works best under KDE desktop

make xconfig

试了下,说either install qt4.8 or qt5.x , and make sure it’s in PKG_CONFIG_PATH。
觉得为了试下在UI界面下配置,就装个好大个qt的包,感觉不太值,就没有继续尝试。

4. 2.3 修改配置方式- make gconfig/

X windows (Gtk) based configuration tool, works best under Gnome Dekstop.

make gconfig
5. make

make
在这里插入图片描述

6. Install the Linux kernel modules
$ sudo make modules_install

安装kernel modules 到 /lib/modules ?
在这里插入图片描述
difference between ‘make’ and ‘make modules’:
There is only one difference between make and make modules: the make modules compiles only modules or source code which is set as

obj-CONFIG_OPTION_NAME=m

in the Makefile. If you want just to build Linux kernel, just use make, the make modules already included there.

6.1 build kernel object?

如果是以make kernel module(.ko)为目的,后面的内核是不是不用安装了,而是转向build kernel object?

7. Install the Linux kernel
$ sudo make install

替换当前内核?

参考文献:

https://www.cyberciti.biz/tips/compiling-linux-kernel-26.html
https://stackoverflow.com/questions/33029390/is-it-meaningful-to-execute-make-modules-install-without-executing-make-modul

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值