Download presentation
Presentation is loading. Please wait.
Published byKristina Auttenberg Modified over 6 years ago
1
Project 0: Linux and Virtual Machine Dabbling
CS-3013 Operating Systems Hugh C. Lauer (Slides include materials from Slides include materials from Modern Operating Systems, 3rd ed., by Andrew Tanenbaum and from Operating System Concepts, 7th ed., by Silbershatz, Galvin, & Gagne) CS-3013, C-Term 2012 Project 0 — Linux Dabbling
2
In this project, we will …
Install our virtual machines and learn how to use them This is the place you will work during this course! Build and install the Linux kernel With your name on it! Follow Linux naming & numbering conventions Turn in the project using web-based Turnin CS-3013, C-Term 2012 Project 0 — Linux Dabbling
3
In this project, we won’t …
… try to change anything in the kernel yet This is for a future project … try to support more than one machine architecture However, 32-bit and 64-bit architectures are different at the kernel level! Hardware-level code for different processor families is organized differently in kernel source code! Your kernel is not portable from one to another CS-3013, C-Term 2012 Project 0 — Linux Dabbling
4
Using your Virtual Machine
Characteristics Guest OS is OpenSUSE Linux 11.4 Configured for projects of this course Configured to work with VMware Just the basic devices needed for this course Host system Your own or corporate PC or Mac VMware Player, VMware Workstation, or VMware Fusion Virtual Fossil Server CS-3013, C-Term 2012 Project 0 — Linux Dabbling
5
Starting your Virtual Machine
Download from See “cookbook” for how to clone or copy Don’t waste too much time trying to figure it out on your own Start it Click in virtual machine screen Use arrow keys to select OpenSUSE 11.4 Login is as student, password = CS-3013/502 … CS-3013, C-Term 2012 Project 0 — Linux Dabbling
6
Starting your Virtual Machine (continued)
Switching between Host and Guest Click in guest window to focus mouse and keyboard Type CTL-ALT to return focus to host Full screen mode Type CTL-ALT-Enter to switch to or from guest full screen Interrupting CTL-ALT-DEL always goes to host system Use VM menu command to “send CTL-ALT-DEL to guest” CS-3013, C-Term 2012 Project 0 — Linux Dabbling
7
KDE – a Linux GUI interface
Looks and acts a lot like Windows or Mac GUI Many similar tools and applications “Start” menu is in lower left corner under the “Gecko” icon YaST, the SUSE administration tool Select User and group administration Create new user identity for yourself Log out, log in as new identity, delete student CS-3013, C-Term 2012 Project 0 — Linux Dabbling
8
YaST, the SUSE administration tool
A much more efficient/effective way to manage your system Administer hardware, software, users, services, etc. Root password CS-3013/502 (same as student password) Access via third tab under “Gecko” icon Use it to Set up your own user ID and delete student ID Fix your network configuration CS-3013, C-Term 2012 Project 0 — Linux Dabbling
9
Project 0 — Linux Dabbling
Other Notes If not, see VM menu Usually! When input focus is in guest window Inserted CD/DVD is recognized by guest OS Same for USB flash drive Snapshots Makes a record of the state of your virtual machine Any subsequent changes are made in copy-on-write mode Shared folder with host operating system Extremely useful! Not available in VMware Player CS-3013, C-Term 2012 Project 0 — Linux Dabbling
10
Share your thoughts and experiences with your colleagues
Use the class list! CS-3013, C-Term 2012 Project 0 — Linux Dabbling
11
Project 0 — Linux Dabbling
Questions? CS-3013, C-Term 2012 Project 0 — Linux Dabbling
12
To get started with kernel build
Find kernel sources in /usr/src i.e., a link to /home/src Current version is linux Clone kernel source tree by linked copy: – In a command shell, do cp –al /usr/src/linux kernelSrc Creates a linked copy of original tree in new directory called kernelSrc Or whatever you wish to name it CS-3013, C-Term 2012 Project 0 — Linux Dabbling
13
Digression on Linux Hard Links
Directory entries point directly to files Multiple directory entries may point to same file! Same or different directories (within same file system) Same or different name Name attached to directory, not file Permissions & attributes attached to file, not directory Called hard links (as opposed to symbolic links) Modifications to file seen thru all hard links mv and rm commands change directories, not files! File goes away when all directory entries (i.e., hard links) to that file are deleted and file is closed. CS-3013, C-Term 2012 Project 0 — Linux Dabbling
14
Project 0 — Linux Dabbling
Cloned Source Tree All directories are copied All directory entries are hard-linked to files in original source tree I.e., only one copy of each file exists A good thing, because kernel sources are hundreds of megabytes! To modify a file:– Unlink it in your directory (via mv or rm) Replace with modified copy in your directory Original still remains intact in original directory CS-3013, C-Term 2012 Project 0 — Linux Dabbling
15
Project 0 — Linux Dabbling
To Modify a File mv file.c file.c~ AND THEN Edit file.c~ in your favorite editor Save as file.c OR Copy file.c~ back to file.c in your kernel source tree Edit file.c directly (Eventually) rm file.c~ Some editors try to do this automatically DO NOT edit kernel source files as root CS-3013, C-Term 2012 Project 0 — Linux Dabbling
16
Project 0 — Linux Dabbling
To Build Linux Kernel “Make configuration” step As ordinary user Build kernel files and modules Install modules, boot file, etc. Need root privileges CS-3013, C-Term 2012 Project 0 — Linux Dabbling
17
To Build Linux Kernel (continued)
Always build to a separate destination tree mkdir ~/kernelDst make O=~/kernelDst … Reason Making the configuration generates a lot of include files and other sources If you don’t specify a destination, it fills up your source tree Submitted project files grow to megabytes! Graders unable to build your kernel! CS-3013, C-Term 2012 Project 0 — Linux Dabbling
18
Making the Configuration
In a command shell cd kernelSrc Do one of:– make O=~/kernelDst config Very long and tedious make O=~/kernelDst menuconfig Still somewhat long and tedious; also hokey make O=~/kernelDst xconfig Really nice; a better GUI; highly recommended make O=~/kernelDst gconfig Used to be better, but has not kept up with xconfig CS-3013, C-Term 2012 Project 0 — Linux Dabbling
19
Make configuration (continued)
Edit configuration file Load course configuration file from Edit “General setup” to add your name No other edits necessary for this project. Save and quit If need to rebuild, use make O=~/kernelDst oldconfig to reuse same configuration CS-3013, C-Term 2012 Project 0 — Linux Dabbling
20
Project 0 — Linux Dabbling
To Build Kernel In a terminal window (i.e., a shell), do:– cd kernelSrc make O=~/kernelDst Takes More than one hour on 3 gigahertz Pentium, 3 GByte, hypterthreaded ~25 minutes on dual-core 2.4 GHz Core2 Duo, 1 GByte RAM in VM (2 GByte real memory) ~6-7 minutes on quad-core 3.4 GHz Core i7 Rebuilds after small edits are much faster Changing .h files causes longer rebuilds I.e., letter “O” CS-3013, C-Term 2012 Project 0 — Linux Dabbling
21
Note: building with multiple processors
Generally faster to do cd kernelSrc make –j4 O=~/kernelDst j = number of concurrent build “jobs” SUSE advice Set j to 2 number of processors CS-3013, C-Term 2012 Project 0 — Linux Dabbling
22
Project 0 — Linux Dabbling
Warnings Lots of warnings from files you never touched Not your problem No warnings allowed in your own code! In this course CS-3013, C-Term 2012 Project 0 — Linux Dabbling
23
For Project Submission
Redirect output of build step to a file Submit A subset of that file (this project only) E.g., first two dozen and last dozen or so lines. Output of uname –a command README file with a summary of any difficulties or issues README.txt, README.doc, or README.pdf CS-3013, C-Term 2012 Project 0 — Linux Dabbling
24
Project 0 — Linux Dabbling
To Install Kernel Requires root privileges sudo make modules_install install Root password = CS-3013/502 Note order of arguments! This puts driver modules into /lib/modules puts kernel, initrd file & symbols into /boot Changes links for vmlinuz, initrd adds entries to /boot/grub/menu.lst So your kernel shows up on boot screen So you can select which kernel to boot CS-3013, C-Term 2012 Project 0 — Linux Dabbling
25
Project 0 — Linux Dabbling
Running Your Kernel Restart your virtual machine Click in boot window Use arrow keys to select desired kernel or system To determine which kernel is running:– uname -a CS-3013, C-Term 2012 Project 0 — Linux Dabbling
26
Submitting your Project
From within your virtual machine, visit Log in Submit output of your build as Project 0 This is a sanity check on your ability to submit projects from the virtual machine! CS-3013, C-Term 2012 Project 0 — Linux Dabbling
27
Project 0 — Linux Dabbling
Project Due Due date:– Tuesday, January 17, 2012 When should projects be due:– 4:00 PM vs. 11:59 PM? Day before class vs. day of class Other thoughts? CS-3013, C-Term 2012 Project 0 — Linux Dabbling
28
Project 0 — Linux Dabbling
Questions? CS-3013, C-Term 2012 Project 0 — Linux Dabbling
29
Project 0 — Linux Dabbling
CS-3013, C-Term 2012 Project 0 — Linux Dabbling
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.