Embedded Linux
Information Technology Institute (ITI)
Sherif Mousa
Embedded Linux @ Information Technology Institute 1
2
Embedded Linux @ Information Technology Institute
Who Am I ?
• 2010
– B.Sc. In Computer Engineering
• GP
– Manara GPS Navigator
– 2nd place in MIE 2010
• 2010 – 2011
– Embedded Linux Developer at PEPArab
• 2012 - 2013
– 9 Month Diploma, ITI, intake 33
– Mobile Applications Development
• 07 / 2013 – present
– Application Developer at IBM
– Android and Hybrid Mobile Apps
• 2014
– Embedded Linux instructor at ITI
– Mentor for graduation projects at ITI
3
What is Embedded Linux
???
Embedded Linux @ Information Technology Institute
What is Embedded Linux
• Embedded Linux is the use of Linux in
embedded computer systems such as mobile
phones, media players, set-top boxes,
networking equipment, machine control,
industrial automation, navigation equipment,
medical instruments ………..
• Creating an Embedded Linux based system is
like a puzzle. Putting the right pieces together
will create the final image.
4
Embedded Linux @ Information Technology Institute
5
What will we learn?
Embedded Linux @ Information Technology Institute
What will we learn?
• To be professional with Linux terminal &
commands.
• To understand how Linux OS was built.
• To understand the difference between
desktop versions of Linux & embedded ones.
• To learn new expressions (Cross-Compiling,
Tool-Chain, …..).
• To know how to deal with Linux source code
programs.
6
Embedded Linux @ Information Technology Institute
What will we learn?
• The old school
– To get and compile Linux kernel from scratch.
– To build a custom file-system for Linux.
– To work with H.W. emulators for other
architectures.
– To build your own full Linux distribution for any
computer architecture.
• To know how to work with development kits.
• And more ……….
7
Embedded Linux @ Information Technology Institute
Embedded Linux
Information Technology Institute (ITI)
Embedded Linux @ Information Technology Institute 8
1– Linux Revision
Agenda
• History
• Linux System Overview
• Terminal, Help, Commands, …….
9
Embedded Linux @ Information Technology Institute
10
History
Embedded Linux @ Information Technology Institute
History
• Unix (Ken Thompson & Dennis Ritchie) AT&T
company
• FSF & GNU (Gnu is Not Unix) & GPL (Richard
Stallman) 1984
– Hurd Kernel
• Minix (Andrew Tanenbaum)
• Linux (Linus Torvalds) 1991
Embedded Linux @ Information Technology Institute 11
History (cont’d)
• GNU/Linux (complete, open source, UNIX-like
operating system)
• Open source: software and source code
available to all
– The freedom to distribute software and source
code
– The ability to modify and create derived works
– Integrity of author's code
Embedded Linux @ Information Technology Institute 12
13
Linux System Overview
Embedded Linux @ Information Technology Institute
Linux Principles
• Everything is a file (including hardware)
• Small, single-purpose programs
• Ability to chain programs together to perform
complex tasks
• Avoid user interfaces
• Configuration data stored in text
Embedded Linux @ Information Technology Institute 14
Linux Structure
• BootLoader (grub, uboot, vivi)
• Kernel (www.kernel.org)
• Filesystem (FHS)
• shell (bash & ash & sh)
• init process
• Scripts & Environment variables
• Applications
• GUIs & TUI
Embedded Linux @ Information Technology Institute 15
Filesystem Hierarchy Standard
/ root directory
/bin commands & executable files
/sbin system commands & executable files
/boot kernel & bootloader
/dev hardware device files (nodes)
/etc configuration files and startup scripts
/home users home directories
/root root home directory
/lib shared library files
/media mount points for storage media
/opt third parity applications
/proc virtual process files
/usr other users applications & libraries
/var files that change a lot
Embedded Linux @ Information Technology Institute 16
Inner View
• Gnome & Kde (X Window system)
• root & users
• Common applications
– gedit, nautilus
• Terminal
• Virtual console
• file types
– normal (text, audio, document)
– directory
– special (node, pipe, link (symbolic & hard))
Embedded Linux @ Information Technology Institute 17
18
Terminal, Help, Commands, …….
Embedded Linux @ Information Technology Institute
Commands & help
• command [option(s)] [parameter(s)]
• man
• info
• --help
Embedded Linux @ Information Technology Institute 19
Common commands
• Absolute and Relative Path names
• Commands
– cd change directory
– pwd print current working directory
– ls list files in current directory
– cp copy
– mv move & rename
– touch create a new file
– mkdir create a directory
– rm remove files
– file file type
– cat print file contents
– less view file contents in pages
– passwd change user's password
Embedded Linux @ Information Technology Institute 20
man
• man sections 1 5 8
• Display manual page descriptions
– man -f command
– whatis
• Search the manual page names and
descriptions
– man -k pattern
– apropos pattern
Embedded Linux @ Information Technology Institute 21
Text editing tools
• Terminal-based editors
– nano
– vim
• modes
• keyboard shortcuts
• GUI-based editors
– gedit
Embedded Linux @ Information Technology Institute 22
Permissions
• ls -l
- | --- | --- | ---
- | rwx | rwx | rwx
t | own | grp | other
• chmod
– letter mode
– numeric mode
• Users & Groups
– chown
– chgrp
Embedded Linux @ Information Technology Institute 23
Programs Packages (debian)
• apt-get install automatically
– install update remove
• dpkg –i install manually
– .deb packages
• Source packages
– ./configure [options] (not always)
– make
– make install
Embedded Linux @ Information Technology Institute 24
Programs Packages (rpm)
• yum install automatically
– install update remove
• rpm -ivh install manually
– .rpm packages
Embedded Linux @ Information Technology Institute 25
System information commands
• whoami print effective current user
• hostname show or set the system's host name
• date print or set the system date and time
• uptime Tell how long the system has been running
• uname print system information
• free Display amount of free and used memory
• df report file system disk space usage
• du estimate file space usage
du -sh file-or-folder-name
• mount mount filesystems
• umount unmount filesystems
• blkid print block device attributes
Embedded Linux @ Information Technology Institute 26
Pipe & Redirection
• cat file-name | less
• Standard output
– command > file
• Standard error
– command 2> file
• The Black hole
– /dev/null
Embedded Linux @ Information Technology Institute 27
File Search tools
• whereis locate the location for a
command
– whereis command
– whereis -b command
• locate find files by name from DB
– locate file-name
– updatedb
• find search for files in a directory hierarchy
– find path-to-search-in -name search-word
Embedded Linux @ Information Technology Institute 28
Text files search tools
• grep print lines matching a pattern
– grep search-pattern file-name
– grep -v
– cat file-name | grep pattern
• cut remove sections from each line of
files
– cut -d”delimiter” -f”field” file-name
– cut -d: -f1 /etc/passwd
• Print the shell for a user
– grep root /etc/passwd | cut -d: -f7
Embedded Linux @ Information Technology Institute 29
Process Management
• ps report a snapshot of the current processes
– ps axu
– ps axo
• top display Linux tasks
• pidof find the process ID of a running program
• kill send a signal to a process
– kill pid
– kill -s signal-number pid
• killall kill processes by name
– killall process-name
Embedded Linux @ Information Technology Institute 30
Archiving
• The GNU version of the tar archiving utility
– tar cf myfile.tar myfolder
– tar xvf myfile.tar
– tar xvf myfile.tar.bz2
– tar xvfz myfile.tar.gz
Embedded Linux @ Information Technology Institute 31
32
Embedded Linux @ Information Technology Institute
eng.sherif.mosa@gmail.com
http://about.me/shatrix
33
Embedded Linux @ Information Technology Institute

00000001_Embedded_Linux_RevisionFile.pdf

  • 1.
    Embedded Linux Information TechnologyInstitute (ITI) Sherif Mousa Embedded Linux @ Information Technology Institute 1
  • 2.
    2 Embedded Linux @Information Technology Institute Who Am I ? • 2010 – B.Sc. In Computer Engineering • GP – Manara GPS Navigator – 2nd place in MIE 2010 • 2010 – 2011 – Embedded Linux Developer at PEPArab • 2012 - 2013 – 9 Month Diploma, ITI, intake 33 – Mobile Applications Development • 07 / 2013 – present – Application Developer at IBM – Android and Hybrid Mobile Apps • 2014 – Embedded Linux instructor at ITI – Mentor for graduation projects at ITI
  • 3.
    3 What is EmbeddedLinux ??? Embedded Linux @ Information Technology Institute
  • 4.
    What is EmbeddedLinux • Embedded Linux is the use of Linux in embedded computer systems such as mobile phones, media players, set-top boxes, networking equipment, machine control, industrial automation, navigation equipment, medical instruments ……….. • Creating an Embedded Linux based system is like a puzzle. Putting the right pieces together will create the final image. 4 Embedded Linux @ Information Technology Institute
  • 5.
    5 What will welearn? Embedded Linux @ Information Technology Institute
  • 6.
    What will welearn? • To be professional with Linux terminal & commands. • To understand how Linux OS was built. • To understand the difference between desktop versions of Linux & embedded ones. • To learn new expressions (Cross-Compiling, Tool-Chain, …..). • To know how to deal with Linux source code programs. 6 Embedded Linux @ Information Technology Institute
  • 7.
    What will welearn? • The old school – To get and compile Linux kernel from scratch. – To build a custom file-system for Linux. – To work with H.W. emulators for other architectures. – To build your own full Linux distribution for any computer architecture. • To know how to work with development kits. • And more ………. 7 Embedded Linux @ Information Technology Institute
  • 8.
    Embedded Linux Information TechnologyInstitute (ITI) Embedded Linux @ Information Technology Institute 8 1– Linux Revision
  • 9.
    Agenda • History • LinuxSystem Overview • Terminal, Help, Commands, ……. 9 Embedded Linux @ Information Technology Institute
  • 10.
    10 History Embedded Linux @Information Technology Institute
  • 11.
    History • Unix (KenThompson & Dennis Ritchie) AT&T company • FSF & GNU (Gnu is Not Unix) & GPL (Richard Stallman) 1984 – Hurd Kernel • Minix (Andrew Tanenbaum) • Linux (Linus Torvalds) 1991 Embedded Linux @ Information Technology Institute 11
  • 12.
    History (cont’d) • GNU/Linux(complete, open source, UNIX-like operating system) • Open source: software and source code available to all – The freedom to distribute software and source code – The ability to modify and create derived works – Integrity of author's code Embedded Linux @ Information Technology Institute 12
  • 13.
    13 Linux System Overview EmbeddedLinux @ Information Technology Institute
  • 14.
    Linux Principles • Everythingis a file (including hardware) • Small, single-purpose programs • Ability to chain programs together to perform complex tasks • Avoid user interfaces • Configuration data stored in text Embedded Linux @ Information Technology Institute 14
  • 15.
    Linux Structure • BootLoader(grub, uboot, vivi) • Kernel (www.kernel.org) • Filesystem (FHS) • shell (bash & ash & sh) • init process • Scripts & Environment variables • Applications • GUIs & TUI Embedded Linux @ Information Technology Institute 15
  • 16.
    Filesystem Hierarchy Standard /root directory /bin commands & executable files /sbin system commands & executable files /boot kernel & bootloader /dev hardware device files (nodes) /etc configuration files and startup scripts /home users home directories /root root home directory /lib shared library files /media mount points for storage media /opt third parity applications /proc virtual process files /usr other users applications & libraries /var files that change a lot Embedded Linux @ Information Technology Institute 16
  • 17.
    Inner View • Gnome& Kde (X Window system) • root & users • Common applications – gedit, nautilus • Terminal • Virtual console • file types – normal (text, audio, document) – directory – special (node, pipe, link (symbolic & hard)) Embedded Linux @ Information Technology Institute 17
  • 18.
    18 Terminal, Help, Commands,……. Embedded Linux @ Information Technology Institute
  • 19.
    Commands & help •command [option(s)] [parameter(s)] • man • info • --help Embedded Linux @ Information Technology Institute 19
  • 20.
    Common commands • Absoluteand Relative Path names • Commands – cd change directory – pwd print current working directory – ls list files in current directory – cp copy – mv move & rename – touch create a new file – mkdir create a directory – rm remove files – file file type – cat print file contents – less view file contents in pages – passwd change user's password Embedded Linux @ Information Technology Institute 20
  • 21.
    man • man sections1 5 8 • Display manual page descriptions – man -f command – whatis • Search the manual page names and descriptions – man -k pattern – apropos pattern Embedded Linux @ Information Technology Institute 21
  • 22.
    Text editing tools •Terminal-based editors – nano – vim • modes • keyboard shortcuts • GUI-based editors – gedit Embedded Linux @ Information Technology Institute 22
  • 23.
    Permissions • ls -l -| --- | --- | --- - | rwx | rwx | rwx t | own | grp | other • chmod – letter mode – numeric mode • Users & Groups – chown – chgrp Embedded Linux @ Information Technology Institute 23
  • 24.
    Programs Packages (debian) •apt-get install automatically – install update remove • dpkg –i install manually – .deb packages • Source packages – ./configure [options] (not always) – make – make install Embedded Linux @ Information Technology Institute 24
  • 25.
    Programs Packages (rpm) •yum install automatically – install update remove • rpm -ivh install manually – .rpm packages Embedded Linux @ Information Technology Institute 25
  • 26.
    System information commands •whoami print effective current user • hostname show or set the system's host name • date print or set the system date and time • uptime Tell how long the system has been running • uname print system information • free Display amount of free and used memory • df report file system disk space usage • du estimate file space usage du -sh file-or-folder-name • mount mount filesystems • umount unmount filesystems • blkid print block device attributes Embedded Linux @ Information Technology Institute 26
  • 27.
    Pipe & Redirection •cat file-name | less • Standard output – command > file • Standard error – command 2> file • The Black hole – /dev/null Embedded Linux @ Information Technology Institute 27
  • 28.
    File Search tools •whereis locate the location for a command – whereis command – whereis -b command • locate find files by name from DB – locate file-name – updatedb • find search for files in a directory hierarchy – find path-to-search-in -name search-word Embedded Linux @ Information Technology Institute 28
  • 29.
    Text files searchtools • grep print lines matching a pattern – grep search-pattern file-name – grep -v – cat file-name | grep pattern • cut remove sections from each line of files – cut -d”delimiter” -f”field” file-name – cut -d: -f1 /etc/passwd • Print the shell for a user – grep root /etc/passwd | cut -d: -f7 Embedded Linux @ Information Technology Institute 29
  • 30.
    Process Management • psreport a snapshot of the current processes – ps axu – ps axo • top display Linux tasks • pidof find the process ID of a running program • kill send a signal to a process – kill pid – kill -s signal-number pid • killall kill processes by name – killall process-name Embedded Linux @ Information Technology Institute 30
  • 31.
    Archiving • The GNUversion of the tar archiving utility – tar cf myfile.tar myfolder – tar xvf myfile.tar – tar xvf myfile.tar.bz2 – tar xvfz myfile.tar.gz Embedded Linux @ Information Technology Institute 31
  • 32.
    32 Embedded Linux @Information Technology Institute
  • 33.