While still maintaining the WinDRBD 1.1 stable branch work on the WinDRBD 1.2 development branch has been started. Having a stable branch (1.1) and a development branch (1.2) allows us to reengineer many things in the source code and the build system while still being able to provide LINBIT® clients a stable and mature solution.
Considerations Before Switching Branches
Unless you want to develop for WinDRBD®, using the 1.2 branch is not recommended as of today (September 2023). Because this branch introduces many new features in various stages of implementation, it might take up to a year until the 1.2 branch can be used in production environments. So, if you are using WinDRBD 1.1, don’t switch now. Also, because we are conservative about changing the source code for the 1.1 branch and will maintain it for a longer time, you can safely run your production setup with the 1.1 branch.
Introducing New Features
The impetus for having a 1.2 branch arose from the fact that patches applied to the original DRBD® source code became unmaintainable. It was just not possible to base WinDRBD on the DRBD 9.1 branch and the DRBD 9.2 branch by using a single WinDRBD branch.
We spent some time on researching how we could implement the new patching system. As a result, we grouped DRBD patches into four categories, in decreasing order of desirability of how we would like to implement them:
- Implement the missing feature in the Linux kernel compatibility layer.
- Use Coccinelle to create a generic patch.
- Have a change merged into the upstream DRBD source code.
- Maintain a manual patch on a DRBD branch.
As of now the number of TODOs for the above categories are:
|Resolution||With MSVC||With GCC|
As the table shows, most of the patches can be resolved by implementing missing features in the compatibility layer. Also, by using GCC to compile WinDRBD rather than Microsoft Visual C++ (MSVC), the number of patches is reduced. This is because the required patches for GCC extensions when compiling with MSVC are unnecessary.
Building WinDRBD on Linux
The second change (one that is implemented already) is the reengineering of the build process. The WinDRBD 1.1 build process is very cumbersome, requiring two machines (one Linux and one Windows), some manual patches to the Makefiles, and in general is not straight forward.
For the new build process to work on Linux we created an open source tool called
generate-cat-file which generates the Microsoft Windows security catalog files containing signatures of all other files in the driver package. This tool has very few dependencies. It should run wherever a C99 compiler and a
sha1sum binary are present. You can think of it as a replacement for the Microsoft
inf2cat.exe utility. Don’t worry about whether your Linux distribution has this tool. Building it is part of the new WinDRBD build process itself.
In addition, the new build process has all the subprojects that the process uses as
git submodules so there is no need anymore to download, for example, the
drbd-utils code and build it separately.
So that WinDRBD can be more universally built, LINBIT provides a ready-to-pull Docker container. If you have Docker installed, you can start building WinDRBD by entering just one line:
make pull-docker && make package-in-docker
Of course if you really want you can also install the build dependencies (two cross compilers, Wine, Inno Setup, and others) on your Linux host machine. There is an
INSTALL.md file that describes what you need to install to build WinDRBD locally.
Developing on a
development and a
stable branch is very common in software engineering. It allows the developer to maintain stability for existing installations while also being able to reengineer different parts of the source code when necessary.
For WinDRBD this means that the 1.1 branch is meant for production use and will receive only small fixes while the 1.2 branch is meant for larger changes. One aspect of the 1.2 branch is that the build process has been radically simplified.
You can now build WinDRBD entirely in Linux, by virtue of the
generate-cat-file tool. This could be the first time that a 64 bit Windows driver can be built solely with open source tools. Prior to LINBIT creating the
generate-cat-file tool, it was necessary to use the Microsoft proprietary
The WinDRBD Build Process In Action
If you want to experience the new build process in action, just visit the WinDRBD 1.2 branch in the project’s public repository on GitHub and follow the simple instructions at the top of the
Happy hacking (and be sure to send patches)!