EasyManua.ls Logo

ORANGE Pi 3B - Page 278

ORANGE Pi 3B
366 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd
270
endif
c. Then use the make command to compile the hello kernel module. The output of
the compilation process is as follows:
If there is a problem with compiling the code you copied here, please go to the
official tool to download the source code and upload it to the Linux system of the
development board for testing.
orangepi@orangepi:~$ make
make -C /lib/modules/5.10.160-rockchip-35xx/build M=/home/orangepi modules
make[1]: Entering directory '/usr/src/linux-headers-5.10.160-rockchip-rk35xx'
CC [M] /home/orangepi/hello.o
MODPOST /home/orangepi/Module.symvers
CC [M] /home/orangepi/hello.mod.o
LD [M] /home/orangepi/hello.ko
make[1]: Leaving directory '/usr/src/linux-headers-5.10.160-rockchip-rk35xx'
d. After compiling, the hello.ko kernel module will be generated
orangepi@orangepi:~$ ls *.ko
hello.ko
e. Use the insmod command to insert the hello.ko kernel module into the kernel
orangepi@orangepi:~$ sudo insmod hello.ko
f. Then use the demsg command to view the output of the hello.ko kernel module.
If you can see the output below, it means that the hello.ko kernel module is
loaded correctly.
orangepi@orangepi:~$ dmesg | grep "Hello"
[ 2871.893988] Hello Orange Pi -- init
g. Use the rmmod command to uninstall the hello.ko kernel module
orangepi@orangepi:~$ sudo rmmod hello
orangepi@orangepi:~$ dmesg | grep "Hello"
[ 2871.893988] Hello Orange Pi -- init
[ 3173.800892] Hello Orange Pi -- exit

Table of Contents