@@ -9,156 +9,156 @@ only on apu2 versions v4.9.0.6 and newer.
9
9
10
10
1 . Clone the [ pce-fw-builder] ( https://github.com/pcengines/pce-fw-builder )
11
11
2 . Pull or [ build] ( https://github.com/pcengines/pce-fw-builder#building-docker-image )
12
- docker container:
12
+ docker container:
13
13
14
- ```
15
- docker pull pcengines/pce-fw-builder
16
- ```
14
+ ```
15
+ docker pull pcengines/pce-fw-builder
16
+ ```
17
17
18
18
3. Build v4.9.0.6 image:
19
19
20
- ```
21
- ./build.sh release v4.9.0.6 apu2
22
- ```
20
+ ```
21
+ ./build.sh release v4.9.0.6 apu2
22
+ ```
23
23
24
24
4. Invoke distclean:
25
25
26
- ```
27
- ./build.sh dev-build $PWD/release/coreboot apu2 distclean
28
- ```
26
+ ```
27
+ ./build.sh dev-build $PWD/release/coreboot apu2 distclean
28
+ ```
29
29
30
30
5. Copy the vboot miniconfig:
31
31
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
+ ```
35
35
36
36
6. Create full config:
37
37
38
- ```
39
- ./build.sh dev-build $PWD/release/coreboot apu2 olddefconfig
40
- ```
38
+ ```
39
+ ./build.sh dev-build $PWD/release/coreboot apu2 olddefconfig
40
+ ```
41
41
42
42
7. Build the image again:
43
43
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
+ ```
47
47
48
48
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.
51
51
52
52
## Using custom keys
53
53
54
54
The config file present in repository builds the binary with default vboot
55
55
developer keys. If one would like to use own keys, vboot has bash scripts that
56
56
simplify the key generation process.
57
57
58
- Enter previously cloned coreboot directory and change directory to vboot:
58
+ 1. Enter previously cloned coreboot directory and change directory to vboot:
59
59
60
- ```
61
- cd $PWD/release/coreboot/3rdparty/vboot
62
- ```
60
+ ```
61
+ cd $PWD/release/coreboot/3rdparty/vboot
62
+ ```
63
63
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):
65
65
66
- ```
67
- make
68
- DESTDIR=/usr sudo make install
69
- ```
66
+ ```
67
+ make
68
+ DESTDIR=/usr sudo make install
69
+ ```
70
70
71
- Then invoke from ` $PWD/release/coreboot ` :
71
+ 3. Then invoke from `$PWD/release/coreboot`:
72
72
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
+ ```
76
76
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:
79
79
80
- 6 . Create full config:
80
+ 4 . Create full config:
81
81
82
- ```
83
- ./build.sh dev-build $PWD/release/coreboot apu2 olddefconfig
84
- ```
82
+ ```
83
+ ./build.sh dev-build $PWD/release/coreboot apu2 olddefconfig
84
+ ```
85
85
86
- 7 . Enter menuconfig:
86
+ 5 . Enter menuconfig:
87
87
88
- ```
89
- ./build.sh dev-build $PWD/release/coreboot apu2 menuconfig
90
- ```
88
+ ```
89
+ ./build.sh dev-build $PWD/release/coreboot apu2 menuconfig
90
+ ```
91
91
92
- Enter Security -> Verified boot (vboot) -> Vboot keys. Change the directories:
92
+ 6. Enter Security -> Verified boot (vboot) -> Vboot keys. Change the directories:
93
93
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
+ ```
97
97
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):
100
100
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
+ ```
107
107
108
108
8. Build the image again:
109
109
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
+ ```
113
113
114
114
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.
117
117
118
118
## Advantages of vboot
119
119
120
120
1. Flashmap layout.
121
121
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).
126
126
127
- Flashing a single region, for example RW_SECTION_A:
127
+ Flashing a single region, for example RW_SECTION_A:
128
128
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
+ ```
132
132
133
- > Region names are defined in the FMD file.
133
+ > Region names are defined in the FMD file.
134
134
135
135
2. Verified boot
136
136
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.
145
145
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.
148
148
149
149
3. Measured boot
150
150
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.
162
162
163
163
### How to check it works
164
164
0 commit comments