Closed snowuyl closed 12 months ago
Hi Is this still an issue? Do you have an DevZone ticket for this problem?
Is this still an issue?
It still can't build successfully on ncs v2.4.2 with the following error messages. C:\ncs\v2.4.2\nrf\samples\mcuboot_smp_custom_key>west build -b nrf5340dk_nrf5340_cpuapp -- west build: generating a build system Loading Zephyr default modules (Zephyr base). -- Application: C:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key -- CMake version: 3.20.5 -- Using NCS Toolchain 2.4.0 for building. (C:/ncs/toolchains/31f4403e35/cmake) -- Found Python3: C:/ncs/toolchains/31f4403e35/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter -- Cache files will be written to: C:/ncs/v2.4.2/zephyr/.cache -- Zephyr version: 3.3.99 (C:/ncs/v2.4.2/zephyr) -- Found west (found suitable version "1.0.0", minimum required is "0.7.1") -- Board: nrf5340dk_nrf5340_cpuapp -- Found host-tools: zephyr 0.16.0 (C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk) -- Found toolchain: zephyr 0.16.0 (C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk) -- Found Dtc: C:/ncs/toolchains/31f4403e35/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6") -- Found BOARD.dts: C:/ncs/v2.4.2/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts -- Generated zephyr.dts: C:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key/build/zephyr/zephyr.dts -- Generated devicetree_generated.h: C:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key/build/zephyr/include/generated/devicetree_generated.h -- Including generated dts.cmake file: C:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key/build/zephyr/dts.cmake Parsing C:/ncs/v2.4.2/zephyr/Kconfig Loaded configuration 'C:/ncs/v2.4.2/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig' Merged configuration 'C:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key/prj.conf' Configuration saved to 'C:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key/build/zephyr/.config' Kconfig header saved to 'C:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key/build/zephyr/include/generated/autoconf.h' -- Found GnuLd: c:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38") -- The C compiler identification is GNU 12.2.0 -- The CXX compiler identification is GNU 12.2.0 -- The ASM compiler identification is GNU -- Found assembler: C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe -- Found Python3: C:/ncs/toolchains/31f4403e35/opt/bin/python.exe (found version "3.8.2") found components: Interpreter
=== child image mcuboot - begin === loading initial cache file C:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key/build/mcuboot/child_image_preload.cmake Loading Zephyr default modules (Zephyr base).-- Application: C:/ncs/v2.4.2/bootloader/mcuboot/boot/zephyr
-- CMake version: 3.20.5 -- Using NCS Toolchain 2.4.0 for building. (C:/ncs/toolchains/31f4403e35/cmake) -- Found Python3: C:/ncs/toolchains/31f4403e35/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter -- Cache files will be written to: C:/ncs/v2.4.2/zephyr/.cache -- Zephyr version: 3.3.99 (C:/ncs/v2.4.2/zephyr) -- Found west (found suitable version "1.0.0", minimum required is "0.7.1") -- Board: nrf5340dk_nrf5340_cpuapp -- Found host-tools: zephyr 0.16.0 (C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk) -- Found toolchain: zephyr 0.16.0 (C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk) -- Found Dtc: C:/ncs/toolchains/31f4403e35/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6") -- Found BOARD.dts: C:/ncs/v2.4.2/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts -- Found devicetree overlay: C:/ncs/v2.4.2/nrf/modules/mcuboot/usb.overlay -- Generated zephyr.dts: C:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key/build/mcuboot/zephyr/zephyr.dts -- Generated devicetree_generated.h: C:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key/build/mcuboot/zephyr/include/generated/devicetree_generated.h -- Including generated dts.cmake file: C:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key/build/mcuboot/zephyr/dts.cmake Parsing C:/ncs/v2.4.2/bootloader/mcuboot/boot/zephyr/Kconfig Loaded configuration 'C:/ncs/v2.4.2/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig' Merged configuration 'C:/ncs/v2.4.2/bootloader/mcuboot/boot/zephyr/prj.conf' Merged configuration 'C:/ncs/v2.4.2/nrf/subsys/partition_manager/partition_manager_enabled.conf' Merged configuration 'C:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key/build/mcuboot/zephyr/misc/generated/extra_kconfig_options.conf' Configuration saved to 'C:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key/build/mcuboot/zephyr/.config' Kconfig header saved to 'C:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key/build/mcuboot/zephyr/include/generated/autoconf.h' -- Found GnuLd: c:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38") -- The C compiler identification is GNU 12.2.0 -- The CXX compiler identification is GNU 12.2.0 -- The ASM compiler identification is GNU -- Found assembler: C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe CMake Warning at C:/ncs/v2.4.2/zephyr/CMakeLists.txt:839 (message): No SOURCES given to Zephyr library: liblibccommon
Excluding target from build.
MCUBoot bootloader key file: C:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key/custom_key_dir/custom_priv.pem -- Configuring done -- Generating done -- Build files have been written to: C:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key/build/mcuboot === child image mcuboot - end ===
CMake Warning at C:/ncs/v2.4.2/zephyr/CMakeLists.txt:839 (message): No SOURCES given to Zephyr library: liblibccommon
Excluding target from build.
-- Configuring done
-- Generating done
-- Build files have been written to: C:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key/build
-- west build: building application
[1/225] Generating include/generated/version.h
-- Zephyr version: 3.3.99 (C:/ncs/v2.4.2/zephyr), build: v3.3.99-ncs1-1
[6/225] Performing build step for 'mcuboot_subimage'
[1/291] Generating include/generated/version.h
-- Zephyr version: 3.3.99 (C:/ncs/v2.4.2/zephyr), build: v3.3.99-ncs1-1
[281/291] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map
cmd.exe /C "cd . && C:\ncs\toolchains\31f4403e35\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr\zephyr_pre0.elf -fuse-ld=bfd -T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=C:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key/build/mcuboot/zephyr/zephyr_pre0.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarchcommon.a zephyr/arch/arch/arm/core/aarch32/libarcharmcoreaarch32.a zephyr/arch/arch/arm/core/aarch32/cortex_m/libarcharmcoreaarch32cortex_m.a zephyr/arch/arch/arm/core/aarch32/cortex_m/cmse/libarcharmcoreaarch32cortex_mcmse.a zephyr/arch/arch/arm/core/aarch32/mpu/libarcharmcoreaarch32mpu.a zephyr/lib/libc/minimal/libliblibcminimal.a zephyr/soc/arm/common/cortex_m/libsocarmcommoncortex_m.a zephyr/drivers/clock_control/libdriversclock_control.a zephyr/drivers/console/libdriversconsole.a zephyr/drivers/flash/libdriversflash.a zephyr/drivers/gpio/libdriversgpio.a zephyr/drivers/pinctrl/libdriverspinctrl.a zephyr/drivers/serial/libdriversserial.a zephyr/drivers/timer/libdriverstimer.a modules/nrf/lib/fprotect/lib..nrflibfprotect.a modules/nrf/lib/fatal_error/lib..nrflibfatal_error.a modules/nrf/drivers/hw_cc310/lib..nrfdrivershw_cc310.a modules/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a modules/mbedtls/libmodulesmbedtls.a modules/hal_nordic/nrfx/libmodules__hal_nordicnrfx.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -L"c:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v8-m.main/nofp" -LC:/ncs/v2.4.2/nrf/samples/mcuboot_smp_custom_key/build/mcuboot/zephyr -lgcc zephyr/arch/common/libisr_tables.a -mcpu=cortex-m33 -mthumb -mabi=aapcs -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -Wl,-no-pie C:/ncs/v2.4.2/nrfxlib/crypto/nrf_cc312_platform/lib/cortex-m33/soft-float/no-interrupts/libnrf_cc312_platform_0.9.17.a && cmd.exe /C "cd /D C:\ncs\v2.4.2\nrf\samples\mcuboot_smp_custom_key\build\mcuboot\zephyr && C:\ncs\toolchains\31f4403e35\opt\bin\cmake.exe -E echo ""
c:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: app/libapp.a(keys.c.obj):C:/ncs/v2.4.2/bootloader/mcuboot/boot/zephyr/keys.c:52: undefined reference to rsa_pub_key' c:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: app/libapp.a(keys.c.obj):(.rodata.bootutil_keys+0x4): undefined reference to
rsa_pub_key_len'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
[204/225] Linking C executable zephyr\zephyr_pre0.elf
[208/225] Linking C executable zephyr\zephyr_pre1.elf
[210/225] Building C object zephyr/CMakeFiles/zephyr_final.dir/isr_tables.c.obj FAILED: modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build mcuboot/zephyr/zephyr.hex mcuboot/zephyr/zephyr.elf cmd.exe /C "cd /D C:\ncs\v2.4.2\nrf\samples\mcuboot_smp_custom_key\build\mcuboot && C:\ncs\toolchains\31f4403e35\opt\bin\cmake.exe --build . --" [214/225] Building C object zephyr/CMakeFiles/zephyr_final.dir/isr_tables.c.obj ninja: build stopped: subcommand failed. FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\31f4403e35\opt\bin\cmake.EXE' --build 'C:\ncs\v2.4.2\nrf\samples\mcuboot_smp_custom_key\build'
Which key types used by mcuboot_smp_custom_key\custom_key_dir\custom_priv.pem? There are rsa-2048, rsa-3072, ecdsa-p256 and ed25519 key types.
Fixed the error in https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/commit/189d6a9122d0f76fc28b9d83d169d4c5abc13390
Which key types used by mcuboot_smp_custom_key\custom_key_dir\custom_priv.pem? There are rsa-2048, rsa-3072, ecdsa-p256 and ed25519 key types.
See The README for the sample for how the key is generated
I have fixed this issue by modifying CMakeLists.txt as follows. cmake_minimum_required(VERSION 3.20.0)
set(mcuboot_CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256 y) set(mcuboot_CONFIG_BOOT_SIGNATURE_KEY_FILE \"${CMAKE_CURRENT_SOURCE_DIR}/custom_key_dir/custom_priv.pem\")
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(mcuboot_smp_custom_key)
target_sources(app PRIVATE src/main.c)
Thanks for your reply! I try to build the following sample. But it failed to build.
https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/keys_and_signatures/mcuboot_smp_custom_key
The following are log messages of west build.
D:\ncs\v2.4.0\bootloader\mcuboot\samples\zephyr\mcuboot_smp_custom_key>west build -b nrf5340dk_nrf5340_cpuapp -- west build: generating a build system
...
warning: MCUMGR (defined at subsys/mgmt/mcumgr/Kconfig:5) was assigned the value 'y' but got the value 'n'. Check these unsatisfied dependencies: NET_BUF (=n), ZCBOR (=n). See docs.zephyrproject.org/.../kconfig.html and/or look up MCUMGR in the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too.
D:/ncs/v2.4.0/bootloader/mcuboot/samples/zephyr/mcuboot_smp_custom_key/prj.conf:3: warning: attempt to assign the value 'y' to the undefined symbol MCUMGR_SMP_UART
D:/ncs/v2.4.0/bootloader/mcuboot/samples/zephyr/mcuboot_smp_custom_key/prj.conf:4: warning: attempt to assign the value 'y' to the undefined symbol MCUMGR_CMD_IMG_MGMT Parsing D:/ncs/v2.4.0/zephyr/Kconfig Loaded configuration 'D:/ncs/v2.4.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig' Merged configuration 'D:/ncs/v2.4.0/bootloader/mcuboot/samples/zephyr/mcuboot_smp_custom_key/prj.conf'
error: Aborting due to Kconfig warnings
Procedures to reproduce this issue are as follows.
Unzipping mcuboot_smp_custom_key.zip to D:\ncs\v2.4.0\bootloader\mcuboot\samples\zephyr\ folder.
west build -b nrf5340dk_nrf5340_cpuapp