Course Code: ldd
Duration: 35 hours
Prerequisites:
- Hiểu biết cơ bản về cách sử dụng hệ thống GNU/Linux với tư cách là người dùng cuối
- Hiểu biết cơ bản về dòng lệnh shell
- Kiến thức cơ bản về phát triển ứng dụng không gian người (user space)
- Kiến thức lập trình C ở mức độ trung cấp
- Đã tham gia khóa học Kiến trúc Hệ thống GNU/Linux Nhúng trước đây (khuyên dùng!) và/hoặc có sự hiểu biết tốt về các chủ đề được đề cập trong khóa đó
Overview:
Mô tả
Khóa học đào tạo 5 ngày này sử dụng các bài tập thực hành kết hợp với hướng dẫn để minh họa các khái niệm về kiến trúc nhân GNU/Linux và phát triển trình điều khiển thiết bị. Khóa học được thiết kế giúp bạn nhanh chóng nắm bắt kiến thức cốt lõi. Chúng tôi mô tả các quy trình, khái niệm và lệnh cần thiết để viết trình điều khiển GNU/Linux thông qua sự kết hợp giữa lý thuyết và đào tạo thực tiễn.
Đừng làm lặp lại những gì đã có, mà hãy học hỏi từ một giảng viên giàu kinh nghiệm và mang về nhà kiến thức thực tiễn cùng khả năng ứng dụng hiệu quả trong dự án phát triển nhúng của riêng bạn.
Đối tượng tham gia
Những người có quan tâm hoặc được giao trách nhiệm phát triển hoặc đánh giá việc phát triển trình điều khiển GNU/Linux, chẳng hạn như kỹ sư phần mềm, kỹ sư hiện trường, nhà quản lý (dự án), kỹ sư phần cứng.
Course Outline:
Giới thiệu
- Lịch sử nhanh của GNU/Linux
- Giấy phép
- Phân loại phiên bản nhân
- Chu kỳ phát hành
- Cây mã nguồn nhân (kernel trees)
- Mã nguồn chính (mainline)
- Nhân (kernel) so với Không gian người (user space)
- Cơ chế so với Chính sách
- Các lựa chọn thay thế cho trình điều khiển nhân
- Hệ điều thời gian thực (RTOS) so với Linux
Quản lý bộ nhớ
- Bộ nhớ ảo so với bộ nhớ vật lý
- Cấp phát bộ nhớ trong nhân
- Các trang (pages)
- Các vùng (zones)
- Giao diện lập trình ứng dụng (API)
- Slab
Bản vá nhân
- Chu kỳ đời sống
- Git
- Mã nguồn nhân
- Tạo bản vá (patch)
- Kiểm tra bản vá (check patch)
- Sửa bản vá (fix patch)
- Phán duyệt bản vá (ship patch)
- Mã đã được kiểm duyệt
Mô-đun nhân
- Lấy mã nguồn nhân
- Cấu hình/xây dựng/cài đặt
- Trình điều khiển thiết bị (liên kết tĩnh, tải khi chạy)
- Khởi tạo/Kết thúc
- Giấy phép
- EXPORT SYMBOL GPL
- Makefile ngoài cây mã nguồn (out of tree)
- Module-init-tools
- Mô-đun trong cây mã nguồn nhân
- Kconfig
- Truyền tham số
- Sparse
Trình điều khiển Ký tự (Char Drivers)
- Kiến trúc
- Giao diện người/nhân
- Hệ thống con I/O
- VFS (Hệ thống file ảo)
- Sysfs (thiết bị, bus, trình điều khiển, lớp),
- kobject/ktype/kset
- Mô hình trình điều khiển kernel Linux
- Tệp thiết bị
-
Trình điều khiển ký tự
- Khởi tạo
- Đăng ký
- Mở, đóng
- cdev, cdev_add, cdev_del,...
- Số chính/phụ
- udev, udevmonitor, udevadm
Các thao tác nâng cao trên Trình điều khiển Ký tự
- ioctl
- unlocked ioctl
- compat ioctl
- API không gian người
- API không gian nhân
- Chu kỳ đời sống tiến trình
- Ngủ/khối chặn
- Ngủ/thức dậy
- Hàng chờ (wait queue)
- Bầy chim gào thét (thundering herd)
- poll/select
Gỡ lỗi nhân
- Gỡ lỗi
-
Gỡ lỗi nhân
- Tìm kiếm nhị phân với git
- Hỗ trợ gỡ lỗi từ nhân
- printk syslogd, klogd, mức log, giới hạn tốc độ, mức gỡ lỗi, gỡ lỗi chọn lọc các hệ thống con
- Gỡ lỗi bằng cách truy vấn debugfs
- Gỡ lỗi lỗi hệ thống (oops), gây ra lỗi hệ thống (asserting oops)
- Phím Magic SysRq
- kgdb/kdb
- JTAG
Theo dõi (Tracing)
- gcov
- lcov
- oprofile
-
ftrace
- trình theo dõi nop
- trình theo dõi hàm (function tracer)
- trình theo dõi chuyển đổi lập lịch (sched switch tracer)
- trình theo dõi đồ thị hàm (function graph tracer)
- trình theo dõi động (dynamic tracer)
- trace-cmd/kernelshark
- perf
- LTTng
Ngắt (Interrupts)
- Ngắt so với vòng lặp kiểm tra (polling)
- Ngắt
- Các đoạn mã chương trình
- Tính tái nhập lại (reentrancy)
- Sự kiện
- Trình xử lý ngắt
- Trình xử lý ngắt chia sẻ
- Luồng ngắt
- Kiểm soát ngắt
Trì hoãn công việc
- nửa trên/nửa dưới (top/bottom halves)
- softirqs
- tasklets
- hàng đợi công việc (work queues)
- ngắt có luồng (threaded interrupts)
Tính đồng thời (Concurrency)
- Vùng/đoạn tới hạn (critical region/section)
- Nguyên tử (atomic)
- Điều kiện đua (race condition)
- Đồng bộ hóa
- Khóa (locking)
- Giải pháp khóa
- Deadlock
- Tranh chấp (contention)
- Cần khóa những gì?
-
Có thể sử dụng những gì?
- Thao tác nguyên tử
- Spinlock
- Spinlock đọc-viết
- Semaphor
- Semaphor nhị phân
- Mutex
- Semaphor đọc-viết
- Biến hoàn thành (completion variables)
- Lock tuần tự
- Tắt tiền chế độ (disable preemption)
- Thứ tự và rào chắn (barriers)
Thời gian
- HZ
- Jiffies
- Độ trễ lớn/nhỏ
- Bộ hẹn giờ nhân
I/O Phần cứng
- Cổng I/O
- Bộ nhớ I/O
- Cách xử lý các tác dụng phụ khi truy cập thanh ghi?
Giao tiếp Người-Nhân
- put(get)_user()
- copy to(from)_user()
- I/O của nhân
- Ánh xạ bộ nhớ
- procfs
- sysfs
- debugfs
- relayfs
- netlink
- ioctl
Khả năng di chuyển (Portability)
- Kích thước từ (word size)
- Kiểu ẩn (opaque types)
- char có dấu/không dấu
- Căn chỉnh dữ liệu
- Nâng cấp nguyên (integral promotion)
- Tái sử dụng mã
- Thứ tự byte (endianess)
- Nhịp hệ thống (system tick)
- Kích thước trang
- Sắp xếp hướng dẫn (instruction ordering)
- SMP/tiền chế độ/bộ nhớ cao
Trừ khi được ghi chú khác, nội dung và phác thảo khóa học này được cấp phép theo Giấy phép Creative Commons Ghi công-Không thương mại-Chia sẻ tương tự 4.0 Quốc tế (CC BY-NC-SA 4.0).
United Arab Emirates - Embedded GNU/Linux Kernel Internals and Device Drivers
Qatar - Embedded GNU/Linux Kernel Internals and Device Drivers
Egypt - Embedded GNU/Linux Kernel Internals and Device Drivers
Saudi Arabia - Embedded GNU/Linux Kernel Internals and Device Drivers
South Africa - Embedded GNU/Linux Kernel Internals and Device Drivers
Brasil - Integridade do Kernel GNU/Linux Embarcado e Drivers de Dispositivo
Canada - Embedded GNU/Linux Kernel Internals and Device Drivers
香港 - Embedded GNU/Linux Kernel Internals and Device Drivers
澳門 - Embedded GNU/Linux Kernel Internals and Device Drivers
台灣 - Embedded GNU/Linux Kernel Internals and Device Drivers
USA - Embedded GNU/Linux Kernel Internals and Device Drivers
Österreich - Interne Struktur des GNU/Linux-Kernels und Gerätetreiber
Schweiz - Interne Struktur des GNU/Linux-Kernels und Gerätetreiber
Deutschland - Interne Struktur des GNU/Linux-Kernels und Gerätetreiber
Czech Republic - Interní struktura jádra GNU/Linuxu a ovladače zařízení
Denmark - Embedded GNU/Linux Kernel Internals and Device Drivers
Estonia - Embedded GNU/Linux Kernel Internals and Device Drivers
Finland - Embedded GNU/Linux Kernel Internals and Device Drivers
Greece - Εσώτερο Λειτουργικό των Πυρήνων GNU/Linux και Οδηγοί Συσκευών
Magyarország - Beágyazott GNU/Linux Kernel Belső Működése és Eszközmeghajtók
Ireland - Embedded GNU/Linux Kernel Internals and Device Drivers
Luxembourg - Embedded GNU/Linux Kernel Internals and Device Drivers
Latvia - Embedded GNU/Linux Kernel Internals and Device Drivers
España - Integridades internas del kernel y controladores de dispositivos GNU/Linux integrados
Italia - Interni del kernel GNU/Linux e driver di dispositivo
Lithuania - Embedded GNU/Linux Kernel Internals and Device Drivers
Nederland - Inwendige werking van de GNU/Linux-kernel en apparaatstuurprogramma's
Norway - Inne i Linux-kjernen for innbygde systemer og enhetsdrivere
Portugal - Integridade do Kernel GNU/Linux Embarcado e Drivers de Dispositivo
România - Internele Nucleului GNU/Linux și Driverele de Dispozitive
Sverige - Inbyggd GNU/Linux-kärninterna funktioner och enhetsdrivrutiner
Türkiye - Gömülü GNU/Linux Çekirdek İç Yapıları ve Cihaz Sürücüleri
Malta - Embedded GNU/Linux Kernel Internals and Device Drivers
Belgique - Internalités du noyau GNU/Linux et pilotes de périphériques intégrés
France - Internalités du noyau GNU/Linux et pilotes de périphériques intégrés
日本 - 埋め込み GNU/Linux カーネルの内部構造とデバイスドライバ
Australia - Embedded GNU/Linux Kernel Internals and Device Drivers
Malaysia - Embedded GNU/Linux Kernel Internals and Device Drivers
New Zealand - Embedded GNU/Linux Kernel Internals and Device Drivers
Philippines - Embedded GNU/Linux Kernel Internals and Device Drivers
Singapore - Embedded GNU/Linux Kernel Internals and Device Drivers
Thailand - Embedded GNU/Linux Kernel Internals and Device Drivers
Vietnam - Kiến trúc Nhân GNU/Linux Nhúng và Trình điều khiển Thiết bị
India - Embedded GNU/Linux Kernel Internals and Device Drivers
Argentina - Integridades internas del kernel y controladores de dispositivos GNU/Linux integrados
Chile - Integridades internas del kernel y controladores de dispositivos GNU/Linux integrados
Costa Rica - Integridades internas del kernel y controladores de dispositivos GNU/Linux integrados
Ecuador - Integridades internas del kernel y controladores de dispositivos GNU/Linux integrados
Guatemala - Integridades internas del kernel y controladores de dispositivos GNU/Linux integrados
Colombia - Integridades internas del kernel y controladores de dispositivos GNU/Linux integrados
México - Integridades internas del kernel y controladores de dispositivos GNU/Linux integrados
Panama - Integridades internas del kernel y controladores de dispositivos GNU/Linux integrados
Peru - Integridades internas del kernel y controladores de dispositivos GNU/Linux integrados
Uruguay - Integridades internas del kernel y controladores de dispositivos GNU/Linux integrados
Venezuela - Integridades internas del kernel y controladores de dispositivos GNU/Linux integrados
Polska - Wewnętrzne mechanizmy jądra GNU/Linux i sterowniki urządzeń
United Kingdom - Embedded GNU/Linux Kernel Internals and Device Drivers
South Korea - 임베디드 GNU/리눅스 커널 내부 구조 및 장치 드라이버
Pakistan - Embedded GNU/Linux Kernel Internals and Device Drivers
Sri Lanka - Embedded GNU/Linux Kernel Internals and Device Drivers
Bulgaria - Вградени вътрешни принципи на ядрото GNU/Linux и драйвери на устройства
Bolivia - Integridades internas del kernel y controladores de dispositivos GNU/Linux integrados
Indonesia - Embedded GNU/Linux Kernel Internals and Device Drivers
Kazakhstan - Embedded GNU/Linux Kernel Internals and Device Drivers
Moldova - Internele Nucleului GNU/Linux și Driverele de Dispozitive
Morocco - Embedded GNU/Linux Kernel Internals and Device Drivers
Tunisia - Embedded GNU/Linux Kernel Internals and Device Drivers
Kuwait - Embedded GNU/Linux Kernel Internals and Device Drivers
Oman - Embedded GNU/Linux Kernel Internals and Device Drivers
Slovakia - Embedded GNU/Linux Kernel Internals and Device Drivers
Kenya - Embedded GNU/Linux Kernel Internals and Device Drivers
Nigeria - Embedded GNU/Linux Kernel Internals and Device Drivers
Botswana - Embedded GNU/Linux Kernel Internals and Device Drivers
Slovenia - Embedded GNU/Linux Kernel Internals and Device Drivers
Croatia - Embedded GNU/Linux Kernel Internals and Device Drivers
Serbia - Embedded GNU/Linux Kernel Internals and Device Drivers
Bhutan - Embedded GNU/Linux Kernel Internals and Device Drivers
Nepal - Embedded GNU/Linux Kernel Internals and Device Drivers
Uzbekistan - Embedded GNU/Linux Kernel Internals and Device Drivers
US Government - Embedded GNU/Linux Kernel Internals and Device Drivers