天天看点

【Linux 内核】编译 Linux 内核 ⑦ ( 安装内核模块 | 安装内核 | 重启系统 | 查看当前内核版本 )

文章目录

  • 一、安装内核模块
  • 二、安装内核
  • 三、重启系统
  • 四、查看当前内核版本

一、安装内核模块

确保 Linux 内核编译完成 , 没有任何报错之后 ; 参考 【Linux 内核】编译 Linux 内核 ⑥ ( 安装 OpenSSL | 安装其它依赖库 | 内核编译完成 ) 博客 ;

进入 Linux 内核源码的根目录 , 执行

sudo make modules_install
           

命令 , 安装编译好的内核模块 ;

【Linux 内核】编译 Linux 内核 ⑦ ( 安装内核模块 | 安装内核 | 重启系统 | 查看当前内核版本 )

安装成功后命令行最后一页内容 :

【Linux 内核】编译 Linux 内核 ⑦ ( 安装内核模块 | 安装内核 | 重启系统 | 查看当前内核版本 )

完整过程如下 :

root@ubuntu:~# cd kernel/
root@ubuntu:~/kernel# cd linux-5.6.14
root@ubuntu:~/kernel/linux-5.6.14# 
root@ubuntu:~/kernel/linux-5.6.14# 
root@ubuntu:~/kernel/linux-5.6.14# ls
arch   COPYING  Documentation  include  Kbuild   lib          Makefile         modules.builtin.modinfo  net      scripts   System.map  virt            vmlinux.o
block  CREDITS  drivers        init     Kconfig  LICENSES     mm               modules.order            README   security  tools       vmlinux
certs  crypto   fs             ipc      kernel   MAINTAINERS  modules.builtin  Module.symvers           samples  sound     usr         vmlinux-gdb.py
root@ubuntu:~/kernel/linux-5.6.14# 
root@ubuntu:~/kernel/linux-5.6.14# 
root@ubuntu:~/kernel/linux-5.6.14# sudo make modules_install
  INSTALL arch/x86/crypto/aesni-intel.ko
  INSTALL arch/x86/crypto/blowfish-x86_64.ko
  INSTALL arch/x86/crypto/camellia-aesni-avx-x86_64.ko
  INSTALL arch/x86/crypto/camellia-aesni-avx2.ko
  INSTALL arch/x86/crypto/camellia-x86_64.ko
  INSTALL arch/x86/crypto/cast5-avx-x86_64.ko
  INSTALL arch/x86/crypto/cast6-avx-x86_64.ko
  INSTALL arch/x86/crypto/chacha-x86_64.ko
  INSTALL arch/x86/crypto/crc32-pclmul.ko
  INSTALL arch/x86/crypto/crct10dif-pclmul.ko
  INSTALL arch/x86/crypto/des3_ede-x86_64.ko
  INSTALL arch/x86/crypto/ghash-clmulni-intel.ko
  INSTALL arch/x86/crypto/glue_helper.ko
  INSTALL arch/x86/crypto/poly1305-x86_64.ko
  INSTALL arch/x86/crypto/serpent-avx-x86_64.ko
  INSTALL arch/x86/crypto/serpent-avx2.ko
  INSTALL arch/x86/crypto/serpent-sse2-x86_64.ko
  INSTALL arch/x86/crypto/sha1-ssse3.ko
  INSTALL arch/x86/crypto/sha256-ssse3.ko
  INSTALL arch/x86/crypto/sha512-ssse3.ko
  INSTALL arch/x86/crypto/twofish-avx-x86_64.ko
  INSTALL arch/x86/crypto/twofish-x86_64-3way.ko
  INSTALL arch/x86/crypto/twofish-x86_64.ko
  INSTALL arch/x86/events/intel/intel-cstate.ko
  INSTALL arch/x86/events/intel/intel-rapl-perf.ko
  INSTALL arch/x86/kernel/cpu/mce/mce-inject.ko
  INSTALL arch/x86/kernel/cpuid.ko
  INSTALL arch/x86/kernel/msr.ko
  INSTALL arch/x86/kvm/kvm-amd.ko
  INSTALL arch/x86/kvm/kvm-intel.ko
  INSTALL arch/x86/kvm/kvm.ko
  INSTALL arch/x86/oprofile/oprofile.ko
  INSTALL arch/x86/platform/atom/punit_atom_debug.ko
  INSTALL block/bfq.ko
  INSTALL block/kyber-iosched.ko
  INSTALL crypto/842.ko
  INSTALL crypto/aes_ti.ko
  INSTALL crypto/af_alg.ko
  INSTALL crypto/algif_aead.ko
  INSTALL crypto/algif_hash.ko
  INSTALL crypto/algif_rng.ko
  INSTALL crypto/algif_skcipher.ko
  INSTALL crypto/ansi_cprng.ko
  INSTALL crypto/anubis.ko
  INSTALL crypto/arc4.ko
  INSTALL crypto/asymmetric_keys/pkcs7_test_key.ko
  INSTALL crypto/async_tx/async_memcpy.ko
  INSTALL crypto/async_tx/async_pq.ko
  INSTALL crypto/async_tx/async_raid6_recov.ko
  INSTALL crypto/async_tx/async_tx.ko
  INSTALL crypto/async_tx/async_xor.ko
  INSTALL crypto/authenc.ko
  INSTALL crypto/authencesn.ko
  INSTALL crypto/blake2b_generic.ko
  INSTALL crypto/blowfish_common.ko
  INSTALL crypto/blowfish_generic.ko
  INSTALL crypto/camellia_generic.ko
  INSTALL crypto/cast5_generic.ko
  INSTALL crypto/cast6_generic.ko
  INSTALL crypto/cast_common.ko
  INSTALL crypto/ccm.ko
  INSTALL crypto/chacha20poly1305.ko
  INSTALL crypto/chacha_generic.ko
  INSTALL crypto/cmac.ko
  INSTALL crypto/crc32_generic.ko
  INSTALL crypto/cryptd.ko
  INSTALL crypto/crypto_engine.ko
  INSTALL crypto/crypto_simd.ko
  INSTALL crypto/crypto_user.ko
  INSTALL crypto/des_generic.ko
  INSTALL crypto/ecc.ko
  INSTALL crypto/ecdh_generic.ko
  INSTALL crypto/echainiv.ko
  INSTALL crypto/essiv.ko
  INSTALL crypto/fcrypt.ko
  INSTALL crypto/keywrap.ko
  INSTALL crypto/khazad.ko
  INSTALL crypto/lrw.ko
  INSTALL crypto/lz4.ko
  INSTALL crypto/lz4hc.ko
  INSTALL crypto/md4.ko
  INSTALL crypto/michael_mic.ko
  INSTALL crypto/pcbc.ko
  INSTALL crypto/pcrypt.ko
  INSTALL crypto/poly1305_generic.ko
  INSTALL crypto/rmd128.ko
  INSTALL crypto/rmd160.ko
  INSTALL crypto/rmd256.ko
  INSTALL crypto/rmd320.ko
  INSTALL crypto/salsa20_generic.ko
  INSTALL crypto/seed.ko
  INSTALL crypto/serpent_generic.ko
  INSTALL crypto/sha3_generic.ko
  INSTALL crypto/tcrypt.ko
  INSTALL crypto/tea.ko
  INSTALL crypto/tgr192.ko
  INSTALL crypto/twofish_common.ko
  INSTALL crypto/twofish_generic.ko
  INSTALL crypto/vmac.ko
  INSTALL crypto/wp512.ko
  INSTALL crypto/xcbc.ko
  INSTALL crypto/xor.ko
  INSTALL crypto/xxhash_generic.ko
  INSTALL crypto/zstd.ko
  INSTALL drivers/acpi/acpi_configfs.ko
  INSTALL drivers/acpi/acpi_extlog.ko
  INSTALL drivers/acpi/acpi_ipmi.ko
  INSTALL drivers/acpi/acpi_pad.ko
  INSTALL drivers/acpi/apei/einj.ko
  INSTALL drivers/acpi/dptf/dptf_power.ko
  INSTALL drivers/acpi/ec_sys.ko
  INSTALL drivers/acpi/nfit/nfit.ko
  INSTALL drivers/acpi/sbs.ko
  INSTALL drivers/acpi/sbshc.ko
  INSTALL drivers/acpi/video.ko
  INSTALL drivers/ata/acard-ahci.ko
  INSTALL drivers/ata/ahci.ko
  # 省略5000 行
  INSTALL sound/usb/line6/snd-usb-toneport.ko
  INSTALL sound/usb/line6/snd-usb-variax.ko
  INSTALL sound/usb/misc/snd-ua101.ko
  INSTALL sound/usb/snd-usb-audio.ko
  INSTALL sound/usb/snd-usbmidi-lib.ko
  INSTALL sound/usb/usx2y/snd-usb-us122l.ko
  INSTALL sound/usb/usx2y/snd-usb-usx2y.ko
  INSTALL sound/x86/snd-hdmi-lpe-audio.ko
  INSTALL virt/lib/irqbypass.ko
  DEPMOD  5.6.14
root@ubuntu:~/kernel/linux-5.6.14# 
root@ubuntu:~/kernel/linux-5.6.14# 
           

二、安装内核

内核模块安装完成后 , 执行

sudo make install
           

命令 , 安装内核 ;

下面的内核安装过程会持续很长时间 ;

【Linux 内核】编译 Linux 内核 ⑦ ( 安装内核模块 | 安装内核 | 重启系统 | 查看当前内核版本 )

内核安装过程 :

root@ubuntu:~# cd kernel/linux-5.6.14
root@ubuntu:~/kernel/linux-5.6.14# 
root@ubuntu:~/kernel/linux-5.6.14# sudo make install
sh ./arch/x86/boot/install.sh 5.6.14 arch/x86/boot/bzImage \
	System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 5.6.14 /boot/vmlinuz-5.6.14
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.6.14 /boot/vmlinuz-5.6.14
update-initramfs: Generating /boot/initrd.img-5.6.14
run-parts: executing /etc/kernel/postinst.d/pm-utils 5.6.14 /boot/vmlinuz-5.6.14
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 5.6.14 /boot/vmlinuz-5.6.14
run-parts: executing /etc/kernel/postinst.d/update-notifier 5.6.14 /boot/vmlinuz-5.6.14
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 5.6.14 /boot/vmlinuz-5.6.14
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-5.6.14
Found initrd image: /boot/initrd.img-5.6.14
Found linux image: /boot/vmlinuz-4.15.0-142-generic
Found initrd image: /boot/initrd.img-4.15.0-142-generic
Found linux image: /boot/vmlinuz-4.13.0-36-generic
Found initrd image: /boot/initrd.img-4.13.0-36-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done
root@ubuntu:~/kernel/linux-5.6.14# 
           
【Linux 内核】编译 Linux 内核 ⑦ ( 安装内核模块 | 安装内核 | 重启系统 | 查看当前内核版本 )

三、重启系统

执行

reboot
           

命令 , 重启 Ubuntu 操作系统 ;

四、查看当前内核版本

uname -a
           

继续阅读