Monday, 30 December 2013

Embedded Linux Basic tutorials

Recently i came across this series on "Getting Started with Embedded Linux" by Michael Eager.

Below are some of the points covered and its really nice tutorial to get started. The content is mostly from the original author and i have just added few points to make it more simpler for myself.

Part 1-> Learning linux for embedded systems

Install Linux

a) Use a separate Linux PC

b) Make your desktop dual boot, with Windows and Linux

c) Use VMware to install virtual machine environment in your existing Windows desktop.

The author recommends the third approach, but if you have resources use first approach. It is always better to include one Linux PC in your existing setups.

Point to be noted :-)

I certainly do not recommend reading Linux source to try to learn how to program Linux. That's like trying to learn to drive by studying how a car's transmission works.

Part 2 : Getting Started with Embedded Linux

a) Open terminal window -> try these commands-> ls,cp, cd, pwd, cat, less, file, man , info, apropos , man apropos, find

b) Learn vi editor basic commands:
  vi filename, :i, :q, Esc y -> select 1 line, p-> paste 1 line, d->delete one line

You can learn more commands using below link:

c) Hierarchical file system->
  •   root->/ -> starting point
  •   /proc ->process directory
  •  /boot -> contains boot program
  •  /bin and /sbin -> programs run by administrators
  •  /dev -> devices both real and virtual
  •   /etc -> system configuration file
  •   /home -> user files
  •   /sys -> system information
  •   /lib -> libraries
  •   /usr -> programs which can be run by users
  •   /tmp -> temporary files
  •   /var -> system logs
Additionally you can see following directories/files as well:
  •  /opt -> Other software and add-on packages that are not part of the default installation
  •  /srv -> site specific data
  • /mnt ->  Mount your filesystems
d) Process structure
  • Try ps various options -> list all processess-> ps alx, ps l, ps -l, ps alx | less
  • init -> Process ID 1 -> created by Linux kernel when system starts

Part 3 : Getting started with Embedded Linux

1) Understand
  • GCC : GNU compiler collection, Binutils: GNU Binary utils, make
  • IDE: Integrated developement environment like Eclipse
  • Text editors: vi, emacs,gedit, kwrite
2) Write first program,

[root@localhost]#vi hello.c

#include <stdio.h>

int main ()

{ printf("Hello World\n");
return 0;


3) Now compile the program

[root@localhost]#gcc -o hello -g -O1 hello.c

gcc : compiler used

-o filename : output file or executable file name

-g level : generate the debugging information ( capital alphabet O (optimized) level in digits 1)
            can be -O0 (for easy debugging alphabet O with digit 0)

4) If no error, run the program

[root@localhost]# ./hello
Hello World

5) If error , try to install the proper packages with

 yum install (for Fedora)

6) GDB: GNU debugger

[root@localhost ~]# gdb hello

GNU gdb (GDB) Fedora (
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i586-redhat-linux-gnu".
For bug reporting instructions, please see:
(gdb) break main
Breakpoint 1 at 0x80483bd: file hello.c, line 5.
(gdb) run
Starting program: /root/hello

Breakpoint 1, main () at hello.c:5
5       { printf ("Hello World\n");
Missing separate debuginfos, use: debuginfo-install glibc-2.10.2-1.i686
(gdb) cont
Hello World

Program exited normally.
(gdb) quit
[root@localhost ~]#

7) The compiler name and debugger name can be different, like
arm-none-eabi-gcc which generates the code for ARM using the EABI (Embedded application binary interface)

Part 4 :  Getting started with Embedded Linux

1) Recommended books/resources :
  • Advanced Programming in the UNIX Environment by W. Richard Stevens
  • The Linux Programming Interface by Michael Kerrisk.

2) Utilities : make, automake, autoconf, libtool, diffutils, wget
  •  make : checks which files need to be compiled ( Makefile) and manages order
  •  automake: generate Makefiles, identifying dependencies and invoking libtool (to create shared libraries
  • autoconf: libraries or programs to be compiled for different targets and OS
  • diffutils: package of several programs related to finding differences between files (diff, diff3, cmp, sdiff)
  • wget : utility for download of files from internet

3) Process

a) Download source files

[root@localhost ~]# wget

b) Untar

[root@localhost ~]# tar xfv diffutils-3.3.tar.xz
[root@localhost ~]# cd diffutils-3.3

c) Read README file in the directory

d) Build the package

 [root@localhost ~]# ./configure
 [root@localhost ~]# make
 [root@localhost ~]# make install

Install to specific directory

 [root@localhost ~]#./configure --prefix=~/mydiff

Part 5 : Getting started with Embedded Linux

For part 5 I recommend you to read the original content

Ref :

Ref :

About the author of these articles:

Michael Eager

Michael Eager is principal consultant at Eager Consulting in Palo Alto, Calif.  He has over four decades experience developing compilers, debuggers, and simulators for a wide range of processor architectures used in embedded systems. His current and former clients include major semiconductor companies and systems developers. Michael has been a member of the ISO C++ Standard Committee and ABI Committees for several processor architectures. He is chair of the Debugging Standards Committee for DWARF, a widely used debug data format. He is active in the open-source and Linux communities.

Thursday, 19 December 2013

What is WAVE, 802.11p ?


1) Wireless access in vehicular environments (WAVE)

2) Added support in 802.11 for Intelligent Transportation Systems (ITS) applications.

3) Applicable ITS band 5.9 GHz (5.85-5.925 GHz).

4) IEEE 1609 is a higher layer standard based on the IEEE 802.11p.

5) There is no association and authentication procedure before exchange of data.

6) Use of wildcard BSSID ( a value of all 1s) in the header of all frames they exchange, and may start communication as soon as they arrive on same communication channel.

7) Addition of new management frame for timing advertisement, which allows IEEE 802.11p enabled stations to synchronize themselves with a common time reference. The only time reference defined in the IEEE 802.11p amendment is UTC or Coordinated Universal Time.

8) Channel rejection requirements can be implemented  (for both adjacent and nonadjacent channels) to avoid out-of-channel interferences. They only apply to OFDM transmissions in the 5GHz band used by the IEEE 802.11a physical layer.

9) Frequecy band : 5.9GHz band (5.850-5.925 GHz) with 5MHz, 10MHz and 20MHz channel spacings, countries: United States , Europe

Ref: Wiki, 802.11p standard

How to change the default MTU size in Windows 7 ?

Steps to follow to change mtu size in Windows 7:

1) Go to Start-> type cmd-> right click on cmd.exe-> select->Run as administrator

2) Using this command prompt give below command to know the existing MTU of interfaces

C:\>netsh interface ipv4 show subinterfaces

MTU  MediaSenseState   Bytes In  Bytes Out  Interface
------  ---------------  ---------  ---------  -------------
4294967295                1          0    1486381  Loopback Pseudo-Interface 1
  1300                1   16167334    2330876  Wireless Network Connection
  1300                5          0          0  Local Area Connection

3) To change give below commands

C:\> netsh interface ipv4 set subinterface "Local Area Connection" mtu=1500 store=persistent

4) View the changed MTU

C:\>netsh interface ipv4 show subinterfaces

MTU  MediaSenseState   Bytes In  Bytes Out  Interface
------  ---------------  ---------  ---------  -------------
4294967295                1          0    1486381  Loopback Pseudo-Interface 1
  1300                1   16167334    2330876  Wireless Network Connection
  1500                5          0          0  Local Area Connection

Saturday, 7 December 2013

RFC 5625 : DNS Proxy Implementation Guidelines

 DNS Proxy RFC


1) The role of the proxy should therefore be no more and no less than to
     receive DNS requests from clients on the LAN side, forward those
     verbatim to one of the known upstream recursive resolvers on the WAN
     side, and ensure that the whole response is returned verbatim to the
     original client.

2)  It is RECOMMENDED that proxies should be as transparent as possible,
   such that any "hop-by-hop" mechanisms or newly introduced protocol
   extensions operate as if the proxy were not there.

3)  Except when required to enforce an active security or network policy
   (such as maintaining a pre-authentication "walled garden"), end-users
   SHOULD be able to send their DNS queries to specified upstream
   resolvers, thereby bypassing the proxy altogether.  In this case, the
   gateway SHOULD NOT modify the DNS request or response packets in any

4) DNS proxies should not arbitrarily reject or otherwise drop requests
     or responses based on perceived non-compliance with standards.

5) Since UDP packets larger than 512 octets are now expected in normal
   operation, proxies SHOULD NOT truncate UDP packets that exceed that

6) Whenever a proxy receives a request over TCP, the proxy
   SHOULD forward the query over TCP and SHOULD NOT attempt the        same query over UDP first.

7) Proxies SHOULD be capable of forwarding UDP packets up to a payload
   size of at least 4096 octets.

8)  As per Section 3, end-users SHOULD be able to send their DNS queries
   directly to specified upstream resolvers, ideally without hard-coding
   those settings in their stub resolver.

9)  It is therefore RECOMMENDED that gateways SHOULD support device-
   administrator configuration of values for the "Domain Name Server"
   DHCP option

10)  It is strongly RECOMMENDED that DNS proxies follow the relevant
   recommendations in [RFC5452], particularly those in Section 9.2
   relating to randomisation of Query IDs and source ports.  This also
   applies to source port selection within any NAT function.

11) If a DNS proxy is running on a broadband gateway with NAT that is
   compliant with [RFC4787], then it SHOULD also follow the
   recommendations in Section 10 of [RFC5452] concerning how long DNS
   state is kept.

12) The DNS proxy in a gateway SHOULD NOT, by default, be accessible from the WAN interfaces of the device.


1)  Proxies MUST ignore any unknown DNS flags and proxy
   packets as usual.

2)  Proxies MUST forward packets regardless of the presence or absence of compressed labels therein. (
   Compression of labels as per Section 4.1.4 of [RFC1035]

3) [RFC3597] requires that resolvers MUST handle Resource Records (RRs)
   of unknown type transparently.

 4)  All requests and responses MUST be proxied regardless of the values
   of the QTYPE and QCLASS fields.

5)  All responses MUST be proxied regardless of the values of the TYPE and CLASS fields of any Resource Record therein.

6)  If a proxy must unilaterally truncate a response, then the proxy MUST
   set the TC bit.  Similarly, proxies MUST NOT remove the TC bit from

7) DNS proxies MUST therefore be prepared to receive and forward queries
   over TCP.

8) As per Section 4.1, proxies MUST NOT refuse to proxy such packets which contain an OPT RR

9)   DNS proxies MUST implement Section 4.7 of [RFC2845] and either
   forward packets unchanged (as recommended above) or fully implement

10)    As per Section 4.3, DNS proxies MUST be capable of proxying packets
   containing TKEY [RFC2930] Resource Records.

11)  Since no standard exists for a "local" scoped domain name suffix, it is RECOMMENDED that the default value for this option SHOULD be empty, and that this option MUST NOT be sent to clients when no value is configured.

Key words for use in RFCs to Indicate Requirement Levels :

 This word, or the terms "REQUIRED" or "SHALL", mean that the
   definition is an absolute requirement of the specification.

 This word, or the adjective "RECOMMENDED", mean that there
   may exist valid reasons in particular circumstances to ignore a
   particular item, but the full implications must be understood and
   carefully weighed before choosing a different course.

Sunday, 1 December 2013

How to write professional mails, some sample professional mails.

I think i have covered it in one of my posts, but this is really important. Yesterday again i got one mail, which has its own mistakes.I am not claiming to be proficient in English or done any majors, but these are very basic and you should try to follow.

1) Read at-least 3 times your mail before sending it. Sometimes we think we have written properly, but if you read it again , you will realize how it is actually.

2) Dont write stories. Be precise and to the point. Write in points if you have multiple things to say.

3) Start first letter in "capital" and follow grammar rules.

4) Salutation: How to  address other person ? Generally private companies do not follow "Sir" policy but its better to confirm in your company. In India some people are used to be called as Sir and Madam, and if you don't use it, they may feel bad. But generally below can be used
  Hi, Hello, Dear ABC,  Dear Mr XYZ

5) Dont use 'Thanks and Regards' instead

Thank you

or just "Regards"

6)  "can you share" instead use "could you share"

7) "Please find the attached file' instead use 'The file has been attached for your reference' or "Please see attachment"

8) "As per your mail' instead use 'According to your mail'

9)'Please revert back' instead use 'Please revert'.

10) Dont use all capital letters it is considered as arrogant.

11) Avoid using exclamation marks, sometimes it may be considered as if you are making fun of them.

12) Avoid short forms or expand it at-least once.

13) Use spell check option, it is there in almost all email clients.