Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions BUILD.BAT
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,31 @@ cd %~d0%~p0
call SET_ENV_VARS.BAT

cd mbr_bootloader
cecho {0A}Building Master Boot Record bootloader...{#}{\n}
echo Building Master Boot Record bootloader...
call BUILD.BAT || goto ERROR
cecho {0A}Master Boot Record bootloader was built{#}{\n}
echo Master Boot Record bootloader was built
echo.

cd ..\stage2_bootloader
cecho {0A}Building second stage bootloader...{#}{\n}
echo Building second stage bootloader...
call BUILD.BAT || goto ERROR
cecho {0A}Second stage bootloader was built{#}{\n\n}
echo Second stage bootloader was built
echo.

cd ..\stage1_bootloader
cecho {0A}Building first stage bootloader...{#}{\n}
echo Building first stage bootloader...
call BUILD.BAT || goto ERROR
cecho {0A}First stage bootloader was built{#}{\n\n}
echo First stage bootloader was built
echo.

cd ..

::User Library
cd user\user_tools
cecho {0A}Building user library...{#}{\n}
echo Building user library...
call BUILD.bat || goto ERROR
cecho {0A}User library was built{#}{\n\n}
echo User library was built
echo.
cd ..

::User Programs
Expand All @@ -81,10 +84,11 @@ setlocal ENABLEDELAYEDEXPANSION
set errorlevel=1
FOR /F "tokens=%i%" %%a IN ("%result%") DO (
set errorlevel=0
cecho {0A}Building program "%%a"...{#}{\n}
echo Building program "%%a"...
cd %%a
call BUILD.BAT || cecho {0C}Failed building program "%%a"{#}{\n}&&endlocal&&goto ERROR
cecho {0A}Program "%%a" was built{#}{\n\n}
call BUILD.BAT || echo Failed building program "%%a"&&endlocal&&goto ERROR
echo Program "%%a" was built
echo.
FOR /F %%b IN ('dir *.ELF /B /A:A') DO (
set "usr_programs_paths=!usr_programs_paths! user/user_programs/%%a/%%b"
)
Expand All @@ -96,21 +100,22 @@ goto user_programs_loop

:user_programs_loop_end
endlocal & set user_programs_paths=%usr_programs_paths%
cecho {0A}All selected programs were built{#}{\n\n}
echo All selected programs were built
echo.
set errorlevel=0

::Kernel
cd ..\..\kernel
cecho {0A}Building kernel...{#}{\n}
call BUILD.BAT %BUILD_ARGS% || cecho {0C}Failed building kernel{#}{\n}&&goto ERROR
cecho {0A}Kernel was built{#}{\n}
echo Building kernel...
call BUILD.BAT %BUILD_ARGS% || echo Failed building kernel&&goto ERROR
echo Kernel was built

cd ..

goto eof

:ERROR
cecho {0C}Build failed{#}{\n}
echo Build failed
cd %~d0%~p0
EXIT /B 1

Expand Down
12 changes: 6 additions & 6 deletions BUILD_IMAGE.BAT
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ call BUILD.BAT %BUILD_ARGS% || goto ERROR

if "%EFI%"=="1" (
cd efi_bootloader
cecho {0A}Building EFI Bootloader...{#}{\n}
echo Building EFI Bootloader...
call BUILD.BAT || goto ERROR
cecho {0A}EFI Bootloader was built{#}{\n}
echo EFI Bootloader was built
cd ..
)

cecho {0A}Building %IMAGE_TYPE% Image...{#}{\n}
echo Building %IMAGE_TYPE% Image...

if "%IMAGE_TYPE%"=="HD" (
if "%MBR%"=="1" (
Expand Down Expand Up @@ -88,13 +88,13 @@ for %%a in ("%user_programs_paths: =" "%") do (
:imageBuilt
if "%IMAGE_TYPE%"=="HD" (
del HDImage.vdi >nul 2>&1
VBoxManage convertfromraw --uuid d32a4d71-7ccb-4864-a684-c9d7c7a425f5 -format VDI HDImage.bin HDImage.vdi || cecho {0C}Failed building VDI HD image{#}{\n}&&goto ERROR
VBoxManage convertfromraw --uuid d32a4d71-7ccb-4864-a684-c9d7c7a425f5 -format VDI HDImage.bin HDImage.vdi || echo Failed building VDI HD image&&goto ERROR
)
cecho {0A}%IMAGE_TYPE% Image was built{#}{\n}
echo %IMAGE_TYPE% Image was built
goto eof

:ERROR
cecho {0C}Build failed{#}{\n}
echo Build failed
cd %~d0%~p0
EXIT /B 1

Expand Down
2 changes: 1 addition & 1 deletion QEMU_BOOT.BAT
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if "%IMAGE_TYPE%"=="HD" (

if "%DEBUG%"=="1" (
call SET_ENV_VARS.BAT
if not exist kernel\CHAOSKRN.SYS_debug cecho {0C}WARNING^^! CHAOSKRN.SYS_debug does not exist{#}{\n}
if not exist kernel\CHAOSKRN.SYS_debug echo WARNING^^! CHAOSKRN.SYS_debug does not exist
start /b cmd /c %QEMU_CMD% %QEMU_ARGS% -S -s
tools\gdb-multiarch.bat -x kernel_debug.gdb
) else (
Expand Down
22 changes: 11 additions & 11 deletions efi_bootloader/BUILD.BAT
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ mkdir obj >nul 2>&1

set CFLAGS=-g -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -fno-common -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables -Wno-address -fno-pic -fno-pie -Os -D DISABLE_NEW_DEPRECATED_INTERFACES -c -Ilib/MdePkg/Include -Ilib/MdePkg/Include/Ia32

cecho {09}Compiling{0F}{\t}==^> AutoGen.c...{#}
echo|set /p dummy="Compiling ==> AutoGen.c..."
i686-elf-gcc %CFLAGS% -include src/AutoGen.h -o obj/AutoGen.obj src/AutoGen.c || goto ERROR
cecho {0a}done{#}{\n}
cecho {09}Compiling{0F}{\t}==^> efiboot.c...{#}
echo done
echo|set /p dummy="Compiling ==> efiboot.c..."
i686-elf-gcc %CFLAGS% -o obj/efiboot.obj src/efiboot.c || goto ERROR
cecho {0a}done{#}{\n}
echo done

setlocal EnableDelayedExpansion

Expand All @@ -21,9 +21,9 @@ FOR /R obj %%G IN (*.obj) DO (

endlocal

cecho {09}Creating Archive{0F}{\t}==^> efiboot.lib...{#}
echo|set /p dummy="Creating Archive ==> efiboot.lib..."
i686-elf-ar cr efiboot.lib @obj/object_files.lst || goto ERROR
cecho {0a}done{#}{\n}
echo done

for /F "tokens=*" %%A in (static_library_files.lst) do (
if not exist %%A (
Expand All @@ -35,22 +35,22 @@ for /F "tokens=*" %%A in (static_library_files.lst) do (
)
)

cecho {09}Linking{0F}{\t}==^> efiboot.dll...{#}
echo|set /p dummy="Linking ==> efiboot.dll..."
i686-elf-gcc -o efiboot.dll -nostdlib -Wl,-n,-q,--gc-sections -Wl,--entry,_ModuleEntryPoint -u _ModuleEntryPoint -Wl,-Map,efiboot.map,--whole-archive -Os -Wl,-m,elf_i386,--oformat=elf32-i386 -Wl,--start-group,@static_library_files.lst,--end-group -g -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -fno-common -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables -Wno-address -fno-pic -fno-pie -Os -D DISABLE_NEW_DEPRECATED_INTERFACES -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 -Wl,--script=GccBase.lds -Wno-error || goto ERROR
cecho {0a}done{#}{\n}
echo done

cecho {09}Generating EFI App{0F}{\t}==^> BOOTIA32.EFI...{#}
echo|set /p dummy="Generating EFI App ==> BOOTIA32.EFI..."
i686-elf-objcopy efiboot.dll || goto ERROR
copy efiboot.dll efiboot.debug >nul 2>&1
i686-elf-objcopy --strip-unneeded -R .eh_frame efiboot.dll || goto ERROR
i686-elf-objcopy --add-gnu-debuglink=efiboot.debug efiboot.dll || goto ERROR
GenFw.exe -e UEFI_APPLICATION -o BOOTIA32.EFI efiboot.dll || goto ERROR
cecho {0a}done{#}{\n}
echo done

goto EOF

:ERROR
cecho {0C}Error{#}{\n}
echo Error
EXIT /B 1

:EOF
62 changes: 37 additions & 25 deletions efi_bootloader/lib/BUILD.BAT
Original file line number Diff line number Diff line change
@@ -1,82 +1,94 @@
@echo off
cd %~d0%~p0

cecho {0A}Building BaseDebugPrintErrorLevelLib...{#}{\n}
echo Building BaseDebugPrintErrorLevelLib...
cd BaseDebugPrintErrorLevelLib
call BUILD.BAT || goto ERROR
cd ..
cecho {0A}BaseDebugPrintErrorLevelLib was built{#}{\n\n}
echo BaseDebugPrintErrorLevelLib was built
echo.

cecho {0A}Building BaseLib...{#}{\n}
echo Building BaseLib...
cd BaseLib
call BUILD.BAT || goto ERROR
cd ..
cecho {0A}BaseLib was built{#}{\n\n}
echo BaseLib was built
echo.

cecho {0A}Building BaseMemoryLib...{#}{\n}
echo Building BaseMemoryLib...
cd BaseMemoryLib
call BUILD.BAT || goto ERROR
cd ..
cecho {0A}BaseMemoryLib was built{#}{\n\n}
echo BaseMemoryLib was built
echo.

cecho {0A}Building BasePcdLibNull...{#}{\n}
echo Building BasePcdLibNull...
cd BasePcdLibNull
call BUILD.BAT || goto ERROR
cd ..
cecho {0A}BasePcdLibNull was built{#}{\n\n}
echo BasePcdLibNull was built
echo.

cecho {0A}Building BasePrintLib...{#}{\n}
echo Building BasePrintLib...
cd BasePrintLib
call BUILD.BAT || goto ERROR
cd ..
cecho {0A}BasePrintLib was built{#}{\n\n}
echo BasePrintLib was built
echo.

cecho {0A}Building UefiApplicationEntryPoint...{#}{\n}
echo Building UefiApplicationEntryPoint...
cd UefiApplicationEntryPoint
call BUILD.BAT || goto ERROR
cd ..
cecho {0A}UefiApplicationEntryPoint was built{#}{\n\n}
echo UefiApplicationEntryPoint was built
echo.

cecho {0A}Building UefiBootServicesTableLib...{#}{\n}
echo Building UefiBootServicesTableLib...
cd UefiBootServicesTableLib
call BUILD.BAT || goto ERROR
cd ..
cecho {0A}UefiBootServicesTableLib was built{#}{\n\n}
echo UefiBootServicesTableLib was built
echo.

cecho {0A}Building UefiDebugLibStdErr...{#}{\n}
echo Building UefiDebugLibStdErr...
cd UefiDebugLibStdErr
call BUILD.BAT || goto ERROR
cd ..
cecho {0A}UefiDebugLibStdErr was built{#}{\n\n}
echo UefiDebugLibStdErr was built
echo.

cecho {0A}Building UefiDevicePathLib...{#}{\n}
echo Building UefiDevicePathLib...
cd UefiDevicePathLib
call BUILD.BAT || goto ERROR
cd ..
cecho {0A}UefiDevicePathLib was built{#}{\n\n}
echo UefiDevicePathLib was built
echo.

cecho {0A}Building UefiLib...{#}{\n}
echo Building UefiLib...
cd UefiLib
call BUILD.BAT || goto ERROR
cd ..
cecho {0A}UefiLib was built{#}{\n\n}
echo UefiLib was built
echo.

cecho {0A}Building UefiMemoryAllocationLib...{#}{\n}
echo Building UefiMemoryAllocationLib...
cd UefiMemoryAllocationLib
call BUILD.BAT || goto ERROR
cd ..
cecho {0A}UefiMemoryAllocationLib was built{#}{\n\n}
echo UefiMemoryAllocationLib was built
echo.

cecho {0A}Building UefiRuntimeServicesTableLib...{#}{\n}
echo Building UefiRuntimeServicesTableLib...
cd UefiRuntimeServicesTableLib
call BUILD.BAT || goto ERROR
cd ..
cecho {0A}UefiRuntimeServicesTableLib was built{#}{\n\n}
echo UefiRuntimeServicesTableLib was built
echo.

goto EOF

:ERROR
cecho {0C}Error{#}{\n}
echo Error
EXIT /B 1

:EOF
8 changes: 4 additions & 4 deletions efi_bootloader/lib/BaseDebugPrintErrorLevelLib/BUILD.BAT
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ cd %~d0%~p0
call CLEAN.BAT
mkdir obj >nul 2>&1

cecho {09}Compiling{0F}{\t}==^> BaseDebugPrintErrorLevelLib.c...{#}
echo|set /p dummy="Compiling ==> BaseDebugPrintErrorLevelLib.c..."
i686-elf-gcc -g -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -include src/AutoGen.h -fno-common -DSTRING_ARRAY_NAME=BaseDebugPrintErrorLevelLibStrings -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables -Wno-address -fno-pic -fno-pie -Os -D DISABLE_NEW_DEPRECATED_INTERFACES -c -o obj/BaseDebugPrintErrorLevelLib.obj -I../MdePkg -I../MdePkg/Include -I../MdePkg/Include/Ia32 src/BaseDebugPrintErrorLevelLib.c || exit /B 1
cecho {0a}done{#}{\n}
echo done

cecho {09}Creating Archive{0F}{\t}==^> BaseDebugPrintErrorLevelLib.lib...{#}
echo|set /p dummy="Creating Archive ==> BaseDebugPrintErrorLevelLib.lib..."
i686-elf-ar cr BaseDebugPrintErrorLevelLib.lib obj/BaseDebugPrintErrorLevelLib.obj || exit /B 1
cecho {0a}done{#}{\n}
echo done
26 changes: 14 additions & 12 deletions efi_bootloader/lib/BaseLib/BUILD.BAT
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@ mkdir obj\Ia32 >nul 2>&1

set CFLAGS=-g -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -include src/AutoGen.h -fno-common -DSTRING_ARRAY_NAME=BaseLibStrings -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables -Wno-address -fno-pic -fno-pie -Os -D DISABLE_NEW_DEPRECATED_INTERFACES -c -Isrc -Isrc/Ia32 -I../MdePkg/Include -I../MdePkg/Include/Ia32

cecho {09}Compiling{0F}{\t}==^> DivS64x64Remainder.c...{#}
echo|set /p dummy="Compiling ==> DivS64x64Remainder.c..."
i686-elf-gcc %CFLAGS% -o obj/Ia32/DivS64x64Remainder.obj src/Ia32/DivS64x64Remainder.c || exit /B 1
cecho {0a}done{#}{\n}
cecho {09}Compiling{0F}{\t}==^> GccInline.c...{#}
echo done
echo|set /p dummy="Compiling ==> GccInline.c..."
i686-elf-gcc %CFLAGS% -o obj/Ia32/GccInline.obj src/Ia32/GccInline.c || exit /B 1
cecho {0a}done{#}{\n}
cecho {09}Compiling{0F}{\t}==^> Non-existing.c...{#}
echo done
echo|set /p dummy="Compiling ==> Non-existing.c..."
i686-elf-gcc %CFLAGS% -o obj/Ia32/Non-existing.obj src/Ia32/Non-existing.c || exit /B 1
cecho {0a}done{#}{\n}
echo done

setlocal EnableDelayedExpansion

FOR %%G IN (src/*.c) DO (
set "xyz=%%G"
cecho {09}Compiling{0F}{\t}==^> %%G...{#}
echo|set /p dummy="Compiling ==> %%G..."
i686-elf-gcc %CFLAGS% -o obj/!xyz:~,-2!.obj src/%%G || exit /B 1
cecho {0a}done{#}{\n}
echo|set /p dummy="done"
echo.
)

endlocal
Expand All @@ -36,11 +37,12 @@ setlocal EnableDelayedExpansion
FOR %%G IN (src/Ia32/*.nasm) DO (
set "xyz=%%G"
set "yz=!xyz:~,-5!"
cecho {09}Assembling{0F}{\t}==^> %%G...{#}
echo|set /p dummy="Assembling ==> %%G..."
i686-elf-gcc %CFLAGS% src/Ia32/%%G > obj/Ia32/!yz!.i || exit /B 1
call Trim --trim-long --source-code -o obj/Ia32/!yz!.iii obj/Ia32/!yz!.i || exit /B 1
"nasm" %NASMFLAGS% -o obj/Ia32/!yz!.obj obj/Ia32/!yz!.iii || exit /B 1
cecho {0a}done{#}{\n}
echo|set /p dummy="done"
echo.
)


Expand All @@ -51,6 +53,6 @@ FOR /R obj %%G IN (*.obj) DO (

endlocal

cecho {09}Creating Archive{0F}{\t}==^> BaseLib.lib...{#}
echo|set /p dummy="Creating Archive ==> BaseLib.lib..."
i686-elf-ar cr BaseLib.lib @obj/object_files.lst || exit /B 1
cecho {0a}done{#}{\n}
echo done
9 changes: 5 additions & 4 deletions efi_bootloader/lib/BaseMemoryLib/BUILD.BAT
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ setlocal EnableDelayedExpansion

FOR %%G IN (src/*.c) DO (
set "xyz=%%G"
cecho {09}Compiling {0F}{\t}==^> %%G...{#}
echo|set /p dummy="Compiling ==> %%G..."
i686-elf-gcc %CFLAGS% -o obj/!xyz:~,-2!.obj src/%%G || exit /B 1
cecho {0a}done{#}{\n}
echo|set /p dummy="done"
echo.
)


Expand All @@ -22,6 +23,6 @@ FOR /R obj %%G IN (*.obj) DO (

endlocal

cecho {09}Creating Archive{0F}{\t}==^> BaseMemoryLib.lib...{#}
echo|set /p dummy="Creating Archive ==> BaseMemoryLib.lib..."
i686-elf-ar cr BaseMemoryLib.lib @obj/object_files.lst || exit /B 1
cecho {0a}done{#}{\n}
echo done
Loading