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
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
Kernel Design Goals
• Performance• Utilize resources with low overhead
• Extensibility
• Capability• features, compatibility
• Security
• Portability
• Stability
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
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
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
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
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
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