Skip to content

Commit f453030

Browse files
author
Igor Bagnucki
committed
fix docs formatting
Signed-off-by: Igor Bagnucki <[email protected]>
1 parent 6a99be1 commit f453030

26 files changed

+1587
-1526
lines changed

docs/apu2_vboot.md

+91-91
Original file line numberDiff line numberDiff line change
@@ -9,156 +9,156 @@ only on apu2 versions v4.9.0.6 and newer.
99

1010
1. Clone the [pce-fw-builder](https://github.com/pcengines/pce-fw-builder)
1111
2. Pull or [build](https://github.com/pcengines/pce-fw-builder#building-docker-image)
12-
docker container:
12+
docker container:
1313

14-
```
15-
docker pull pcengines/pce-fw-builder
16-
```
14+
```
15+
docker pull pcengines/pce-fw-builder
16+
```
1717
1818
3. Build v4.9.0.6 image:
1919
20-
```
21-
./build.sh release v4.9.0.6 apu2
22-
```
20+
```
21+
./build.sh release v4.9.0.6 apu2
22+
```
2323
2424
4. Invoke distclean:
2525
26-
```
27-
./build.sh dev-build $PWD/release/coreboot apu2 distclean
28-
```
26+
```
27+
./build.sh dev-build $PWD/release/coreboot apu2 distclean
28+
```
2929
3030
5. Copy the vboot miniconfig:
3131
32-
```
33-
cp $PWD/release/coreboot/configs/config.pcengines_apu2_vboot $PWD/release/coreboot/.config
34-
```
32+
```
33+
cp $PWD/release/coreboot/configs/config.pcengines_apu2_vboot $PWD/release/coreboot/.config
34+
```
3535
3636
6. Create full config:
3737
38-
```
39-
./build.sh dev-build $PWD/release/coreboot apu2 olddefconfig
40-
```
38+
```
39+
./build.sh dev-build $PWD/release/coreboot apu2 olddefconfig
40+
```
4141
4242
7. Build the image again:
4343
44-
```
45-
./build.sh dev-build $PWD/release/coreboot apu2 CPUS=$(nproc)
46-
```
44+
```
45+
./build.sh dev-build $PWD/release/coreboot apu2 CPUS=$(nproc)
46+
```
4747
4848
8. Flash the new image. The firmware image can be found in
49-
`release/coreboot/build` which is relative to cloned `pce-fw-builder`
50-
directory.
49+
`release/coreboot/build` which is relative to cloned `pce-fw-builder`
50+
directory.
5151
5252
## Using custom keys
5353
5454
The config file present in repository builds the binary with default vboot
5555
developer keys. If one would like to use own keys, vboot has bash scripts that
5656
simplify the key generation process.
5757
58-
Enter previously cloned coreboot directory and change directory to vboot:
58+
1. Enter previously cloned coreboot directory and change directory to vboot:
5959
60-
```
61-
cd $PWD/release/coreboot/3rdparty/vboot
62-
```
60+
```
61+
cd $PWD/release/coreboot/3rdparty/vboot
62+
```
6363
64-
Compile and install the vboot library (outside docker on the host):
64+
2. Compile and install the vboot library (outside docker on the host):
6565
66-
```
67-
make
68-
DESTDIR=/usr sudo make install
69-
```
66+
```
67+
make
68+
DESTDIR=/usr sudo make install
69+
```
7070
71-
Then invoke from `$PWD/release/coreboot`:
71+
3. Then invoke from `$PWD/release/coreboot`:
7272
73-
```
74-
3rdparty/vboot/scripts/keygeneration/create_new_keys.sh --4k --4k-root --output keys
75-
```
73+
```
74+
3rdparty/vboot/scripts/keygeneration/create_new_keys.sh --4k --4k-root --output keys
75+
```
7676
77-
This script will produce whole set of new random keys in the `keys` directory.
78-
In order to use them, follow the procedure described previously, but:
77+
This script will produce whole set of new random keys in the `keys` directory.
78+
In order to use them, follow the procedure described previously, but:
7979
80-
6. Create full config:
80+
4. Create full config:
8181
82-
```
83-
./build.sh dev-build $PWD/release/coreboot apu2 olddefconfig
84-
```
82+
```
83+
./build.sh dev-build $PWD/release/coreboot apu2 olddefconfig
84+
```
8585
86-
7. Enter menuconfig:
86+
5. Enter menuconfig:
8787
88-
```
89-
./build.sh dev-build $PWD/release/coreboot apu2 menuconfig
90-
```
88+
```
89+
./build.sh dev-build $PWD/release/coreboot apu2 menuconfig
90+
```
9191
92-
Enter Security -> Verified boot (vboot) -> Vboot keys. Change the directories:
92+
6. Enter Security -> Verified boot (vboot) -> Vboot keys. Change the directories:
9393
94-
```
95-
$(VBOOT_SOURCE)/tests/devkeys/some_key.vbpubk ----> $(top)/some_key.vbpubk
96-
```
94+
```
95+
$(VBOOT_SOURCE)/tests/devkeys/some_key.vbpubk ----> $(top)/some_key.vbpubk
96+
```
9797
98-
Do the change for all 4 key paths, but do not change the filename (generated
99-
keys have the same names):
98+
7. Do the change for all 4 key paths, but do not change the filename (generated
99+
keys have the same names):
100100
101-
```
102-
($(VBOOT_SOURCE)/tests/devkeys/root_key.vbpubk) Root key (public)
103-
($(VBOOT_SOURCE)/tests/devkeys/recovery_key.vbpubk) Recovery key (public)
104-
($(VBOOT_SOURCE)/tests/devkeys/firmware_data_key.vbprivk) Firmware key (private)($(VBOOT_SOURCE)/tests/devkeys/kernel_subkey.vbpubk) Kernel subkey (public)
105-
($(VBOOT_SOURCE)/tests/devkeys/firmware.keyblock) Keyblock to use for the RW regions
106-
```
101+
```
102+
($(VBOOT_SOURCE)/tests/devkeys/root_key.vbpubk) Root key (public)
103+
($(VBOOT_SOURCE)/tests/devkeys/recovery_key.vbpubk) Recovery key (public)
104+
($(VBOOT_SOURCE)/tests/devkeys/firmware_data_key.vbprivk) Firmware key (private)($(VBOOT_SOURCE)/tests/devkeys/kernel_subkey.vbpubk) Kernel subkey (public)
105+
($(VBOOT_SOURCE)/tests/devkeys/firmware.keyblock) Keyblock to use for the RW regions
106+
```
107107
108108
8. Build the image again:
109109
110-
```
111-
./build.sh dev-build $PWD/release/coreboot apu2 CPUS=$(nproc)
112-
```
110+
```
111+
./build.sh dev-build $PWD/release/coreboot apu2 CPUS=$(nproc)
112+
```
113113
114114
9. Flash the new image. The firmware image can be found in
115-
`release/coreboot/build` which is relative to cloned `pce-fw-builder`
116-
directory.
115+
`release/coreboot/build` which is relative to cloned `pce-fw-builder`
116+
directory.
117117
118118
## Advantages of vboot
119119
120120
1. Flashmap layout.
121121
122-
Whole flash is divided into sections describe in an FMD (FlashMap Descriptor)
123-
file (located in `src/mainboard/pcengines/apu2` directory). Each section has
124-
strictly precised size. This allows to flash only certain flash regions with
125-
flashrom (requires quite fresh compilation of flashrom).
122+
Whole flash is divided into sections describe in an FMD (FlashMap Descriptor)
123+
file (located in `src/mainboard/pcengines/apu2` directory). Each section has
124+
strictly precised size. This allows to flash only certain flash regions with
125+
flashrom (requires quite fresh compilation of flashrom).
126126
127-
Flashing a single region, for example RW_SECTION_A:
127+
Flashing a single region, for example RW_SECTION_A:
128128
129-
```
130-
flashrom -p internal -w coreboot.rom --fmap -i RW_SECTION_A
131-
```
129+
```
130+
flashrom -p internal -w coreboot.rom --fmap -i RW_SECTION_A
131+
```
132132
133-
> Region names are defined in the FMD file.
133+
> Region names are defined in the FMD file.
134134
135135
2. Verified boot
136136
137-
Each boot component in firmware block A or B (depending which one is correctly
138-
booting) is verified again the keys that signed the blocks and the root key
139-
which public part lies in the recovery region. Only the firmware signed by the
140-
keys that belong to the cryptographical keychain (established during key
141-
generation) is allowed to boot. If the signatures are not matching, another
142-
firmware slot is used (also must pass verification). If everything else fails,
143-
boot from recovery. Recovery partition aka read-only is supposed to be
144-
protected by SPI flash protection mechanism as it make the Root of Trust.
137+
Each boot component in firmware block A or B (depending which one is correctly
138+
booting) is verified again the keys that signed the blocks and the root key
139+
which public part lies in the recovery region. Only the firmware signed by the
140+
keys that belong to the cryptographical keychain (established during key
141+
generation) is allowed to boot. If the signatures are not matching, another
142+
firmware slot is used (also must pass verification). If everything else fails,
143+
boot from recovery. Recovery partition aka read-only is supposed to be
144+
protected by SPI flash protection mechanism as it make the Root of Trust.
145145
146-
> Note that firmware components signed by different keyset won't work. If You
147-
> change the keys, flash whole firmware.
146+
> Note that firmware components signed by different keyset won't work. If You
147+
> change the keys, flash whole firmware.
148148
149149
3. Measured boot
150150
151-
By utlizing TPM capabilities, each boot component is cryptographically measured
152-
i.e. its hash is computed and extended in TPM's PCR (Platform Configuration
153-
Register). The hash is not directly written into PCR, but extended, which means
154-
that TPM takes current PCR value, add the hash value of the component and
155-
rehashes the combined value. The final result is written to PCR. Such approach
156-
has the advantage that the final PCR values after boot process is finished are
157-
fixed. In other words, by measuring the same components, in same order, without
158-
any changes in its content we are able to obtain same PCR values. There is no
159-
other way to obtain the same result if any of the components changed, or if the
160-
measuring order has been altered. Given that, the PCR values can clearly assure
161-
that the firmware has not been tampered.
151+
By utlizing TPM capabilities, each boot component is cryptographically measured
152+
i.e. its hash is computed and extended in TPM's PCR (Platform Configuration
153+
Register). The hash is not directly written into PCR, but extended, which means
154+
that TPM takes current PCR value, add the hash value of the component and
155+
rehashes the combined value. The final result is written to PCR. Such approach
156+
has the advantage that the final PCR values after boot process is finished are
157+
fixed. In other words, by measuring the same components, in same order, without
158+
any changes in its content we are able to obtain same PCR values. There is no
159+
other way to obtain the same result if any of the components changed, or if the
160+
measuring order has been altered. Given that, the PCR values can clearly assure
161+
that the firmware has not been tampered.
162162
163163
### How to check it works
164164

0 commit comments

Comments
 (0)