Compare commits
3 Commits
cfdb21e905
...
10e2112faf
Author | SHA1 | Date | |
---|---|---|---|
10e2112faf | |||
a3135a1c56 | |||
c2fc23c327 |
|
@ -154,7 +154,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)\gnu-efi\inc;$(SolutionDir)\gnu-efi\inc\x86_64</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)inc;$(SolutionDir)\gnu-efi\inc;$(SolutionDir)\gnu-efi\inc\x86_64</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_UNICODE;UNICODE;HAVE_USE_MS_ABI;GNU_EFI_USE_EXTERNAL_STDARG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_UNICODE;UNICODE;HAVE_USE_MS_ABI;GNU_EFI_USE_EXTERNAL_STDARG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ExceptionHandling>false</ExceptionHandling>
|
<ExceptionHandling>false</ExceptionHandling>
|
||||||
<CompileAs>CompileAsC</CompileAs>
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
@ -386,11 +386,18 @@
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\main.c" />
|
<ClCompile Include="..\..\src\bootloader.c" />
|
||||||
|
<ClCompile Include="..\..\src\gfx.c" />
|
||||||
|
<ClCompile Include="..\..\src\main.c" />
|
||||||
|
<ClCompile Include="..\..\src\memory.c" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\..\debug.vbs" />
|
<None Include="..\..\debug.vbs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\inc\ELF.h" />
|
||||||
|
<ClInclude Include="BL.h" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
|
|
@ -19,8 +19,25 @@
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\main.c">
|
<ClCompile Include="..\..\src\bootloader.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\gfx.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\main.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\memory.c">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="BL.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\inc\ELF.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Binary file not shown.
42
build.sh
Normal file
42
build.sh
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
set +v
|
||||||
|
|
||||||
|
|
||||||
|
CurrentDir = $PWD
|
||||||
|
GCC-NAME = x86_64-w64-mingw
|
||||||
|
EFI-FOLDER = gnu-efi
|
||||||
|
|
||||||
|
Linker="$EFI-FOLDER/gnuefi/elf_x86_64_efi.lds"
|
||||||
|
|
||||||
|
cd ./x64
|
||||||
|
|
||||||
|
rm objects.list
|
||||||
|
|
||||||
|
HeaderFiles=-I$CurrentDir/inc/ \
|
||||||
|
-I$CurrentDir/gnu-efi/inc \
|
||||||
|
-I$CurrentDir/gnu-efi/inc/x86_64 \
|
||||||
|
-I$CurrentDir/gnu-efi/inc/protocol \
|
||||||
|
-I$CurrentDir/gnu-efi/lib
|
||||||
|
|
||||||
|
|
||||||
|
set -v
|
||||||
|
for f in $CurrentDir/src/*.c; do
|
||||||
|
echo "$GCC-NAME-gcc" -ffreestanding -fpic -fshort-wchar -fno-stack-protector -fno-stack-check -fno-strict-aliasing -fno-merge-all-constants -m64 -mno-redzone -DGNU_USE_MS_ABI -maccumulate-outgoing-args --std=c11 $HeaderFiles -Og -g3 -Wall -Wextra -Wdouble-promotion -fmessage-length=0 -c -MMD -MP -Wa,-adhln="${f%.*}.out" -MF"${f%.*}.d" -MT"${f%.*}.o" -o "${f%.*}.o" "$f"
|
||||||
|
"$GCC-NAME-gcc" -ffreestanding -fpic -fshort-wchar -fno-stack-protector -fno-stack-check -fno-strict-aliasing -fno-merge-all-constants -m64 -mno-redzone -DGNU_USE_MS_ABI -maccumulate-outgoing-args --std=c11 $HeaderFiles -Og -g3 -Wall -Wextra -Wdouble-promotion -fmessage-length=0 -c -MMD -MP -Wa,-adhln="${f%.*}.out" -MF"${f%.*}.d" -MT"${f%.*}.o" -o "${f%.*}.o" "$f"
|
||||||
|
done
|
||||||
|
|
||||||
|
set +v
|
||||||
|
|
||||||
|
while read f; do
|
||||||
|
echo "${f%.*}.o" | tee -a objects.list
|
||||||
|
done < $CurrentDir/c_files.txt
|
||||||
|
|
||||||
|
for f in $CurrentDir/src/*.o; do
|
||||||
|
echo "$f" | tee -a objects.list
|
||||||
|
done
|
||||||
|
|
||||||
|
set -v
|
||||||
|
"$GCC-NAME-ld" -T$Linker -nostdlib --warn-common --no-undefined -znocombreloc -s -shared -Bsymbolic -Map=output.map -o "program.so" @"objects.list"
|
||||||
|
set +v
|
||||||
|
|
||||||
|
rm image/efi/boot/BOOTx64.efi
|
||||||
|
objcopy -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .rel* -j .reloc --target=efi-app-x86_64 "program.so" "image/efi/boot/BOOTx64.efi"
|
30
c_files.txt
Normal file
30
c_files.txt
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
gnu-efi/lib/misc.c
|
||||||
|
gnu-efi/lib/print.c
|
||||||
|
gnu-efi/lib/smbios.c
|
||||||
|
gnu-efi/lib/sread.c
|
||||||
|
gnu-efi/lib/str.c
|
||||||
|
gnu-efi/lib/boxdraw.c
|
||||||
|
gnu-efi/lib/cmdline.c
|
||||||
|
gnu-efi/lib/console.c
|
||||||
|
gnu-efi/lib/crc.c
|
||||||
|
gnu-efi/lib/data.c
|
||||||
|
gnu-efi/lib/debug.c
|
||||||
|
gnu-efi/lib/dpath.c
|
||||||
|
gnu-efi/lib/error.c
|
||||||
|
gnu-efi/lib/event.c
|
||||||
|
gnu-efi/lib/exit.c
|
||||||
|
gnu-efi/lib/guid.c
|
||||||
|
gnu-efi/lib/hand.c
|
||||||
|
gnu-efi/lib/hw.c
|
||||||
|
gnu-efi/lib/init.c
|
||||||
|
gnu-efi/lib/lock.c
|
||||||
|
gnu-efi/lib/x86_64/callwrap.c
|
||||||
|
gnu-efi/lib/x86_64/efi_stub.S
|
||||||
|
gnu-efi/lib/x86_64/initplat.c
|
||||||
|
gnu-efi/lib/x86_64/math.c
|
||||||
|
gnu-efi/lib/x86_64/setjmp.S
|
||||||
|
gnu-efi/lib/runtime/efirtlib.c
|
||||||
|
gnu-efi/lib/runtime/rtdata.c
|
||||||
|
gnu-efi/lib/runtime/rtlock.c
|
||||||
|
gnu-efi/lib/runtime/rtstr.c
|
||||||
|
gnu-efi/lib/runtime/vm.c
|
|
@ -974,7 +974,7 @@ EFI_STATUS LoadKernel(EFI_HANDLE ImageHandle, GFX_INFO* Graphics, EFI_CONFIGURAT
|
||||||
AwaitKey(L"\0");
|
AwaitKey(L"\0");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
KernelStatus = IMAGE_FILE_EXECUTABLE_IMAGE;
|
KernelStatus = DOS_EXECUTABLE;
|
||||||
Print(L"\r\n Error 0x%llx: This file cannot be run in UEFI mode.\r\n", KernelStatus);
|
Print(L"\r\n Error 0x%llx: This file cannot be run in UEFI mode.\r\n", KernelStatus);
|
||||||
return KernelStatus;
|
return KernelStatus;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,6 +129,7 @@ EFI_STATUS InitGfx(EFI_HANDLE ImageHandle, GFX_INFO* Graphics) {
|
||||||
#ifdef GFX_DEBUG_NAMING
|
#ifdef GFX_DEBUG_NAMING
|
||||||
Print(L"Number of NAME2 handles: %llu\r\n", NumName2Handles);
|
Print(L"Number of NAME2 handles: %llu\r\n", NumName2Handles);
|
||||||
Print(L"Number of Device Path handles: %llu\r\n", NumDevicePathHandles);
|
Print(L"Number of Device Path handles: %llu\r\n", NumDevicePathHandles);
|
||||||
|
AwaitKey(L"\0");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (DeviceInd = 0; DeviceInd < NumGfxHandles; DeviceInd++) {
|
for (DeviceInd = 0; DeviceInd < NumGfxHandles; DeviceInd++) {
|
||||||
|
@ -283,7 +284,7 @@ EFI_STATUS InitGfx(EFI_HANDLE ImageHandle, GFX_INFO* Graphics) {
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef GFX_DEBUG_NAMING
|
#ifdef GFX_DEBUG_NAMING
|
||||||
Print(L"Name2Device GetController ChildName error: 0x%llu\r\n", GfxStatus);
|
Print(L"Name2Device GetController ChildName error: 0x%llx\r\n", GfxStatus);
|
||||||
#endif
|
#endif
|
||||||
ChildDisplayName = DefaultChildName;
|
ChildDisplayName = DefaultChildName;
|
||||||
}
|
}
|
||||||
|
@ -483,7 +484,7 @@ EFI_STATUS InitGfx(EFI_HANDLE ImageHandle, GFX_INFO* Graphics) {
|
||||||
// CatPrint solves an edgecase in GNU-EFI relating to an off-by-one error.
|
// CatPrint solves an edgecase in GNU-EFI relating to an off-by-one error.
|
||||||
|
|
||||||
POOL_PRINT StringName = { 0 };
|
POOL_PRINT StringName = { 0 };
|
||||||
CatPrint(&StringName, L"%c. %s: %s @ Memory Address 0xllx, using %s\r\n", DeviceInd + 0x30 /* Shift into the ASCII numbers */, ControllerDisplayName, ChildDisplayName, GraphicsHandles[DeviceInd], DriverDisplayName);
|
CatPrint(&StringName, L"%c. %s: %s @ Memory Address 0x%llx, using %s\r\n", DeviceInd + 0x30 /* Shift into the ASCII numbers */, ControllerDisplayName, ChildDisplayName, GraphicsHandles[DeviceInd], DriverDisplayName);
|
||||||
NameBuffer[DeviceInd] = StringName.str;
|
NameBuffer[DeviceInd] = StringName.str;
|
||||||
|
|
||||||
#ifdef GFX_DEBUG_NAMING
|
#ifdef GFX_DEBUG_NAMING
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,2 +1,14 @@
|
||||||
main.c
|
bootloader.c
|
||||||
|
c:\users\gem\documents\red\src\bootloader.c(221): warning C4022: 'Compare': pointer mismatch for actual parameter 2
|
||||||
|
c:\users\gem\documents\red\src\bootloader.c(226): warning C4022: 'Compare': pointer mismatch for actual parameter 2
|
||||||
|
c:\users\gem\documents\red\src\bootloader.c(373): warning C4133: 'function': incompatible types - from 'char [43]' to 'CHAR16 *'
|
||||||
|
c:\users\gem\documents\red\src\bootloader.c(641): warning C4013: 'FindFreeAddress_ByPage' undefined; assuming extern returning int
|
||||||
|
gfx.c
|
||||||
|
c:\users\gem\documents\red\src\gfx.c(642): warning C4047: 'function': 'BOOLEAN' differs in levels of indirection from 'void *'
|
||||||
|
c:\users\gem\documents\red\src\gfx.c(642): warning C4024: 'function through pointer': different types for formal and actual parameter 2
|
||||||
|
c:\users\gem\documents\red\src\gfx.c(645): warning C4047: 'function': 'BOOLEAN' differs in levels of indirection from 'void *'
|
||||||
|
c:\users\gem\documents\red\src\gfx.c(645): warning C4024: 'function through pointer': different types for formal and actual parameter 2
|
||||||
|
c:\users\gem\documents\red\src\gfx.c(45): warning C4101: 'GfxInfoSize': unreferenced local variable
|
||||||
|
Generating Code...
|
||||||
|
c:\users\gem\documents\red\src\bootloader.c(1445): warning C4700: uninitialized local variable 'LoaderBlock' used
|
||||||
uefi-simple.vcxproj -> C:\Users\Gem\Documents\red\x64\Debug\uefi-simple.efi
|
uefi-simple.vcxproj -> C:\Users\Gem\Documents\red\x64\Debug\uefi-simple.efi
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user