Implement filesystem-based partition state management#608
Closed
julek-wolfssl wants to merge 7 commits intowolfSSL:masterfrom
Closed
Implement filesystem-based partition state management#608julek-wolfssl wants to merge 7 commits intowolfSSL:masterfrom
julek-wolfssl wants to merge 7 commits intowolfSSL:masterfrom
Conversation
a89e90b to
75d8485
Compare
dgarske
requested changes
Oct 15, 2025
Contributor
dgarske
left a comment
There was a problem hiding this comment.
make clean && make lib-fs
[CC sim] src/string.o
[CC sim] src/image.o
[CC sim] src/libwolfboot.o
[CC sim] hal/hal.o
[CC sim] src/keystore.o
[CC sim] src/xmalloc.o
[CC sim] /home/davidgarske/GitHub/wolfboot-alt/lib/wolfssl/wolfcrypt/src/sha256.o
[CC sim] /home/davidgarske/GitHub/wolfboot-alt/lib/wolfssl/wolfcrypt/src/hash.o
[CC sim] /home/davidgarske/GitHub/wolfboot-alt/lib/wolfssl/wolfcrypt/src/memory.o
[CC sim] /home/davidgarske/GitHub/wolfboot-alt/lib/wolfssl/wolfcrypt/src/wc_port.o
[CC sim] /home/davidgarske/GitHub/wolfboot-alt/lib/wolfssl/wolfcrypt/src/wolfmath.o
[CC sim] /home/davidgarske/GitHub/wolfboot-alt/lib/wolfssl/wolfcrypt/src/logging.o
[CC sim] /home/davidgarske/GitHub/wolfboot-alt/lib/wolfssl/wolfcrypt/src/asn.o
[CC sim] /home/davidgarske/GitHub/wolfboot-alt/lib/wolfssl/wolfcrypt/src/sha512.o
[CC sim] /home/davidgarske/GitHub/wolfboot-alt/lib/wolfssl/wolfcrypt/src/ed25519.o
[CC sim] /home/davidgarske/GitHub/wolfboot-alt/lib/wolfssl/wolfcrypt/src/ge_low_mem.o
[CC sim] /home/davidgarske/GitHub/wolfboot-alt/lib/wolfssl/wolfcrypt/src/fe_low_mem.o
[LIB] libwolfboot.a
[CC sim] hal/library.o
[BIN] lib-fs
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [Makefile:207: lib-fs] Error 1
Not related, but on 32-bit targets getting these printf warnings. Can you fix these too?
In file included from hal/library.c:42:
hal/library.c: In function 'wolfBoot_start':
hal/library.c:144:25: error: format '%d' expects argument of type 'int', but argument 4 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
144 | wolfBoot_printf("Failure %d: Hdr %d, Hash %d, Sig %d\n", ret,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145 | os_image.hdr_ok, os_image.sha_ok, os_image.signature_ok);
| ~~~~~~~~~~~~~~~
| |
| uint32_t {aka long unsigned int}
include/printf.h:71:58: note: in definition of macro 'wolfBoot_printf'
71 | # define wolfBoot_printf(_f_, ...) fprintf(stderr, _f_, ##__VA_ARGS__)
| ^~~
hal/library.c:144:43: note: format string is defined here
144 | wolfBoot_printf("Failure %d: Hdr %d, Hash %d, Sig %d\n", ret,
| ~^
| |
| int
| %ld
hal/library.c:144:25: error: format '%d' expects argument of type 'int', but argument 5 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
144 | wolfBoot_printf("Failure %d: Hdr %d, Hash %d, Sig %d\n", ret,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145 | os_image.hdr_ok, os_image.sha_ok, os_image.signature_ok);
| ~~~~~~~~~~~~~~~
| |
| uint32_t {aka long unsigned int}
include/printf.h:71:58: note: in definition of macro 'wolfBoot_printf'
71 | # define wolfBoot_printf(_f_, ...) fprintf(stderr, _f_, ##__VA_ARGS__)
| ^~~
hal/library.c:144:52: note: format string is defined here
144 | wolfBoot_printf("Failure %d: Hdr %d, Hash %d, Sig %d\n", ret,
| ~^
| |
| int
| %ld
hal/library.c:144:25: error: format '%d' expects argument of type 'int', but argument 6 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
144 | wolfBoot_printf("Failure %d: Hdr %d, Hash %d, Sig %d\n", ret,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145 | os_image.hdr_ok, os_image.sha_ok, os_image.signature_ok);
| ~~~~~~~~~~~~~~~~~~~~~
| |
| uint32_t {aka long unsigned int}
include/printf.h:71:58: note: in definition of macro 'wolfBoot_printf'
71 | # define wolfBoot_printf(_f_, ...) fprintf(stderr, _f_, ##__VA_ARGS__)
| ^~~
hal/library.c:144:60: note: format string is defined here
144 | wolfBoot_printf("Failure %d: Hdr %d, Hash %d, Sig %d\n", ret,
| ~^
| |
| int
| %ld
cc1: all warnings being treated as errors
make: *** [Makefile:493: hal/library.o] Error 1
44bba65 to
7b19319
Compare
Member
Author
Added explicit casting as the types of those fields are dependent on the build configuration. |
dgarske
requested changes
Oct 15, 2025
Contributor
dgarske
left a comment
There was a problem hiding this comment.
Looking really good! I will find time to test on customer hardware.
julek-wolfssl
commented
Oct 15, 2025
- Add new logic to `libwolfboot.c` for reading and updating partition states using a filesystem, enabled via `WOLFBOOT_PARTITION_FILENAME`. - Implement functions to set and get partition states (`wolfBoot_update_trigger`, `wolfBoot_success`, `wolfBoot_get_partition_state`) - Add `boot_status.py` and `hal/library_fs.c` for CLI and library access. - Update `.gitignore` and build rules for new artifacts.
- Update build rules for test-lib and lib-fs. - Improve clean rule to remove test-lib and lib-fs binaries.
dgarske
requested changes
Oct 17, 2025
Contributor
dgarske
left a comment
There was a problem hiding this comment.
This needs some work and I would like to give you access to a ZCU102 with working /dev/mtd0 that you can remote into for testing. This is the .config I am using:
ARCH=AARCH64
TARGET=library_fs
SIGN?=RSA4096
HASH?=SHA3
IMAGE_HEADER_SIZE?=1024
DEBUG=1
SPMATH?=1
SPMATHALL?=0
# Required for library (libwolfboot.a)
NO_LOADER=1
USE_GCC_HEADLESS=0
CROSS_COMPILE=aarch64-linux-gnu-
# Flash Partition Filename
WOLFBOOT_PARTITION_FILENAME=\"/dev/mtd0\"
# Flash Sector Size
WOLFBOOT_SECTOR_SIZE=0x2000
# Application Partition Size
WOLFBOOT_PARTITION_SIZE=0xA000000
# Load Partition to RAM Address
WOLFBOOT_LOAD_ADDRESS?=0x18000000
# Location in Flash for wolfBoot
WOLFBOOT_ORIGIN=0x0
# Location in flash for boot partition
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x7000000
# Location in flash for update partition
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x3A00000
# Location in flash for swap
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xFFE0000
# DTS (Device Tree)
WOLFBOOT_LOAD_DTS_ADDRESS?=0x0FFF2000
WOLFBOOT_DTS_BOOT_ADDRESS?=0x7B0000
WOLFBOOT_DTS_UPDATE_ADDRESS?=0x39B0000
This is the result when I scp the binary to the Ubuntu 20.04
root@ubuntu-focal-arm64v8:~# ls
lib-fs libwolfboot.a
root@ubuntu-focal-arm64v8:~# ./lib-fs
./lib-fs: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./lib-fs)
root@ubuntu-focal-arm64v8:~# uname -a
Linux ubuntu-focal-arm64v8 5.4.0-1049-xilinx-zynqmp #53 SMP Mon May 12 17:44:51 UTC 2025 aarch64 aarch64 aarch64 GNU/Linux
root@ubuntu-focal-arm64v8:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
Contributor
|
Closing in favor of #615 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
libwolfboot.cfor reading and updating partition states using a filesystem, enabled viaWOLFBOOT_PARTITION_FILENAME.wolfBoot_update_trigger,wolfBoot_success,wolfBoot_get_partition_state)boot_status.pyandhal/library_fs.cfor CLI and library access..gitignoreand build rules for new artifacts.