Linux --编译kernel

1. download the kernel package that you want to install .

2. unzip the package to the path that has enough space :use command ("df -h /usr/local ")to check the space;

3.check the kernel :uname -r

4.go to /usr/local/kernel ...

  cp /boot/config$kernel .config   复制现在的kernel 的文件到当前的需要安装的kernel包的路径下,并且改名为.config

5.make menuconfig 

[root@localhost linux-5.9.10]# make menuconfig
  HOSTCC  scripts/basic/fixdep
  UPD     scripts/kconfig/mconf-cfg
  HOSTCC  scripts/kconfig/mconf.o
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
  HOSTCC  scripts/kconfig/lxdialog/util.o
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/mconf
scripts/kconfig/mconf  Kconfig
configuration written to .config

*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

 

就会出现下图的配置:

 

 7.go to the "Genernal setup "可以在标黄的地方改名;再退出

 

 8. 找到file system

 

 9.go to DOS/FAT/EXFAT/NT filesystems-----

 

 10 到NTFS files system support 的位置输入"M",NTFS write support (NEW )输入y 

 

 通过以上菜单,就是修改config文件中的内容:

[root@localhost linux-5.9.10]# grep -i ntfs .config
CONFIG_NTFS_FS=m
# CONFIG_NTFS_DEBUG is not set
CONFIG_NTFS_RW=y

最后开始编译:

make -j 8

编译完成后安装模块

sudo make modules_install

安装内核相关

make install 

此时到/boot 的路径下check,已经有vmlinuz 和initramfs的文件

[root@localhost src]# cd /boot
[root@localhost boot]# ls
System.map
System.map-4.18.0-193.el8.x86_64
System.map-5.9.10x86_5.9.10_debug
config-4.18.0-193.el8.x86_64
efi
extlinux
grub2
initramfs-4.18.0-193.el8.x86_64.img
initramfs-4.18.0-193.el8.x86_64kdump.img
initramfs-5.9.10x86_5.9.10_debug.img
loader
vmlinuz
vmlinuz-0-rescue-203f6b7975c648658a1e9b53121d0eab
vmlinuz-4.18.0-193.el8.x86_64
vmlinuz-5.9.10x86_5.9.10_debug

然后在 /boot/efi/EFI/centos/grubenv 中可以check到我们新安装的kernel。

重启吧~~

 

posted @ 2020-11-27 10:14  正霜霜儿  阅读(276)  评论(0编辑  收藏  举报