当前位置:网站首页>单独编译内核模块
单独编译内核模块
2022-07-05 12:38:00 【Li-Yongjun】
前言
在开发和调试某个内核模块时,如果采用整体编译内核的方式,那效率就太低了。我们通常采用单独编译的方式进行。
step 1
拷贝内核模块到 workspace,以英特尔以太网卡驱动 drivers/net/ethernet/intel/
为例
cp linux-5.13/drivers/net/ethernet/intel/ ./ -rf
step 2
改写 Makefile
原始
# 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/
改写后
# 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)
注释掉不需要的模块,将需要的模块添加到 obj-m。
OK
边栏推荐
- Kotlin函数
- UNIX socket advanced learning diary - advanced i/o functions
- I met Tencent in the morning and took out 38K, which showed me the basic smallpox
- 【云原生】Nacos-TaskManager 任务管理的使用
- Redis highly available sentinel cluster
- VoneDAO破解组织发展效能难题
- About LDA model
- Full text search of MySQL
- Distributed solution - distributed session consistency problem
- Using docker for MySQL 8.0 master-slave configuration
猜你喜欢
Redis's memory elimination mechanism, read this article is enough.
激动人心!2022开放原子全球开源峰会报名火热开启!
ZABBIX customized monitoring disk IO performance
【云原生】Nacos-TaskManager 任务管理的使用
Taobao flag insertion remarks | logistics delivery interface
Oppo Xiaobu launched Obert, a large pre training model, and promoted to the top of kgclue
I met Tencent in the morning and took out 38K, which showed me the basic smallpox
DNS的原理介绍
研究:数据安全工具在 60% 的情况下无法抵御勒索软件
Ecplise development environment configuration and simple web project construction
随机推荐
前几年外包干了四年,秋招感觉人生就这样了..
Interviewer: is acid fully guaranteed for redis transactions?
Kotlin变量
A few years ago, I outsourced for four years. Qiu Zhao felt that life was like this
OPPO小布推出预训练大模型OBERT,晋升KgCLUE榜首
ZABBIX monitors mongodb templates and configuration operations
Wechat enterprise payment to change access, open quickly
GPON other manufacturers' configuration process analysis
Learning items
Pytoch loads the initialization V3 pre training model and reports an error
JDBC -- extract JDBC tool classes
Pytoch counts the number of the same elements in the tensor
10 minute fitness method reading notes (2/5)
Learning JVM garbage collection 06 - memory set and card table (hotspot)
Rasa Chat Robot Tutorial (translation) (1)
How to design an interface?
End to end neural network
GPON technical standard analysis I
Distance measuring sensor chip 4530a used in home intelligent lighting
How to connect the API interface of Taobao open platform (super detailed)