|
19 | 19 | ### USB drive
|
20 | 20 |
|
21 | 21 | 1. Download [generate-image.sh](./generate-image.sh)
|
22 |
| -1. Build `LockDown.efi`. To do that install |
23 |
| -[needed prerequisites](https://docs.dasharo.com/dasharo-tools-suite/documentation/#prerequisites), |
24 |
| -checkout tag `v1.2.23` in `meta-dts` |
25 |
| -and then build `efitools` which will build `LockDown.efi` with sample keys |
| 22 | +1. Build [LockDown.efi](#lockdownefi) file |
| 23 | +1. Build [hello.efi](#helloefi) file |
| 24 | +1. Run `generate-image.sh` script. It'll generate `tests.img` file containing |
| 25 | +needed files and certificates |
| 26 | +1. Flash this file to USB drive |
| 27 | + |
| 28 | +#### LockDown.efi |
| 29 | + |
| 30 | +**Dependencies** |
| 31 | + |
| 32 | +* [kas-container](https://docs.dasharo.com/dasharo-tools-suite/documentation/#prerequisites) |
| 33 | +* [git](https://git-scm.com/) |
| 34 | + |
| 35 | +**Steps** |
| 36 | + |
| 37 | +1. Clone and checkout tag `v1.2.23` |
| 38 | + |
| 39 | + ```shell |
| 40 | + git clone --depth 1 --branch v1.2.23 https://github.com/Dasharo/meta-dts.git |
| 41 | + ``` |
| 42 | + |
| 43 | +1. Build `efitools` recipe which will build `LockDown.efi` with sample keys |
26 | 44 |
|
27 | 45 | ```shell
|
28 | 46 | SHELL=/bin/bash kas-container shell meta-dts/kas-uefi-sb.yml -c "bitbake efitools"`
|
29 | 47 | ```
|
30 | 48 |
|
31 |
| -1. Copy `LockDown.efi` to directory containing `generate-image.sh` script. |
32 |
| -It should be inside `build/tmp/deploy/images/genericx86_64`. |
33 |
| -Sample keys and certificates used in `LockDown.efi` are in |
| 49 | +1. Copy `LockDown.efi` to directory containing `generate-image.sh` script.</br> |
| 50 | +File should be inside `build/tmp/deploy/images/genericx86_64` directory.</br> |
| 51 | +Sample keys and certificates used in `LockDown.efi` can be viewed in |
34 | 52 | `build/tmp/deploy/images/genericx86_64/sample-keys/uefi_sb_keys`
|
35 |
| -1. Run `generate-image.sh` script. It'll generate `tests.img` file containing |
36 |
| -needed files and certificates |
37 |
| -1. Flash this file to USB drive |
38 | 53 |
|
39 |
| -USB directory layout: |
| 54 | +#### hello.efi |
| 55 | + |
| 56 | +**Dependencies** |
| 57 | + |
| 58 | +* [Docker](https://docs.docker.com/engine/install/) |
| 59 | +* [git](https://git-scm.com/) |
| 60 | + |
| 61 | +**Steps** |
| 62 | + |
| 63 | +1. Pull docker image that'll contain tools needed to build `hello.efi` |
| 64 | +<https://github.com/tianocore/containers?tab=readme-ov-file#Current-Status>. |
| 65 | +
|
| 66 | + ```shell |
| 67 | + docker pull ghcr.io/tianocore/containers/fedora-39-build:46802aa |
| 68 | + ``` |
| 69 | +
|
| 70 | +1. Get source code for EDK2 |
| 71 | +
|
| 72 | + ```shell |
| 73 | + git clone --depth 1 --recurse-submodules --shallow-submodules --branch edk2-stable202408 https://github.com/tianocore/edk2.git |
| 74 | + ``` |
| 75 | +
|
| 76 | +1. Add sleep (in this case 2 seconds) to `HelloWorld.c` otherwise output will |
| 77 | +disappear too fast for human to see |
| 78 | +
|
| 79 | + ```shell |
| 80 | + cd edk2 |
| 81 | + git apply <<EOF |
| 82 | + diff --git a/MdeModulePkg/Application/HelloWorld/HelloWorld.c b/MdeModulePkg/Application/HelloWorld/HelloWorld.c |
| 83 | + index 9b77046e561c..ebd4ad9d6a79 100644 |
| 84 | + --- a/MdeModulePkg/Application/HelloWorld/HelloWorld.c |
| 85 | + +++ b/MdeModulePkg/Application/HelloWorld/HelloWorld.c |
| 86 | + @@ -56,5 +56,6 @@ UefiMain ( |
| 87 | + } |
| 88 | + } |
| 89 | +
|
| 90 | + + SystemTable->BootServices->Stall(2000000); |
| 91 | + return EFI_SUCCESS; |
| 92 | + } |
| 93 | + EOF |
| 94 | + ``` |
| 95 | +
|
| 96 | +1. Build `HelloWorld.efi` |
| 97 | +
|
| 98 | + ```shell |
| 99 | + docker run -v $(pwd):/edk2 -w /edk2 --entrypoint bash --rm \ |
| 100 | + ghcr.io/tianocore/containers/fedora-39-build:46802aa -c ' \ |
| 101 | + source edksetup.sh && make -C BaseTools && build -a X64 -t GCC5 \ |
| 102 | + -p MdeModulePkg/MdeModulePkg.dsc \ |
| 103 | + -m MdeModulePkg/Application/HelloWorld/HelloWorld.inf -b RELEASE' |
| 104 | + ``` |
| 105 | +
|
| 106 | + Build should complete with |
| 107 | +
|
| 108 | + ```text |
| 109 | + (...) |
| 110 | + - Done - |
| 111 | + Build end time: 12:51:06, Oct.04 2024 |
| 112 | + Build total time: 00:00:06 |
| 113 | + ``` |
| 114 | +
|
| 115 | +1. Copy built `HelloWorld.efi` file to directory with `generate-image.sh` and |
| 116 | +rename it to `hello.efi` |
| 117 | +
|
| 118 | + ```shell |
| 119 | + cp Build/MdeModule/RELEASE_GCC5/X64/HelloWorld.efi <replace/this/path/>hello.efi |
| 120 | + ``` |
| 121 | +
|
| 122 | +#### USB directory layout |
40 | 123 |
|
41 | 124 | ```text
|
42 | 125 | .
|
|
0 commit comments