<?xml version="1.0" encoding="utf-8"?><feedxmlns="http://www.w3.org/2005/Atom"><generatoruri="https://jekyllrb.com/"version="4.1.1">Jekyll</generator><linkhref="/feed.xml"rel="self"type="application/atom+xml"/><linkhref="/"rel="alternate"type="text/html"/><updated>2021-04-24T15:34:21-06:00</updated><id>/feed.xml</id><entry><titletype="html">UEFI Development On x86 With EDK2</title><linkhref="/2021/04/18/uefi-development-environment/"rel="alternate"type="text/html"title="UEFI Development On x86 With EDK2"/><published>2021-04-18T00:00:00-06:00</published><updated>2021-04-18T00:00:00-06:00</updated><id>/2021/04/18/uefi-development-environment</id><contenttype="html"xml:base="/2021/04/18/uefi-development-environment/"><p>I made this blog so I could remember how to do stuff that had instructions spread around the internet. So here is how I setup my environment for developing EFI applications.</p><h2 id="requirements">Requirements</h2><p>On Artix or other Arch-based distros like Manjaro I installed the following packages: <code class="language-plaintext highlighter-rouge">gcc nasm iasl</code></p><p>Here is what the packages do:</p><ul><li>GCC is obviously the GNU Compiler Collection and it allows us to compile C code to machine code.</li><li>NASM stands for Netwide Assembler. It is an assembler and disassembler for 32 and 64 bit Intel x86 platforms.</li><li>IASL stands for the ACPI Source Language Compiler/Decompiler. This will compile any ACPI calls to our local machine’s code.</li></ul><p>We need all these packages to start our (U)EFI journey. Now that these are installed, let’s setup our environment.</p><h2 id="building-edk2">Building EDK2</h2><p>I used the stable/202011 branch as that is latest stable version of the EDK2 project.</p><p>So first let’s pull the project:</p><p><code class="language-plaintext highlighter-rouge">git clone https://github.com/tianocore/edk2.git</code></p><p>Now, let’s fetch the tags and switch to the latest stable version:</p><div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cd edk2 git fetch git checkout stable/202011 </code></pre></div></div><p>Perfect! We’re on stable now! Let’s grab all our submodules: <code class="language-plaintext highlighter-rouge">git submodule update --init</code></p><p>This will take a bit the first time you do it. But no fear, once that’s done, we can finally build the base tools.</p><div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>make -C BaseTools export EDK_TOOLS_PATH=$HOME/Documents/edk2/BaseTools . edksetup.sh BaseTools </code></pre></div></div><p>Notice we source a file with <code class="language-plaintext highlighter-rouge">.</code> before continuing. This is needed to load some tools and options into our shell for later. The environment variable <code class="language-plaintext highlighter-rouge">EDK_TOOLS_PATH</code> is set so that EDK knows where to find itself later. Now that everything is loaded up, we can modify a config file located at <code class="language-plaintext highlighter-rouge">Conf/target.txt</code>.</p><p>The most important options are these, feel free to append them to the end of the file; there is no default value for them.</p><pre class="file"> ACTIVE_PLATFORM = MdeModulePkg/MdeModulePkg.dsc TOOL_CHAIN_TAG = GCC5 # for 64-bit development TARGET_ARCH = X64 # for 32-bit development TARGET_ARCH = IA32 # for 32 and 64-bit development TARGET_ARCH = IA32 X64 # set