0% found this document useful (0 votes)
12 views79 pages

TOC Embedded TOC LDD v2.1-WithPhase1

The document outlines a comprehensive curriculum for Linux Device Driver Development, detailing modules, hours, and milestones over a total of 171 hours. It includes topics on computer architecture, networking, Linux operating systems, source code management with Git, and C++ programming. The course structure emphasizes practical learning through assessments and a capstone project, with a focus on both theoretical understanding and hands-on experience.

Uploaded by

Niravjoel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views79 pages

TOC Embedded TOC LDD v2.1-WithPhase1

The document outlines a comprehensive curriculum for Linux Device Driver Development, detailing modules, hours, and milestones over a total of 171 hours. It includes topics on computer architecture, networking, Linux operating systems, source code management with Git, and C++ programming. The course structure emphasizes practical learning through assessments and a capstone project, with a focus on both theoretical understanding and hands-on experience.

Uploaded by

Niravjoel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 79

Linux Device Drivers

Module Hours
C++ Programming 54
Computer Architecture - Hardware 6
Computer Architecture - Network 6

Linux Operating System and Source Code Management with Git 17

Linux Device Driver Development 63


SDLC - Software Development Life Cycle and Agile Principles 5
Capstone Project 20
LDD Total Hours 171

LDD Total Days (at 4 hours per day of teaching) 43.00

NOTE: Per day 9 hours of learning (4 hours teaching + 5 hours practice)


Linux Device Driver Development
Sl.no Module Days Start DaEnd Date
1 Computer Architecture - Hardware 1.5 24-Apr 25-Apr
2 Computer Architecture - Network 1.5 25-Apr 28-Apr
3 Linux Operating System and Source Code Management with 4 29-Apr 3-May
Git
Milestone 1(CA, SDLC, Programming 5-May 5-May
Constructs, Linux OS, GIT)
Milestone 1(Reassessment for failed 8-May 8-May
C++ Programming
4 participants 14 5-May 20-May
Milestone 2(C++ Programming) 20-May 20-May
Milestone 2(Reassessment for failed 26-May 26-May
Linux Device Driver Development
5 participants) 16 21-May 7-Jun
Milestone 3(LDD) 7-Jun 7-Jun
Milestone 3(Reassessment for failed 9-Jun 9-Jun
SDLC - Software Development Life Cycle and Agile Principles
6 participants) 1 9-Jun 9-Jun

Final Assessment(All topics with more 11-Jun 11-Jun


focus on Programming and Domain)
Final Assessment(ReAssessment) 13-Jun 13-Jun
7 Capstone Project 5 10-Jun 14-Jun
End Date
Module Computer Architecture - Hardware
Time (hour6
Sl. No. Topics
1.0 Understanding Computer Architecture
Introduction to Computer Architecture
Overview of computer architecture.
Importance in software development.
Basic terminology.
Historical development of computer architectures
1.1
RISC vs. CISC architectures.
Pipeline processing and superscalar execution
Computer arithmetic and ALU design.
Virtual memory and paging systems.
Benchmarking and performance metrics.
Central Processing Unit (CPU)
CPU components and functions.
How a CPU executes instructions.
CPU performance factors.
Microarchitecture design.
1.2
Instruction set architectures (ISAs).
Branch prediction and speculative execution.
Parallelism at the instruction level (ILP).
CPU cooling and thermal management.
The future of CPUs: Quantum computing and beyond.
Quiz 1(MCQ)
Detailed study of cache memory and cache coherence.
Memory allocation algorithms and garbage collection.
Advances in solid-state drives (SSDs) technology.
1.3 Error detection and correction codes in memory.
Memory hierarchy optimization techniques.
Types of memory (RAM, Cache, Hard Drives).
How data is stored and accessed.
Memory management concepts.
I/O Systems
Overview of I/O systems.
Communication between CPU, memory, and I/O devices.
Introduction to buses and data transfer.
1.4 Direct Memory Access (DMA) operations.
I/O interface protocols (e.g., USB, Thunderbolt).
Performance issues in I/O operations and solutions.
I/O virtualization technologies.
Future trends in I/O devices and systems.
Introduction to parallel computing.
Multi-core processors and GPUs.
Real-world applications and examples.
Detailed exploration of SIMD and MIMD architectures.
1.5
Hardware acceleration through FPGAs and ASICs.
Challenges in parallel programming and synchronization.

_x000D_ Internal - General Use


#
1.5

Data parallelism versus task parallelism


Quiz2 (MCQ)

_x000D_ Internal - General Use


#
Hours Needed Desired OutCome

1.5

Understanding the System from a


1.5 Software Developer perspective, the
learners must understand different
components of a modern computing
device (Computers, Mobiles, Embedded
Systems, Intelligent Systems etc.).
How the differents parts of the system
function, how the data is stored and
retrieved.
How parallel computing works, different
computing solutions for solving complex
problems with parallel computing. How
1 data is moved in paralled systems.
_x000D_ Internal - General Use
#
Systems, Intelligent Systems etc.).
How the differents parts of the system
function, how the data is stored and
retrieved.
How parallel computing works, different
computing solutions for solving complex
problems with parallel computing. How
1 data is moved in paralled systems.

_x000D_ Internal - General Use


#
Module Computer Architecture - Network
Time (hrs) 6
Sl. No. Topics
2.0 Understanding Computer Networking
Introduction to Networking
Basic networking concepts.
Importance in software development and communication.
Advanced routing and switching concepts.
2.1
Network topology design and analysis.
Mobile networking and cellular technologies.
The role of network protocols in cloud computing.
Future Internet technologies (e.g., 5G, IoT networking).
Network Models and Protocols
OSI and TCP/IP models.
Common protocols: HTTP, FTP, TCP, UDP.
2.2 Transport layer protocols beyond TCP/UDP (e.g., SCTP).
Application layer protocols (e.g., SMTP, SNMP, SIP).
Network protocol security (e.g., SSL/TLS).
Protocol engineering and design principles.
Assignment 1: Draw your Home Network Topology and explain it.
IPv4 vs. IPv6.
2.3
Subnetting basics.
Network Address Translation (NAT).
Wireless and Wired Networks
Comparison of wired and wireless networking.
2.4
WiFi, Ethernet, and emerging technologies.
Powerline and optical fiber communication.
Assignment 2
2.5 Introduction to network security challenges.
Basic security measures (Firewalls, VPNs).

Assignment 2: Identify a real-world application for both parallel computing and networked systems. Explain how these techno

Submission Guidelines:
1. Ensure that each answer is clear, concise, and reflects an understanding of the core concepts.
2. Diagrams can be hand-drawn and scanned or created using any digital drawing tool.
3. Provide references for any external sources used.
Submit your work in a single PDF document by end of Module

_x000D_ Internal - General Use


#
Hours Needed Desired OutCome

2
Understanding the Networks from a
Software Developer perspective, the
learners must understand how
computer network works, how data
1.5 is transferred across two connected
systems in a network, different
addressing schemes. What are
protocols, commonly used protocols
and their use. How does network
1 isolation and topology work, how
data traverses over internet, what is
NAT and why they must know it.
Understand network security,
0.5 firewall, VPN etc.

ked systems. Explain how these technologies are used and why they are important in that context.

_x000D_ Internal - General Use


#
Module Linux Operating System and Source Code Management with Git
Time (hrs) 17
Sl. No. Topics
1.0 Linux Basics and Command Line
Introduction to Linux
Linux History and Philosophy
Origins of Linux, GNU/Linux
Open Source Movement
1.1
Popular Linux Distributions
Overview of Ubuntu, Fedora, CentOS
Understanding Desktop Environments
GNOME, KDE, XFCE
Command Line Basics
Terminal Fundamentals
Accessing the Terminal
Basic Navigation Commands
1.2 Directory Structures
Home, Root, Bin, and Other Directories
Absolute vs Relative Paths
File Management Commands
Creating, Listing, Deleting Files and Directories
Task 1 and Task 2
File Operations
Copying, Moving, Removing Files
1.3 Searching Within Files with grep
Introduction to Nano and Vim
Basic Operations: Opening, Editing, Saving Files
Vim Modes and Navigation
Basic File System Structure and Permissions
Exploring Linux File System Hierarchy
Standard Directories and Their Roles
1.4
File Permissions and Ownership
Reading and Modifying File Permissions
Changing File Ownership
Task 3
1.5 Accessing remote system using SSH and Telnet access
Copy Files from/to remote System
2.0 Advanced Command Line and Source Code Management with Git
Advanced Command Line Tools
Advanced Text Processing
Using grep, sed, awk for Text Manipulation
Task 4
How to effectively read and understand man pages.
Finding command options, flags, and examples.
Navigating man pages, searching within man pages.
2.1

_x000D_ Internal - General Use


#
2.1
Advanced search in man pages, understanding complex command options.
Task 5 and Task 6 with Assignment 1
Basics of Shell Scripting
Writing Simple Bash Scripts
Executing and Scheduling Scripts with cron
File Searching and Archiving
Using find, locate, tar, gzip Commands
3.0 Source Code Management with Git
Version Control with Git
Git Introduction
Why Version Control?
3.1 Git Installation and Configuration
Git Basics
Initializing a Repository (git init)
Staging and Committing Changes (git add, git commit)
Git Operations and Workflow
Managing Changes
Viewing Commit History (git log)
3.2 Undoing Changes (git revert, git reset)
Branching in Git
Creating and Switching Branches (git branch, git checkout)
Basic Merging Techniques
4.0 Git Branching, Merging, and Collaborative Features
Assignment 2
Advanced Branching Strategies
Feature Branching, Hotfix Branches
4.1
Complex Merging Techniques
Resolving Complex Merge Conflicts
Rebase vs Merge
Collaborative Development with Git
Collaborative Workflows in Git
Forking and Cloning Repositories
4.2 Managing Collaborative Changes
Working with Branches Remotely
Pushing and Pulling Branches
Remote Branch Management
Code Review and Collaboration Practices
Utilizing Pull Requests
4.3
Creating and Managing Pull Requests
Assignment 3
Task 1: Linux History and Philosophy
Objective: Write a brief explanation of the history of Linux and its philosophy.
Action Items:
Open a terminal.
Use nano to create a .txt file named LinuxHistory.txt.

_x000D_ Internal - General Use


#
Within the file, summarize the origins of Linux and the principles of the GNU/Linux system.
Save and close the file.

Task 2: File Navigation and Directory Structure


Objective: Demonstrate basic file navigation and directory structure understanding.
Action Items:
List all files in the home directory using a single command.
Display the absolute path of the current working directory.
Create a new directory called Practice in the home directory and navigate into it.

Task 3: File Management Commands


Objective: Use file management commands to organize files and directories.
Action Items:
In the Practice directory, create a new file called sample.txt.
Copy sample.txt to a new file called duplicate.txt.
Delete duplicate.txt using a command-line command.

Task 4: Using grep to Search within Files


Objective: Utilize grep to search text within files.
Action Items:
Use grep to find all instances of the word "Linux" in the LinuxHistory.txt file.
Redirect the output to a new file called LinuxInstances.txt.

Task 5: Permissions and Ownership


Objective: Understand and modify file permissions and ownership.
Action Items:
View the current permissions for sample.txt.
Change the permissions to read-only for the owner and no permissions for others.
Change the ownership of LinuxHistory.txt to another user (assuming one exists).

Task 6: Remote System Access


Objective: Practice accessing a remote system and transferring files.
Action Items:
Use ssh to connect to a remote system (this can be a local VM for practice).
Once connected, use scp to copy LinuxHistory.txt from the local machine to the remote system.

Assignment 1: Text Processing and Automation - Write a bash script that uses grep, sed, and awk to list all login attemtps to a

Assignment 2: Version Control with Git - Initialize a new Git repository, simulate making changes to a project by adding text fil

Assignment 3: Collaborative Development Using Git - Fork an existing repository (this can be a simulated action if no actual re

Submission Guidelines:
1. Ensure that each answer is clear, concise, and reflects an understanding of the core concepts.
2. Diagrams can be hand-drawn and scanned or created using any digital drawing tool.
3. Provide references for any external sources used.
Submit your work in a single PDF document by end of Module.

_x000D_ Internal - General Use


#
Hours Needed Desired OutCome

Participants will learn


2 about Linux's
background, how to use
the command line,
manage files, and edit
texts using tools like
Nano and Vim. They'll
also learn how to search
inside files with grep and
access a remote Linux
System.

Knowing these basics of


Linux is important for
learners, as it helps them
work better and faster in
software development
and managing computer
systems. These skills are
the first step to becoming
good at more advanced
2.5 tech work.

2.5
_x000D_ Internal - General Use
#
2.5

Learners will enhance


their command line
expertise, learn advanced
text processing, dive into
Git basics, and explore
Git operations. They'll
cover advanced text
manipulation with grep,
sed, and awk, and start
automating tasks using
3 simple bash scripts. The
introduction to Git will
include its installation
and basic commands like
init, add, commit, and
status. They'll also delve
into managing changes
with Git, understanding
branching, creating
branches, and basic
merging techniques.

These sessions are crucial


for them as developer to
efficiently manage and
manipulate text,
automate repetitive
tasks, and handle version
control. Mastering Git is
3 especially important for
tracking changes,
collaborating on projects,
and maintaining the
integrity of their code in
1 a team environment.

_x000D_ Internal - General Use


#
ed, and awk to list all login attemtps to a linux system, extract attempted user and error messages to a separate file..

ng changes to a project by adding text files, and commit those changes. Create a new branch, make further changes in this branch, and m

can be a simulated action if no actual repository is available), clone it locally, and demonstrate managing updates from the original reposi

_x000D_ Internal - General Use


#
hanges in this branch, and merge it back to the main branch, resolving a simulated merge conflict.

ates from the original repository. Create a pull request to the original repository with changes made in the forked repository, and outline

_x000D_ Internal - General Use


#
orked repository, and outline a simple code review process.

_x000D_ Internal - General Use


#
Module C++ Programming

Duration (hrs) 54.00

Sl. No. Topics


1.0 Introduction to C Programming
History and Evolution of C
Setting Up the Development Environment
1.1
Introduction to GCC Compiler
Writing and Executing the First Program: "Hello World"
2.0 C Programming Basics
Data Types
Int, Char, Float, Double, Void
2.1
Enumerated Types, Type Modifiers
Data type representation in memory
Variables and Constants
Variable Declaration and Initialization
2.2
Scope of Variables: Local and Global
Constants and the const Keyword
Storage Classes and Specifiers
2.3 Auto, Extern, Static, Register
Understanding Stack, Heap, and volatile Keyword
3.0 Operators and Control Structures
Operators in C
Arithmetic, Relational, Logical Operators
3.1
Unary and Bitwise Operators
Bit Manipulation: Set, Reset, Toggle, Test kth bit
Conditional Constructs
3.2
if, if...else, switch Statements
Iterative Constructs
3.3
while, do-while, for-loop
Task 1A, 1B
4.0 Arrays and Pointers
Introduction to Arrays
4.1 Single and Multi-Dimensional Arrays
Array Bound Overflow
Understanding Pointers
Declaring and Dereferencing Pointers
4.2
Pointer Arithmetic
Relationship between Pointers and Arrays
Task 1C, 1D, 1E
5.0 Functions in C
Fundamentals of Functions
5.1
5.1 Function Arguments and Prototype Declaration
Function Call Mechanisms: By Value and Reference
Advanced Function Usage
Passing Arrays to Functions
5.2
Command Line Arguments
Recursive Functions and Stack Overflow
Task 1F
6.0 Advanced C Concepts
Strings and Advanced Pointers
String and Character Literals
6.1
Dynamic Memory Allocation
Managing Dangling Pointers and Memory Leaks
Function Pointers and Callbacks
6.2 Declaration and Use of Function Pointers
Implementing Callback Functions
Task 1G
7.0 Structs, Unions, and Preprocessor Directives
Basics of Structures and Unions
Defining and Using Structures and Unions
7.1
Typedef and Data Alignment
Serializing and Deserializing Structures and Unions in Files
Preprocessor Directives
Understanding #define, #include
Conditional Directives: #if, #ifdef, #ifndef, #else, #elif, #endif
7.2 #pragma Directives and their uses
Advanced Macros: Parameters, Token Concatenation, Stringification

Common Predefined Macros: __FILE__, __LINE__, __DATE__, __TIME__, __STDC__


Task 1H, 1J, 1K
8.0 File Input/Output in C
File Operations Basics
Opening and Closing Files: fopen, fclose
Reading from and Writing to Files: fprintf, fscanf, fgets, fputs, fread, fwrite
81.0 File Positioning: fseek, ftell, rewind
Error Handling in File I/O
Character, Line, and Block Oriented I/O
Working with Binary and Text Files
9.0 Data Structures in C
Implementing Linked Lists
9.1
Singly and Doubly Linked Lists
Stacks and Queues
9.2
Implementing Stacks and Queues
Tasks 1A to 1K on
9.0 Data Structures and Operations
Overview of Data Structures
Classification of Data Structures: Linear vs Non-Linear
Linear Data Structures
9.1 Static Data Structures - Arrays
Dynamic Data Structures - Queue, Stack, Linked List
Non-Linear Data Structures
Tree, Graph, Has Tables, Sets, Heaps, Tries
Imlementing Linked List in C++
Definition and types: Single, Double, Circular
9.2
Basic operations
Insert at beginning, Insert at end, Insert at position, Delete node, Update no
Implementing Stacks in C++
9.3 Definition and characteristics
Basic operations: Push, Pop, Peek, isEmpty
Implementing Queues in C++
9.4 Definition and types: Simple, Circular, Priority, Double Ended
Basic operations: Enqueue, Dequeue, Peek, isEmpty
Search Algorithms for the above Data Structures (Problem Type)
Linear Search (Strategy: Brute Force)
9.5
Binary Search (Strategy: Divide and Conquer)
Jump Search (Strategy: Divide and Conquer)
Sort Algorithms for the above Data Structures (Problem Type)
Bubble Sort (Strategy: Exchanging)
9.6 Quick Sort (Strategy: Divide and Conquer)
Merge Sort (Strategy: Divide and Conquer)
Heap Sort (Strategy: Selection)
10.0 Multi-Threading and Concurrency in C
10.1 Basics of pthread Library
10.2 Thread Creation and Management
Synchronization Mechanisms in C
Mutexes
10.3
Semaphores
Condition Variables
11.0 Search and Sorting Algorithms
11.1 Implementing Linear and Binary Search
11.2 Sorting Algorithms: Bubble, Quick, Merge Sort
12.0 Object-oriented Programming Concepts
Classes and Objects
Classes Vs. Structs
Data Encapsulation
Key Principles
Abstraction
Polymorphism
12.1 Inheritance
12.1
Reusability
Composition vs. Aggregation vs. Inheritance
Static Members
Access Specifiers
Member Functions
Task 1Z
13.0 Constructors & Destructors, this pointer
Constructors
Default Constructor
Parameterized Constructor
13.1
Copy Constructor
Shallow Copy
Deep Copy
13.2 Destructors
13.3 this Pointer
13.4 Static Variables in C and C++
13.5 Static Members in a Class
Task 2
14.0 Friend Functions, Friend Classes
14.1 Friend Functions
14.2 Friend Classes
15.0 Inheritance and Polymorphism
Introduction to Inheritance
Simple Inheritance
Multiple Inheritance
15.1
Multilevel Inheritance
Public, Protected, and Private Inheritance
Constructors in Inheritance
Introduction to Polymorphism
15.2 Static Polymorphism
Dynamic Polymorphism
16.0 Function Overloading, Operator Overloading
16.1 Function Overloading
Operator Overloading
16.2
Overloading +, =, +=, ==, <<, >>, new, and Assignment Operators
Task 3
17.0 Virtual Functions
Early Binding vs. Late Binding
Understanding Binding in C++
Definition of Binding in the Context of Functions
Early (Static) Binding: Concept and Characteristics
17.1
Late (Dynamic) Binding: Concept and Characteristics
Comparing Early and Late Binding
Use Cases and Implications of Each Type
Performance Considerations
Virtual Functions
Basics of Virtual Functions
Introduction to Virtual Functions in C++
How Virtual Functions Enable Polymorphism
Implementing Virtual Functions
17.2 Syntax and Rules for Declaring Virtual Functions
Overriding Virtual Functions in Derived Classes
Virtual Function Table (VTable) and Virtual Table Pointer (VPtr)
Best Practices and Common Pitfalls
When to Use Virtual Functions
Understanding the Impact on Performance and Memory
Pure Virtual Functions and Abstract Base Classes
Pure Virtual Functions
Definition and Purpose of Pure Virtual Functions
Declaring and Implementing Pure Virtual Functions
Abstract Base Classes
17.3 What Makes a Class Abstract
Designing Abstract Base Classes for Frameworks and APIs
Real-world Examples and Use Cases
Advanced Concepts
Interfaces in C++ Using Abstract Classes
Diamond Problem and Virtual Inheritance
Task 4, Task 5
18.0 File I/O
18.1 File I/O and File Handling
Streams
ofstream
18.2
ifstream
fstream
18.3 File Position Pointers
Task 6
19.0 Exception Handling
19.1 Basics of Exception Handling
19.2 try, catch, and throw Keywords
19.3 Standard Exceptions
19.4 Uncaught Exceptions
Task 7
20.0 Namespaces
20.1 Understanding Namespaces
20.2 Rules of Namespaces
Task 8
21.0 Smart Pointers
21.1 Introduction to Smart Pointers
Types of Smart Pointers
auto_ptr
21.2
21.2 unique_ptr
shared_ptr
weak_ptr
Task 9
22.0 Templates
Advantages of Templates
Introduction to Templates in C++
22.1
Code Reusability and Efficiency
Type Safety and Flexibility
Function Templates
Basics of Function Templates
22.2
Creating and Using Function Templates
Template Specialization and Overloading
Class Templates
Understanding Class Templates
22.3 Implementing Generic Classes
Class Template Specializations
Member Functions in Class Templates
Task 10
23.0 STL Containers
Overview of Containers
23.1 Role of Containers in the Standard Template Library (STL)
Different Types of Containers and Their Usage
Specific Containers
Vectors: Dynamic Array Implementation
List: Doubly Linked List Features
23.2 Map: Key-Value Pair Mapping
Queue: FIFO Data Structure
Stack: LIFO Data Structure
Deque: Double-Ended Queue Characteristics
Iterators
Basics of Iterators in STL
23.3 Types of Iterators: Input, Output, Forward, Bidirectional, Random Access

Iterator Operations and Traversal


Typical STL Algorithms
Overview of STL Algorithms
23.4
Common Algorithms: find, for_each, sort, search, copy, remove
Practical Use Cases and Examples
Adaptors
Understanding Container Adaptors
23.5
Adaptors in STL: Stack, Queue, Priority Queue
Custom Adaptor Implementation
23.6 Allocators
The Role of Allocators in STL
Custom Allocators: Use and Implementation
Memory Management in STL Containers
Task 11, Task 12, Task 13, Task 14, Task 15
24.0 RTTI, Namespace, Templates
Run Time Type Identification (RTTI)
Understanding RTTI
Introduction to RTTI in C++
Purpose and Use Cases of RTTI
24.1
Working with RTTI
The typeid Operator: Basics and Usage
Dynamic Casting: dynamic_cast and its Applications
Limitations and Performance Considerations of RTTI
Defining and Using Namespaces
Introduction to Namespaces
Purpose of Namespaces in C++
Avoiding Name Conflicts with Namespaces
24.2
Implementing Namespaces
Declaring and Defining Namespaces
Nested Namespaces and their Usage
Accessing Namespace Members
The using Directive
Overview of the using Directive
Purpose and Functionality of the using Directive
Differences between using Directive and using Declaration
Practical Usage
24.3
Implementing using for Namespace Simplification
Alias Declarations in C++
Scope and Accessibility
Scope Rules for the using Directive
Managing Accessibility and Visibility
26.0 Build Tool Chain
Introduction to Build Tools
26.1 Understanding the Role of Build Tools in Software Development
Overview of Common Build Tools
Using the g++ Compiler
Basics of g++
Introduction to g++ and its Role in Compiling C++ Programs
Setting up g++ Environment
Compilation Process
Understanding the Compilation Steps: Preprocessing, Compilation,
Assembly, Linking
Using g++ Commands for Compiling Single and Multiple Files
26.2 Compiler Options
Common g++ Compiler Flags and Their Usage
Optimizing Performance with Compiler Flags
26.2

Linking with g++


Static vs. Dynamic Linking
Linking Multiple Object Files and Libraries
Debugging with g++
Enabling Debugging Information in g++
Basic Debugging Techniques
Advanced g++ Features
Cross-Compilation with g++
Using g++ with Makefiles
26.3
Introduction to Makefiles
Writing and Executing Simple Makefiles
Automating Build Process with Make

Day End Assignments


Task Details
Data types
Task 1A: Observe layout of data in memory using gdb

Define variables of differnt types initialized with predefined data. The variables
should be local variables, global variables, static variables, constants. Put a break
point in gdb on main function and observe the memory layout of the variables in
memory. Understand stack and heap memory areas.

Operators and Control structures


Task 1B: Bit operations
Implement functions to count number of bits set in an integer, get the specific bit,
set a specified bit, toggle a bit. Experiment using different types of control
structures for the count operations.

Arrays and pointers

Task 1C: Using gdb, observe memory layout of string array and integer array.
Observe memory layout of single dimensional array and two dimentional array.

Task 1D: Define a pointer initialized with string constant. Observe using gdb, the
address where pointer is stored, the address contained the pointer where the string
is stored. Observe are they in different areas of data storage classes (stack, data
section etc.).

Task 1E: Operation with double pointers. Learn to modify the data using a double
pointer.

Functions
Task 1F: Observe the location of stack

Make two level function calls, with passing of parameters. Observe the address of
the stack frames, where the local variables are stored and how the SP and BP
registers are manipulated and how the return address is stored on the stack.

Task 1G: Define function pointer and use a function pointer

Define a function operation() which should take a function pointer and 2 more
arguments. Define add, subtrack, multiply and divide as functions. Pass one of these
functions to operation() with other two arguments and check correct function gets
called.

Structs, Unions, Preprocessor directives


Task 1H: Use predefined macros in a printf and observe the output. Use these to
write a logging macro, which when called logs the function name and line number in
the log output.

Task 1J: Use #ifdef directive in a header file to make it get included only once in a C
file.

Task 1K: Use #pragma pack directive with a structure and observe the data layout in
memory using gdb.

Task 1Z: Implement a Basic Class


Objective: Create a Car class with basic attributes.
Steps:
Define a Car class with private members: make, model, and year.
Write public member functions to set and get these values.

Task 2: Utilize Constructors and Destructors


Objective: Understand the use of constructors and destructors.
Steps:
Add a constructor to the Car class to initialize all attributes.
Implement a destructor that prints a message when an object is destroyed.

Task 3: Implement Operator Overloading


Objective: Overload the + operator to add two Point objects.
Steps:
Define a Point class with x and y coordinates.
Overload the + operator to add two Point objects.

Task 4: Virtual Functions Usage


Objective: Demonstrate polymorphism with virtual functions.
Steps:
Create a base class Shape with a virtual function draw().
Derive Circle and Square classes and override draw().

Task 5: Abstract Class and Pure Virtual Functions


Objective: Define an abstract class with a pure virtual function.
Steps:
Modify the Shape class to make draw() a pure virtual function.
Ensure derived classes implement the draw() function.

Task 6: File I/O Operations


Objective: Perform basic file input and output operations.
Steps:
Write a function to create a text file and write a few lines.
Read the contents of the file and print them to the console.

Task 7: Exception Handling Basics


Objective: Handle exceptions in a function that divides two numbers.
Steps:
Write a function that takes two integers and divides them.
Use try-catch blocks to handle division by zero.

Task 8: Namespaces Introduction


Objective: Demonstrate the use of namespaces.
Steps:
Define two namespaces with the same function name but different implementations.
Call both functions in the main() demonstrating the use of namespaces.

Task 9: Smart Pointers


Objective: Illustrate the use of std::unique_ptr.
Steps:
Create a std::unique_ptr to a new Car object.
Use the unique_ptr to access Car member functions.

Tasl 10: Templates with Functions


Objective: Write a function template to compare two values.
Steps:
Define a template function compare that returns the larger of two values.
Instantiate and test the function with int, float, and string types.

Task 11: STL Vectors


Objective: Use STL vector to store integers and manipulate them.
Steps:
Create a vector<int> and populate it with some numbers.
Write functions to find the sum and average of the numbers in the vector.

Task 12: STL Maps


Objective: Map students' names to their grades using an STL map.
Steps:
Create an std::map from string to char representing names and grades.
Insert some data into the map and print the contents.

Task 13: Lambda Expressions


Objective: Write a lambda expression to sort a vector<string>.
Steps:
Create a vector<string> with some unsorted names.
Use std::sort with a lambda to sort the names in descending order.

Task 14: Range-based Loops


Objective: Use a range-based loop to iterate over a container.
Steps:
Create an array or vector of integers.
Iterate over the container using a range-based for loop and print each element.

Task 15: Using the auto Keyword


Objective: Practice the use of auto to simplify code.
Steps:
Declare a few variables with auto, initializing them with different types.
Print the types of the variables using typeid().name().
Duration (hours) Desired Outcome
4.00 Learners will begin their journey by understanding the origin ,
setting up their development space, and navigating the GCC
compiler to bring their first lines of code to life. They will
explore the intricacies of data representation, master the use
and scope of variables, and grasp the significance of constants.
Delving deeper, they will become adept at manipulating data
and controlling program execution flow through various
operators, loops, and conditional statements. This
foundational knowledge equips learners with the skills to
write efficient code and provides a gateway to system-le

4.00 Learners will delve into arrays and pointers, uncovering the
essentials of single and multi-dimensional arrays, and learning
to prevent array bound overflow. They'll grasp the
fundamentals of pointers, including declaration,
dereferencing, and pointer arithmetic, and understand how
pointers intricately relate to arrays, enhancing their data
manipulation capabilities.

In studying functions, learners will discover the mechanics of


function arguments, prototype declarations, and the
differences between calling by value and reference. They'll
tackle advanced usage such as passing arrays and handling
command line arguments, and explore the depths of recursive
functions, learning to manage stack overflow and understand
the recursive call stack's impact on memory.
differences between calling by value and reference. They'll
tackle advanced usage such as passing arrays and handling
command line arguments, and explore the depths of recursive
functions, learning to manage stack overflow and understand
the recursive call stack's impact on memory.

4.00 Learners will deepen their programming expertise by


mastering string manipulation and advanced pointer concepts,
crucial for creating dynamic and efficient applications. They'll
learn to manage memory effectively, avoiding common pitfalls
like dangling pointers and memory leaks. Function pointers
and callbacks are essential tools for writing flexible and
modular code, and students will learn to declare, use, and
implement these with precision.

In exploring structs, unions, and preprocessor directives,


learners will become proficient in defining complex data
types, ensuring proper data alignment, and leveraging typedef
for readability. They'll also gain hands-on experience in
serializing data for storage or communication. Preprocessor
directives will be demystified, enabling students to write more
efficient and conditional code, while understanding how to
harness the power of macros for code simplicity and
maintenance. This knowledge is not only foundational but also
critical for advancing in areas such as systems programming,
embedded systems, and application development.

4.00 In the "File Input/Output " module, learners will gain the skills
to manipulate files using standard I/O functions,
understanding how to open, read, write, and close files
effectively. They'll work with both text and binary files,
learning the nuances of each format. In the "Data Structures
in C" section, learners will construct the backbone of efficient
software through the implementation of linked lists, stacks,
and queues. They will learn to build and manipulate singly and
doubly linked lists, understand the functionality of stacks and
queues, and how to implement them. This knowledge is
fundamental to solving complex problems in software
development, where efficient data handling is key to
performance and scalability.
Building on their previous experience with programming
constructs, object-oriented principles, and array algorithms,
learners will dive into the realm of data structures. They'll
start by understanding the classification of data structures
into linear and non-linear types, including static structures like
arrays and dynamic structures such as queues, stacks, and
linked lists. Further, they will explore non-linear structures like
trees, graphs, hash tables, sets, heaps, and tries. Practical
implementation in C++ will begin with linked lists, covering
various types and operations, followed by stacks and queues,
learning to perform basic operations. This knowledge is crucial
3.00 for efficient data management and algorithm design in
software development.

After mastering data structures and operations, learners will


enhance their algorithmic toolkit by studying search
algorithms such as Linear Search, using brute force methods;
Binary Search and Jump Search, both applying divide and
conquer strategies. They will also explore sort algorithms:
3.00 Bubble Sort, where elements are repeatedly swapped if out of
order; Quick Sort, which partitions arrays to sort data
efficiently; Merge Sort, that divides and conquers by merging
sorted arrays; and Heap Sort, which utilizes a heap to select
and sort elements. These algorithms are essential for
optimizing data retrieval and organization in software
applications.
In the "Multi-Threading and Concurrency in C" segment,
learners will explore the pthread library, the cornerstone of
threading in Unix-like systems. They will acquire hands-on
experience in creating, managing, and synchronizing threads,
3.00 which are vital for executing multiple tasks concurrently in a
single program. The "Search and Sorting Algorithms" section
will equip learners with essential algorithms that form the
basis of computer science. Mastering these algorithms is
fundamental to improving problem-solving skills and
optimizing software for speed and performance.
3.00

Learners will master Object-oriented Programming (OOP)


concepts, understanding the structure and behavior of classes
and objects, and the distinction between classes and structs.
They will grasp data encapsulation, fundamental OOP
principles such as abstraction, polymorphism, inheritance, and
reusability, and learn to differentiate between composition,
aggregation, and inheritance. They'll also learn about static
and member functions, access specifiers, and the use and
importance of constructors, destructors, and the 'this' pointer.
Additionally, they will explore static variables, and the role
and use of friend functions and classes. This knowledge is
critical for creating modular, scalable, and maintainable
software.
reusability, and learn to differentiate between composition,
aggregation, and inheritance. They'll also learn about static
and member functions, access specifiers, and the use and
importance of constructors, destructors, and the 'this' pointer.
Additionally, they will explore static variables, and the role
and use of friend functions and classes. This knowledge is
critical for creating modular, scalable, and maintainable
software.

6.00

Learners will dive into inheritance and polymorphism,


exploring types of inheritance, including simple, multiple, and
multilevel, and different access levels. They'll examine
constructors in inheritance and the nuances of polymorphism,
both static and dynamic. Overloading functions and operators
will enable them to create more intuitive code. They'll
differentiate between early and late binding, understand
virtual functions and their role in polymorphism, and learn to
implement virtual functions effectively. The course will cover
pure virtual functions and abstract base classes, vital for
designing extensible frameworks, and address the diamond
problem, concluding with best practices in C++ programming.
This foundational knowledge is key for advanced software
development and design patterns.

6.00
6.00

Participants will learn file I/O operations, utilizing streams like


ofstream, ifstream, and fstream for robust file handling,
including file position manipulation. They'll gain skills in
exception handling using try, catch, and throw, managing both
standard and uncaught exceptions. Understanding and
implementing namespaces will help them organize code
effectively. They'll explore smart pointers to manage
resources automatically, preventing memory leaks with types
like auto_ptr, unique_ptr, shared_ptr, and weak_ptr. The
course also covers templates, enhancing code reusability,
efficiency, type safety, and flexibility, with practical
applications in function and class templates, including
specialization and overloading. These skills are essential for
writing efficient, clean, and maintainable C++ code.

3.00
Learners will delve into STL Containers, crucial for C++
development, understanding their role in the Standard
Template Library. They'll examine container types like vectors
for dynamic arrays, lists for linked structures, maps for key-
value pairs, queues, stacks, and deques for specific data
handling. They'll master iterators, which are fundamental for
container traversal, and learn about the various iterator types.
The course will cover essential STL algorithms like find,
for_each, sort, and more, with real-world examples. Adaptors
and allocators will be discussed, teaching students to adapt
container interfaces and manage memory effectively in
container operations, forming a core skill set for efficient C++
5.00 programming.
In this module, learners will explore RTTI in C++,
understanding its purpose and how to use typeid and
dynamic_cast operators, while considering RTTI's limitations
and impact on performance. They'll learn how to define and
utilize namespaces to avoid name conflicts, and the best
practices for their effective use. The course will also cover the
'using' directive for simplification and aliasing in C++.
Additionally, modern C++ features like auto, nullptr, range-
based loops, and more advanced concepts like fold
expressions and transactional memory will be introduced,
alongside the practicalities of class template argument
deduction, equipping learners with contemporary C++
programming skills.

3.00

In this module, participants will learn about build toolchains,


focusing on g++ as a core tool for compiling C++ programs.
They'll understand how to set up the g++ environment, the
compilation process, and the use of compiler flags for
optimization. The course will teach both static and dynamic
linking, essential g++ commands, and how to debug using g++.
It will also cover advanced topics like cross-compilation and
creating makefiles for build automation. Best practices in
coding standards and dependency management for C++
projects are included to ensure a comprehensive
understanding of modern software development workflows.

3.00
3.00
s destroyed.
rent implementations.

the vector.
nt each element.
Module
Duration (Hrs)

Sl. No.
1.0

1.1

1.2

1.3

3.0

3.1

3.2

3.3

3.4

3.5
3.5

3.6

3.11

4.00

4.10

4.20

5.0

5.1

5.2
5.3

5.4

6.0

6.1

6.2

6.3

6.4

7.0

7.1

7.2

7.3

9.00

9.10
9.10

9.20

10.30

10.40

11.0

11.1

11.2

11.3

13.0

13.1

13.2

14.0

14.1

14.2
14.2

15.0

15.1

15.2

16.0

16.1

16.2

19.0

19.1

19.2

21.0

21.1

21.2
23
Linux Device Driver Development
63

Topics
Linux Systems
Introduction to Linux System Software:
Linux as an Operating System
Components of a Linux Distribution
Linux Kernel Overview:
Role of the Kernel
Linux Kernel Versions
Kernel Architecture & Components:
Understanding the Kernel's Structure
Kernel Components and Their Functions
Task 1
Linux Systems Internals and Programming
Linux System Overview
Purpose of Understanding Linux System
Significance of Kernel vs. User Space
Privilege Levels and Rings
Concept of Privilege Levels (Rings)
Ring 0: The Kernel Mode
Ring 3: The User Mode
Intermediate Rings (Ring 1 and Ring 2)
Task 6
Protected Mode in the x86 Architecture
Introduction to Protected Mode
Transition from Real Mode to Protected Mode
Benefits of Protected Mode
Memory Protection in Protected Mode
Segmentation and Paging
Role of Segmentation
Paging Mechanisms for Memory Isolation
Address Translation by the MMU
Task 7
User-Space to Kernel-Space Transition
Transition Mechanism
Understanding User-Space to Kernel-Space Transition
Role of System Calls (Syscalls)
Privilege Escalation
How Syscalls Enable Privilege Escalation
Syscall Handling in the Kernel
Kernel Space Operations
Direct Hardware Access
Kernel Space's Direct Access to Hardware
Execution of Device Drivers in Kernel Space
Core Functions in Kernel Space
Kernel Space as the Core of the Operating System
Resource Management by the Kernel
User Space Restrictions
Security and Stability
Ensuring Security through User Space Restrictions
Maintaining System Stability
Controlled Interfaces (Syscalls)
Limitations on Direct Hardware Access
Role of Syscalls as Controlled Interfaces
Benefits of Isolation
Advantages of Isolating User Space from Kernel Space
GNU Bin Tools for Programmers
Understanding Process Layout
Memory Segmentation and Organization
Program Memory Layout
Important Bin Tools
nm (Symbol Table)
Symbol Tables in Object Files and Executables
Listing Symbols and Their Attributes
objdump (Object File Information)
Extracting Disassembly and Sections
Analyzing Object Files and Executables
readelf (ELF File Information)
Retrieving ELF Header Information
Examining Section Headers
size (Binary Size Information)
Determining Binary Size Information
Task 16
Understanding Virtual Memory
Session 4: Virtual Memory Fundamentals
Basics of Virtual Memory in Linux
Understanding Paging and Memory Management
Kernel space vs. User space memory
Hands-on: Exploring procfs to view memory mappings
Session 5: User Space and Kernel Space Interaction
Functions like copy_to_user and copy_from_user
Protecting against buffer overruns and access violations
Task 17
Hands-on: Writing a simple module using copy_to_user to send data to user space
Introduction to Device Drivers
Understanding Device Drivers in Linux
Kernel-User Space Interaction
Types of Device Drivers: Character, Block, Network
Development Environment Setup
Essential Tools: GCC, Make, Kernel Headers
Writing a Basic Kernel Module: Hello World Example
Module Loading and Unloading
module_init() and module_exit()
Module Parameters: module_param()
Kernel Data Structures and Basic APIs
Kernel Version and Compatibility
Kernel Logging with printk()
Device Registration and Initialization
Char Device Registration: register_chrdev()
Char Device Initialization: cdev_init()
Task 18
Task 19
Task 20
Task 21
Character Device Drivers
Major and Minor Numbers
Allocation of Device Numbers: alloc_chrdev_region()
Registering a Character Device: cdev_add()
File Operations
Struct file_operations: Function Signatures
open(), release(), read(), write()
Implementation of File Operations
ioctl Method
unlocked_ioctl() for Handling User Space Requests
Command Definitions and Macros
Synchronization Techniques
Mutexes: mutex_init(), mutex_lock(), mutex_unlock()
Spinlocks: spin_lock(), spin_unlock()
Strategies to Prevent Deadlocks and Race Conditions
Task 22
Task 23
Task 24
Task 25
Concurrency and Race Conditions
Concurrency in the Kernel
Process Context and Interrupt Context
Kernel Preemption and Sleeping
Semaphores and Mutexes
Semaphore Usage: sema_init(), down(), up()
Mutex API: Initialization and Usage
Deadlock Prevention Strategies
Identifying and Avoiding Deadlocks
Lock Hierarchy and Effective Locking Techniques
Task 26
Task 27
Task 28
Understanding Device Trees
Session 1: Introduction to Device Trees
Overview of Device Trees in Linux
Understanding the structure of Device Trees
Device Tree Blob (DTB), Device Tree Compiler (DTC), and Device Tree Source (DTS)
files
Hands-on: Analyzing a sample DTS file and compiling it into DTB
Session 2: Customizing Device Tree
How the Kernel uses Device Trees
Customizing Device Trees for different hardware
Overlaying Device Trees for modular hardware configurations
Task 31
Hands-on: Modifying a DTS file and creating an overlay
Session 7: Embedded Linux Boot Process and Build Systems
Bootloaders and the Linux boot process
Understanding zImage and its role in booting
The Linux memory map and linker scripts
Introduction to Buildroot and Yocto
Hands-on: Creating a custom embedded Linux build using Buildroot
Session 8: Building and Customizing Embedded Linux with Yocto
Yocto Project overview
Creating custom layers and recipes
Configuring and building a Yocto-based system
Hands-on: Customizing a Yocto project to include a new application
Direct Memory Access (DMA)
DMA API and Concepts
Understanding DMA and DMA Engine API
Buffer Allocation: dma_alloc_coherent()
Buffer Management
Managing DMA Buffers
dma_map_single(), dma_map_sg()
Handling DMA Transfers: dma_unmap_single()
Synchronization for DMA
Synchronizing DMA Buffers: dma_sync_single_for_cpu(), dma_sync_single_for_device()

Task 32
Task 33
Time, Delays, and Deferred Work
Using Kernel Timers
Timer Initialization: init_timer()
Adding and Modifying Timers: add_timer(), mod_timer()
Timekeeping in the Kernel
Tasklets and Workqueues
Tasklet Initialization: tasklet_init()
Scheduling and Handling Tasklets
Workqueue Initialization: create_workqueue()
Task 34
Task 35
Allocating Memory
Memory Allocation Functions
kmalloc(), kfree(), vmalloc()
GFP Flags and Memory Zones
Managing Noncontiguous Memory
High Memory and vmalloc() Area
Memory Pool API: kmem_cache_create()
Interrupt Handling
Understanding Interrupts and IRQs
IRQ Numbers and IRQ Descriptors
Top Half and Bottom Half Handlers
Writing an Interrupt Handler
request_irq(), free_irq()
Shared Interrupt Lines
Data Types in the Kernel
Kernel-Specific Data Types
Fixed-Width Integer Types: u8, u16, u32
List and Queue APIs: list_head, list_add(), list_for_each_entry()
Atomic Operations and Bit Manipulation
atomic_t and Atomic Functions
Bitwise Operators: set_bit(), test_and_set_bit()
Task 36
Task 37
Task 38
Task 39
Task 40
Task 41
The Linux Device Model
Understanding Sysfs
Sysfs Entries and Kobjects
Attribute Files and show()/store() Methods
Hotplug and Coldplug Mechanisms
udev Integration and uevent Handling
Hotplug Callbacks
Debugging Techniques
Debugging Device Drivers
Effective Logging with printk()
Using Kernel Debuggers: KDB, KGDB
Handling OOPS Messages and Kernel Panics
Profiling and Tracing
Profiling with ftrace and perf Tools
Kernel Probes and Tracepoints
Assignment - Device Driver Development inside QEMU

Topic:
Simple Character Device Driver Development in QEMU
Objective:
To create a basic character device driver for a virtual device in QEMU, demonstrating understanding
of device driver structure and simple read/write operations.
Steps:
1-Prepare the Environment:
-Ensure QEMU is set up with a standard virtual machine environment that includes a Linux
kernel with development tools (GCC, make, etc.).
2-Driver Specification:
-Develop a simple character device driver. The driver need only implement basic open, close,
read, and write operations. The read and write operations can perform simple
tasks, such as returning a fixed string to any read request and printing any write input to the
kernel log.
3-Code the Driver:
-Write the character device driver code in C, adhering to the Linux kernel coding style. The
driver does not need to interact with actual hardware but should successfully load and unload
within the Linux kernel running in QEMU.
4-Compile and Load the Driver:
-Compile the driver as a module and load it into the Linux kernel within the QEMU
environment. Use insmod to load the module and rmmod to remove it.
5-Test the Driver:
-Test the driver by opening a device file associated with your driver and performing read and
write operations. Use dmesg to verify that write operations log input to the kernel log.
6-Document the Process:
-Briefly document the steps you took, any challenges you faced, and how you tested the
driver.

Daily Assignments
Linux Systems
Task 1: Kernel Architecture Diagram - Draw a detailed diagram of the Linux kernel architecture. Label and
write a short description (2-3 sentences) for each major component like Scheduler, File System, Network
Stack, etc.

Task 2: Use command-line tools to perform the following tasks in Linux:


Create a directory structure /tmp/myfiles and navigate into it.
Create three text files, write sample content in them, and list the files in the directory.
Change the permissions of one file to read-only for the group.

Shell Scripting
Task 3: Write a Bash script that:
Declares two variables, one string, and one integer.
Includes an if-else statement that prints a message based on the value of the integer.

Task 4: Loop and Function Script: Write a script that:


Uses a for loop to iterate over a list of file names.
For each file, calls a function that prints the number of lines in the file.

Task 5: Pipes and Filters: Write a Bash script that:


Uses the grep command to find and list all occurrences of a specific word in a given file.
Pipes the output to sort to display the results alphabetically.

Linux Systems Internals and Programming


Task 6: Privilege Levels Essay: Write a detailed essay explaining Linux's privilege levels, focusing on Kernel
Mode and User Mode.
Include examples of operations permitted at each level.
For each file, calls a function that prints the number of lines in the file.

Task 5: Pipes and Filters: Write a Bash script that:


Uses the grep command to find and list all occurrences of a specific word in a given file.
Pipes the output to sort to display the results alphabetically.

Linux Systems Internals and Programming


Task 6: Privilege Levels Essay: Write a detailed essay explaining Linux's privilege levels, focusing on Kernel
Mode and User Mode.
Include examples of operations permitted at each level.

Task 7: Segmentation and Paging Presentation: Prepare a slide presentation on segmentation and paging,
including visual diagrams and examples of address translation.

File Handling and Management


Task 8: File Operations in C
Write a C program to perform the following file operations:
Open an existing file named "data.txt." If it doesn't exist, the program should create it.
Write the string "Hello, File Handling in C!" to the file.
Move the file pointer to the beginning of the file and read the contents back.
Print the contents read from the file to the console.
Close the file.

Task 9: Directory Operations in C


Develop a C program to perform directory operations:
Use system calls to list all files and directories in the current working directory.
Change the current working directory to "/tmp".
Create a new directory named "testdir" within "/tmp" and set its permissions to 755.

Process Management and Control


Task 10: Process Creation and Management in C
Write a C program that demonstrates process creation and management:
Use fork() to create a child process.
In the child process, execute an external program (e.g., ls command) using execvp().
In the parent process, wait for the child process to complete and print a message indicating the child’s
termination.

Task 11: Inter-Process Communication (IPC) Using Shared Memory


Implement an IPC mechanism using shared memory in C:
Create a shared memory segment and attach it to the process's memory space.
Write a string message to the shared memory in one process.
Read and display the message from the shared memory in another process.

Network Programming with Sockets


Task 12: TCP Socket Programming in C
Develop a simple client-server application using TCP sockets in C:
The server listens on a specified port and accepts a client connection.
Once connected, the server sends a message "Welcome to the Server!" to the client.
The client receives the message and prints it to the console.

Task 13: UDP Socket Programming in C


Create a basic UDP program in C:
Implement both client and server functionalities within the program.
The client sends a message "Hello from Client" to the server.
The server receives the message, prints it, and responds with "Hello from Server."
The client receives the server's response and displays it.

Writing Custom System Calls


Task 14: Developing a More Complex Custom System Call in C
Your task is to develop a custom system call in the Linux kernel that performs a more complex operation
than simple arithmetic. The system call should accept a string as an input, reverse the string, and then return
the reversed string to the user space. This task involves understanding string manipulation in kernel space
and how data is transferred between user space and kernel space.
The client sends a message "Hello from Client" to the server.
The server receives the message, prints it, and responds with "Hello from Server."
The client receives the server's response and displays it.

Writing Custom System Calls


Task 14: Developing a More Complex Custom System Call in C
Your task is to develop a custom system call in the Linux kernel that performs a more complex operation
than simple arithmetic. The system call should accept a string as an input, reverse the string, and then return
the reversed string to the user space. This task involves understanding string manipulation in kernel space
and how data is transferred between user space and kernel space.
Steps to follow:
Modify the Linux kernel source code to add your new system call.
The system call should be defined to take a user-space pointer to a string, and another pointer to store the
result.
Inside the system call, reverse the string safely in kernel space.
Return the reversed string to the user-space pointer provided.
Rebuild and load the modified kernel.
Document the entire process, including handling memory allocation and copying data between user and
kernel spaces.

Task 15: User-Space Program to Test the Custom System Call


Write a C program in user space that tests your new custom system call.
The program should prompt the user to enter a string.
It should then use the custom system call to reverse the string.
Finally, the program should print the reversed string returned by the system call.
Include in your program:
Proper error handling to ensure that the system call is invoked correctly.
Memory management to allocate and free the necessary space for the strings.

Debugging and Testing


Task 16: Debugging with GDB
Write a C program that intentionally contains a logical error (e.g., incorrect loop condition).
Use GDB (GNU Debugger) to debug the program:
Set breakpoints, inspect variable values, and step through the program to find and fix the error.

Task 17:
Virtual Memory Basics:
Summarize how virtual memory works in Linux in three sentences or less. Why is virtual memory critical in a
multitasking operating system?

Kernel vs. User Space Memory:


Write down the differences between kernel space and user space memory. Why is this distinction important
in Linux systems?

Exploring procfs:
What kind of information can you find about memory mappings in the procfs? Describe how you would use
procfs to find out about the virtual memory usage of a process.

Buffer Overruns Prevention:


Explain what buffer overruns are and how the Linux kernel prevents them. Why is it important to avoid
buffer overruns in relation to virtual memory?
Task 18: Develop "Hello World" Kernel Module
Objective: Write, load, and log a simple kernel module.
Scope: Understand module basics, compile, load/unload, and dmesg logging.

Task 19: Enhance Kernel Module with Parameters


Objective: Add customizable parameters and logging levels.
Scope: Use module_param(), experiment with printk() for various log levels
.
Task 20: Register and Initialize Char Device
Objective: Create and register a character device module.
Scope: Implement register_chrdev() and cdev_init(), create device file in /dev.

Task 21: Implement Kernel-User Space Communication


Objective: Facilitate data exchange between kernel and user app.
Scope: Develop user-space app, perform read/write operations with the char device.

Task 22: Device Number Allocation and Registration


Objective: Allocate and register a character device.
Scope: Use alloc_chrdev_region() and cdev_add().

Task 23: Implement File Operations


Objective: Code file operations for a character device.
Scope: Define file_operations structure with open(), release(), read(), write().

Task 24: ioctl Method Implementation


Objective: Handle user space requests with ioctl.
Scope: Implement unlocked_ioctl(), define custom commands.

Task 25: Synchronization and Deadlock Prevention


Objective: Employ mutexes and spinlocks effectively.
Scope: Use synchronization primitives; prevent deadlocks and race conditions.

Task 26: Understand and Illustrate Kernel Contexts


Objective: Differentiate process and interrupt contexts.
Scope: Summarize context roles, preemption, and sleeping mechanisms.

Task 27: Semaphore and Mutex Implementation


Objective: Implement semaphores and mutexes.
Scope: Use sema_init(), down(), up(), and Mutex API in a sample module.

Task 28: Deadlock Prevention Technique Application


Objective: Apply deadlock prevention strategies.
Scope: Demonstrate lock hierarchy and effective locking to avoid deadlocks.

Task 29: Implement Blocking I/O with Wait Queues


Objective: Enable blocking read/write operations.
Scope: Utilize wait_event_interruptible(), init_waitqueue_head(), prepare_to_wait().

Task 30: Memory Mapping and Access Control Implementation


Objective: Implement memory mapping and access controls.
Scope: Code mmap() method, handle VM operations, use llseek(), and enforce permissions with capable(),
uid_eq().
Task 31:
Device Tree Structure Quick Review:
Draw a simple device tree structure and label where you would find the DTB, DTC, and DTS within a Linux
system. Explain each component's role in under three sentences.

Kernel Device Tree Usage Scenario:


Describe a scenario where the Linux kernel would need to use a device tree to interact with hardware. How
does modifying the device tree affect hardware recognition?

Overlaying Device Trees Challenge:


Explain the concept of overlaying device trees and give an example of when you would need to create an
overlay for a device tree in a Linux system.

Task 32: DMA Buffer Allocation and Mapping


Objective: Implement DMA buffer management.
Scope: Allocate buffers with dma_alloc_coherent() and manage with dma_map_single(), dma_map_sg().

Task 33: DMA Synchronization Implementation


Objective: Handle DMA buffer synchronization.
Scope: Use dma_sync_single_for_cpu() and dma_sync_single_for_device() for correct DMA operations.

Task 34: Kernel Timer Utilization


Objective: Implement kernel timers.
Scope: Initialize with init_timer(), manage timers with add_timer(), mod_timer().

Task 35: Tasklets and Workqueues Management


Objective: Initialize and handle deferred work.
Scope: Use tasklet_init() for tasklets, create_workqueue() for workqueues.

Task 36: Memory Allocation Function Usage


Objective: Utilize kernel memory allocation functions.
Scope: Implement kmalloc(), kfree(), vmalloc() with appropriate GFP flags.

Task 37: Noncontiguous Memory Management


Objective: Manage noncontiguous memory.
Scope: Use vmalloc() and kmem_cache_create() for memory pools.

Task 38: Interrupt Handling Basics


Objective: Understand and handle interrupts.
Scope: Code interrupt handlers with request_irq() and free_irq().

Task 39: IRQ Management


Objective: Manage IRQs and shared lines.
Scope: Work with IRQ numbers, descriptors, and shared interrupt lines.

Task 40: Kernel Data Types and List Operations


Objective: Implement kernel-specific data structures.
Scope: Use fixed-width integer types and list APIs like list_head, list_add(), list_for_each_entry().

Task 41: Atomic Operations and Bit Manipulation


Objective: Execute atomic operations and bit manipulation.
Scope: Apply atomic_t, set_bit(), test_and_set_bit() in kernel modules.
Task 42: Sysfs and Kobjects
Objective: Utilize Sysfs and Kobjects.
Scope: Create Sysfs entries, manage Kobjects.

Task 43: Implementing Attribute Files


Objective: Handle attribute files.
Scope: Implement show() and store() methods for device attributes.

Task 44: Hotplug Mechanism Integration


Objective: Integrate udev and uevents.
Scope: Manage hotplug and coldplug callbacks.

Task 45: Memory Mapping Implementation


Objective: Implement memory mapping.
Scope: Use remap_pfn_range(), handle vm_area_struct, and mmap() operations.

Task 46: Advanced DMA Handling


Objective: Perform advanced DMA operations.
Scope: Implement scatter-gather and handle asynchronous DMA transfers.

Task 47: Debugging Device Drivers


Objective: Debug drivers effectively.
Scope: Use printk(), handle kernel oops, and utilize KDB/KGDB.

Task 48: Profiling and Tracing Drivers


Objective: Profile and trace driver behavior.
Scope: Implement profiling with ftrace and perf, manage tracepoints.

Task 49: Driver Portability and Compatibility


Objective: Ensure driver compatibility.
Scope: Address endianness, write platform-independent code, manage API changes.
15.75

Duration (Hrs) Desired Outcomes


In this module, learners will learn about the Linux operating
system's core components and how it works. They will explore
the Linux kernel, understand its structure, and grasp its role in
managing hardware. The module covers essential file and
directory operations, managing file permissions, handling user
accounts and groups, and performing advanced file tasks.
1 Learners will also gain insights into process management,
scheduling, package management using tools like 'apt' and
'yum,' and the Linux boot process. This knowledge is essential
for system programmers as it equips them to understand linux
system better.

This module explores Linux system internals, essential for


system programmers. It covers the purpose of the Linux system,
the distinction between kernel and user space, and the concept
of privilege levels. Learners will understand the transition to
Protected Mode, memory protection through segmentation and
paging, and the User-Space to Kernel-Space shift facilitated by
system calls. Kernel space operations, direct hardware access,
and controlled interfaces via syscalls are emphasized, ensuring
security, stability, and efficient resource management.

4
In this module, learners will master the art of debugging and
testing, vital skills for system programmers. They'll explore
debugging techniques tailored for kernel code and familiarize
themselves with kernel debuggers and tools. Additionally, the
module covers GNU Bin Tools for programmers, focusing on
understanding process layout, memory segmentation, and
program memory organization.

Learners will delve into important Bin Tools such as 'nm' for
symbol table analysis, 'objdump' for extracting disassembly and
3 sections, and 'readelf' for retrieving ELF header information and
examining section headers. The module concludes with 'size' for
determining binary size information. These skills are essential
for efficient debugging, testing, and analysis of Linux system
components.

This module introduces learners to Linux device drivers,


covering kernel-user space interaction, driver types (Character,
Block, Network), essential development tools (GCC, Make),
module creation and loading, kernel data structures, version
compatibility, logging with printk(), and device registration and
initialization.

6
6

This module focuses on Character Device Drivers, covering


Major and Minor Numbers, allocation of device numbers with
alloc_chrdev_region(), registering devices using cdev_add(),
detailed function signatures for File Operations (open, release,
read, write), ioctl handling, and synchronization techniques
with Mutexes and Spinlocks, emphasizing deadlock and race
condition prevention.

This module covers kernel-level Concurrency and Race


Conditions, addressing Process and Interrupt Contexts, Kernel
Preemption, and Sleeping. It explores synchronization with
Semaphores and Mutexes, utilizing functions like sema_init(),
down(), and up(). Deadlock identification, avoidance, and
effective locking techniques are also discussed.

4
4

In the DMA module, learners explore Direct Memory Access,


covering DMA API and concepts, buffer allocation using
dma_alloc_coherent(), buffer management with
dma_map_single() and dma_map_sg(), handling DMA transfers,
and synchronization techniques like dma_sync_single_for_cpu()
and dma_sync_single_for_device().

This module covers time-related aspects, including Kernel


Timers with init_timer(), add_timer(), and mod_timer(),
timekeeping in the Kernel, and Tasklets and Workqueues with
tasklet_init() and create_workqueue() for deferred work
handling.

This module covers critical aspects of memory management,


including memory allocation functions like kmalloc(), kfree(),
and vmalloc(), as well as understanding memory zones and GFP
flags. Learners explore managing noncontiguous memory,
3 addressing high memory, and utilizing the vmalloc() area.
Additionally, it introduces the Memory Pool API with
kmem_cache_create(). The module also delves into interrupt
handling, explaining IRQs, IRQ numbers, and descriptor
management. It distinguishes between top-half and bottom-half
interrupt handlers, emphasizing writing effective interrupt
handlers using request_irq() and free_irq(). Furthermore,
kernel-specific data types, atomic operations, and bitwise
manipulation with functions like set_bit() and
flags. Learners explore managing noncontiguous memory,
3 addressing high memory, and utilizing the vmalloc() area.
Additionally, it introduces the Memory Pool API with
kmem_cache_create(). The module also delves into interrupt
handling, explaining IRQs, IRQ numbers, and descriptor
management. It distinguishes between top-half and bottom-half
interrupt handlers, emphasizing writing effective interrupt
handlers using request_irq() and free_irq(). Furthermore,
kernel-specific data types, atomic operations, and bitwise
manipulation with functions like set_bit() and
4 test_and_set_bit() are covered comprehensively.

In this module, learners delve into the Linux Device Model,


understanding Sysfs, attribute files, and hotplug mechanisms.
They explore memory mapping and DMA operations, debugging
techniques with effective logging and kernel debuggers,
3 profiling using ftrace and perf tools, and ensuring portability
and compatibility in driver development.

4
4
4. Task: (Conceptual) Research How System Calls Enable Privilege Escalation
5. Task: (Conceptual) Research Syscall Handling in the Kernel
Task Set 4: Exploring Kernel Space Operations and Restrictions (Conceptual and Observational)
1. Task: (Conceptual) Research Kernel Space's Direct Access to Hardware
2. Task: (Conceptual) Research the Execution of Device Drivers in Kernel Space
3. Task: (Conceptual) Research Core Functions in Kernel Space
4. Task: (Conceptual) Understand the Kernel as the Core of the Operating System
5. Task: (Conceptual) Research Resource Management by the Kernel
6. Task: Observe User Space Restrictions (Hands-on)
Handson
7. Task: (Conceptual) Understand the Role of Syscalls as Controlled Interfaces
8. Task: (Conceptual) Research the Benefits of Isolating User Space from Kernel Space
Advanced and Challenge Tasks:
• Task: Analyze a Shared Library (Revisited with a Focus on Kernel Interaction): Choose a core shared library lik
libc.so.6. Use nm, objdump, and readelf to analyze its symbols, sections, and structure. Pay attention to the symb
related to system calls (e.g., syscall, __syscall). How do these symbols facilitate the transition to the kernel?
• Task: Explore Dynamic Linking and System Calls: Use ldd on a program that makes system calls. Observe whi
shared libraries are linked. Research how dynamic linking helps programs access system call wrappers provided
libraries like libc.
• Task: (Conceptual) Explore SystemTap or BPF for Dynamic Analysis (Focus on Kernel Events): Research how t
like SystemTap or BPF can be used to dynamically trace system calls and other kernel events. Understand how th
provide insights into the interaction between user space and the kernel without modifying the kernel code.
• Task: (Conceptual) Research Kernel Modules: Understand what kernel modules are and why they are used. H
do they fit into the kernel space? How are they loaded and unloaded?
Advanced and Challenge Tasks:
• Task: Write a Simple C Program that Uses a System Call Directly: Write a basic C program that uses a system
like write or read directly (instead of relying on standard library functions like printf or fread). Compile and run it
then use strace to verify that it makes the expected system call.
• Task: Research a Specific System Call in Detail: Choose a system call (e.g., fork, execve, pipe) and research its
purpose, arguments, and how it facilitates communication or process management between user space and the
kernel.
• Task: Explore the Differences Between System Calls and Library Functions: Research the relationship betwee
system calls and standard library functions, understanding when a library function might make a system call and
it might perform operations entirely in user space.
• Task: (Requires Kernel Source Code or Advanced Tools) Observe the System Call Entry Point: (Highly advance
Research how the transition from user space to kernel space happens at the assembly level, involving interrupts
trap instructions. This is a more theoretical task but can be explored by examining kernel source code or using
advanced debugging tools.
Linux Device Drivers: Deep Dive & Practical Application
Objective: This assignment aims to solidify your understanding of Linux device drivers by guiding you through the
process of creating, testing, and interacting with a basic character device driver. You will apply the concepts cove
the module to build a functional driver and understand its lifecycle.
Assignment:
We will create a simple character device driver named "ldd_assignment" that acts as a virtual, in-memory buffer
Userspace applications will be able to write data to this buffer and read data from it.
Tasks:
1. Development Environment Setup:
o Verify that you can build and load a simple "Hello World" kernel module.
4.
2. Task: Determine
Basic Kernel Binary
Module: Size Information
"Hello World" (Review with&size Refinement):
Advanced and Challenge Tasks:
o Create a kernel module named hello_ldd.c that prints "Hello, LDD Assignment!" when loaded and "Goodbye
•Assignment!"
Task: Use whena User-Space
unloaded Debugger (gdb):
using printk().
o Compile your C program with
o Include the necessary headers: <linux/module.h>, debugging symbols: gcc -g -o my_program
<linux/kernel.h>, my_program.c.
and <linux/init.h>.
o Start the debugger: gdb my_program.
o Use module_init() and module_exit() to specify your initialization and cleanup functions.
o
o Set a breakpoint
Create a Makefileattothe main
build thisfunction:
module.break main.
o Run the program: run.
o Load and unload the module using insmod and rmmod respectively, and observe the output in the kernel log
o
(dmesg). Step through the code line by line: next.
o
3. Print the values
Designing of variables: printCharacter
the "ldd_assignment" local_var,Device
print global_var.
Driver:
o
o Kernel-User Space Interaction: Think about howmemory
Examine memory: x /x &local_var (examine the userspace at applications
the address willof local_var).
interact with your driver. They w
o Continue execution: continue.
standard file operations like open(), read(), write(), and close().
o
o Explain how gdb allows
Driver Structure: Plan the interactive
structuredebugging of user-space programs,
of your ldd_assignment.c inspecting
file. You will need tovariables,
define thestepping through
necessary func
and analyzing memory.
to handle the file operations.
•o Task: BufferAnalyze a Shared Library:
Implementation: Decide Choose
how youa willshared library on
implement theyour system (e.g.,
in-memory libc.so.6)
buffer. A simpleand use nm,array
character objdump
or a
readelf to analyze its symbols, sections, and structure.
dynamically allocated buffer will suffice for this assignment. Consider its size and how to handle potential overflo
•4. Task: Explore Dynamic
Implementing Linking: Research
the "ldd_assignment" how dynamic linking works and how tools like ldd can show the sha
Driver:
libraries that a program depends on.
o Include Necessary Headers: Include headers like <linux/module.h>, <linux/kernel.h>, <linux/init.h>, <linux/fs
•<linux/cdev.h>,
Task: Understand the Purpose
<linux/slab.h>, of Different ELFand
<asm/uaccess.h>, Sections: Research common ELF sections
<linux/uaccess.h>.
(e.g., .text, .data, .bss, .rodata, .symtab, .strtab,
o Module Information: Define the module license and author .debug_info) andusing
theirMODULE_LICENSE()
role in organizing a binary.
and MODULE_AUTHO
•o Task: (Conceptual/Research) Explore SystemTap or
Device Number Allocation: Dynamically allocate a major and minor number BPF for Dynamic Analysis:forResearch dynamicdevice
your character analysis too
using
SystemTap or BPF
alloc_chrdev_region(). (Berkeley Packet Filter) which allow you to probe the kernel and user space without modifying
code, providingDevice
o Character powerful debugging
Structure: and tracing
Initialize a structcapabilities.
cdev for your device using cdev_init().
Assignment: Exploring
o File Operations: Memory Mappings
Implement the following andfile
Interacting
operation with Kernel Space
functions:
Objective: To understand how virtual memory is
 ldd_assignment_open(): Called when a userspace application opens organized in Linux, how theprocesses
device map
file. memory, the distinction
between user and kernel space, and how user space interacts with
 ldd_assignment_release(): Called when a userspace application closes the device file. kernel space.
Part 1: Exploring Process Memoryfile
 ldd_assignment_read(struct Mappings
*filp, charwith procfs
__user *buf, size_t count, loff_t *f_pos): Reads data from the buff
1. Create a Simple C Program:
the userspace buffer. Use copy_to_user() carefully. Handle the buffer position (f_pos).
o
 Write a C program named memory_explorer.c
ldd_assignment_write(struct file *filp, const char that performs
__user *buf,the following:
size_t count, loff_t *f_pos): Writes data from
 Declares an integer variable on the stack.
userspace buffer to the driver's buffer. Use copy_from_user() carefully. Handle the buffer position (f_pos).

o Declares a globalStructure:
File Operations integer variable.
Populate a struct file_operations with pointers to your implemented functions.
 Allocates memory
o Device Registration: onAdd
theyour
heapcharacter
using mallocdevicefor to
anthe
integer.
kernel's device list using cdev_add().
 Prints the addresses
o Initialization and Cleanup: of the stack variable, the global variable, and the heap-allocated variable.
 Prints
Implementthe process ID (PID) of the program
the ldd_assignment_init() usingAllocate
function: getpid().device numbers, initialize the cdev, and add the dev
 Enters
Use printk()an toinfinite loop or
log success (e.g., using while(1);) so you can inspect its memory while it's running.
failure.
 Implement the ldd_assignment_exit() function: Delete the character device using cdev_del() and unregister
Part 2: numbers
device SimulatingusingKernel Space Interaction
unregister_chrdev_region(). Use printk() to log cleanup.
o Module Entry and Exit Points: Use module_init() and module_exit() to point to your ldd_assignment_init() an
ldd_assignment_exit() functions.
5. Adding Module Parameters (Optional but Recommended):
o Add a module parameter named buffer_size using module_param() that allows the user to specify the size o
internal buffer when loading the module.
o Modify your driver to allocate the buffer dynamically based on the buffer_size parameter. Handle potential
memory allocation failures.
6. Building and Testing the Driver:
o Update your Makefile to build the ldd_assignment.ko module.
o Load the module using insmod ldd_assignment.ko. If you implemented the module parameter, try loading it
specific size: insmod ldd_assignment.ko buffer_size=1024.
o Check the kernel log (dmesg) for messages from your driver.
o Create a Device Node: Manually create a device node in the /dev directory corresponding to your driver's m
and minor numbers. You can find these numbers in the kernel log after loading the module. The command is typ
sudo mknod /dev/ldd_assignment c <major_number> <minor_number>.
o Userspace Testing Program: Write a simple C program that opens /dev/ldd_assignment, writes some data to
reads data back, and closes the device. Print the data read back to verify the driver's functionality.
o Update your Makefile to build the ldd_assignment.ko module.
o Load the module using insmod ldd_assignment.ko. If you implemented the module parameter, try loading it
specific size: insmod ldd_assignment.ko buffer_size=1024.
o Check the kernel log (dmesg) for messages from your driver.
o Create a Device Node: Manually create a device node in the /dev directory corresponding to your driver's m
and minor numbers. You can find these numbers in the kernel log after loading the module. The command is typ
sudo mknod /dev/ldd_assignment c <major_number> <minor_number>.
o Userspace Testing Program: Write a simple C program that opens /dev/ldd_assignment, writes some data to
reads data back, and closes the device. Print the data read back to verify the driver's functionality.
o Test Cases:
 Write data that is smaller than the buffer size.
 Write data that is larger than the buffer size (observe how your driver handles this).
 Read data after writing.
 Attempt to read more data than is currently in the buffer.
 Test multiple opens and closes.
o Unload the module using rmmod ldd_assignment. Check the kernel log for cleanup messages.
7. Documentation and Reflection
Part 2: Implementing File Operations
1. Define the struct file_operations:
2. Implement pseudo_mem_open: }
3. Implement pseudo_mem_release:
4. Implement pseudo_mem_read:
5. Implement pseudo_mem_writePart
3: Implementing the ioctl Method
1. Define ioctl Commands
2. Implement pseudo_mem_ioctl (or unlocked_ioctlPart
4: Synchronization Techniques
• In a real-world scenario, multiple processes might access your device concurrently. This can lead to race con
when accessing the pseudo_mem_buffer. We need to protect access to this shared resource.
1. Implement Mutex Protection
2. Implement Spinlock Protection (Optional but good to understand
3. Strategies to Prevent Deadlocks and Race Conditions:
Part 5: Building and Testing the Driver
1. Create a Makefile
2. Build the Module
3. Load the Module
4. Test with User Space Programs
5. Compile User Space Programs
6. Run User Space Programs
7. Unload the Module
8. Remove the Device Node
 Assignment 8: Deadlock Prevention Strategies
• Objective: Practice effective locking.
• Task:
o Implement retry logic using trylock() in a kernel module.
o Use lock timeouts to avoid hard deadlocks.
 Assignment 9: Lock Hierarchy Enforcement
• Objective: Enforce a lock acquisition hierarchy.
• Task:
o Create three shared resources protected by mutexes.
o Document a strict lock acquisition order.
o Validate using kernel debug options like lockdep (CONFIG_DEBUG_LOCK_ALLOC).
 Assignment 10: Kernel Debugging of Concurrency Issues
• Objective: Learn to identify real-world locking issues.
• Task:
o Use printk, lockdep, ftrace, or dmesg to track lock behavior in previous assignments.
o Trigger deadlocks and analyze stack traces.
1. Choose a simple peripheral (e.g., an LED or I2C device).
2. Modify an existing .dts file to include a new node for your device.
3. Set properties like GPIO number, compatible string, etc.
4. Recompile and verify using dtc.
Hands-On Assignment 3: Kernel Integration Test
• Objective: Understand how the kernel consumes Device Trees.
• Steps:
1. Boot a Linux system with a custom .dtb.
2. Verify that the kernel has recognized the device via dmesg or /proc/device-tree/.
2. Verify that the kernel has recognized the device via dmesg or /proc/device-tree/.
3. Use tools like hexdump or fdtdump to inspect .dtb contents.
Hands-On Assignment 4: Create a Device Tree Overlay
• Objective: Dynamically add hardware support using overlays.
• Steps:
1. Write a small Device Tree Overlay (.dts) for an add-on board (e.g., GPIO expansion).
DMA
2. Load Hands-On Assignment
the overlay Series or U-Boot (depends on platform).
using configfs
Assignment
3. Confirm1: DMA API Basics
functionality via /sys/firmware/devicetree/base/.
• Objective: Understand DMA setup and concepts using a basic kernel module.
3.
• Boot Task: the image in QEMU.
Hands-On
1. Write aAssignment 6: Create
simple kernel module Custom Layer and
that initializes Recipe
a DMA-capable device (can be simulated).
•2. Objective: Extend Yocto with custom content.
Print out device DMA mask capabilities (dma_get_mask()).
•Assignment
Steps: 2: Allocating Coherent DMA Buffers
1.
• Create a new
Objective: Uselayer:
dma_alloc_coherent() to allocate memory accessible by both CPU and device.
2. Write
• Task: a recipe for a custom app (e.g., a simple C "Hello World").
3.
1. Add youraapp
Allocate to IMAGE_INSTALL.
buffer in a kernel modul
Hands-On
2. Fill buffer with data7:and
Assignment Customize and Rebuild
print virtual Yoctoaddresses.
and physical Image
•Assignment
Objective: Modify and expand a Yocto image.
3: Managing DMA Buffers with dma_map_single()
• Steps:
Objective: Practice streaming DMA buffer mapping.
1.
• Add
Task:Dropbear or OpenSSH to the image.
2.
1. Include
Allocateyour custom
memory withapp in the rootfs.
kmalloc() (non-coherent).
3. Boot the image, confirm functionality
2. Map it with dma_map_single() and print via the
SSHreturned
or console.
DMA address.
3. Simulate a device write and unmap using dma_unmap_single().
Assignment 4: Scatter-Gather DMA with dma_map_sg()
• Objective: Handle non-contiguous memory.
• Task:
1. Use alloc_pages() or multiple kmalloc() to create scatter buffers.
2. Fill struct scatterlist[] and call dma_map_sg().
3. Iterate and print DMA addresses for each segment.
Assignment 5: DMA Synchronization
• Objective: Synchronize CPU and device access to DMA buffers.
• Task:
1. Allocate a streaming DMA buffer.
2. Before CPU reads, use:
dma_sync_single_for_cpu(dev, dma_handle, size, DMA_FROM_DEVICE);
3. After CPU write, use:
dma_sync_single_for_device(dev, dma_handle, size, DMA_TO_DEVICE);

2. Schedule it in your module's init function with tasklet_schedule().


3. The handler should print CPU ID and jiffies.
Assignment 5: Simulate IRQ and Schedule a Tasklet
• Objective: Link tasklets to interrupt-like behavior.
• Steps:
1. Trigger tasklet from a simulated IRQ (e.g., timer or procfs trigger).
2. Confirm it runs in softirq context (check in_interrupt() or in_softirq()).
Assignment 6: Using Workqueues
• Objective: Move work to a kernel thread context.
• Steps:
1. Initialize a workqueue with create_workqueue() and define a work handler.
2. Use queue_work() to schedule it.
3. In the handler, sleep with msleep() to demonstrate sleepable context (tasklets can't do this).
1. Write a kernel module that checks available high memory (si_meminfo() or vm_stat).
2. Use kmap()/kunmap() to access high memory pages.
Assignment 5: Creating a Custom Memory Pool with kmem_cache_create()
• Objective: Use slab allocator for efficient object caching.
• Steps:
1. Define a simple struct (e.g., a network buffer).
2. Create a cache with kmem_cache_create().
3. Allocate/free objects using kmem_cache_alloc() and kmem_cache_free().
3. Allocate/free objects using kmem_cache_alloc() and kmem_cache_free().
2. Each handler must check dev_id to ensure it's their own interrupt.
3. Use GPIO or dummy platform device IRQs if real hardware isn't available.
Assignment 5: Triggering Software IRQ
• Objective: Simulate an interrupt manually (debugging/learning only).
• Steps:
1. Use kernel API like generic_handle_irq() (restricted use).
2. Alternatively, simulate with a timer/tasklet triggering an IRQ handler indirectly (e.g., calling handler logic wit
shared data structure).
1. Define a structure with a list_head member.
2. Dynamically allocate and insert multiple nodes using list_add().
3. Traverse the list using list_for_each_entry() and print node contents.
4. Clean up memory on module exit.
Assignment 3: Atomic Counter Module
• Objective: Demonstrate use of atomic_t in a concurrent-safe counter.
• Task:
o Create a kernel module with a global atomic_t counter.
o Provide read, increment, and decrement operations via sysfs or module parameters.
o Use atomic_read(), atomic_inc(), atomic_dec().
Assignment 4: Bit Manipulation
• Objective: Practice bit-level control using kernel APIs.
• Task:
o Create a module using a unsigned long flags variable.
o Use set_bit(), clear_bit(), test_and_set_bit() to manipulate flag bits.
o Log the status of specific bits before and after operations.
o Monitor udev events in user space using udevadm monitor.
o Create custom udev rules to log or act on your event.
Assignment 4: Simulating Hotplug with Callbacks
• Objective: Explore kernel hotplug support and related callbacks.
• Task:
o Implement hotplug callbacks (.uevent, .probe, .remove) in a simple platform driver.
o Register a dummy device to trigger hotplug events.
o Validate callback execution using debug logs (pr_info).
o Trace execution of your module’s init and exit functions.
o Use trace-cmd or cat trace to analyze the output.
Assignment 5: Using kprobes
• Objective: Insert dynamic probes to observe kernel behavior.
• Task:
o Register a kprobe on a common kernel function (e.g., do_sys_open).
o Log arguments and return values using a handler.
o Remove the probe cleanly.
Module SDLC - Software Development Life Cycle and Agile Principles
Time (hrs) 5
Sl. No. Topics
1.0 Introduction to SDLC Phases
Overview of SDLC
1.1 Explanation of SDLC phases: Requirements, Design, Implementation, Testing, Deployment.
The significance of a well-defined SDLC.
Assignment 1
Techniques for gathering requirements (interviews, surveys, observations).
1.2
Hands-on Activity 1: Conduct a mock requirement gathering session for a fictional project.
Documentation and traceability of requirements.
Assignment 2
Detailed exploration of the system design phase.
1.3
Hands-on Activity 2: Create a system design document for a sample project.
Architectural considerations and design principles.
8.0 UML Topics
Use-Case Diagrams
Definition and Purpose
8.1 Creating Use-Case Diagrams with Examples
Detailing Functional Requirements
Advanced Use-Case Modeling
State Machine Diagrams
Explanation and Diagram Elements
8.3 Example Diagrams and Application
Defining States and Transitions
Advanced State Modeling Techniques
Sequence Diagrams
Purpose and Utility
8.4 Constructing Sequence Diagrams with Scenarios
Depicting Object Interactions
Complex Sequence Modeling

Assignment 1: SDLC Overview - Create a one-page infographic that outlines the SDLC phases (Requirements, Design, Implemen

Assignment 2: Requirements Gathering - Conduct a 30-minute mock interview to gather requirements for a fictional app that

Submission Guidelines:
1. Ensure that each answer is clear, concise, and reflects an understanding of the core concepts.
2. Diagrams can be hand-drawn and scanned or created using any digital drawing tool.
3. Provide references for any external sources used.
Submit your work in a single PDF document by end of Module.

Task 1: Use-Case Diagram Creation

Objective: Create a simple use-case diagram for a Library Management System.

_x000D_ Internal - General Use


#
Steps to Perform:

Identify at least two actors who will interact with the system (e.g., Librarian, Member).
Determine two to three main functionalities (use cases) that the actors will perform (e.g., Check Out Book, Return Book).
Draw a use-case diagram with these actors and use cases, showing the interactions between the actors and the system.

_x000D_ Internal - General Use


#
nt Life Cycle and Agile Principles

Topics

ses: Requirements, Design, Implementation, Testing, Deployment.


l-defined SDLC.
Assignment 1
g requirements (interviews, surveys, observations).
nduct a mock requirement gathering session for a fictional project.
eability of requirements.
Assignment 2
he system design phase.
ate a system design document for a sample project.
ons and design principles.

ams with Examples

Task 1

m Elements
Application

ing Techniques

Diagrams with Scenarios

ne-page infographic that outlines the SDLC phases (Requirements, Design, Implementation, Testing, Deployment), highlighting the importa

Conduct a 30-minute mock interview to gather requirements for a fictional app that helps organize community events. Summarize the requ

e, and reflects an understanding of the core concepts.


ned or created using any digital drawing tool.

nt by end of Module.

m for a Library Management System.

_x000D_ Internal - General Use


#
ct with the system (e.g., Librarian, Member).
es (use cases) that the actors will perform (e.g., Check Out Book, Return Book).
s and use cases, showing the interactions between the actors and the system.

_x000D_ Internal - General Use


#
Desired Outcome Hours Needed

Learners will gain a solid grasp of the Software Development Life Cycle
(SDLC), covering its core phases: Requirements, Design, Implementation,
Testing, and Deployment.

This understanding is essential as it allows learners to effectively


participate in software development processes, ensuring they can
contribute meaningfully to projects by following the structured path from
idea to product. Acquiring a good understanding of SDLC basics is crucial
for navigating software development success. 2

s, Design, Implementation, Testing, Deployment), highlighting the importance of each phase and how they interconnect.

a fictional app that helps organize community events. Summarize the requirements and how you would document and trace them in a one

_x000D_ Internal - General Use


#
Return Book).
d the system.

_x000D_ Internal - General Use


#
nterconnect.

ument and trace them in a one-page brief.

_x000D_ Internal - General Use


#
Module Capstone Project
Duration (Days) 5 days(4hours each)
Time (hrs) 20
Capstone Scenario
Assignment 1(LinuxOS)
File Explorer Application
Objective: Develop a console-based file explorer application in
C++ that interfaces with the Linux operating system to manage files
and directories.
Day-wise Tasks:
Day 1: Design the application structure and setup the development
environment. Start with basic file operations like listing files in a
directory.

Day 2: Implement file and directory navigation features. Enable the


user to move through directories.

Day 3: Add file manipulation capabilities (copy, move, delete, create).


Day 4: Implement file search functionality within the file explorer.

Day 5: Add file permission management features.

_x000D_ Internal - General Use


#
Capstone Scenario
Assignment 2(LinuxOS)
Custom Shell Implementation

Objective: Build a simple shell in C++ that can execute


commands, manage processes, and handle redirection and piping.
Day-wise Tasks:

Day 1: Plan the shell features and parse user input.

Day 2: Implement execution of basic commands through the shell.


Day 3: Add support for process management (foreground, background
processes).
Day 4: Implement piping and redirection features.
Day 5: Incorporate job control (listing jobs, bringing jobs to
foreground/background).

_x000D_ Internal - General Use


#
Assignment 3(LSP)
System Monitor Tool
Objective: Create a system monitor tool in C++
that displays real-time information about system
processes, memory usage, and CPU load, similar to the
'top' command.
Day-wise Tasks:
Day 1: Design UI layout and gather system data using
system calls.

Day 2: Display process list with CPU and memory usage.


Day 3: Implement process sorting by CPU and memory
usage.
Day 4: Add functionality to kill processes.
Day 5: Implement real-time update feature to refresh
data every few seconds.

_x000D_ Internal - General Use


#
Assignment 4(LSP)
Network File Sharing Server & Client
Objective: Develop a networked file sharing application
with a server and client architecture, enabling file transfers over
sockets.
Day-wise Tasks:

Day 1: Setup server-client socket communication.


Day 2: Implement file listing and selection feature on the client
side.

Day 3: Enable file transfer from server to client.


Day 4: Add file upload functionality from client to server.
Day 5: Implement security features like authentication and
encryption

_x000D_ Internal - General Use


#
Assignment 5(LinuxOS and LSP)
Bash Scripting Suite for System Maintenance

Objective: Write a suite of Bash scripts to automate system


maintenance tasks such as backup, system updates, and log monitoring.
Day-wise Tasks:

Day 1: Write a script for automated system backups.

Day 2: Create a script to perform system updates and clean up.

Day
Day 3
4:: Develop a log monitoring script to alert on certain conditions.
Combine scripts into a maintenance suite with a menu to execute
them.

Day 5: Test scripts and add error handling and logging functionalities.

_x000D_ Internal - General Use


#

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy