Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Introduction to Linux device driver 潘仁義. The role of device driver Flexible Mechanism? Policy? 只提供存取硬體的能力,而不加諸任何限制 介於『應用程式』與『硬體裝置』的軟體層 功能性 ? 簡潔性 ?"— 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 2.4.10 above Kernel source http://www.kernel.org/ 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-2.4.24 cp.config /boot/config-2.4.24 cp System.map /boot/System.map.2.4.24 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 http://ourworld.compuserve.com/homepages/KanjiFlash/BPTour.h tm The Linux Boot Process http://oldfield.wattle.id.au/luv/boot.html The Linux Kernel HOWTO http://24.221.230.253/HOWTO/kernel- howto/linux_boot_process.html

8 Demo example Source http://www.oreilly.com.tw/chinese/linux/ldd2.html http://www.oreilly.com.tw/bookcode/ldd2-samples-1.0.2.tar.gz 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 Run tail – f /var/log/messages insmod./hello.o MODULE_LICENSE( “ GPL ” )

9 作業 裝一台 linux, compile kernel, boot 裝上 demo code, 執行 eCos eCos home http://www.ecos.sourceware.org/ eCosCentric http://www.ecoscentric.com/ WebCast: A License-Free Alternative RTOS for the G4 PowerPC http://seminar2.techonline.com/~pentek22/sep2303/index.shtml


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

Similar presentations


Ads by Google