Skip to main content


Showing posts from 2008

DHCP Client Server Porting Guide Steps Here

Looking for DHCP Client Server Porting Guide Steps? read on,

1.Download udhcp-0.9.8.tar.gz and Untar it
>tar -zxvf udhcp-0.9.8.tar.gz

2.You will get udhcp-0.9.8 directory.Go to that directory
>cd udhcp-0.9.8

3.The code can be compiled directly for gcc.For arm-linux
> Go to Makefile and uncomment the CROSS-COMPILE (line 19) and edit

4.Now run make command from that directory.

5.You will get two binaries
1.udhcpd -- DHCP Server
2.udhcpc -- DHCP Client

6.For DHCP server:
1.copy udhcpd(binary) to /usr/sbin
2.copy udhcpd.conf in the directory samples to /etc directory
3.create an empty file udhcpd.leases in /var/lib/misc directoty

7.For DHCP client:
1.copy udhcpc(binary) to /sbin directory
2.copy all the scripts except udhcpd.conf in samples directory to
/usr/share/udhcpc directory
3.Create an empty directory udhcpc in /etc directory.
(In this directory the client will c…

NFS Based ROOTFS Mounting From NFS

How to boot from NFS?
Network File System (NFS) is a Network file system protocol allowing a user on a client computer to access files over a network as easily as if the network devices were attached to its local disks. All kernels after 2.2 support NFS over TCP.

Mounting the root file system from NFS steps.

1) Go to kernel source directory and type "make menuconfig".
2) In order to configure root NFS support in the kernel, it is first necessary to enable "IP Autoconfiguration". This setting is accessed by selecting "Network" and then "Networking Options" in the menu. On the Network options screen select "IP: kernel level autoconfiguration". type / to search config options from make menucnfig.
3) Main menu select "File Systems" select "Network File Systems". On the Network File Systems page select the "NFS file system support" as built-in (select as *). Then scroll down and select "Root File system on …

Steps For Booting Linux Kernel From USB Pen Drive

Boot Linux kernel from USB:
Here are the steps for Booting Linux kernel from USB pen drive. If you have kernel image in pen drive then use these steps to boot from pen drive.

1) Create ext2 file system on USB.
2) Copy the kernel image to USB.
3) Connect the USB to embedded board.
4) From u-boot: Execute following commands.
5) “usb start” :– This will probe for usb mass storage devices.
6) “usb storage”:- shows the details of mass storage device.
7) “ext2ls usb o” :- lists the files in the USB.
8) “ext2load usb 0 7fc0 scp_zimage “ :- copies the embedded linux kernel file from usb and stores it in RAM 7fc0
9) Then do “bootm” to boot Linux.

What is Boot loader in embedded System Init Steps

Lets talk about Boot loader in embedded system and its basics.
What is Boot loader in embedded System and its initialization steps?
What happens on power on? What does bootloader do on power on? Read on for answers to these question .
Boot loader is a program which will execute on power-on in an embedded system. The main functionality of the boot loader is to initialize the hardware and make a platform for, and load the Operating system. Hardware initialization includes the CPU, memory controller, UART, etc. As system is up the CPU will be initialized then the memory controller (i.e. DDR controller, Flash controller) will be initialized. The Boot loader code will itself relocate to the RAM and do further hardware initialization like UART, MAC, PCI etc.
The very first initialization code should be from a non-volatile memory on board, which will have the capability of XIP (execute in place). IF you have serial Flash as boot code holder, which cannot be used for XIP, then other options are


ntfsprogs and Fuse Compilation errors and Solution here

Got some luck to compile ntfsprogs. Ntfsprogs are a collection of utilities for doing stuff with NTFS volumes. Steps to compile ntfsprogs .
1. get the FUSE and compile it.
$ tar xvzf fuse-2.7.4.tar.gz
$ ./configure --disable-kernel-module
$ make
getting error while compiling examples dir.

libtool: link: gcc -Wall -W -Wno-sign-compare -Wstrict-prototypes -Wmissing-declarations -Wwrite-strings -g -O2 -fno-strict-aliasing -o .libs/fusexmp fusexmp.o -pthread -pthread ../lib/.libs/ -ldl
../lib/.libs/ undefined reference to `clock_gettime'
make[1]: Leaving directory `/home/bhagwat/fuse-2.7.4/example'
Solution is
$ cd examples
open Makefile go to line no 205 change the option from -ldl to -lrt
$ cd ../make
$ make install

FUSE will be installed in default dir ie /usr/local/lib
Get the ntfsprogs from linux-ntfs. untar ntfsprograms
$ tar xvzf ntfsprogs-2.0.0.tar.gz
$ ./configure --enable-ntfsmount

still getting same error
smount ntfsmount-ntfsmount.o ntfsmount-utils.o -pthread ..…

Useful Windows DOS Commands For Linux Users

Useful Windows DOS Commands For Linux Users
the most useful DOS commands available in Windows XP. DOS Commands must be run at the prompt of the Cmd.exe. To open Command Prompt, click Start, click Run, type cmd, and then click OK.
Now try some useful commands;
1. To convert FAt32 volume into NTFS volume
converts F drive into NTFS format.
2. Disconnect all the connection using net use
use : - net use * /del /yes
This will delete all the connection to your windows system; means If you have already connected to some system with shared folders and provided log in and password. After using this command you need to type login and password again. One can disconnect specific connection using net use.
: net use will display all the connection list.

3. Today I learn about SDelete command. (works on Windows NT/2000's (Win2K) )
SDelete is a command line utility that takes a number of options. In any given use, it allows you to delete one or more files and/or directories, or t…

dda housing scheme 2008 results at

Housing Scheme 08 — the Delhi Development Authority’s latest offering of affordable houses for citizens. The much-awaited draw of lots to the Delhi Development Authority (DDA) Housing Scheme 2008 – under which 5,010 flats are up for sale.
The DDA will, however, upload the list of successful allottees on its website by 3 p.m. To view your Registration/Allotment/Application Status please:
1. Select Scheme, either enter Registration/Application No. or Priority No., and select Flat category. Scheme:
Of the 12.64 lakh application forms which were sold, 5,60,000 forms were found eligible for inclusion in the lottery by DDA.
The list will also appear in all national newspapers on Wednesday,” said Dhar.
direct link is
dda, dda housing sch…

Calling User Space Program From Kernel Space

Invoking user mode application from kernel modules, yes its possible with help of CALL_USERMODEHELPER.
With the following kernel API, we can invoke user mode application from Kernel modules/threads.

int call_usermodehelper (char * path, char ** argv, char ** envp, int wait);

path: pathname for the application.
argv: null-terminated argument list.
envp: null-terminated environment list.
wait: wait for application to finish and return status.


Kernel Module:

char name[]="user_program";

static int init_function(void)
int ret;
char *argv[] = {name, "hello", "world", NULL };
static char *envp[] = { "HOME=/",

printk("We r in init_function\n");

ret= call_usermodehelper(name, argv, envp, 1);
if ( ret <>
int main(int arg…

Ruby.rewrite Ruby Fringe talk by Braithwaite

Ruby.rewrite(Ruby).In this RubyFringe talk, Reginald Braithwaite shows how to write Ruby that reads, writes, and rewrites Ruby. The demos include extending the Ruby language with conditional expressions, new forms of evaluation such as call-by-name and call-by-need, and more.
RubyFringe is an avant-garde conference for developers that are excited about emerging Ruby projects and technologies. They're mounting a unique and eccentric gathering of the people and projects that are driving things forward in our community.
about Author
Reginald Braithwaite was the tech lead on the team that created JProbe Threadalyzer, a tool that did automatic detection of potential threading-related bugs.
check out the presentation here.

The 10 Most Puzzling Ancient Artifacts

What are we to make of these finds? There are several possibilities:

* Intelligent humans date back much, much further than we realize.
* Other intelligent beings and civilizations existed on earth far beyond our recorded history.
* Our dating methods are completely inaccurate, and that stone, coal and fossils form much more rapidly than we now estimate.

In any case, these examples - and there are many more - should prompt any curious and open-minded scientist to reexamine and rethink the true history of life on earth. clipped from There is a great deal of archeological evidence that the history of life on earth might be far different than what current geological and anthropological texts tell us. Could it be, however, that conventional science is just as mistaken as the Bible stories? Consider these astonishing finds: The Grooved Spheres
Over the last few decades, miners in South Africa have been digging up mysterious metal spheres. The kicker is that the rock in…

Nanotechnology vs. God

A team of American and Singaporean scientists conducted a survey of attitudes towards nanotechnology, and found that the more religious the community, the more they opposed the science of nanotechnology clipped from The U.S. is experiencing an apocalyptic showdown even as we speak.  In one corner we have nanotechnology, which could potentially end the world through rogue replication or uncontrolled alteration.  In the other we have God, who has - and this according to his fans, remember - killed almost everything on Earth at least once and will do so again the very instant he decides he wants to, under the euphemistic name of "Rapture".  The public is the referee and, amazingly, they're on the "I drowned all but one family of you people once" guy's side. A team of American and Singaporean scientists conducted a survey of
attitudes towards nanotechnology, and found that the more religious the
community, the more they opposed the science of n…

Taking A Shower Improves Moral Judgment

The research was conducted through two experiments with university students. In the first, they were asked to complete a scrambled sentence task involving 40 sets of four words each. By underlining any three words, a sentence could be formed. For the neutral condition, the task contained 40 sets of neutral words, but for the cleanliness condition, half of the sets contained words such as ‘pure, washed, clean, immaculate, and pristine’. The participants were then asked to rate a series of moral dilemmas including keeping money found inside a wallet, putting false information on a resume and killing a terminally ill plane crash survivor in order to avoid starvation.

The second experiment saw the students watch a ‘disgusting’ film clip before rating the same moral dilemmas. However, half the group were asked to first wash their hands.

clipped from The next time you have to make a difficult moral decision, you might think twice about mulling it over in the bath or…

Best Buy black friday ads 2009 slick deals Released

Check out information on black friday ads,
Best Buy black friday ads 2009 slick deals Released target, best buy black friday ads, walmart black friday ads, best buy deals clipped from
Best Buy From black friday ads
And here is best buy from walmart black friday ads Target Target Black Friday ad listing for 2008 at along with the Black Friday, and online coupons. clipped from
Best Buy Black Friday 2008 From Sears Circuit City and Wal-Mart
1. How to start making out of best deals and best buy? 2. Why slickDeals is favorite? They have created a Excel spreadsheet to get idea and quick overview of items and prices. No need to scan through tons of color ad pages. and Kmart, Target, Meijer, and a few others will be opening at 6:00am. Check out some of best deals for 2009 black friday. Laptops
HDTV Best Buy Best Buy is Wal-Mart's $199 Xbox 360 Arcade pack which includes Guitar Hero, Blu-ray from Circuit…

SATA disk is Not Detecting While Linux bootup

Did you experience below kind of error anytime with SATA disk,

PCI: enabling device 0000:00:01.0 (0140 -> 0143)
ata1: SATA max UDMA/100 cmd 0xC2852080 ctl 0xC285208A bmdma 0xC2852000 irq 22
ata2: SATA max UDMA/100 cmd 0xC28520C0 ctl 0xC28520CA bmdma 0xC2852008 irq 22
ata1 is slow to respond, please be patient

after waiting you get
ata1: no device found (phy stat 00000000)
scsi0 : sata_sil

and at last
ata2 failed to respond (30 secs)

And you know how simple answer is for this.
Yes only thing is knowing is the key.

The answer lies in power source connector; SATA disks are very sensitive to power source, so if you see such errors coming while bootup and your SATA disk is not getting detected then press the power connector, And your are saved. This is my experience after struggling for an hour with changing SATA disk and changing SMPS, changing target board, but nothing worked; finally press hold on power connector to SATA disk and done. bbuuuurrr..

what does /dev/null 2>&1 command do?

what does /dev/null 2>&1 command do ?
What does > /dev/null 2>&1″ mean?
I was running some CGI for disk formatting and during this process some warning messages were coming on screen; even though I was duplicating standard out file pointer to some temporary file pointer. It was not redirecting standard error messages to this temporary file. Searched on google, but was not able to hit google with right keyword. Got this answer of using /dev/null 2>&1.
Here is explanation,

In Linux There are three standard file descriptors, Standard In (STDIN, file descriptor 0), Standard Output (STDOUT, file descriptor 1) and Standard Error (STDERR, file descriptor 2). /dev/null is the null device, which is like "write only memory". > will write to the specified file (overwriting its contents) and >> will append to the specified file.

> /dev/null 2>&1 redirect both output and error to /dev/null
> /file 2>&1 redirect both output and error to …

Use of CUT Grep AWK Linux Command Combinations

Today I learn about power usage of grep cut and awk command;
My requirement was to know on which physical USB port which device is connected,
I can get this information from /proc/bus/usb/devices; which tells me about on which port which device is connected; my udev script will automatically mount the USB device with combination of Manufacturer name and serial number;
Here is the steps how I reached to simple solution instead of coding hundred lines of code.

To search for the SerialNumber in proc file i used
$ grep 'SerialNumber' /proc/bus/usb/devices
was giving me output in "S: SerialNumber=LDVTCGP6" format, I don't need that S: so used pipe;
$ grep 'SerialNumber' /proc/bus/usb/devices | awk '{print $2}'
This removes initial "S:" The output is combination of SerialNumber=LDVTCGP6 lines;
I need to separate each strings with individual values; use cut command from linux.
$ grep 'SerialNumber' /proc/bus/usb/devices | awk '{print $2}&…

It's a Bigger World than Java and C++

We hear a lot about Java and C++, but that doesn't mean they're the only languages developers are using.
Tokeneer was developed for the U.S. National Security Agency (NSA), an outfit known for keeping things secret. Which makes it even more surprising that not only did the NSA acknowledge Tokeneer's existence, but they released it as open source software.
In a nutshell, Tokeneer is a proof-of-concept of what's called "high-assurance software engineering." Secure software, in other words. Software you can trust. Software that must work correctly or else the consequences could be calamitous. And software that's written in Ada—yes, Ada—and developed using Praxis High Integrity Systems ( Correctness-by-Construction (CbyC) methodology, the SPARK Ada language (, and AdaCore's GNAT Pro environment ( The project demonstrates how to meet or exceed all those things that are necessary to achieve high assurance, …

Refresh HTML Page Every 5 Seconds Usages META tag

How to Refresh HTML/CGI page every 5 seconds?
Today I was searching for page refresh after a certain activity is completed. I was running some task in say CGI 1; which uses fork() to execute another task; once this task is done CGI 1 should get refreshed or should show me the updated status which is being updated by new task.
I tried lot of other combination like calling refresh function from new task; with window.opener.refresh_fucntion(); and a lot.
Finally got the solution using meta tag of html.

Meta HTML tag,The element provides meta-information about your page
And the answer to question is just include before head element this tag;
Refresh page every 5 seconds:

Refresh page every 5 seconds:

<meta http-equiv="refresh" content="5" />

and my job is done.
Thanks to meta tag.

C Programming Caution while using execlp function

What is C Programming Caution while using execlp function?

programming caution while using execl function series. execlp function series most of the time are used with fork() system call;
If the requirement is there to kill the process started by execl function, then one caution need to take care, as execl functions will replace complete child process image with the new process image, This means new process started is having new pid and not as same as child pid.
In order to kill the process we need to call getpid function in calling function and store this pid in temp file and while killing this new process use
kill(pid) system call.

Example usage assuming in pid is stored in /var/childpid.

fptr = fopen("/var/childpid","r");
if(fptr != NULL)
printf("Can't open childpid file");
child_pid[strlen(child_pid)-1] = '\0';

sprintf(cmd,"kill %s >…

How to Check Directory Size In Linux Also lists file size

How to check directory size in linux?
du is the answer.
du - estimate file space usage
Summarize disk usage of each FILE, recursively for directories.
useful options are
-h, --human-readable
print sizes in human readable format (e.g., 1K 234M 2G)
-s, --summarize
display only a total for each argument
To check the directory size use $ du -hs
this will give current working directory size if specified gives specific directory size ie
$du -hs /home/bhagwat/test/dir
gives size of /dir.

while df is also there but it gives disk space not directory space
df - report filesystem disk space usage
df displays the amount of disk space
available on the filesystem containing each file name argument. If no file name is given,
the space available on all currently mounted filesystems is shown.

Use of Execlp Functions C program Explained

Below code listing illustrates usage of execl function series, and talks about how to redirect the output from these functions.
Here is trick to redirect the output from execlp command series
In other words implematiation of "ls -l >/var/test.log"
first open file using "open" system call


int open(const char *pathname, int flags);

then duplicate this file pointer with stdio file pointers
stdio file pointer are 0 for stdin
1 for stdout and 2 for stderr

use of dup2

dup and dup2 create a copy of the file descriptor oldfd.
int dup2(int oldfd, int newfd);

here is c example implementation in function;

int spawn(char* cmd)
pid_t child_pid;
int fptr,fptr2;
char tmp_devfs[20];
int child_status=-1,ret=-1;

// printf("executing cmd=%s\n",cmd);
/*create new process */
child_pid = fork();
if (child_pid != 0){
/* This is the parent process. */
ret = child_pid;

Why We Need to Call a Pig a Pig - The politics of language ..

We know Orwell for his novels, but it's the way he saw the politics of language that makes him relevant. clipped from Why We Need to Call a Pig a Pig (With Or Without Lipstick) We know Orwell for his novels, but it's the way he saw the politics of language that makes him relevant.clipped from Though many of Orwell's essays describe single incidents, his concerns are political, in the largest sense: the way human dignity is corrupted by false phrases. He was less interested in what motivates people to act without integrity than in the words they use to camouflage and perpetuate their dishonesty: for Orwell, bad language and bad politics were one and the same. Yet for all his penury and despair, his faith in the power of clear, strong language can only be read as optimistic. Orwell's ideas have been bastardized and simplified over time, so that "Big Brother," the totalitarian, state-run citizen-control mechanism of "1984,&qu…

Stupid Products

Consumers MUST BE SATISFIED! clipped from Inflatable Toast The Goatee Saver Taco Propers Sci Fi Themed Condoms Handsets for cell phones Cassette Tape Dispenser Day-Glo Camouflage Zaky Infant Pillow Two-da-loo Tandom Toilet CLEAN-UP SLIPPERS Hair Guard for Noodle Eating

Get Mounted File System Type C function

How to get Mounted file system type using C program?
Here is trick to get mounted file system type or say this trick can be applied to get variable from linux; This is simple combination of "grep" and "awk" commands. check out below; this function takes mounted point name like where you have mounted the disk example
/dev/sda1 is being mounted at /mnt/test so the input argument to this function is test and the output should get is /dev/sda1 filesytem type.
If you type mount command you will get the file type

on my system with one pen drive; it shows
dev/sda1 on /mnt/JetFlash type ext3 (rw)
input to this function is JetFlash and I will get return as ext3 which is file system type.
Description : returns mounted FS type
char *get_fs_type(char *mount_point_name)
char temp[20];
char cmd[100],*ret_p;
FILE *fptr;

sprintf(cmd,"/sbin/fdisk -l | grep %s | awk '{print $6,$7}' > /var/mpt",mount_point_name);

fptr = fopen("/var/mpt&…

Scratchbox Cross-compiling Made Easy

Often Getting problems with corss compiling here is the perfect solution, read on.
Scratchbox is a configuration and compilation environment for building Linux software and entire Linux distributions.
The basic idea of Scratchbox is to offer developers an environment that works and looks like the target environment before the target environment is available.
The Scratchbox is an environment that you log into like you would log into some machine. However, the Scratchbox tools can be used either inside or outside of Scratchbox download
untar all tar ball using tar -xzf command
then run


fdisk Compilation for ARM-Target board Errors

Today Trying my luck with compiling fdisk utility;

Source code at:

Current fdisk 1.0 is July 7 2007 370K source .tar.gz

./configure --disable-cfdisk --host=arm-linux --build=i686 --disable-largefile
./configure says to install GNU/Parted before compiling.
It needs parted/parted.h. Latest version is 1.8.7 of May 2007.
1.4GB source code tar.gz.
./configure --host=arm-linux --build=i686
configure: error: GNU Parted requires libuuid - a part of the e2fsprogs package (but
GNU Parted requires libuuid - a part of the e2fsprogs package (but
sometimes distributed separately in uuid-devel or similar)
This can probably be found on your distribution's CD or FTP site or at:
Note: if you are using pre compiled packages you will also need the development
package as well (which may be called e2fsprogs-devel or something similar).
If you compile e2fsprogs yourself then you need to do &#…

Install NTFS read Write Support ntfsmount a big Bang

Today's leanings are
1. How to create NTFS partition from FAT32 filesystem?
Need to have windows XP or NT to run this command.
Created NTFS partition using command from cmd prompt; -
2. Major task was to enable NTFS Read/write support;
Started with enabling NTFS_RW in Linux kernel, its help says;
This enables the partial, but safe, write support in the NTFS driver.
The only supported operation is overwriting existing files, without changing the file length. No file or directory creation, deletion or renaming is possible. Note only non-resident files can be written to so you may find that some very small files (<500 href=""> user level driver(requires FUSE) and kernel mode driver.

Started with kernel mode driver from ntfs-3gwhich uses mkedev function ref to our arm-tool chain in file /tools/arm-tools-3.3.1/tools.Linux/hard_fp/armv5-linux/sys-include/s…

UDEV Simple Rules For Events In Linux

How to execute external program upon certain events occurred in linux?
This is quite wide requirement if you are running embedded linux on target board. Well The answer could be varied as question is more general. Lets limit the scope of question to USB devices.
Running external programs upon certain events to be specific want to run a program on USB device connection and on USB device removal.
Well I am going to do it with UDEV,
For the beginners/novices about UDEV and howto write UDEV rules the howto is pretty nice and easy to apply.
One can do it with signals also, but I like this way. To start with,
I have written simple udev rules file and kept in /etc/udev/rules.d/90-local.rules (off course you can give any name but with ext .rules and start with some no like 90 here); My udev rules are in 50-udev.rules files which defines the way to mount on USB connection and unmount on USB device disconnect.
I can't believe myself that with simple two lines rule placed in 90-local.rules file m…

Palindrome Number Checking for Int C program Functions

Write a c program to know if given number is palindrome or not?
Well first try to digg out what is palindrome?
A palindrome is a word, phrase, number or other sequence of units that can be read the same way in either direction. Palindrome example is TENT on either direction characters are same.
The most familiar palindromes, in English at least, are character-by-character: the written characters read the same backwards as forwards. Palindromes may consist of a single word (civic, level, racecar, rotator, Malayalam), or a phrase or sentence ("Was it a rat I saw?", "Wasilla: All I saw", "Mr. Owl ate my metal worm", "Sit on a potato pan, Otis", "Neil, a trap! Sid is part alien!", "Go hang a salami I'm a lasagna hog.", "Satan, oscillate my metallic sonatas", "I roamed under it as a tired nude Maori"). Punctuation, case and spacing are usually ignored, although some (such as "Rats live on no evil star&quo…