r/kerneldevelopment • u/compgeek38400 • Sep 21 '26
What I've learned this week (14)
r/kerneldevelopment • u/compgeek38400 • Sep 21 '26
r/kerneldevelopment • u/christiaansp • Sep 14 '26
Would it theoretically be possible to create an operating system that decompiles itself, recompiles itself, and installs itself to another disk while remaining bit-for-bit identical to the parent OS?
some rules:
No Source on Disk: The storage media contains only the compiled binary image. The codebase exists on disk exactly once, as raw executable code/data.
Upon booting into RAM, the OS must decompile its own executing machine code into an intermediate source representation in memory, recompile that source back into a new binary image, and write it to a target drive.
The child image written to the target disk must have the exact same cryptographic hash (SHA-256) as the parent OS image.
It cannot simply dd / copy the raw sectors from drive to drive. The binary must pass through the decompiler, compiler pipeline.
r/kerneldevelopment • u/compgeek38400 • Aug 16 '26
r/kerneldevelopment • u/Sorry_Difficulty_250 • Aug 03 '26
r/kerneldevelopment • u/Professional_Cow7308 • Mar 04 '26
Is there any way yall can help me figure out the build system, cuz, despite doing this for years I’m not really too good at multi arch work
r/kerneldevelopment • u/shsh-1312 • Dec 06 '25
A lightweight, purely custom 64-bit Operating System kernel and bootloader from scratch. It features a custom 2-stage bootloader that transitions from Real Mode to Long Mode, loads a Flat Binary kernel, and provides a dual-output (VGA+Serial) interactive shell with memory management and permission systems, you can download the image and try it or the complete source, it is assembled with two scripts, one to compile the kernel and the other for the img with a custom bootloader, it seems quite fast, and the buddy works well, it would be necessary to work on multitasking (partially implemented but little tested) fs (which has not yet been implemented) and on the conversion to make it an iso (the modified bootloader complicates everything), but the system works, and it has never happened to me that it crashed
r/kerneldevelopment • u/Kreiser_ • Oct 08 '25
x86_64 OS that have:
Custom filesystem.
Custom bootloader for this filesystem.
Pixel font renderer.
IDE and AHCI support.
Multitasking and processes.
I am planing to implement user mode, USB and NVMe support, SMP, and GUI in future.
r/kerneldevelopment • u/franticblood • Sep 27 '26
r/kerneldevelopment • u/AI_Kernel_Engg • Sep 20 '26
Hi everyone, I recently joined a semiconductor as AI Kernel Engg. My work involes writing TAPI code. Tensor API(TAPI) is provided by our company by Synopsys, and it's for NPU. I know this much only. And I don't have any prior experience of writing the kernel as well so can anyone suggest some good resources so that I can code and experiment with them.
r/kerneldevelopment • u/love_guru_911 • Aug 29 '26
r/kerneldevelopment • u/tseli0s • Mar 31 '26
r/kerneldevelopment • u/pvtoari • Feb 10 '26
cross repost, ignore last paragraph, i know the purpose of this subreddit is to avoid sloppy osdev
r/kerneldevelopment • u/TheRealAdam256 • Oct 10 '26
r/kerneldevelopment • u/Sorry_Difficulty_250 • Sep 18 '26
r/kerneldevelopment • u/Sorry_Difficulty_250 • Sep 10 '26
r/kerneldevelopment • u/compgeek38400 • Sep 01 '26
r/kerneldevelopment • u/Eloulatruite • Aug 24 '26
r/kerneldevelopment • u/K4milLeg1t • May 11 '26
r/kerneldevelopment • u/DeSyfer1709 • Jan 03 '26
Hi guys, I'm a newbie to OS Dev. After finishing with OS Dev Barebones, I was trying to write a kernel that boots up using multiboot 2 and prints hello world using VGA, but this time for my native architecture (x86_64). So far I managed to boot into my OS's kmain function, but when I try to read/write any variables I get garbage (or rather mostly 0xfff....). It's baffling me for a whole day and would be extremely grateful for some help.
(gdb) c
Continuing.
Breakpoint 1, kmain () at src/kmain.c:3
3void kmain() {
(gdb) i r
rax 0x36d76289 920085129
rbx 0x100000 1048576
...
rbp 0x0 0x0
rsp 0x205ffc 0x205ffc
...
rip 0x200065 0x200065 <kmain>
eflags 0x200046 [ ID IOPL=0 ZF PF ]
cs 0x10 16
...
cr0 0x11 [ ET PE ]
...
(gdb) n
Breakpoint 1, kmain () at src/kmain.c:3
3 void kmain() {
(gdb)
Breakpoint 1, kmain () at src/kmain.c:3
3 void kmain() {
(gdb)
Breakpoint 1, kmain () at src/kmain.c:3
3 void kmain() {
(gdb)
Breakpoint 1, kmain () at src/kmain.c:3
3 void kmain() {
(gdb)
Breakpoint 1, kmain () at src/kmain.c:3
3 void kmain() {
(gdb)
kmain () at src/kmain.c:4
4 const char *message = "hello world";
(gdb) p/x message
$1 = 0x0
(gdb) n
7 asm volatile ("HLT");
(gdb) p/x message
$2 = 0xf8f
(gdb) p/x *message
$3 = 0x0
(gdb) x/80hw message
0xf8f: 0x00000000 0x00000000 0x00000000 0x00000000
0xf9f: 0x00000000 0x00000000 0x00000000 0x00000000
0xfaf: 0x00000000 0x00000000 0x00000000 0x00000000
0xfbf: 0x00000000 0x00000000 0x00000000 0x00000000
0xfcf: 0x00000000 0x00000000 0x00000000 0x00000000
0xfdf: 0x00000000 0x00000000 0x00000000 0x00000000
0xfef: 0x00000000 0x00000000 0x00000000 0x00000000
0xfff: 0x05c68900 0x00000009 0x868de0ff 0x00000048
0x100f: 0x00408689 0x868d0000 0x000000b0 0x00328689
0x101f: 0x010f0000 0x00003096 0x40aeff00 0x66000000
0x102f: 0xb0002090 0x90000010 0xb48d2e90 0x00000026
0x103f: 0x00104800 0x00001000 0x0018b800 0xd88e0000
0x104f: 0xe08ec08e 0xd08ee88e 0x25c0200f 0x7fffffff
0x105f: 0x0fc0220f 0xe083e020 0xe0220fdf 0x00b800eb
0x106f: 0x890007ff 0x0000b8c4 0xc5890000 0x000000b8
0x107f: 0xb8c68900 0x00000000 0x89b8c789 0xbb36d762
0x108f: 0x00100000 0x000000b9 0x0000ba00 0xeafc0000
0x109f: 0x00200056 0x66900010 0xb48d2e90 0x00000026
0x10af: 0x00000000 0x00000000 0x00000000 0x00000000
0x10bf: 0x00ffff00 0xcf9a0000 0x00ffff00 0xcf930000
(gdb) i r
rax 0xf8f 3983
rbx 0x100000 1048576
...
rbp 0x205ff8 0x205ff8
rsp 0x205ff8 0x205ff8
...
rip 0x200074 0x200074 <kmain+15>
eflags 0x200012 [ ID IOPL=0 AF ]
cs 0x10 16
...
cr0 0x11 [ ET PE ]
...
(gdb)
(gdb) list
2
3 void kmain() {
4 const char *message = "hello world";
5
6 while (1) {
7 asm volatile ("HLT");
8 }
9 }My C is already in the GDB output, and my linker script is:
SECTIONS {
. = 2M;
.text ALIGN(4K): {
_smultiboot = .;
KEEP(*(.multiboot))
_emultiboot = .;
_stext = .;
*(.text)
_etext = .;
}
.rodata ALIGN(4K): {
_srodata = .;
*(.rodata)
_erodata = .;
}
.data ALIGN(4K): {
_sdata = .;
*(.data)
_edata = .;
}
.bss ALIGN(4K): {
_sbss = .;
*(COMMON)
*(.bss)
_ebss = .;
}
/DISCARD/ : {
*(*.note.*)
*(.eh_frame)
}
}Also the last few lines in my kernel binary (line numbers are in decimal):
0004084 00 00 00 00 >....<0004088 00 00 00 00 >....<0004092 00 00 00 00 >....<0004096 68 65 6c 6c >hell<0004100 6f 20 77 6f >o wo<0004104 72 6c 64 00 >rld.<0004108
PS: I read somewhere that Multiboot 2 boots into 32-bit protected mode, and memory map might cause a problem, though I have no idea how to fix it or even if that's the case here.
Edit: Source