13
Embedded Linux System Internals List of Exercises Group 1: Device Tree Related Exercises - 4 Exercises Group 2: Initramfs Experiment On Raspberry Pi - 1 Exercise Group 3: Kernel Exercises - 8 Exercises Timmins Training Consulng Sdn. Bhd. DURATION: 5 days consult-timmins.com

Embedded Linux System Internals - consult-timmins.com€¦ · consult-timmins.com. Our Training Profile We customize the content Timmins Training Consulting was established in 2015

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

  • Embedded Linux System Internals

    List of Exercises

    Group 1: Device Tree Related Exercises - 4 Exercises

    Group 2: Initramfs Experiment On Raspberry Pi - 1 Exercise

    Group 3: Kernel Exercises - 8 Exercises

    Timmins Training Consulting Sdn. Bhd.

    DURATION: 5 days

    consult-timmins.com

  • Our Training Profile

    We customize the content

    Timmins Training Consulting was established in 2015. We are an HRDF registered training provider and our courses are HRDF claimable.

    We have done hundreds days of training sessions in many countries including Malaysia, Singapore, Indonesia, China, Taiwan, India Canada and USA.

    We have diverse clientele from telecommunications, information technology, finance, semi-conductor, manufacturing and oil & gas sectors.

    Our training programmes include courses in:

    Why choose Timmins?

    About Us - Timmins Training Consulting

    TelecommunicationsSoftware Development

    Web Development

    Artificial Intelligence & Data Semiconductor

    Embedded Programming

    Professional Development

    We work with subject matter expertsWe provide experiential learning

    TimminsTrainingConsulting

    Timmins Training Consulting Sdn. Bhd.

  • Timmins clients include:Our clients come from Malaysia, Singapore, Thailand, Indonesia, India, China, Canada and USA.

    TimminsTrainingConsulting

    Timmins Training Consulting Sdn. Bhd.

  • PRE-REQUISITES• Embedded programming in C or C++, Knowledgeable in Realtime operating systems

    This course provides a deep insight into the Embedded Linux kernel internals in a hardware platform specific context. The various Li-nux Kernel sub system infrastructure (data structures and functions) around the Linux device and driver models are brought to a sharp focus. The interplay of different kernel sub systems managing resources such as memory, file system and CPU are brought to a per-ceptual level of understanding enabling diagnostics and debugging of Linux based Embedded systems.

    DESCRIPTION

    LEARNING OUTCOME• To understand the configuration and build procedures associated with the kernel, root file system and device tree• To understand the multistage boot initialization sequence of Arm based embedded Linux system• To understand the management of Virtual address space resource in Linux kernel• To understand the management of memory resource in Linux kernel• To understand the interrupt handling, event handling and synchronization mechanisms in Linux• To understand the Linux device and driver model and its visibility through sysfs• To understand the Linux kernel sub system infrastructure that supports a program execution• To understand the management of CPU resource in Linux kernel• To understand the management of File System and File resources in Linux kernel• To understand the use of /proc and /sys entries as diagnostic aids in Linux kernel and driver debugging

    COURSE OBJECTIVESThis course attempts to serve multiple objectives

    To enable participants understand the fundamental structure of Embedded Linux kernel from the perspective of porting a Linux based Operating System execution environment over some standard hardware platforms including board bring up and manage the execution of Embedded Applications on top of it taking them to a skill level of diagnostics and debugging.

    To enable participants, who are already familiar with the fundamentals of Embedded Linux, to become proficient in the different device driver frameworks of Linux. The approach is to understand the kernel internals from a driver design perspective and identify the Linux infrastructure provisions that serve as building blocks of the driver frameworks.

    To enable participants interested in Android platform porting for custom hardware involving Hardware Abstraction Layer realization over an androidized Linux kernel and device drivers.

    Timmins Training Consulting

  • Embedded Linux System Internals

    • Physical memory allocation ◊ Buddy allocation

    • get_free_pages • Zones• GFP Masks • kmalloc

    ◊ SLAB and SLUB allocations • kmem_cache_init • kmem_cache_create • kmem_cache_alloc • kmem_cache_free • kmem_cache_destroy

    • Virtual address translation schema Kernel virtual address space

    • Kernel address space mapping ◊ Fixed mapping ◊ Dynamic mapping

    • vmalloc • ioremap • kmap

    • Task virtual address space

    Memory management in Linux

    Virtual Address Space Management in Linux

    • Boot loader stages ◊ U-boot◊ Kernel boot parameters◊ Linux kernel boot initialization◊ /sbin/init, init process and the scripts that are

    processed by init

    • Write a device tree entry for UART and build the device tree blob

    • Configure and build the kernel, root file system and device tree using build root and bring up Linux on the Nitrogen 8M board

    Boot Initialization

    Minor Exercise

    Major Exercise

    • Kernel Configuration • Root file systems

    ◊ Jffs2 ◊ Cramfs ◊ Initramfs◊ Device Tree

    • Device tree entries overview • Building device tree blob

    Configuration and Build 01

    02 04

    03

    Timmins Training Consulting

    Hands-on hardware specifics• Boundary Systems Nitrogen 8M (IMX 8 based) boards

  • Embedded Linux System Internals

    • The Linux Device Model◊ Platform devices ◊ Bus devices

    • Linux Driver Model • Device Registration

    ◊ struct device and its role in kernel space device registration.

    • Driver Registration◊ Device Probe function ◊ Sysfs entries◊ Device registration in devtmpfs file system

    mounted on /dev

    ◊ struct vm_area_struct ◊ struct page◊ struct mm_struct ◊ page tables

    Devices and their drivers in Linux

    Program Execution in Linux

    • Write a kernel module that would generate a pseudo kernel space event which gets delivered to the user space udev process.

    • Write appropriate udev rules to handle such an event to load a pseudo driver module.

    • Write a pseudo driver module that registers an interrupt handler function and allocates buffer for data transfer

    • Write an interrupt handler function that organizes a bottom half handling through any one of the bottom half handling mechanisms.

    • Write a pseudo bottom half handler function that does buffer handling

    Minor Exercise

    • Interrupt generation at hardware level (GPIO programming)

    • Interrupt reporting (Interrupt controller configuration/programming)

    • Interrupt Capturing at kernel level• Interrupt handling mechanisms (Interrupt Bottom Half

    handling) ◊ softirq◊ Tasklets Worker threads◊ Threaded irq handling

    • Uevent and its delivery to user space through netlink socket

    • Kernel Synchronization◊ Use of Atomic updates and increments ◊ Semaphores◊ Spinlocks

    Event handling and synchronization in Linux05 06

    07

    Timmins Training Consulting

    • Make suitable entries in device tree for the UART device in the Nitrogen 8M board, write a simple UART driver, build it as a kernel module and also as a built-in driver. Test the diver functionality through a test application.

    Major Exercise

  • Embedded Linux System Internals

    • Kernel data structure state published through /proc

    • Device and driver data structure state published through /sys

    Debugging • Scheduling Framework in Linux

    ◊ SCHED_FIFO◊ SCHED_RR ◊ SCHED_OTHER

    • CFS• Multicore per-cpu resources in the kernel cgroup and

    its use

    CPU management in Linux08

    • Virtual File System • Page cache• File System views

    ◊ /proc◊ /sys◊ /devtmpfs◊ /tmpfs

    File System and File management in Linux09

    10

    Timmins Training Consulting

    • Write a kernel module that does a page table walk for a specific process and dumps the physical page base addresses mapped to the Virtual Frame Numbers.

    • Create cgroup entries and study its effect• Study of /proc entries• Study of /sys entries

    Minor Exercise

  • GROUP 1 - DEVICE TREE RELATED EXERCISES

    GROUP 2 - INITRAMFS EXPERIMENT ON RASPBERRY PI

    Timmins Training Consulting

    Reading the device tree blob and registering the driver resources in the following device drivers• UART• USB• HDMI• RTC• ETHERNET

    Building initramfs separately or as part of kernel image for Raspberry PI board and related experiments.

    To configure IOMUX module in the dts file for enabling the functionality of the following• UART• USB• ETHERNET

    Reading the device tree blob for the IRQ and registering the interrupt handler in the following device drivers• UART• HDMI• RTC• ETHERNET

    Adding a pseudo node entry into the DTSI file, reading the resource entries in your own pseudo character device driver and handling the shared IRQ that of USB • UART• HDMI• RTC• ETHERNET

    Part 1: DRIVER RESOURCE REGISTERATION

    Part 4: PIN CONFIGURATION AND PIN MUXING ENTRIES IN DTS

    Part 2: DRIVER INTERRUPT HANDLING

    Part 3: ADDING YOUR OWN NODE INTO DTSI

  • GROUP 3 - KERNEL EXERCISES

    Timmins Training Consulting

    • SIMPLE CHARACTER DEVICE DRIVER• BUFFER HANDLING • INTERRUPT REGISTERATION• DRIVER DEBUGGING

    • WAITQUEUE

    • DEBUGFS• SYSFS

    • KERNEL MUTEX• SPINLOCK• SPINLOCK RW

    • PAGE WALK • KERNEL TIMERS• HR TIMERS

    • NETLINK SOCKETS• TASKLET• WORKQUEUE• THREADED IRQ

    Part 1 Part 5

    Part 2 Part 6

    Part 7Part 3

    Part 8Part 4

  • About NITROGEN8M

    Key Features of the Nitrogen8M Series:

    Ideal Applications for the Nitrogen8M:

    Timmins Training Consulting

    The Nitrogen8M single board computer (SBC) is the latest in i.MX based Nitrogen platforms, from NXP. Built with industry-leading au-dio, voice and video processing, the i.MX 8M applications processor family is ideal for applications scaling from consumer home audio to industrial building automation and mobile computers.

    • Cortex-A53 (64-bit) + Cortex-M4F• 2GB of LPDDR4 RAM (Up to 4Gb)• 8GB eMMC (Up to 128Gb)• USB 3.0• Pre-Certified WiFi (802.11ac) & Bluetooth (BT 4.1) module• 4K + HDR Video Capabilities• 4-Lane MIPI-DSI Display (up to 1080p)• Dual Camera Inputs (4-Lane MIPI-CSI)• High Performance GPU3D (GC7000)

    Video Voice control

    Audio General HMI

    Optimized for streaming video devices including:• Over-the-top (OTT) set top boxes• Digital media adapters• Digital signage• Machine visual inspection

    Industry leading voice processing for:• Voice controlled devices• Voice assistants

    Perfect for a variety streaming audio solutions:• Surround sound• Wireless or networked speakers• Sound bars• Audio/Video (AV) receivers• Public address system

    Engineered to deliver optimal results with your general purpose human ma-chine interface (HMI) solutions:• Touch• Voice• Graphics• Video

    • Image• Analytics• Vision• Sensors

  • • Ph. D in Computer Science and Engineering. • B. E. (Honors) in Electronics and Communication Engineering.

    Education

    FACILITATOR

    • Corporate Training (21 Years)• Lecturer, Dept. of Computer Science & Engineering, • Professor and Head of the Dept. of Computer Science & Engineering, (5 Years)

    Teaching and Corporate Training Experience

    • 21 years in Corporate training as an independent consultant• 9 years and 6 months in Research & Development• 5 years in Teaching as Professor and Head of the Department of Computer Science and Engineering.

    Total Professional Experience

    Timmins Training Consulting

  • Our clients say

    Timmins Training Consulting

    “In-depth Linux kernel internal is the best thing of the training”

    “Stories or real life examples, practical stuff we can use at work”

    “The trainer has a very deep knowledge on Embedded Linux. He could able to answer and explain very well for all question we asked”

    “Prof. Chockalingam great instructor and explained very very detail in the subject”

    “Relevance of the topics presented to what is actually required for my work. Exercises help visualize the top-ics taught. Clear explanation and presentation of the topics in a way that is easy to understand”

    “The Professor meticulously conveyed the points in the most well thought out terminology possible which makes absorbing and remembering the points easier.

    “Trainer is very experienced in the subject. Able to help us to understand some important concepts in Linux”

    “Relevance of the topics presented to what is actually required for my work. Exercises help visualize the topics taught. Clear explanation and presentation of the topics in a way that is easy to understand”

    “The instructor method to ensure all the participants understand and follow”

    “Group discussion and practical exercise are really good”

  • Contact Us

    Email : [email protected]: 0327850737Mobile : +60164443517Level 8, Vertical Corporate Tower B, Avenue 10, The Vertical, No, 8, Jalan Kerinchi, Bangsar South, 59200 Kuala Lumpur

    Email : [email protected]: +622152917494Mobile : +628159859825IDX Building, Tower 2, 17th Floor, jalan Jend. Sudirman Kav 52-53 Jakarta 12190, Indonesia.

    Website: consult-timmins.com

    PT Timmins Konsultan Utama

    Timmins Training Consulting Sdn. Bhd.

    TimminsTrainingConsulting