Skip to content

mohitmishra786/low-level-dev-skills / skills/kernel-dev/linux-kernel-architecture

linux-kernel-architecture

Verified

Linux kernel architecture skill for subsystem overview. Use when navigating kernel source, understanding boot flow, initcalls, or major subsystems (VFS, scheduler, MM). Activates on queries about kernel architecture, boot process, initcall levels, subsystem layout, or where code lives in linux.git.

FileKindSize
SKILL.mdskill md3.0 KB
---
name: linux-kernel-architecture
description: Linux kernel architecture skill for subsystem overview. Use when navigating kernel source, understanding boot flow, initcalls, or major subsystems (VFS, scheduler, MM). Activates on queries about kernel architecture, boot process, initcall levels, subsystem layout, or where code lives in linux.git.
---

# Linux Kernel Architecture

## Purpose

Provide a mental map of the Linux kernel: boot sequence, major subsystems, key data structures, and where to look in source — complementing `skills/kernel/kernel-internals` with architecture-level navigation for driver and subsystem work.

## Triggers

- First time exploring `linux.git` for a feature or bug
- Understanding how boot reaches `init` and driver `probe`
- Tracing a syscall or interrupt through subsystems
- Onboarding before `skills/kernel-dev/platform-device-model` or driver skills

## Workflow

### 1. Boot flow (x86/ARM64 simplified)

```text
firmware/UEFI
├── arch/*/boot — decompress kernel, early setup
├── start_kernel() — mm, scheduler, timers, IRQ subsys
├── rest_init() → kernel_init → run_init_process
└── userspace init (systemd)
```

Driver `module_init` / `device_initcall` run during `start_kernel` before init.

### 2. Major subsystems

| Subsystem | Path (typical) | Key structs |
|-----------|----------------|-------------|
| Scheduler | `kernel/sched/` | `task_struct`, `sched_entity` |
| Memory | `mm/` | `struct page`, `mm_struct`, `vm_area_struct` |
| VFS | `fs/` | `inode`, `dentry`, `file`, `super_block` |
| Block | `block/` | `request_queue`, `gendisk` |
| Net | `net/` | `sk_buff`, `net_device` |
| Drivers | `drivers/` | `device`, `device_driver` |
| Syscalls | `kernel/`, `fs/`, `mm/` | `SYSCALL_DEFINE*` |

### 3. Initcall levels

```c
/* include/linux/init.h — order matters */
early_initcall → core_initcall → postcore_initcall
→ arch_initcall → subsys_initcall → fs_initcall
→ device_initcall → late_initcall
```

Platform drivers usually register at `subsys_initcall` or via `module_init`.

### 4. Finding code

```bash
# Locate symbol
grep -rn "platform_driver_register" drivers/

# Trace config
./scripts/config --state CONFIG_FOO

# File hierarchy docs
ls Documentation/admin-guide/
```

### 5. Agent usage

```text
/linux-kernel-architecture Where does page fault handling live and what calls it?
```

## Common Problems

| Symptom | Cause | Fix |
|---------|-------|-----|
| Driver probes too early | Initcall vs DT ordering | Defer with `deferred_probe` |
| Symbol missing | Built as module | `modprobe` or built-in `CONFIG_*` |
| Wrong subsystem | Similar names in `drivers/` | Follow `struct bus_type` |
| Boot hang | Early printk disabled | `earlyprintk`, `initcall_debug` |

## Related skills

- `skills/kernel/kernel-internals` — scheduler, SLUB, VFS depth
- `skills/kernel-dev/kernel-memory-management` — mm/ details
- `skills/kernel-dev/platform-device-model` — driver model
- `skills/kernel-dev/device-tree` — hardware description
- `skills/low-level-programming/linux-kernel-modules` — LKM basics
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall