Skip to content

Windows Build Machine

stefanopanella edited this page Jun 17, 2014 · 35 revisions

This page describes how to create a build machine to build the windows components of OpenXT.

The Making of a Build Machine

Install Windows

Simple, either set up a native install or VM. In addition, currently all build machines run windows 7 32 bit so deviate from this at your own risk. The setup and build scripts should work on 32 and 64 bit Windows7 and on Windows 2008 R2 according to the previous author, but personally writing this right now I only guarantee Win 7 32 bit.

Before You Start

All of the scripts to create a build machine (bare metal or VM) are stored in https://github.com/OpenXT/openxt/tree/master/windows/mkbuildmachine. Consider the following before starting the process of making a build machine:

Any Machine

  • The installation process should be done logged in as the Administrator or with an account that has administrative access ('''and UAC turned off'''). To turn off UAC, hit start, type UAC, select "Change User Account Control Settings" and set slider to "never notify".
  • To be on the safe side, '''disable''' Power Management features like Sleep after a certain period. (A '''must''' for build-slaves)
  • The C: drive should be at least '''60G''' just to handle all the tools that need to be installed.
  • '''Turn off''' Automatic Windows Updates as they can cause automatic reboots of the system. Suggest selecting the option "Download but let me choose when to install".
  • The system should be Activated with a valid windows licence to allow the various software packages to install and update correctly. This should have been done when you installed Windows but if you haven't this is just a reminder...
  • As the setup script will cause multiple reboots it is a good idea to setup autologon for the account used to run the setup scripts. From an administrator command prompt type "control userpasswords2" select the account and uncheck "Users must enter name and password" or use SysInternals' Autologon.exe.
  • Run powershell as an Administrator and enter the command "Set-ExecutionPolicy Unrestricted"

VM

  • If a build machine is being installed on a OpenXT VM, it is recommended that you install the OpenXT tools. It will make the VM faster.

Before You Start

  • Check the UAC is turned off
  • Check that no login screen shows after reboot

Ready To Start

To start the process, you need to get the winbuild-setup.ps1 and config.xml files. Open Internet Explorer and visit the following URL:

https://raw.githubusercontent.com/OpenXT/openxt/master/windows/mkbuildmachine/winbuild-setup.ps1

Copy the content of the URL to a file called winbuild-setup.ps1 to somewhere suitable on your PC.

Than visit the URL:

https://raw.githubusercontent.com/OpenXT/openxt/master/windows/mkbuildmachine/config.xml

Copy the content of the URL to a file called say config.xml next to winbuild-setup.ps1.

To kick off the installation of all the software needed on the build machine run winbuild-setup.ps1 from an Administrator cmd prompt as shown here:

powershell ./winbuild-setup.ps1 config.xml

This will cause the Machine to reboot several times. Wait until all is finished.

Further Setup

Now all the software required by the build system is installed, there is however still yet more to do. For example:

  • Windows update should be run to pick up all the security updates for the newly installed build tools and Windows itself. Either do this manually or set updates to self-install again.
  • Consider disabling the auto-logon.

Certificates

To run windows builds requires the signing of drivers and executables in several places, as such you need a signing certificate. Depending what you'll be using your new build machine for, use one of the two following guides:

Development

Being a developer, you should not have access to machines with official signing certificates installed on them - if you do you better have good reasons for why. Regardless, you still need to be able to actually create test builds for your new shiny code, meaning you first need to create a test certificate for your machine. This whole process has been scripted for you and can be done as follows:

visit the following URL:

https://raw.githubusercontent.com/OpenXT/openxt/master/windows/mkbuildmachine/makecert.bat

Copy the content of the URL to a file called makecert.bat to somewhere suitable on your PC.

Run "makecert.bat " at an Administrator command prompt, e.g. "makecert.bat developer"

For good measure, what this script actually does is simple. First it creates the bits needed to sign code, wraps them into a pfx file and then adds this file to the User's personal certificate store. To test that everything went okay either run certmgr.msc or add the certificates snap in to mmc.exe. Either example should show the newly created signing key under "Certificates (Current User) -> Personal -> Certificates".

Official Builds

An official signing certificate and key will need to be installed on the new build machine for release signed builds. This key should be installed on production build machines only by authorised Administrators.

NOTE:

The signing step in the build uses the Issuer Id of the certificate to locate the cert/key in the store. This name is sometimes the same for older and newer certificates - e.g. "John Doe, Inc". This can lead to a name collision if older expired certificates have the same Issuer Id and cause signing to fail. It is recommended that you remove expired certificates first before installing a new one.