1. Introduction to Linux Kernel & Embedded Linux

advertisement
Syllabus for Embedded System course
1. Linux Basics & commands
2. Advanced C & Embedded C programming
3. Linux System and Network Programming
4. Embedded programming with ARM processor (Beagle Bone Black board & Raspberry PI
5. Linux kernel and Device driver programming
Hands on Beagle Board:
1. Build custom Linux kernel and deployment on Embedded board (to support USB-Wifi device)
2. C-program to access GPIO ports (demo with LDR) from Linux User space
3. Data acquisition from I2C based accelerometer sensor
4. C-program to develop to capture video frames from webcam
5. Diagnosis Embedded devices (With NOR Flash memory example)
Lab activities: 1
o Basic & Advanced Linux commands practice
o Copy file to/from USB to Linux machine without GUI
o Operation on C-Files implement using function pointers with CLI support
o Data structure programs
o Explore Linux Binary Utilities like objdump, nm, readelf …
o Linux application debugging with gdb.
o Explore more options in GDB (Call stack, segmentation fault …)
o Make file, static and dynamic library creation
Lab activities: 2 (Linux User Space programming)
o Work on programs using File I/O System calls open, read, write, dup..
o PC-PC communication via RS232 by using Linux system calls
o Work on programs using process related system calls fork, exec..
o Work on programs using posix threads
o Develop customized shell (support commands options like ls –lrt, ps –aef | wc ….)
o Work on programs for Inter process communication with pipe, message queue, Shared memory,
semaphore.
Lab activities: 3:
o Linux network programming TCP/IP and UDP
o Concurrent and iterative server programming
Lab activities: 4
o Install arm cross compiler and tool chain
o Debug Embedded application using Eclipse IDE on Target Beagle board black
o C-program to access GPIO ports (demo with LDR) from Linux User space
o Data acquisition from I2C based accelerometer sensor
o Diagnosis Embedded devices (With mmap NOR Flash memory example)
o Customization kernel compilation and compile using cross compiler
o Practice U-boot commands
Lab activities: 5
o Basic Kernel Module programming with Jiffies and task_ struct contents
o Parameter passing to kernel modules and module stacking
o Explore insmod, modprobe, rmmod, modinfo tools
Lab activity: 6
o Write application to validate RAM and peripherals of Embedded board (RS Pi/BBB) using mmap
o Disable existing Parallel port driver, Develop new parallel port driver which should control LED’s
placed on bread board.
Lab activity: 7
o Write interrupt handler for parallel port driver; generate interrupt by using voltage, it should
invoke interrupt handler routine and respective boot halves
o Enumerate USB devices by using libusb
Detail Syllabus mentioned in next pages:
Phase –1:
Lab activities for Linux User Space training:
1.
2.
3.
4.
5.
6.
Develop shell script , should execute on auto boot
Develop standard linux library to release external vendor
Data acquisition from serial port by using Linux I/O System calls
Develop Linux customized shell by using process related system calls
Access I/O memory (Access ACPI table) using mmap system call.
Develop client-server concurrent application based on sensor data acquisition
Linux introduction:
o What is OS
o Components of OS
o OS vs Kernel
o Kernel Services
o Types of operating systems
o Introduction to Linux
o Basic Linux commands
o Explore Linux root file system /proc/sys/bin/sbin….
o Shell scripting
Program Execution in Linux
o gcc compiler and gdb (GNU debugger)
o Executable Image contents
o Text/Code, Read only Data, Data, BSS
o Loading and running a program in Physical memory
o Loading and running a program in Virtual memory
Program with Multiple C files
o Why multiple C files
o Definition Vs Declaration
o Hiding data and functions
o Header files
Development tools in Linux
Compiler:
o Compilation Stages
o Object file format
Linker:
o Function of Linker
o Static linking Vs Dynamic linking
o Executable file format
o Executable file vs Executable Image in memory
o Archive or Libray utility, shared object (.so)
o Make utility
o
gdb-Debugger
File and I/O Services (System calls)
o
o
o
o
o
o
o
o
o
File descriptors
File types
Stdin, Stdout and Stderr File descriptors
Link or Relationship between File Descriptor and File or device
File descriptors of same file but from multiple processes
File I/O system calls (unbuffered i/o)
open, create, close, lseek, read, write, dup, dup2
fcntl, ioctl
File types, IDs and Access permissions
Multi-threading
o Multi-threaded programming
o Synchronization and Mutual exclusion for threads
o POSIX Semaphores
o POSIX Mutexes
Multi-Processing
o Process Identifiers
o fork, exit, wait, waitpid, execv
Signals
o Signal Concepts
o Signal(), kill(), raise(), alarm() and pause()
Inter Process Communication
1. Pipes
2. FIFO (Named pipes)
3. Message Queues
4. Semaphores
5. Shared Memory,
I/O communication
mmap system call
ioperm, iopl system call
Network Programming
o Concept of socket / socket pair
o Concept of Client and Server
o Concept connectionless and connection oriented protocols (UDP/TCP)
o Socket calls for UDP server and client
o Socket calls for TCP server and client
o Concurrent/Iterative server programming
Phase – 2:
1. Introduction to Linux Kernel & Embedded Linux
Linux OS vs Linux Kernel
Kernel Source Tree
Configuring and Building Kernel
Embedded Linux Development Environment
Cross-compiling tool chains
Boot loader, booting process
Booting process on ARM TI(Embedded CPU)
U-boot Boot loader
Device Tree
Lab activities:






Install arm cross compiler and tool chain, (ARM & Power PC)
Practice U-boot commands
Debugging Embedded application using Eclipse IDE on Target Beagle board black
Customization kernel compilation and compile using cross compiler
Configuring, Compilation and booting new kernel on Power PC T1040 board with YOCTO
environment.
Build custom Linux kernel and deployment on Embedded board (to support USB-Wifi
device)
1. Kernel Modules
-
Kernel Programming vs Application Programming
Kernel APIs
Module Concepts
Module tools
Module Parameters
Module stacking
Lab activities:
1. Basic Kernel Module programming with Jiffies and task_ struct contents
2. Parameter passing to kernel modules and module stacking
3. Explore insmod, modprobe, rmmod, modinfo tools
2. Character Device Drivers
Device files and Device Numbers
Opening a device
The file_operations
Registering and unregistering a device
Character Driver implementation
Proc file system support
Lab activities:
1. Write application program to access CMOS driver API’s
2. Character Device registration by using Virtual Buffer
3. Timing issues in the kernel
System tick, Tick rate and Jiffies
Knowing the current time
Implementing long and short delays
Kernel Timers
Lab activity: Modular program on Ktimers and Jiffies
4. Memory management and accessing hardware
Physical memory and Virtual memory
Kernel memory API’s
About MMAP, IO Ports accessing from user space with ioperm
Accessing I/O Ports
Accessing I/O memory
Memory Barriers
Lab activity:
1. Write application to validate RAM and peripherals of Embedded board (RS Pi/BBB)
using mmap call.
2. Disable existing Parallel port driver, Develop new parallel port driver which should
control LED’s placed on bread board.
5. Concurrency in the Kernel
Understanding Concurrency
Causes of concurrency
Atomic operations
Spin Locks
Reader-Writer Spin Locks
Semaphores
Reader-Writer Semaphores
Mutexes
Asynchronous I/O
Lab activity:
1. Handle interrupts in Userspace by using Asynchronous I/O approach in the kernel
driver( Using Key board interrupt/external interrupts)
2. Use Concurrency related kernel API in above driver where ever applicable (walk through
code using LXR)
6 Interrupts and Bottom Halves
Handling Interrupts
Understanding Bottom halves
Softirqs
Tasklets
Work Queues
Lab activity:
1. Write interrupt handler for parallel port driver; generate interrupt by using voltage, it
should invoke interrupt handler routine and respective boot halves
7. Linux Device and Driver model
Bus drivers
USB/PCI/I2C
USB architecture
Linux-USB sub system
PCI drivers
Enumeration
Platform drivers
Serial Driver
Lab activity: (Below activities will be explained with our remote board)
1. Understand PCI driver by using Ethernet-Modem card
2. Understand USB Host client driver by using usb-skelton.c file
3. Implement a driver that registers as an I2C driver with Device Tree for sensor, Make sure
that the probe/remove functions are called when there is a device/driver match.
4. configure PCI space by using device tree
8. Kernel Debugging and Kernel crash analysis
Kernel debugging techniques like kdb, kgdb, printk..
Kernel crash analysis
Lab activity: Develop tool to analyze kernel crash for x86 architecture
Note: 1. If any topic additionally required based on the training sessions, to be considered
2. For concept flow of the given chapters in each phase, additional topics can be added
Download