Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
gtrevi committed Mar 20, 2024
1 parent 9244e7b commit 37eb2c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions docs/InstallEbpf.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ has already built the binaries for `x64/Debug` or `x64/Release`.
### Method 3 (Install files you built yourself, with a VM checkpoint)

This method uses a machine that has already built the binaries for
the desired build configuration, i.e. `\x64\[Debug|Release|NativeOnlyDebug|NativeOnlyRelease]`.
the desired build configuration, i.e., `\x64\[Debug|Release|NativeOnlyDebug|NativeOnlyRelease]`.

Copy the build output in `\x64\[Debug|Release|NativeOnlyDebug|NativeOnlyRelease]` to the host of the test VM and run the following in a Powershell
command prompt:
Expand All @@ -134,8 +134,8 @@ Copy the build output in `\x64\[Debug|Release|NativeOnlyDebug|NativeOnlyRelease]
New-StoredCredential -Target TEST_VM -Username <VM Administrator> -Password <VM Administrator account password> -Persist LocalMachine
```

> Note that "`TEST_VM`" is literal and is later used to lookup the actual VM name; it need not be the name of any actual test VM.
1. Enter the desired directory (`cd`) where the build artifacts are stored (i.e. `\x64\[Debug|Release|NativeOnlyDebug|NativeOnlyRelease]`).
> Note that "`TEST_VM`" is literal and is later used to look up the actual VM name; it need not be the name of any actual test VM.
1. Enter the desired directory (`cd`) where the build artifacts are stored (i.e., `\x64\[Debug|Release|NativeOnlyDebug|NativeOnlyRelease]`).
1. Modify `.\test_execution.json` to specify the name of the test VM under the `VMMap` attribute, e.g.:

```json
Expand Down
18 changes: 9 additions & 9 deletions scripts/install_ebpf.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Import-Module $PSScriptRoot\common.psm1 -Force -ArgumentList ($LogFileName) -War
$VcRedistPath = Join-Path $WorkingDirectory "vc_redist.x64.exe"
$MsiPath = Join-Path $WorkingDirectory "ebpf-for-windows.msi"

# eBPF Drivers.
# eBPF drivers and services.
$EbpfDrivers = @{
"EbpfCore" = [PSCustomObject]@{
"Name" = "ebpfcore.sys"
Expand Down Expand Up @@ -147,8 +147,8 @@ function Install-eBPFComponents
[parameter(Mandatory=$false)] [bool] $KMDFVerifier = $false)

# Print the status of the eBPF drivers and services before installation.
# This is useful for detecting issues with the runner baselines!!
Print-eBPFComponentsStatus "Querying the status of eBPF drivers and services before the installation (all should not be present)..." | Out-Null
# This is useful for detecting issues with the runner baselines.
Print-eBPFComponentsStatus "Querying the status of eBPF drivers and services before the installation (none should be present)..." | Out-Null

# Install the Visual C++ Redistributable (Release version, which is required for the MSI installation).
Write-Log("Installing Visual C++ Redistributable from '$VcRedistPath'...")
Expand All @@ -162,12 +162,12 @@ function Install-eBPFComponents
Write-Log("Visual C++ Redistributable installation completed successfully!") -ForegroundColor Green

# Copy the VC debug runtime DLLs to the system32 directory,
# so that debug versions of the MSI can be installed (i.e. export_program_info.exe will not fail).
# so that debug versions of the MSI can be installed (i.e., export_program_info.exe will not fail).
Write-Log("Copying VC debug runtime DLLs to the $system32Path directory...")
# Test is the VC debug runtime DLLs are present in the working directory (indicating a debug build).
# Test if the VC debug runtime DLLs are present in the working directory (indicating a debug build).
$VCDebugRuntime = $VCDebugRuntime | Where-Object { Test-Path (Join-Path $WorkingDirectory $_) }
if (-not $VCDebugRuntime) {
Write-Log("VC debug runtime DLLs not found in the working directory (i.e. release build). Skipping this step.") -ForegroundColor Yellow
Write-Log("VC debug runtime DLLs not found in the working directory (i.e., release build). Skipping this step.") -ForegroundColor Yellow
} else {
$system32Path = Join-Path $env:SystemRoot "System32"
$VCDebugRuntime | ForEach-Object {
Expand Down Expand Up @@ -212,7 +212,7 @@ function Install-eBPFComponents
throw ("Failed to create $($_.Key) driver.")
} else {
Write-Log("$($_.Key) driver created.") -ForegroundColor Green
# Start the service
# Start the service.
Write-Log("Starting $($_.Key) service...") -ForegroundColor Green
sc.exe start $_.Key 2>&1 | Write-Log
if ($LASTEXITCODE -ne 0) {
Expand All @@ -236,7 +236,7 @@ function Install-eBPFComponents
}

# Print the status of the eBPF drivers and services after installation.
Print-eBPFComponentsStatus "Verifing the status of eBPF drivers and services after the installation..." | Out-Null
Print-eBPFComponentsStatus "Verifying the status of eBPF drivers and services after the installation..." | Out-Null

# Optionally enable KMDF verifier and tag tracking.
if ($KMDFVerifier) {
Expand All @@ -255,7 +255,7 @@ function Uninstall-eBPFComponents
Write-Log("Stopping $($_.Key) service...") -ForegroundColor Green
sc.exe stop $_.Key 2>&1 | Write-Log
if ($LASTEXITCODE -ne 0) {
throw ("Failed to stop $($_.Key) service.")
Write-Log("Failed to stop $($_.Key) service.") -ForegroundColor Red
} else {
Write-Log("$($_.Key) service stopped.") -ForegroundColor Green
}
Expand Down

0 comments on commit 37eb2c5

Please sign in to comment.