Skip to content

netdata/windows-driver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 

Netdata Windows Driver

Used for collecting hardware metrics that aren’t accessible through the regular Windows APIs, such as per-core CPU temperatures.

This is kept as a separate repository as it is versioned independently from the main Netdata Agent code due to code signing complexities for drivers.

Building

This repository builds the Windows kernel driver as netdata_driver.sys, stages netdata_driver.inf, and generates netdata_driver.cat for the driver package.

Prerequisites

  • Build on Windows using either:
    • an MSYS2 MinGW shell, or
    • a Microsoft Visual C++ compiler environment with the Windows Driver Kit (WDK) available.
  • Install CMake and a build tool such as Ninja or GNU Make.
  • For MSYS2 MinGW builds, install a MinGW toolchain capable of linking kernel32 and ntoskrnl.
  • For GNU-style Windows toolchains, ensure the Windows DDK headers are installed in a directory containing ntddk.h. Common MSYS2 layouts include /mingw64/include/ddk, /clang64/include/ddk, /ucrt64/include/ddk, and /usr/include/w32api/ddk.
  • If the headers live elsewhere, pass -DNETDATA_DRIVER_GNU_DDK_INCLUDE_DIR=<path> pointing to the directory that contains ntddk.h.
  • Install the Windows Driver Kit (WDK) so Inf2Cat is available during the Windows build.

Inf2Cat is mandatory for the Windows build. The repository root CMakeLists.txt now selects compiler-specific include paths and flags for GNU-style Windows toolchains and MSVC separately, and still generates netdata_driver.cat during the normal Windows build.

Configure

Preferred helper script:

./packaging/compile-on-msys.sh

MSVC helper script:

.\packaging\compile-on-msvc.ps1

Manual configure command:

cmake -S . -B build -G Ninja

If Ninja is not available, use:

cmake -S . -B build -G "Unix Makefiles"

For MSVC/WDK environments, use .\packaging\compile-on-msvc.ps1, or run CMake manually with a Visual Studio generator or Ninja from a developer prompt where the WDK include and library paths are already configured. For example:

cmake -S . -B build -G Ninja

Build

If you used the helper script, it already performs this step.

Manual build command:

cmake --build build

Install

To install the generated files using CMake's install rules:

cmake --install build

By default, installation uses CMAKE_INSTALL_BINDIR. If BINDIR is provided by a parent CMake project, that value is used instead.

To stage the installed files into /opt/netdata and build the MSI using the repository helper:

./packaging/package-windows.sh

Set BUILD_DIR, PACKAGE_ROOT, WIX_BIN, WIX_ARCH, WIX_SOURCE, or WIX_OUTPUT if you need to override the default build directory, staging root, WiX executable, or WiX output settings. WIX_SOURCE and WIX_OUTPUT are evaluated from inside the build directory by default.

Build Outputs

After a successful build, the main artifacts are:

  • build/netdata_driver.sys
  • build/netdata_driver.inf
  • build/netdata_driver.cat

Notes

  • packaging/compile-on-msys.sh checks the required binaries before building, auto-detects a supported MSYS2 DDK include directory, and uses build/ as the output directory.
  • packaging/compile-on-msys.sh auto-detects Inf2Cat.exe from the default Windows Kits 10 installation directory when it is not already on PATH.
  • packaging/compile-on-msvc.ps1 defaults to build-msvc/ and selects Ninja when both ninja and cl are already available; otherwise it falls back to Visual Studio 17 2022.
  • packaging/compile-on-msvc.ps1 uses CMAKE_BUILD_TYPE as the configuration name for multi-config generators. The default is RelWithDebInfo.
  • packaging/compile-on-msvc.sh is retained only as a compatibility wrapper that forwards to the PowerShell script.
  • NETDATA_DRIVER_GNU_DDK_INCLUDE_DIR controls where GNU-style Windows builds look for ntddk.h. The configure step auto-detects a supported MSYS2 DDK include directory when possible.
  • packaging/package-windows.sh installs the generated driver package artifacts from build/ into /opt/netdata by default, then changes into build/ and runs wix build there so the packaged assets resolve correctly.
  • cmake -S . -B build now also stages Windows installer assets into build/, including build/netdata_driver.wxs.
  • Override the Inf2Cat OS target list with -DNETDATA_DRIVER_INF2CAT_OS=<comma-separated-identifiers> if you need a different Windows support matrix.
  • packaging/package-windows.sh uses wix from PATH when available, otherwise it probes common WiX installation directories and builds build/netdata-driver-x64.msi by default.
  • This repository currently documents the build flow, but the commands have not been validated in this repository yet.
  • Driver signing is not handled by this repository CMake file.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Contributors