Skip to content

Commit

Permalink
Automate generation of signing_keys.c
Browse files Browse the repository at this point in the history
  • Loading branch information
multiplemonomials committed Dec 15, 2024
1 parent bd5178e commit 736dab3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ jobs:
python3 -m pip install --user -r mcuboot/scripts/requirements.txt
python3 -m pip install --user mcuboot/scripts
$HOME/.local/bin/imgtool keygen -k signing-keys.pem -t rsa-2048
$HOME/.local/bin/imgtool getpub -k signing-keys.pem > signing_keys.c
- name: Build project for ${{ matrix.mbed_target }}
run: |
mkdir build && cd build
cmake .. -GNinja -DMBED_TARGET=${{ matrix.mbed_target }}
cmake .. -GNinja -DMBED_TARGET=${{ matrix.mbed_target }} -DMCUBOOT_SIGNING_KEY=signing-keys.pem
ninja
7 changes: 1 addition & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ project(mbed-mcuboot-bootloader)
set(MBED_MCUBOOT_BOOTLOADER_SOURCES
secondary_bd.cpp
enc_key.c
shared_data.c
signing_keys.c)

if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/signing_keys.c)
message(FATAL_ERROR "Missing signing_keys.c in source directory! Please follow the README instructions to generate the signing keys!")
endif()
shared_data.c)

# Compile mcuboot sources
add_subdirectory(mcuboot/boot/bootutil)
Expand Down
2 changes: 1 addition & 1 deletion mbed-os
Submodule mbed-os updated 30 files
+1 −0 connectivity/cellular/CMakeLists.txt
+14 −0 connectivity/drivers/cellular/Altair/COMPONENT_ALTAIR_ALT1250/PPP/ALT1250_PPP.cpp
+12 −0 connectivity/drivers/cellular/Altair/COMPONENT_ALTAIR_ALT1250/PPP/CMakeLists.txt
+12 −0 connectivity/drivers/cellular/COMPONENT_STMOD_CELLULAR/CMakeLists.txt
+14 −0 connectivity/drivers/cellular/COMPONENT_STMOD_CELLULAR/STModCellular.cpp
+12 −0 connectivity/drivers/cellular/GEMALTO/COMPONENT_GEMALTO_CINTERION/CMakeLists.txt
+14 −0 connectivity/drivers/cellular/GEMALTO/COMPONENT_GEMALTO_CINTERION/GEMALTO_CINTERION.cpp
+12 −0 connectivity/drivers/cellular/GENERIC/COMPONENT_GENERIC_AT3GPP/CMakeLists.txt
+14 −0 connectivity/drivers/cellular/GENERIC/COMPONENT_GENERIC_AT3GPP/GENERIC_AT3GPP.cpp
+13 −1 ...ctivity/drivers/cellular/MultiTech/DragonflyNano/COMPONENT_MULTITECH_DRAGONFLY_NANO_CELLULAR/CMakeLists.txt
+14 −0 ...ectivity/drivers/cellular/MultiTech/DragonflyNano/COMPONENT_MULTITECH_DRAGONFLY_NANO_CELLULAR/SARA4_PPP.cpp
+12 −0 connectivity/drivers/cellular/RiotMicro/COMPONENT_RIOTMICRO_RM1000/CMakeLists.txt
+14 −0 connectivity/drivers/cellular/RiotMicro/COMPONENT_RIOTMICRO_RM1000/RM1000_AT.cpp
+13 −1 connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_HE910/CMakeLists.txt
+14 −0 connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_HE910/TELIT_HE910.cpp
+13 −1 connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME310/CMakeLists.txt
+14 −0 connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME310/TELIT_ME310.cpp
+13 −1 connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME910/CMakeLists.txt
+14 −0 connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME910/TELIT_ME910.cpp
+1 −1 connectivity/drivers/emac/TARGET_Freescale_EMAC/kinetis_emac.cpp
+6 −0 connectivity/mbedtls/CMakeLists.txt
+7 −0 connectivity/netsocket/source/NetworkInterfaceDefaults.cpp
+1 −1 platform/mbed-trace/include/mbed-trace/mbed_trace.h
+1 −1 platform/mbed-trace/source/mbed_trace.c
+9 −2 storage/blockdevice/include/blockdevice/BufferedBlockDevice.h
+89 −70 targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_GCC_ARM/MK64FN1M0xxx12.ld
+9 −2 targets/TARGET_NUVOTON/scripts/mbed_set_post_build_nuvoton.cmake
+6 −6 targets/cmsis_mcu_descriptions.json5
+1 −1 tools/cmake/UploadMethodManager.cmake
+11 −10 tools/cmake/mbed_target_functions.cmake
2 changes: 1 addition & 1 deletion mcuboot
8 changes: 7 additions & 1 deletion secondary_bd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "SlicingBlockDevice.h"
#include "FlashIAPBlockDevice.h"
#include "BufferedBlockDevice.h"

#if MBED_CONF_APP_SECONDARY_SLOT_IN_FLASH

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

// mcuboot assumes that the read size of the secondary block device is the same as the read size
// of flash, so use a BufferedBlockDevice to wrap the underlying BD and ensure this is the case.
static mbed::BufferedBlockDevice buffered_bd(default_bd);

// In this case, our flash is much larger than a single image so
// slice it into the size of an image slot
static mbed::SlicingBlockDevice sliced_bd(default_bd, 0x0, MCUBOOT_SLOT_SIZE);
static mbed::SlicingBlockDevice sliced_bd(&buffered_bd, 0x0, MCUBOOT_SLOT_SIZE);

return &sliced_bd;
}
#endif

0 comments on commit 736dab3

Please sign in to comment.