Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/test-external-library-paths.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Test External Library Paths

on:
push:
branches: [ 'master', 'main', 'release/**' ]
pull_request:
branches: [ '*' ]
workflow_dispatch:

jobs:
test_external_libs:
runs-on: ubuntu-latest

# Matrix to test multiple configurations
strategy:
matrix:
test-config:
- name: "External wolfSSL"
config: "config/examples/sim.config"

- name: "External wolfTPM"
config: "config/examples/sim-tpm.config"
build-tpm-tools: true

- name: "external wolfHSM"
config: "config/examples/sim-wolfHSM-client.config"

- name: "Unit tests"
config: ""
is-unit-test: true

fail-fast: false

steps:
# Checkout wolfBoot with submodules
- uses: actions/checkout@v4
with:
submodules: true

# Move libraries outside the wolfBoot tree
- name: Relocate libraries to external path
run: |
echo "=== Moving libraries outside wolfBoot tree ==="
mv lib ../external-libs
ls -la ../external-libs/
echo "Libraries moved to ../external-libs"

# Select configuration (skip for unit tests)
- name: Select config
if: matrix.test-config.config != ''
run: |
cp ${{ matrix.test-config.config }} .config
echo "=== Selected config: ${{ matrix.test-config.name }} ==="

# Build TPM tools if needed
- name: Build TPM tools with external paths
if: matrix.test-config.build-tpm-tools == true
run: |
echo "=== Building TPM tools with external paths ==="
make tpmtools \
WOLFBOOT_LIB_WOLFSSL=$(realpath ../external-libs/wolfssl) \
WOLFBOOT_LIB_WOLFTPM=$(realpath ../external-libs/wolfTPM)

# Build main target (skip for unit tests)
- name: Build wolfBoot with external library paths
if: matrix.test-config.is-unit-test != true
run: |
echo "=== Building wolfBoot with external paths ==="
make clean
make \
WOLFBOOT_LIB_WOLFSSL="$(realpath ../external-libs/wolfssl)" \
WOLFBOOT_LIB_WOLFTPM="$(realpath ../external-libs/wolfTPM)" \
WOLFBOOT_LIB_WOLFPKCS11="$(realpath ../external-libs/wolfPKCS11)" \
WOLFBOOT_LIB_WOLFHSM="$(realpath ../external-libs/wolfHSM)"

# If building unit tests, install libcheck
- name: install libcheck
if: matrix.test-config.is-unit-test == true
run: sudo apt-get install --no-install-recommends -y -q check


# Build unit tests with external paths
- name: Build unit tests with external library paths
if: matrix.test-config.is-unit-test == true
run: |
echo "=== Building unit tests with external paths ==="
make -C tools/unit-tests \
WOLFBOOT_LIB_WOLFSSL="$(realpath ../external-libs/wolfssl)" \
WOLFBOOT_LIB_WOLFPKCS11="$(realpath ../external-libs/wolfPKCS11)"
26 changes: 23 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,26 @@ ifneq ("$(NO_LOADER)","1")
OBJS+=./src/loader.o
endif

## Library Path Configuration
# Default paths for wolf* submodules - can be overridden with absolute or relative paths
# Convert all paths to absolute paths for consistent handling across sub-makefiles
WOLFBOOT_LIB_WOLFSSL?=lib/wolfssl
WOLFBOOT_LIB_WOLFTPM?=lib/wolfTPM
WOLFBOOT_LIB_WOLFPKCS11?=lib/wolfPKCS11
WOLFBOOT_LIB_WOLFHSM?=lib/wolfHSM

# Convert to absolute paths using abspath function
WOLFBOOT_LIB_WOLFSSL:=$(abspath $(WOLFBOOT_LIB_WOLFSSL))
WOLFBOOT_LIB_WOLFTPM:=$(abspath $(WOLFBOOT_LIB_WOLFTPM))
WOLFBOOT_LIB_WOLFPKCS11:=$(abspath $(WOLFBOOT_LIB_WOLFPKCS11))
WOLFBOOT_LIB_WOLFHSM:=$(abspath $(WOLFBOOT_LIB_WOLFHSM))

# Export variables so they are available to sub-makefiles
export WOLFBOOT_LIB_WOLFSSL
export WOLFBOOT_LIB_WOLFTPM
export WOLFBOOT_LIB_WOLFPKCS11
export WOLFBOOT_LIB_WOLFHSM

## Architecture/CPU configuration
include arch.mk

Expand All @@ -70,7 +90,7 @@ OBJS+=$(PUBLIC_KEY_OBJS)
OBJS+=$(WOLFHSM_OBJS)

CFLAGS+= \
-I"." -I"include/" -I"lib/wolfssl" \
-I"." -I"include/" -I"$(WOLFBOOT_LIB_WOLFSSL)" \
-Wno-array-bounds \
-D"WOLFSSL_USER_SETTINGS" \
-D"WOLFTPM_USER_SETTINGS"
Expand Down Expand Up @@ -364,8 +384,8 @@ keys: $(PRIVATE_KEY)

clean:
$(Q)rm -f src/*.o hal/*.o hal/spi/*.o test-app/*.o src/x86/*.o
$(Q)rm -f lib/wolfssl/wolfcrypt/src/*.o lib/wolfTPM/src/*.o lib/wolfTPM/hal/*.o lib/wolfTPM/examples/pcr/*.o
$(Q)rm -f lib/wolfssl/wolfcrypt/src/port/Renesas/*.o
$(Q)rm -f $(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/*.o $(WOLFBOOT_LIB_WOLFTPM)/src/*.o $(WOLFBOOT_LIB_WOLFTPM)/hal/*.o $(WOLFBOOT_LIB_WOLFTPM)/examples/pcr/*.o
$(Q)rm -f $(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/Renesas/*.o
$(Q)rm -f wolfboot.bin wolfboot.elf wolfboot.map test-update.rom wolfboot.hex
$(Q)rm -f $(MACHINE_OBJ) $(MAIN_TARGET) $(LSCRIPT)
$(Q)rm -f $(OBJS)
Expand Down
Loading