CS3210: Operating Systems

Similar documents
Lab1 tutorial CS

GIT. A free and open source distributed version control system. User Guide. January, Department of Computer Science and Engineering

Getting the Source Code

Versioning with git. Moritz August Git/Bash/Python-Course for MPE. Moritz August Versioning with Git

Version Control: Gitting Started

Index. Alias syntax, 31 Author and commit attributes, 334

HW 0: Executable CS 162. Due: January 29, 2018

EECS 470 Lab 4. Version Control System. Friday, 31 st January, 2014

Git & Github Fundamental by Rajesh Kumar.

Lab 01 How to Survive & Introduction to Git. Web Programming DataLab, CS, NTHU

CS 261 Recitation 1 Compiling C on UNIX

GETTING TO KNOW GIT: PART II JUSTIN ELLIOTT PENN STATE UNIVERSITY

Version Control with GIT

CS3210: Booting and x86

Building Tizen Development Environment

Introduction to distributed version control with git

Building CircuitPython

CS 390 Software Engineering Lecture 5 More Git

Introduction to Git. Database Systems DataLab, CS, NTHU Spring, 2018

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Gerrit

Tutorial: Getting Started with Git. Introduction to version control Benefits of using Git Basic commands Workflow

CSE 391 Lecture 9. Version control with Git

CS3210: Booting and x86. Taesoo Kim

Version Control. Version Control

FEEG Applied Programming 3 - Version Control and Git II

Hard Disk Organization. Vocabulary

School of Computing Science Gitlab Platform - User Notes

Introduction to Version Control

Submitting your Work using GIT

CS356: Discussion #1 Development Environment. Marco Paolieri

Version Control with Git

Introduction to Git and Github Repositories

git Version: 2.0b Merge combines trees, and checks out the result Pull does a fetch, then a merge If you only can remember one command:

SPPEXA TEACHLET: GETTING STARTED WITH L4RE CARSTEN WEINHOLD

Object Oriented Programming. Week 1 Part 2 Git and egit

1. Git. Robert Snapp

Systems Programming and Computer Architecture ( ) Exercise Session 01 Data Lab

Lab Exercise Git: A distributed version control system

L Modeling and Simulating Social Systems with MATLAB

Revision control Advanced git

Introduction to Pintos

CS 390 Software Engineering Lecture 4 - Git

Configuring and Building Palacios/Linux

CSE 331 Software Design & Implementation

Distributed Version Control (with Git)

Section 1: Tools. Contents CS162. January 19, Make More details about Make Git Commands to know... 3

2 Initialize a git repository on your machine, add a README file, commit and push

AMath 483/583 Lecture 2

Linux and Git Boot Camp

Introduction to GIT. Jordi Blasco 14 Oct 2011

CS314 Software Engineering Configuration Management

Boot. How OS boots

GIT VERSION CONTROL TUTORIAL. William Wu 2014 October 7

AMath 483/583 Lecture 2. Notes: Notes: Homework #1. Class Virtual Machine. Notes: Outline:

Version control with Git.

DEVNET Introduction to Git. Ashley Roach Principal Engineer Evangelist

Basic git. Interactive.

Version Control with Git

Git. Presenter: Haotao (Eric) Lai Contact:

The Early System Start-Up Process. Group Presentation by: Tianyuan Liu, Caiwei He, Krishna Parasuram Srinivasan, Wenbin Xu

LPF Training Handbook!

:59:32 PM PST

PL-I Assignment Broup B-Ass 5 BIOS & UEFI

Git! Fundamentals. IT Pro Roundtable! June 17, 2014!! Justin Elliott! ITS / TLT! Classroom and Lab Computing!! Michael Potter!

Shell Project Part 1 (140 points)

Online Remote Repositories

GIT. CS 490MT/5555, Spring 2017, Yongjie Zheng

CSCI 350 Pintos Intro. Mark Redekopp

USING GIT FOR AUTOMATION AND COLLABORATION JUSTIN ELLIOTT - MATT HANSEN PENN STATE UNIVERSITY

! #Running this command from the top directory of your project will add all your changes."! $ git add."

Git Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : October, More documents are freely available at PythonDSP

Tutorial 2 GitHub Tutorial

Tizen Project Guideline. SKKU Embedded Software Lab.

Department of Computer Science College of Engineering Boise State University

Chapter. Overview. Tornado BSP Training Workshop Copyright Wind River Systems 1-1 Wind River Systems

EGit/Gerrit Hands-on training #1: Installation and Configuration

Agenda. Several projects are using GIT Developer(s) Junio Hamano, Linus Torvalds. Qt Stable release (January 31, 2011)

Source Code Management wih git

Misc. Third Generation Batch Multiprogramming. Fourth Generation Time Sharing. Last Time Evolution of OSs

Advanced Operating Systems Control Versioning with GIT. Giuseppe Massari

Software Development I

CS Lab 1 xv6 Introduction Setup and exercise

Overview. during this tutorial we will examine how touse git from the command line. finally we will explore a graphical visualisation of git activity

Today s presentation. Git gdb Project 1

A quick (and maybe practical) guide to Git and version control. By Jay Johnson

Software Revision Control for MASS. Git Installation / Configuration / Use

Git Introduction CS 400. February 11, 2018

Lab 1 1 Due Wed., 2 Sept. 2015

Building Tizen Development Environment

CS333 Intro to Operating Systems. Jonathan Walpole

Version Control. Version Control

Programming Tools. Computer Organization Tools. Most of the programming assignments will require using the C language.

Project 8: Virtual Machine Translator II

A BASIC UNDERSTANDING OF VERSION CONTROL

COS 318: Operating Systems

Git: Distributed Version Control

Introduction to Supercomputing

Contents Coding standard Debugging tool Text editor Version control system

CSCI 350 Virtual Machine Setup Guide

Exercise 1: Basic Tools

Transcription:

CS3210: Operating Systems Lab 1 Tutorial 1 / 39

Lab session general structure Session A - overview presentation (30 min) Concepts, tutorial, and demo Session B - group activity (30 min) Each student will get his/her hands dirty on tutorials We will provide a README and/or source code Divide class in three groups Note: README is only for practice Session C (20 min) Q&A lab 2 / 39

Lab1 goals Understanding the tools required for OS development Part 1 - Git source control and its internals Part 2 - QEMU and debugging with QEMU Part 3 - Basics of boot process and JOS makefile 3 / 39

Source Control - Git Basics 4 / 39

Why version control? Basic functionality Keep track of changes made to files Merge the contributions of multiple developers Accountability Who wrote the code? Do we have the rights to it? Software branches Different software versions, ensure bug fixes shared Record keeping Commit logs may tie to issue tracking system or be used to enforce guidelines 5 / 39

Why version control? Setting up Git In this class we will use Git heavily for development and for general assignment submission. Let's walk through basic commands and then the internals. First, prevent your commits from having terrible <user@hostname> annotations. Update your global config, one time only. Applies to all repos. $ git config --global user.name "George P. Burdell" $ git config --global user.email "burdell@gatech.edu" Or, later go edit ~/.gitconfig manually: $ cat ~/.gitconfig [user] name=george P. Burdell email=burdell@gatech.edu 6 / 39

Why version control? Setting up Git Generating SSH keypair Skip if you've already done this... Yes, https works but this is much better. $ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/vagrant/.ssh/id_ Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/vagrant/.ssh/id Your public key has been saved in /home/vagrant/.ssh/id_rsa Generally speaking, good to set a password. You can always use ssh-agent to cache later. Now... $ cat ~/.ssh/id_rsa.pub <copy contents to clipboard> 7 / 39

Getting started Your lab repo: git@github.gatech.edu:cs3210-spring2017/cs3210-lab-<username>.git This is your own repo. It is readable and writeable only by you, the TAs, and the instructors. Let's clone it. $ mkdir ~/cs3210 $ cd ~/cs3210 $ git clone git@github.gatech.edu:cs3210-spring2017/cs3210-lab-<user>.git lab $ Cloning into lab... $ cd lab Note: If you are using Vagrant, it is convenient to clone into the folder containing your Vagrantfile. This folder is auto mounted by vagrant in the guest OS. Then you can use handy tools (gitk, git-gui) on the host OS for doing your commits. 8 / 39

Committing and pushing your changes Bringing code under control, committing, pushing $ git add code1.c $ git commit -m "my solution for lab1 exercise 9" $ git push origin master */ push your code to github.gatech */ Turning assignment in... $ git tag "lab1_v1" $ git push origin lab1_v1 9 / 39

Git - Distributed Version Control 10 / 39

Git Internals - blob Git is a DAG (directed acyclic graph) of different type of objects Objects are stored compressed and identified by an SHA 1 Blob: simplest object, just a bunch of bytes, often a file 11 / 39

Git Internals - trees and blobs Directories are represented by a tree object They point to blob objects or subtrees 12 / 39

Git Internals - blobs and trees $ find.git/objects type f.git/objects/02/b365d4af3f74b0b1f18c41507c82b3ee571.git/objects/37/ce98f6635fa1192d843bcaa4622537b2eb87 Tree.git/objects/f0/5245cba7f23f998a5e372812d1a390375314c $ git cat file p 37ce98f6635fa1192d85243bcaa4622537b2eb87 100644 blob 5fe92a0481023dfa3d2e64a0556dda3bbb852e5d init.scm 100644 blob 20fa5e19fcb963f8a4ff249a815413153fb6b4e3 opdefines.h 10644 blob 69c742cc2544e336230d637b8115d69f0c050720 scheme.h 100644 blob badef17026a45893a7b3174db325e868c3a688b7 scheme.c 13 / 39

Git Internals - commit Commit refers to a tree that represents the state of the files at the time of the commit 14 / 39

Git Internals - commit It also refers to 0..n other commits that are its parents 15 / 39

Git Internals - commit A branch is a pointer to a commit 16 / 39

Git Internals - commit The files in the working directory reflect HEAD 17 / 39

Git internals - creating branch $ git checkout -b testing 18 / 39

X86 Assembly 19 / 39

Why x86 assembly? All labs require understanding of assembly instructions We need to understand what instructions are executed during the boot process, which all written in assembly The book "PC Assembly Language" is an excellent resource to understand the basics. See: https://tc.gtisc.gatech.edu/cs3210/2017/spring/refs.html We will not be covering it today in the class 20 / 39

QEMU emulator 21 / 39

PC Emulator Debugging and modifying real PC boot is hard So, we use a program that faithfully emulates a PC We can track, debug when our kernel boots So what does the emulator PC require? A working OS! Let's discuss the internals 22 / 39

What is QEMU? Modes: System-mode emulation- emulation of a full system User-mode emulation- launch processes compiled for another CPU(same OS) Ex. execute arm/linux program on x86/linux Popular uses: For cross-compilation development environments virtualization, device emulation, for kvm Android Emulator(part of SDK) 23 / 39

What is QEMU? QEMU is a user-level processor emulator Simulation vs. Emulation Simulation - for analysis and study Emulation - for usage as substitute 24 / 39

Building CS3210 kernel for emulator $ cd lab $ make Successful build generates our CS3210 kernel: check kern/kernel.img Next we install our PC emulator - QEMU: $ sudo apt-get install qemu When done, we can boot our PC: $ make qemu 25 / 39

Starting QEMU $ make qemu-gdb You will see the following printed on the screen $ qemu-system-i386 -drive file= obj/kern/kernel.img, index=0,media=disk,format=raw -serial mon:stdio -gdb tcp::26001 D qemu.log We will next discuss Boot procedure Using QEMU with gdb to understand boot procedure 26 / 39

How does computer startup? Booting is a bootstrapping process that starts operating systems when the user turns on a computer system A boot sequence is the set of operations the performs when it is switched on that load an operating system 27 / 39

Understanding OS booting 28 / 39

What is BIOS BIOS refers to the software code run by a computer when first powered on The primary function of BIOS is code program embedded on a chip that recognizes and controls various devices that make up the computer 29 / 39

Graphic Initial PC address is 0xffff0 30 / 39

Booting sequence - high-level steps first 1. Turning on the computer 2. CPU jumps to address of BIOS (0xFFFF0) 3. BIOS runs POST (Power-On Self Test) 4. Finds a bootable device 5. Loads and executes boot sector form MBR 6. Loads OS 31 / 39

Boot sector OS is booted from a hard disk, where the master boot Record (MBR) contains the primary boot loader The MBR is a 512 byte sector, located in the first sector on the disk (sector 1 of cylinder 0, head 0) After the MBR is loaded into RAM, the BIOS yields control to it 32 / 39

Boot loader Boot loader is the code ultimately responsible for loading your kernel In JOS, you can find the boot-loader implementation in boot/main.c The boot loader does two important steps: 1. Switches processor from real mode to 32-bit (Why?) 2. Reads the kernel from the hard disk 33 / 39

How can we debug PC booting? GDB is the GNU program debugger GDB provides some helpful functionality Allows you to stop your program at any given point. You can examine the program state when stopped. Change things in your program, so you can experiment with correcting the effects of a bug. So, let's see a demo for debugging our PC emulator 34 / 39

JOS: Boot loader (main.c and boot.s) Both boot.s and main.c correspond as JOS's boot loader It should be stored in the first sector of the disk The 2nd sector onward holds the kernel image In JOS source, bootmain() function is where it all starts Function readsect() reads the first sector (boot loader) 35 / 39

Cscope Walking through the source kernel Cscope can be a particularly useful tool if you need to wade into a large code base Fast, targeted searches rather than randomly grepping through the source files by hand To recursively parse a directory, use $ cscope -R -p X X represents the number of levels of subdirectories 36 / 39

Cscope Walking through the source kernel Commonly used Cscope options: Find this C symbol: (functions or symbols to be searched) Find this global definition: (function definition) Find functions called by this function: (callee's of a func) Find functions calling this function: (caller's of a func) Find this egrep pattern: (search by grepping) Find this file: (locate a file) 37 / 39

Getting hands dirty $ git clone git@github.gatech.edu:cs3210-spring2017/cs3210-pub $ cd cs3210 pub/tut/tut1 $ less README Looks like... # Lab 1 - Tools ## Part 1. Getting hands dirty with git In this part you will try the basics required for updating, committing, and submitting your code via git. For more details about git at http://gitimmersion.com/index.html 1. Install git $ sudo apt-get install git (in ubuntu) 2. Set your user name and email $ git config --global user.name "Your Name" $ git config --global user.email "your_email@whatever.com" 38 / 39

39 / 39