Skip to content

Commit d6782bb

Browse files
committed
Restore fat16 func
1 parent 96736c7 commit d6782bb

19 files changed

Lines changed: 376 additions & 919 deletions

File tree

Makefile

Lines changed: 31 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ build: prepare_dirs fonts ./bin/boot_with_size.bin ./bin/kernel.bin user_program
7474
@echo "To install user programs to disk image, run: make install"
7575

7676
fonts:
77-
./generateFonts.sh
77+
./utilities/generateFonts.sh
7878

7979
install: ./bin/os.bin
8080
ifeq ($(UNAME_S),Linux)
@@ -87,66 +87,51 @@ ifeq ($(UNAME_S),Linux)
8787
@sudo umount /mnt/d
8888
@echo "User programs and assets installed to disk image!"
8989
else ifeq ($(UNAME_S),Darwin)
90-
@echo "Preparing disk image for macOS..."
91-
@bash -c "\
92-
set -e; \
93-
echo 'Attaching disk image...'; \
94-
ATTACH_OUTPUT=\$$(hdiutil attach -imagekey diskimage-class=CRawDiskImage -nomount ./bin/os.bin 2>/dev/null); \
95-
DISK_ID=\$$(echo \"\$$ATTACH_OUTPUT\" | grep -o '/dev/disk[0-9]*' | head -1); \
96-
PARTITION_ID=\"\$${DISK_ID}s1\"; \
97-
if [ -z \"\$$DISK_ID\" ]; then echo 'Failed to attach disk image'; exit 1; fi; \
98-
echo \"Attached as \$$DISK_ID, partition \$$PARTITION_ID\"; \
99-
echo 'Formatting partition as FAT32...'; \
100-
diskutil eraseVolume MS-DOS VIOSFAT32 \"\$$PARTITION_ID\" >/dev/null 2>&1 || { echo 'Failed to format partition'; hdiutil detach \"\$$DISK_ID\" 2>/dev/null; exit 1; }; \
101-
echo 'Copying files...'; \
102-
if [ -d './assets' ]; then \
103-
echo 'Copying assets...'; \
104-
cp -r ./assets/* /Volumes/VIOSFAT32/ || { echo 'Failed to copy assets'; diskutil unmount \"\$$PARTITION_ID\"; hdiutil detach \"\$$DISK_ID\" 2>/dev/null; exit 1; }; \
105-
else \
106-
echo 'No assets directory found, skipping...'; \
107-
fi; \
108-
if [ -d './assets/etc/default/user/programs' ]; then \
109-
echo 'Copying .elf files...'; \
110-
find ./assets/etc/default/user/programs -name '*.elf' -exec cp {} /Volumes/VIOSFAT32/ \; || { echo 'Failed to copy .elf files'; diskutil unmount \"\$$PARTITION_ID\"; hdiutil detach \"\$$DISK_ID\" 2>/dev/null; exit 1; }; \
111-
else \
112-
echo 'No programs directory found, skipping...'; \
113-
fi; \
90+
@echo "Attaching disk image (macOS)..."
91+
@bash -c '\
92+
DISK_ID=$$(hdiutil attach -imagekey diskimage-class=CRawDiskImage -nomount ./bin/os.bin | awk "/\/dev\// {print \$$1}"); \
93+
echo "Attached as $$DISK_ID"; \
94+
sudo mkdir -p /Volumes/viosmnt; \
95+
sudo mount -t msdos $$DISK_ID /Volumes/viosmnt || { echo "Failed to mount $$DISK_ID"; exit 1; }; \
96+
echo "Copying files..."; \
97+
sudo cp -r ./assets/* /Volumes/viosmnt/ 2>/dev/null || true; \
11498
sync; \
115-
echo 'Unmounting for boot sector update...'; \
116-
diskutil unmount \"\$$PARTITION_ID\" >/dev/null 2>&1 || echo 'Unmount failed, continuing...'; \
117-
echo 'Installing custom boot sector...'; \
118-
dd if=./bin/vbr.bin of=\"\$$PARTITION_ID\" bs=512 count=1 conv=notrunc 2>/dev/null || echo 'Warning: Failed to install custom boot sector'; \
119-
hdiutil detach \"\$$DISK_ID\" >/dev/null 2>&1 || echo 'Detach failed, continuing...'; \
120-
echo 'User programs and assets installed to disk image!'; \
121-
"
99+
echo "Unmounting..."; \
100+
sudo umount /Volumes/viosmnt; \
101+
hdiutil detach $$DISK_ID; \
102+
echo "User programs and assets installed to disk image!" \
103+
'
122104
endif
123105

124106

125107
./bin/kernel.bin: prepare_dirs $(FILES)
126108
i686-elf-gcc $(FLAGS) -T ./src/linker.ld -o ./bin/kernel.bin -ffreestanding -O0 -nostdlib $(FILES)
127109

128-
./bin/boot.bin: prepare_dirs ./src/boot/mbr.asm ./src/boot/vbrEntry.asm ./src/boot/vbrMain.asm ./src/boot/fsinfo.asm
129-
nasm -f bin ./src/boot/mbr.asm -o ./bin/mbr.bin
130-
nasm -f bin ./src/boot/vbrEntry.asm -o ./bin/vbrEntry.bin
131-
nasm -f bin ./src/boot/vbrMain.asm -o ./bin/vbrMain.bin
132-
nasm -f bin ./src/boot/fsinfo.asm -o ./bin/fsinfo.bin
133-
dd if=./bin/vbrEntry.bin of=./bin/vbr.bin bs=512 count=1 conv=notrunc status=none
134-
dd if=./bin/vbrMain.bin of=./bin/vbr.bin bs=512 seek=1 count=2 conv=notrunc status=none
135-
dd if=./bin/mbr.bin of=$@ bs=512 count=1 conv=notrunc status=none
136-
dd if=./bin/vbr.bin of=$@ bs=512 seek=2050 count=3 conv=notrunc status=none
137-
dd if=./bin/fsinfo.bin of=$@ bs=512 seek=2060 count=1 conv=notrunc status=none
110+
./bin/boot.bin: prepare_dirs ./src/boot/boot.asm
111+
nasm -f bin ./src/boot/boot.asm -o ./bin/boot.bin
138112

139113
# Calculate kernel size and update boot sector
140114
./bin/boot_with_size.bin: ./bin/boot.bin ./bin/kernel.bin
141115
@echo "Calculating kernel size and updating boot sector..."
142-
cp ./bin/boot.bin ./bin/boot_with_size.bin
116+
./utilities/updateBoot.sh
143117

118+
# ./bin/boot.bin: prepare_dirs ./src/boot/mbr.asm ./src/boot/vbrEntry.asm ./src/boot/vbrMain.asm ./src/boot/fsinfo.asm
119+
# # nasm -f bin ./src/boot/mbr.asm -o ./bin/mbr.bin
120+
# # nasm -f bin ./src/boot/vbrEntry.asm -o ./bin/vbrEntry.bin
121+
# # nasm -f bin ./src/boot/vbrMain.asm -o ./bin/vbrMain.bin
122+
# # nasm -f bin ./src/boot/fsinfo.asm -o ./bin/fsinfo.bin
123+
# # dd if=./bin/vbrEntry.bin of=./bin/vbr.bin bs=512 count=1 conv=notrunc status=none
124+
# # dd if=./bin/vbrMain.bin of=./bin/vbr.bin bs=512 seek=1 count=2 conv=notrunc status=none
125+
# # dd if=./bin/mbr.bin of=$@ bs=512 count=1 conv=notrunc status=none
126+
# # dd if=./bin/vbr.bin of=$@ bs=512 seek=2050 count=3 conv=notrunc status=none
127+
# # dd if=./bin/fsinfo.bin of=$@ bs=512 seek=2060 count=1 conv=notrunc status=nonez
144128

145-
./bin/os.bin: ./bin/boot_with_size.bin
129+
130+
./bin/os.bin: ./bin/boot_with_size.bin ./bin/kernel.bin
146131
rm -rf ./bin/os.bin
147132
dd if=./bin/boot_with_size.bin of=./bin/os.bin bs=512 conv=notrunc
148-
dd if=./bin/kernel.bin of=./bin/os.bin bs=512 seek=2070 conv=notrunc
149-
dd if=/dev/zero bs=1048576 count=128 >> ./bin/os.bin
133+
dd if=./bin/kernel.bin >> ./bin/os.bin
134+
dd if=/dev/zero bs=1048576 count=1500 >> ./bin/os.bin
150135

151136
# Generic C and ASM file rules
152137
./build/%.o: ./src/%.c

README.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ ___________
115115
├── .env
116116
├── .github
117117
│   ├── dependabot.yml
118+
│   ├── FUNDING.yml
118119
│   └── workflows
119120
│   └── build.yml
120121
├── .gitignore
@@ -149,13 +150,18 @@ ___________
149150
│   ├── kernel
150151
│   │   └── .keep
151152
│   └── shells
153+
│   ├── etc
154+
│   │   └── wardenviod
155+
│   │   └── src
156+
│   │   └── main.cpp
152157
│   ├── vio:nova
153-
│   │   └── .keep
158+
│   │   └── src
159+
│   │   └── main.cpp
154160
│   └── vio:void
155-
│   └── .keep
161+
│   └── src
162+
│   └── main.cpp
156163
├── build.sh
157164
├── buildExternal.sh
158-
├── debug.log
159165
├── docs
160166
│   └── api
161167
│   ├── copy_string_from_task.md
@@ -188,7 +194,6 @@ ___________
188194
│   ├── vix_clear_screen.md
189195
│   ├── vix_draw_pixel.md
190196
│   └── vix_present_frame.md
191-
├── generateFonts.sh
192197
├── LICENSE
193198
├── Makefile
194199
├── README.md
@@ -201,11 +206,7 @@ ___________
201206
│   │   ├── sb16.c
202207
│   │   └── sb16.h
203208
│   ├── boot
204-
│   │   ├── fsinfo.asm
205-
│   │   ├── mbr.asm
206-
│   │   ├── vbrEntry.asm
207-
│   │   ├── vbrMain.asm
208-
│   │   └── vbrOld.asm
209+
│   │   └── boot.asm
209210
│   ├── config.h
210211
│   ├── debug
211212
│   │   ├── simple_serial.c
@@ -320,18 +321,20 @@ ___________
320321
│   └── utils
321322
│   ├── utils.c
322323
│   └── utils.h
323-
├── updateREADME.sh
324324
├── utilities
325325
│   ├── fonts
326326
│   │   ├── Arial.ttf
327327
│   │   ├── AtariST8x16SystemFont.ttf
328328
│   │   ├── Brightly.otf
329329
│   │   ├── Cheri.ttf
330330
│   │   └── RobotoThin.ttf
331-
│   └── generateFonts.py
331+
│   ├── generateFonts.py
332+
│   ├── generateFonts.sh
333+
│   ├── updateBoot.sh
334+
│   └── updateREADME.sh
332335
└── ViOS_LOGO_PNG.png
333336
334-
53 directories, 167 files
337+
58 directories, 165 files
335338
```
336339

337340
___________
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
all:
22
nasm -f elf ./main.asm -o ./asm_test.o
3-
i386-vios-elf-ld -T ./linker.ld -o ./asm_testelfelflef.elf ./asm_test.o
3+
i386-vios-elf-ld -T ./linker.ld -o ./asm_test.elf ./asm_test.o
44

55
clean:
66
rm -f ./asm_test.o ./asm_test.elf

assets/etc/default/user/programs/cpp_test/src/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ int main(int argc, char *argv[])
2222
{
2323
// Print all arguments
2424
printf("Program called with %d arguments:\n", argc);
25-
// for (int i = 0; i < argc; i++)
26-
// {
27-
// printf("argv[%d] = %s\n", i, argv[i]);
28-
// }
25+
for (int i = 0; i < argc; i++)
26+
{
27+
printf("argv[%d] = %s\n", i, argv[i]);
28+
}
2929

3030
// printf("\nStart typing. Press 'f' to stop.\n");
3131

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// default load shell void (CLI) with setting for default shell recommended GUI is nova

debug.log

-9 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)