Monday, November 3, 2008

First kernel module (2.6 kernel) - hello

/* First kernel module - hello.c */

/*
--------------------------------------
Steps to be followed
#
vi hello.c - Enter the given c code
#
vi Makefile - Enter the following
obj-m += hello.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) clean
install:
make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) modules_install

#make
#
insmod hello.ko
#
dmesg tail -4 --> view message
#
rmmod hello
#
dmesg tail -4 --> view message
--------------------------------------
*/

#include <linux/kernel.h>
#include <linux/module.h >
#include <linux/init.h>

static int __init hello_init(void)
{
printk(KERN_INFO "Hello world\n");
return 0;
}

static void __exit hello_exit(void)
{
printk(KERN_INFO "Goodbye world\n");
}

module_init(hello_init);
module_exit(hello_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("KERNO");
MODULE_DESCRIPTION("First kernel module");

Monday, August 4, 2008

Why should you use Linux?

You can know what is happening inside the machine from bootup to shutdown.

You can see every bit of code, which dance before you as terminal texts or gui gimmicks.

You can experiment a lot, without paying a lot.

You can get help from lots of passionate geeks.

This is only a beginning.

You can be part of a culture.

Yes, Linux is a culture...