Похожие презентации:
Projects of EE516. Embedded Software. Project 1. “Setting Up Environment for Projects”
1.
EE516:Embedded Software
Project 1.
“Setting Up Environment for Projects”
Dong Jae Shin, PhD student
2016. 09. 01.
2.
ContentsIntroduction to Projects of EE516
Tasks
Setting Up Environment
Virtual Machine Environment
Ubuntu Linux OS Installation
Environment for Development
Tasks
1. Shell Script
2. Simple C Programming
3. Makefile
Report
Problems
Source code submission & Screenshot
General Grading Policy
Computer Engineering Research
3.
Introduction to ProjectsProject 1: Setting up Environment for Project
“Development” Project
Project 2: Linux Fundamental
Project 3: System Call and Synchronization
Project 4: File System
Project 5: Device Driver for Embedded H/W
Especially, including “BeagleBoard Development”
3
Computer Engineering Research
4.
Environment OverviewThrough this course,,,
We will use Ubuntu LINUX as the base OS for the p
rojects.
Do we need new machine for Ubuntu LINUX?
We usually use Windows OS for our own machine
The answer is NO!
We have “Virtual Machine Environment”!
Such as VMware Player
4
Computer Engineering Research
5.
Environment OverviewWhat is “Virtual Machine Environment”?
Software Stack of “Virtual Machine Environment”
Ubuntu
(Guest OS)
…
Others
(Guest OS)
VMware Player
(Virtualization Layer from VMware)
Host OS (e.g. Windows)
(Your host OS installed on the machine)
Physical Resources of Your own machine
(CPU, MEM, STORAGE, NETWORK ..)
5
Computer Engineering Research
6.
Install Virtual Machine Monitor“Virtual Machine Environment”
Download VMware Player (
https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_
workstation_player/12_0
) or
(http://core.kaist.ac.kr/~ djshin/VMware-player-12.0.0-2985596.exe )
Depends on your OS
Windows-64bit
Linux-64bit
You need 64-bit Operating System.
If you don’t have, please contact TA.
6
Computer Engineering Research
7.
Install Virtual Machine MonitorInstall VMM
Install the product following the instructions of the i
nstaller
Installation Path
7
Enter your e-mail
Run VMware Player
Computer Engineering Research
8.
Install Guest OSWe’ll use Linux OS for Guest
Linux
made by Linus Torvalds in 1991
Free software for replacing Unix
Many usages - servers, desktops, mobile devices(Android)
Linux Distributions
Operating Systems based on Linux Kernel
Linux Kernel : Core of Linux
Scheduling, File System, Device Drivers
System Software : Compilers, Libraries, User Interface
User Program : Office, DB, Web Server, Web Browser, Mail …
8
Computer Engineering Research
9.
Install Guest OSDownload Ubuntu Linux
http://www.ubuntu.com/download/desktop
ubuntu-14.04.3-desktop-amd64.iso
or http://core.kaist.ac.kr/~
djshin/ubuntu-14.04.3-desktop-amd64.iso
9
Computer Engineering Research
10.
Install Guest OSCreate your own Virtual Machine
Select New Virtual Machine
10
Downloaded File Path
Login Password
Computer Engineering Research
11.
Install Guest OSVirtual Machine Properties
Disk Size : 20GB is enough Main Memory Size for VM
Number of processor for VM
Need free space in HDD
more than 1GB
11
Computer Engineering Research
12.
Install Guest OSInitialize Ubuntu Desktop
it takes several minutes.
12
log-in with your
password
open terminal (ctrl +
alt + T)
Computer Engineering Research
13.
Install Guest OSGet root account & password
root account : the highest level account for administrator
It is needed when
change system configuration
install programs
execute system-level program
cannot reboot
create root
password
13
you are the root
now
Computer Engineering Research
14.
Shell ScriptShell
A command line interpreter
CLI
Accepts input from the user
Executes the command that is given
Types of Shell
Command Line Interface (CLI) shell
Based on text
GUI
Graphic User Interface (GUI) shell
Based on graphic
e.g. x-window system in linux
14
Computer Engineering Research
15.
Shell ScriptVarious CLI Shells
Bourne Shell (1977) == sh
bourne shell (sh)
Developed by Steve Bourne @ AT
&T Bell lab.
First shell of UNIX system
Bourne-again shell (1989) == b
ash
Developed by Brain Fox
Basis of shells on UNIX/LINUX type
bash shell : Ubuntu
default
system
Recent systems also use bash
15
Computer Engineering Research
16.
Shell ScriptCSH (C shell)
Developed by Bill Joy
C-language-like shell interpretation
TCSH (Tenex C shell)
Tenex: OS from Carnegie Mellon Univ.
Enhanced version of CSH for Tenex system
16
Computer Engineering Research
17.
Shell ScriptCommand execution on Shell
ls : List information about file(s)
cat : Display the contents of a file
echo : Print string
mkdir : Create new folder(s)
rmdir : Remove folder(s)
pwd : Display current directory
cd : Change current directory
cp : Copy one or more files to an
other location
mv : Move or rename files or dire
ctories
rm : Remove files
17
Computer Engineering Research
18.
Writing a Shell ScriptText Editor
gedit : GUI based text editor
vi, vim : CLI based text editor
install vim
apt-get install vim
you can use any text editor
ubuntu:~$ gedit
18
ubuntu:~$ vim
test.sh
Computer Engineering Research
19.
Writing a Shell ScriptWriting a Simple Script
$ vim test.sh
simple source code
or $ gedit test.sh
save file
$ chmod 755 test.sh
$ ./test.sh
execution
$ ./test.sh something
Shell Script Guide
http://linuxconfig.org/bash-scripting-tutorial
19
Computer Engineering Research
20.
tree -d20
Computer Engineering Research
21.
Writing a C ProgramWriting a C Program
$ vim hello
simple source code
or $ gedit hello.c
save file
$ gcc hello.c -o hello
$ ./hello
compile & execution
C Program Guide
http://www.gnu.org/software/gnu-c-manual/gnu-c-manual.pdf
https://
classes.soe.ucsc.edu/cmpe013/Spring10/notes/C%20Programming%
20Guide.pdf
21
Computer Engineering Research
22.
Make UtilityUtility for automatically building executable p
rograms and libraries from source code
Help build programs from numbers of source cod
e files
Manage dependency among source code files an
d compiling method
Prevent mistake
$ gcc –o hello hello.c
Correct
$ gcc –o hello.c hello.c
source code will be gone!
22
Computer Engineering Research
23.
Make SyntaxSyntax
<Target>: <dependency>
<Compile command>
$ make program
Will compile “program”
After all compilation of others because of dependency
This empty space
should be “tab” not
“space”
23
Computer Engineering Research
24.
Makefile Example24
Computer Engineering Research
25.
Macro of MakefileSimilar as “#define” of C programming
Useful for repeated expression
Below will do same compilation as previous slide
$ make all : compile every BINs
$ make clean : delete every BINs
25
Computer Engineering Research
26.
Task1. Tree ScriptWrite a bash shell script that shows tree stru
cture of the directories and files included in y
ou own home directory.
Example of Task1
26
Computer Engineering Research
27.
Task2. Simple C ProgramBenchmark
Computer program in order to assess the relative per
formance of an object, normally by running a numbe
r of standard tests and trials against it
We can make File System Benchmark!
with Sequential Access and Random Access
Access 1
Order
2
Logical
Block
2
1
Sequential
Access
Random Access
3
4
5
6
7
2
5
3
1
4
7
6
3
4
5
6
7
1
2
3
4
5
6
7
Example of Task1
27
Computer Engineering Research
28.
Task2. Simple C ProgramSample code is here
http://core.kaist.ac.kr/~djshin/fsbench_sample.c
File create Sequential Write Sequential Read Ran
dom Write Random Read File Delete End
You should Implement 3 functions
You can refer “file_write_sequential()” function
void file_read_sequential()
: about 20 lines
void file_write_random()
: about 25 lines
void file_read_random()
: about 25 lines
Example of Task1
28
Computer Engineering Research
29.
Task2. Simple C ProgramCompile & Execute Sample Code
Implement 3 operations : Sequential Read, Random Write,
Random Read
29
Computer Engineering Research
30.
Task2. Simple C ProgramExample of Task2
30
Computer Engineering Research
31.
Task3. MakefileWrite a Makefile for the source code of Task2
Test cases
make all
make clean
Example Result of
Task3
31
Computer Engineering Research
32.
SubmissionContents
Source Code
Report
Answer to the questions
Key point of your Source Code
Screenshots (Task 1, 2, 3)
Page Limit : about 5 page (except figures)
Submission
Due Date : Sept. 19 ,PM 23:59
E-mail : [email protected]
[EE516] student_number.zip
(various compression format is allowed)
Computer Engineering Research
33.
General Grading PolicyRatio of Grading
Tasks : 70%
Code operation(exception handling), Code readability
No errors and warnings
Report : 30%
Free-form
Problems, Key point of your Source Code, Screenshots of Results
Page Limit : about 5 page (except figures)
Delay Penalty
10%/day (AM 00:00)
Source Code Copying will deduct all of your points
should mention if you referenced it
Computer Engineering Research
34.
How to Transfer your filesCompression and Extraction
tar.gz
$ tar -czvf compressed_file_name.tar.gz dir_name
$ tar -xzvf compressed_file_name.tar.gz
zip
$ zip compressed_file_name.zip dir_name
$ unzip compressed_file_name.zip
File Transfer between Host Window and VM
Just Copy and Paste
Ctrl + C
Ctrl + V
Computer Engineering Research