David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 1 | ########################################################################### |
| 2 | # Sample multi-part application Makefile |
| 3 | # |
| 4 | # Copyright (c) 2017 Linaro Limited |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 5 | # Copyright (c) 2017 Open Source Foundries Limited |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 6 | # |
| 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | # you may not use this file except in compliance with the License. |
| 9 | # You may obtain a copy of the License at |
| 10 | # |
| 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | # |
| 13 | # Unless required by applicable law or agreed to in writing, software |
| 14 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | # See the License for the specific language governing permissions and |
| 17 | # limitations under the License. |
| 18 | ########################################################################### |
| 19 | |
| 20 | # This is an example Makefile to demonstrate how to use mcuboot to |
| 21 | # deploy and upgrade images. The image building should work on any |
| 22 | # supported target, however flashing will likely require changes to |
| 23 | # the flash addresses, depending on the partition layout of the device |
| 24 | # in question. |
| 25 | # |
| 26 | # running |
Marti Bolivar | 7135410 | 2017-08-01 15:09:44 -0400 | [diff] [blame] | 27 | # |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 28 | # make BOARD=frdm_k64f all |
| 29 | # |
| 30 | # should generate three "*.bin" files in this directory: |
| 31 | # |
| 32 | # mcuboot.bin: The bootloader itself |
| 33 | # signed-hello1.bin: A signed sample. |
| 34 | # signed-hello2.bin: An upgrade image, signed and marked for |
| 35 | # upgrade. |
| 36 | # |
| 37 | # "make flash_boot" should flash the bootloader into the flash, |
| 38 | # erasing the rest of the device. If you examine the device at this |
| 39 | # time, you should see a message about the bootloader not being able |
| 40 | # to find a bootable image. |
| 41 | # |
David Vincze | 2d736ad | 2019-02-18 11:50:22 +0100 | [diff] [blame] | 42 | # "make flash_hello1" will then flash the first application into the |
| 43 | # "primary slot". This should boot into this app, print a small message, and |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 44 | # give the zephyr console. |
| 45 | # |
David Vincze | 2d736ad | 2019-02-18 11:50:22 +0100 | [diff] [blame] | 46 | # "make flash_hello2" will flash hello2 into the "secondary slot". The |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 47 | # reset should upgrade and run the new image. Resetting again should |
| 48 | # then revert back to the first app, since we did not mark this image |
| 49 | # as good. |
| 50 | |
Marti Bolivar | a4818a5 | 2018-04-12 13:02:38 -0400 | [diff] [blame] | 51 | # Extra .conf fragments to merge into the MCUboot .config, as a |
| 52 | # semicolon-separated list (i.e., a CMake list). |
| 53 | BOOTLOADER_OVERLAY_CONFIG ?= |
| 54 | |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 55 | BOARD ?= frdm_k64f |
| 56 | |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 57 | .PHONY: check boot hello1 clean_boot clean_hello1 \ |
| 58 | hello2 clean_hello2 flash_boot flash_hello1 flash_hello2 |
| 59 | |
| 60 | # For signing, use the default RSA demo key, to match the default in |
| 61 | # the mcuboot Makefile. |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 62 | SIGNING_KEY ?= ../../root-rsa-2048.pem |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 63 | |
| 64 | # The header size should match that in hello1/prj.conf |
| 65 | # CONFIG_TEXT_SECTION_OFFSET. This value needs to be a power of two |
| 66 | # that is at least as large as the size of the vector table. The |
| 67 | # value given here of 0x200 should be sufficient for any supported |
| 68 | # devices, but it can be made smaller, as long as this value matches |
| 69 | # that used to build the app. |
| 70 | BOOT_HEADER_LEN = 0x200 |
| 71 | |
| 72 | # For upgrades, the signing tool needs to know the device alignment. |
| 73 | # This requirement will be going away soon. |
| 74 | FLASH_ALIGNMENT = 8 |
| 75 | |
| 76 | IMGTOOL = ../../scripts/imgtool.py |
David Brown | dbc5727 | 2017-07-17 15:38:54 -0600 | [diff] [blame] | 77 | ASSEMBLE = ../../scripts/assemble.py |
Maureen Helm | 0e0c488 | 2019-02-18 17:20:00 -0600 | [diff] [blame] | 78 | PYOCD = pyocd |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 79 | |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 80 | SOURCE_DIRECTORY := $(CURDIR) |
| 81 | BUILD_DIRECTORY := $(CURDIR)/build/$(BOARD) |
| 82 | BUILD_DIR_BOOT := $(BUILD_DIRECTORY)/mcuboot |
| 83 | BUILD_DIR_HELLO1 := $(BUILD_DIRECTORY)/hello1 |
| 84 | BUILD_DIR_HELLO2 := $(BUILD_DIRECTORY)/hello2 |
| 85 | |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 86 | help: |
| 87 | @echo "make <target> BOARD=<board>" |
David Brown | dbc5727 | 2017-07-17 15:38:54 -0600 | [diff] [blame] | 88 | @echo "<target>: all, boot, hello1, full.bin" |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 89 | @echo "<board>: frdm_k64f only for now" |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 90 | |
| 91 | all: boot hello1 hello2 |
| 92 | |
David Brown | dbc5727 | 2017-07-17 15:38:54 -0600 | [diff] [blame] | 93 | full.bin: boot hello1 hello2 |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 94 | $(ASSEMBLE) -b $(BUILD_DIR_BOOT) \ |
Torsten Rasmussen | 33fbef5 | 2020-06-03 20:21:13 +0200 | [diff] [blame] | 95 | -z $(ZEPHYR_BASE) \ |
David Brown | dbc5727 | 2017-07-17 15:38:54 -0600 | [diff] [blame] | 96 | -p signed-hello1.bin \ |
| 97 | -s signed-hello2.bin \ |
| 98 | -o full.bin |
| 99 | |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 100 | clean: clean_boot clean_hello1 clean_hello2 |
| 101 | @rm -f signed-hello1.bin |
| 102 | @rm -f signed-hello2.bin |
| 103 | @rm -f mcuboot.bin |
| 104 | |
| 105 | boot: check |
| 106 | @rm -f mcuboot.bin |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 107 | (mkdir -p $(BUILD_DIR_BOOT) && \ |
| 108 | cd $(BUILD_DIR_BOOT) && \ |
Marti Bolivar | a879843 | 2018-04-12 13:12:06 -0400 | [diff] [blame] | 109 | cmake -DOVERLAY_CONFIG=$(BOOTLOADER_OVERLAY_CONFIG) \ |
David Brown | 358ca1a | 2019-06-25 10:13:20 -0600 | [diff] [blame] | 110 | -G"Ninja" \ |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 111 | -DBOARD=$(BOARD) \ |
| 112 | $(SOURCE_DIRECTORY)/../../boot/zephyr && \ |
David Brown | 358ca1a | 2019-06-25 10:13:20 -0600 | [diff] [blame] | 113 | ninja) |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 114 | cp $(BUILD_DIR_BOOT)/zephyr/zephyr.bin mcuboot.bin |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 115 | |
| 116 | clean_boot: check |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 117 | rm -rf $(BUILD_DIR_BOOT) |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 118 | |
| 119 | # Build and sign "hello1". |
| 120 | hello1: check |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 121 | (mkdir -p $(BUILD_DIR_HELLO1) && \ |
| 122 | cd $(BUILD_DIR_HELLO1) && \ |
| 123 | cmake -DFROM_WHO=hello1 \ |
David Brown | 358ca1a | 2019-06-25 10:13:20 -0600 | [diff] [blame] | 124 | -G"Ninja" \ |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 125 | -DBOARD=$(BOARD) \ |
| 126 | $(SOURCE_DIRECTORY)/hello-world && \ |
David Brown | 358ca1a | 2019-06-25 10:13:20 -0600 | [diff] [blame] | 127 | ninja) |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 128 | $(IMGTOOL) sign \ |
| 129 | --key $(SIGNING_KEY) \ |
| 130 | --header-size $(BOOT_HEADER_LEN) \ |
| 131 | --align $(FLASH_ALIGNMENT) \ |
| 132 | --version 1.2 \ |
Fabio Utzig | ffffbad | 2018-07-10 09:34:25 -0300 | [diff] [blame] | 133 | --slot-size 0x60000 \ |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 134 | $(BUILD_DIR_HELLO1)/zephyr/zephyr.bin \ |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 135 | signed-hello1.bin |
| 136 | |
| 137 | clean_hello1: check |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 138 | rm -rf $(BUILD_DIR_HELLO1) |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 139 | |
| 140 | # Build and sign "hello2". |
| 141 | # This is the same signing command as above, except that it adds the |
| 142 | # "--pad" argument. This will also add the trailer that indicates |
| 143 | # this image is intended to be an upgrade. It should be flashed into |
David Vincze | 2d736ad | 2019-02-18 11:50:22 +0100 | [diff] [blame] | 144 | # the secondary slot instead of the primary slot. |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 145 | hello2: check |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 146 | (mkdir -p $(BUILD_DIR_HELLO2) && \ |
| 147 | cd $(BUILD_DIR_HELLO2) && \ |
| 148 | cmake -DFROM_WHO=hello2 \ |
David Brown | 358ca1a | 2019-06-25 10:13:20 -0600 | [diff] [blame] | 149 | -G"Ninja" \ |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 150 | -DBOARD=$(BOARD) \ |
| 151 | $(SOURCE_DIRECTORY)/hello-world && \ |
David Brown | 358ca1a | 2019-06-25 10:13:20 -0600 | [diff] [blame] | 152 | ninja) |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 153 | $(IMGTOOL) sign \ |
| 154 | --key $(SIGNING_KEY) \ |
| 155 | --header-size $(BOOT_HEADER_LEN) \ |
| 156 | --align $(FLASH_ALIGNMENT) \ |
| 157 | --version 1.2 \ |
Fabio Utzig | 263d439 | 2018-06-05 10:37:35 -0300 | [diff] [blame] | 158 | --slot-size 0x60000 \ |
| 159 | --pad \ |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 160 | $(BUILD_DIR_HELLO2)/zephyr/zephyr.bin \ |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 161 | signed-hello2.bin |
| 162 | |
| 163 | clean_hello2: check |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 164 | rm -rf $(BUILD_DIR_HELLO2) |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 165 | |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 166 | # These flash_* targets use pyocd to flash the images. The addresses |
| 167 | # are hardcoded at this time. |
| 168 | |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 169 | flash_boot: |
Maureen Helm | 0e0c488 | 2019-02-18 17:20:00 -0600 | [diff] [blame] | 170 | $(PYOCD) flash -e chip -a 0 mcuboot.bin |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 171 | |
| 172 | flash_hello1: |
Maureen Helm | 0e0c488 | 2019-02-18 17:20:00 -0600 | [diff] [blame] | 173 | $(PYOCD) flash -a 0x20000 signed-hello1.bin |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 174 | |
| 175 | flash_hello2: |
Maureen Helm | 0e0c488 | 2019-02-18 17:20:00 -0600 | [diff] [blame] | 176 | $(PYOCD) flash -a 0x80000 signed-hello2.bin |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 177 | |
David Brown | 84a67af | 2017-07-26 00:36:02 -0600 | [diff] [blame] | 178 | flash_full: |
Maureen Helm | 0e0c488 | 2019-02-18 17:20:00 -0600 | [diff] [blame] | 179 | $(PYOCD) flash -e chip -a 0 full.bin |
David Brown | 84a67af | 2017-07-26 00:36:02 -0600 | [diff] [blame] | 180 | |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 181 | # These test- targets reinvoke make with the configuration set to test |
| 182 | # various configurations. This will generally be followed by using |
| 183 | # the above flash targets. |
| 184 | |
| 185 | # Test a good image, with a good upgrade, using RSA signatures. |
| 186 | # flash_boot: Unable to find bootable image |
| 187 | # flash_hello1: hello1 runs |
| 188 | # flash_hello2: hello2 runs |
| 189 | # reset: hello1 runs |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 190 | test-good-rsa: clean |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 191 | $(MAKE) \ |
Marti Bolivar | a4818a5 | 2018-04-12 13:02:38 -0400 | [diff] [blame] | 192 | BOOTLOADER_OVERLAY_CONFIG=$(PWD)/overlay-rsa.conf \ |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 193 | all |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 194 | |
| 195 | # Test a good image, with a good upgrade, using ECDSA signatures. |
| 196 | # flash_boot: Unable to find bootable image |
| 197 | # flash_hello1: hello1 runs |
| 198 | # flash_hello2: hello2 runs |
| 199 | # reset: hello1 runs |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 200 | test-good-ecdsa: clean |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 201 | $(MAKE) \ |
Marti Bolivar | a4818a5 | 2018-04-12 13:02:38 -0400 | [diff] [blame] | 202 | BOOTLOADER_OVERLAY_CONFIG=$(PWD)/overlay-ecdsa-p256.conf \ |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 203 | SIGNING_KEY=../../root-ec-p256.pem \ |
| 204 | all |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 205 | |
| 206 | # Test (with RSA) that overwrite-only works. This should boot, |
| 207 | # upgrade correctly, but not revert once the upgrade has been done. |
| 208 | # flash_boot: Unable to find bootable image |
| 209 | # flash_hello1: hello1 runs |
| 210 | # flash_hello2: hello2 runs |
| 211 | # reset: hello2 runs |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 212 | test-overwrite: clean |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 213 | $(MAKE) \ |
Marti Bolivar | a879843 | 2018-04-12 13:12:06 -0400 | [diff] [blame] | 214 | BOOTLOADER_OVERLAY_CONFIG=$(PWD)/overlay-upgrade-only.conf \ |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 215 | all |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 216 | |
| 217 | # Test that when configured for RSA, a wrong signature in the upgrade |
| 218 | # image will fail to upgrade. |
| 219 | # flash_boot: Unable to find bootable image |
| 220 | # flash_hello1: hello1 runs |
| 221 | # flash_hello2: hello1 runs |
| 222 | # reset: hello1 runs |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 223 | test-bad-rsa-upgrade: clean |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 224 | $(MAKE) \ |
Marti Bolivar | a4818a5 | 2018-04-12 13:02:38 -0400 | [diff] [blame] | 225 | BOOTLOADER_OVERLAY_CONFIG=$(PWD)/overlay-rsa.conf \ |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 226 | boot hello1 |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 227 | $(MAKE) \ |
Marti Bolivar | a4818a5 | 2018-04-12 13:02:38 -0400 | [diff] [blame] | 228 | BOOTLOADER_OVERLAY_CONFIG=$(PWD)/overlay-rsa.conf \ |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 229 | SIGNING_KEY=../../root-ec-p256.pem \ |
| 230 | hello2 |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 231 | |
| 232 | # Test that when configured for ECDSA, a wrong signature in the upgrade |
| 233 | # image will fail to upgrade. |
| 234 | # flash_boot: Unable to find bootable image |
| 235 | # flash_hello1: hello1 runs |
| 236 | # flash_hello2: hello1 runs |
| 237 | # reset: hello1 runs |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 238 | test-bad-ecdsa-upgrade: clean |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 239 | $(MAKE) \ |
Marti Bolivar | a4818a5 | 2018-04-12 13:02:38 -0400 | [diff] [blame] | 240 | BOOTLOADER_OVERLAY_CONFIG=$(PWD)/overlay-ecdsa-p256.conf \ |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 241 | SIGNING_KEY=../../root-ec-p256.pem \ |
| 242 | boot hello1 |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 243 | $(MAKE) \ |
Marti Bolivar | a4818a5 | 2018-04-12 13:02:38 -0400 | [diff] [blame] | 244 | BOOTLOADER_OVERLAY_CONFIG=$(PWD)/overlay-ecdsa-p256.conf \ |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 245 | SIGNING_KEY=../../root-rsa-2048.pem \ |
| 246 | hello2 |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 247 | |
David Vincze | 2d736ad | 2019-02-18 11:50:22 +0100 | [diff] [blame] | 248 | # Test that when configured to not validate the primary slot, we still boot, but |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 249 | # don't upgrade. |
| 250 | # flash_boot: tries to boot and resets |
| 251 | # flash_hello1: hello1 runs |
| 252 | # flash_hello2: hello1 runs |
| 253 | # reset: hello1 runs |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 254 | test-no-bootcheck: clean |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 255 | $(MAKE) \ |
David Vincze | 2d736ad | 2019-02-18 11:50:22 +0100 | [diff] [blame] | 256 | BOOTLOADER_OVERLAY_CONFIG=$(PWD)/overlay-skip-primary-slot-validate.conf \ |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 257 | SIGNING_KEY=../../root-ec-p256.pem \ |
| 258 | all |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 259 | |
| 260 | # Test a good image, with a wrong-signature upgrade, using RSA signatures. |
| 261 | # flash_boot: Unable to find bootable image |
| 262 | # flash_hello1: hello1 runs |
| 263 | # flash_hello2: hello1 runs |
| 264 | # reset: hello1 runs |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 265 | test-wrong-rsa: clean |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 266 | $(MAKE) \ |
Marti Bolivar | a4818a5 | 2018-04-12 13:02:38 -0400 | [diff] [blame] | 267 | BOOTLOADER_OVERLAY_CONFIG=$(PWD)/overlay-rsa.conf \ |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 268 | boot hello1 |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 269 | $(MAKE) \ |
Marti Bolivar | a4818a5 | 2018-04-12 13:02:38 -0400 | [diff] [blame] | 270 | BOOTLOADER_OVERLAY_CONFIG=$(PWD)/overlay-rsa.conf \ |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 271 | SIGNING_KEY=bad-keys/bad-rsa-2048.pem \ |
| 272 | hello2 |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 273 | |
| 274 | # Test a good image, with a wrong-signature upgrade, using ECDSA signatures. |
| 275 | # flash_boot: Unable to find bootable image |
| 276 | # flash_hello1: hello1 runs |
| 277 | # flash_hello2: hello1 runs |
| 278 | # reset: hello1 runs |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 279 | test-wrong-ecdsa: clean |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 280 | $(MAKE) \ |
Marti Bolivar | a4818a5 | 2018-04-12 13:02:38 -0400 | [diff] [blame] | 281 | BOOTLOADER_OVERLAY_CONFIG=$(PWD)/overlay-ecdsa-p256.conf \ |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 282 | SIGNING_KEY=../../root-ec-p256.pem \ |
| 283 | boot hello1 |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 284 | $(MAKE) \ |
Marti Bolivar | a4818a5 | 2018-04-12 13:02:38 -0400 | [diff] [blame] | 285 | BOOTLOADER_OVERLAY_CONFIG=$(PWD)/overlay-ecdsa-p256.conf \ |
Marti Bolivar | bf909a1 | 2017-11-13 19:43:46 -0500 | [diff] [blame] | 286 | SIGNING_KEY=bad-keys/bad-ec-p256.pem \ |
| 287 | hello2 |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 288 | |
David Brown | ada28e1 | 2017-07-05 13:36:37 -0600 | [diff] [blame] | 289 | check: |
| 290 | @if [ -z "$$ZEPHYR_BASE" ]; then echo "Zephyr environment not set up"; false; fi |
Marti Bolivar | 7135410 | 2017-08-01 15:09:44 -0400 | [diff] [blame] | 291 | @if [ -z "$(BOARD)" ]; then echo "You must specify BOARD=<board>"; false; fi |