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:
http://www.cs.colostate.edu/helpdocs/vi.html
c) Hierarchical file system->
Part 3 : Getting started with Embedded Linux
1) Understand
2) Utilities : make, automake, autoconf, libtool, diffutils, wget
3) Process
a) Download source files
[root@localhost ~]# wget ftp://ftp.gnu.org/gnu/diffutils/diffutils-3.3.tar.xz
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
http://www.embedded.com/electronics-blogs/open-mike/4425954/Getting-started-with-Embedded-Linux--Part-Five
Ref :
http://www.linuxtopia.org/online_books/linux_beginner_books/linux_filesystem/opt.html
Ref : http://www.embedded.com/electronics-blogs/4420670/Open-Mike
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.
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:
http://www.cs.colostate.edu/helpdocs/vi.html
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 (6.8.50.20090302-21.fc11)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb)
(gdb)
(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
Continuing.
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 :
[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 (6.8.50.20090302-21.fc11)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb)
(gdb)
(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
Continuing.
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.
- http://stackoverflow.com/
- http://www.fsf.org/
- http://gnu.mirrors.pair.com/gnu/
- http://sourceforge.net/
- http://freecode.com/
- https://github.com/
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 ftp://ftp.gnu.org/gnu/diffutils/diffutils-3.3.tar.xz
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
http://www.embedded.com/electronics-blogs/open-mike/4425954/Getting-started-with-Embedded-Linux--Part-Five
http://www.linuxtopia.org/online_books/linux_beginner_books/linux_filesystem/opt.html
Ref : http://www.embedded.com/electronics-blogs/4420670/Open-Mike
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.