Embedded Linux
Information Technology Institute (ITI)
Sherif Mousa
Embedded Linux @ Information Technology Institute 1
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
Embedded Linux @ Information Technology Institute 2
What is Embedded Linux
???
Embedded Linux @ Information Technology Institute 3
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.
Embedded Linux @ Information Technology Institute 4
What will we learn?
Embedded Linux @ Information Technology Institute 5
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.
Embedded Linux @ Information Technology Institute 6
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 ……….
Embedded Linux @ Information Technology Institute 7
Embedded Linux
1– Linux Revision
Information Technology Institute (ITI)
Embedded Linux @ Information Technology Institute 8
Agenda
• History
• Linux System Overview
• Terminal, Help, Commands, …….
Embedded Linux @ Information Technology Institute 9
History
Embedded Linux @ Information Technology Institute 10
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
Linux System Overview
Embedded Linux @ Information Technology Institute 13
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
Terminal, Help, Commands, …….
Embedded Linux @ Information Technology Institute 18
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
Embedded Linux @ Information Technology Institute 32
eng.sherif.mosa@gmail.com
http://about.me/shatrix
Embedded Linux @ Information Technology Institute 33