Skip to main content

Posts

Showing posts from January, 2010

Implementing a new system call in Kernel version 2.6.32

A system call is used by application or user programs to request service from the operating systems. Since the user programs does not have direct access to the kernel whereas the OS has the direct access. OS can access the hardware through system calls only. The following files has to be modified for implementing a system call /usr/src/linux-2.6.32.5/arch/x86/kernel/syscall_table_32.S /usr/src/linux-2.6.32.5/arch/x86/include/asm/unistd_32.h /usr/src/linux-2.6.32.5/include/linux/syscalls.h /usr/src/linux-2.6.32.5/Makefile New set of files to be created Create a new directory newcall/ inside the path “ /usr/src/linux-2.6.32.5/ ” Create new files Makefile, newcall.c and put them in the /usr/src/linux-2.6.32.5/newcall/ folder Create new user files (in any folder of Linux) to test the system call testnewcall.c, testnewcall.h (created in /home/pradeepkumar ) syscall_table_32.S Find the file /usr/src/linux-2.6.32.5/arch/x86/kernel/syscall_tab...

Installing Windows 7 from USB

Are you a person recently purchased a netbook which is not having a DVD ROM, No problem, you can install any OS using a pendrive or USB’s. Here is the steps. Requirements 1. A 4GB pen drive (since the size of Windows 7 is 2.34GB) 2. Windows 7 installation files or a iso image of Windows 7 OS 3. Administrative privileges in the OS Step 1 : Take the backup of all the data in your usb drive plug into the Machine. Step 2 : Go to device manager (Control panel –> device manager –> select disk –> select your usb drive ) and then right click –> properties –> go to policies –> Select Better performance). This step is needed for faster installation of windows 7 (You can wonder, windows 7 installed within 15 minutes with just 1GB RAM) See the following picture   Step 3 :   open the command prompt with administrative rights (Accessories –> right click Command prompt – and select run as administrator) Step 4 : type DISKPART  (you wil...

Installing Windows 7 from USB

Are you a person recently purchased a netbook which is not having a DVD ROM, No problem, you can install any OS using a pendrive or USB’s. Here is the steps. Requirements 1. A 4GB pen drive (since the size of Windows 7 is 2.34GB) 2. Windows 7 installation files or a iso image of Windows 7 OS 3. Administrative privileges in the OS Step 1 : Take the backup of all the data in your usb drive plug into the Machine. Step 2 : Go to device manager (Control panel –> device manager –> select disk –> select your usb drive ) and then right click –> properties –> go to policies –> Select Better performance). This step is needed for faster installation of windows 7 (You can wonder, windows 7 installed within 15 minutes with just 1GB RAM) See the following picture   Step 3 :   open the command prompt with administrative rights (Accessories –> right click Command prompt – and select run as administrator) Step 4 : type DISKPART  (you wil...

How to add a new Linux Kernel Module (LKM)

To demonstrate, let us goto a simple “Hello World” as a module and inserted in to the kernel Step 1 Open any editor like vi or gedit in a shell prompt and the type the following /* Name of the file is hello.c */ #include <linux/module.h> #include <linux/kernel.h> int init_module(void) { printk(KERN_INFO “Hello world.n”); return 0; } void cleanup_module(void) { printk(KERN_INFO “Goodbye worldn”); } The above is a simple C program that displays “Hello world” when the module is inserted and displays “Goodbye world” when the module is removed. Step 2 The program can be compiled using gcc compiler in the shell prompt itself, but we need to write the commands twice or more. So to compile shortly let us write a makefile to compile the above program The make file should be named as Makefile (See the First letter M is uppercase and there should not be any space between Make and file) Copy and paste the following lines in an editor (vi or gedit) obj-m += hello.o all: make -C /lib/mo...

Recompiling Linux Kernel

How to add a new kernel to linux OS and compile it and use it, the following points discusses that. Step 1: Download a new kernel from kernel.org (recent version is 2.6.33) Step 2: you may get the file either as a .tar.bz2 file  or .tar.gz file Step 3: untar the file in the /usr/src directory (for installing you need to be a root user) if it is a bz2 file, then execute tar jxvf filename.tar.bz2 –C /usr/src if it is a gz file, then execute tar zxvf filename.tar.gz –C /usr/src Step 4: go to the folder /usr/src using the command cd /usr/src Step 5: Execute the following  Execute any one of the following command make config (for text mode) make menuconfig make xconfig (for X window) make gconfig (this command is preferred) Step 6: make  (will take atleast 30 minutes to complete, be patient) Step 7: make modules Step 8: make modules_install Step 9: make install Once done, reboot the system, your grub loader is updated with one more kernel. (NB: in the previous flavors of li...