introduction to linux device driver
Download
Skip this Video
Download Presentation
Introduction to Linux device driver

Loading in 2 Seconds...

play fullscreen
1 / 9

Introduction to Linux device driver - PowerPoint PPT Presentation


  • 173 Views
  • Uploaded on

Introduction to Linux device driver. 潘仁義. The role of device driver. Flexible Mechanism? Policy? 只提供存取硬體的能力,而不加諸任何限制 介於 『 應用程式 』 與 『 硬體裝置 』 的軟體層 功能性 ? 簡潔性 ?. Splitting the Kernel. Classes of devices and modules. Character device Can be accessed as a stream of bytes

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Introduction to Linux device driver' - evelia


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
the role of device driver
The role of device driver
  • Flexible
    • Mechanism? Policy?
    • 只提供存取硬體的能力,而不加諸任何限制
  • 介於『應用程式』與『硬體裝置』的軟體層
    • 功能性? 簡潔性?
classes of devices and modules
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
kernel compile and installation
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
usr src linux directory
/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
linux booting process
Linux booting process
  • A Guided Tour of a Linux Boot
    • http://ourworld.compuserve.com/homepages/KanjiFlash/BPTour.htm
  • 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
demo example
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<slab.h>
  • Run
    • tail –f /var/log/messages
    • insmod ./hello.o
    • MODULE_LICENSE(“GPL”)
slide9
作業
  • 裝一台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
ad