Skip to content

Commit 562b372

Browse files
committed
nai_68int6: add wolfBoot target for the NAI 68INT6 (Intel Tiger Lake UP3) OpenVPX SBC
1 parent 19bcbb5 commit 562b372

20 files changed

Lines changed: 2009 additions & 118 deletions

‎arch.mk‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2187,13 +2187,13 @@ ifeq ($(USE_GCC),1)
21872187
endif
21882188
OUTPUT_FLAG?=-o
21892189

2190-
ifeq ($(filter $(TARGET),x86_fsp_qemu kontron_vx3060_s2),$(TARGET))
2190+
ifeq ($(filter $(TARGET),x86_fsp_qemu kontron_vx3060_s2 nai_68int6),$(TARGET))
21912191
FSP=1
21922192
CFLAGS+=-ffunction-sections -fdata-sections -ffreestanding -nostdlib -static
21932193
# some std libc have headers that bring in extra symbols used in
21942194
# FORTIFY_SOURCE realated checks. Use -U_FORTIFY_SOURCE to avoid that.
21952195
CFLAGS+=-U_FORTIFY_SOURCE
2196-
ifeq ($(TARGET), kontron_vx3060_s2)
2196+
ifeq ($(filter $(TARGET),kontron_vx3060_s2 nai_68int6),$(TARGET))
21972197
FSP_TGL=1
21982198
CFLAGS+=-DWOLFBOOT_TGL=1
21992199
endif
@@ -2243,23 +2243,20 @@ ifeq ("${FSP}", "1")
22432243
OBJS += src/image.o
22442244
OBJS += src/keystore.o
22452245
OBJS += src/sig_wolfboot_raw.o
2246-
ifeq ($(TARGET), kontron_vx3060_s2)
2247-
OBJS += hal/kontron_vx3060_s2_loader.o
2248-
endif
22492246
OBJS += $(WOLFCRYPT_OBJS)
22502247
CFLAGS+=-DSTAGE1_AUTH
22512248
endif
22522249

2250+
# Generic stage1 loader HAL (stubs); shared by all x86 FSP targets.
2251+
OBJS += hal/stub_loader.o
2252+
22532253
CFLAGS += -fno-stack-protector -m32 -fno-PIC -fno-pie -mno-mmx -mno-sse -DDEBUG_UART
22542254
CFLAGS += -DFSP_M_BASE=$(FSP_M_BASE)
22552255
ifeq ($(FSP_TGL), 1)
22562256
OBJS+=src/x86/tgl_fsp.o
22572257
OBJS+=src/ucode0.o
22582258
CFLAGS += -DUCODE0_ADDRESS=$(UCODE0_BASE)
22592259
endif
2260-
ifeq ($(TARGET),x86_fsp_qemu)
2261-
OBJS += hal/x86_fsp_qemu_loader.o
2262-
endif
22632260
else
22642261
# building wolfBoot
22652262
ifeq ($(FSP_TGL), 1)

‎config/examples/nai_68int6.config‎

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# NAI 68INT6 -- 3U OpenVPX SOSA SBC, Intel Core i7-118xGRE (Tiger Lake UP3).
2+
# Memory is trained by the FSP from the board's own BIOS (the public TGL_IOT
3+
# FSP does not train it), extracted with tools/scripts/x86_fsp/tgl/nai_extract_fsp.sh.
4+
# See the NAI 68INT6 section of docs/Targets.md.
5+
6+
ARCH=x86_64
7+
TARGET=nai_68int6
8+
WOLFBOOT_SMALL_STACK=0
9+
10+
# ECC P-384 signature, SHA-384 digest (measured boot uses SHA-256 on an
11+
# SLB9670). See the integrity-algorithm table in docs/Targets.md.
12+
SIGN=ECC384
13+
HASH=SHA384
14+
15+
DEBUG=1
16+
# FSP-M UPD dump over the console before FspMemInit; bring-up aid, off by default.
17+
DUMP_FSP_UPD=0
18+
SPMATH=1
19+
ENCRYPTION=0
20+
WOLFBOOT_NO_PARTITIONS=1
21+
# Disk boot: signed kernels in GPT partitions 3/4, Ubuntu root in partition 2.
22+
# The A/B boot-partition indices are set per target in src/update_disk.c.
23+
WOLFBOOT_BOOT_DISK=0
24+
FORCE_32BIT=1
25+
26+
########## Flash layout (measured from the factory descriptor, 32 MB) ##########
27+
WOLFBOOT_PARTITION_BOOT_ADDRESS=0xff400000
28+
WOLFBOOT_PARTITION_SWAP_ADDRESS=0x0
29+
WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x0
30+
WOLFBOOT_LOAD_BASE=0x58000200
31+
WOLFBOOT_SECTOR_SIZE?=0x1000
32+
WOLFBOOT_DATA_ADDRESS=0x1000000
33+
34+
FSP_CONFIG_BASE=0xffe9f800
35+
FSP_T_BASE=0xfff59000
36+
FSP_M_BASE=0xfff60000
37+
38+
WOLFBOOT_ORIGIN=0xfff00000
39+
BOOTLOADER_PARTITION_SIZE=0x600000
40+
# Inert (read from the flash descriptor, not this value); kept for config parity.
41+
BIOS_REGION_SIZE=0xc00000
42+
43+
UCODE0_BASE=0xffd90000
44+
UCODE0_BIN=src/x86/ucode0.bin
45+
46+
FSP_T_BIN=./src/x86/fsp_t.bin
47+
FSP_M_BIN=./src/x86/fsp_m.bin
48+
FSP_S_BIN=./src/x86/fsp_s.bin
49+
FSP_S_UPD_DATA_BIN=./src/x86/fsp_s_upd_data.bin
50+
# Boot Guard is left to the board owner: supply an ACM and key here to build a
51+
# Boot-Guard image. Unset, wolfBoot builds and boots without it.
52+
ACM_BIN=
53+
FSP_S_LOAD_BASE=0x0FED5F00
54+
55+
POLICY_BASE=0xffaa4000
56+
KEYSTORE_OFFSET=0x3FE00
57+
KEYSTORE_STAGE1_OFFSET=0x400
58+
59+
########## Console: LPSS UART2 (PCI 00:19.2), verified on hardware ##########
60+
X86_UART_NUMBER=2
61+
X86_UART_BASE=0xFE032000
62+
X86_UART_REG_WIDTH=4
63+
X86_UART_MMIO=1
64+
65+
########## PCH / PCI ##########
66+
PCH_PCR_BASE=0xFD000000
67+
PCI_ECAM_BASE=0xC0000000
68+
PCI_USE_ECAM=1
69+
PCH_HAS_PCR=1
70+
# Generate ACPI tables so Linux gets the interrupt model and PCI routing.
71+
ACPI=1
72+
73+
########## Payload: signed 64-bit Linux bzImage ##########
74+
64BIT=1
75+
ELF=1
76+
DEBUG_ELF=0
77+
MULTIBOOT2=1
78+
LINUX_PAYLOAD=1
79+
80+
########## Security ##########
81+
STAGE1_AUTH=1
82+
WOLFTPM=1
83+
MEASURED_BOOT=1
84+
MEASURED_PCR_A=0
85+
# Measure the verified OS image into PCR4, alongside the firmware in PCR0.
86+
MEASURED_PCR_OS=4
87+
WOLFBOOT_UNIVERSAL_KEYSTORE=1
88+
WOLFBOOT_SKIP_AUTH_CHECK=0
89+
# BIOS region not write-locked by default; see "BIOS region lock" in docs/Targets.md.
90+
WOLFBOOT_DONT_LOCK_BIOS=1
91+
ENABLE_DEBUG_CONSENT=0
92+
93+
# Deferred: TPM sealing and ATA disk lock/erase.
94+
WOLFBOOT_TPM_SEAL=0
95+
DISK_LOCK=0
96+
DISK_ERASE=0
97+
98+
# Anti-rollback: persistent version floor + audit counters in TPM NV
99+
# (trust-on-first-use; provision before first boot where that matters).
100+
ANTI_ROLLBACK=1

‎docs/Targets.md‎

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This README describes configuration of supported targets.
1414
* [Infineon AURIX TC4xx](#infineon-aurix-tc4xx)
1515
* [Intel x86-64 Intel FSP](#intel-x86_64-with-intel-fsp-support)
1616
* [Kontron VX3060-S2](#kontron-vx3060-s2)
17+
* [NAI 68INT6 (Intel Tiger Lake)](#nai-68int6-intel-tiger-lake)
1718
* [Microchip PIC32CK](#microchip-pic32ck)
1819
* [Microchip PIC32CZ](#microchip-pic32cz)
1920
* [Microchip PolarFire SoC](#microchip-polarfire-soc)
@@ -9352,6 +9353,74 @@ Attempting boot from partition A
93529353
```
93539354
At this point, the kernel image in partition "A" is verified and staged and you should be seeing the log messages of your OS booting.
93549355

9356+
## NAI 68INT6 (Intel Tiger Lake)
9357+
9358+
wolfBoot target `nai_68int6` for the North Atlantic Industries 68INT6, a 3U OpenVPX SOSA-aligned single board computer (Intel Core i7-1185GRE, Tiger Lake UP3). It uses the Intel FSP support described [above](#intel-x86_64-with-intel-fsp-support) and shares the Tiger Lake path with the Kontron target. wolfBoot boots a signed 64-bit Linux from the SATA disk with A/B update, measured boot and TPM anti-rollback, verified on a Rev D5 bench board. The public Tiger Lake FSP does not train this board's memory, so the FSP is extracted from a 68INT6 BIOS image.
9359+
9360+
| | |
9361+
|---|---|
9362+
| CPU | i7-1185GRE (`06-8C-01`), Tiger Lake UP3, PCH-LP |
9363+
| Memory | 2 x 32 GB DDR4-3200 SODIMM, non-ECC |
9364+
| BIOS flash | Rev C/D5: 2 x W25R256JV (32 MB), selected by JP36. Next revision: one 64 MB device |
9365+
| TPM | SLB9670 (SHA-1/256), or SLB9672, which adds a SHA-384 bank |
9366+
| Storage | Onboard SATA SSD, AHCI at `00:17.0` |
9367+
| Console | LPSS UART2, PCI `00:19.2`, RS-232; `X86_UART_NUMBER=2` |
9368+
9369+
### Building
9370+
9371+
```
9372+
cp config/examples/nai_68int6.config .config
9373+
./tools/scripts/x86_fsp/tgl/tgl_download_fsp.sh # FSP UPD headers, first time only
9374+
./tools/scripts/x86_fsp/tgl/nai_extract_fsp.sh <68INT6.bin> # board's own FSP blobs
9375+
./tools/scripts/x86_fsp/tgl/assemble_image.sh -k # generate signing keys
9376+
make
9377+
./tools/scripts/x86_fsp/tgl/assemble_image.sh -n <68INT6.bin>
9378+
```
9379+
9380+
`nai_extract_fsp.sh` takes FSP-T/M/S and the microcode from a 68INT6 BIOS image. Without it the build uses the public FSP, which compiles but does not train memory. The `-n` stitch replaces the top 6 MB (`BOOTLOADER_PARTITION_SIZE`) of the 12 MB BIOS region and keeps the descriptor and CSME byte for byte. The board has no recovery region (recovery is the second flash device), so use `-n`, not `-m`. The result is `final_image.bin`.
9381+
9382+
### Integrity algorithms
9383+
9384+
ECC P-384 and SHA-384 match what Intel Boot Guard uses for the Initial Boot Block.
9385+
9386+
| Layer | Algorithm |
9387+
|---|---|
9388+
| Image signature | ECC P-384 (`SIGN=ECC384`) |
9389+
| Image digest | SHA-384 (`HASH=SHA384`) |
9390+
| Measured boot PCR | SHA-256 (the SLB9670 has only SHA-1 and SHA-256 banks) |
9391+
9392+
`wolfBoot_image_measure()` re-hashes the authenticated digest with the PCR bank's algorithm, so one image serves either TPM. `MEASURED_PCR_ALG=SHA384` needs an SLB9672 with its SHA-384 bank allocated (`TPM2_PCR_Allocate` under platform auth, a provisioning step).
9393+
9394+
### Configuration
9395+
9396+
Notable options in [config/examples/nai_68int6.config](../config/examples/nai_68int6.config):
9397+
9398+
| Option | Meaning |
9399+
|---|---|
9400+
| `X86_UART_NUMBER=2` | LPSS UART2 for all three FSP phases (Kontron uses 0) |
9401+
| `ACPI=1` | Generate ACPI tables (RSDP/XSDT/FADT/MADT/MCFG and a minimal DSDT) for Linux |
9402+
| `ANTI_ROLLBACK=1` | Persistent version floor and boot audit counters in TPM NV |
9403+
| `MEASURED_BOOT=1`, `MEASURED_PCR_OS=4` | Firmware into PCR 0, the verified OS image into PCR 4 |
9404+
| `WOLFBOOT_BOOT_DISK=0` | Boot from GPT partitions; the A/B indices (sda3/sda4) are set in `src/update_disk.c` |
9405+
9406+
### BIOS region lock
9407+
9408+
The BIOS region is not write-locked by default (`WOLFBOOT_DONT_LOCK_BIOS=1`), so the flash stays writable for in-field updates. To lock it, call `tgl_lock_bios_region()` (`hal/nai_68int6.c`) from a `hal_flash_protect()` override. It sets SPI Flash Protected Range 0 over the BIOS region and then FLOCKDN, which hold until the next platform reset.
9409+
9410+
### Anti-rollback
9411+
9412+
`ANTI_ROLLBACK=1` keeps a version floor and boot audit counters in a TPM NV index; the backend is `src/boot_state_tpm.c` and the policy is `src/boot_state.c`. The floor is the highest version ever booted, set trust-on-first-use. A validly signed older image still boots and records a rollback event. Only an untrustworthy reference halts the boot; `ANTI_ROLLBACK_STRICT=1` also halts when the TPM is unreachable or a write fails.
9413+
9414+
TPM NV is used instead of the partition state trailer because the floor must survive a full reimage of the disk or flash. `DISK_BOOT_CONFIRM` still handles per-slot confirmation, and the backend can move to a root-of-trust device later without changing the policy.
9415+
9416+
`ALLOW_DOWNGRADE` is left unset, the secure default: if the higher-versioned slot fails to verify, wolfBoot halts (`Rollback to lower version not allowed`) rather than boot the lower one. Building with `ALLOW_DOWNGRADE=1` allows that fall-back and leaves the TPM floor as the only rollback guard.
9417+
9418+
The booted OS cannot lower the floor. wolfBoot write-locks the NV index (`TPMA_NV_WRITE_STCLEAR`) on every boot, so it stays read-only until the next TPM reset. `wolfBoot_tpm2_deinit()` then sets the platform hierarchy auth to a random value nobody keeps, as in the TPM keystore build, so the OS cannot undefine the index and recreate it. `WOLFBOOT_TPM_NO_CHG_PLAT_AUTH` keeps platform auth unchanged.
9419+
9420+
### Boot, programming and recovery
9421+
9422+
wolfBoot boots the highest-versioned signed 64-bit `bzImage` that verifies from the two GPT boot partitions. It falls back to the other slot only if that is not a downgrade (see Anti-rollback), and holds in reset if neither boots. Program the flash with `flashrom` from the board's Linux, or with a Dediprog SF100 on JP4 while the board is off. JP36 selects which bank boots and which one a programmer sees; move it only with the board off. Software can only reprogram the bank the board booted from, so a development image that never reaches an OS has to be recovered with the SF100.
9423+
93559424
## Infineon PSOC Control C3
93569425

93579426
The [PSOC Control C3](https://www.infineon.com/products/microcontroller/32-bit-psoc-arm-cortex/32-bit-psoc-control-arm-cortex-m33-mcu/psoc-control-c3-main-line) family (PSC3, CAT1B) is an Arm Cortex-M33 motor-control MCU. wolfBoot runs as the first application the BootROM launches, verifies the signed firmware in the BOOT partition and jumps to it.

‎hal/kontron_vx3060_s2_loader.c‎

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)