Skip to content

Commit b22fc16

Browse files
committed
kontron-vx3060-s2: simplify example, add build test, improve docs
1 parent edeee1b commit b22fc16

File tree

4 files changed

+117
-47
lines changed

4 files changed

+117
-47
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: kontron_vx3060_s2 build test
2+
3+
on:
4+
pull_request:
5+
branches: [ '*' ]
6+
jobs:
7+
fsp_qemu_test:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
with:
12+
submodules: true
13+
- name: install req
14+
run: |
15+
sudo apt-get update
16+
sudo apt-get install --no-install-recommends -y -q nasm gcc-multilib
17+
- name: setup git
18+
run: |
19+
git config --global user.email "[email protected]"
20+
git config --global user.name "Your Name"
21+
- name: run test
22+
run: |
23+
cp config/examples/kontron_vx3060_s2.config .config
24+
./tools/scripts/x86_fsp/tgl/tgl_download_fsp.sh
25+
make
Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARCH=x86_64
22
TARGET=kontron_vx3060_s2
33
WOLFBOOT_SMALL_STACK=0
4-
SIGN=ECC384
4+
SIGN=ECC256
55
HASH=SHA256
66
DEBUG=0
77
SPMATH=1
@@ -21,47 +21,32 @@ WOLFBOOT_LOAD_BASE=0x58000200
2121
WOLFBOOT_SECTOR_SIZE?=0x1000
2222
WOLFBOOT_DATA_ADDRESS=0x1000000
2323

24-
25-
FSP_S_BASE=0xffea0000
2624
FSP_T_BASE=0xfff59000
2725
FSP_M_BASE=0xfff60000
2826

2927
WOLFBOOT_ORIGIN=0xfff00000
30-
# 4 MB
28+
# 6 MB
3129
BOOTLOADER_PARTITION_SIZE=0x600000
32-
# 12 MB
33-
BIOS_REGION_SIZE=0xc00000
3430

3531
UCODE0_BASE=0xffd90000
3632
UCODE0_BIN=src/x86/ucode0.bin
3733

3834
FSP_T_BIN=./src/x86/fsp_t.bin
3935
FSP_M_BIN=./src/x86/fsp_m.bin
4036
FSP_S_BIN=./src/x86/fsp_s.bin
41-
FSP_S_UPD_DATA_BIN=./src/x86/fsp_s_upd_data.bin
4237

4338
X86_UART_BASE=0xFE032000
4439
X86_UART_REG_WIDTH=4
4540
X86_UART_MMIO=1
46-
4741
PCH_PCR_BASE=0xFD000000
4842
PCI_ECAM_BASE=0xC0000000
49-
5043
PCI_USE_ECAM=1
5144
PCH_HAS_PCR=1
52-
5345
64BIT=1
5446
ELF=1
5547
DEBUG_ELF=0
5648
MULTIBOOT2=1
57-
5849
FSP_S_LOAD_BASE=0x0FED5F00
5950
STAGE1_AUTH=1
60-
MEASURED_BOOT=1
61-
MEASURED_PCR_A=0
6251
DISK_LOCK=0
63-
WOLFTPM=1
64-
WOLFBOOT_TPM_SEAL=1
65-
WOLFBOOT_TPM_SEAL_KEY_ID=1
66-
WOLFBOOT_UNIVERSAL_KEYSTORE=1
6752
DEBUG_SYMBOLS=1

docs/Targets.md

Lines changed: 83 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This README describes configuration of supported targets.
99
* [Cypress PSoC-6](#cypress-psoc-6)
1010
* [Infineon AURIX TC3xx](#infineon-aurix-tc3xx)
1111
* [Intel x86-64 Intel FSP](#intel-x86_64-with-intel-fsp-support)
12+
* [Kontron VX3060-S2](#kontron-vx3060-s2)
1213
* [Microchip SAMA5D3](#microchip-sama5d3)
1314
* [Microchip SAME51](#microchip-same51)
1415
* [Nordic nRF52840](#nordic-nrf52840)
@@ -3199,24 +3200,96 @@ IMAGE=test-app/image.elf SIGN=--ecc384 tools/scripts/x86_fsp/qemu/make_hd.sh
31993200
For more advanced uses of TPM, please check [TPM.md](TPM.md) to configure wolfBoot
32003201
according to your secure boot strategy.
32013202

3202-
### Running on Kontron VX3060-S2
3203+
## Kontron VX3060-S2
32033204

3204-
A reference configuration and helper scripts are provided to run wolfBoot on
3205-
Kontron VX3060-S2 board.
3206-
A flash dump of the original Flash BIOS is needed.
3207-
To compile a flashable image run the following steps:
3205+
wolfBoot supports Kontron VX3060-S2 board using Intel Firmware Support Package
3206+
(FSP). You can find more details about the wolfBoot support with Intel FSP in
3207+
the above [section](#intel-x86_64-with-intel-fsp-support). A minimal
3208+
configuration example is provided in
3209+
[config/examples/kontron_vx3060_s2.config](config/examples/kontron_vx3060_s2.config).
3210+
In order to produce a flashable flash image, a dump of the original flash is
3211+
required. To build wolfBoot, follow the following steps:
32083212

32093213
```
32103214
cp config/examples/kontron_vx3060_s2.config .config
32113215
./tools/scripts/x86_fsp/tgl/tgl_download_fsp.sh
3212-
make tpmtools
3213-
./tools/scripts/x86_fsp/tgl/assemble_image.sh -k
3214-
make CFLAGS_EXTRA="-DHAVE_ECC256"
3216+
make
32153217
./tools/scripts/x86_fsp/tgl/assemble_image.sh -n /path/to/original/flash/dump
32163218
```
32173219

3218-
they produce a file named `final_image.bin` inside the root folder of the
3219-
repository that can be directly flashed into the BIOS flash of the board.
3220+
After running the above commands, you should find a file named `final_image.bin` in the root folder of the repository. The image can be flashed directly into the board.
3221+
By default wolfBoot tries to read a wolfBoot image from the SATA drive.
3222+
The drive should be partitioned with a GPT table, wolfBoot tries to load an image saved in the 5th or the 6th partition.
3223+
You can find more details in `src/update_disk.c`. wolfBoot doesn't try to read from a filesystem and the images need to be written directly into the partition.
3224+
This is an example boot log:
3225+
```
3226+
Press any key within 2 seconds to toogle BIOS flash chip
3227+
Cache-as-RAM initialized
3228+
FSP-T:A.0.7E build 70
3229+
FSP-M:A.0.7E build 70
3230+
microcode revision: AA, date: 12-28-2022
3231+
machine_update_m_params
3232+
calling FspMemInit...
3233+
warm reset required
3234+
Press any key within 2 seconds to toogle BIOS flash chip
3235+
Cache-as-RAM initialized
3236+
FSP-T:A.0.7E build 70
3237+
FSP-M:A.0.7E build 70
3238+
microcode revision: AA, date: 12-28-2022
3239+
machine_update_m_params
3240+
calling FspMemInit...
3241+
success
3242+
top reserved 0_78C50000h
3243+
mem: [ 0x78C40000, 0x78C50000 ] - stack (0x10000)
3244+
mem: [ 0x78C3FFF4, 0x78C40000 ] - stage2 parameter (0xC)
3245+
hoblist@0x78C90000
3246+
mem: [ 0x78C38000, 0x78C3FFF4 ] - page tables (0x7FF4)
3247+
page table @ 0x78C38000 [length: 7000]
3248+
mem: [ 0x78C37FF8, 0x78C38000 ] - stage2 ptr holder (0x8)
3249+
TOLUM: 0x78C37FF8
3250+
mem: [ 0x100000, 0x100014 ] - stage1 .data (0x14)
3251+
mem: [ 0x100020, 0x100040 ] - stage1 .bss (0x20)
3252+
CPUID(0):1B 756E6547 6C65746E
3253+
mem: [ 0x58000100, 0x5806196C ] - wolfboot (0x6186C)
3254+
mem: [ 0x5806196C, 0x58282000 ] - wolfboot .bss (0x220694)
3255+
load wolfboot end
3256+
Authenticating wolfboot at 58000200...
3257+
Boot partition: 0x58000100 (sz 399212, ver 0x1, type 0x201)
3258+
verify_payload: image open successfully.
3259+
verify_payload: integrity OK. Checking signature.
3260+
wolfBoot: verified OK.
3261+
starting wolfboot 64bit
3262+
call temp ram exit...successA.0.7E build 70
3263+
call silicon...successcap a 2268409840
3264+
ddt disabled 0
3265+
device enable: 172049
3266+
device enable: 172049
3267+
AHCI port 0: Disk detected (det: 04 ipm: 00)
3268+
AHCI port 1: Disk detected (det: 03 ipm: 01)
3269+
SATA disk drive detected on AHCI port 1
3270+
Reading MBR...
3271+
Found GPT PTE at sector 1
3272+
Found valid boot signature in MBR
3273+
Valid GPT partition table
3274+
Current LBA: 0x1
3275+
Backup LBA: 0x6FCCF2F
3276+
Max number of partitions: 128
3277+
Software limited: only allowing up to 16 partitions per disk.
3278+
Disk size: 1107095552
3279+
disk0.p0 (0_8000000h@ 0_100000)
3280+
disk0.p1 (0_20000000h@ 0_8100000)
3281+
disk0.p2 (4_0h@ 0_28100000)
3282+
disk0.p3 (4_0h@ 4_28100000)
3283+
disk0.p4 (1_0h@ 8_28100000)
3284+
disk0.p5 (0_80000000h@ 9_28100000)
3285+
disk0.p6 (0_80000000h@ 9_A8100000)
3286+
Total partitions on disk0: 7
3287+
Checking primary OS image in 0,5...
3288+
Checking secondary OS image in 0,6...
3289+
Versions, A:1 B:1
3290+
Load address 0x58282000
3291+
Attempting boot from partition A
3292+
```
32203293

32213294
## Infineon AURIX TC3xx
32223295

tools/scripts/x86_fsp/tgl/assemble_image.sh

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,10 @@
33
WOLFBOOT_DIR=$(pwd)
44

55
# 16 MB
6-
BIOS_REGION_SIZE=16777216
76
BIOS_REGION_PATH=/tmp/bios.bin
8-
SIGN_OPTIONS="--ecc384 --sha256"
9-
SIGN_KEY=$WOLFBOOT_DIR/wolfboot_signing_private_key.der
10-
SIGN_TOOL=./tools/keytools/sign
117

128
set -e
139

14-
make_keys()
15-
{
16-
make keytools
17-
./tools/keytools/keygen --ecc384 -g wolfboot_signing_private_key.der --ecc256 -g tpm_seal_key.key -keystoreDir src/
18-
}
19-
2010
build_and_sign_image()
2111
{
2212
# compute the size differences between $FLASH_DUMP and "$WOLFBOOT_DIR"/wolfboot_stage1.bin and store it in SIZE
@@ -26,27 +16,24 @@ build_and_sign_image()
2616
cp "$FLASH_DUMP" "$WOLFBOOT_DIR/temp_image.bin"
2717
truncate -s $SIZE "$WOLFBOOT_DIR/temp_image.bin"
2818
cat "$WOLFBOOT_DIR/temp_image.bin" "$BIOS_REGION_PATH" > "$WOLFBOOT_DIR/final_image.bin"
29-
PCR0=$(python ./tools/scripts/x86_fsp/compute_pcr.py "$WOLFBOOT_DIR"/final_image.bin | tail -n 1)
30-
"$WOLFBOOT_DIR"/tools/tpm/policy_sign -ecc256 -key=tpm_seal_key.key -pcr=0 -pcrdigest=$PCR0
31-
IMAGE_FILE="$WOLFBOOT_DIR"/final_image.bin "$WOLFBOOT_DIR"/tools/scripts/x86_fsp/tpm_install_policy.sh policy.bin.sig
19+
if grep -q '^WOLFBOOT_TPM_SEAL=1$' .config; then
20+
PCR0=$(python ./tools/scripts/x86_fsp/compute_pcr.py "$WOLFBOOT_DIR"/final_image.bin | tail -n 1)
21+
"$WOLFBOOT_DIR"/tools/tpm/policy_sign -ecc256 -key=tpm_seal_key.key -pcr=0 -pcrdigest="$PCR0"
22+
IMAGE_FILE="$WOLFBOOT_DIR"/final_image.bin "$WOLFBOOT_DIR"/tools/scripts/x86_fsp/tpm_install_policy.sh policy.bin.sig
23+
fi
3224
}
3325

3426
assemble()
3527
{
36-
cp $WOLFBOOT_DIR/wolfboot_stage1.bin $BIOS_REGION_PATH
28+
cp "$WOLFBOOT_DIR/wolfboot_stage1.bin" $BIOS_REGION_PATH
3729
build_and_sign_image
3830
}
3931

4032
# Parse command line options
41-
while getopts "ks:n:m:" opt; do
33+
while getopts "s:n:m:" opt; do
4234
case "$opt" in
43-
k)
44-
make_keys
45-
exit 0
46-
;;
4735
n)
4836
FLASH_DUMP="$OPTARG"
49-
IBG=0
5037
;;
5138
*)
5239
echo "Usage: $0 [-k] [-s FLASH_DUMP]"

0 commit comments

Comments
 (0)