KernelDriverProgrammingCourse2015/OutlineDay2

From RevSpace
Revision as of 13:11, 5 August 2015 by Hans de Goede (talk | contribs)
Jump to navigation Jump to search

Kernel Driver Programming Course Day 2

  1. Intro
    1. Welcome
    2. Results of the first course day, a number of changes have been queued up for merging into the official kernel sources
    3. Some further changes are queued up in my sunxi-wip branch as they rely on the pmic for otg vbus-detection and the matching pmic code is not yet merged upstream
  2. Plan for today:
    1. Kernel is an intermediate between hardware and applications, a device driver typically has 2 interfaces, one side talking to the hardware, and another side talking to userspace
    2. i2c hardware and driver basics
    3. Looking at a userspace interface from a userspace pov: input devices / evdev
    4. Looking at evdev from the kernel side
    5. Handson
  3. i2c hardware and driver basics
    1. i2c hardware basics
    2. Exploring an i2c device using i2cdetect and i2cget
    3. Looking at a basic i2c driver
  4. Lunch Break
  5. Looking at a userspace interface from a userspace pov: input devices / evdev
  6. Looking at evdev from the kernel side
  7. Handson
    1. Building and running your own kernel
      1. Build and install u-boot for your board using the instructions from Day 1
      2. Cross compile your own kernel, following the [[KernelDriverProgrammingCourse2015/PreparationDay2 preparation instructions] for today
      3. Install this kernel by copying arch/arm/boot/zImage to the cards boot partition
      4. Also copy over the build dtb files arch/arm/boot/dts/sun?i-*.dtb to the dtb dir under the boot partition
      5. Boot your board, login as root and do "uname -a" to verify that the board is running your kernel
    2. Building and running a standalone driver
      1. On your laptop download the basic i2c driver, edit the Makefile adjusting the path to the linux kernel sources and CROSS_COMPILE= settings to match your system
      2. Type "make" to build the driver, and then transfer the generated .ko file to your ARM board
      3. On your arm system do "insmod i2c-basic-drv.ko" and then "lsmod" to verify that the module has loaded