当前位置:网站首页>Compile kernel modules separately
Compile kernel modules separately
2022-07-05 12:51:00 【Li-Yongjun】
Preface
When developing and debugging a kernel module , If the kernel is compiled as a whole , That's too inefficient . We usually compile separately .
step 1
Copy kernel module to workspace, Driven by Intel Ethernet card drivers/net/ethernet/intel/
For example
cp linux-5.13/drivers/net/ethernet/intel/ ./ -rf
step 2
rewrite Makefile
original
# SPDX-License-Identifier: GPL-2.0
#
# Makefile for the Intel network device drivers.
#
obj-$(CONFIG_E100) += e100.o
obj-$(CONFIG_E1000) += e1000/
obj-$(CONFIG_E1000E) += e1000e/
obj-$(CONFIG_IGB) += igb/
obj-$(CONFIG_IGC) += igc/
obj-$(CONFIG_IGBVF) += igbvf/
obj-$(CONFIG_IXGBE) += ixgbe/
obj-$(CONFIG_IXGBEVF) += ixgbevf/
obj-$(CONFIG_I40E) += i40e/
obj-$(CONFIG_IXGB) += ixgb/
obj-$(CONFIG_IAVF) += iavf/
obj-$(CONFIG_FM10K) += fm10k/
obj-$(CONFIG_ICE) += ice/
After rewriting
# SPDX-License-Identifier: GPL-2.0
#
# Makefile for the Intel network device drivers.
#
obj-m += e100.o
obj-m += e1000/
#obj-$(CONFIG_E1000E) += e1000e/
#obj-$(CONFIG_IGB) += igb/
#obj-$(CONFIG_IGC) += igc/
#obj-$(CONFIG_IGBVF) += igbvf/
#obj-$(CONFIG_IXGBE) += ixgbe/
#obj-$(CONFIG_IXGBEVF) += ixgbevf/
#obj-$(CONFIG_I40E) += i40e/
#obj-$(CONFIG_IXGB) += ixgb/
#obj-$(CONFIG_IAVF) += iavf/
#obj-$(CONFIG_FM10K) += fm10k/
#obj-$(CONFIG_ICE) += ice/
KDIR=/lib/modules/$(shell uname -r)/build
DIRS := . $(shell find -type d)
GARBAGE_PATTERNS := *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions *.mod *.order *.symvers
GARBAGE := $(foreach DIR,$(DIRS),$(addprefix $(DIR)/,$(GARBAGE_PATTERNS)))
all:
$(MAKE) -C $(KDIR) M=$(shell pwd) modules
clean:
rm -rf $(GARBAGE)
Comment out unnecessary modules , Add the required modules to obj-m.
OK
边栏推荐
- Preliminary exploration of basic knowledge of MySQL
- JDBC -- use JDBC connection to operate MySQL database
- Distributed solution - completely solve website cross domain requests
- Common commands and basic operations of Apache Phoenix
- Reshape the power of multi cloud products with VMware innovation
- #yyds干货盘点#js截取文件后缀名
- Taobao order amount check error, avoid capital loss API
- JDBC exercise - query data encapsulated into object return & simple login demo
- JSON parsing error special character processing (really speechless... Troubleshooting for a long time)
- ZABBIX ODBC database monitoring
猜你喜欢
石臻臻的2021总结和2022展望 | 文末彩蛋
实战模拟│JWT 登录认证
Lepton 无损压缩原理及性能分析
OPPO小布推出预训练大模型OBERT,晋升KgCLUE榜首
Summary of C language learning problems (VS)
Transactions from January 6 to October 2022
2021.12.16-2021.12.20 empty four hand transaction records
Taobao flag insertion remarks | logistics delivery interface
Annotation problem and hidden Markov model
Taobao product details API | get baby SKU, main map, evaluation and other API interfaces
随机推荐
OPPO小布推出预训练大模型OBERT,晋升KgCLUE榜首
[figure neural network] GNN from entry to mastery
Anaconda creates a virtual environment and installs pytorch
#yyds干货盘点#js截取文件后缀名
Setting up sqli lab environment
2021-12-22 transaction record
Migrate data from Mysql to neo4j database
Pytoch loads the initialization V3 pre training model and reports an error
Lepton 无损压缩原理及性能分析
C language structure is initialized as a function parameter
激动人心!2022开放原子全球开源峰会报名火热开启!
10 minute fitness method reading notes (1/5)
JDBC -- extract JDBC tool classes
Taobao short video, why the worse the effect
Average lookup length when hash table lookup fails
View and modify the MySQL data storage directory under centos7
研究:数据安全工具在 60% 的情况下无法抵御勒索软件
以VMware创新之道,重塑多云产品力
CVPR 2022 | 基于稀疏 Transformer 的单步三维目标识别器
Taobao flag insertion remarks | logistics delivery interface