Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Linux device driver

Similar presentations


Presentation on theme: "Introduction to Linux device driver"— Presentation transcript:

1 Introduction to Linux device driver
潘仁義

2 The role of device driver
Flexible Mechanism? Policy? 只提供存取硬體的能力,而不加諸任何限制 介於『應用程式』與『硬體裝置』的軟體層 功能性? 簡潔性?

3 Splitting the Kernel

4 Classes of devices and modules
Character device Can be accessed as a stream of bytes open, close, read, write /dev/console Block device Can host a filesystem and transfer any number of bytes at a time mount a filesystem Network interface Can exchange data with other hosts packet transmission

5 Kernel compile and installation
Version above Kernel source Make kernel cd /usr/src/linux make clean make menuconfig make dep; make bzImage make modules; make modules_install cp arch/i386/boot/bzImage /boot/vmlinuz cp .config /boot/config cp System.map /boot/System.map lilo; reboot; dmesg

6 /usr/src/linux directory
kernel/ 除了fs, mm, networking外的核心碼 fs/ File system mm/ Memory management net/ Socket library, Protocol stack ipc/ and lib/ Include/ and arch/ driver/ driver/char, driver/block, driver/net

7 Linux booting process A Guided Tour of a Linux Boot
The Linux Boot Process The Linux Kernel HOWTO

8 Demo example Source Make Run
Make cd ~/ldd2/misc-modules/ make clean; make Oops? cd /usr/include/ mv linux linux.orig ln –s /usr/src/linux/include/linux/ linux mv asm asm.orig ln –s /usr/src/linux/include/linux/acm/ asm Oops? Again make export.ver #include<slab.h> Run tail –f /var/log/messages insmod ./hello.o MODULE_LICENSE(“GPL”)

9 作業 裝一台linux, compile kernel, boot 裝上demo code, 執行 eCos eCos home
eCosCentric WebCast: A License-Free Alternative RTOS for the G4 PowerPC


Download ppt "Introduction to Linux device driver"

Similar presentations


Ads by Google