This file is a curated set of questions that a developer can use to guide an LLM (ChatGPT, Claude, Gemini, etc.)through the process of building a similar RISC‑V operating system. Each question corresponds to a conceptual milestone in this OS (bootloading, trap handling, scheduling, filesystem design, and user‑program execution, etc.)
- “How might I build a simple RISC-V operating system from scratch?”
- “What are the minimum components the OS might need?”
- “How do I install the RISC-V GCC toolchain?”
- “How do I run a bare-metal RISC-V binary in QEMU?”
- “How do I write a minimal RISC-V bootloader in assembly?”
- “How do I set up the stack pointer in RISC-V assembly?”
- “How do I pass control from a bootloader to a C function?”
- “How do I configure the RISC-V trap vector during boot?”
- “How do I print characters to a UART device in bare-metal RISC-V?”
- “What memory-mapped IO address does QEMU use for UART?”
- “How do I write the entry point of a RISC-V kernel in C?”
- “How should I structure initialization code in a small OS?”
- “How do I initialize a bump allocator for dynamic memory?”
- “What is a trap handler, and how do I install one in RISC-V?”
- “What’s the simplest way to implement a scheduler?”
- “How do I mount a simple in-memory filesystem?”
- “How do I write a trap handler in RISC-V assembly?”
- “How do I save and restore registers correctly in the trap handler?”
- “What does mcause mean in RISC-V?”
- “How might I detect an ecall from user mode?”
- “How would I implement a syscall interface on RISC-V?”
- “How might I add a syscall for exiting user programs?”
- “How do I write a simple assembly program that runs in user mode?”
- “How do I embed user programs into an OS image?”
- “How do I compile assembly programs into flat binaries?”
- “How do user programs call syscalls using
ecall?” - “How does the kernel load and execute a user program?”
- “How do I implement a simple memory-based FAT-like filesystem?”
- “What’s the minimum structure for a directory and file?”
- “How do I recursively create directories?”
- “How do I implement
ls,cd,cat,rm, and other related commands?” - “How do I store file contents in an in-memory OS?”
- “How do I run user programs via a shell command like
run <file>?”
- “What is cooperative multitasking, and how does it differ from preemptive?”
- “How do I design a process table in C?”
- “What does
RUNNING,READY,ZOMBIEmean?”
- “How do I save all registers during an
exitin RISC-V?” - “How does the scheduler switch between processes?”