Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Awesome-Embedded-Learning-Studio/PenguinLab

Open more actions menu

Repository files navigation

PenguinLab

English Coverage 262/262 docs translated

Linux 内核学习站 — 从 QEMU 实践到内核原理、驱动开发与嵌入式全栈

Kernel Arch Docusaurus License

English · 在线阅读 · 开始学习


为什么要有 PenguinLab?

学 Linux 内核的资料不少,但大多要么偏理论(ULK、LKD 看完还是不会写驱动),要么偏实操(LDD3 的 API 已经过时)。PenguinLab 想做的是:

  • 知识图谱驱动,不是线性教程——你可以按推荐路径走,也可以根据兴趣自由选择下一步
  • 全栈覆盖——从内核模块基础到调度器、内存管理、设备驱动、嵌入式 BSP、调试调优、虚拟化,一个站点搞定
  • 纯 QEMU 实践——不需要开发板,ARM32/ARM64/RISC-V/x86_64 四种架构都能跑
  • 基于最新稳定内核 6.19.y——不教过时 API,不拿 2.6 时代的代码糊弄人

内容覆盖

PenguinLab 采用 6 层知识图谱 组织教程,89 个知识节点之间有明确的前置/后继关系:

Layer 0🎯 通识基础环境搭建 · Kconfig · 内核模块 · 数据结构 · 进程与地址空间10 节点
Layer 1🧠 内核子系统调度器 · 内存管理 · 文件系统 · 网络栈26 节点
Layer 2🔧 驱动开发字符设备 · 平台驱动 · 设备树 · 中断 · GPIO · 同步原语22 节点
Layer 3📦 嵌入式全栈交叉编译 · U-Boot · 内核裁剪 · Buildroot · BSP 项目8 节点
Layer 4🔍 调试与性能printk · ftrace · perf · eBPF · KASAN · KGDB · Lockdep17 节点
Layer 5☁️ 虚拟化与容器KVM · Namespaces · cgroups · 容器运行时7 节点

知识图谱预览

                         ┌─→ sched-overview ──→ sched-cfs ──→ sched-rt
                         │                         │
process-thread-kernel ───┤                         └─→ sched-context-switch
                         │
                         ├─→ mm-overview ──→ mm-buddy ──→ mm-slab ──→ mm-vmalloc
                         │
                         ├─→ fs-vfs ──→ fs-ext4 · fs-procfs · fs-page-cache
                         │
                         └─→ net-overview ──→ net-sk-buff ──→ net-ipv4 ──→ net-tcp

kernel-module-basics ──→ drv-model ──→ drv-chardev ──→ drv-ioctl · drv-poll · drv-mmap
                            │
                            ├─→ drv-dts ──→ drv-platform ──→ drv-irq ──→ drv-threaded-irq
                            │
                            └─→ drv-sync ──→ drv-atomic ──→ drv-rcu

基于真实的笔记和代码

PenguinLab 不是凭空写出来的,背后有 253 篇学习笔记12 个可构建的代码示例 作为内容基础:

笔记来源 篇数 覆盖范围
Linux Kernel Programming 13 章 内核基础、模块、进程、调度器、内存、同步
Linux Kernel Device Drivers 22 章 设备模型、字符设备、procfs/sysfs、中断、DMA
Linux Kernel Debugging 93 章 printk、ftrace、KASAN、Lockdep、KGDB、crash
Linux Kernel Networking 124 章 网络栈全貌、sk_buff、IPv4、TCP、Netfilter、XDP

每个代码示例放在 example/mini/ 下,自带 Makefile,支持多架构交叉编译:

example/mini/
├── kernel_module_hello/     # 最小内核模块
├── kernel_module_params/    # 模块参数
├── kernel_module_export/    # 符号导出
├── chardev_basic/           # 字符设备驱动
├── sysfs_attributes/        # sysfs 属性
├── debugfs_basics/          # debugfs 基础
├── linked_list_kernel/      # 侵入式链表(用户态实现)
├── kthread_demo/            # 内核线程
├── wait_queue_demo/         # 等待队列
├── mutex_spinlock/          # 互斥锁 vs 自旋锁
├── atomic_ops/              # 原子操作
└── workqueue_demo/          # 工作队列

快速开始

1. 克隆仓库

git clone --recursive https://github.com/Awesome-Embedded-Learning-Studio/PenguinLab.git
cd PenguinLab

# 如果已克隆但未初始化子模块
git submodule update --init third_party/linux third_party/busybox

2. 安装工具链

# ARM64 交叉编译
sudo apt install gcc-aarch64-linux-gnu

# ARM32(可选)
sudo apt install gcc-arm-linux-gnueabihf

# QEMU
sudo apt install qemu-system-arm

# 内核编译依赖
sudo apt install build-essential libncurses-dev bison flex libssl-dev

3. 构建内核 + 启动 QEMU

# 构建 ARM64 内核
./scripts/linux-action-scripts.sh config_and_build \
    ARCH=arm64 LINUX_DEFCONFIG=defconfig

# 构建最小 rootfs
./scripts/rootfs-minimal-maker.sh --static all

# 启动!
./scripts/qemu-run.sh run

内核启动后在 QEMU shell 里操作。退出:Ctrl+A X

目录结构

PenguinLab/
├── document/                  # 教程、笔记和参考文档
│   ├── tutorials/             #   教程(按知识图谱 6 层组织)
│   └── notes/                 #   学习笔记(253 篇)
├── example/                   # 可构建的示例代码
│   ├── mini/                  #   单概念小示例(12 个)
│   ├── project/               #   综合实战项目
│   └── common/                #   共享构建文件(多架构支持)
├── scripts/                   # 自动化脚本
│   ├── linux-action-scripts.sh      # 内核配置与交叉编译
│   ├── qemu-run.sh                  # QEMU ARM 仿真
│   └── rootfs-minimal-maker.sh      # BusyBox 最小根文件系统
├── third_party/               # 第三方子模块
│   ├── linux/                 #   Linux 内核 6.19.y
│   └── busybox/               #   BusyBox
└── site/                      # Docusaurus 网站源码

推荐学习路径

PenguinLab 的知识图谱支持多条路径,这里列出四条典型路线:

嵌入式驱动工程师(最热门):

通识基础 → 内核模块 → 驱动模型 → 设备树 → 平台驱动
→ 字符设备 → 中断 → GPIO → DMA → 综合驱动项目

内核爱好者

通识基础 → 进程/线程 → 调度器 CFS → 内存管理 Buddy/Slab
→ 文件系统 VFS → 网络栈 sk_buff → Netfilter → XDP

调试专家

通识基础 → printk → ftrace → perf → eBPF → KASAN → KGDB
→ 综合性能调优实战

BSP 工程师

通识基础 → 交叉编译 → QEMU → U-Boot → 内核裁剪
→ 根文件系统 → Buildroot → 完整 BSP 项目

参考书单

教程内容参考了 13 本内核领域经典书籍,完整书单见这里。核心参考包括:

  • Linux Kernel Development — Robert Love
  • Understanding the Linux Kernel — Bovet & Cesati
  • Linux Device Driver Development — John Madieu
  • BPF Performance Tools — Brendan Gregg
  • Mastering Embedded Linux Programming — Frank Vasquez

许可证

MIT License — 详见 LICENSE

About

🐧 A hands-on lab for mastering Embedded Linux and Desktop Linux internals, from kernel to user space.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.