KernelDriverProgrammingCourse2015/OutlineDay2
Jump to navigation
Jump to search
Kernel Driver Programming Course Day 2
- Intro
- Welcome
- Results of the first course day, a number of changes have been queued up for merging into the official kernel sources
- 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
- Plan for today:
- 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
- i2c hardware and driver basics
- Looking at a userspace interface from a userspace pov: input devices / evdev
- Looking at evdev from the kernel side
- Handson
- i2c hardware and driver basics
- i2c hardware basics
- Exploring an i2c device using i2cdetect and i2cget
- Looking at a basic i2c driver
- Lunch Break
- Looking at a userspace interface from a userspace pov: input devices / evdev
- Looking at evdev from the kernel side
- Handson
- Building and running your own kernel
- Build and install u-boot for your board using the instructions from Day 1
- Cross compile your own kernel, following the [[KernelDriverProgrammingCourse2015/PreparationDay2 preparation instructions] for today
- Install this kernel by copying arch/arm/boot/zImage to the cards boot partition
- Also copy over the build dtb files arch/arm/boot/dts/sun?i-*.dtb to the dtb dir under the boot partition
- Boot your board, login as root and do "uname -a" to verify that the board is running your kernel
- Building and running a standalone driver
- 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
- Type "make" to build the driver, and then transfer the generated .ko file to your ARM board
- On your arm system do "insmod i2c-basic-drv.ko" and then "lsmod" to verify that the module has loaded
- Building and running your own kernel