Skip to content

Commit

Permalink
Add boilerplate for new 'UEFI Booting' post
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-opp committed Feb 16, 2021
1 parent d6f424e commit c2fe996
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 7 deletions.
9 changes: 4 additions & 5 deletions blog/content/edition-3/posts/02-booting/index.md
Expand Up @@ -12,6 +12,8 @@ icon = '''
<path d="M3 8.812a4.999 4.999 0 0 1 2.578-4.375l-.485-.874A6 6 0 1 0 11 3.616l-.501.865A5 5 0 1 1 3 8.812z"/>
</svg>
'''

extra_content = ["uefi.md"]
+++

In this post, we explore the boot process on both BIOS and UEFI-based systems. We combine the [minimal kernel] created in the previous post with a bootloader to create a bootable disk image. We then show how this image can be started in the [QEMU] emulator and run on real hardware.
Expand Down Expand Up @@ -144,12 +146,9 @@ Bootloaders and kernels typically need additional information about the system,

As it is probably clear at this point, the UEFI interface is very powerful and complex. The wide range of functionality makes it even possible to write an operating system directly as an UEFI application, using the UEFI services provided by the system table instead of creating own drivers. In practice, however, most operating systems use UEFI only for the bootloader since own drivers give you better performance and more control over the system. We will also follow this path for our OS implementation.

To keep this post focused, we won't cover the creation of an UEFI bootloader here. Instead, we will use the already mentioned [`bootloader`] crate, which allows loading our kernel on both UEFI and BIOS systems.

If you're interested in how to create an UEFI bootloader: We are planning to cover this in detail in a separate series of posts. If you can't wait, check out our [`uefi` crate] and the [_An EFI App a bit rusty_] post by Gil Mendes.
To keep this post focused, we won't cover the creation of an UEFI bootloader here. Instead, we will use the already mentioned [`bootloader`] crate, which allows loading our kernel on both UEFI and BIOS systems. If you're interested in how to create an UEFI bootloader yourself, check out our extra post about [**UEFI Booting**].

[_An EFI App a bit rusty_]: https://gil0mendes.io/blog/an-efi-app-a-bit-rusty/
[`uefi` crate]: https://github.com/rust-osdev/uefi-rs/
[**UEFI Booting**]: @/edition-3/posts/02-booting/uefi.md

### The Multiboot Standard

Expand Down
22 changes: 22 additions & 0 deletions blog/content/edition-3/posts/02-booting/uefi.md
@@ -0,0 +1,22 @@
+++
title = "UEFI Booting"
path = "booting/uefi"
date = 0000-01-01
template = "edition-3/page.html"

[extra]
hide_next_prev = true
icon = '''
<!-- icon source: https://de.wikipedia.org/wiki/Datei:Uefi_logo.svg -->
<svg baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" viewBox = "0 0 367.92 424.8">
<path fill="#FFF" d="M183.505 7.5l12.515.016 59.87 34.233.632 13.683 23.938.38L339.524 89.6l16.386 30.31 5.136 192.808L349.92 329.3l-56.88 32.657-19.564-1.81-13.315 20.69-56.41 32.404-89.687-32.764L4.375 312.71 7.5 109.59z"/>
<path fill="#DC0000" d="M182.88 0l13.14 7.516-86.427 50.52S83.443 71.21 74.16 81.362c-11.362 12.428-7.917 30.125 2.16 42.48 24.693 30.28 88.66 54.367 141.12 34.56C239.666 150.01 339.524 89.6 339.524 89.6l28.397 16.243v213.12l-18 10.337V207.36l-56.88 32.66v121.937l-32.88 18.88V311.04l20.28-12.24v-51.543l-20.28 11.646s-2.37-32.09 1.92-42.902c4.1-10.31 15.74-21.72 25.2-18.72 6.95 2.21 5.76 24.95 5.76 24.95s42.95-24.85 56.88-32.86c2.25-36.34-9.13-59-43.92-55.44-15.87 1.63-28.37 10.02-38.88 17.28-11.14 7.7-20.4 16.555-28.8 26.64-15.89 19.1-33.02 45.26-35.28 76.32-1.77 24.357.71 159.07.71 159.07L183.6 424.8 0 318.96V105.84L182.88 0zM115.2 167.04c-13.318-10.95-29.718-21.208-47.52-25.2-11.942-2.678-23.93-1.128-32.4 3.6-22.328 12.466-28.844 45.437-26.64 77.76 3.508 51.445 22.065 86.146 48.96 113.04 17.977 17.977 47.576 39.66 74.16 41.76 27.702 2.187 36.335-16.023 42.48-36.72-20.956-14.324-44.265-26.296-65.52-40.32-3.91 2.99-3.572 6.328-9.36 6.48-5.15.135-10.955-4.727-14.4-9.36-6.09-8.19-8.026-21.054-8.64-30.96 33.78 18.062 66.363 37.317 100.08 55.44 3.688-67.27-23.104-124.2-61.2-155.52zM280.46 55.813l-85.795 52.732s-22.85 14.813-38.136 13.134c-4.99-.55-13.31-4.77-13.68-8.64-.7-7.16 25.2-21.02 25.2-21.02l87.84-50.27L280.46 55.8zM109.44 241.2c-11.23-5.81-21.966-12.114-32.4-18.72 1.032-7.922 2.438-15.645 12.24-13.68 11.49 2.303 19.817 20.686 20.16 32.4z"/>
</svg>
'''
+++

This post is an addendum to our main [**Booting**] post. It explains how to create a basic UEFI bootloader from scratch.

[**Booting**]: @/edition-3/posts/02-booting/index.md

<!-- more -->
9 changes: 9 additions & 0 deletions blog/sass/css/edition-3/main.scss
Expand Up @@ -1043,3 +1043,12 @@ a strong {
.chapter-introduction {
margin-bottom: 1.5rem;
}

.post-extra-content {
margin-top: 1rem;
font-style: italic;
}

.post-extra-content h4 {
display: inline;
}
13 changes: 13 additions & 0 deletions blog/templates/edition-3/macros.html
Expand Up @@ -20,6 +20,19 @@ <h3 class="post-list-title"><a href="{{ post.path | safe }}">{{ post.title }}</a
{{ post.summary | safe }}
<a class="read-more" href="{{ post.path | safe }}"><em>read&nbsp;more&nbsp;»</em></a>

{% if page.extra.extra_content %}
<aside class="post-extra-content">
<h4>Extra Content:</h4>
{% for name in page.extra.extra_content %}
{% set path = page.relative_path | split(pat="/") | slice(end=-1) | concat(with=name) | join(sep="/") %}

{% set extra_page = get_page(path = path) %}

<a href = "{{ extra_page.path | safe }}">{{ extra_page.title }}</a>{% if not loop.last %},{% endif %}
{% endfor %}
</aside>
{% endif %}

{%- if lang and not_translated and lang != config.default_language -%}
<aside class="no-translation">
(This post is not translated yet.)
Expand Down
6 changes: 4 additions & 2 deletions blog/templates/edition-3/page.html
Expand Up @@ -84,15 +84,17 @@ <h2>Support Me</h2>
{{ snippets::support() }}
</div>

{% if not page.extra.hide_next_prev %}
<hr>
<div class="PageNavigation">
{% if page.lighter %}
<a class="prev" href="{{ page.lighter.path | safe }}">&laquo; {{ page.lighter.title }}</a>
<a class="prev" href="{{ page.lighter.path | safe }}">&laquo; {{ page.lighter.title }}</a>
{% endif %}
{% if page.heavier %}
<a class="next" href="{{ page.heavier.path | safe }}">{{ page.heavier.title }} &raquo;</a>
<a class="next" href="{{ page.heavier.path | safe }}">{{ page.heavier.title }} &raquo;</a>
{% endif %}
</div>
{% endif %}

<hr>
<section>
Expand Down

0 comments on commit c2fe996

Please sign in to comment.