Skip to content

Commit 736dab3

Browse files
Automate generation of signing_keys.c
1 parent bd5178e commit 736dab3

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

.github/workflows/compile.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ jobs:
3333
python3 -m pip install --user -r mcuboot/scripts/requirements.txt
3434
python3 -m pip install --user mcuboot/scripts
3535
$HOME/.local/bin/imgtool keygen -k signing-keys.pem -t rsa-2048
36-
$HOME/.local/bin/imgtool getpub -k signing-keys.pem > signing_keys.c
3736
3837
- name: Build project for ${{ matrix.mbed_target }}
3938
run: |
4039
mkdir build && cd build
41-
cmake .. -GNinja -DMBED_TARGET=${{ matrix.mbed_target }}
40+
cmake .. -GNinja -DMBED_TARGET=${{ matrix.mbed_target }} -DMCUBOOT_SIGNING_KEY=signing-keys.pem
4241
ninja

CMakeLists.txt

+1-6
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@ project(mbed-mcuboot-bootloader)
1212
set(MBED_MCUBOOT_BOOTLOADER_SOURCES
1313
secondary_bd.cpp
1414
enc_key.c
15-
shared_data.c
16-
signing_keys.c)
17-
18-
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/signing_keys.c)
19-
message(FATAL_ERROR "Missing signing_keys.c in source directory! Please follow the README instructions to generate the signing keys!")
20-
endif()
15+
shared_data.c)
2116

2217
# Compile mcuboot sources
2318
add_subdirectory(mcuboot/boot/bootutil)

mbed-os

Submodule mbed-os updated 30 files

secondary_bd.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "SlicingBlockDevice.h"
1111
#include "FlashIAPBlockDevice.h"
12+
#include "BufferedBlockDevice.h"
1213

1314
#if MBED_CONF_APP_SECONDARY_SLOT_IN_FLASH
1415

@@ -35,9 +36,14 @@ mbed::BlockDevice* get_secondary_bd(void) {
3536
// If this assert fails, there is no block def
3637
MBED_ASSERT(default_bd != nullptr);
3738

39+
// mcuboot assumes that the read size of the secondary block device is the same as the read size
40+
// of flash, so use a BufferedBlockDevice to wrap the underlying BD and ensure this is the case.
41+
static mbed::BufferedBlockDevice buffered_bd(default_bd);
42+
3843
// In this case, our flash is much larger than a single image so
3944
// slice it into the size of an image slot
40-
static mbed::SlicingBlockDevice sliced_bd(default_bd, 0x0, MCUBOOT_SLOT_SIZE);
45+
static mbed::SlicingBlockDevice sliced_bd(&buffered_bd, 0x0, MCUBOOT_SLOT_SIZE);
46+
4147
return &sliced_bd;
4248
}
4349
#endif

0 commit comments

Comments
 (0)