Repository navigation
Disk Setup
This guide explains the current disk model and how to work with the FAT16 partition inside cupidos.img. Persistent file storage in /home lives in this partition.
If you just want a working HDD image fast:
# Build (or reuse) cupidos.img
make HDD_MB=200
# Copy host file into FAT root (maps to /home in CupidOS)
mcopy -o -i cupidos.img@@2097152 cupid.bmp ::/cupid.bmp
# Boot
make runThat's it. Read on for a detailed explanation of each step.
- Linux (or WSL) with root/sudo access
-
fdisk - included in
util-linux(pre-installed on most distros) -
mkfs.fat - from
dosfstools -
losetup - from
util-linux
Install if needed:
# Ubuntu / Debian / WSL
sudo apt-get install dosfstools util-linux
# Arch
sudo pacman -S dosfstools util-linuxmakeThis creates cupidos.img (or reuses the existing image) with:
- MBR boot code + partition table
- Stage 2 + kernel area
- FAT16 partition mounted at
/home
Choose image size with HDD_MB:
make HDD_MB=100
make HDD_MB=200Default is HDD_MB=200.
Install mtools if needed:
sudo apt-get update
sudo apt-get install -y mtoolsCopy files into FAT root:
mcopy -o -i cupidos.img@@2097152 cupid.bmp ::/cupid.bmpList files:
mdir -i cupidos.img@@2097152 ::/Mapping:
- FAT
::/corresponds to CupidOS/home -
::/cupid.bmpbecomes/home/cupid.bmpin CupidOS
If FAT_START_LBA is customized, use offset:
offset_bytes=$((FAT_START_LBA*512))
mcopy -o -i cupidos.img@@${offset_bytes} file.txt ::/file.txtIf you prefer mounting from Linux directly:
sudo mount -o loop,offset=$((4096*512)) cupidos.img /mnt/cupidosThis mounts the FAT16 partition directly from cupidos.img.
Now copy files into it:
# Simple text file
echo "Hello from CupidOS!" | sudo tee /mnt/cupidos/HELLO.TXT
# A CupidScript program
cat <<'EOF' | sudo tee /mnt/cupidos/HELLO.CUP
#!/bin/cupid
NAME="World"
echo "Hello, $NAME!"
echo "Welcome to CupidOS"
EOF
# A CupidC source file
cat <<'EOF' | sudo tee /mnt/cupidos/DEMO.CC
void main() {
println("Hello from CupidC on disk!");
int x = 42;
print("The answer is: ");
print_int(x);
println("");
}
EOF
# Copy any host files you want
# sudo cp ~/my-project/*.txt /mnt/cupidos/FAT16 filename rules:
- Maximum 8 characters for the name, 3 for the extension (8.3 format)
- Names are stored as uppercase -
hello.txtbecomesHELLO.TXT - No spaces or special characters in filenames
- Only the root directory is supported (no subdirectories)
sudo umount /mnt/cupidosYour cupidos.img now contains the updated /home data.
Use:
make runqemu-system-i386 \
-boot c \
-hda cupidos.img \
-rtc base=localtime \
-audiodev none,id=speaker \
-machine pcspk-audiodev=speaker \
-serial stdio| Flag | Purpose |
|---|---|
-boot c |
Boot from hard disk |
-hda cupidos.img |
HDD image with bootloader, kernel, and FAT16 /home
|
-rtc base=localtime |
Set RTC to host's local time |
-serial stdio |
Route serial debug output to your terminal |
Once booted with make run, the FAT16 partition is automatically mounted at /home:
/> mount
Mounted filesystems:
/ ramfs
/dev devfs
/home fat16
/> cd /home
/home> ls
HELLO .TXT 21
HELLO .CUP 64
DEMO .CC 110
/home> cat HELLO.TXT
Hello from CupidOS!
# Read a file
cat /home/HELLO.TXT
# Write a new file
vwrite /home/NOTES.TXT "My notes here"
# Delete a file
rm /home/OLD.TXT
# Open in Notepad (GUI)
# Click File → Open, navigate to /home, double-click a file# Run a CupidScript file
cupid /home/HELLO.CUP
# Compile and run a CupidC file
cupidc /home/DEMO.CCWrites go through a block cache and may not be flushed to disk immediately. The cache auto-flushes every 5 seconds, but you can force it:
syncAlways sync before shutting down QEMU to avoid data loss.
-
makeandmake runkeep existingcupidos.img -
make cleankeepscupidos.img -
make clean-imageremoves onlycupidos.img -
make distcleanremoves build artifacts andcupidos.img
-
cupidos.imgmay be missing or corrupted. Rebuild withmake.
- Verify files were copied to FAT root
::/(not::/home). - Check FAT listing from host:
mdir -i cupidos.img@@2097152 ::/. - Check serial output for FAT16 mount messages.
- QEMU may not be using
cupidos.img; usemake run. - The ATA driver didn't detect the disk - check serial log for ATA init messages.
- Run
syncbefore closing QEMU to flush the block cache. - The auto-flush runs every 5 seconds, but closing QEMU abruptly can lose unflushed writes.
- FAT16 uses 8.3 format - names longer than 8 characters are truncated.
- Use only uppercase letters, digits, and underscores.
- No long filename (LFN) support.
- Default FAT offset is
2097152bytes (4096 * 512). - If
FAT_START_LBAchanged, recompute offset asFAT_START_LBA * 512.
- Loop device and mount operations require
sudo. - If using WSL, ensure you're running in a WSL terminal (not PowerShell directly).
- Getting Started - Build and run cupid-os
- Filesystem - VFS architecture, RamFS, DevFS, FAT16 internals
- Shell Commands - Full command reference
- CupidScript - Writing scripts to run from disk
Getting Started
Shell & Scripting
Compilers
- CupidC Compiler
- CupidC Language Reference
- CupidC 2D Graphics Library
- CupidASM Assembler
- Toolchain Bootstrap
- Floating Point
Programs & Docs
GUI
Kernel
Filesystems
Hardware