当前位置:网站首页>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
边栏推荐
- Taobao, pinduoduo, jd.com, Doudian order & Flag insertion remarks API solution
- How to connect the API interface of Taobao open platform (super detailed)
- Taobao flag insertion remarks | logistics delivery interface
- Compilation principle reading notes (1/12)
- Taobao order interface | order flag remarks, may be the most stable and easy-to-use interface
- NLP engineer learning summary and index
- Flume common commands and basic operations
- 在家庭智能照明中应用的测距传感芯片4530A
- End to end neural network
- ZABBIX monitors mongodb (template and deployment operations)
猜你喜欢

10 minute fitness method reading notes (5/5)

【Nacos云原生】阅读源码第一步,本地启动Nacos

国内市场上的BI软件,到底有啥区别

开发者,云原生数据库是未来吗?
![[figure neural network] GNN from entry to mastery](/img/e2/bb045fb03bc255b8659f9ca7cdd26b.jpg)
[figure neural network] GNN from entry to mastery

Super efficient! The secret of swagger Yapi

Taobao short videos are automatically released in batches without manual RPA open source

Preliminary exploration of basic knowledge of MySQL

你的下一台电脑何必是电脑,探索不一样的远程操作

Simply take stock reading notes (2/8)
随机推荐
Oppo Xiaobu launched Obert, a large pre training model, and promoted to the top of kgclue
Redis master-slave configuration and sentinel mode
Constructing expression binary tree with prefix expression
How do e-commerce sellers refund in batches?
以VMware创新之道,重塑多云产品力
奔跑,开路
JDBC -- use JDBC connection to operate MySQL database
GNN(pytorch-geometric)
Principle of universal gbase high availability synchronization tool in Nanjing University
ZABBIX agent2 monitors mongodb nodes, clusters and templates (official blog)
Rasa Chat Robot Tutorial (translation) (1)
Distributed solution - distributed lock solution - redis based distributed lock implementation
Wechat enterprise payment to change access, open quickly
Common commands and basic operations of Apache Phoenix
RHCAS6
Introduction to relational model theory
Compilation principle reading notes (1/12)
Using docker for MySQL 8.0 master-slave configuration
Kotlin process control and circulation
End to end neural network