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
1
$ 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

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

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

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

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

5. make

make
在这里插入图片描述

6. Install the Linux kernel modules
1
$ 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

1
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
1
$ 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