The document provides an overview of writing a Linux USB device driver. It discusses key concepts such as loadable kernel modules (LKMs), registering and unregistering a device driver, common device driver types, and important kernel functions for device drivers. It also outlines the general steps to implement a device driver, including understanding the device, mapping operations to file operations, creating a special device file, and loading the driver module.
The Linux driver model was created over a decade ago with the goal of unifying all hardware drivers in the kernel in a way to provide both consitant device naming and properly power management control. This talk will go into how well those goals were reached, how the model works today, and what remains to be done.
Greg KH, The Linux Foundation
Device drivers in Linux allow software to interact with hardware devices by implementing functions like open, read, write, and close, and can be built into the kernel or loaded as modules. The kernel provides common interfaces for character and block devices that drivers can hook into. Device drivers must be registered with the kernel and handle events like loading, unloading, and accessing devices through file operations.
This course gets you started with writing device drivers in Linux by providing real time hardware exposure. Equip you with real-time tools, debugging techniques and industry usage in a hands-on manner. Dedicated hardware by Emertxe's device driver learning kit. Special focus on character and USB device drivers.
Linux Device Driver Training-TutorialsDaddyStryker King
The document outlines a Linux device driver training course which covers writing basic character drivers and modules, memory management, interrupts, synchronization, and debugging techniques. It also discusses related kernel topics like processes, scheduling, syscalls, and timers. Additionally, it introduces multimedia driver architectures for Android cameras and HDMI and provides a forum for questions.
The document discusses various data structures and functions related to network packet processing in the Linux kernel socket layer. It describes the sk_buff structure that is used to pass packets between layers. It also explains the net_device structure that represents a network interface in the kernel. When a packet is received, the interrupt handler will raise a soft IRQ for processing. The packet will then traverse various protocol layers like IP and TCP to be eventually delivered to a socket and read by a userspace application.
This document provides an overview of using systemd to manage services effectively. It discusses defining service behavior and types, handling timeouts and failures, tightening security, and automating monitoring and management. The key steps outlined are to define expected behavior, plan for the unexpected, tighten security early, and automate monitoring. Various systemd directives and options are explained for tasks like controlling resources, dependencies, reloading, and failure handling.
The document provides an introduction to Linux kernel modules. It discusses that kernel modules extend the capabilities of the Linux kernel by executing code as part of the kernel. It then describes the anatomy of a kernel module, including initialization and cleanup functions. The document demonstrates a simple "hello world" kernel module example and how to build, load and unload kernel modules. It also introduces the idea of character device drivers as a more advanced kernel module example.
This document provides an overview of different Linux I/O models including blocking I/O, non-blocking I/O, I/O multiplexing using select, poll, epoll, signal-driven I/O and asynchronous I/O. It describes key functions and system calls used for each model and provides examples of how they can be used in drivers and applications.
The Linux driver model was created over a decade ago with the goal of unifying all hardware drivers in the kernel in a way to provide both consitant device naming and properly power management control. This talk will go into how well those goals were reached, how the model works today, and what remains to be done.
Greg KH, The Linux Foundation
Device drivers in Linux allow software to interact with hardware devices by implementing functions like open, read, write, and close, and can be built into the kernel or loaded as modules. The kernel provides common interfaces for character and block devices that drivers can hook into. Device drivers must be registered with the kernel and handle events like loading, unloading, and accessing devices through file operations.
This course gets you started with writing device drivers in Linux by providing real time hardware exposure. Equip you with real-time tools, debugging techniques and industry usage in a hands-on manner. Dedicated hardware by Emertxe's device driver learning kit. Special focus on character and USB device drivers.
Linux Device Driver Training-TutorialsDaddyStryker King
The document outlines a Linux device driver training course which covers writing basic character drivers and modules, memory management, interrupts, synchronization, and debugging techniques. It also discusses related kernel topics like processes, scheduling, syscalls, and timers. Additionally, it introduces multimedia driver architectures for Android cameras and HDMI and provides a forum for questions.
The document discusses various data structures and functions related to network packet processing in the Linux kernel socket layer. It describes the sk_buff structure that is used to pass packets between layers. It also explains the net_device structure that represents a network interface in the kernel. When a packet is received, the interrupt handler will raise a soft IRQ for processing. The packet will then traverse various protocol layers like IP and TCP to be eventually delivered to a socket and read by a userspace application.
This document provides an overview of using systemd to manage services effectively. It discusses defining service behavior and types, handling timeouts and failures, tightening security, and automating monitoring and management. The key steps outlined are to define expected behavior, plan for the unexpected, tighten security early, and automate monitoring. Various systemd directives and options are explained for tasks like controlling resources, dependencies, reloading, and failure handling.
The document provides an introduction to Linux kernel modules. It discusses that kernel modules extend the capabilities of the Linux kernel by executing code as part of the kernel. It then describes the anatomy of a kernel module, including initialization and cleanup functions. The document demonstrates a simple "hello world" kernel module example and how to build, load and unload kernel modules. It also introduces the idea of character device drivers as a more advanced kernel module example.
This document provides an overview of different Linux I/O models including blocking I/O, non-blocking I/O, I/O multiplexing using select, poll, epoll, signal-driven I/O and asynchronous I/O. It describes key functions and system calls used for each model and provides examples of how they can be used in drivers and applications.
This presentation gives an overview of Linux kernel block I/O susbsystem functionality, importance of I/O schedulers in Block layer. It also describes the different types of I/O Schedulers including the Deadline I/O scheduler, Anticipatory I/O Scheduler, Complete Fair queuing I/O scheduler and Noop I/O scheduler.
Systemd is an init system that replaces traditional init daemons. It allows for parallel startup of services through dependency-based activation of units which encapsulate system objects like services, devices, and mounts. Systemd also provides on-demand activation of services through sockets, buses, devices, and file paths. It aims to be backwards compatible with System V while offering improvements like parallel startup and centralized logging.
Systemd: the modern Linux init system you will learn to loveAlison Chaiken
The talk combines a design overview of systemd with some tutorial incofrmation about how to configure it. Systemd's features and pitfalls are illustrated by short demos and real-life examples. Files used in the demos are listed under "Presentations" at http://she-devel.com/
Video of the live presentation will appear here:
http://www.meetup.com/Silicon-Valley-Linux-Technology/events/208133972/
Workshop - Linux Memory Analysis with VolatilityAndrew Case
Slides from my 3 hour workshop at Blackhat Vegas 2011. Covers using Volatility to perform Linux memory analysis investigations as well Linux kernel internals.
Systemd is a system and service manager that provides modular, asynchronous, and concurrent services. It allows administrators to create snapshots of unit configurations. Some key capabilities it provides include listing and controlling systemd units and services. A service file template is also provided that defines properties like the service description, execution commands, and installation targets. Systemd-nspawn can be used to create lightweight containers with their own isolated namespaces.
The document provides an overview of the initialization process in the Linux kernel from start_kernel to rest_init. It lists the functions called during this process organized by category including functions for initialization of multiprocessor support (SMP), memory management (MM), scheduling, timers, interrupts, and architecture specific setup. The setup_arch section focuses on x86 architecture specific initialization functions such as reserving memory regions, parsing boot parameters, initializing memory mapping and MTRRs.
The document provides an overview of device driver development in Linux, including character device drivers. It discusses topics such as device driver types, kernel subsystems, compiling and loading kernel modules, the __init and __exit macros, character device registration, and issues around reference counting when removing modules. It also provides sample code for a basic character device driver that prints information to the kernel log.
Some basic knowledges required for beginners in writing linux kernel module - with a description of linux source tree, so that the idea of where and how develops. The working of insmod and rmmod commands are described also.
Have you ever heard of FreeBSD? Probably.
Have you ever interacted with its kernel? Probably not.
In this talk, Gili Yankovitch (nyxsecuritysolutions.com) will talk about the FreeBSD operating system, its network stack and how to write network drivers for it.
The talk will cover the following topics:
* Kernel/User interation in FreeBSD
* The FreeBSD Network Stack
* Network Buffers API
* L2 and L3 Hooking
The document provides an introduction to Linux and device drivers. It discusses Linux directory structure, kernel components, kernel modules, character drivers, and registering drivers. Key topics include dynamically loading modules, major and minor numbers, private data, and communicating with hardware via I/O ports and memory mapping.
This document discusses several important Android kernel modules. It begins by outlining key network modules like Netlink for IPC, network schedulers for packet sequencing, Netfilter for packet filtering, and Nftables as a new packet filtering framework. For sound, it describes ALSA as the software API for sound card drivers. Regarding graphics, it mentions the Direct Rendering Manager for interfacing with GPUs and configuring display modes, and the Graphics Execution Manager for managing graphics memory. Finally, it notes the evdev input driver handles input from devices like keyboards and mice.
The second part of Linux Internals covers system calls, process subsystem and inter process communication mechanisms. Understanding these services provided by Linux are essential for embedded systems engineer.
An unique module combining various previous modules you have learnt by combing Linux administration, Hardware knowledge, Linux as OS, C/Computer programming areas. This is a complete module on Embedded OS, as of now no books are written on this with such practical aspects. Here is a consolidated material to get real hands-on perspective about building custom Embedded Linux distribution in ARM.
The document summarizes key aspects of the C compilation model and process concepts in operating systems. It discusses that the C compilation model involves preprocessing, compilation, assembly, and linking. It also explains that a process is a program in execution with a unique process ID, that processes are created through forking, and that signals allow processes to communicate termination status. Process attributes like user IDs, group IDs, and process groups are also covered.
- Systemd is now the most widely used Linux init system, replacing sysVinit. It has a superior design with tight integration with the Linux kernel.
- Systemd aims to extract duplicate functionality from individual daemons and replace init scripts with declarative configuration files. It provides a single daemon, systemd, to manage all system services.
- While systemd exemplifies needed modernization of Linux, its rapid development and deprecation of features could cause problems during the transition by distributions.
This document discusses kernel modules in Linux. It begins by defining the kernel as the central part of the operating system that manages processes, memory, devices, and storage. Kernel modules allow new functionality to be added to the kernel at runtime without rebooting. Common module commands like insmod, lsmod and rmmod are described. The document outlines how modules are loaded and unloaded by the kernel and provides a simple "hello world" example of a kernel module.
IRQs: the Hard, the Soft, the Threaded and the PreemptibleAlison Chaiken
The Linux kernel supports a diverse set of interrupt handlers that partition work into immediate and deferred tasks. The talk introduces the major varieties and explains how IRQs differ in the real-time kernel.
Tasklet vs work queues (Deferrable functions in linux)RajKumar Rampelli
Deferrable functions in linux is a mechanism to delay the execution of any piece of code later in the kernel context. Can be implemented using Tasklet and work queues
Linux containers (LXC) provide operating system-level virtualization using features of the Linux kernel such as cgroups, namespaces, and chroot. This allows for the creation of lightweight isolated environments called containers that share the kernel of the host system. Containers offer many advantages over traditional virtual machines such as near-native performance, flexibility, and lightweight resource usage. The document discusses the key building blocks and technologies that underpin LXC such as cgroups for resource control and namespaces for process isolation. It also covers the benefits of using LXC and how container images are realized on Linux.
The document discusses Linux device drivers, including how they interface between user programs and hardware using a file interface, are implemented as loadable kernel modules (LKMs) that are inserted into the kernel, and how common operations like open, read, write, and release are mapped to kernel functions through a file operations structure.
This presentation gives an overview of Linux kernel block I/O susbsystem functionality, importance of I/O schedulers in Block layer. It also describes the different types of I/O Schedulers including the Deadline I/O scheduler, Anticipatory I/O Scheduler, Complete Fair queuing I/O scheduler and Noop I/O scheduler.
Systemd is an init system that replaces traditional init daemons. It allows for parallel startup of services through dependency-based activation of units which encapsulate system objects like services, devices, and mounts. Systemd also provides on-demand activation of services through sockets, buses, devices, and file paths. It aims to be backwards compatible with System V while offering improvements like parallel startup and centralized logging.
Systemd: the modern Linux init system you will learn to loveAlison Chaiken
The talk combines a design overview of systemd with some tutorial incofrmation about how to configure it. Systemd's features and pitfalls are illustrated by short demos and real-life examples. Files used in the demos are listed under "Presentations" at http://she-devel.com/
Video of the live presentation will appear here:
http://www.meetup.com/Silicon-Valley-Linux-Technology/events/208133972/
Workshop - Linux Memory Analysis with VolatilityAndrew Case
Slides from my 3 hour workshop at Blackhat Vegas 2011. Covers using Volatility to perform Linux memory analysis investigations as well Linux kernel internals.
Systemd is a system and service manager that provides modular, asynchronous, and concurrent services. It allows administrators to create snapshots of unit configurations. Some key capabilities it provides include listing and controlling systemd units and services. A service file template is also provided that defines properties like the service description, execution commands, and installation targets. Systemd-nspawn can be used to create lightweight containers with their own isolated namespaces.
The document provides an overview of the initialization process in the Linux kernel from start_kernel to rest_init. It lists the functions called during this process organized by category including functions for initialization of multiprocessor support (SMP), memory management (MM), scheduling, timers, interrupts, and architecture specific setup. The setup_arch section focuses on x86 architecture specific initialization functions such as reserving memory regions, parsing boot parameters, initializing memory mapping and MTRRs.
The document provides an overview of device driver development in Linux, including character device drivers. It discusses topics such as device driver types, kernel subsystems, compiling and loading kernel modules, the __init and __exit macros, character device registration, and issues around reference counting when removing modules. It also provides sample code for a basic character device driver that prints information to the kernel log.
Some basic knowledges required for beginners in writing linux kernel module - with a description of linux source tree, so that the idea of where and how develops. The working of insmod and rmmod commands are described also.
Have you ever heard of FreeBSD? Probably.
Have you ever interacted with its kernel? Probably not.
In this talk, Gili Yankovitch (nyxsecuritysolutions.com) will talk about the FreeBSD operating system, its network stack and how to write network drivers for it.
The talk will cover the following topics:
* Kernel/User interation in FreeBSD
* The FreeBSD Network Stack
* Network Buffers API
* L2 and L3 Hooking
The document provides an introduction to Linux and device drivers. It discusses Linux directory structure, kernel components, kernel modules, character drivers, and registering drivers. Key topics include dynamically loading modules, major and minor numbers, private data, and communicating with hardware via I/O ports and memory mapping.
This document discusses several important Android kernel modules. It begins by outlining key network modules like Netlink for IPC, network schedulers for packet sequencing, Netfilter for packet filtering, and Nftables as a new packet filtering framework. For sound, it describes ALSA as the software API for sound card drivers. Regarding graphics, it mentions the Direct Rendering Manager for interfacing with GPUs and configuring display modes, and the Graphics Execution Manager for managing graphics memory. Finally, it notes the evdev input driver handles input from devices like keyboards and mice.
The second part of Linux Internals covers system calls, process subsystem and inter process communication mechanisms. Understanding these services provided by Linux are essential for embedded systems engineer.
An unique module combining various previous modules you have learnt by combing Linux administration, Hardware knowledge, Linux as OS, C/Computer programming areas. This is a complete module on Embedded OS, as of now no books are written on this with such practical aspects. Here is a consolidated material to get real hands-on perspective about building custom Embedded Linux distribution in ARM.
The document summarizes key aspects of the C compilation model and process concepts in operating systems. It discusses that the C compilation model involves preprocessing, compilation, assembly, and linking. It also explains that a process is a program in execution with a unique process ID, that processes are created through forking, and that signals allow processes to communicate termination status. Process attributes like user IDs, group IDs, and process groups are also covered.
- Systemd is now the most widely used Linux init system, replacing sysVinit. It has a superior design with tight integration with the Linux kernel.
- Systemd aims to extract duplicate functionality from individual daemons and replace init scripts with declarative configuration files. It provides a single daemon, systemd, to manage all system services.
- While systemd exemplifies needed modernization of Linux, its rapid development and deprecation of features could cause problems during the transition by distributions.
This document discusses kernel modules in Linux. It begins by defining the kernel as the central part of the operating system that manages processes, memory, devices, and storage. Kernel modules allow new functionality to be added to the kernel at runtime without rebooting. Common module commands like insmod, lsmod and rmmod are described. The document outlines how modules are loaded and unloaded by the kernel and provides a simple "hello world" example of a kernel module.
IRQs: the Hard, the Soft, the Threaded and the PreemptibleAlison Chaiken
The Linux kernel supports a diverse set of interrupt handlers that partition work into immediate and deferred tasks. The talk introduces the major varieties and explains how IRQs differ in the real-time kernel.
Tasklet vs work queues (Deferrable functions in linux)RajKumar Rampelli
Deferrable functions in linux is a mechanism to delay the execution of any piece of code later in the kernel context. Can be implemented using Tasklet and work queues
Linux containers (LXC) provide operating system-level virtualization using features of the Linux kernel such as cgroups, namespaces, and chroot. This allows for the creation of lightweight isolated environments called containers that share the kernel of the host system. Containers offer many advantages over traditional virtual machines such as near-native performance, flexibility, and lightweight resource usage. The document discusses the key building blocks and technologies that underpin LXC such as cgroups for resource control and namespaces for process isolation. It also covers the benefits of using LXC and how container images are realized on Linux.
The document discusses Linux device drivers, including how they interface between user programs and hardware using a file interface, are implemented as loadable kernel modules (LKMs) that are inserted into the kernel, and how common operations like open, read, write, and release are mapped to kernel functions through a file operations structure.
This document provides an introduction to Linux device drivers. It discusses that device drivers provide an abstraction layer between software and hardware, hiding hardware details. It describes different types of devices like character and block devices. It covers key concepts like loadable modules, driver entry/exit points, interrupts, deferred work, and memory-mapped peripherals. The document uses serial/UART drivers and the TTY layer as examples to illustrate driver concepts.
Writing Character driver (loadable module) in linuxRajKumar Rampelli
It covers the step by step approach on how to write a simple loadable character device driver in linux. What are Device files in linux detail. How user application interact with character driver using a device file.
The document discusses the Linux booting procedure. It begins with the CPU jumping to the BIOS address when the computer is turned on. The BIOS then runs tests and loads the master boot record (MBR) from the hard disk. The MBR contains the primary boot loader that loads the Linux kernel into memory. Control is then passed to the kernel which initializes processes, mounts filesystems, and launches the init process to start essential system services and reach the default runlevel.
The Linux booting process begins when the user turns on the computer. The BIOS loads and runs a power-on self-test before finding the bootable devices and loading the boot sector from the master boot record (MBR). The MBR then loads the boot loader, such as GRUB or LILO, which loads the Linux kernel into memory and passes control to it. The kernel initializes essential system components and starts the init process, which launches other processes according to the runlevel configuration to complete the system startup.
The default applications on an embedded Linux system include many common command line utilities from BusyBox, such as cat, cp, grep, ls, mkdir, more, mv, ping, ps, rm, top, and vi. BusyBox provides minimal versions of many common UNIX commands in a single executable to reduce the size of the system. Other default applications may include services like bootchartd, crond, and syslogd.
The document discusses the boot sequence of a computer system. It examines each step including the PROM monitor, boot block, secondary boot loader, the OS kernel, and start-up scripts. The administrator should understand this boot process as well as how to modify the boot sequence, select alternate devices, and properly shut down the system.
The document discusses the boot sequence of a computer system. It examines each step including the PROM monitor, boot block, secondary boot loader, and OS kernel initialization. It also covers modifying the boot process, selecting alternate boot devices, different boot loaders, and proper system shutdown procedures.
This document provides an overview of Unix fundamentals, including computer hardware components, storage terminology, processing power terminology, what an operating system is, the difference between single-user and multi-user systems, multitasking and timesharing in Unix, components of Unix like the kernel and shell, the history and versions of Unix including Linux, how to log in and out of Unix, the Unix interface, Xwindows, common windows managers, the Unix bootup sequence, an overview of the Unix file system structure including inodes and data blocks, how permissions are checked, the process of reading and writing files, how the open system call works to retrieve an inode, and the structure and contents of directories.
This document provides an overview and tutorial on Linux kernel driver development. It discusses key areas of the kernel source tree relevant for drivers, debugging techniques, basic kernel infrastructure like memory allocation and printing messages, implementing character device drivers, and the virtual file system layer. The tutorial also demonstrates how to add a basic "hello world" kernel module and integrate it into the kernel build system.
The document discusses the Linux booting process. It begins with the BIOS loading the master boot record (MBR) from the hard disk. The MBR then loads the boot loader like GRUB or LILO. The boot loader loads the Linux kernel into memory and passes control to it. The kernel initializes hardware and loads drivers. It then launches the init process which starts essential system processes and moves the system to the default runlevel based on the /etc/inittab file.
The document discusses Linux/Unix interview questions and answers. It covers topics such as the GRUB bootloader, the Linux boot process, user profile files, changing the default runlevel, displaying user information with the finger command, inode numbers, increasing disk read performance, password expiration times, locking user passwords, default shells, user attributes defined in /etc/login.defs, changing the system's authentication method, modifying file attributes with chattr, network interface configuration files, changing network interface settings, the DNS configuration file, exporting NFS directories, checking open ports, soft vs hard links, setting expired passwords, restricting file insertion, displaying or killing processes accessing files/folders, killing all processes for a user, daily system analysis reports
The document summarizes the shell system boot process and the init process. It describes how the shell interprets commands and executes them by forking child processes. It then explains the system boot process, where the bootstrap program loads the kernel from the disk into memory. The kernel then starts process 1 (init) which executes /etc/inittab to spawn essential processes like getty. Init continues monitoring and respawning processes using wait. The document also defines user, daemon and kernel processes.
The document discusses the Linux booting procedure. It describes how when a computer is turned on, the BIOS loads the MBR which contains the bootloader. The bootloader then loads the Linux kernel and initrd. The kernel mounts the root filesystem and executes init to start essential processes and reach the default runlevel. Popular init systems include SystemV, Upstart, and Systemd which boot Linux in different ways. The document also provides an overview of the Linux filesystem structure and organization of important directories.
The Linux boot process begins with the BIOS which initializes hardware and loads the boot loader like LILO or GRUB. The boot loader then loads the Linux kernel and initial RAM disk into memory. The kernel takes over the boot process, mounting partitions and file systems. It starts init which launches other processes according to runlevels and targets. Systemd now handles starting processes. The system can be shut down, rebooted or powered off. Logging uses syslog to record events to /var/log. Partitions on disks are managed using tools like fdisk, gdisk and parted.
A device driver allows operating systems and programs to interact with hardware devices. This document discusses device drivers in Linux, including that drivers are loaded as kernel modules, communicate between user and kernel space, and have character, block, and network classes. It provides examples of initializing and removing a sample "memory" driver that allows reading from and writing to a character device memory buffer.
This document discusses bootloaders for embedded systems. It defines a bootloader as the first code executed after a system powers on or resets that is responsible for loading the operating system kernel. The document then describes the tasks of a bootloader like initializing hardware, loading binaries from storage, and providing a shell. It outlines the booting process differences between desktops and embedded systems. Finally, it focuses on the universal bootloader U-Boot, describing its directory structure, configuration, building process, and commands.
The document discusses the Linux boot process and management tools Grub and Dracut. It provides an overview of the BIOS and UEFI boot methods, the kernel loading process, and the role of the initramfs and systemd. It describes Grub fundamentals like the multi-stage boot process and configuration via grub.cfg. Diagnostic tools like the Grub shell, initramfs shell, and systemd targets are covered. The document concludes with demonstrations of BIOS vs UEFI boot and recovering from a boot failure.
Most of this session will focus on Kernel Module Programming. We will briefly talk about the interaction of different layers of operating system from userspace to kernel space. Starting from simple Hello World kernel modules, we will learn the development of more sophisticated modules related to device drivers and interrupt handlers. We will also briefly touch upon the shell scripts and how they can be used to extract system level information. Since, this will be a hands on session, attendees are expected to try the examples on their machines. Basic understanding of operating systems and C programming is expected for the tutorial.
The document discusses various CSS concepts including:
- Three ways to add style rules: inline, embedded, and external style sheets
- Positioning elements using static, relative, absolute and fixed positioning
- The box model which describes the content, padding, border, and margin areas of elements
- Floating elements and using the clear property to control floating behavior
- The overflow property and its values of visible, hidden, scroll, and auto
This document summarizes a result processing system project. It includes an overview of features for admins, students, and teachers. It describes functionality like registration, course management, and viewing results. It includes diagrams for use cases, classes, and the database schema. Special features are validating inputs and calculating letter grades and points. Limitations include only viewing one's own department and future work includes cross-department functionality.
This document describes a cell phone operated land rover. The land rover can be controlled remotely using a mobile phone through dual-tone multiple frequency (DTMF) tones. When buttons on the mobile phone are pressed, corresponding DTMF tones are sent to a DTMF decoder in the land rover which then controls motors to move the land rover forward, backward, left or right. The system uses an ATmega16 microcontroller to interpret the DTMF tones and control the motors. Some challenges faced included connecting the mobile phone headset and circuit board issues. Potential applications include search and rescue operations.
The document discusses the power sector in Bangladesh. It provides an overview of the sector including current generation capacity, transmission lines, distribution lines, and access to electricity. It describes the hierarchy of power sector structures and issues like transmission losses and interruptions. It notes a fundamental problem is a shortage of natural resources. There is a growing gap between electricity supply and demand. Initiatives to address this include adding 9,000 MW of new capacity and developing cross-border electricity trade with India. Ongoing power plant projects include a nuclear plant and coal plant. Meeting financing needs of $9.5 billion for generation and $9.52 billion for gas infrastructure by 2025 is a major challenge.
The document discusses the Place Identifier app, which aims to help newcomers identify locations on a university campus. It outlines the app's features such as identifying buildings and classrooms and showing relevant information. It also discusses the app's motivation and the overall working process, which included concept mapping, storyboarding, surveying students, prototyping, and usability testing. The goal is to create an intuitive app that helps newcomers easily navigate an unfamiliar location.
The document summarizes the process of designing a diabetes monitoring mobile application. It discusses conducting need findings through interviews and observations of users to understand what features should be included. Concept mapping and storyboarding were used to design the app features and workflow. Paper prototyping allowed for testing the prototype and getting feedback. Finally, usability testing and a t-test were conducted to evaluate the effectiveness of connecting diabetic patients through the app.
This document discusses the Memento pattern, which allows an object to save its state to a memento object, in order to be able to restore itself to that state later. It describes the intent of the pattern as promoting undo or rollback of an object's status without violating encapsulation. It provides examples of participants like the originator that creates mementos, the memento itself that stores the originator's internal state, and the caretaker that is responsible for the memento. It also includes pseudocode of a diet tracking application that uses the pattern to allow restoring a dieter's previous weight and day.
3. ∗ Write a device driver for a pseudo stack device
∗ Idea fromhttp://www.cs.swarthmore.edu/~newhall/cs45/f01/proj5.html
∗ Linux device type supports the following operations
∗ Open: only one is allowed.
∗ Write: writes an char string to top of the device stack. Error if stack is
empty
∗ Read: reads an item from top of the device stack. Error if stack is
empty
∗ Release: release the device
∗ Install with LKM.
∗ Test: It will be a dedicated standalone machine in the lab. Root
password may be given out. If you mess up, you will re-install the
Overview
4. ∗ A programming module with interfaces
∗ Communication Medium between application/user and
hardware
∗ In Unix,
∗ Kernel module
∗ device driver interface = file interface
∗ What are normal operations?
∗ Block vs. character
What is a device driver?
5. User program & Kernel interface
Note: This picture is excerpted from Write a Linux Hardware Device Driver, Andrew O’Shauqhnessy, Unix world
6. USB Subsystem in LINUX
A top-to-bottom view of the USB subsystem in Linux.
7. ∗ A new kernel module can be added on the fly (while
OS is still running)
∗ LKMs are often called “kernel modules”
∗ They are not user program
Loadable Kernel Module (LKM)
8. ∗ Device drivers
∗ Filesystem driver (one for ext2, MSDOS FAT16, 32,
NFS)
∗ System calls
∗ Network Drivers
∗ TTY line disciplines. special terminal devices.
∗ Executable interpreters.
Types of LKM
9. ∗ Every LKM consist of two basic functions (minimum) :
int init_module(void) /*used for all initialition stuff*/
{
...
}
void cleanup_module(void) /*used for a clean shutdown*/
{
...
}
∗ Loading a module - normally retricted to root - is managed by issuing
the follwing command: # insmod module.o
Basic LKM (program)
10. ∗ insmod
∗ Insert an LKM into the kernel.
∗ rmmod
∗ Remove an LKM from the kernel.
∗ depmod
∗ Determine interdependencies between LKMs.
∗ kerneld
∗ Kerneld daemon program
∗ ksyms
∗ Display symbols that are exported by the kernel for use by new LKMs.
∗ lsmod
∗ List currently loaded LKMs.
∗ modinfo
∗ Display contents of .modinfo section in an LKM object file.
∗ modprobe
∗ Insert or remove an LKM or set of LKMs intelligently. For example, if you must load A before
loading B, Modprobe will automatically load A when you tell it to load B.
LKM Utilities cmd
11. ∗ Create a special device file
% mknode /dev/driver c 40 0
∗ Insert a new module
% insmod modname
∗ Remove a module
∗ %rmmod modname
∗ List module
% lsmod
Or % more /proc/modules
audio 37840 0
cmpci 24544 0
soundcore 4208 4 [audio cmpci]
nfsd 70464 8 (autoclean)
Common LKM util cmd
12. ∗ A set of API subroutines (typically system calls)
interface to hardware
∗ Hide implementation and hardware-specific details
from a user program
∗ Typically use a file interface metaphor
∗ Device is a special file
Linux Device Drivers
13. ∗ Manage data flow between a user program and
devices
∗ A self-contained component (add/remove from
kernel)
∗ A user can access the device via file name in /dev ,
e.g. /dev/lp0
Linux Device Drivers (cont.)
14. 1. Understand the device characteristic and supported
commands.
2. Map device specific operations to unix file operation
3. Select the device name (user interface)
∗ Namespace (2-3 characters, /dev/lp0)
1. (optional) select a major number and minor (a device
special file creation) for VFS interface
∗ Mapping the number to right device sub-routines
1. Implement file interface subroutines
2. Compile the device driver
3. Install the device driver module with loadable kernel
module (LKM)
4. or Rebuild (compile) the kernel
General implementation steps
15. ∗ Pooling (or synchronous)
∗ Interrupt based
Read/write (I/O)
16. int init_module(void) /*used for all initialition stuff*/
{
/* Register the character device (atleast try) */
Major = register_chrdev(0,
DEVICE_NAME,
&Fops);
:
}
void cleanup_module(void) /*used for a clean shutdown*/
{ret = unregister_chrdev(Major, DEVICE_NAME);
...
}
Register and unregister device
17. ∗ compile
-Wall -DMODULE -D__KERNEL__ -DLINUX –DDEBUG -I /usr/include/linux/version.h
-I/lib/modules/`uname -r`/build/include
∗ Install the module
%insmod module.o
∗ List the module
%lsmod
∗ If you let the system pick Major number, you can find the
major number (for special creation) by
% more /proc/devices
∗ Make a special file
% mknod /dev/device_name c major minor
Register and unregister device
18. ∗ A character device driver ( c )
∗ Most devices are this type (e.g.Modem, lp, USB
∗ No buffer.
∗ A block device driver (b)
∗ through a system buffer that acts as a data cache.
∗ Hard drive controller and HDs
Device Driver Types
19. ∗ first things first — get the pen drive’s interface associated with
our USB device driver (pen_register.ko),” consoled Pugs.
• Build the driver (.ko file) by running make.
• Load the driver using insmod.
• List the loaded modules using lsmod.
• Unload the driver using rmmod.
Implementation
22. ∗ add_timer()
∗ Causes a function to be executed when a given amount of time has passed
∗ cli()
∗ Prevents interrupts from being acknowledged
∗ end_request()
∗ Called when a request has been satisfied or aborted
∗ free_irq()
∗ Frees an IRQ previously acquired with request_irq() or irqaction()
∗ get_user*()
∗ Allows a driver to access data in user space, a memory area distinct from the kernel
∗ inb(), inb_p()
∗ Reads a byte from a port. Here, inb() goes as fast as it can, while inb_p() pauses before returning.
∗ irqaction()
∗ Registers an interrupt like a signal.
∗ IS_*(inode)
∗ Tests if inode is on a file system mounted with the corresponding flag.
∗ kfree*()
∗ Frees memory previously allocated with kmalloc()
∗ kmalloc()
∗ Allocates a chu nk of memory no larger than 4096 bytes.
∗ MAJOR()
∗ Reports the major device number for a device.
∗ MINOR()
∗ Reports the minor device number for a device.
kernel functions
23. ∗ memcpy_*fs()
∗ Copies chunks of memory between user space and kernel space
∗ outb(), outb_p()
∗ Writes a byte to a port. Here, outb() goes as fast as it can, while outb_p() pauses before returning.
∗ printk()
∗ A version of printf() for the kernel.
∗ put_user*()
∗ Allows a driver to write data in user space.
∗ register_*dev()
∗ Registers a device with the kernel.
∗ request_irq()
∗ Requests an IRQ from the kernel, and, if successful, installs an IRQ interrupt handler.
∗ select_wait()
∗ Adds a process to the proper select_wait queue.
∗ *sleep_on()
∗ Sleeps on an event, puts a wait_queue entry in the list so that the process can be awakened on that
event.
∗ sti()
∗ Allows interrupts to be acknowledged.
∗ sys_get*()
∗ System calls used to get information regarding the process, user, or group.
∗ wake_up*()
∗ Wakes up a process that has been put to sleep by the matching *sleep_on() function.
kernel functions
24. 1. Using standard libraries: can only use kernel
functions, which are the functions you can see
in /proc/ksyms.
1. Disabling interrupts: You might need to do this for
a short time and that is OK, but if you don't enable
them afterwards, your system will be stuck
2. Changes from version to version
Pitfalls
25. ∗ Linux Kernel API: http://kernelnewbies.org/documents/kdoc/kernel-
api/linuxkernelapi.html
∗ Kernel development tool http://www.jungo.com/products.html
∗ Linux Device Drivers 2nd Edition by Rubini & Corbet, O'Reilly Pub,
ISBN 0-596-00008-1
∗ http://www.opensourceforu.com/2011/10/usb-drivers-in-linux-1/
Resources