Friday, January 13, 2012

Thursday, January 12, 2012

Linux Kernel Bootup Process

http://www.ibm.com/developerworks/library/l-linuxboot/index.html
http://free-7.blogspot.com/2010/10/linux-boot-process.html

Linux Kernel Doc - Help

http://whatisthekernel.blogspot.com/
http://www.kernel.org/doc/
http://web.dit.upm.es/~jmseyas/linux/kernel/hackers-docs.html
http://www.nondot.org/sabre/os/articles
http://kernelnewbies.org/Documents/Kernel-Docbooks

Wednesday, January 11, 2012

Reset Linux passwd ~ by booting in Single User Mode


You can enter single user mode directly after turning on the power to your system. The steps to do this are listed below.

1. Power on your system. Wait for the "Grub loading" message to appear and, depending on your Linux distribution, get ready to hit either any key or the ESC key to enter the grub boot menu.

Grub loading, please wait ... Press ESC to enter the menu 

or

Grub loading, please wait ... Press any key to enter the menu 

2. You will then get grub's main menu which will display a list of available kernels. Use the arrow keys to scroll to your desired version of the kernel and then press e for "edit".

Fedora Core (2.6.18-1.2239.fc5smp) Fedora Core (2.6.18-1.2200.fc5smp) 

3. The kernel's boot menu will appear. Use the arrow keys to scroll to the "kernel" line and then press e for "edit".

root (hd0,0) kernel /vmlinuz-2.6.18-1.2239.fc5smp ro root=LABEL=/ initrd /initrd-2.6.18-1.2239.fc5smp.img 

4. A grub edit prompt will appear. Use the arrow keys to move to the end of the line and add the word "single" to the end, separated by a space. Change

grub edit> kernel /vmlinuz-2.6.18-1.2239.fc5smp ro root=LABEL=/ 

to

grub edit> kernel /vmlinuz-2.6.18-1.2239.fc5smp ro root=LABEL=/ single 

5. Press enter to save your changes, and then b for "boot".

6. The system will continue to boot, but will go straight to the root # prompt without first asking for a username and password and now we can reset any passwd.

Basic Linux Hello World Kernel module

Step 1: vi hello.c


#include
#include
#include

static int hello_init(void)
{
printk(KERN_ALERT "Hello World");
return 0;
}

static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye World");
}

module_init(hello_init);
module_exit(hello_exit);

MODULE_LICENSE("GPL v2");
MODULE_AUTHOR(RICHIE);


Step 2: vi Makefile

obj-m := hello-kernel.o
hello-kernel-objs := hello.o

Step 3: make -C /lib/modules/`uname -r`/build M=`pwd`
You should see hello-kernel.ko in your current directory, by now.

Step 4: sudo /sbin/insmod hello-kernel.ko

Step 5: dmesg

You should see "Hello World" here.

Step 6: lsmod | grep hello-kernel

Step 7: modinfo hello-kernel.ko

Step 8: sudo /sbin/rmmod hello-kernel.ko

Step 9: dmesg

You should see "Goodbye World" here.

how linux kernel works - Programmers' view

http://www.tuxradar.com/content/how-linux-kernel-works

geeksforgeeks - A Computer Science Portal

A Computer Science Portal
http://www.geeksforgeeks.org/

Gr8 db for C/C++ Interview qs!
http://www.geeksforgeeks.org/archives/category/linked-list
http://www.geeksforgeeks.org/archives/category/c-puzzles
http://www.geeksforgeeks.org/archives/category/gfact
http://www.geeksforgeeks.org/archives/category/tree
http://www.geeksforgeeks.org/archives/category/c-arrays
http://www.geeksforgeeks.org/archives/category/articles

Ankit's fav
http://dumpyard.tumblr.com/post/31130051/must-read-software-engineering-books