Top Banner
Chapter 9 Extra Topics
12

Chapter 9 Extra Topics. The Kernel Core of the operating system Similar to UNIX kernel Originally developed and still controlled by Linus Torvalds uname.

Dec 22, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Chapter 9 Extra Topics. The Kernel Core of the operating system Similar to UNIX kernel Originally developed and still controlled by Linus Torvalds uname.

Chapter 9Extra Topics

Page 2: Chapter 9 Extra Topics. The Kernel Core of the operating system Similar to UNIX kernel Originally developed and still controlled by Linus Torvalds uname.

The Kernel

• Core of the operating system

• Similar to UNIX kernel

• Originally developed and still controlled by Linus Torvalds

• uname -r

• Current latest version: 2.6.x

• Version names follow the convention:• major.minor.patchlevel

• minor• even : stable

• odd : development

Page 3: Chapter 9 Extra Topics. The Kernel Core of the operating system Similar to UNIX kernel Originally developed and still controlled by Linus Torvalds uname.

What’s a Kernel

• Can be seen as an executive, system monitor

• Controls and provides access to the hardware

• Implements and supports • processes, files, devices, etc.

• Schedules system resources• Memory, Processor time, disk space, peripherals

• Enforce security, protection

• Respond to user commands

Page 4: Chapter 9 Extra Topics. The Kernel Core of the operating system Similar to UNIX kernel Originally developed and still controlled by Linus Torvalds uname.

Kernel Design Goals

• Performance• Utilize resources with low overhead

• Extensibility

• Capability• features, compatibility

• Security

• Portability

• Stability

Page 5: Chapter 9 Extra Topics. The Kernel Core of the operating system Similar to UNIX kernel Originally developed and still controlled by Linus Torvalds uname.

Kernel Overview

Page 6: Chapter 9 Extra Topics. The Kernel Core of the operating system Similar to UNIX kernel Originally developed and still controlled by Linus Torvalds uname.

Building the Kernel

• For• keeping up with new kernel releases

• Remove device drivers not needed: better performance

• Obtain sources

• From Internet• from ftp://ftp.kernel.org

• main release usually a tar-zipped file

• patches released as seperate files

• maybe installed already: /usr/src/linux

• apt-get

Page 7: Chapter 9 Extra Topics. The Kernel Core of the operating system Similar to UNIX kernel Originally developed and still controlled by Linus Torvalds uname.

Patching

• Patches are available to the last release• fix bugs, holes

• provide new features

• Can be applied using the patch command• download the patch file to /usr/src/linux

• extract

• patch -pl < patch-2.2.x

Page 8: Chapter 9 Extra Topics. The Kernel Core of the operating system Similar to UNIX kernel Originally developed and still controlled by Linus Torvalds uname.

Building the Kernel: Steps

• Look in Documentation/Changes for the list of requirements

• README for detailed information for building

• run make config or make xconfig• make oldconfig if already built the kernel earlier

• run make dep to build dependencies• run make clean to clean up

• build the kernel: make bzimage

• copy the bzimage and System.map to /boot

Page 9: Chapter 9 Extra Topics. The Kernel Core of the operating system Similar to UNIX kernel Originally developed and still controlled by Linus Torvalds uname.

diff - comparing files

• Utility to compare files

• Gives instructions on how to make them similar

• a: add

• c: change

• d: delete

• diff file1 file2• changes in file1 to make it like file2

• l1al2, l3: append lines l2 to l3 from file2 after line1 in file1

• l1,l2cl3,l4 : change lines l1 to l2 in file1 to l3 to l4 in file2

• l1,l2dl3 : delete lines l1 to l2 in file1

Page 10: Chapter 9 Extra Topics. The Kernel Core of the operating system Similar to UNIX kernel Originally developed and still controlled by Linus Torvalds uname.

uniq: Deleting repeated lines

• Deleting repeated lines in a file

• uniq sample• output the lines in sample without repitition

• uniq sample out• output the non-repeated lines in sample to out

• uniq -c sample• give counts of repetitions

• uniq -d sample• give the lines that are repeated in sample

• uniq -d sample out• save the repeated lines in sample to out

Page 11: Chapter 9 Extra Topics. The Kernel Core of the operating system Similar to UNIX kernel Originally developed and still controlled by Linus Torvalds uname.

find: advanced file searching

• searches for files with specified criteria in specified directories

• find ~ -name *.doc -print• search for all .doc files in my home directory

• -print option to print the results

• enclose complex search criteria in \( \)

• -o for OR

• find ~ \( -name *.doc -o -name *.ppt \) -print• search for all .doc and .ppt files in my home directory

Page 12: Chapter 9 Extra Topics. The Kernel Core of the operating system Similar to UNIX kernel Originally developed and still controlled by Linus Torvalds uname.

whereis and which

• whereis: locate the directories where a command is• useful when shell cannot find the command

• command may not be in PATH

• which: similar to whereis• prints location of the command

• helpful when more than two commands with same name exist