This repository has been archived by the owner on Jun 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.cmd
36 lines (25 loc) · 1.53 KB
/
build.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
::
:: "Manual" build script that bypasses MSBuild and directly invokes the necessary tools.
::
:Clean
rmdir /S /Q ..\bin >nul 2>&1
@if "%1" == "clean" exit /B
:Build
mkdir ..\bin
cd ..\bin
csc /debug:embedded /noconfig /nostdlib /runtimemetadataversion:v4.0.30319 ../src/PatienceOS.Kernel/Color.cs ../src/PatienceOS.Kernel/Console.cs ../src/PatienceOS.Kernel/FrameBuffer.cs ../src/PatienceOS.Kernel/kernel.cs ../src/PatienceOS.Kernel/zerosharp.cs /out:kernel.ilexe /langversion:latest /unsafe || goto Error
ilc --targetos windows --targetarch x86 --instruction-set base --verbose kernel.ilexe -g -o kernel.obj --systemmodule kernel --map kernel.map -O || goto Error
nasm -f win32 -o loader.obj ../src/loader.asm || goto Error
:: QEMU doesn't boot properly when I use the Microsoft linker, continually stuck in a BIOS loop looking for something to boot.
:: I suspect it's producing a slightly different output than the GNU `ld` command that follows.
:: link /debug /subsystem:console /machine:x86 /nodefaultlib /base:0x00200000 /ALIGN:4096 /entry:kernel_Program__Main /out:kernel.bin loader.obj kernel.obj || goto Error
ld -m i386pe -T ../src/linker.ld -o kernel.bin loader.obj kernel.obj || goto Error
objcopy -O elf32-i386 kernel.bin kernel.elf || goto Error
qemu-system-i386 -cpu pentium3 -kernel kernel.elf -no-reboot -no-shutdown || goto Error
:: qemu-system-i386 -cpu pentium3 -kernel kernel.elf -d int -no-reboot -no-shutdown || goto Error
cd ..\build
exit /B
:Error
@echo Tool failed.
cd ..\build
exit /B 1