LoginSignup
30
36

More than 5 years have passed since last update.

[Linux][kernel] カーネルモジュールの情報を確認する方法まとめ

Last updated at Posted at 2016-01-28

built-in kernel moduleloadable Kernel Module の確認方法

built-in kernel modules

built-in kernel modulesの一覧を確認

組み込みカーネルモジュールの一覧を確認
$ cat /lib/modules/$(uname -r)/modules.builtin

built-in kernel moduleのパラメータを確認

/sys/module/<module_name>/parameters/* にて確認できる。

例「bluetooth」
$ ls /sys/module/bluetooth/parameters
disable_ertm  disable_esco  enable_hs

$ cat /sys/module/bluetooth/parameters/*
N
N
N

有効なカーネルコンフィグを確認

$ grep "=y" /boot/config-$(uname -r) | less

TODO:
/boot/config-$(uname -r) のファイルが作られない場合がある。KConfigの設定で有効にする?

参考

loadable Kernel Module

依存関係情報は /lib/modules/$(uname -r)/modules.dep に記載されている。

1. 有効な loadable Kernel Module を確認

# 有効な全モジュールと依存関係を表示
$ lsmod

or 

# 指定したモジュールの情報を表示
$ modinfo <module_name>
modinfo実行例
$ modinfo bluetooth
filename:       /lib/modules/3.8.0-44-generic/kernel/net/bluetooth/bluetooth.ko
alias:          net-pf-31
license:        GPL
version:        2.16
description:    Bluetooth Core ver 2.16
author:         Marcel Holtmann <marcel@holtmann.org>
srcversion:     69F404CC8C537406DC6169A
depends:
intree:         Y
vermagic:       3.8.0-44-generic SMP mod_unload modversions
parm:           disable_esco:Disable eSCO connection creation (bool)
parm:           disable_ertm:Disable enhanced retransmission mode (bool)
parm:           enable_hs:Enable High Speed support (bool)

2. loadable Kernel Module のロード

# モジュールのロード(依存関係を考慮する)
# /lib/modules/$(uname -r)/kernel/drivers 以下から <module_name> を読み込み
$ modprobe <module_name>

or

# モジュールのロード(依存関係は考慮しない)
$ insmod <module_name>

3. loadable Kernel Module のアンロード

# モジュールのアンロード(依存するモジュールもアンロードを行う)
$ modprobe -r <module_name>

or

# モジュールのアンロード(依存関係は考慮しない)
$ rmmod <module_name>

# モジュールのアンロード(依存するモジュールもアンロードを行う)
$ rmmod -r <module_name>

関連

Device Tree についてのまとめ - Qiita
カーネルモジュールのコンソールへのログ出力抑制(printkのログレベル変更) - Qiita

参考

How to find information about built-in kernel modules on Linux - Ask Xmodulo
Linux ローダブル・カーネル・モジュールの徹底調査
Linuxカーネルモジュールの管理について | OpenGroove
カーネルモジュール - ArchWiki
1.カーネルとカーネルモジュール(第1章カーネル:基本管理コースII)
kernel - What's the difference between insmod and modprobe? - Ask Ubuntu
Linuxドライバのはなし|Wireless・のおと|サイレックス・テクノロジー株式会社

30
36
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
30
36