LDD Basics
LDD Basics
Contents:
1. Write basic LDD Program(hello.c).
2. Write Makefile
3. Compilation stages.
• module_init is the entry point of the kernel
modules and hello_module_init function is
registered with module_init.
• So, hello_module_init function is executed
when this module is inserted into the kernel.
obj-m := hello.o
all:
make -C /lib/modules/`uname -r`/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
Now run the make command it will create the
module hello.ko:
$ make
commands: # To load module run below command
$ sudo insmod hello.ko
# To remove the module
$ sudo rmmod hello
Thanks,