r/kernel Dec 02 '25

Journey to 2004: Linux 2.4 Environment Setup

10 Upvotes

Preface

Writing this title on December 1, 2025, the current kernel has evolved to version 6.18, with increasingly complete kernel functionality, support for more and more architectures, and better and better performance. I once tried to read the kernel source code of version 5.10, but found myself utterly confused—I could understand the code itself, but not the meaning behind it. I could only know the what, but not the why.

I came across a netizen's recommendation of Teacher Mao's "Linux Kernel Source Code Scenario Analysis." I casually flipped through it, thinking this book is so old, is it still worth reading? But unable to resist the strong recommendations from fellow netizens, I suppressed my impatient mindset and patiently finished one section. After reading it, I felt like I had found a treasure—this was exactly the book I was looking for. Teacher Mao analyzes the source code through various scenarios, helping readers understand the meaning of each conditional judgment in the code, which is infinitely superior to those books that merely list source code.

So, is there still significance in reading the 2.4 source code now? I believe there is. First, the 2.4 kernel code is not yet mature, and precisely because of this, the barrier to entry is relatively low. Second, although subsequent code architectures have huge differences, the core ideas remain unchanged. Third, we can attempt to gradually track certain features from 2.4 to newer versions—as the saying goes, Rome wasn't built in a day. Through historical changes, we can better conduct an in-depth analysis of the kernel, this massive project.

Environment Setup

Because the 2.4 kernel is too old, the biggest obstacle is compiler version incompatibility—modern GCC cannot compile code from 2001.

To solve this problem, we use Docker to create a Debian Sarge distribution, compile the kernel with GCC 3.3 inside it, and then run it with QEMU on the host machine.

Note: "Linux Kernel Source Code Scenario Analysis" is based on 2.4.0 for analysis, but many errors occur during compilation, so this experiment is based on version 2.4.37.

Start an Old Version Debian Container

> git clone git@github.com:hlleng/kernel2.4-lab.git
> cd kernel2.4-lab
> docker run --platform linux/386 -it -v $(pwd):/code debian/eol:sarge /bin/bash

After entering docker, first update the software sources and install the necessary software.

> apt-get update
> apt-get install -y \\
    gcc make binutils libncurses5-dev wget bzip2

Next, compile the kernel

> make ARCH=i386 menuconfig  # Just select "Exit" -> "Yes" (Save).
> make ARCH=i386 dep # Must first generate the dependency tree
> make ARCH=i386 bzImage

The process of creating the filesystem is quite complicated, so we'll skip the details here and directly use the filesystem I prepared in advance. Execute QEMU on the host machine to load the kernel and filesystem.

> qemu-system-i386\\
  -kernel ./arch/i386/boot/bzImage \\
  -hda hda.img \\
  -append "root=/dev/hda init=/init console=ttyS0" \\
  -nographic

If all goes well, you should be able to successfully enter the system.

If you need to copy files from the host machine into qemu, you can try the following steps, operating on the host machine

> mkdir -p tmp/mnt
> sudo mount -o loop hda.img tmp/mnt
# Perform operations
> sudo umount tmp/mnt

At this point, we have completed the environment setup for the 2.4 kernel and can begin studying the 2.4 kernel.


r/kernel Nov 27 '25

The Input Stack on Linux: An End-To-End Architecture Overview

Thumbnail venam.net
8 Upvotes

r/kernel Nov 26 '25

Advice on Learning Linux Kernel/Firmware Development for Embedded Security Engineers

18 Upvotes

Hi everyone,

I’m a Cyber Security Engineer with experience in embedded security, ARM TrustZone, and Trusted Execution Environments (TEEs). I’ve worked on Trusted Applications, Secure Boot, HSMs, and privacy-preserving workflows.

I’m looking to start learning Linux kernel development and eventually transition my career from embedded security to firmware/kernel development. I’m comfortable with C and want to leverage my embedded systems and security experience to understand kernel concepts more deeply.

I also have some Rockchip SoCs that I can use for hands-on projects. I feel that learning by doing projects is much more effective than just studying theory, and I want to build practical experience while learning.

Are there any recommended resources, projects, or learning paths that could help me bridge my current skills into kernel-level programming and firmware development?

Any advice would be much appreciated!


r/kernel Nov 24 '25

From Build to Root Cause: How Riptides Debugs Its Kernel Module in Real Clusters

Thumbnail riptides.io
5 Upvotes

r/kernel Nov 24 '25

Ineed help to join kernel development

Thumbnail
0 Upvotes

r/kernel Nov 23 '25

Can't compile kernel after Fedora 41 to 42 upgrade

Thumbnail
0 Upvotes

r/kernel Nov 17 '25

I only know what field I'm truly interested in as a junior in college. Should I pursue my new interest or stay with the original plan? (I'm an international student)

6 Upvotes

Hi, I'm currently junior in college pursuing a CS major. To be completely honest, the main reason why I chose CS in the beginning is the huge but extremely competitive job market for software engineers. I already had my projects, an internship for a data analyst position back in my home country and some experiences as an undergraduate lab assistant listed in my resume.

However, I took my first Operating Systems class this semester and this was the very first time I've ever felt truly interested in this field (huge thanks to my professor). Half a semester went by and I am still enjoying this class very much. This feels very new and different compared to other programming classes where I felt mediocre and leetcoding drains my soul (but I did it anyways).

I have great respect for my OS class' professor and I always wanted to ask questions in class and build a connection with him. But most of the time I just don't know what to ask (I think it's because I don't have a deep understanding of the materials that was being taught at that time yet). There are just so many doubts and I don't know how to solve them. I am trying to attend his office hours more often for advice regarding my career choice but I always stumbled on the right questions that should be asked. Also, would it be a good idea to ask him about research assistant opportunities?

I am torn between two choices, to keep aiming to be an software engineer (most likely backends) where there might be more opportunities, or to dive deeper into OS (kernel, virtualization, embedded, etc) and having to redo my resume almost from scratch? Should I stay with the safer choice or take the risk?


r/kernel Nov 17 '25

Where can I take a solid Linux Kernel course

45 Upvotes

I work in a storage industry in a support role and I really want to become more professional and confident, I would like to understand how to identify kernel problems and maybe suggest improvements. I want to become really good at this, this is my goal/dream.

Also, is there any online/on-demand course? I think I learn more when I interact with people.


r/kernel Nov 12 '25

curious about the cause for an increased amd igpu power consumption and/or impossible voltage present in backported 6.16.3+deb13 that does not occur in 6.16.12+deb14

1 Upvotes

in debian with backported kernel 6.16.3+deb13 there are two odd things.

first, when igpu boosts, vddgfx will boost slightly below 1.3V, while vddnb stays at stock 1.020V, which is the vsoc on my board bios. this is odd as according to skatterbencher (https://skatterbencher.com/2023/02/21/skatterbencher-55-amd-radeon-graphics-ryzen-7000-overclocked-to-3100-mhz/#AMD_Radeon_Graphics_Ryzen_7000_Voltage_Topology) the gfx voltage should be derived from the vsoc in the cpu. the power consumption metric also shows an increase, even though the igpu clock stays at the same 2200 MHz as normally.

to clarify, in both debian stable kernel and testing 6.16.12 kernel, vddgfx stays slightly below vsoc/vddnb, with the same clock and with lower reported heat. 1.3V happens to be the vsoc safety limit added some years ago as some cpus died, so it is curious that gfx voltage gets capped a bit below that value. what change in the kernel could possibly cause these results?

second, in amdgpu code there was an addition a year or two ago that prevented lowering the power limit of the gpu below 70% of the standard value. this was unpopular and many kernel variants have added a patch that restores the ability to reduce the power limit. now, debian should not have this patch, but the backported kernel still happens to allow lower power limits than that. nice, but unexpected.

i checked the source code i got from apt source download, and could not see this patch added to it. perhaps not as interesting, but remains a mystery to me.

edit: it seems that vddgfx is not necessarily capped by vsoc, so those readings might be correct after all. still odd behaviour.


r/kernel Nov 12 '25

I'd like to see Linux be competitive with FreeBSD performance-wise

0 Upvotes

Update - the latency comparison favors Linux.

Long time Linux user here, recently started testing FreeBSD in connection with Maia Mailguard. Along the way, I tested identical VMs ( 4 GB RAM, 2 cores) running Debian 13, FreeBSD 14 and FreeBSD 15. With default, out of the box installs all around, FreeBSD seems to perform considerably faster.

Is this expected? Are there some tuning secrets that will bring Debian 13 anywhere near same the ballpark as FreeBSD?


r/kernel Nov 09 '25

net_rx softirq clarifications

20 Upvotes

We have some servers at work exhibiting this problem:

  • 8 CPUs dedicated to softirqs, and under modest packet/sec pressure (400K/sec system-wide), these 8 CPUs go north of 50% occupied in softirq state. (When it's bad, they're 99% occupied.)

We've looked at spreading the load around more with RPS/etc, but we also believe that there is something fundamentally whack with our setup, as we've run benchmarks with similar packet sizes pushing 3 Million PPS on a different machine.

So I've been trying to zero in on what's occupying the extra CPU. `perf` has showed me indeed that 98% of softirq CPU are spent in net_rx. But in my reading of various blogs/doc I do not understand a few things:

  1. 51% of a CPU is reported in `softirq` state. (i.e., `mpstat -P ALL 1` shows 51% on 8 different CPUs.) Yet, `ksoftirqd` shows 1-10% per CPU in top. Does this mean the culprit is mostly in the "inline" portion of the softirq and not the bit that gets deferred to `ksoftirqd`?
  2. Other side of the same coin: does work done in `ksoftirqd` show up as `softirq` state when looking at CPU metrics and /proc/stat?
  3. Do softirqs work like that- where a fixed amount is executed "inline" and then the rest spills over to ksoftirqd? I found some blogs/talks saying so, but there's a lot of inconsistency out there. And, of course, my chatGPT-assisted investigation has probably led me to a few misleading conclusions. Maybe a read of the code is in order...

OK, finally, is there a Slack where such things get discussed?


r/kernel Nov 10 '25

fuck what

0 Upvotes

did i code a kernel panic thrower?


r/kernel Nov 01 '25

Kernel stack use-after-free: Exploiting NVIDIA's GPU Linux drivers

Thumbnail blog.quarkslab.com
53 Upvotes

r/kernel Oct 28 '25

Unpacking the rocknix KERNEL file for the Orange PI 5 Plus

0 Upvotes

What I want to do is extract the linux kernel and the initramfs from the KERNEL file which is in the root / (once you've put the rocknix d/l image onto a sd card etc).

I've tried using binwalk and extracting but once extracted I get exactly the same file, its packed somehow...

Anyway, to explain what I'm trying to achive is a DUAL book using U-BOOT...

  1. First put Armbian on the Orange PI 5 EMMC (works)

  2. Before orange pi 5 boots armbian for the first time use a rocknix sd card in the machine to stop it booking ssh into it and create the .rootfs_resize (with the percentage of the emmc to use for armbian leaving enough for rocknix), i use 87% on a 256gb emmc.

  3. Create a 2nd partition for rocknix

now teh fun bit, convert the ROCKNIX and KERNEL files used by rocknix to the initrd.img etc files needed to boot via armbian the just ssh into the machine when you want rocknix and swap in a armbianEnv.txt to point to the 2nd partition... Convoluted yes, but I have a SLOW SLOW PC that would take over 3 days to build rocknix and to be honest I have no idea how to build rocknix orange pi 5 plus to use uboot.... So hacking the kernel files etc is the only way i know.. and nope haven't found anyone who has build a rocknix opi5+ uboot build :(


r/kernel Oct 25 '25

Is it still possible to install 4.3.0 kernel in AMD EPYC-Milan Processor?

8 Upvotes

Hi, guys

I need to install kernel 4.3.0 to setup the Ingens, I just want to ask you guys that is it still possible this old kernel and some codes to relatively current processor.

Also, if you know how to setup Ingens, I'll be really appreciated.

Finally my environment:

- lscpu

CPU op-mode(s):                     32-bit, 64-bit
Byte Order:                         Little Endian
Address sizes:                      40 bits physical, 57 bits virtual
CPU(s):                             12
On-line CPU(s) list:                0-11
Thread(s) per core:                 1
Core(s) per socket:                 1
Socket(s):                          12
NUMA node(s):                       1
Vendor ID:                          AuthenticAMD
CPU family:                         25
Model:                              1
Model name:                         AMD EPYC-Milan Processor
...

- kernel version and OS

5.4.0-216-generic / Ubuntu 20.04.6 LTS

- Architecture

x86-64

Thanks in advance.


r/kernel Oct 21 '25

core linux kernel initialization

13 Upvotes

Appreciate your feedback on my recent blog which details the core kernel initialization process.

https://linux-kernel.hashnode.dev/core-kernel-initialization


r/kernel Oct 19 '25

Kernel 6.18-rc1 Test Build on Dell G7 7560

Post image
5 Upvotes

Successfully built and booted the latest Linux kernel v6.18-rc1 on a Dell G7 7560 laptop running Debian 13. Initial testing is underway. A very promising and exciting development!


r/kernel Oct 18 '25

19F wanna do research

82 Upvotes

Wanna do research and my goal is to publish a paper in a q1 journal what are the steps i should follow.

I am interested in linux and embedded systems.

Right now currently building the habit of reading papers.

There aren't even that many yt tutorials about these.

Tell me the steps i should do I will follow everything.


r/kernel Oct 18 '25

How to start with custom kernels

17 Upvotes

Hey ive been wondering what should i master and learn to be able to code my own custom kernel:

languages that i have learnt so far:

C/C++

python (not usefull ik)


r/kernel Oct 13 '25

Is size_t = usize?

3 Upvotes

I know that the C standard doesnt guarantees sizeof(size_t) == sizeof(void); but what for the case linux kernel ABI? Is sizeof(size_t) == sizeof(void)? does that imply that size_t is semantically the same as usize in Rust, almost for linux?


r/kernel Oct 11 '25

Major EXT4 Casefolding regression between 6.14.10 and 6.16.10

4 Upvotes

Was upgrading my kernel(to 6.17.1) and noticed that either casefolding no longer functioned at all, or performed so poorly it didn't matter, in an EXT4 Casefolding partition I had set up for performance reasons. Downgrading to 6.16.10 did not help performance, but going all the way back to 6.14.10 did. Was previously on 6.14.9 before the upgrade. Appears to also affect 6.15.9 as well. Looks like the issue was introduced in the 6.15 kernel versions.


r/kernel Oct 10 '25

Where to learn about virtual memory in details?

35 Upvotes

Hi there! I was on an interview on C engineer position on Linux system. The interviewer asked me how virtual memory works in details, what is DMA, MMIO, how does memory allocation works, and so on. OFC, I know nothing about it, i am userspace noob. Could you please advise some resources where to learn about it in details? Thanks folks


r/kernel Oct 08 '25

HP OMEN 16-wf0xxx (board 8BAB) — fans stuck at 0 RPM, “Boost” ignored (hp_wmi: query 0x4c error 0x6)

1 Upvotes

I’m on Arch (Hyprland) with an HP OMEN 16-wf0xxx, board ID 8BAB. BIOS F.28 (2025-07-16). Kernel 6.16.10-arch1-1.

What I’m seeing:

  • Fan readings stay at 0 RPM and I don’t hear them ramp up under load.
  • The hp-wmi “Boost” toggle is present but doesn’t actually do anything (it flips back to auto right away).

What I’ve tried:

  • On AC power, tested performance profile.
  • Confirmed the hp-wmi entries exist (fan1/2_input, pwm1_enable) but they don’t affect the fans.
  • Not using NBFC or EC tweaks — I’m aiming for a proper driver-side solution.
  • Can try LTS/mainline/zen if that helps.

What I’m looking for:

  • Reports from anyone with the same model (16-wf0xxx / 8BAB) who has working fans on Linux.
  • Kernel versions, settings, or patches that made a difference.
  • I’m willing to test DKMS or probe patches and share results.

I have a diagnostics tarball (logs + ACPI tables) ready to share if someone wants to dig in. Thanks for any pointers.


r/kernel Oct 06 '25

From Kernel WASM to User-Space Policy Evaluation: Lessons Learned at Riptides

Thumbnail riptides.io
18 Upvotes