1.Linux login interface1. Check the current file directory: After connecting to the Linux system through Xshell Enter the command: ls 2. Create a new code/kernel folder 2. Write code1. Create hello_module.c Command: vim hello_module.c 2. Press i to enter edit mode and enter the following code The above code is explained as follows: 3. Save and exit, and press ESC to view the file directory; 3. Write the Makefilevim Makefile obj-m := hello_module.o KERNELBUILD := /lib/modules/$(shell uname -r)/build CURRENT_PATH := $(shell pwd) all: make -C $(KERNELBUILD) M=$(CURRENT_PATH) modules clean: make -C $(KERNELBUILD) M=$(CURRENT_PATH) clean The above code is explained as follows: :wq save and exit 4. Compile:Enter the command: make You can see the compiled files Check compiled modules You can also use the modinfo command to further check: 5. Insert moduleInsert the module using the insmod command. After the insertion is complete, you can use the lsmod command to check whether the current module has been loaded into the system: The first one is. After the system loads the module, it will also create a new directory named after the module under the "/sys/module" directory: 6. View log outputSince prink() uses the default output level in this demonstration, you can view the output results through the "dmesg" or "tail /var/log/kern.log" command. This is the end of this article about Ubuntu compiling kernel modules and the content reflected in the system log. For more relevant content about Ubuntu compiling kernel modules, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Concat() of combined fields in MySQL
>>: Using CSS3 and JavaScript to develop web color picker example code
I encountered a pitfall when writing dynamic form...
Recently, I have implemented such an effect: clic...
Question: How to achieve a rounded rectangle usin...
Table of contents What is Docker Compose Requirem...
Without further ado, let’s run the screenshot dir...
describe: When the Tabs component switches back a...
Table of contents 1. Introduction 2. What is func...
Solve the problem of Chinese garbled characters i...
Taking Windows as an example, Linux is actually t...
Table of contents Overview 1. Function debounce 2...
1.MySQL multiple instances MySQL multi-instance m...
This article shares the specific code for the WeC...
Table of contents Proper use of indexes 1. Disadv...
This article example shares the specific code of ...
Preface When mysql modified the default database ...