Skip to content

Commit 4551d7c

Browse files
committed
Support for building libwolfboot.a. Library target used to just build a test-lib, but that's not very portable. Added test cases.
1 parent 8877da9 commit 4551d7c

File tree

11 files changed

+64
-11
lines changed

11 files changed

+64
-11
lines changed

.github/workflows/footprint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-24.04
1212

1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515
with:
1616
submodules: true
1717

.github/workflows/test-build-kontron-vx3060-s2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
fsp_qemu_test:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v4
1111
with:
1212
submodules: true
1313
- name: install req

.github/workflows/test-configs.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ jobs:
106106
config-file: ./config/examples/kinetis-k82f.config
107107

108108
library_test:
109+
uses: ./.github/workflows/test-build.yml
110+
with:
111+
arch: host
112+
config-file: ./config/examples/library.config
113+
make-args: test-lib
114+
115+
libwolfboot_test:
109116
uses: ./.github/workflows/test-build.yml
110117
with:
111118
arch: host

.github/workflows/test-cppcheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515
with:
1616
submodules: false
1717

.github/workflows/test-library.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: wolfBoot as Library test
2+
3+
on:
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
jobs:
10+
test-lib:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
submodules: true
17+
18+
- name: make clean
19+
run: |
20+
make keysclean && make -C tools/keytools clean && rm -f include/target.h
21+
22+
- name: Build test-lib
23+
run: |
24+
cp config/examples/library.config .config
25+
make keytools
26+
./tools/keytools/keygen --ed25519 -g wolfboot_signing_private_key.der
27+
echo "Test" > test.bin
28+
./tools/keytools/sign --ed25519 --sha256 test.bin wolfboot_signing_private_key.der 1
29+
make test-lib
30+
31+
- name: Run test-lib
32+
run: |
33+
./test-lib test_v1_signed.bin 2>&1 | grep "Firmware Valid"
34+
35+
- name: Run test-lib (expect failure)
36+
run: |
37+
echo "A" >> test_v1_signed.bin
38+
./test-lib test_v1_signed.bin 2>&1 | grep "Failure"

.github/workflows/test-renode-fastmath.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-22.04
1212

1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515
with:
1616
submodules: true
1717

.github/workflows/test-units.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515
with:
1616
submodules: true
1717

.github/workflows/test-x86-fsp-qemu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
fsp_qemu_test:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v4
1111
with:
1212
submodules: true
1313
- name: install req

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ endif
126126

127127
ifeq ($(TARGET),library)
128128
CFLAGS+=-g
129-
MAIN_TARGET:=test-lib
129+
MAIN_TARGET:=libwolfboot.a
130130
endif
131131

132132
ifeq ($(TARGET),raspi3)
@@ -174,6 +174,9 @@ stage1/loader_stage1.bin: FORCE
174174
test-lib: include/target.h $(OBJS)
175175
$(Q)$(CC) $(CFLAGS) -o $@ $(OBJS)
176176

177+
libwolfboot.a: $(OBJS)
178+
$(Q)$(AR) rcs $@ $(OBJS)
179+
177180
wolfboot.efi: wolfboot.elf
178181
@echo "\t[BIN] $@"
179182
$(Q)$(OBJCOPY) -j .rodata -j .text -j .sdata -j .data \
@@ -193,7 +196,6 @@ wolfboot.bin: wolfboot.elf
193196
$(Q)$(SIZE) wolfboot.elf
194197
@echo
195198

196-
197199
test-app/image.bin: wolfboot.elf
198200
$(Q)$(MAKE) -C test-app WOLFBOOT_ROOT="$(WOLFBOOT_ROOT)"
199201
$(Q)$(SIZE) test-app/image.elf
@@ -454,7 +456,7 @@ secondary: $(SECONDARY_PRIVATE_KEY)
454456

455457
src/x86/fsp_s.o: $(FSP_S_BIN)
456458
$(OBJCOPY) -I binary -O elf64-x86-64 -B i386 --rename-section .data=.fsp_s $^ $@
457-
459+
458460
pico-sdk-info: FORCE
459461
@echo "To complete the build, check IDE/pico-sdk/rp2350"
460462

arch.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ ifeq ($(ARCH),RENESAS_RX)
410410
# Must use LD directly (gcc link calls LD with sysroot and is not supported)
411411
LD=$(CROSS_COMPILE)ld
412412
AS=$(CROSS_COMPILE)gcc
413+
AR=$(CROSS_COMPILE)ar
413414
OBJCOPY?=$(CROSS_COMPILE)objcopy
414415
SIZE=$(CROSS_COMPILE)size
415416

@@ -872,6 +873,7 @@ ifeq ($(TARGET),ti_hercules)
872873
CC=$(CROSS_COMPILE)armcl
873874
LD=$(CROSS_COMPILE)armcl
874875
AS=$(CROSS_COMPILE)armasm
876+
AR=$(CROSS_COMPILE)armcl -ar
875877
OBJCOPY=$(CROSS_COMPILE)armobjcopy
876878
SIZE=$(CROSS_COMPILE)armsize
877879
OUTPUT_FLAG=--output_file
@@ -972,6 +974,7 @@ ifeq ($(USE_GCC),1)
972974
CC=$(CROSS_COMPILE)gcc
973975
LD=$(CROSS_COMPILE)gcc
974976
AS=$(CROSS_COMPILE)gcc
977+
AR=$(CROSS_COMPILE)ar
975978
OBJCOPY?=$(CROSS_COMPILE)objcopy
976979
SIZE=$(CROSS_COMPILE)size
977980
endif

0 commit comments

Comments
 (0)