1. Build environment: Windows 7 x86
2. Prerequisites for downloading
To be installed in the following recommended order:
2.1 Visual Studio 2010 Pro
2.2 Windows Platform SDK v7.1
http://www.microsoft.com/en-us/download ... px?id=8279
2.3 Install Visual Studio 2010 Service Pack 1
2.4 Install Visual C++ 2010 SP1 Compiler Update for Windows SDK 7.1
http://www.microsoft.com/en-us/download ... px?id=4422
2.5 Windows Driver Development Kit (WDK) v7.1
http://www.microsoft.com/en-us/download ... n&id=11800
2.6 Python 2.7 (a version newer than 2.7 might cause building errors)
2.7 ActivePerl 5.20
2.8 MingW (32-bit Windows only):
GCC 3.3.3: http://prdownloads.sf.net/mingw/gcc-cor ... z?download
and http://prdownloads.sf.net/mingw/gcc-g++ ... z?download
Runtime: http://prdownloads.sf.net/mingw/mingw-r ... z?download
W32API: http://prdownloads.sf.net/mingw/w32api- ... z?download
Binutils 2.19: http://sourceforge.net/projects/mingw/f ... tils-2.19/
Note: All the packages need to be extracted and merged to the same root folder (e.g., C:\VBox\MinGW32-3.3.3\bin, C:\VBox\MinGW32-3.3.3\include, C:\VBox\MinGW32-3.3.3\lib)
Set C:\VBox\MinGW32-3.3.3\bin in PATH
2.9 SDL v1.2.15 or later development package http://www.libsdl.org/download-1.2.php
3. Prerequisites for building
3.1 Build QT 4.7.x or later
1)Download Qt-4.7.3 source code (qt-everywhere-opensource-src-4.7.3.tar.gz) from https://download.qt.io/archive/qt/4.7/ and extract to ..\qt-4.7.3
2)Download jom from https://wiki.qt.io/Jom and extract to ..\VBox\jom ("jom" is a clone of nmake to support the execution of multiple independent commands in parallel.)
3)Update the PATH variable to include ..\qt-4.7.3\bin
4)Open a VS2010 command prompt (Start > Programs > Microsoft Visual Studio 2010 > Visual Studio Tools > Visual Studio Command Prompt)
5)Go to the source code directory of qt 4.7.3 (..\qt-4.7.3\)
6)Set QMAKESPEC to the corresponding VS version
Code: Select all
e.g., set QMAKESPEC=C:\VBox\qt-4.7.3\mkspecs\win32-msvc2010
Code: Select all
configure -debug-and-release -opensource -platform win32-msvc2010
Code: Select all
Option 1: using jom –
C:\dev\VBox\qt-4.7.3>..\jom\jom.exe -j N
(Where N is number of CPU cores you want to utilize for Qt compilation. Larger is better.
Option 2: using nmake –
C:\dev\VBox\qt-4.7.3>nmake
1) Download source code from http://olex.openlogic.com/packages/open ... etail_tabs (Note: The header files under “..\openssl-xxx\include\openssl” always have 0 size when the package is downloaded. They are populated with links during the make phase.)
2) Open a VS2010 command prompt
3) Build Openssl
i. Install ActivePerl (e.g., at C:\Perl)
ii. Update the PATH variable to include ..\Perl\bin
iii. For 32-bit build: go to the OpenSSL source folder for (e.g. cd C:\VBox\openssl-1.0.1p\) to run configure commands:
Code: Select all
perl Configure VC-WIN32 --prefix=C:\VBox\openssl-1.0.1p\output
ms\do_ms
nmake -f ms\ntdll.mak
nmake -f ms\ntdll.mak install
3.3 Build cURL
1) Download source code from http://curl.haxx.se/download.html
2) Open a VS2010 command prompt
3) Go to the directory of the source code (e.g., C:\VBox\curl-7.35.0) and set OPENSSL_PATH to the openssl directory (e.g., set OPENSSL_PATH=..\..\openssl-xxx)
4) Build commands:
Code: Select all
pushd lib
nmake /f Makefile.vc10 cfg=release-dll
What VBox requires from cURL build output are
..\curl-7.35.0\include
..\ curl-7.35.0\lib\release-dll\libcurl.dll
..\ curl-7.35.0\lib\release-dll\libcurl_imp.lib (rename libcurl_imp.lib to libcurl.lib)
4 Build VirtualBox
4.1 Get source code of VBox (e.g., 5.0.0) from http://download.virtualbox.org/virtualb ... .0.tar.bz2 and extract to a folder (e.g., C:\VBox\VirtualBox-5.0.0)
4.2 Install Python and ActivePerl if they are not present
4.3 Open a VS2010 command prompt
4.4 Configure required libraries for VBox building:
Code: Select all
C:\VBox\VirtualBox-5.0.0>cscript configure.vbs --with-libSDL=C:\VBox\SDL-1.2.15 --with-openssl=C:\VBox\openssl-1.0.1p\output --with-libcurl=C:\VBox\curl-7.35.0 --with-QT4=C:\VBox\qt-4.7.3 --with-MinGW32=C:\VBox\MinGW32-3.3.3
If the configure command doesn’t succeed, please check “..\VirtualBox-5.0.0\configure.log” for errors.
If the script finds all the tools necessary, it will output two files: AutoConfig.kmk containing information where to find the tools on your system and env.bat, a batch file to setup your environment for building VirtualBox. You only have to execute this step once, unless something about your tools changes in which case you have to repeat the above step. Keep in mind that the script always overwrites the two generated files so you should not manually edit them.
4.5 To build an unhardening version of VBox, add the following in “..\VirtualBox-5.0.0\LocalConfig.kmk” (If LocalConfig.kmk doesn’t exit, create one).
Code: Select all
VBOX_WITH_HARDENING :=
4.6 Add the following in “..\VirtualBox-5.0.0\Makefile.kmk”
Code: Select all
VBOX_BLD_PYTHON=C:\Python27\python.exe
Code: Select all
env.bat
kmk
kmk KBUILD_TYPE=debug (for debug version)
Once VirtualBox is built successfully, there are a few steps to do before executing VirtualBox.exe:
5.1 Copy the following libraries to the same directory of VirtualBox.exe (e.g., C:\VBox\VirtualBox-5.0.0\out\win.x86\release\bin) or..\system32:
Code: Select all
libcurl.dll (e.g., from C:\VBox\curl-7.35.0\lib)
libeay32.dll (e.g., from C:\VBox\openssl-1.0.1p\output\bin)
ssleay32.dll (e.g., from C:\VBox\openssl-1.0.1p\output\bin)
QtCore4.dll (e.g., from C:\VBox\qt-4.7.3\bin)
QtGui4.dll (e.g., from C:\VBox\qt-4.7.3\bin)
QtNetwork4.dll (e.g., from C:\VBox\qt-4.7.3\bin)
QtOpenGL4.dll (e.g., from C:\VBox\qt-4.7.3\bin)
Code: Select all
comregister.cmd
loadall.cmd
5.3 Run VirtualBox.exe to load VirtualBox
6 Signing VBox
To create a signed version of VBox, steps in Section 3-5 need to be modified as follows:
6.1 creating and installing the test certificate
6.1.1 Launch an elevated command line shell
6.1.2 makecert.exe -r -pe -ss my -n "CN=MyTestCertificate" mytestcert.cer
6.1.3 certmgr.exe -add mytestcert.cer -s -r localMachine root
6.1.4 Start certmgr.exe and check that "MyTestCertificate" is listed both under "Personal" and "Trusted Root Certification Authorities".
6.1.5 Keep the mytestcert.cer file in a safe place
6.2 Configuring the system to run test signed code
6.2.1 Launch an elevated command line shell
6.2.2 Run the following on an elevated cmd.exe prompt
Code: Select all
Bcdedit.exe -set TESTSIGNING ON
Code: Select all
certmgr.exe -add mytestcert.cer -s -r localMachine root
certmgr.exe -add mytestcert.cer -s -r localMachine trustedpublisher
6.2.5 Windows 7: "Test Mode<CR>Windows 7<CR>Build 7601" will appear in the lower right corner
6.3 Building prerequisite dlls for VBox
6.3.1 In order to be loaded by signed VBox, the prerequisite dlls should get a link option “Integrity Check” set in the dll headers. Edit the following configure files before building the prerequisites in Setion 3 to get the right link headers.
in ..\qt-4.7.3\mkspecs\win32-msvc2010\qmake.conf, edited the value of flag QMAKE_LFLAGS_DLL to
Code: Select all
"QMAKE_LFLAGS_DLL = /DLL /INTEGRITYCHECK"
Code: Select all
"LFLAGS=/nologo /subsystem:console /opt:ref /debug /INTEGRITYCHECK"
"MLFLAGS= /nologo /subsystem:console /opt:ref /debug /dll /INTEGRITYCHECK"
In ..\curl-7.35.0-src\curl-7.35.0\lib\Makefile.vc10, change to the following
Code: Select all
"LNKDLL = link.exe /DLL /INTEGRITYCHECK"
6.3.3 Sign the built dlls using command
Code: Select all
Signtool.exe sign –v [name].dll
Code: Select all
libcurl.dll (e.g., from C:\VBox\curl-7.35.0\lib)
libeay32.dll (e.g., from C:\VBox\openssl-1.0.1p\output\bin)
ssleay32.dll (e.g., from C:\VBox\openssl-1.0.1p\output\bin)
QtCore4.dll (e.g., from C:\VBox\qt-4.7.3\bin)
QtGui4.dll (e.g., from C:\VBox\qt-4.7.3\bin)
QtNetwork4.dll (e.g., from C:\VBox\qt-4.7.3\bin)
QtOpenGL4.dll (e.g., from C:\VBox\qt-4.7.3\bin)
Code: Select all
Link.exe /dump /headers [name].dll
6.3.5 Copy and paste the above signed dlls to the same directory of VirtualBox.exe
6.4 Building VirtualBox with signing enabled
6.4.1 If you called the certificate something other than MyTestCertificate you'll have make the appropriate overrides in LocalConfig.kmk. See the Code Signing section of Config.kmk for what can be overridden
6.4.2 Remove the following from LocalConfig.kmk
Code: Select all
VBOX_WITH_HARDENING :=
Code: Select all
VBOX_SIGNING_MODE=test
6.4.5 Build VBox (incremental is sufficient) – refer to Section 4