

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Userโlevel I/O software & libraries Deviceโindependent OS software Device drivers Interrupt handlers Hardware Operating system (kernel) User
User space Kernel space User program Keyboard driver Disk driver Rest of the OS Keyboard controller Disk controller
#include <linux/init.h> #include <linux/module.h> MODULE_LICENSE("Dual BSD/GPL"); static int hello_init(void) { printk(KERN_ALERT "Hello, world\n"); return 0; } static void hello_exit(void) { printk(KERN_ALERT "Goodbye, cruel world\n"); } module_init(hello_init); module_exit(hello_exit);
% make make[1]: Entering directory /usr/src/linuxโ2.6.10' CC [M] /home/ldd3/src/miscโmodules/hello.o Building modules, stage 2. MODPOST CC /home/ldd3/src/miscโmodules/hello.mod.o LD [M] /home/ldd3/src/miscโmodules/hello.ko make[1]: Leaving directory/usr/src/linuxโ2.6.10' % su root# insmod ./hello.ko Hello, world root# rmmod hello Goodbye cruel world root#