Hello ! This is Kite blog ,

Welcome to communicate with me .


Before Linux Kernel Transplant well , Just load the driver in

It turns out that :

/ # ls
bin           first_drv.ko  linuxrc       root          tmp
dev           firstdrvtest  mnt           sbin          usr
etc           lib           proc          sys
/ # insmod first_drv.ko 
first_drv: loading out-of-tree module taints kernel.
/ # lsmod
lsmod: can't open '/proc/modules': No such file or directory
/ # random: crng init done
/ # insmod first_drv.ko 
insmod: can't insert 'first_drv.ko': File exists
/ #

Good pit ,insmod Tips  loading out-of-tree module taints kernel.

and lsmod Also prompt  can't open '/proc/modules': No such file or directory...

For a long time , find Kernel It's printed out log There is a sentence :

cann't run '/etc/init.d/rcS':Permission denied.

it turns out to be the case that rcS Not running , Add the execution authority :

sudo chmod u+x /work/nfs/root/etc/init.d/rcS

such , Restart development board , After file system ,

insmod Although it will be prompted :loading out-of-tree module taints kernel.

however lsmod You will see the driver just installed .


loading out-of-tree module taints kernel.

This seems to be because the kernel chooses to support the kernel signature mechanism when compiling , It is said that 3.7 It is supported after the version

The module is signed . This is for the sake of Kernel Safety plus .

among , Kernel configuration item :

Indicates that the signature mechanism is enabled .

The module must have the correct signature to work properly .

When the kernel is compiled , Will take the initiative to sign the module .


I am here Kernel Of menuconfig Have a look , my

CONFIG_MODULE_SIG yes =n Yeah . strange .

It doesn't matter , Tips taints kernel Just give me a hint , Just load the driver anyway .

estimate CONFIG_MODULE_SIG=y The driver can't be loaded normally .

Need to sign driver .

then ,insmod and lsmod It's all right , Now try it rmmod Unload drive .

Need to be in lib Create an empty folder under the directory to enable use rmmod.


  mkdir -p /lib/module/4.8.17
however rmmod There is also a problem : 







Unable to handle kernel paging request at virtual address fffffffc
pgd = c3b40000
This error occurred while unloading the driver , It is estimated that there is a memory access error .
Later, I was reminded by the boss , When the driver is unloaded ,device_destroy The first argument to the function is struct class * type .
The parameters of my program were passed in incorrectly , It was passed on struct class_device * Type .
This is the difference caused by the new kernel .


in general , Load and unload driver , Both :

init function : 1. devno register   2. class register   3. device apply
exit function : 1. device Destruction  2. class release    3. devno release




©2019-2020 Toolsou All rights reserved,
Forbes China Auto rich list : He xiaopengdi 11 Li Xiangdi 14 Li Bindi 15 Change one's mind ! Tesla starts to deliver made in China to European market Model 3 The difference between memory overflow and memory leak , Causes and Solutions Character recognition technology of vehicle license plate based on Neural Network Vue Transfer parameters and receiving of page Jump SparkSQL Achieve partition overlay write 1190 Reverses the substring between each pair of parentheses leetcode Note 14 : The second biggest obstacle to motivating others in R & D management Chrome OS, For programmers and Windows What does it mean ? Internet Marketing JAVA Convert a string to a numeric type