Project 0 Linux Virtual Machine Dabbling CS3013 Operating
Project 0: Linux & Virtual Machine Dabbling CS-3013, Operating Systems CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 1
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 2008 Project 0: Linux & VM Dabbling 2
In this project, we won’t … • … try to change anything in the kernel yet • This is for next project • … try to support more than one machine architecture • However, 32 -bit and 64 -bit architectures are different at the kernel level! • Your kernel is not portable from one to the other CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 3
Installing your Virtual Machine in the Fossil Lab • Log into any Fossil Lab workstation • Your user ID • Your Fossil password (from TAs) • Open VMware Workstation • Select “Open an existing Virtual Machine” • Navigate to P: cs 3013c 08Virtual. Machine • Double click on SUSE Linux (a VMware Configuration File) • Select “Clone this Virtual Machine” • Select Linked Clone • Choose snapshot = Template for clones • Save in your home directory on H drive CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 4
Starting your Virtual Machine • Start your virtual machine • When it starts • Click in virtual machine screen • Use arrow keys to select Open. SUSE 10. 3 • Login is as student, password = CS-3013 • Switching between Host and Guest • Click in guest window to focus mouse and keyboard • Type CTL-ALT to return focus to host • … CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 5
Starting your Virtual Machine (continued) • 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 2008 Project 0: Linux & VM Dabbling 6
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 • Ya. ST, 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 2008 Project 0: Linux & VM Dabbling 7
Ya. ST, the SUSE administration tool • A much more efficient/effective way to manage your system • Administer hardware, software, users, services, etc. • Access via third tab under “Gecko” icon • Use it to set up your own user ID • Delete student ID CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 8
Other Notes • 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 • Doesn’t work in this version! CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 9
/home and /home 2 drives • Intended to have only /home drive • Due to miscalculation • /home 2 added to provide enough space to build Linux kernel • /home disabled but not deleted • Disaster recovery • Re-clone the virtual machine • Copy /home 2 files from broken clone to new clone CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 10
Share your thoughts and experiences in the Fossil Lab with your colleagues Use the class e-mail list! CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 11
Questions? CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 12
To get started with kernel build • Find kernel sources in /usr/src, i. e. , a link to /home 2/src Current version is linux-2. 6. 22. 13 -0. 3 • Clone kernel source tree by linked copy: – – In a command shell, do cp –al /usr/src/linux-2. 6. 22. 13 -0. 3 kernel. Src – Creates a linked copy of original tree in new directory called kernel. Src – Or whatever you wish to name it CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 13
Digression on Unix/Linux Hard Links • Directory entries point directly to files • Two directory entries may point to same file! • • • Same or different directories 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 2008 Project 0: Linux & VM Dabbling 14
Cloned Source Tree • All directories are copied • All directory entries in copy are hard-linked to files in original source tree • I. e. , only one copy of each file exists • To modify a file: – • Unlink it (via mv or rm) • Replace it with modified copy in your directory • Original is preserved intact in original directory CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 15
To Modify a File • mv file. c~ • Edit file. c~ in your favorite editor • Save as file. c • (Eventually) rm file. c~ • EMACS and patch do this automatically • Most other editors require you to do it manually CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 16
To Build Linux Kernel • “Make configuration” step – As ordinary user • Build kernel files and modules – As ordinary user • Install modules, boot file, etc. – Need root privileges CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 17
To Build Linux Kernel (continued) • Always build to a separate destination tree mkdir ~/kernel. Dst make O=~/kernel. Dst … • 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 – Your patch files grow to megabytes! CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 18
Making the Configuration • In a command shell – cd kernel. Src • Do one of: – – make O=~/kernel. Dst config • Very long and tedious – make O=~/kernel. Dst menuconfig • Still somewhat long and tedious; also hokey – make O=~/kernel. Dst xconfig • Nicer; a reasonable GUI with very small print – make O=~/kernel. Dst gconfig • Really nice; a better GUI; highly recommended CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 19
Make configuration (continued) • Edit “General Setup” line to name your “Local version” • No other edits necessary for this project. • Save and quit • If need to rebuild, use • make O=~/kernel. Dst oldconfig to reuse same configuration CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 20
To Build Kernel • In a terminal window (i. e. , a shell), do: – – cd kernel. Src – make O=~/kernel. Dst • Takes • 30 -40 minutes on dual-core 2. 4 GHz Core Duo, 1 GByte RAM in VM (2 GByte real memory) • Almost 1. 25 hours on 3 gigahertz Pentium, 3 GByte • Rebuilds after small edits are much faster • Changing. h files causes longer rebuilds CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 21
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 2008 Project 0: Linux & VM Dabbling 22
For Project Submission • Redirect build output to a file • Submit – A subset of that file (this project only) – Output of uname –a command CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 23
To Build Kernel on a Dual Processor • Generally faster to do – cd kernel. Src – make –j 2 O=~/kernel. Dst – j = number of concurrent build “jobs” • Sometimes, this is even faster – make –j 4 O=~/kernel. Dst • SUSE advice – 2 number of processors – Fossil Lab workstations have two processors (dual core) CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 24
To Install Kernel • Requires root privileges – sudo make modules_install – Root password = CS-3013 – Note order of arguments! • Puts kernel, initrd file, symbols in /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 2008 Project 0: Linux & VM Dabbling 25
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 2008 Project 0: Linux & VM Dabbling 26
Submitting your Project • From within your virtual machine, visit – http: //turnin. cs. wpi. edu: 8088/servlets/turnin. ss • Log in • Submit output of your build as Project 0 • This is to test the ability to submit projects from the virtual machine! CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 27
Project Due • Due date: – – Tuesday, January 15, 5: 00 PM • Normally, projects are due the night before class, but this due date is extended to accommodate problems, questions, etc. CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 28
Questions? CS-3013, C-term 2008 Project 0: Linux & VM Dabbling 29
- Slides: 29