Skip to content

Commit 57ae01a

Browse files
ineskhouhrfarmer
andauthored
Update key makefile (#308)
* added Makefile edit * edit readme * Apply suggestion from @hrfarmer Co-authored-by: aychar <aychar@aychar.dev> --------- Co-authored-by: aychar <aychar@aychar.dev>
1 parent 0b9edfc commit 57ae01a

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.PHONY: all
2-
all: submodules fprime-venv zephyr generate-if-needed build
2+
all: submodules fprime-venv zephyr copy-keys generate-if-needed build
33

44
.PHONY: help
55
help: ## Display this help.
@@ -131,6 +131,10 @@ generate-auth-key: ## Generate AuthDefaultKey.h with a random HMAC key
131131
fi
132132
@echo "Generated $(AUTH_DEFAULT_KEY_HEADER)"
133133

134+
.PHONY: copy-keys
135+
copy-keys:
136+
@mkdir -p keys
137+
@cp lib/zephyr-workspace/bootloader/mcuboot/root-rsa-2048.pem keys/proves.pem
134138

135139
SYSBUILD_PATH ?= $(shell pwd)/lib/zephyr-workspace/zephyr/samples/sysbuild/with_mcuboot
136140
.PHONY: build-mcuboot

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,6 @@ The bootloader build outputs `mcuboot.uf2` at the repo root Put the board into U
6262
cp mcuboot.uf2 [path-to-your-board]
6363
```
6464

65-
#### Copy the signing key used by the bootloader
66-
67-
MCUBoot only boots images that are **signed with the same key** the bootloader is configured for. This repo’s app build is configured to sign using `keys/proves.pem` (see `CONFIG_MCUBOOT_SIGNATURE_KEY_FILE` in `prj.conf`), so you must ensure that file matches the bootloader you flashed.
68-
69-
For the default (development) key bundled with MCUBoot:
70-
71-
```shell
72-
mkdir -p keys
73-
cp lib/zephyr-workspace/bootloader/mcuboot/root-rsa-2048.pem keys/proves.pem
74-
```
75-
76-
If you regenerate/replace the bootloader (or switch computers and flash a bootloader built elsewhere), make sure you also update `keys/proves.pem` to the matching signing key, or your built images will not boot.
77-
7865
## Running the code
7966

8067
Run generate from the `proves-core-reference` directory. This generates the build cache for FPrime. You only need to do generate if something in the core FPrime package has changed
@@ -103,6 +90,19 @@ Finally, run the fprime-gds.
10390
make gds
10491
```
10592

93+
#### Ensuring your authentication/signing is correct
94+
95+
The Makefile will ensure the authentication is correct if you run the code on the same computer you flash on. However, if you switch from a computer that compiled the code you will likely have issues with authentication. Here are some things you may encounter
96+
97+
MCUBoot only boots images that are **signed with the same key** the bootloader is configured for. This repo’s app build is configured to sign using `keys/proves.pem` (see `CONFIG_MCUBOOT_SIGNATURE_KEY_FILE` in `prj.conf`), so you must ensure that file matches the bootloader you flashed.
98+
99+
If you regenerate/replace the bootloader (or switch computers and flash a bootloader built elsewhere), make sure you also update `keys/proves.pem` to the matching signing key, or your built images will not boot.
100+
101+
```shell
102+
make copy-keys
103+
```
104+
You also want to make sure the authentication key the gds runs with is the same as the authentication key on the board. For that, you want to make sure the authentication key in FprimeZephyrReference/Components/Authenticate/AuthDefaultKey.h matches.
105+
106106
## Running Integration Tests
107107

108108
First, start GDS with:

0 commit comments

Comments
 (0)