当前位置:网站首页>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
边栏推荐
- Implementing Yang Hui triangle with cyclic queue C language
- Add a new cloud disk to Huawei virtual machine
- Taobao flag insertion remarks | logistics delivery interface
- I met Tencent in the morning and took out 38K, which showed me the basic smallpox
- Distance measuring sensor chip 4530a used in home intelligent lighting
- 【云原生】Nacos-TaskManager 任务管理的使用
- Kotlin function
- Resnet18 actual battle Baoke dream spirit
- stm32和电机开发(从架构图到文档编写)
- 国内市场上的BI软件,到底有啥区别
猜你喜欢
【云原生】Nacos中的事件发布与订阅--观察者模式
I met Tencent in the morning and took out 38K, which showed me the basic smallpox
Pytoch loads the initialization V3 pre training model and reports an error
Migrate data from Mysql to neo4j database
Tips and tricks of image segmentation summarized from 39 Kabul competitions
Distance measuring sensor chip 4530a used in home intelligent lighting
Constructing expression binary tree with prefix expression
JSON parsing error special character processing (really speechless... Troubleshooting for a long time)
Kotlin variable
Install rhel8.2 virtual machine
随机推荐
Knowledge representation (KR)
Preliminary exploration of basic knowledge of MySQL
Compilation principle reading notes (1/12)
Introduction to relational model theory
Average lookup length when hash table lookup fails
10 minute fitness method reading notes (1/5)
C language structure is initialized as a function parameter
GPON other manufacturers' configuration process analysis
Making and using the cutting tool of TTF font library
初识Linkerd项目
Research: data security tools cannot resist blackmail software in 60% of cases
C alarm design
Kotlin variable
Kotlin变量
【Nacos云原生】阅读源码第一步,本地启动Nacos
Volatile instruction rearrangement and why instruction rearrangement is prohibited
Experimental design - using stack to realize calculator
Kotlin流程控制、循环
Redis clean cache
10 minute fitness method reading notes (5/5)