Compiling Your Own WinDRBD: 1.2 Branch Preview

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:

ResolutionWith MSVCWith GCC
TODO.compat4745
TODO.cocci136
TODO.upstream33
TODO.manual2516
Total8870

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.

Conclusion

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.

Making History

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 inf2cat.exe utility.

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 README.md file.

Happy hacking (and be sure to send patches)!

Johannes Khoshnazar-Thoma

Johannes Khoshnazar-Thoma

Johannes Khoshnazar-Thoma is a freelance software developer with 20+ years of experience in the industry. He specializes on systems programming, including but not limited to Linux Kernel programming. Past projects include a real-time capable image chain for a medical X-Ray device as well as an early version of DRBD proxy. Johannes also plays Jazz Piano on a professional level and can be heard on Jam Sessions all over the world, including the Smalls in New York or the B flat in Berlin.

Talk to us

LINBIT is committed to protecting and respecting your privacy, and we’ll only use your personal information to administer your account and to provide the products and services you requested from us. From time to time, we would like to contact you about our products and services, as well as other content that may be of interest to you. If you consent to us contacting you for this purpose, please tick above to say how you would like us to contact you.

You can unsubscribe from these communications at any time. For more information on how to unsubscribe, our privacy practices, and how we are committed to protecting and respecting your privacy, please review our Privacy Policy.

By clicking submit below, you consent to allow LINBIT to store and process the personal information submitted above to provide you the content requested.

Talk to us

LINBIT is committed to protecting and respecting your privacy, and we’ll only use your personal information to administer your account and to provide the products and services you requested from us. From time to time, we would like to contact you about our products and services, as well as other content that may be of interest to you. If you consent to us contacting you for this purpose, please tick above to say how you would like us to contact you.

You can unsubscribe from these communications at any time. For more information on how to unsubscribe, our privacy practices, and how we are committed to protecting and respecting your privacy, please review our Privacy Policy.

By clicking submit below, you consent to allow LINBIT to store and process the personal information submitted above to provide you the content requested.