EasyManuals Logo

ORANGE Pi 3B User Manual

ORANGE Pi 3B
366 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #277 background imageLoading...
Page #277 background image
range Pi User Manual Copyright reserved by Shenzhen Xunlong Software Co., Ltd
269
4) Then you can write a hello kernel module to test the kernel header file
a. First write the code of the hello kernel module, as follows:
orangepi@orangepi:~$ vim hello.c
#include <linux/init.h>
#include <linux/module.h>
static int hello_init(void)
{
printk("Hello Orange Pi -- init\n");
return 0;
}
static void hello_exit(void)
{
printk("Hello Orange Pi -- exit\n");
return;
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_LICENSE("GPL");
b. Then write the Makefile for compiling the hello kernel module, as follows:
orangepi@orangepi:~$ vim Makefile
ifneq ($(KERNELRELEASE),)
obj-m:=hello.o
else
KDIR :=/lib/modules/$(shell uname -r)/build
PWD :=$(shell pwd)
all:
make -C $(KDIR) M=$(PWD) modules
clean:
rm -f *.ko *.o *.mod.o *.mod *.symvers *.cmd *.mod.c *.order

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the ORANGE Pi 3B and is the answer not in the manual?

ORANGE Pi 3B Specifications

General IconGeneral
EthernetGigabit Ethernet
BluetoothBluetooth 5.0
USB2x USB 2.0, 1x USB 3.0
Power Supply5V/3A via USB-C
RAM4GB LPDDR4
StorageMicroSD card slot
WirelessWi-Fi 5 (802.11ac)
Video OutputHDMI 2.0
Operating SystemAndroid