• No results found

EXPLORING LINUX KERNEL: THE EASY WAY!

N/A
N/A
Protected

Academic year: 2021

Share "EXPLORING LINUX KERNEL: THE EASY WAY!"

Copied!
39
0
0

Loading.... (view fulltext now)

Full text

(1)

EXPLORING LINUX KERNEL:

THE EASY WAY!

(2)

PROBLEM

Explore linux kernel TCP/IP stack

• Solution

– Try to understand relative kernel code – Available text

– Run kernel in virtualized environment

• Selected solution

– Develop a virtual machine using QEMU – Build Linux kernel as Eclipse project

– Interconnect Eclipse with QEMU

(3)

IN THIS PRESENTATION

• Virtualization

• What is QEMU

• Linux

• Root File System • Linux kernel

• Linux under QEMU

(4)

VIRTUALIZATION

• Separation of resources from underlying physical

resources

• Examples

─ Memory virtualization

─ Partitioning the hard disk ─ Server virtualization

─ Hardware virtualization

(5)
(6)

WHY VIRTUALIZATION

• Resource utility optimization

• Testing and Development

• Exploration

(7)

WHY VIRTUALIZATION

• Resource utility optimization

• Testing and Development

• Exploration

(8)

HOW TO GET VIRTUALIZATION

• Xen

– Baremetal hypervisor

– Open source virtualization

• VMWare

– A number of virtualization products

• VMWare player • Ware workstation

(9)

QEMU

• QEMU

– CPU Emulator – Open source

– Emulation of various architectures

• x86, x86_64 • ARM

• MIPS

– Supports large variety of devices

(10)

QEMU

• Networking features

– Connection to multiple virtualized instances – Local host connection using NAT

– Use same network as the host

• Communication between host and guest system

• SMP system simulation

– Multiple CPUs can be virtualized to get an SMP

machine

(11)

INTRODUCTION TO LINUX

• Robust, open source OS

• Applications range form servers to embedded

systems

• Best option for research purpose

• Two major parts

(12)

ROOT FILE SYSTEM

• File system

– File system is hierarchy of directories

• Types of file system

– How data is organized on the disc – Rules to handle the data

(13)

ROOT FILE SYSTEM

• Linux file system

– Supports large number of file system types – Everything starts from “root” directory

– Hierarchy may vary with Linux distribution or system

requirement

(14)

ROOT FILE SYSTEM

• File system hierarchy

• /bin

– Contains binary executables

(15)

ROOT FILE SYSTEM

• File system hierarchy

• /boot

(16)

ROOT FILE SYSTEM

• File system hierarchy

• /dev

– Contains device files

(17)

ROOT FILE SYSTEM

• File system hierarchy

• /home

– Contains directories of all the users registered to the

system

(18)

ROOT FILE SYSTEM

• File system hierarchy

• /lib

(19)

ROOT FILE SYSTEM

• File system hierarchy

• /media

– Contains directories for temporarily mounted

removable devices

(20)

LINUX FILE SYSTEM

• File system hierarchy

• /etc

– Contains configuration files for all the programs

(21)

LINUX FILE SYSTEM

• File system hierarchy

• /sbin

– Named after system binaries

– Contains executable binaries especially for system

(22)

ROOT FILE SYSTEM

• File system hierarchy

• /sys

– It is utilized by sysfs

(23)

ROOT FILE SYSTEM

• File system hierarchy

• /tmp

(24)

ROOT FILE SYSTEM

• File system hierarchy

• /usr

– Contains files that can be shared across multiple

machines.

(25)

ROOT FILE SYSTEM

• File system hierarchy

• /var

– Contains variable files – File size varies with time

(26)

LINUX KERNEL

• Core of Linux

• Manages hardware

• Distributes the resources

• Basic components of kernel

– Scheduler

– Interrupt handler

– Memory management – System services

Network services & inter-process communication

(27)

LINUX KERNEL

• User space

– All user level programs – Limited privilege

• Kernel space

– Protected memory space

– Communicates with user space using system calls and

virtual file systems

– Has complete access to the resources

(28)
(29)

LINUX KERNEL

• Linux kernel source

– http://www.kernel.org/

(30)

LINUX KERNEL

• Distribution of Linux

– Debian – SUSE Linux – Gentoo – Slackware

– Red Hat Enterprise Linux – Fedore Project

(31)

BOOTING THE LINUX KERNEL

• System startup

• BIOS

– Power on self test

• Checks the hardware

– Search for bootable device

• CD-ROM

• Disk partition • USB

• Bootable kernel file

(32)

BOOTING THE LINUX KERNEL

• Booting procedure in vmlinuz

– Basic hardware startup – Basic environment setup – Kernel decompression

• decompress_kernel()

– Memory management

(33)

BOOTING THE LINUX KERNEL

• Start_kernel() performs

– initialization of procedure – Setup interrupts

– Load of initial-RAM disk (initrd) in memory

(34)

BOOTING THE LINUX KERNEL

Initial-RAM disc (initrd.img)

– Initial root file system

– 1st step to load real file system

(35)

LINUX UNDER QEMU

• Requirement to run Linux on QEMU

– Virtualized hardware

– Root file system (initrd.img)

– Linux kernel (bzimage of Linux kernel)

(36)

LINUX UNDER QEMU

• BIOS in QEMU

– QEMU uses SeaBIOS

– SeaBIOS is a free BIOS implementation

– SeaBIOS can be used to boot emulator/hardware

(37)

LINUX UNDER QEMU

• -append option specifies the device on which the

file system is mounted

– ‘root=/dev/ram rw’

• ‘rw’ gives read/write permission

• Flags are added to support debuging

– Example: -s and –S

• -s: start servergdb

(38)

LINUX KERNEL DEBUGGING

Procedure of linux debugging

– Setup kernel source code as Eclipse project – Build the project

– Setup emulator to run virtualized machine – Connect Eclipse with emulator

– Setup break points in kernel source – Run debug configuration.

(39)

LINUX KERNEL DEBUGGING

References

Related documents

•  The Linux Kernel Documentation: the extensive documents extracted from kernel source. •  Linux Weekly News: easy explanation of recently added

• Linux kernel developers frown upon binary only modules, because they don’t have the source and thus cannot debug them.. • Later kernels include facilities to mark when a binary

The literature reviewed shows that allagreed on the fact that interpersonal communication plays a very important role in the transfer of information between the reference

•  An easy way to enter debug mode is to right click on the class and select Debug As  Java Application.. Debugging

2 Configuring and connecting to a target 2.4 Configuring a connection to a Linux Kernel.. 2.5 About configuring connections to a Linux target using Application Debug with

A command line program is provided allowing you to debug your configuration and SMTP client setup outside of the SoftPLC runtime, yet on the same box using the Linux command

If the directory-based project format is used, the settings for a run/debug configuration are stored in a separate xml file in the.. .idea\runConfigurations folder if the

accounting method (VRRS), attribute list (VRRS), debug vrrp all, debug vrrp vrrs, debug vrrs accounting, debug vrrs infra, debug vrrs plugin, show vrrp, show vrrs clients, show