Operating System Lab 1 Using Linux and Lab
Operating System Lab 1 Using Linux and Lab Setup OS Lab 1 TA:王嘉豪 Addr. :地理馆314 E-mail:jiahaowang@stu. ecnu. edu. cn QQ: 523102520 Da. SE
Operating System Lab 1 Outline • Lab Goal && what is pintos • Lab Setup • Install the Virtual. Box • Install the project environment • Linux Introduction • Linux command • Basic commands • Handle files and directories • Editor: Vim • Compiler: gcc • Bochs and Pintos install Da. SE
Operating System Lab 1 Lab goal • Analyze and improve a small operating system (Pintos) and , make a deeper understanding of the principle of operating systems and implementation mechanism. Da. SE
Operating System Lab 1 What is pintos • Welcome to Pintos is a simple operating system framework for the 80 x 86 architecture. It supports kernel threads, loading and running user programs, and a file system, but it implements all of these in a very simple way. • In the Pintos projects, you and your project team will strengthen its support in all three of these areas. You will also add a virtual memory implementation. Da. SE
Operating System Lab 1 4 projects in pintos Da. SE
Operating System Lab 1 Install the Virtual. Box • What is Virtual. Box? • Download Virtual. Box • Homepage: https: //www. virtualbox. org/ • Downloads: ftp: //58. 198. 176. 47/pub/oslab/ch-01/resources/Virtual. Box-5. 1. 4 -110228 Win. exe • Support: Windows, Max. OS, Linux, etc. • Documents: http: //www. virtualbox. org/wiki/Documentation • Newest version: 5. 1. 4 Da. SE
Operating System Lab 1 Install the Virtual. Box Da. SE
Operating System Lab 1 Install the Virtual. Box Da. SE
Operating System Lab 1 Install the project environment • Method 1: Install Ubuntu yourself on Virtual. Box ! • Method 2: Import mirror file I have already made for you. Link : ftp: //58. 198. 176. 47/pub/oslab/ch-01/resources/oslab. ova Da. SE
Operating System Lab 1 Method 1: Install Ubuntu • Choose your Ubuntu img file ubuntu-16. 04. 1 -desktop-amd 64. iso • Install Ubuntu on virtual box • Choose OS: Linux 64 bit, Version: Ubuntu 16. 04 • Memory: Share from your local memory size, e. g. 1024 MB • Hard Drive: Use an existing virtual hard drive file Da. SE
Operating System Lab 1 Da. SE
Operating System Lab 1 Da. SE
Operating System Lab 1 Da. SE
Operating System Lab 1 Da. SE
Operating System Lab 1 Da. SE
Operating System Lab 1 Da. SE
Operating System Lab 1 Da. SE
Operating System Lab 1 Method 2: Import Appliance • Start vbox • Import the oslab. ova mirror to your virtual machine. Da. SE
Operating System Lab 1 Setup the vbox • Choose the oslab virtual machine, click Settings button on toolbar • Click Storage in the left pane, and check whether the oslab is located under IDE • Click Shared Folders in the left pane • Click the button (Add New Shared Folder) on the right side • Choose the path you want to share with oslab, and name it (and remember it!) • Start the oslab, wait, user name: ’oslab’, password: ’oslab’ • Open a terminal, type (and hit RETURN): sudo usermod -a. G vboxsf $(whoami) • Your root’s password is oslab Da. SE
Operating System Lab 1 Da. SE
Operating System Lab 1 Da. SE
Operating System Lab 1 Da. SE
Operating System Lab 1 Da. SE
Operating System Lab 1 Da. SE
Operating System Lab 1 Da. SE
Operating System Lab 1 Da. SE
Operating System Lab 1 Da. SE
Operating System Lab 1 Da. SE
Operating System Lab 1 Linux Introduction • Linux is a kernel • Open source • Linux OS includes • • • Ubuntu open. SUSE Fedora Cent. OS Red Hat SUSE Da. SE
Operating System Lab 1 Linux 学习推荐 http: //cn. linux. vbird. org Da. SE
Operating System Lab 1 Linux Command • Basic commands • Useful keys • Useful commands • Handle files and directories Da. SE
Operating System Lab 1 Basic Commands • Useful keys • Tab words autocomplete • ↑/↓ check history commands(history) • Ctrl + c terminate command • Ctrl + Shift +c/v copy/paste Da. SE
Operating System Lab 1 • • • Useful commands ls list files (ll/ls –l) cd change directory cat show file content less/more show file content in separate windows mkdir make directory rm remove a file (or a directory rm -r) rmdir remove directory cp copy something mv move something Da. SE
Operating System Lab 1 • sudo • ~ (~/) • . (. /) • pwd • su • exit super user do(root) home directory current directory see the path of current directory login with an user exit(quit/sign out) • --help/-h get help • man/info command info Da. SE
Operating System Lab 1 • head • tail • sort • uniq • diff • file • find • ln show top (10/n) lines of a file (-n) show bottom n lines of a file (-n) show files in sorted order omit duplicated lines compare to files test to see the basic info. about a file find files link a file Da. SE
Operating System Lab 1 • tar • • • pack and unpack tar -cvf all. tar x y z tar -xvf all. tar compress and decompress files tar -zcvf all. tar. gz x y z tar -xvzf all. tar. gz Da. SE
Operating System Lab 1 Editor: Vim • Start Vim: vim filename • Level 1: Use as a text editor • Level 2: Use as a Microsoft Word • Level 3: Throw your mouse Da. SE
Operating System Lab 1 Mode Normal mode move cursor search replace delete copy a r i o Esc : insert mode edit command mode read 、save、close … Da. SE
Operating System Lab 1 • • • hjkl x/dw/dd f/F/t/T / or ? n/N yw/yd p/P u Ctrl + r : x/: wq : q! move arrow ←↓↑→ delete a character/word/line search a character search a string next search result copy word/line paste undo redo save and quit without save Da. SE
Operating System Lab 1 Compiler: gcc • Create file: vim filename. c • Save and Close the filename • Compile : gcc -o filename. c • Execute: . /filename Da. SE
Operating System Lab 1 Bochs install • Install dependence on Ubuntu • sudo apt-get install libncurses 5 -dev libx 11 -dev libxrandr-dev • Install with `make` commond • cd /home/oslab/Code/bochs-2. 4. 6 • . /configure --enable-gdb-stub • make • sudo make install Da. SE
Operating System Lab 1 Run Bochs • Run bochs Da. SE
Operating System Lab 1 Configure pintos • Edit with vim Vim ~/. bashrc • Add line at bottom export PATH=$PATH: /home/oslab/Code/pintos/src/utils Da. SE
Operating System Lab 1 Configure pintos • Edit with vim cd /home/oslab/Code/pintos/src/utils vim Makefile • Modify “LDFLAGS” to “LDLIBS” Da. SE
Operating System Lab 1 Configure pintos • Edit with vim cd /home/oslab/Code/pintos/src/misc vim gdb-macros • Modify the path of `GDBMACROS` Da. SE
Operating System Lab 1 Compile pintos • Enter folder utils cd /home/oslab/Code/pintos/src/utils • Make make • Enter folder thread cd /home/oslab/Code/pintos/src/thread • Make make Da. SE
Operating System Lab 1 Run pintos • Enter folder build cd /home/oslab/Code/pintos/src/thread/build pintos -- run alarm-multiple Da. SE
Operating System Lab 1 After class • Setup on your machine following the instruction • Get ready for next class——project 1 • Team work! At most 3 classmates made-up of a team • Please report your team members to your class monitor 蒋家宝 • Get all resource at : ftp: //58. 198. 176. 47/pub/oslab/ch-01/ Da. SE
- Slides: 48