Skip to content
Nobody Knows edited this page May 12, 2013 · 3 revisions

Howto Build Clover by apianti

This is a work in progess

I find that it's often beneficial to build things yourself when you're having trouble. Build errors (and warnings) provide the most information about bugs and are often different based on different build environments and therefore target execution environments. If you have two identical commercially manufactured computers, you can't be sure that even they have the same environment. Therefore getting more people to build clover would be beneficial to it's advancement. This topic is meant to firstly getting you started, then get clover, build it and finally report your progress or get help. I'm going to assume you have a basic knowledge of your build environment. You'll need to know how to use a terminal/command prompt to at least navigate file systems.

Alright, to get started you're going to need a few things. So jump to which OS you will be using to build (Note: The package can only be built on Mac OS X):

#####Mac OS X

If you're on OS X, you'll need to install Xcode, (GNU GCC toolset, git) and subversion. Subversion and git should be included in the Xcode command line tools, which are installed by default in versions previous to Xcode 4(?). Xcode 4 users will have to open Xcode preferences goto the Downloads section and install the tools.

You can also use [CloverGrower] or [CloverGrowerPro] to automate the compilation process under OS X.

#####Linux

In Linux you'll need the GNU GCC toolset, and subversion. These are usually included or installed easily through a package. If not though here are some links;

Binary packages of subversion Howto Install the GNU GCC toolset

To get started open a terminal and change to a directory you're comfortable putting the source. I will refer to that directory as SOURCEDIR. You should probably use your home directory or the desktop. To check out the tianocore EDK2 sources use the following command;

####### svn co https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2 edk2

This will download EDK2. After a while it should say Checked out revision XXXX.

Now execute these commands to get the Clover sources:

####### cd edk2 ####### svn co svn://svn.code.sf.net/p/cloverefiboot/code Clover

It should now also say Checked out revision XXXX

Let's edit the EDK2 configuration so it knows which toolset we are using. Execute this:

####### ./edksetup.sh

After that you're going to need to open SOURCEDIR/edk2/Conf/target.txt in your favorite text editor. The active platform is the current package that's being built, it defaults to something we don't want. We're going to change it to;

ACTIVE_PLATFORM = Clover/rEFIt_UEFI/rEFIt64.dsc

The next option is target. This can be set to DEBUG or RELEASE. Release targets will be faster and smaller. But debug targets will have extra information related to symbol names and shouldn't optimize in situations it could. Because it will be more reliable for testing purposes we'll set this to;

TARGET = DEBUG

The target architecture describes which processors to target for execution. We'll need both 32bit and 64bit support so set that to;

TARGET_ARCH = IA32 X64

The tool chain is the compiler which you are using. Your best choice is probably:

TOOL_CHAIN_TAG = ELFGCC

Or select one from this table:

Supported tool chains

UNIXGCC GCC 4.3.0 on UNIX compatible GCC44 GCC 4.4.0 on Linux GCC45 GCC 4.5.0 on Linux GCC46 GCC 4.6.0 on Linux ELFGCC GCC tool chain installed in /usr/bin on Linux

You can change the maximum concurrent threads to the number of processor cores you have + 1, if you want, like so;

MAX_CONCURRENT_THREAD_NUMBER = 5

Now that we are done editing the configuration, save it and exit your editor.

At this point you should be ready to build. To start the scripts use:

####### cd Clover ####### ./cbuild.sh (Note: This does not work currently)

If your build succeeded (or you think it did):

The drivers end up in SOURCEDIR/edk2/Clover/CloverPackage/CloverV2/drivers-Off/ boot can be found in SOURCEDIR/edk2/Clover/CloverPackage/CloverV2/Bootloaders/ EFI binaries are located in SOURCEDIR/edk2/Clover/CloverPackage/CloverV2/EFI/BOOT/.

#####Windows

For Windows you'll need visual studio 2005 or newer (there are free versions available, I have no idea if they'll work fully though), WindowsSDK (PlatformSDK or DDK in older versions), and subversion. Binary packages of subversion

Open a command prompt and change to a directory in which you're comfortable putting the source. I will refer to that directory as SOURCEDIR. You should probably put it at C:\ but absolutely not in a path that contains spaces! To check out the tianocore EDK2 sources use the following command;

####### svn co https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2 edk2

This will download EDK2. After a while it should say Checked out revision XXXX.

Now execute these commands to get the Clover sources:

####### cd edk2 ####### svn co svn://svn.code.sf.net/p/cloverefiboot/code Clover

It should now also say Checked out revision XXXX.

Let's edit the EDK2 configuration so it knows which toolset we are using. Execute this;

####### edksetup

After that you're going to need to open SOURCEDIR\edk2\Conf\target.txt in your favorite text editor. The active platform is the current package that's being built, it defaults to something we don't want. We're going to change it to:

ACTIVE_PLATFORM = Clover/rEFIt_UEFI/rEFIt64.dsc

The next option is target. This can be set to DEBUG or RELEASE. Release targets will be faster and smaller. But debug targets will have extra information related to symbol names and shouldn't optimize in situations it could. Because it will be more reliable for testing purposes we'll set this to;

TARGET = DEBUG

The target architecture describes which processors to target for execution. We'll need both 32bit and 64bit support so set that to;

TARGET_ARCH = IA32 X64

The tool chain is the compiler which you are using. An example:

TOOL_CHAIN_TAG = VS2010x86

Select one from this table:

Supported tool chains

VS2003 Visual Studio 2003 on 32-bit Windows VS2005 Visual Studio 2005 on 32-bit Windows VS2008 Visual Studio 2008 on 32-bit Windows VS2010 Visual Studio 2010 on 32-bit Windows VS2005x86 Visual Studio 2005 on 64-bit Windows VS2008x86 Visual Studio 2008 on 64-bit Windows VS2010x86 Visual Studio 2010 on 64-bit Windows

You can change the maximum concurrent threads to the number of processor cores you have + 1, if you want, like so;

MAX_CONCURRENT_THREAD_NUMBER = 5

Now that we are done editing the configuration, save it and exit your editor.

At this point you should be ready to build. To start the scripts use:

####### cd Clover ####### cbuild

If your build succeeded (or you think it did):

The drivers end up in *SOURCEDIR\edk2\Clover\CloverPackage\CloverV2\drivers-Off* boot can be found in *SOURCEDIR\edk2\Clover\CloverPackage\CloverV2\Bootloaders* EFI binaries are located in *SOURCEDIR\edk2\Clover\CloverPackage\CloverV2\EFI\BOOT. *

Clone this wiki locally