我的许多模块缺少 /sys/module/*/parameters 目录,我无法检查模块加载的参数。
# printf "%s\n" /sys/module/*/parameters | wc -l
125
# lsmod | wc -l
151
# comm -13 <(printf "%s\n" /sys/module/*/parameters | xargs dirname | xargs basename -a | sort) <(lsmod | awk '{print $1}' | sort) | fmt
Module aesni_intel at24 blake2b_generic bpf_preload btbcm btintel
btmtk btrfs btrtl crc16 crc32_pclmul crc32c_generic crc32c_intel
crct10dif_pclmul cryptd crypto_simd crypto_user dummy ecdh_generic fat
gf128mul ghash_clmulni_intel i2c_smbus iTCO_vendor_support iTCO_wdt
intel_cstate intel_pmc_bxt intel_rapl_common intel_rapl_msr intel_uncore
ip6_tables ip6t_REJECT ip6table_filter ip6table_mangle ip6table_nat
ip6table_raw ip_tables ipt_REJECT …Run Code Online (Sandbox Code Playgroud) 我知道您可以编写自定义 udev 规则来在 /dev 目录中创建符号链接。
但是 /dev 中的符号链接有什么用呢?
符号链接链接到什么?
我知道您可以与 /dev 目录中的常规链接进行交互,但不了解符号链接的作用。
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0461", ATTRS{idProduct}=="4d81", SYMLINK+="myusb"
我在 Arch 启动时不断收到与我有关的错误rc.conf:
failed to load module "wl"
failed to load module "lib80211"
Run Code Online (Sandbox Code Playgroud)
等。它列出了我的所有模块 /etc/rc.conf
这是我的完整内容rc.conf:
#
# /etc/rc.conf - configuration file for initscripts
#
DAEMONS=(syslog-ng dbus networkmanager crond .. etc. ..)
MODULES=(... wl... lib80211... nvidia-bl... openntpd... slim... acpid... pommed)
# Storage
#
# USEDMRAID="no"
# USELVM="no"
# Network
#
# interface=
# address=
# netmask=
# gateway=
HARDWARECLOCK="UTC-5"
TIMEZONE="US/Central"
Run Code Online (Sandbox Code Playgroud)
当我notcied这个pommed失败的X启动时,我说sudo pommed &我的xinitrc。
配置文件格式是否正确?
我正在尝试将 kexec 构建为一个模块,但遇到了一个奇怪的问题。我的 obj-m 是:
obj-m += kexec.o machine_kexec.o relocate_kernel.o
当我运行 makefile 时,它抱怨说“没有规则可以制作 relocate_kernel.o 需要的目标 relocate_kernel.c”
我应该如何告诉它包含程序集文件?我查看了内核 Makefile,虽然我对它们不是很好,但似乎确实存在 .S > .o 的规则。我错了吗?
我没有构建内核模块的经验。更糟糕的是,我正在尝试在 ChrUbuntu 上执行此操作,因此我似乎无法遵循现有的 Ubuntu 指南。例如,此命令失败:
# apt-get install linux-headers-$(uname -r)
Run Code Online (Sandbox Code Playgroud)
因为 ChrUbuntu 内核是 3.4.0 版,并且没有该版本的 Ubuntu 存储库 (afaik)。
uname -a
Linux ChrUbuntu 3.4.0 #1 SMP Sun Aug 26 19:17:55 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud)
以下是我看过的一些参考资料:
在 Debian 中,当我想编译我的内核模块时,我需要安装linux-header-*软件包,然后我需要编写makefile如下代码:
obj-m := hello.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
Run Code Online (Sandbox Code Playgroud)
但是现在我已经从 kernel.org 下载了特定的 kenel 并编译它。那么我怎样才能解决我的KDIR变量makefile?
我想知道,Debian 维护者如何创建linux-header-*软件包?
我正在尝试编译一个 Linux 内核来调试我在 Arch Linux 上遇到的问题,并且我正在配置模块,但是我不知道很多东西是什么,所以我把它们留在了。
如果这个内核可以工作,我打算保留它,但是所有这些额外的模块会减慢系统速度还是仅在需要时加载?
我需要应用以下补丁,而且我不想弄乱我目前拥有的东西。下面我把我在网上找到的完整内容贴出来,这是某人对与我类似的问题的回答。
在 2007 年 3 月 20 日星期二 14:32 -0500,James Bottomley 写道:
MODULE 是否设置为“n”?看起来符号导出
#ifdef MODULE出于某种原因受到保护......除此之外 ,我无法解释这一点。事实上,这就是错误......模块化配置是MODULES而不是MODULE。你能试试这个吗:
---
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 0949145..a67f315 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -181,10 +181,8 @@ int scsi_complete_async_scans(void)
return 0;
}
-#ifdef MODULE
/* Only exported for the benefit of scsi_wait_scan */
EXPORT_SYMBOL_GPL(scsi_complete_async_scans);
-#endif
/**
* scsi_unlock_floptical - unlock device via a special MODE SENSE command
Run Code Online (Sandbox Code Playgroud)
我在网上找到了上面的代码作为我遇到的问题的解决方案。我正在尝试为我自己的内核构建模块。我的问题是如何应用上述补丁?我想我必须在一个我可以看到的目录中/drivers,对吗?请问之后我该怎么办?
这是当我发出“make modules”来构建我的内核和相关的设备驱动程序时得到的错误:
sansari@ubuntu:~/WORKING_DIRECTORY$ make modules
scripts/kconfig/conf --silentoldconfig Kconfig …Run Code Online (Sandbox Code Playgroud) MODULE_FIRMWARE(filename)Linux内核模块中的宏有什么用?
当运行 modprobe 将模块插入内核时,我得到以下信息:
# modprobe 8192cu
FATAL: Error inserting 8192cu (/lib/modules/3.8.13-118.2.1.el6uek.x86_64/kernel/drivers/net/wireless/8192.cu.ko): Device or resource busy
Run Code Online (Sandbox Code Playgroud)
这在设备插入和未插入时都会发生。这也可能与我在尝试重新安装驱动程序时看到的其他错误有关:
# rmmod 8192.cu.ko
ERROR: Module 8192cu does not exist in /proc/modules
# insmod 8192.cu.ko
insmod: error inserting `8192cu.ko`: -1 Device or resource busy
Run Code Online (Sandbox Code Playgroud)
最奇怪的是,该设备甚至没有插入。它一直运行良好,直到我的 Oracle Linux(基于 Red Hat Enterprise Linux 6)重新启动。
我应该如何重新安装驱动程序并确保它正常工作?
# dmesg
rtl8192cu driver version=v4.0.2_9000.20130911
build time: Dec 2 2015 15:05:23
Error: Driver 'rtl8192cu' is already registered, aborting...
Run Code Online (Sandbox Code Playgroud) kernel-modules ×10
drivers ×4
kernel ×3
linux ×3
linux-kernel ×2
make ×2
arch-linux ×1
assembly ×1
compiling ×1
debian ×1
devices ×1
modprobe ×1
oracle-linux ×1
patch ×1
performance ×1
rhel ×1
ubuntu ×1
udev ×1
x-server ×1