Download presentation
Presentation is loading. Please wait.
1
Using Linux and Lab Setup OS Lab 1
TA:王嘉豪 Addr.:地理馆314 QQ:
2
Outline Lab Goal && what is pintos Lab Setup Linux Introduction
Install the VirtualBox Install the project environment Linux Introduction Linux command Basic commands Handle files and directories Editor: Vim Compiler:gcc Bochs and Pintos install
3
Lab goal Analyze and improve a small operating system (Pintos) and , make a deeper understanding of the principle of operating systems and implementation mechanism.
4
What is pintos Welcome to Pintos. Pintos is a simple operating system framework for the 80x86 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.
5
4 projects in pintos
6
Install the VirtualBox
What is VirtualBox? Download VirtualBox Homepage: Downloads: ftp:// /pub/oslab/ch-01/resources/VirtualBox Win.exe Support: Windows, MaxOS, Linux, etc. Documents: Newest version: 5.1.4 VirtualBox是一个跨平台的虚拟化应用,它可以运行在Windows,Mac,Linux等系统。在VB中可以同时运行多个操作系统,比如,在MAC系统运行Windows和Linux,在Linux系统上运行Windows。但是唯一的限制就是磁盘空间和内存大小是有限的。
7
Install the VirtualBox
8
Install the VirtualBox
9
Install the project environment
Method 1: Install Ubuntu yourself on VirtualBox ! Method2: Import mirror file I have already made for you. Link : ftp:// /pub/oslab/ch-01/resources/oslab.ova
10
Method 1: Install Ubuntu
Choose your Ubuntu img file ubuntu desktop-amd64.iso Install Ubuntu on virtual box Choose OS: Linux 64 bit, Version: Ubuntu16.04 Memory: Share from your local memory size, e.g MB Hard Drive: Use an existing virtual hard drive file
18
Method 2: Import Appliance
Start vbox Import the oslab.ova mirror to your virtual machine.
19
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 -aG vboxsf $(whoami) Your root’s password is oslab
29
Linux Introduction Linux is a kernel Open source Linux OS includes
Ubuntu openSUSE Fedora CentOS Red Hat SUSE Linux是一个操作系统的底层核心,Linux是一款免费的操作系统
30
Linux 学习推荐
31
Linux Command Basic commands Useful keys Useful commands
Handle files and directories
32
Basic Commands Useful keys Tab words autocomplete
↑/↓ check history commands(history) Ctrl + c terminate command Ctrl + Shift +c/v copy/paste
33
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
34
sudo super user do(root)
~ (~/) home directory . (./) current directory pwd see the path of current directory su login with an user exit exit(quit/sign out) --help/-h get help man/info command info
35
head show top (10/n) lines of a file (-n)
tail show bottom n lines of a file (-n) sort show files in sorted order uniq omit duplicated lines diff compare to files file test to see the basic info. about a file find find files ln link a file
36
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
37
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
38
Mode Normal mode insert mode edit move cursor search replace delete
a i o r insert mode edit move cursor search replace delete copy Esc command mode : read 、save、close …
39
hjkl move arrow ←↓↑→ x/dw/dd delete a character/word/line f/F/t/T search a character / or ? search a string n/N next search result yw/yd copy word/line p/P paste u undo Ctrl + r redo :x/:wq save and quit :q! quit without save
40
Compiler: gcc Create file: vim filename.c Save and Close the filename
Compile : gcc -o filename filename.c Execute: ./filename
41
Bochs install Install dependence on Ubuntu
sudo apt-get install libncurses5-dev libx11-dev libxrandr-dev Install with `make` commond cd /home/oslab/Code/bochs-2.4.6 ./configure --enable-gdb-stub make sudo make install
42
Run Bochs Run bochs bochs
43
Configure pintos Edit with vim Vim ~/.bashrc Add line at bottom
export PATH=$PATH:/home/oslab/Code/pintos/src/utils
44
Configure pintos Edit with vim cd /home/oslab/Code/pintos/src/utils
vim Makefile Modify “LDFLAGS” to “LDLIBS”
45
Configure pintos Edit with vim cd /home/oslab/Code/pintos/src/misc
vim gdb-macros Modify the path of `GDBMACROS`
46
Compile pintos Enter folder utils cd /home/oslab/Code/pintos/src/utils
Make make Enter folder thread cd /home/oslab/Code/pintos/src/thread
47
Run pintos Enter folder build
cd /home/oslab/Code/pintos/src/thread/build pintos -- run alarm-multiple
48
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:// /pub/oslab/ch-01/
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.