我用Arduino UNO (2KB RAM) 构建了一个微型的类Unix操作系统,带有shell和文件系统。
Ibuilt a tiny Unix‑like 'OS' with shell and filesystem for Arduino UNO (2KB RAM)

原始链接: https://github.com/Arc1011/KernelUNO

KernelUNO是一个轻量级、基于RAM的shell操作系统,适用于Arduino UNO(或ATmega328P兼容板)。它模拟了一个文件系统,包含`/dev`和`/home`等目录,允许用户在RAM中直接创建、读取、写入和删除文件。 除了文件系统操作外,KernelUNO还通过GPIO管理提供硬件控制,让您可以配置引脚模式并直接控制引脚。系统监控功能包括内存使用情况、运行时间和内核消息(dmesg)。 交互式shell提供了22个内置命令,从基本的导航(`ls`、`cd`、`pwd`)到硬件交互(`pinmode`、`gpio`)和系统信息(`uname`、`uptime`)。其中包含一个有趣的“LED Disco Mode”,用于GPIO测试。 KernelUNO使用大约38%的闪存和85%的RAM,优先考虑效率。它是一个非持久性系统——断电后数据会丢失——并且专为实验和学习而设计。该项目是开源的(BSD 3-Clause License),欢迎贡献。

Hacker News新 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交登录 我用Arduino UNO (2KB RAM) 构建了一个类Unix的“操作系统”,带有shell和文件系统 (github.com/arc1011) 21点 由 Arc1011 2小时前 | 隐藏 | 过去 | 收藏 | 2评论 帮助 DoctorWhoof 25分钟前 | 下一个 [–] 错失了将其命名为“Unox”的机会 jrflo 32分钟前 | 上一个 | 下一个 [–] 有趣的想法!从CLI与GPIO的实时交互是最有趣的地方,如果包含I2C、SPI和UART等,我可以看到一个通用的框架对于使用新硬件/传感器进行早期原型设计会很有用。 考虑申请YC 2026年夏季批次!申请截止至5月4日 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请YC | 联系 搜索:
相关文章

原文

A lightweight RAM-based shell for Arduino UNO with filesystem simulation, hardware control, and interactive shell.

  • Virtual Filesystem - Create files and directories in RAM (/dev, /home) - Hardware Control - GPIO management with pin mode configuration
  • System Monitoring - Memory usage, uptime, kernel messages (dmesg)
  • 22 Built-in Commands - From basic file operations to hardware control
  • Interactive Shell - Real-time command execution with input buffering
  • LED Disco Mode - Fun easter egg for testing GPIO
kerneluno
  • Arduino UNO (or compatible board with ATmega328P)
  • USB cable for programming
  • LEDs and resistors (optional, for GPIO testing)
  1. Clone or download this repository
  2. Open KernelUNO.ino in Arduino IDE
  3. Select Board: Tools → Board → Arduino UNO
  4. Select Port: Tools → Port → /dev/ttyUSB0 (or your port)
  5. Compile & Upload: Sketch → Upload
  6. Open Serial Monitor: Tools → Serial Monitor (115200 baud)

Alternative with arduino-cli:

arduino-cli compile --fqbn arduino:avr:uno .
arduino-cli upload --fqbn arduino:avr:uno -p /dev/ttyUSB0 .
  • ls - List files in current directory
  • cd [dir] - Change directory
  • pwd - Print working directory
  • mkdir [name] - Create directory
  • touch [name] - Create file
  • cat [file] - Read file contents
  • echo [text] > [file] - Write to file
  • rm [name] - Remove file/directory
  • info [name] - Display file information
  • pinmode [pin] [in/out] - Set pin mode
  • write [pin] [high/low] - Write to pin
  • read [pin] - Read pin value
  • gpio [pin] [on/off/toggle] - GPIO control
  • gpio vixa [count] - LED disco mode (easter egg)
  • uptime - System uptime
  • uname - System information
  • dmesg - Kernel messages
  • df / free - Free memory
  • whoami - Current user (hardcoded root)
  • clear - Clear screen
  • reboot - Restart system
  • help - Show all commands
# Navigate filesystem
cd home
mkdir myproject
cd myproject
touch notes.txt
echo Hello World > notes.txt
cat notes.txt

# Hardware control
pinmode 13 out
gpio 13 on
gpio 13 toggle
read 2

# System info
uname
uptime
dmesg
df

# Fun mode
gpio vixa 10
  • Program: ~38% of 32KB flash
  • RAM: ~85% of 2KB SRAM (optimized)
  • Filesystem: 10 files/directories max
  • DMESG buffer: 6 messages
  • Board: Arduino UNO (ATmega328P)
  • Clock: 16 MHz
  • Serial Baud: 115200
  • Filesystem: RAM-based (no EEPROM)
  • Storage: Volatile (resets on power cycle)
  • Char-array based input buffer (32 bytes max)
  • Safe path concatenation to prevent buffer overflow
  • Kernel message logging with timestamps
  • Real-time GPIO operations
  • Efficient memory management
  • No persistent storage (EEPROM/SD)
  • Limited file size (32 bytes content per file)
  • Maximum 10 files/directories
  • PATH limited to 16 characters
  • Single user (root)

TODO / Future Enhancements

BSD 3-Clause License - See LICENSE file for details

Arc1011 (Arc1011)
Created in 2026.

Feel free to fork, modify, and improve! Send PRs for:

  • Bug fixes
  • Performance improvements
  • New commands
  • Code optimization

// The descriptive files (i.e., README and QUICKSTART) were written by Claude AI (with minor tweaks). Why? Because if I had done it myself, it would have ended up as a few lines of incoherent gibberish that wouldn't tell you anything.//

联系我们 contact @ memedata.com