About Me (TS Pradeep Kumar)

Working at VIT University and having great interest towards embedded wireless systems and e-learning. This site caters to most of the Indian Engineering/technology students to know about embedded systems, network simulator, e learning tools/techniques, etc. If you are a student or a learner, you can always request a title or post..

Subscribe by Email

Enter your email address:

Delivered by FeedBurner

File Handling using Shell Scripts

File handling using Shell Scripts

to prepend a line to a file

to develop a temporary file name generator

to compare two files

Requirements:

    Suse Linux, BASH Scripting

Program

(a) Prepending a line to a file

 

#!/bin/bash

# prepend.sh: Add text at beginning of file.

 

E_NOSUCHFILE=65

 

read -p “File: ” file # -p arg to ‘read’ displays prompt.

if [ ! -e "$file" ]

    then [...]

Continue reading File Handling using Shell Scripts

  • Share/Bookmark

Linux System Programming – Lecture notes (upto File systems)

LSP Lecture Notes

Continue reading Linux System Programming – Lecture notes (upto File systems)

  • Share/Bookmark

Linux kernel module to add a proc file entry

A look at the proc_dir_entry structure
struct proc_dir_entry { unsigned int low_ino; unsigned short namelen; const char *name; // name of our module mode_t mode; // permissions ,who can read and write to it [...]

Continue reading Linux kernel module to add a proc file entry

  • Share/Bookmark

Writing a Simple Character Device driver in Linux

A Character device driver needs a major number and a minor number. The devices are registered in the Kernel and it lies either in the /dev/ or in the /proc folder.
The following example uses a char device driver with major number 222 and a minor number 0. The name of the device driver namely “new_device”
It [...]

Continue reading Writing a Simple Character Device driver in Linux

  • Share/Bookmark

How to write a Makefile

Assume there are more number of source files to be compiled using a set of commands everytime is a tedious process. So there is a facility to compile everything at a stretch is by the use of a Makefile.
The makefile can be named as either “Makefile” or “makefile”.
Let me define four files for my simple [...]

Continue reading How to write a Makefile

  • Share/Bookmark

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 [...]

Continue reading Implementing a new system call in Kernel version 2.6.32

  • Share/Bookmark

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 kernelStep 1Open 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 [...]

Continue reading How to add a new Linux Kernel Module (LKM)

  • Share/Bookmark

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 [...]

Continue reading Recompiling Linux Kernel

  • Share/Bookmark

Introduction to Proc File System

The proc file system provides information on the current status of the Linux kernel and running process.
It also allows modifications of kernel parameters in simple ways during runtime
Each process in the system that is currently running is assigned a directory /proc/pid, where pid is the process identification number of the relevant process
There [...]

Continue reading Introduction to Proc File System

  • Share/Bookmark

The Ext2 File System

The initially developed file system was Minix which uses a partition of 64MB and the filenames of no more than 14 characters.
After that, A file system called ext was developed which uses a partition size of 2GB and filenames of 255 characters but it was slow compared with Minix.
Later the file system for Xia was [...]

Continue reading The Ext2 File System

  • Share/Bookmark