Skip to content

Commit

Permalink
book: Update the tutorial
Browse files Browse the repository at this point in the history
This page was a little out of date; it still referred to `main` taking multiple
arguments, and to the `uefi_services` crate.
  • Loading branch information
nicholasbishop committed Sep 12, 2024
1 parent 8d066f9 commit b7130a3
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions book/src/tutorial/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ used.

Next up are some `use` lines. Nothing too exciting here; the
`uefi::prelude` module is intended to be glob-imported, and exports a
number of commonly-used types.
number of commonly-used macros, modules, and types.

```rust
{{#include ../../../uefi-test-runner/examples/hello_world.rs:use}}
Expand All @@ -63,23 +63,18 @@ a little different from a standard Rust program.
{{#include ../../../uefi-test-runner/examples/hello_world.rs:entry}}
```

The `main` function in a Uefi application always takes two arguments,
the image handle and the system table. The image [handle] represents the
currently-running executable, and the system [table] provides access to
many different UEFI services. The `main` function returns a [`Status`],
which is essentially a numeric error (or success) code defined by UEFI.
The `main` function in a UEFI application takes no arguments and returns
a [`Status`], which is essentially a numeric error (or success) code
defined by UEFI. The `main` function must be marked with the `#[entry]`
macro.

The first thing we do inside of `main` is initialize `uefi_services`:
The first thing we do inside of `main` is initialize the `helpers`
module, which initializes logging:

```rust
{{#include ../../../uefi-test-runner/examples/hello_world.rs:services}}
```

The `uefi_services` crate is not strictly required to make a UEFI
application with the `uefi` crate, but it makes things much simpler by
setting a simple memory allocator, initializing the logger, and
providing a panic handler.

Next we use the standard `log` crate to output "Hello world!". Then we
call `stall` to make the system pause for 10 seconds. This just ensures
you have enough time to see the output.
Expand Down

0 comments on commit b7130a3

Please sign in to comment.