this post was submitted on 05 Dec 2025
215 points (98.6% liked)

Programming

23856 readers
210 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS
 

I’ve been working on a "Linux Inside Out" series and wrote a post that might interest folks here who like low(ish)-level / OS internals.

The idea is to dissect the components of a Linux OS, layer by layer, and build a mental model of how everything fits together through experiments.

The first part is about the kernel, in the post I:

  • take the same kernel image my distro boots from /boot
  • boot it directly with QEMU (no distro, no init system)
  • watch it panic
  • write a tiny Go program and use it as PID 1
  • build a minimal initramfs around it so the kernel can actually start our process

The goal isn’t to build a real distro, just to give a concrete mental model of:

  • that the Linux kernel is just a compressed file, you can boot it
  • without anything else
  • what the kernel actually does at boot
  • how it hands control to userspace
  • what PID 1 / init is in practice
  • what is kernel space vs user space

Link: https://serversfor.dev/linux-inside-out/the-linux-kernel-is-just-a-program/

I’m the author, would be happy to hear from other devs whether this way of explaining things makes sense, and what you’d add or change for future posts in the series.

Hope you find it useful.

top 8 comments
sorted by: hot top controversial new old
[–] DickFiasco@sh.itjust.works 28 points 1 week ago* (last edited 1 week ago) (1 children)

Thank you, this is a great explanation. I look forward to the rest of this series.

Edit: I successfully booted a Debian kernel using this tutorial, though I wrote the init program in C++ instead of Go. The process is pretty much the same, but you have to add the -static flag to g++ since the C runtime is not included in the initramfs. This might be obvious to more seasoned programmers but it took me a minute to figure it out.

[–] zknd@lemmy.world 11 points 1 week ago

Thank you for the feedback.

[–] calliope@retrolemmy.com 8 points 1 week ago

This is very cool, thanks for sharing!

I did a similar exercise a decade ago with HTTP and it was fun and eye-opening.

[–] gsx@discuss.tchncs.de 8 points 1 week ago

Nice article. Waiting for the upcoming parts.

Blinry did something similar not to lomg ago, maybe it's interesting for you, too: https://blinry.org/tiny-linux/

[–] sfxrlz@lemmy.dbzer0.com 4 points 1 week ago

This looks really interesting. I’ll have a look when I get home.

[–] lascapi@jlai.lu 4 points 1 week ago

That looks simple when someone (you) say it simply.

Thank you for that. 😌

[–] LainTrain@lemmy.dbzer0.com 1 points 1 week ago

That's so cool! Thanks for sharing it!

[–] thatradomguy@lemmy.world -2 points 1 week ago

AI is just a program.