The above mentioned modification to the kconfig file,
Added
Config embedsky_hello
Tristate "tq2440/sky2440 Hello driver"
Depends on arch_s3c2440
Help
Embedsky tq2440/sky2440 hello.
These lines of code indicate that the embedsky_hello driver needs to be compiled. What we need to do is
Modify the MAKEFILE file in the same parent directory
Add this line to makefile,
OBJ-$ (config_embedsky_hello) + = embedsky_hello.o
Then select in the kernel compilation option and compile the kernel directly, or use the command # Make subdir = Drivers/Char/modules to compile the driver module.
Let's take a look at the driver module
*************************************
Name: embedsky_hello.c
Copyright: www.embedsky.net
*************************************/
# Include <Linux/module. h>
# Include <Linux/kernel. h>
# Include <Linux/fs. h>
# Include <Linux/init. h>
# Include <Linux/miscdevice. h>
# Include <Linux/delay. h>
# Include <ASM/IRQ. h>
# Include <ASM/ARCH/regs-gpio.h>
# Include <ASM/hardware. h>
Module_license ("GPL ");
When the static int _ init embedsky_hello_init (void) // insmod driver is used, the system automatically calls the function.
{
Printk ("<1>/n hello, embedsky! /N ");
Printk ("<1>/nthis is first driver program./n ");
Return 0;
}
Static void _ exit embedsky_hello_exit (void)
{
Printk ("<1>/n exit! /N ");
Printk ("<1>/ngoodbye embedsky! /N ");
}
Module_init (embedsky_hello_init );
Module_exit (embedsky_hello_exit );
A short piece of code, but it seems that only a few lines of words can be printed in the kernel, without interacting with hardware.
The gpio driver will be available tomorrow.