mcuboot starting documentation
This commit is contained in:
@@ -19,12 +19,41 @@ west flash --runner pyocd # had to su root first to run this (after running nix
|
||||
|
||||
# MCUBoot
|
||||
cd ~/utat-dev/zephyrproject
|
||||
west build -p always -b nucleo_g431rb bootloader/mcuboot/boot/zephyr -d build/mcuboot -- -DEXTRA_CONF_FILE=mcuboot-nucleo-g431rb.conf
|
||||
# Configure the DTS for partition sizes: https://docs.zephyrproject.org/latest/build/dts/intro-scope-purpose.html
|
||||
# https://docs.zephyrproject.org/latest/build/dts/api/bindings/mtd/fixed-partitions.html
|
||||
nvim "zephyr/boards/st/nucleo_g431rb/nucleo_g431rb.dts"
|
||||
|
||||
# Create a private key: https://docs.mcuboot.com/readme-zephyr.html
|
||||
./scripts/imgtool.py keygen -k mykey.pem -t rsa-2048
|
||||
|
||||
# Create its public key
|
||||
openssl rsa -in mykey.pem -pubout > pubkey.pem
|
||||
|
||||
# Set up signing: https://docs.mcuboot.com/readme-zephyr.html
|
||||
# ./bootloader/mcuboot/samples/zephyr/Makefile
|
||||
python scripts/imgtool.py sign \
|
||||
--key mykey.pem \
|
||||
--header-size 0x200 \
|
||||
--align 8 \
|
||||
--version 1.2 \
|
||||
--slot-size 0x8000 \
|
||||
./
|
||||
|
||||
|
||||
# Add the key file path to the KConfig https://docs.zephyrproject.org/latest/build/kconfig/setting.html
|
||||
echo "
|
||||
|
||||
# Set the key file
|
||||
CONFIG_BOOT_SIGNATURE_KEY_FILE=pubkey.pem" >> "./zephyr/boards/st/nucleo_g431rb/nucleo_g431rb_defconfig"
|
||||
|
||||
|
||||
|
||||
west build -p always -b nucleo_g431rb bootloader/mcuboot/boot/zephyr -d build/mcuboot -- -DEXTRA_CONF_FILE=mcuboot-nucleo-g431rb.conf
|
||||
west flash -d build/mcuboot --runner pyocd # (as root, with nix develop)
|
||||
|
||||
cd zephyr
|
||||
# Package 1
|
||||
west build -p always -b nucleo_g431rb samples/basic/blinky -d build/app -- -DCONFIG_BOOTLOADER_MCUBOOT=y -DCONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE=y
|
||||
west build -p always -b nucleo_g431rb samples/basic/blinky -d build/app -- -DCONFIG_BOOTLOADER_MCUBOOT=y -DCONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE=y
|
||||
west flash -d build/app --runner pyocd # (as root, with nix develop)
|
||||
|
||||
# Package 2
|
||||
|
||||
Reference in New Issue
Block a user