C Language
Publish date: Oct 16, 2019
Last updated: Apr 22, 2020
Last updated: Apr 22, 2020
#define is a C preprocessor directive used to define macros.
#define MACRONAME (expression)
For example, in C
int x;
int *p;
- we can declare a variable x that holds an integer value,
- and a variable p that holds a pointer to an integer value in memory:
- Peek inside Kernel
- Kernel Facilities
- kernel threads
- are like user processes but they live in kernel space and have access to special kernel functions and data structures
- Kernel Interfaces
- Kernel APIs
- kernel threads
- Linux device model
- Character / char drivers -printers, watchdogs
- Serial drivers
- UARTS drivers
- TTY drivers
- Input drivers - keyboard, mouse
- USB drivers
- touch screens drivers
- Audio/ Video/ Block device drivers
- Network interface cards
- Wireless drivers - Bluetooth, Wifi, GPRS, CDMA
- Embedding Linux
- Tool chains
- Bootloaders
- Memory Layout
- Debugging drivers
Introduction
- What is linux? where is the official source and mailing list? Where is the official source?
- How to buid linux from source?
- Linux has lodable modules
lsmod - Kernel mode and user mode aka user/kernel space
- to effectively implement time-sharing system
- peek Internals of kernel from pseudo fs
procusuallt mounted at/root
Kernel boot starts with the execution of real mode assembly code living in
/arch/x86/bootdirectory
- How to create a new kernel thread?1
#include <linux/kthread.h>
What are devices and drivers?
Schematics of device from vendor, Role of device driver?
- device nodes
/dev - drivers
/sys - useful abstractions provided by kernel by
sysfs,kobjects,device classes,udev - Hotplug and Coldplug? Whats the difference?
- SPI available in market today includes RF (radio frewquency) chips, smart card interfaces, EEPROM, RTC, touch sensor, ADCs
- Write a
Makefilefor your driver file - Compilation would create a
.kofile - Load the
.kofile - Exporting/importing kernel symbol table
nm- list symbols from object fileskernel headers printk KERNEL_ALERT # Makefile obj-m
Footnotes
[^2]: