Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write the Makefile file of Ubuntu driver

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you how to write Ubuntu driver Makefile file, the content is simple and easy to understand, organized clearly, I hope to help you solve doubts, let Xiaobian lead you to study and learn "Ubuntu driver Makefile how to write" this article bar.

I. Makefile file format

KVERS = $(shell uname -r)

#Kernel modules

obj-m += globalmem.o

#Specify flags for the module compilation

#Enable modules that can contain debug information: globalmem.ko

#EXTRA_CFLAG = -g -o0

build:kernel_modules

kernel_modules:

make -C /lib/modules/$(KVERS)/build M=$(CURDIR) modules

clean:

make -C /lib/modules/$(KVERS)/build M=$(CURDIR) clean

II. Install and uninstall module commands

Installation module: insmod globalmem.ko

Uninstall module: rmmod globalmem.ko

Loading module: lsmod

View master device number: cat /proc/devices

Create a device node:

mknod /dev/globalmem0 c 250 0

mknod /dev/globalmem1 c 250 1

Delete Device Node:

rm /dev/globalmem0

rm /dev/globalmem1

Verify that the device reads:

echo "hello world1" > /dev/globalmem0

echo "hello world2" > /dev/globalmem1

cat /dev/globalmem0

cat /dev/globalmem0

Start two processes: blocking and non-blocking IO (one executing in the background and one writing to strings)

cat /dev/globalfifo &

echo 'i want to be' > /dev/globalfifo

The above is "Ubuntu driver Makefile how to write" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report