|
| 1 | +name: Compressed images - test with simulator target |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ 'master', 'main', 'release/**' ] |
| 6 | + pull_request: |
| 7 | + branches: [ '*' ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + compressed_simulator_tests: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + container: |
| 13 | + image: ghcr.io/wolfssl/wolfboot-ci-sim:v1.0 |
| 14 | + timeout-minutes: 20 |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + # GZIP_SMALL selects a different Huffman decoder in src/gzip.c, so |
| 19 | + # both have to be exercised and not merely built. |
| 20 | + sign: [ ED25519, ECC256 ] |
| 21 | + gzip_small: [ 0, 1 ] |
| 22 | + |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + submodules: true |
| 27 | + |
| 28 | + - name: Trust workspace |
| 29 | + run: git config --global --add safe.directory "$GITHUB_WORKSPACE" |
| 30 | + |
| 31 | + - name: make clean |
| 32 | + run: | |
| 33 | + make distclean |
| 34 | +
|
| 35 | + - name: Select config |
| 36 | + run: | |
| 37 | + cp config/examples/sim-compressed-ram.config .config |
| 38 | + sed -i "s/^SIGN?=.*/SIGN?=${{ matrix.sign }}/" .config |
| 39 | + sed -i "s/^GZIP_SMALL=.*//" .config |
| 40 | + echo "GZIP_SMALL=${{ matrix.gzip_small }}" >> .config |
| 41 | +
|
| 42 | + - name: Build tools |
| 43 | + run: | |
| 44 | + make -C tools/keytools && make -C tools/bin-assemble |
| 45 | +
|
| 46 | + - name: Build wolfboot.elf and test-app/image.elf |
| 47 | + run: | |
| 48 | + make clean && make |
| 49 | +
|
| 50 | + - name: Assemble the compressed A/B slots |
| 51 | + run: | |
| 52 | + make test-sim-compressed-ram-with-update |
| 53 | +
|
| 54 | + - name: Run the compressed image simulator test |
| 55 | + run: | |
| 56 | + ./tools/scripts/sim-compressed-ram.sh |
| 57 | +
|
| 58 | + compressed_encrypted_simulator_tests: |
| 59 | + runs-on: ubuntu-latest |
| 60 | + container: |
| 61 | + image: ghcr.io/wolfssl/wolfboot-ci-sim:v1.0 |
| 62 | + timeout-minutes: 20 |
| 63 | + strategy: |
| 64 | + fail-fast: false |
| 65 | + matrix: |
| 66 | + # Each cipher has its own block size, which the per-slot keystream |
| 67 | + # stride is derived from, so all three have to run. |
| 68 | + cipher: [ chacha, aes128, aes256 ] |
| 69 | + |
| 70 | + steps: |
| 71 | + - uses: actions/checkout@v4 |
| 72 | + with: |
| 73 | + submodules: true |
| 74 | + |
| 75 | + - name: Trust workspace |
| 76 | + run: git config --global --add safe.directory "$GITHUB_WORKSPACE" |
| 77 | + |
| 78 | + - name: make clean |
| 79 | + run: | |
| 80 | + make distclean |
| 81 | +
|
| 82 | + - name: Select config |
| 83 | + run: | |
| 84 | + cp config/examples/sim-compressed-ram-enc.config .config |
| 85 | + case "${{ matrix.cipher }}" in |
| 86 | + aes128) echo "ENCRYPT_WITH_AES128=1" >> .config ;; |
| 87 | + aes256) echo "ENCRYPT_WITH_AES256=1" >> .config ;; |
| 88 | + esac |
| 89 | +
|
| 90 | + - name: Build tools |
| 91 | + run: | |
| 92 | + make -C tools/keytools && make -C tools/bin-assemble |
| 93 | +
|
| 94 | + - name: Build wolfboot.elf and test-app/image.elf |
| 95 | + run: | |
| 96 | + make clean && make |
| 97 | +
|
| 98 | + - name: Assemble the encrypted compressed A/B slots |
| 99 | + run: | |
| 100 | + make test-sim-compressed-ram-enc-with-update |
| 101 | +
|
| 102 | + - name: Run the encrypted compressed image simulator test |
| 103 | + run: | |
| 104 | + ./tools/scripts/sim-compressed-ram-enc.sh |
| 105 | +
|
| 106 | + compressed_cross_build: |
| 107 | + runs-on: ubuntu-latest |
| 108 | + container: |
| 109 | + image: ghcr.io/wolfssl/wolfboot-ci-arm:v1.0 |
| 110 | + timeout-minutes: 20 |
| 111 | + strategy: |
| 112 | + fail-fast: false |
| 113 | + matrix: |
| 114 | + config: [ stm32h7-compressed-ram, stm32f407-compressed-ram ] |
| 115 | + |
| 116 | + steps: |
| 117 | + - uses: actions/checkout@v4 |
| 118 | + with: |
| 119 | + submodules: true |
| 120 | + |
| 121 | + - name: Trust workspace |
| 122 | + run: git config --global --add safe.directory "$GITHUB_WORKSPACE" |
| 123 | + |
| 124 | + - name: Select config |
| 125 | + run: | |
| 126 | + cp config/examples/${{ matrix.config }}.config .config |
| 127 | +
|
| 128 | + - name: Build |
| 129 | + run: | |
| 130 | + make clean && make keysclean && make |
| 131 | +
|
| 132 | + # A link that succeeds but places the vector table somewhere other |
| 133 | + # than the load address boots into garbage, and nothing catches that |
| 134 | + # without hardware. Assert the layout from the ELF instead. |
| 135 | + - name: Check the application is linked for the load address |
| 136 | + run: | |
| 137 | + LOAD=$(grep -E '^WOLFBOOT_LOAD_ADDRESS\??=' .config | tail -1 | cut -d= -f2) |
| 138 | + SIZE=$(grep -E '^WOLFBOOT_RAMBOOT_MAX_SIZE\??=' .config | tail -1 | cut -d= -f2) |
| 139 | + echo "load address $LOAD, region size $SIZE" |
| 140 | + # .text must start exactly at the load address, with LMA == VMA |
| 141 | + arm-none-eabi-objdump -h test-app/image.elf | \ |
| 142 | + awk -v want=$(printf "%08x" $((LOAD))) ' |
| 143 | + $2==".text" { if ($4!=want || $5!=want) { |
| 144 | + printf "`.text` at vma %s lma %s, expected %s\n",$4,$5,want; exit 1 } |
| 145 | + print "ok: .text at " $4 " (lma " $5 ")" }' |
| 146 | + # word 0 of the image is the initial stack pointer and must be the |
| 147 | + # top of the load region |
| 148 | + SP=$(od -An -t x4 -N 4 test-app/image.bin | tr -d ' ') |
| 149 | + WANT_SP=$(printf "%08x" $((LOAD + SIZE))) |
| 150 | + if [ "$SP" != "$WANT_SP" ]; then |
| 151 | + echo "initial SP is 0x$SP, expected 0x$WANT_SP"; exit 1 |
| 152 | + fi |
| 153 | + echo "ok: initial SP 0x$SP" |
| 154 | +
|
| 155 | + - name: Check wolfBoot does not overlap the load region |
| 156 | + run: | |
| 157 | + LOAD=$(grep -E '^WOLFBOOT_LOAD_ADDRESS\??=' .config | tail -1 | cut -d= -f2) |
| 158 | + END=$(arm-none-eabi-nm wolfboot.elf | awk '$3=="_end" {print $1}') |
| 159 | + # Only meaningful when wolfBoot's RAM and the load region share an |
| 160 | + # address space (STM32F4); on the H7 they are different SRAMs. |
| 161 | + if [ $((0x$END)) -ge $((LOAD)) ] && \ |
| 162 | + [ $((0x$END)) -lt $((LOAD + 0x100000)) ]; then |
| 163 | + echo "wolfBoot _end 0x$END is inside the load region at $LOAD"; exit 1 |
| 164 | + fi |
| 165 | + echo "ok: wolfBoot _end 0x$END clear of the load region at $LOAD" |
0 commit comments