PicoOS Devlog #1 : Build the Shell Foundation
Welcome to this very first devlog! After setting up the project description, it’s time to div into the actual code.
Lately, I’ve been focusing on implementing the core shell environment. The goal is to build a familiar CLI experience by rewriting essential Unix/Linux commands from scratch, keeping them lightweight and stripped of bloat
Anatomy of a Command
In this OS, every command lives as a file or folder inside the /bin directory, with the exception of cd, which has to be built directly into the shell to modify the current working directory.
Here is the standard structure for a basic command (e.g., hello):
def hello(args: list) -> int:
print("Hello World")
return 0
- Naming convention: The main function name must perfectly match the script’s filename.
- Arguments: Just like in standard C programs on Unix/Linux,
args[0]always hold the name of the program itself, followed by the actual arguments.
What’s Already Working
I have successfully implemented a solid batch of core utilities:
-
ls: Lists directory contents. Supported flags:-l(long format) and-a(show hidden files). -
cd: Changes the current working directory. -
mkdir: Creates one or multiple directories. -
touch: Creates one or multiple empty files. -
rm: Removes files or directories. Supported flag:-r(recursive). -
mv: Renames or moves files/directories. -
cp: Copies files/directories. Supported flag:-r(recursive). -
picofetch: A custom, lightweight system information tool (think neofetch / fastfetch) custom-tailored for PicoOS.
What’s Next?
The shell is alive, but there is still plenty of low-level work to do. My immediate milestones are:
- Expanding the toolbet: Implement the
catcommand along with a few other handy utilities. - I/O Streams: Add basic shell redirection mechanisms, specifically output redirection (
>) and piping (|). - Hardware Storage: Write drivers to interface with and manage external SPI flash memories.
The Endgame
As a reminder, the final objective of this project is to build a functional mini-computer powered by a Raspberry Pi Pico 2. I’ll be handling networking, driving a graphical display purely over UART, and the ultimate test of fire: making DOOM run on it.
Stay tuned for the next updates!
Comments 4
Writing an OS in MicroPython? Interesting. But wouldn’t it be more of a challenge to write it in C(++), Rust, Go, or any other compiled language, so that it would be a lot more performant as well?
Yes of course C is better for performance and I love this language. The fact is that I have already coded operating system bases in C for microcontrollers. And for once I just wanted to go back to Python which is certainly much simpler in syntax but which allows me to focus on pure logic… I don’t know if you know what I mean
as a cybersecurity enthusiast, this really caught my attention. I hope to see more devlogs from you as the project comes along :)
making DOOM run on a Pico 2 is an insane end goal. the shell foundation looks solid — cd being a shell builtin instead of a /bin command is the right call
Sign in to join the conversation.