Kernel安裝

版本: Red Hat 7.2

重建相依索引DB

檔案路徑: /lib/modules/${uname -r}/modules.dep

首先安裝kernel最新版本,然後重建相依索引DB

# yum install -y kernel-devel kernel-headers
# depmod -a kernel.3.10.3-57.e17x86_64

注意: 若 depmod 不加版本,只會在當下 kernel 重建DB,因為系統不知道有新版本的存在

重建 initf

# sudo su -
# rpm -qp --scripts http://.../kernel.3.10.3-57.e17x86_64
# dracut
# cd /etc/dracut-conf

檢查有沒有產生 initramfs-3.10.327.e17.x86-64.img

查看 Module

# lsmod
# modinfo <module_name>

加入 Module

# modprobe <module_name>

移除 Module

# modprobe -r <module_name>

範例: insert & eject USB Flash driver

when insert USB Flash driver
# lsmod
      Module        Used
      vfat           1
      fat            1
      usb storage     1
Then eject USB Flash driver
# lsmod
      Module        Used
      vfat           0
      fat            1
      usbstorage     0
# modprobe -r vfat
# modprobe -r 'usb storage'

Blacklisting

Blacklisting, in the context of kernel modules, is a mechanism to prevent the kernel module from loading.

  1. 另開一個 terminal
    # ping 8.8.8.8
    
  2. 原來的 terminal 執行以下指令
    # modinfo r8168
    # modprobe -r r8169
    # modporbe r8168
    
  3. 注意:雖然已經植入 r8168 driver,但是reboot 後還是回到 r8169,因為索引還是只有 r8169,若要讓下次 reboot 可以只找到 r8168,可以建立 Black List,如下:
# cd /etc/modporbe.d
# vim blacklist.conf
      blacklist r8169

results matching ""

    No results matching ""