Operating Systems Lab. (#2) University of Tehran – ECE Dept. Fall 2005 Reza Shokri

Slides:



Advertisements
Similar presentations
Drivers and the kernel1-1 Drivers and the kernel UNIX system has three layers: m The hardware m The operating system kernel m The user-level programs Kernel.
Advertisements

DHCP -Ameeta and Haripriya -cmsc 691x. DHCP ► Dynamic Host Configuration Protocol ► It controls vital networking parameters of hosts with the help of.
Genesis: from raw hardware to processes System booting sequence: how does a machine come into life.
Linux can be generally divided into four major components: 1. KERNEL – OS, ultimate boss The kernel is the core program that runs programs and manages.
CIS238/DL1 Chapter 15 Rebuilding the Linux Kernel Preparing the Source Code Locating the Source Code Installing the Source Code Read the Documentation.
CCNA2 MODULE 5.
Managing Your Network Environment © 2004 Cisco Systems, Inc. All rights reserved. Managing Cisco IOS Devices INTRO v2.0—9-1.
Exploring the UNIX File System and File Security
Installing Windows 7 Lesson 2.
1 Web Server Administration Chapter 3 Installing the Server.
System initialisation
Embedded Real-time Systems The Linux kernel. The Operating System Kernel Resident in memory, privileged mode System calls offer general purpose services.
Guide To UNIX Using Linux Third Edition
1Lecture 5 Lecture 5: Linux for Hardware Developers ECE 412: Microcomputer Laboratory.
Chapter 9 Extra Topics. The Kernel Core of the operating system Similar to UNIX kernel Originally developed and still controlled by Linus Torvalds uname.
Cambodia-India Entrepreneurship Development Centre - : :.... :-:-
Installing software on personal computer
Introduction to The Linaro Toolchain Embedded Processors Training Multicore Software Applications Literature Number: SPRPXXX 1.
1 Introduction to Tool chains. 2 Tool chain for the Sitara Family (but it is true for other ARM based devices as well) A tool chain is a collection of.
Debugging techniques in Linux Debugging Techniques in Linux Chetan Kumar S Wipro Technologies.
Linux+ Guide to Linux Certification Chapter Three Linux Installation and Usage.
1 Web Server Administration Chapter 3 Installing the Server.
Chapter-4 Windows 2000 Professional Win2K Professional provides a very usable interface and was designed for use in the desktop PC. Microsoft server system.
DOS Understanding what you can do. Operating System Traits An OS only works with one type of processor –X86 processors for us; Motorola for Mac –Must.
Guide to Linux Installation and Administration, 2e1 Chapter 3 Installing Linux.
Computer Maintenance Unit Subtitle: Basic Input/Output System (BIOS) Excerpted from 1 Copyright © Texas Education Agency, All.
4 1 Operating System Activities  An operating system is a type of system software that acts as the master controller for all activities that take place.
NET+OS 6 BSP How and why it was restructured Changes to memory map New features How to port to custom hardware.
LOGO Linux Installation. Linux Distribution Including shells, libraries, tools, compiler, servers, applications. Redhat, Fedora, Mandrake, SuSE, Debian,
Lab 11 Department of Computer Science and Information Engineering National Taiwan University Lab11 - Porting 2014/12/9/ 26 1.
Installing Windows 2000 BY: Joshua Wilburn, Arnol Vaquero.
Porting Android to Beagleboard
09/21/081 Ho Chi Minh city University of Technology Linux kernel R.M. Introduction of building Linux kernel from source.
Installation Overview Lab#2 1Hanin Abdulrahman. Installing Ubuntu Linux is the process of copying operating system files from a CD, DVD, or USB flash.
Troubleshooting and Performance
Unit - VI. Linux and Real Time: Real Time Tasks Hard and Soft Real Time Tasks Linux Scheduling Latency Kernel Preemption Challenges in Kernel Preemption.
Linux Architecture Overview 1. Initialization Uboot – hardware init, loads kernel Kernel – remaining initialization, calls “init” Init – 1 st process,
Manage Directories and Files in Linux. 2 Objectives Understand the Filesystem Hierarchy Standard (FHS) Identify File Types in the Linux System Change.
What is a port The Ports Collection is essentially a set of Makefiles, patches, and description files placed in /usr/ports. The port includes instructions.
1 uClinux course Day 2 of 5 Using configuration tools and the tool chain.
ICOM Noack Linux kernel structure Kernel code structure How it boots itself All the system calls are available System is configured Process handling.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop V Files and the File System Part B – File System.
Hp education services education.hp.com hp education services education.hp.com 1 HP World/Interex 2002 Linux Kernel Configuration and Patching Chris Cooper.
An Overview of ROMS Code Kate Hedstrom, ARSC April 2007.
Chapter 8: Installing Linux The Complete Guide To Linux System Administration.
LOGO Linux Installation. Linux Distribution Including shells, libraries, tools, compiler, servers, applications. Redhat, Fedora, Mandrake, SuSE, Debian,
Chapter 2. System Structures
Linux Operation System Computer Operation Manual.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
2.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition System Programs (p73) System programs provide a convenient environment.
Computer Maintenance I
Implementation of Embedded OS
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Lab5 - OS Kernel 2014/10/21/ 16 1.
1 Setup and Compile Linux Kernel Speaker: Yi-Ji Jheng Date:
Embedded Software Design Week II Linux Intro Linux Kernel.
Rebuilding Linux Kernel Dedicated to penguin lovers everywhere 26 September 20161Rebuilding kernel by Visakh M R.
Operating System Kernel Compilation
Computer System Laboratory
UBUNTU INSTALLATION
Computer Maintenance Unit Subtitle: Basic Input/Output System (BIOS)
Drivers and the kernel UNIX system has three layers: Kernel
CONFIGURING HARDWARE DEVICE & START UP PROCESS
Operating System Kernel Compilation
COP 4343 Unix System Administration
SUSE Linux Enterprise Desktop Administration
Linux Architecture Overview.
Outline Chapter 2 (cont) OS Design OS structure
Linux Operation System
Operating System Kernel Compilation
Presentation transcript:

Operating Systems Lab. (#2) University of Tehran – ECE Dept. Fall 2005 Reza Shokri

Operating Systems Lab - UT ECE Dept Fall Outline Obtaining Kernel Source Compiling the Kernel Installing a New Linux Kernel Kernel Source Structure Kernel Debugging

Operating Systems Lab - UT ECE Dept Fall Obtaining Kernel Source Obtain Kernel Source form The official kernel site: While installing RedHat, select the installer to include kernel source Source, normally is in bz2 or tgz format linux-.tar.gz Open the archive tar –xzvf linux-.tar.gz

Operating Systems Lab - UT ECE Dept Fall Compiling the Kernel Overview of kernel compilation Configuring the kernel dep, clean and mrproper make bzImage - build the kernel image make modules - build the modules make modules_install and final installation Problem solving

Operating Systems Lab - UT ECE Dept Fall Overview Compiling the kernel is composed of three stages: Configuration building (compiling) installing It’s really quite simpler than it appears, and it’s very hard to cause damage and end with a non booting system We will go over the steps together, configuring, building and installing the latest kernel

Operating Systems Lab - UT ECE Dept Fall Configuration Configuring the kernel can be non trivial, since you have to include support for your hardware for things to work If you’ve done it before and saved the.config, just do ’make oldconfig’. ’make oldconfig’ will only asked about new configuration choices and use your old choices for everything else Otherwise, run ’make menuconfig’ or ’make xconfig’, and start going through the options, based on your computer’s hardware Alternatives include ’make defconfig’, for a “default” configuration, and copying a distribution’s.config for a configuration that should fit almost everything

Operating Systems Lab - UT ECE Dept Fall dep, clean, and mrproper After configuring the kernel, you need to do ’make dep’, in order to generate dependency information and cause various build magic to occur. Occasionally, you might want or need to clean up the sources before beginning from scratch. ’make clean’ will delete object files, ’make mrproper’ will delete everything except the sources, including your.config! be sure to save it elsewhere, not in the kernel source directory, as ’make mrproper’ will delete all files matching.config* Neither ’make clean’ nor ’make mrproper’ are needed if this is the first time compiling the kernel from pristine sources, only ’make dep’.

Operating Systems Lab - UT ECE Dept Fall Cleaning Cleaning is done on three levels. make clean Delete most generated files, Leave enough to build external modules make mrproper Delete the current configuration, and all generated files make distclean Remove editor backup files, patch leftover files and the like

Operating Systems Lab - UT ECE Dept Fall make bzImage Not much to say here, really... ’make bzImage’ will build a compressed, ready to be installed kernel image. Alternatives include ’make vmlinux’, which will create a debuggable (but not runnable) kernel image.

Operating Systems Lab - UT ECE Dept Fall make modules ’make modules’ will built the various components which we chose to build as modules. Why would we want to build something as a module? To save space in the kernel image (for embedded systems) For easier debugging of drivers and kernel code To support new peripherals without requiring a kernel reboot.

Operating Systems Lab - UT ECE Dept Fall make install, and make modules_install ’make modules_install’, which must be run as root, will create /lib/modules/‘uname -r‘ and copy the modules there. The bzImage file, found at arch/i386/boot/bzImage, needs to be copied somewhere the boot loader will find it. The System.map file should be copied along with it, for debugging later, if necessary. The boot loader (lilo, grub, else) should be updated to reflect the old kernel. Never replace a working kernel with a newly compiled one without verifying that it works first!

Operating Systems Lab - UT ECE Dept Fall Problem Solving So you compiled your first kernel, and it doesn’t work. Congratulations! you aren’t the first one, and certainly won’t be the last one. Did you install the bzImage and modules properly? Did you update the boot loader? If hardware that used to work no longer works, check the.config for appropriate support. If you compiled your disk drivers as modules, you need to create an initrd (initial ram disk). Read the documentation for more information.

Operating Systems Lab - UT ECE Dept Fall Linux Source Layout

Operating Systems Lab - UT ECE Dept Fall Linux Code Layout Linux/arch Architecture dependent code. Highly-optimized common utility routines such as memcpy Linux/drivers Largest amount of code Device, bus, platform and general directories Character and block devices, network, video Buses – pci, agp, usb, pcmcia, scsi, etc Linux/fs Virtual file system (VFS) framework. Actual file systems: Disk format: ext2, ext3, fat, RAID, journaling, etc But also in-memory file systems: RAM, Flash, ROM

Operating Systems Lab - UT ECE Dept Fall Linux Code Layout Linux/include Architecture-dependent include subdirectories. Need to be included to compile your driver code: gcc … -I/ /include … Kernel-only portions are guarded by #ifdefs #ifdef __KERNEL__ /* kernel stuff */ #endif Specific directories: asm, math-emu, net, pcmcia, scsi, video.

Operating Systems Lab - UT ECE Dept Fall Kernel Source Structure mm Architecture-independent memory management code Architecture-dependent: arch/*/mm ipc Kernel inter-process communications init The initialization code for the kernel Very good place to start looking at how the kernel works modules Holds built-in modules

Operating Systems Lab - UT ECE Dept Fall Kernel Source Structure net The kernel networking code lib The kernel ’ s library code Architecture-dependent: arch/*/lib Scripts Awk and tk scripts for kernel configuration

Operating Systems Lab - UT ECE Dept Fall Kernel Debugging printk approach printk is a printf like function it prints the output in the text console you can not see the output from X

Operating Systems Lab - UT ECE Dept Fall Kernel Debugging To print the output to a file printk (KERN_DEBUG “message”, vars) Edit /etc/syslog.conf to add kern.debug /dev/console kern.debug /var/log/ ’ filename ’ This option prints all debug level information into the specified file In addition to printk, there are number of usefull printing functions like sprintf

Operating Systems Lab - UT ECE Dept Fall Kernel Debugging 2. use ‘ gdb ’ to use ‘ gdb ’, it is required to modify Makefile. CFLAGS = -Wall -Wstrict-prototypes -02 -fomit- frame-pointer => CFLAGS = -Wall -Wstrict-prototypes -02 -g ‘ gdb ’ enables all data structures in the kernel to be just read, but no local variables. ‘ gdb ’ can ’ t change values or call kernel functions