My Tech notes: December 2008
Subscribe

Unix Documentation

Free Online Unix Training Materials

Lists many links to free Unix training materials.

Pointers and Arrays Materials

Pointers and Arrays materials Explained for C beginners

C FAQ and General Questions C Interview Questions

Powered By

Free XML Skins for Blogger

Powered by Blogger

Tuesday, December 30, 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
>CROSS-COMPILE=arm-linux-

4.Now run make command from that directory.
>make

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 create a file resolv.conf for
DNS entries)

8.For running DHCP client

eth0 :> /sbin/udhcpc -s /usr/share/udhcpc/sample.bound
eth1 :> /sbin/udhcpc -i eth1 -s /usr/share/udhcpc/sample.bound
eth2 :> /sbin/udhcpc -i eth2 -s /usr/share/udhcpc/sample.bound

9.For running DHCP server

interface : Change the interface in config file udhcpd.conf in /etc
directory to the interface on which you want to run.
Ex: interface eth0 (for running server on eth0 interface)

>/usr/sbin/udhcpd

Sunday, December 21, 2008

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 NFS".
4) Now give the boot options to the kernel so that it mounts the NFS directory. From the main menu of kernel configuration select "Boot Options" and select "Default kernel command string". Here give something like the following:
root=/dev/nfs rw nfsroot=192.168.xx.xx:/home/xyz/fs_image ip=192.168.yy.yy:192.168.xx.xx::::eth0:off mem=32M@0x0 console=ttyMCS

Where 192.168.xx.xx is the server IP i.e where the actual Root File system exists. And 192.168.yy.yy is the Board's IP address.

5) Save the kernel configuration. Go to the "dev" folder inside the "fs_image" and create a device entry for ttyMCS by giving "mknod ttyMCS c 204 32". Also create a soft link ttyS0. "ln -s ttyMCS ttyS0". If it is not there. You need to be in root to do this.

6) Now create a kernel image with modified configuration.
7) Next, Setup the NFS server side. Open the /etc/exports file and add the following line
/home/xyz/fs_image/ 192.168.2.yy.yy (rw,no_root_squash)

Save and exit the file.
8) Restart the two services in the server PC.
# service portmap restart
# service nfs restart
9) On the board, from the bootloader Remove the Bootargs, since by having this will override kernel command line arguments. Just give "setenv bootargs" to unset.
10) Next step is to just do TFTP of the kernel image and run "bootmf".

Any question and doubts put comments.

Saturday, December 20, 2008

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.

Friday, December 19, 2008

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

1. Boot from IROM
2. Boot from SPI flash

IROM code will be a one time programmable on-chip memory. This memory should be enough to hold a minimal boot loader. This memory will have the capability of XIP. On power-up, if boot strap selects this mode of operation IROM code will initialize the hardware. After initialization is over the code will be relocated to DDR.
Basic operations provided in the boot loader will be
1. Memory read
2. Memory write
3. SPI & I2C EEPROM support
4. SPI Flash read, write & erase
5. TFTP support for Upgrade
Algorithm for the boot-up procedure from IROM
1. On power-up IROM will be mapped to address 0x00 by H/W.
2. Read the configuration data from I2C/SPI memory for configuring memory controller and SPI Flash Support.

a. If I2C EEPROM is not present, I2C flag provided by the ASIC will be cleared. Thus boot loader can do a conditional read, either from SPI EEPROM or I2C EEPROM.
b. When neither SPI EEPROM nor I2C EEPROM has the configuration data, default configuration will be used.
3. Configure the memory controller and SPI Flash support

4. The IROM code will be relocated to the DDR
5. Control of execution will be transferred to DDR.

In summary
Internal bootloader (IBoot) is present in the IROM memory of the chip and the main purpose of this is to do the critical initializations. The IBoot is divided into following.
Booting procedure:
• Jump to Internal ROM address 0xE8000100.
• Initialize CPU (peripheral port configuration).
• Disable the IROM on region0 i.e. at address 0x00 so that DDR can be configured.
• Initialize DDR memory controller.
• Check for PCIe RC/EP mode and if EP mode is enabled then configure the device properties.
• Check for external booting mode and if it is enabled relocate code from SPI flash and execute it.
• If external booting is not enabled then relocate the IBoot code from IROM to RAM and jump to the start_iboot ().
• Initialize UART with baud rate 57600.
• Initialize the stack.
• Print the IBoot command prompt.
• Now IBoot is ready to execute commands given by the user.

Thursday, December 18, 2008

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/libfuse.so -ldl
../lib/.libs/libfuse.so: 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 ../libntfs/.libs/libntfs.so -L/usr/local/lib /usr/local/lib/libfuse.so -ldl
/usr/local/lib/libfuse.so: undefined reference to `clock_gettime'
collect2: ld returned 1 exit status
make[2]: *** [ntfsmount] Error 1
make[2]: Leaving directory `/home/bhagwat/ntfsprogs-2.0.0/ntfsprogs'

so go to ntfsprogs and change the -ldl option to -lrt in Makefile.
and done.
I got successfully compiled ntfsprogs and got ntfsmount for my embedded linux box.
Note:- I have compiled these utilities in Scratchbox is a cross-compilation toolkit designed to make embedded Linux application development easier.
Also note that FUSE require libpthred lib in scratchbox home, before compiling setup libpthred also.
The shortcut to all this compilation error and efforts is use Debian pre-compiled source for ntfsprogs for ARM.

Wednesday, December 17, 2008

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
use :- CONVERT F: /FS:NTFS
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 to cleanse the free space on a logical disk. SDelete accepts wild card characters as part of the directory or file specifier.
usage is to securely delete existing files (replacement of delete). or in other words Delete Files Permanently from your Computer.
why use sdelete?
When you delete files or folders, the data is not initially removed from the hard disk. Instead, the space on the disk that was occupied by the deleted data is "deallocated." After it is deallocated, the space is available for use when new data is written to the disk. Until the space is overwritten, it is possible to recover the deleted data by using a low-level disk editor or data-recovery software.
To view help at the command-line, at the command prompt, type the following:
CommandName /?

Tuesday, December 16, 2008

dda housing scheme 2008 results at www.dda.org.in

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 www.dda.org.in 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.
ALLOTMENTS TO CTRL GOV PSU, AMBEDKAR AWAS YOJNA, CGHS, DDA HOUSING SCHEME 2006, DDA HOUSING SCHEME 2008, DWARKA HIG HOUSING SCHEME 2003 ...
www.dda.org.in
direct link is dda.org.in/housing/results/reg_results.asp
dda, dda housing scheme 2008, dda delhi, dda website, dda results

dda, www.dda.org.in, dda draw result, urbanindia.nic.in, dda draw 2008
DDA had launched the Housing Scheme on August 6 this year.
reports hindustan times. dda, dda housing scheme 2008, dda.org.in, dda.org, www.dda.com
delhi development authority, dda housing scheme 2008, dda delhi, dda draw, dda housing scheme 2008 results.
site is coming slow have patience. Draw Results

Monday, December 15, 2008

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.


Example:

Kernel Module:
#include
#include

char name[]="user_program";

static int init_function(void)
{
int ret;
char *argv[] = {name, "hello", "world", NULL };
static char *envp[] = { "HOME=/",
"TERM=linux",
"PATH=/sbin:/usr/sbin:/bin:/usr/bin",
NULL };

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


ret= call_usermodehelper(name, argv, envp, 1);
if ( ret <>
#include
int main(int argc,char *argv[],char *envp[])
{
int i=0,fd;

fd=open("/dev/ttyMCS",O_WRONLY);
if( fd <>

Sunday, December 14, 2008

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.
Ruby.rewrite(Ruby).001.png by raganwald

Friday, December 12, 2008

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 www.ancientx.com
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 which they where found is Precambrian - and dated to 2.8 billion years old!
The Dropa Stones
The spiral groove, it turns out, is actually composed of tiny hieroglyphics that tell the incredible story of spaceships from some distant world that crash-landed in the mountains.
The Ica Stones
The most astonishing etchings, however, clearly represent dinosaurs - brontosaurs, triceratops (see photo), stegosaurus and pterosaurs.
The Antikythera Mechanism
The Baghdad Battery
The Coso Artifact
Ancient Model Aircraft
Giant Stone Balls of Costa Rica
Impossible Fossils
 blog it

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 www.dailygalaxy.com
Nanotechnology_main
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 nanotechnology
Making societal technology
choices based on religion is like altering the economy based on a
knowledge of macramé: it might be something you care about in your
daily life, but that doesn't make it valid for everyone else.
 blog it

Monday, December 1, 2008

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.

The next time you have to make a difficult moral decision, you might think twice about mulling it over in the bath or shower.
New research in Psychological Science has found that the physical notion of cleanliness significantly reduces the severity of moral judgments showing that intuition, rather than deliberate reasoning, can influence our perception of what is right and wrong.
“When we exercise moral judgment, we believe we are making a conscious, rational decision, but this research shows that we are subconsciously influenced by how clean or ‘pure’ we feel.
“Take for example the situation of a jury member or voting in an election - if the jury member had washes their hands prior to delivering their verdict, they may judge the crime less harshly.”
Similarly, someone may find it easier to overlook a political misdemeanor had they performed an action that made them feel ‘clean’ prior to casting their vote.”
 blog it