Project 0: Linux - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

Project 0: Linux

Description:

Needs 8 gigabytes of disk, 1-2 gigabytes of RAM, fast Pentium CPU (dual core would be very nice! ... 20 minutes on dual-core 2.4 GHz Pentium, 2 GByte. 40 ... – PowerPoint PPT presentation

Number of Views:18
Avg rating:3.0/5.0
Slides: 27
Provided by: hughc7
Category:

less

Transcript and Presenter's Notes

Title: Project 0: Linux


1
Project 0 Linux Virtual Machine Dabbling
  • CS-502, Operating Systems

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

3
In this project, we wont
  • 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 virtual machine is not portable from one to
    the other

4
Installing your Virtual Machine Options
  • Install from DVD using VMware Player or any other
    VMware product
  • Needs 8 gigabytes of disk, 1-2 gigabytes of RAM,
    fast Pentium CPU (dual core would be very nice!)
  • Use VMware Server on csopt4.wpi.edu
  • Needs VMware client on your PC
  • GUI interface to virtual machine
  • Use Parallels on Macintosh (or other)
  • See instructor

5
Installing from DVD
  • See instructions on-line
  • .doc, .html
  • Download and install VMware Player
  • Or other VMware product
  • Unzip your virtual machine to new directory

6
Installing from DVD (continued)
  • Choose type of networking
  • Bridged vs. NAT (Network Address Translation)
  • Start your virtual machine
  • Fix up MAC address for network
  • Boot OpenSUSE 10.2
  • Login is as student, password CS-502
  • Open YaST, the SUSE administration tool
  • Fix and test networking
  • Create new user identity for yourself
  • Log out, log in as new identity, delete student

7
Using VMware Server on csopt4
  • See instructions
  • .doc, .html
  • Get CS Department user ID and password
  • Download and install VMware client
  • Log onto csopt4, make new directory on
    /xtra_space drive
  • Unzip the following file to your new directory
  • /xtra_space/CS-502/CS-502_Fall-07_x86_64.zip

8
Using VMware Server on csopt4 (continued)
  • Start VMware client, log into csopt4
  • Browse to and open your virtual machine
  • Rename it to something unique (your user ID)
  • Set permissions
  • Start your virtual machine
  • Follow instructions for distributed version
  • Networking, user identity, etc.

9
Setting OpenSUSE Linux 10.2 on Parallels
  • See instructor
  • Will install OpenSUSE Linux 10.2 directly to disk
    partition
  • Be sure to get on-line updates
  • Best to create a separate partition for /home
    directory
  • Need to move /usr/src to /home/src
  • Create link /usr/src ? /home/src

10
Questions?
11
To get started with kernel
  • Find kernel sources in /usr/src, i.e., a link to
    /home/src
  • linux-2.6.18.2-34linux-2.6.18.8-0.5
  • Clone kernel source tree by linked copy
  • In a terminal window, do
  • cp al /usr/src/linux-2.6.18.8-0.5 kernelSrc
  • Creates a linked copy of original tree in new
    directory called kernelSrc

12
Digression on Unix/Linux Hard Links
  • Directory entries point directly to files
  • Two entries may point to same file!
  • Same or different directories
  • Same or different name
  • Permissions attached to file, not directory
  • Called hard links (as opposed to symbolic links)
  • Modifications to file seen via 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.

13
Cloned Source Tree
  • All directories are copied
  • All directory entries in copy are hard-linked
    back 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

14
To Modify a File
  • mv file.c file.c
  • Edit file.c in your favorite editor
  • Save as file.c
  • (Eventually) delete file.c
  • EMACS and patch do this automatically
  • Most other editors require you to do it manually

15
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

16
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 dont specify a destination, it fills up
    your source tree
  • Your patch files grow to gt 1 megabyte!

17
Make 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
  • Nice a GUI with very small print
  • make O/kernelDst gconfig
  • Really nice a better GUI highly recommended

18
Make configuration (continued)
  • Edit General Setup to name your Local version
  • No other edits necessary for this project.
  • Save and quit
  • If need to rebuild, use
  • make O/kernelDst oldconfig
  • to reuse same configuration

19
To Build Kernel
  • In a terminal window (i.e., a shell), do
  • cd kernelSrc
  • make O/kernelDst
  • Takes
  • 20 minutes on dual-core 2.4 GHz Pentium, 2 GByte
  • 40 minutes on csopt4 (last year)
  • Almost two hours on 3 gigahertz Pentium, 1 GByte
  • Rebuilds after small edits are much faster
  • Changing .h files can cause longer rebuilds

20
One little glitch
  • File include2/asm/asm-offsets.h not generated by
    make config
  • Build crashes within about 2-3 minutes
  • Link file from
  • /kernelDst/include/asm-i386/ or
  • /kernelDst/include/asm-x86_64
  • to
  • kernelDst/include2/asm
  • Run make O/kernelDst again
  • Without trying to remake the config
  • Build should complete without further errors

21
For Project Submission
  • Redirect build output to a file
  • Submit that file (this project only)
  • Note that there are lots of warnings in the Linux
    kernel
  • Not your problem!

22
To Build Kernel on a Dual Processor
  • Generally faster to do
  • cd kernelSrc
  • make j2 O/kernelDst
  • Sometimes, this is even faster
  • make j4 O/kernelDst
  • SUSE advice
  • 2 ? number of processors

23
To Install Kernel
  • Requires root privileges
  • sudo make modules_install install
  • 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

24
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

25
Submitting your Project
  • From within your virtual machine, visit
  • http//turnin.cs.wpi.edu8088/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!

26
Questions?
Write a Comment
User Comments (0)
About PowerShow.com