Embedded Linux Systems Bin Li Assistant Professor Dept. of Electrical, Computer and Biomedical Engineering University of Rhode Island
Generic Embedded Systems Structure User Sensors ADC microcontroller Application Actuators DAC IP FPGA Operating System Hardware
Embedded Processors
ARM ARM founded in November 1990 Advanced RISC (Reduced instruction set computing) Machines Company headquarters in Cambridge, UK Processor design centers in Cambridge, Austin, and Sophia Antipolis Sales, support, and engineering offices all over the world Best known for its range of RISC processor cores designs Other products fabric IP, software tools, models, cell libraries - to help partners develop and ship ARM-based SoCs ARM does not manufacture silicon
Application Processors
Embedded Operating Systems It has basic components of an operating system Process management Memory management File management I/O management Network management Main characteristics Configurable Real-time
Embedded Operating Systems
Linux Operating Systems A free Unix-type operating system originally created by Linus Torvalds with the assistance of developers around the world. The source code for Linux is freely available to everyone. GUI operating system, including many of the tools that Windows users are familiar with such as, A file manager A Window manager A help system A configuration. Requiring less system resources. A Linux based system can operate smoothly on a 386 or 486.
Access to Department Linux Systems If you are using Windows, download and install PuTTy.exe In HostName (or IP address), input mermaid.ele.uri.edu Connection type: SSH Login using your ELE user name and password
SSH Widely used utilities to login through a network in Unix environment are telnet and rlogin Problem - user's login name and password transmitted as clear text Data transmission after login - also in clear text! SSH, the Secure Shell is a powerful, software-based approach to network security that provides a secure channel for data transmission through a network
Transmit files from Windows to Linux Download and install WinSCP.exe In HostName (or IP address), input mermaid.ele.uri.edu Input your ELE user name and password
Basic Linux Commands File Handling Text Processing System Administration Process Management Archival Network File Systems Advanced Commands
Sources to Learn Commands Primary man (manual) pages man <command> - shows all information about the command <command> --help shows the available options for that command Secondary Books and Internet
File Handling Commands mkdir make directories Usage: mkdir [OPTION] DIRECTORY eg. mkdir test ls list directory contents Usage: ls [OPTION] [FILE] Eg. ls, ls l, ls test cd changes directories Usage: cd [DIRECTORY] Eg. cd test
File Handling (Cont ) pwd print name of current working directory Usage: pwd vim vi Improved, a programmers text editor Usage: vim [OPTION] [file] Eg., vim file1.txt
File Handling (Cont ) cp copy files and directories Usage: cp [OPTION] SOURCE DEST e.g., cp sample.txt sample_copy.txt cp sample_copy.txt targe_dir cp r sample_dir targe_dir mv move (rename) files Usage: mv [OPTION] SOURCE DEST e.g., mv source.txt target_dir mv old.txt new.txt
File Handling (Cont ) rm remove files or directories Usage: rm [OPTION] FILE Eg. rm file1.txt rm r some_dir find search for files in a directory hierarchy Usage: find [OPTION] [path] [pattern] Eg. find name file1.txt history prints recently used commands Usage: history
Pattern A pattern is an expression that describes a set of strings which is used to give a concise description of a set, without having to list all elements e.g., ab*cd matches anything that starts with ab and ends with cd etc. ls *.txt prints all text files
Text Processing cat concatenate files and print on the standard output Usage: cat [OPTION] [FILE] E.g., cat file1.txt file2.txt cat n file1.txt echo display a line of text Usage: echo [OPTION] [string] E.g., echo I like playing Ping Pong echo $HOME
Text Processing (Cont ) grep print lines matching a pattern Usage: grep [OPTION] PATTERN [FILE] E.g., grep apple sample.txt ifconfig grep inet addr: wc print the number of newlines, words, and bytes in files Usage: wc [OPTION] [FILE] eg., wc file1.txt
Text Processing (Cont ) sort sort lines of text files Usage: sort [OPTION] [FILE] E.g., sort file1.txt sort r file1.txt
Linux File Permissions Each file has an associated permission level This allows the user to prevent others from reading/writing/executing their files or directories Use ls l filename to find the permission level of that file
Permission Levels r means read only permission w means write permission x means execute permission
Linux File Permissions e.g., rwx-rw-r means owner has all three permissions, group has read and write, others have only read permission Read permission -4, write-2, execute -1 e.g., rwx-rw-r-- = 764 673 = rw-rwx-wx
System Administration chmod change file access permissions Usage: chmod [OPTION] [MODE] [FILE] Eg., chmod 744 calculate.sh chmod +x calculate.sh
System Administration (Cont ) passwd update a user s authentication tokens Usage: passwd [OPTION] Eg., passwd who show who is logged on Usage: who [OPTION] E.g., who, who b, who q su change user ID or become super-user Usage: su [OPTION] [LOGIN] E.g., su remo, su
Process Management top view the CPU usage of all processes ps report a snapshot of the current processes Usage: ps [OPTION] E.g., ps, ps el kill to kill a process (using signal mechanism) Usage: kill [OPTION] pid E.g., kill -9 2275
Archival tar to archive a file Usage: tar [OPTION] DEST SOURCE E.g., Compress a file: tar cvf /home/archive.tar /home/original Decompress : tar xvf /home/archive.tar zip package and compress (archive) files Usage: zip [OPTION] DEST SOURCE E.g., zip original.zip original unzip list, text and extract compressed files in a ZIP archive Usage: unzip filename E.g., unzip original.zip
Network Ifconfig set/check configuration values for network interfaces Check network configuration: ifconfig Assign an address: ifconfig eth0 192.168.0.1 Turn off the network interface: ifconfig eth0 down Turn on the network interface: ifconfig eth0 up netstat check network status
Network (Cont ) ssh SSH client (remote login program) Ssh is a program for logging into a remote machine and for executing commands on a remote machine Usage: ssh [OPTION] [USER]@hostname E.g., ssh X guest@10.105.11.20 scp secure copy (remote file copy program) Scp copies files between hosts on a network Usage: scp [OPTIONs] [[user]@host1:file1] [[user]@host2:file2] E.g., scp file1.txt guest@10.105.11.20:~/desktop/
File Systems fdisk partition manipulator E.g., sudo fdisk l mount mount a file system Usage: mount t type device dir E.g., mount /dev/sda5 /media/target umount unmount file systems Usage: umount [OPTIONS] dir device E.g., umount /media/target
File Systems (Cont ) du estimate file space usage Usage: du [OPTION] [FILE] e.g., du df report filesystem disk space usage Usage: df [OPTION] [FILE] e.g., df quota display disk usage and limits Usage: quota [OPTION] e.g., quota -v
Advanced Commands reboot reboot the system Usage: reboot [OPTION] E.g., reboot poweroff power off the system Usage: poweroff [OPTION] E.g., poweroff apt-get -- Install/remove programs/softwares Usage: apt-get install packagename apt-get remove packagename apt-get update
Vi 2 modes Input mode ESC to back to cmd mode Command mode Cursor movement h (left), j (down), k (up), l (right) ^f (page down) ^b (page up) ^ (first char.) $ (last char.) G (bottom page) :1 (goto first line) Swtch to input mode a (append) i (insert) o (insert line after O (insert line before) Delete dd (delete a line) d10d (delete 10 lines) d$ (delete till end of line) dg (delete till end of file) x (current char.) Paste p (paste after) P (paste before) Undo u Search / Save/Quit :w (write) :q (quit) :wq (write and quit) :q! (give up changes)
/bin This directory contains executable files necessary to manage and run the Linux system, including shells (such as bash) and file system management utilities such as cp and rm.
/boot This directory contains your bootloader files, which are required to boot your system
/dev This directory contains special files that are used to represent the various hardware devices installed in the system E.g., screen /dev/ttyusb0 115200
/home This directory contains subdirectories that serve as home directories for each user account on your Linux system.
/lib This directory contains code libraries used by programs in /bin and /sbin. Your kernel modules are also stored in the modules subdirectory of /lib.
/etc This directory contains text-based configuration files used by the system as well as services running on the system. You can edit these files with a text editor to customize how Linux behaves e.g., vi /etc/network/interfaces cd /etc/lighttpd >> cd /etc/apt >> cp sources.list sources.list.bak >> vi sources.list
/var This directory contains a variety of variable data, including your system log files e.g., /var/www/
/media This directory is used by some Linux distributions (such as SUSE Linux) to mount external devices, including CD drives, DVD drives, and floppy drives.
/root This directory is the root user s home directory. Notice that it is located separately from the home directories for other users in /home.
/usr This directory contains application files. In fact, most of the application files used on your system are saved in a subdirectory of /usr