Skip to content

Commit

Permalink
add version
Browse files Browse the repository at this point in the history
* Also fix a Coverity warning
  • Loading branch information
pbatard committed Jul 15, 2021
1 parent 584eb41 commit 60c3c3a
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/coverity.yml
Expand Up @@ -14,6 +14,7 @@ jobs:
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive

- name: Download Coverity
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/windows.yml
Expand Up @@ -18,6 +18,7 @@ jobs:
- name: Check out repository and submodules
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive

- name: Add MSBuild to PATH
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -13,3 +13,4 @@ aa64
ia32
x64
image
version.h
72 changes: 72 additions & 0 deletions .vs/uefi-ntfs.vcxproj
Expand Up @@ -103,6 +103,7 @@
<OutDir>$(SolutionDir)x64\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
<TargetName>bootx64</TargetName>
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetExt>.efi</TargetExt>
Expand All @@ -111,6 +112,7 @@
<OutDir>$(SolutionDir)ia32\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
<TargetName>bootia32</TargetName>
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<TargetExt>.efi</TargetExt>
Expand All @@ -119,6 +121,7 @@
<OutDir>$(SolutionDir)arm\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
<TargetName>bootarm</TargetName>
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<TargetExt>.efi</TargetExt>
Expand All @@ -127,6 +130,7 @@
<OutDir>$(SolutionDir)aa64\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
<TargetName>bootaa64</TargetName>
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetExt>.efi</TargetExt>
Expand All @@ -135,6 +139,7 @@
<OutDir>$(SolutionDir)x64\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
<TargetName>bootx64</TargetName>
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetExt>.efi</TargetExt>
Expand All @@ -143,6 +148,7 @@
<OutDir>$(SolutionDir)ia32\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
<TargetName>bootia32</TargetName>
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<TargetExt>.efi</TargetExt>
Expand All @@ -151,6 +157,7 @@
<OutDir>$(SolutionDir)arm\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
<TargetName>bootarm</TargetName>
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<TargetExt>.efi</TargetExt>
Expand All @@ -159,6 +166,7 @@
<OutDir>$(SolutionDir)aa64\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
<TargetName>bootaa64</TargetName>
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
Expand Down Expand Up @@ -189,6 +197,14 @@
<OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress />
</Link>
<PreBuildEvent>
<Command>del version.h &gt;NUL 2&gt;&amp;1
git describe --tags --dirty &gt; version.txt
set /p VERSION= &lt; version.txt
del version.txt
echo #define VERSION_STRING L"%VERSION%"&gt; $(SolutionDir)version.h</Command>
<Message>Create 'version.h'</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand Down Expand Up @@ -220,6 +236,14 @@
<TargetMachine>MachineX86</TargetMachine>
<RandomizedBaseAddress />
</Link>
<PreBuildEvent>
<Command>del version.h &gt;NUL 2&gt;&amp;1
git describe --tags --dirty &gt; version.txt
set /p VERSION= &lt; version.txt
del version.txt
echo #define VERSION_STRING L"%VERSION%"&gt; $(SolutionDir)version.h</Command>
<Message>Create 'version.h'</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<ClCompile>
Expand Down Expand Up @@ -250,6 +274,14 @@
<OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress />
</Link>
<PreBuildEvent>
<Command>del version.h &gt;NUL 2&gt;&amp;1
git describe --tags --dirty &gt; version.txt
set /p VERSION= &lt; version.txt
del version.txt
echo #define VERSION_STRING L"%VERSION%"&gt; $(SolutionDir)version.h</Command>
<Message>Create 'version.h'</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<ClCompile>
Expand Down Expand Up @@ -280,6 +312,14 @@
<OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress />
</Link>
<PreBuildEvent>
<Command>del version.h &gt;NUL 2&gt;&amp;1
git describe --tags --dirty &gt; version.txt
set /p VERSION= &lt; version.txt
del version.txt
echo #define VERSION_STRING L"%VERSION%"&gt; $(SolutionDir)version.h</Command>
<Message>Create 'version.h'</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
Expand Down Expand Up @@ -308,6 +348,14 @@
<OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress />
</Link>
<PreBuildEvent>
<Command>del version.h &gt;NUL 2&gt;&amp;1
git describe --tags --dirty &gt; version.txt
set /p VERSION= &lt; version.txt
del version.txt
echo #define VERSION_STRING L"%VERSION%"&gt; $(SolutionDir)version.h</Command>
<Message>Create 'version.h'</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
Expand Down Expand Up @@ -336,6 +384,14 @@
<OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress />
</Link>
<PreBuildEvent>
<Command>del version.h &gt;NUL 2&gt;&amp;1
git describe --tags --dirty &gt; version.txt
set /p VERSION= &lt; version.txt
del version.txt
echo #define VERSION_STRING L"%VERSION%"&gt; $(SolutionDir)version.h</Command>
<Message>Create 'version.h'</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<ClCompile>
Expand Down Expand Up @@ -364,6 +420,14 @@
<OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress />
</Link>
<PreBuildEvent>
<Command>del version.h &gt;NUL 2&gt;&amp;1
git describe --tags --dirty &gt; version.txt
set /p VERSION= &lt; version.txt
del version.txt
echo #define VERSION_STRING L"%VERSION%"&gt; $(SolutionDir)version.h</Command>
<Message>Create 'version.h'</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<ClCompile>
Expand Down Expand Up @@ -392,6 +456,14 @@
<OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress />
</Link>
<PreBuildEvent>
<Command>del version.h &gt;NUL 2&gt;&amp;1
git describe --tags --dirty &gt; version.txt
set /p VERSION= &lt; version.txt
del version.txt
echo #define VERSION_STRING L"%VERSION%"&gt; $(SolutionDir)version.h</Command>
<Message>Create 'version.h'</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\boot.c" />
Expand Down
7 changes: 5 additions & 2 deletions boot.c
Expand Up @@ -22,6 +22,9 @@
#include <efistdarg.h>
#include <libsmbios.h>

/* The following is autogenerated by the build process */
#include "version.h"

#define FILE_INFO_SIZE (512 * sizeof(CHAR16))
#define NUM_RETRIES 1
#define DELAY 3 // delay before retry, in seconds
Expand Down Expand Up @@ -453,7 +456,7 @@ EFI_STATUS efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
// The platform logo may still be displayed → remove it
SystemTable->ConOut->ClearScreen(SystemTable->ConOut);

Print(L"\n%H*** UEFI:NTFS (%s) ***%N\n\n", Arch);
Print(L"\n%H*** UEFI:NTFS %s (%s) ***%N\n\n", VERSION_STRING, Arch);
PrintSystemInfo();

Status = gBS->OpenProtocol(MainImageHandle, &gEfiLoadedImageProtocolGuid,
Expand Down Expand Up @@ -626,7 +629,7 @@ EFI_STATUS efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
}
// Get the volume label while we're at it
VolumeInfo = LibFileSystemVolumeLabelInfo(Root);
if ((VolumeInfo->VolumeLabel != NULL) && (VolumeInfo->VolumeLabel[0] != 0))
if ((VolumeInfo != NULL) && (VolumeInfo->VolumeLabel[0] != 0))
PrintInfo(L" Volume label is '%s'", VolumeInfo->VolumeLabel);

PrintInfo(L"This system uses %s UEFI => searching for %s EFI bootloader", ArchName, Arch);
Expand Down

0 comments on commit 60c3c3a

Please sign in to comment.