ICOM 5007 - Noack Linux kernel structure Kernel code structure How it boots itself All the system calls are available System is configured Process handling.

Slides:



Advertisements
Similar presentations
Assembly Language – 1.
Advertisements

COMPUTERS: TOOLS FOR AN INFORMATION AGE Chapter 3 Operating Systems.
Device Drivers. Linux Device Drivers Linux supports three types of hardware device: character, block and network –character devices: R/W without buffering.
Computer System Laboratory
Machine/Assembler Language Putting It All Together Noah Mendelsohn Tufts University Web:
Gnu Debugger (GDB) Topics Overview Quick Reference Card Readings: Quick Reference Card February 7, 2012 CSCE 212Honors Computer Organization.
Chapter 9: Understanding System Initialization The Complete Guide To Linux System Administration.
Linux vs. Windows. Linux  Linux was originally built by Linus Torvalds at the University of Helsinki in  Linux is a Unix-like, Kernal-based, fully.
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 12 Separate Compilation Namespaces Simple Make Files (Ignore all class references.
Linux Boot Up Process Bootstrapping –Bootstrapping is the standard term for “ starting up a computer”. During bootstrapping, the kernel is loaded into.
How to make a pseudo-file As a follow-up to our first lab, we examine the steps needed to create our own ‘/proc’ file.
1 Homework Reading –PAL, pp , Machine Projects –Finish mp2warmup Questions? –Start mp2 as soon as possible Labs –Continue labs with your.
Introduction to C Programming Overview of C Hello World program Unix environment C programming basics.
System Startup and Shutdown
Linux+ Guide to Linux Certification, Third Edition Chapter 11 Compression, System Backup, and Software Installation.
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
Linux Operating system
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.
Operating Systems Lab. (#2) University of Tehran – ECE Dept. Fall 2005 Reza Shokri
System Calls 1.
Guide to Linux Installation and Administration, 2e1 Chapter 3 Installing Linux.
CIS 191 – Lesson 2 System Administration. CIS 191 – Lesson 2 System Architecture Component Architecture –The OS provides the simple components from which.
DOS  In the 1980s or early 1990s, the operating system that shipped with most PCs was a version of the Disk Operating System (DOS) created by Microsoft:
Porting Linux to the Puppeteer. Getting the kernel source You will need a clean version of the linux kernel source This can be found at
Review Security Hardening IPTables SELinux. Today Installations and updates – Rpm command and packages Apache “Issue Ownership”
Exercise #1: Exploring Open- Source Operating Systems with Virtual Machines J. H. Wang Mar. 9, 2010.
Assembly Questions תרגול 12.
Makefiles. makefiles Problem: You are working on one part of a large programming project (e. g., MS Word).  It consists of hundreds of individual.cpp.
Introduction to Linux ( I ) Sidney Fong 4 th Feb 2006.
Guide to Linux Installation and Administration, 2e1 Chapter 10 Managing System Resources.
1 Objectives Manage and install new file systems.
Linux Administration. Pre-Install Different distributions –Redhat, Caldera, mandrake, SuSE, FreeBSD Redhat Server Install –Check HCL –Significant issues.
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
System Startup & Shutdown
Unit - VI. Linux and Real Time: Real Time Tasks Hard and Soft Real Time Tasks Linux Scheduling Latency Kernel Preemption Challenges in Kernel Preemption.
CSNB334 Advanced Operating Systems 3a. Working with the Linux Community Lecturer: Abdul Rahim Ahmad.
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.
Linux Overview COMS W4118 Spring Slides based on Phil Hutto, Silberschatz 2 History Linux is a modern, free operating system based on UNIX standards.
Exercise #1: Exploring Open- Source Operating Systems with Virtual Machines J. H. Wang Sep. 25, 2015.
CSC414 “Introduction to UNIX/ Linux” Lecture 2. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
OS Project 0 February 25, Outline  Linux Installation  Linux Kernel Compilation  System Call Development  Kernel Modules / 452.
Byoung-Jo CHOI Fall 2007 SW Project II Advanced Linux Programming.
Linux Architecture Overview.
Unix System Administration Booting and Shutting Down Chapter 2.
ICOM Noack Linux I/O structure Device special files Device switch tables and fops How the kernel finds a device Parts of a device driver or module.
CS 461 Operating Systems I.Mona Alshehri Office
Chapter Linux Basics. Acknowledgements This presentation was prepared by – Banyat Settapanich – Bahran Madaen This presentation will be updated later.
Program Libraries 1. What is a program library? A library is a collection of implementations of behavior, written in terms of a language, that has a well-defined.
Gorman, Stubbs, & CEP Inc. 1 Introduction to Operating Systems Lesson 8 Linux.
MINIX 3 – Introduction Béat Hirsbrunner Lecture 1, 18 September 2012 Main reference Andrew S. Tanenbaum, Albert S. Woodhull Operating Systems : Design.
Visual Programming Borland Delphi. Developing Applications Borland Delphi is an object-oriented, visual programming environment to develop 32-bit applications.
Getting Started with the Kernel. Obtaining the Kernel Source
Topic 2: Hardware and Software
Getting Started with the Kernel
Guide to Linux Installation and Administration, 2e
LINUX WINDOWS Vs..
UBUNTU INSTALLATION
Homework Reading Machine Projects Labs PAL, pp ,
Homework In-line Assembly Code Machine Language
Software Development with uMPS
Assembly Language Programming V: In-line Assembly Code
LINUX WINDOWS Vs..
Assembly Language Programming II: C Compiler Calling Sequences
Discussions on HW2 Objectives
Project 3: An Introduction to File Systems
Linux Architecture Overview.
Discussions on HW2 Objectives
Presentation transcript:

ICOM Noack Linux kernel structure Kernel code structure How it boots itself All the system calls are available System is configured Process handling is available

ICOM Noack The kernel code Obtaining it Information at ftp ftp.pr.kernel.orgftp.pr.kernel.org Usually it is in/usr/src – various directories Most recent stable version is What it contains The source code that compiles and links into a bootable system The compressed version is vmlinuz It contains all the openly available device drivers Future drivers appear in future versions or can be compiled in the current version Makefiles for automated configuration

ICOM Noack structure Major directories Arch – architecture-dependent Documentation – read these Drivers – all except network Fs – the file system Include – includes of multiple use Init – from boot to running kernel Ipc – IPC Kernel – the kernel structures Lib – libraries for the kernel Mm – memory management Net – the network code

ICOM Noack More structure The auxiliary files Makefile and rules These explain quite a bit about kernel structure Note – this makefile activates the others in each subdirectory README How to compile Others Casual reading – how Linux gets developed

ICOM Noack Linux is ported to these architectures

ICOM Noack View of the i386 arch area

ICOM Noack Contents of lib for the i386 Comments The.S are assembly language – GNU, not Microsoft Note the individual makefile General utilities, as you would expect

ICOM Noack The makefile for lib Notes The CONFIG shell variables come from the make config step Rules.make is used The.S.o: rule does assembly instead of compilation because of the $(AFLAGS) argument # # Makefile for i386-specific library files.. #.S.o: $(CC) $(AFLAGS) -c $< -o $*.o L_TARGET = lib.a obj-y = checksum.o old-checksum.o delay.o \ usercopy.o getuser.o \ memcpy.o strstr.o obj-$(CONFIG_X86_USE_3DNOW) += mmx.o obj-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o obj-$(CONFIG_DEBUG_IOVIRT) += iodebug.o include $(TOPDIR)/Rules.make

ICOM Noack A sample of GNU assembler /* unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) */.text.align 4.globl csum_partial pushl %esi pushl %ebx movl 20(%esp),%eax# Function arg: unsigned int sum movl 16(%esp),%ecx# Function arg: int len movl 12(%esp),%esi# Function arg: unsigned char *buff testl $2, %esi# Check alignment. jz 2f# Jump if alignment is ok. subl $2, %ecx# Alignment uses up two bytes. jae 1f# Jump if we had at least two bytes. addl $2, %ecx# ecx was < 2. Deal with it. jmp 4f

ICOM Noack Some recognizable parts of kernel Notes This is the i386- specific part of kernel Note semaphore.c smp.c signal.c Some of these files will show up in the arch-independent part also

ICOM Noack Tiny piece of kernel code from mm #if CONFIG_HIGHMEM pte_t *kmap_pte; pgprot_t kmap_prot; #define kmap_get_fixmap_pte(vaddr)\ pte_offset(pmd_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)) void __init kmap_init(void) { unsigned long kmap_vstart; /* cache the first kmap pte */ kmap_vstart = __fix_to_virt(FIX_KMAP_BEGIN); kmap_pte = kmap_get_fixmap_pte(kmap_vstart); kmap_prot = PAGE_KERNEL; } #endif /* CONFIG_HIGHMEM */

ICOM Noack The contents of fs This shows all the file systems supported by Linux

ICOM Noack The non-architecture-dependent routines of the kernel

ICOM Noack The driver repertoire in general

ICOM Noack The block device drivers note: paride contains the IDE drivers

ICOM Noack A few of the char drivers

ICOM Noack Comments - drivers Block device drivers All the common block devices – these include disks and anything else that is block-oriented Character device drivers These include the character-by-character devices – also some pseudo-devices Note – these are architecture-independent

ICOM Noack Some things that aren’t in the kernel Anything that isn’t in vmlinuz Examples: Init – it reads /etc/inittab and starts all those processes Startup scripts – these are called up by init using inittab Libraries and most network daemons The kernel and the distribution are different The distribution contains utilities and libraries for users It contains the system installation utilities Typical distributions are RedHat, Slackware, Suse X-windows is part of the distribution or separately downloadable

ICOM Noack Some techniques for viewing the kernel This is W2K and WXP – Obviously the kernel won’t compile here, but it makes nice slides Open with permits viewing makefiles, etc. Documentation directory contains.txt files Set the.txt association to word, not notepad Viewing in Linux is a little easier The usual gui lets you view the filesystem treewise Clicking on individual.c,.h,.s, etc immediately displays the file in editor (emacs) Learn to use grep and fgrep to find out where structures, etc. are defined Learn to use du (disk usage) to get an idea of the size of the kernel