Skip to content

Commit 430e109

Browse files
committed
Refactor project structure and enhance functionality
- Updated .gitignore to include additional environment files and clean up ignored directories. - Modified Makefile to reorganize source files and improve build process for user programs. - Enhanced README with updated badge links and improved directory structure overview. - Added new audio and input drivers, including keyboard and mouse support. - Introduced new system calls for audio control and sleep functionality. - Removed obsolete files and cleaned up code for better maintainability. - Implemented disk and file handling improvements for better performance and reliability.
1 parent d6782bb commit 430e109

71 files changed

Lines changed: 1172 additions & 600 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,15 @@
55
# macOS metadata
66
.DS_Store
77

8-
# Compiled binary/object/ELF files
9-
*.bin
10-
*.o
11-
*.elf
12-
*.iso
13-
*.env
14-
**.tmp
15-
168
# Ignore bin and build folders recursively
179
src/fonts/
18-
bin/
10+
/bin/
1911
build/
2012
out/
21-
mnt/
22-
**/bin/
23-
**/build/
13+
/mnt/
2414
.venv/
25-
external/
15+
external/
16+
17+
.env
18+
*/.env
19+
**/.env

Makefile

Lines changed: 57 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,55 +3,57 @@ FILES = \
33
./build/kernel.o \
44
./build/kernel/init.o \
55
./build/kernel/mainloop.o \
6-
./build/graphics/renderer.o \
7-
./build/graphics/graphics.o \
8-
./build/disk/disk.o \
9-
./build/disk/streamer.o \
10-
./build/fs/pparser.o \
6+
./build/drivers/io/io.asm.o \
7+
./build/drivers/io/power/power.o \
8+
./build/drivers/io/storage/disk.o \
9+
./build/drivers/io/storage/streamer.o \
10+
./build/drivers/io/timing/rtc.o \
11+
./build/drivers/io/timing/timer.o \
12+
./build/drivers/input/keyboard/keyboard.o \
13+
./build/drivers/input/keyboard/ps2_keyboard.o \
14+
./build/drivers/input/mouse/mouse.o \
15+
./build/drivers/input/mouse/ps2_mouse.o \
16+
./build/drivers/output/audio/audio.o \
17+
./build/drivers/output/audio/sb16.o \
18+
./build/drivers/output/vigfx/vigfx.o \
19+
./build/drivers/output/vigfx/vigfx_vesa.o \
1120
./build/fs/file.o \
1221
./build/fs/fat/fat16.o \
1322
./build/fs/fat/fat32.o \
14-
./build/string/string.o \
23+
./build/fs/pparser.o \
24+
./build/gdt/gdt.asm.o \
25+
./build/gdt/gdt.o \
1526
./build/idt/idt.asm.o \
1627
./build/idt/idt.o \
17-
./build/gdt/gdt.o \
18-
./build/gdt/gdt.asm.o \
19-
./build/memory/memory.o \
28+
./build/loader/formats/elf.o \
29+
./build/loader/formats/elfloader.o \
2030
./build/memory/heap/heap.o \
2131
./build/memory/heap/kheap.o \
22-
./build/memory/paging/paging.o \
32+
./build/memory/memory.o \
2333
./build/memory/paging/paging.asm.o \
24-
./build/io/io.asm.o \
25-
./build/task/tss.asm.o \
34+
./build/memory/paging/paging.o \
2635
./build/task/process.o \
27-
./build/task/task.o \
2836
./build/task/task.asm.o \
29-
./build/isr80h/isr80h.o \
37+
./build/task/task.o \
38+
./build/task/tss.asm.o \
39+
./build/isr80h/audio.o \
40+
./build/isr80h/file.o \
3041
./build/isr80h/heap.o \
42+
./build/isr80h/isr80h.o \
43+
./build/isr80h/keyboard.o \
3144
./build/isr80h/process.o \
32-
./build/isr80h/file.o \
3345
./build/isr80h/serial.o \
34-
./build/isr80h/waits.o \
35-
./build/isr80h/keyboard.o \
36-
./build/keyboard/keyboard.o \
37-
./build/keyboard/ps2_keyboard.o \
38-
./build/loader/formats/elfloader.o \
39-
./build/loader/formats/elf.o \
40-
./build/rtc/rtc.o \
46+
./build/isr80h/timers.o \
4147
./build/panic/panic.o \
48+
./build/debug/simple_serial.o \
49+
./build/string/string.o \
4250
./build/utils/utils.o \
4351
./build/fonts/characters_Arial.o \
4452
./build/fonts/characters_AtariST8x16SystemFont.o \
4553
./build/fonts/characters_Brightly.o \
4654
./build/fonts/characters_Cheri.o \
4755
./build/fonts/characters_RobotoThin.o \
48-
./build/mouse/mouse.o \
49-
./build/mouse/ps2_mouse.o \
50-
./build/math/fpu_math.o \
51-
./build/power/power.o \
52-
./build/debug/simple_serial.o \
53-
./build/audio/audio.o \
54-
./build/audio/sb16.o
56+
./build/math/fpu_math.o
5557

5658
INCLUDES = -I./src
5759
CFLAGS = -std=gnu99 -Wall -Werror -O0 -g
@@ -103,6 +105,22 @@ else ifeq ($(UNAME_S),Darwin)
103105
'
104106
endif
105107

108+
mount: ./bin/os.bin
109+
ifeq ($(UNAME_S),Linux)
110+
@echo "Installing user programs and assets to disk image (Linux)..."
111+
@sudo mkdir -p /mnt/d
112+
@sudo umount /mnt/d 2>/dev/null || true
113+
@sudo mount -t vfat ./bin/os.bin /mnt/d || { echo "Failed to mount disk image"; exit 1; }
114+
else ifeq ($(UNAME_S),Darwin)
115+
@echo "Attaching disk image (macOS)..."
116+
@bash -c '\
117+
DISK_ID=$$(hdiutil attach -imagekey diskimage-class=CRawDiskImage -nomount ./bin/os.bin | awk "/\/dev\// {print \$$1}"); \
118+
echo "Attached as $$DISK_ID"; \
119+
sudo mkdir -p /Volumes/viosmnt; \
120+
sudo mount -t msdos $$DISK_ID /Volumes/viosmnt || { echo "Failed to mount $$DISK_ID"; exit 1; }; \
121+
'
122+
endif
123+
106124

107125
./bin/kernel.bin: prepare_dirs $(FILES)
108126
i686-elf-gcc $(FLAGS) -T ./src/linker.ld -o ./bin/kernel.bin -ffreestanding -O0 -nostdlib $(FILES)
@@ -143,17 +161,18 @@ endif
143161
nasm -f elf -g $< -o $@
144162

145163
user_programs:
146-
@if [ -d "./assets/etc/default/user/programs" ]; then \
147-
for dir in $$(find ./assets/etc/default/user/programs -mindepth 1 -maxdepth 1 -type d 2>/dev/null); do \
148-
echo "Building user program $$dir..."; \
149-
$(MAKE) -C $$dir all || exit 1; \
150-
done; \
151-
else \
152-
echo "No user programs directory found (./assets/etc/default/user/programs), skipping..."; \
153-
fi
164+
@for mk in $$(find ./assets -name Makefile \
165+
! -path "./assets/etc/default/user/programs/*"); do \
166+
dir=$$(dirname $$mk); \
167+
echo "Building in $$dir..."; \
168+
$(MAKE) -C $$dir all || exit 1; \
169+
done
154170

155171
user_programs_clean:
156-
@for dir in ./assets/etc/default/user/programs/*/ ; do \
172+
@for mk in $$(find ./assets -name Makefile \
173+
! -path "./assets/etc/default/user/programs/*"); do \
174+
dir=$$(dirname $$mk); \
175+
echo "Cleaning in $$dir..."; \
157176
$(MAKE) -C $$dir clean || true; \
158177
done
159178

README.md

Lines changed: 67 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ The following components are versioned together and must be used in compatible v
4242
![GitHub Discussions](https://img.shields.io/github/discussions/PinkQween/ViOS)
4343
![Forks](https://img.shields.io/github/forks/PinkQween/ViOS?style=social)
4444
![Commit Activity](https://img.shields.io/github/commit-activity/w/PinkQween/ViOS)
45-
![Total Issues](https://img.shields.io/github/issues-closed-raw/PinkQween/ViOS?label=total%20issues&color=blue)
46-
![Total PRs](https://img.shields.io/github/issues-pr-closed-raw/PinkQween/ViOS?label=total%20PRs&color=blue)
45+
![Total Issues](https://img.shields.io/github/issues/PinkQween/ViOS?label=total%20issues&color=blue)
46+
![Total PRs](https://img.shields.io/github/issues-pr/PinkQween/ViOS?label=total%20PRs&color=blue)
4747

4848
## 📚 Table of Contents
4949

@@ -120,46 +120,57 @@ ___________
120120
│   └── build.yml
121121
├── .gitignore
122122
├── assets
123-
│   ├── boot
124-
│   │   └── .keep
125123
│   ├── etc
126-
│   │   └── default
127-
│   │   └── user
128-
│   │   └── programs
129-
│   │   ├── asm_test
130-
│   │   │   ├── linker.ld
131-
│   │   │   ├── main.asm
132-
│   │   │   └── Makefile
133-
│   │   ├── c_print
134-
│   │   │   ├── Makefile
135-
│   │   │   └── src
136-
│   │   │   └── main.c
137-
│   │   ├── cpp_prnt
138-
│   │   │   ├── Makefile
139-
│   │   │   └── src
140-
│   │   │   └── main.cpp
141-
│   │   ├── cpp_test
142-
│   │   │   ├── Makefile
143-
│   │   │   └── src
144-
│   │   │   └── main.cpp
145-
│   │   └── shell
146-
│   │   ├── Makefile
147-
│   │   └── src
148-
│   │   ├── main.c
149-
│   │   └── shell.h
150-
│   ├── kernel
124+
│   │   ├── passwd
125+
│   │   └── shadow
126+
│   ├── shared
127+
│   │   ├── fonts
128+
│   │   │   └── .keep
129+
│   │   └── lib
130+
│   │   └── .keep
131+
│   ├── sys
132+
│   │   └── src
133+
│   │   └── reloivd
134+
│   │   ├── Makefile
135+
│   │   └── src
136+
│   │   └── main.cpp
137+
│   ├── tmp
151138
│   │   └── .keep
152-
│   └── shells
153-
│   ├── etc
154-
│   │   └── wardenviod
155-
│   │   └── src
156-
│   │   └── main.cpp
157-
│   ├── vio:nova
158-
│   │   └── src
159-
│   │   └── main.cpp
160-
│   └── vio:void
161-
│   └── src
162-
│   └── main.cpp
139+
│   ├── usr
140+
│   │   └── src
141+
│   │   ├── programs
142+
│   │   │   ├── echo
143+
│   │   │   │   ├── Makefile
144+
│   │   │   │   └── src
145+
│   │   │   │   └── main.cpp
146+
│   │   │   ├── ls
147+
│   │   │   │   ├── Makefile
148+
│   │   │   │   └── src
149+
│   │   │   │   └── main.cpp
150+
│   │   │   ├── öviash
151+
│   │   │   │   ├── Makefile
152+
│   │   │   │   └── src
153+
│   │   │   │   └── main.cpp
154+
│   │   │   ├── pwd
155+
│   │   │   │   ├── Makefile
156+
│   │   │   │   └── src
157+
│   │   │   │   └── main.cpp
158+
│   │   │   └── v
159+
│   │   │   ├── Makefile
160+
│   │   │   └── src
161+
│   │   │   └── main.cpp
162+
│   │   └── realms
163+
│   │   ├── vio:nova
164+
│   │   │   ├── Makefile
165+
│   │   │   └── src
166+
│   │   │   └── main.cpp
167+
│   │   └── vio:void
168+
│   │   ├── Makefile
169+
│   │   └── src
170+
│   │   └── main.cpp
171+
│   └── var
172+
│   └── log
173+
│   └── .keep
163174
├── build.sh
164175
├── buildExternal.sh
165176
├── docs
@@ -230,11 +241,6 @@ ___________
230241
│   │   ├── gdt.asm
231242
│   │   ├── gdt.c
232243
│   │   └── gdt.h
233-
│   ├── graphics
234-
│   │   ├── graphics.c
235-
│   │   ├── graphics.h
236-
│   │   ├── renderer.c
237-
│   │   └── renderer.h
238244
│   ├── idt
239245
│   │   ├── idt.asm
240246
│   │   ├── idt.c
@@ -300,6 +306,13 @@ ___________
300306
│   ├── panic
301307
│   │   ├── panic.c
302308
│   │   └── panic.h
309+
│   ├── pci
310+
│   │   ├── pci.c
311+
│   │   ├── pci.h
312+
│   │   ├── virtio_gpu_pci.c
313+
│   │   ├── virtio_gpu_pci.h
314+
│   │   ├── virtio_pci.c
315+
│   │   └── virtio_pci.h
303316
│   ├── power
304317
│   │   ├── power.c
305318
│   │   └── power.h
@@ -318,9 +331,14 @@ ___________
318331
│   │   ├── task.h
319332
│   │   ├── tss.asm
320333
│   │   └── tss.h
321-
│   └── utils
322-
│   ├── utils.c
323-
│   └── utils.h
334+
│   ├── utils
335+
│   │   ├── utils.c
336+
│   │   └── utils.h
337+
│   └── vigfx
338+
│   ├── vigfx.c
339+
│   ├── vigfx.h
340+
│   ├── virtio_gpu.c
341+
│   └── virtio_gpu.h
324342
├── utilities
325343
│   ├── fonts
326344
│   │   ├── Arial.ttf
@@ -334,7 +352,7 @@ ___________
334352
│   └── updateREADME.sh
335353
└── ViOS_LOGO_PNG.png
336354
337-
58 directories, 165 files
355+
65 directories, 176 files
338356
```
339357

340358
___________
File renamed without changes.

assets/shells/etc/wardenviod/src/main.cpp

Lines changed: 0 additions & 1 deletion
This file was deleted.

assets/sys/src/reloivd/Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
CXX = i386-vios-elf-g++
2+
CC = i386-vios-elf-gcc
3+
4+
SRC = src/main.cpp
5+
OBJ = build/main.o
6+
OUT = ../../../sbin/reloivd
7+
8+
CFLAGS = -O2
9+
LDFLAGS =
10+
11+
all: $(OUT)
12+
13+
$(OBJ): $(SRC)
14+
@mkdir -p $(dir $@)
15+
$(CC) $(CFLAGS) -c $< -o $@
16+
17+
$(OUT): $(OBJ)
18+
$(CC) $(LDFLAGS) $^ -o $@
19+
20+
clean:
21+
rm -rf build $(OUT)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <stdio.h>
2+
3+
int main(int argc, char *argv[])
4+
{
5+
while (1)
6+
{
7+
// TODO: replace with a OS manager+ + other systemd functionalities
8+
// printf("Hello, World!\n");
9+
}
10+
11+
return -1;
12+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
CXX = i386-vios-elf-g++
2+
CC = i386-vios-elf-gcc
3+
4+
SRC = src/main.c
5+
OBJ = build/main.o
6+
OUT = ../../../../bin/beep
7+
8+
CFLAGS = -O2
9+
LDFLAGS =
10+
11+
all: $(OUT)
12+
13+
$(OBJ): $(SRC)
14+
@mkdir -p $(dir $@)
15+
$(CC) $(CFLAGS) -c $< -o $@
16+
17+
$(OUT): $(OBJ)
18+
$(CC) $(LDFLAGS) $^ -o $@
19+
20+
clean:
21+
rm -rf build $(OUT)

0 commit comments

Comments
 (0)