Vault7: CIA Hacking Tools Revealed
Navigation: » Latest version
Owner: User #71491
QuarkMatter
Page is currently under construction. Please don't try to follow the below instructions, as they are incomplete and subject to change.
('toc' missing)
Setting Up a Generic EFIExtensible Firmware Interface UDK Development Environment
Specific Ubuntu Configuration Details
The first step in setting up the development environment is making sure that you have a working Ubuntu machine. You can use an actual Ubuntu DEVLAN machine or an Ubuntu VMVirtual Machine on your DEVLAN machine.
This page will not go into detail about how to install Ubuntu or create an Ubuntu VM, but will focus on the few ways you'll configure the Ubuntu machine before you can install and set up the UDK.
First, you need to modify your sources.list file so apt-get can use the DEVLAN repos, located at repo.devlan.net. Linux Package Repository Mirrors setup discusses a few ways to do that.
Once you have set up Ubuntu to run properly, run the following commands to update and upgrade your packages and download the ones needed for the UDK.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential uuid-dev iasl nasm git
At this point, you should have all of the dependencies for the UDK that are not included in the UDK package itself, and you are ready to install the UDK.
Installing the UDK
The first step in setting up your development environment is to install the UDK, in this case, the TianoCore EDKEmbedded Development Kit II (http://www.tianocore.org/edk2). This is the open source environment for UEFIUniversal Extendible Firmware Interface and PI development.
The next step is to download all of the source files for the project. These are located on Stash, under the OpenSource/edk2 project. A link to that project is here.
mkdir ~/src
cd ~/src
git clone http://USERNAME@stash.devlan.net/scm/quarkmatter/edk2.git
cd edk2
make -C Basetools/
export EDK_TOOLS_PATH=$HOME/src/edk2/BaseTools
mkdir Conf
. edksetup.sh BaseTools
Note: if you cloned the QuarkMatter version of edk2 instead of the OpenSource version, you may have gotten a "cannot create dirrectory 'Conf': File exists" error. That is fine; I added the Conf files with their changes to that directory for QuarkMatter-specific builds.
If this succeeded, your output should be similar to the output below:
bash$. edksetup.sh BaseTools
WORKSPACE: /home/user/src/edk2
EDK_TOOLS_PATH: /home/user/src/edk2/BaseTools
Copying $EDK_TOOLS_PATH/Conf/build_rule.template
to $WORKSPACE/Conf/Build_rule.txt
Copying $EDK_TOOLS_PATH/Conf/tools_def.template
to $WORKSPACE/Conf/tools_def.txt
Copying $EDK_TOOLS_PATH/Conf/target.template
to $WORKSPACE/Conf/target.txt
At this point, you have built the BaseTools components and set up the build shell environment. The next step is to configure your installation to use the correct GCCGNU Compiler Collection compiler. First, determine your GCCGNU Compiler Collection version by using the command below.
bash$ gcc --version
gcc (Ubuntu4.9.2-10ubuntu13) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
According to the above output, the machine is using GCCGNU Compiler Collection version 4.9.2. For the purposes of configuration, this will be referred to as "GCC49".
Next, open up the Conf/target.txt file and find the following lines:
ACTIVE_PLATFORM =Nt32Pkg/Nt32Pkg.dsc
TOOL_CHAIN_TAG =MYTOOLS
TARGET_ARCH =IA32
and change them to the following:
ACTIVE_PLATFORM =MdeModulePkg/MdeModulePkg.dsc
TOOL_CHAIN_TAG =GCC49
TARGET_ARCH =IA32 X64
Note: if your Ubuntu machine has a different version of GCC, use that number above instead of GCC49.
Now, you need to build the project. The command and some of its output are below. Note: give yourself a few minutes for this to run to completion, as it will take a little while.
bash$cd ~/src/edk2
bash$build
Build environment: Linux-3.19.0-15-generic-x86_64-with-Ubuntu-15.04-vivid
Build start time: 14:18:08, Aug.11 2015
WORKSPACE = /home/user/src/edk2
ECP_SOURCE = /home/user/src/edk2/EdkCompatibilityPkg
EDK_SOURCE = /home/user/src/edk2/EdkCompatibilityPkg
EFI_SOURCE = /home/user/src/edk2/EdkCompatibilityPkg
EDK_TOOLS_PATH = /home/user/src/edk2/BaseTools
Architecture(s) = IA32 X64
Build target = DEBUG
Toolchain = GCC49
Active Platform = /home/user/src/edk2/MdeModulePkg/MdeModulePkg.dsc
Processing meta-data ....
<LOTS OF MAKEFILE AND OTHER BUILD OUTPUT HERE>
- Done -
Build end time: 13:51:03, Aug.11 2015
Build total time: 00:06:34
bash$
Another note: if you get a "No command 'build' found" error, re-run the edksetup.sh script. The command to do this is: ". edksetup.sh" Make sure to use the "." at the beginning of the command, or it won't work.
At this point, presuming that the build did not give you any errors, you have successfully built the build environment for EDKEmbedded Development Kit II. The next step is to understand how to create a basic EFIExtensible Firmware Interface executable, which will be covered in the next section.
Creating and Building a Basic EFIExtensible Firmware Interface Executable
HelloWorld.c and HelloWorld.inf
This section is dependent on having a working EDKEmbedded Development Kit II build environment. If you have not done that already, please go back to the