build.bat can create the image if missing, split the shell into native, posix and win32, clean up the build by moving executables into directories, the bootloader is no longer responsible to resolve drivers, fix ResolvePath, every process gets a copy of a module (dll), the child always inherits the cwd, fix function exports in posix, add unlink and exit to posix, add path translator to win32, first bugcheck.
This commit is contained in:
1 parent
0c7f461c6d
commit
f80e66ecde
38 files changed
+1620
-462
No files matched your search
@@ -6,8 +6,7 @@ set SRC=%ROOT%\code
|
||||
set VHD=%~dp0disk.vhd
|
||||
|
||||
if not exist "%VHD%" (
|
||||
echo ERROR: disk.vhd not found. Run mkimage.bat first.
|
||||
exit /b 1
|
||||
call mkimage.bat
|
||||
)
|
||||
|
||||
if exist "obj" rd /s /q "obj"
|
||||
@@ -21,12 +20,14 @@ mkdir "obj\win32" 2>nul
|
||||
mkdir "obj\posix" 2>nul
|
||||
mkdir "obj\drivers" 2>nul
|
||||
mkdir "obj\init" 2>nul
|
||||
mkdir "obj\shell" 2>nul
|
||||
mkdir "obj\shell_win32" 2>nul
|
||||
mkdir "obj\shell_posix" 2>nul
|
||||
mkdir "obj\shell_native" 2>nul
|
||||
mkdir "obj\doom" 2>nul
|
||||
mkdir "obj\video" 2>nul
|
||||
mkdir "bin" 2>nul
|
||||
|
||||
set CFLAGS=/nologo /W3 /Od /GS- /Gs999999 /Gz /Gy /EHsc- /GR- /Oi /Zi /std:c17 /D_CRT_SECURE_NO_WARNINGS /I"%SRC%\kernel" /I"%SRC%\hal"
|
||||
set CFLAGS=/nologo /W3 /WX /Od /GS- /Gs999999 /Gz /Gy /EHsc- /GR- /Oi /Zi /std:c17 /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /I"%SRC%\kernel" /I"%SRC%\hal" /I"%SRC%\syscall"
|
||||
set LFLAGS=/nologo /NODEFAULTLIB /DEBUG
|
||||
|
||||
:: ---- Assemble ASM files ----
|
||||
@@ -124,16 +125,38 @@ for %%f in (%SRC%\init\*.c) do (
|
||||
link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:_start ^
|
||||
/OUT:"bin\init.exe" /PDB:"bin\init.pdb" bin\syscall.lib obj\libc.obj obj\init\init.obj || exit /b 1
|
||||
|
||||
:: ---- Compile shell ----
|
||||
echo Compiling shell...
|
||||
for %%f in (%SRC%\shell\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\shell\%%~nf.obj" "%%f" || exit /b 1
|
||||
:: ---- Compile shell_win32 ----
|
||||
echo Compiling shell_win32...
|
||||
for %%f in (%SRC%\shell_win32\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\shell_win32\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
|
||||
:: ---- Link shell.exe ----
|
||||
echo Linking shell.exe...
|
||||
:: ---- Compile shell_posix ----
|
||||
echo Compiling shell_posix...
|
||||
for %%f in (%SRC%\shell_posix\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\shell_posix\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
|
||||
:: ---- Compile shell_native ----
|
||||
echo Compiling shell_native...
|
||||
for %%f in (%SRC%\shell_native\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\shell_native\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
|
||||
:: ---- Link shell_win32.exe ----
|
||||
echo Linking shell_win32.exe...
|
||||
link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
/OUT:"bin\shell.exe" /PDB:"bin\shell.pdb" bin\win32.lib obj\libc.obj obj\shell\*.obj || exit /b 1
|
||||
/OUT:"bin\shell_win32.exe" /PDB:"bin\shell_win32.pdb" bin\win32.lib obj\libc.obj obj\shell_win32\*.obj || exit /b 1
|
||||
|
||||
:: ---- Link shell_posix.exe ----
|
||||
echo Linking shell_posix.exe...
|
||||
link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
/OUT:"bin\shell_posix.exe" /PDB:"bin\shell_posix.pdb" bin\posix.lib obj\libc.obj obj\shell_posix\*.obj || exit /b 1
|
||||
|
||||
:: ---- Link shell_native.exe ----
|
||||
echo Linking shell_native.exe...
|
||||
link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
/OUT:"bin\shell_native.exe" /PDB:"bin\shell_native.pdb" bin\syscall.lib obj\libc.obj obj\shell_native\*.obj || exit /b 1
|
||||
|
||||
:: ---- Compile doom ----
|
||||
echo Compiling doom...
|
||||
@@ -179,27 +202,31 @@ set DEST=Z:
|
||||
|
||||
:: ---- Copy to ESP layout ----
|
||||
echo Assembling ESP...
|
||||
mkdir "%DEST%\drivers" 2>nul
|
||||
mkdir "%DEST%\apps" 2>nul
|
||||
mkdir "%DEST%\system" 2>nul
|
||||
mkdir "%DEST%\drivers" 2>nul
|
||||
mkdir "%DEST%\EFI\BOOT" 2>nul
|
||||
copy /y "bin\bootx64.efi" "%DEST%\EFI\BOOT\"
|
||||
copy /y "bin\kernel.exe" "%DEST%\colonel.exe"
|
||||
copy /y "bin\hal.dll" "%DEST%\"
|
||||
copy /y "bin\syscall.dll" "%DEST%\"
|
||||
copy /y "bin\win32.dll" "%DEST%\"
|
||||
copy /y "bin\posix.dll" "%DEST%\"
|
||||
copy /y "bin\kernel.exe" "%DEST%\system\colonel.exe"
|
||||
copy /y "bin\hal.dll" "%DEST%\system\"
|
||||
copy /y "bin\syscall.dll" "%DEST%\system\"
|
||||
copy /y "bin\win32.dll" "%DEST%\system\"
|
||||
copy /y "bin\posix.dll" "%DEST%\system\"
|
||||
copy /y "bin\ide.sys" "%DEST%\drivers\"
|
||||
copy /y "bin\ahci.sys" "%DEST%\drivers\"
|
||||
copy /y "bin\fat32.sys" "%DEST%\drivers\"
|
||||
copy /y "bin\usb.sys" "%DEST%\drivers\"
|
||||
copy /y "bin\init.exe" "%DEST%\"
|
||||
copy /y "bin\shell.exe" "%DEST%\"
|
||||
copy /y "bin\doom.exe" "%DEST%\"
|
||||
copy /y "bin\video.exe" "%DEST%\"
|
||||
copy /y "bin\init.exe" "%DEST%\system\"
|
||||
copy /y "bin\shell_win32.exe" "%DEST%\apps\"
|
||||
copy /y "bin\shell_posix.exe" "%DEST%\apps\"
|
||||
copy /y "bin\shell_native.exe" "%DEST%\apps\"
|
||||
copy /y "bin\doom.exe" "%DEST%\apps\"
|
||||
copy /y "bin\video.exe" "%DEST%\apps\"
|
||||
copy /y "%SRC%\boot.ini" "%DEST%\"
|
||||
copy /y "%SRC%\drivers\drivers.ini" "%DEST%\drivers\"
|
||||
if exist "%SRC%\video\bink2w64.dll" copy /y "%SRC%\video\bink2w64.dll" "%DEST%\"
|
||||
if exist "%SRC%\video\video.bk2" copy /y "%SRC%\video\video.bk2" "%DEST%\"
|
||||
if exist "%SRC%\doom\doom1.wad" copy /y "%SRC%\doom\doom1.wad" "%DEST%\"
|
||||
if exist "%SRC%\video\bink2w64.dll" copy /y "%SRC%\video\bink2w64.dll" "%DEST%\apps\"
|
||||
if exist "%SRC%\video\video.bk2" copy /y "%SRC%\video\video.bk2" "%DEST%\apps\"
|
||||
if exist "%SRC%\doom\doom1.wad" copy /y "%SRC%\doom\doom1.wad" "%DEST%\apps\"
|
||||
|
||||
:: ---- Unmount disk image ----
|
||||
echo Unmounting disk.vhd...
|
||||
|
||||
Reference in new issue
Block a user