当前位置:网站首页>单独编译内核模块
单独编译内核模块
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
边栏推荐
- Learning items
- Redis cluster configuration
- Common commands and basic operations of Apache Phoenix
- How to connect the API interface of Taobao open platform (super detailed)
- Volatile instruction rearrangement and why instruction rearrangement is prohibited
- Distributed solution - distributed session consistency problem
- Flume common commands and basic operations
- Migrate data from Mysql to neo4j database
- jxl笔记
- About LDA model
猜你喜欢

Preliminary exploration of basic knowledge of MySQL

Notes for preparation of information system project manager --- information knowledge

研究:数据安全工具在 60% 的情况下无法抵御勒索软件

ActiveMQ installation and deployment simple configuration (personal test)
![[superhard core] is the core technology of redis](/img/5e/d6438f09031c2acbea17441c316a2b.jpg)
[superhard core] is the core technology of redis

实战模拟│JWT 登录认证

Making and using the cutting tool of TTF font library

CVPR 2022 | 基于稀疏 Transformer 的单步三维目标识别器

【云原生】Nacos-TaskManager 任务管理的使用

太方便了,钉钉上就可完成代码发布审批啦!
随机推荐
NFT: how to make money with unique assets?
A few years ago, I outsourced for four years. Qiu Zhao felt that life was like this
End to end neural network
Distance measuring sensor chip 4530a used in home intelligent lighting
HiEngine:可媲美本地的云原生内存数据库引擎
Simply take stock reading notes (2/8)
About cache exceptions: solutions for cache avalanche, breakdown, and penetration
Ecplise development environment configuration and simple web project construction
Redis highly available sentinel mechanism
Principle of universal gbase high availability synchronization tool in Nanjing University
Annotation problem and hidden Markov model
超高效!Swagger-Yapi的秘密
10 minute fitness method reading notes (2/5)
Full text search of MySQL
Detailed structure and code of inception V3
《信息系统项目管理师》备考笔记---信息化知识
Database connection pool & jdbctemplate
Simply take stock reading notes (1/8)
About LDA model
上午面了个腾讯拿 38K 出来的,让我见识到了基础的天花