Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x86: fsp: misc improvements #365

Merged
merged 21 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
32b66f9
ahci: move SATA memory areas in wolfboot .bss
rizlik Sep 13, 2023
ae7221d
fix: remove stale section include in stage1 linker script
rizlik Aug 10, 2023
478afe3
x86_fsp: move cflags into options.mk
rizlik Aug 10, 2023
db806eb
x86_fsp: tgl: improve FPS download script to avoid repo re-cloning
rizlik Aug 10, 2023
ab69e27
x86: tgl: flash layout reorder
rizlik Sep 13, 2023
e0d9e65
x86: fsp: disable hyperthreading
rizlik Sep 13, 2023
0babaae
Stage1: allow signing with ecc384/sha384
danielinux Aug 21, 2023
6b4f0be
x86: fsp: support .data and .bss in stage1
rizlik Sep 14, 2023
e2a6899
Improved code readability; added comments
danielinux Aug 22, 2023
5db2714
Moved keystore section to the end of the flash
danielinux Aug 22, 2023
686335b
Updated linker script files for tgl target
danielinux Aug 31, 2023
d79ae03
Updated configuration for tgl target
danielinux Aug 31, 2023
d9d1492
makefile: add inlcude/target.h dep to keytools target
rizlik Aug 31, 2023
e95dad8
image.c: fix newline
rizlik Sep 12, 2023
ce90b3b
x86: paging: add end of reserved memory check
rizlik Sep 12, 2023
f4411f2
x86: fsp: add more debugging
rizlik Sep 12, 2023
9e9e504
fsp: remove unused stage2_params declaration
rizlik Sep 12, 2023
d88315c
fsp: move _stage2_params symbol in wolfboot .bss
rizlik Sep 12, 2023
e24c372
fsp: remove WOLFBOOT_FIXED_PARTITIONS (and hardcoded size limit)
rizlik Sep 12, 2023
c428d5a
config: tgl: default wolfboot load base to 64 MB
rizlik Sep 13, 2023
f5bd675
tools: script: make_hd update to use sha384/ecc384
rizlik Sep 13, 2023
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ $(PRIVATE_KEY):
$(Q)(test $(SIGN) = NONE) || ("$(KEYGEN_TOOL)" $(KEYGEN_OPTIONS) -g $(PRIVATE_KEY)) || true
$(Q)(test $(SIGN) = NONE) && (echo "// SIGN=NONE" > src/keystore.c) || true

keytools:
keytools: include/target.h
@echo "Building key tools"
@$(MAKE) -C tools/keytools -s clean
@$(MAKE) -C tools/keytools -j
Expand Down
2 changes: 0 additions & 2 deletions arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,6 @@ ifeq ("${FSP}", "1")
--defsym wb_end_bss=`grep _end_bss ../wolfboot.map | awk '{print $$1}'` \
--defsym _stage2_params=`grep _stage2_params ../wolfboot.map | awk '{print $$1}'`
LDFLAGS += --no-gc-sections --print-gc-sections -T $(LSCRIPT) -m elf_i386 -Map=loader_stage1.map
CFLAGS+=-DFSP_M_LOAD_BASE=$(FSP_M_LOAD_BASE)
CFLAGS+=-DFSP_S_LOAD_BASE=$(FSP_S_LOAD_BASE)
OBJS += src/boot_x86_fsp.o
OBJS += src/boot_x86_fsp_start.o
OBJS += src/fsp_m.o
Expand Down
13 changes: 6 additions & 7 deletions config/examples/kontron_vx3060_s2.config
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
ARCH=x86_64
TARGET=kontron_vx3060_s2
WOLFBOOT_SMALL_STACK=0
SIGN=ECC256
HASH?=SHA256
SIGN=ECC384
HASH=SHA384
DEBUG=1
SPMATH=1
ENCRYPTION=0
WOLFBOOT_FIXED_PARTITIONS=1
WOLFBOOT_PARTITION_SIZE=0x4000000
WOLFBOOT_NO_PARTITIONS=1
FORCE_32BIT=1

# 4gb - 12mb (BIOS Region size)
WOLFBOOT_PARTITION_BOOT_ADDRESS=0xff400000
WOLFBOOT_PARTITION_SWAP_ADDRESS=0x0
WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x0
WOLFBOOT_LOAD_BASE=0x2000000
WOLFBOOT_LOAD_BASE=0x4000000
WOLFBOOT_LOAD_ADDRESS=0x1000000

# required for keytools
Expand All @@ -27,7 +26,7 @@ FSP_S_UPD_DATA_BASE=0xffd00000
FSP_T_BASE=0xfff59000
FSP_M_BASE=0xfff60000

WOLFBOOT_ORIGIN=0xfff40000
WOLFBOOT_ORIGIN=0xfff20000
# 4 MB
BOOTLOADER_PARTITION_SIZE=0x600000
# 12 MB
Expand All @@ -51,7 +50,7 @@ PCI_ECAM_BASE=0xC0000000
PCI_USE_ECAM=1
PCH_HAS_PCR=1

WOLFTPM=1
WOLFTPM=0
64BIT=1
ELF=1
DEBUG_ELF=0
Expand Down
8 changes: 4 additions & 4 deletions config/examples/x86_fsp_qemu.config
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
ARCH=x86_64
TARGET=x86_fsp_qemu
WOLFBOOT_SMALL_STACK=1
SIGN?=ECC256
HASH?=SHA256
SIGN?=ECC384
HASH?=SHA384
DEBUG=1
SPMATH=1
FORCE_32BIT=1
ENCRYPTION=0
WOLFBOOT_FIXED_PARTITIONS=1
WOLFBOOT_PARTITION_SIZE=0x8000000
WOLFBOOT_NO_PARTITIONS=1
WOLFTPM=0

# TPM Keystore options
Expand All @@ -30,6 +29,7 @@ WOLFBOOT_DATA_ADDRESS=0x1000000
FSP_M_BASE=0xffe30000
FSP_S_BASE=0xffed6000
FSP_T_BASE=0xfffe0000
FSP_S_LOAD_BASE=0x0FED5F00
WOLFBOOT_ORIGIN=0xfffa0000
LINUX_PAYLOAD=1

Expand Down
3 changes: 1 addition & 2 deletions config/examples/x86_fsp_qemu_stage1_auth.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ DEBUG=1
SPMATH=1
FORCE_32BIT=1
ENCRYPTION=0
WOLFBOOT_FIXED_PARTITIONS=1
WOLFBOOT_PARTITION_SIZE=0x8000000
WOLFBOOT_NO_PARTITIONS=1
WOLFTPM=0

# TPM Keystore options
Expand Down
11 changes: 6 additions & 5 deletions config/examples/x86_fsp_qemu_tpm.config
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
ARCH=x86_64
TARGET=x86_fsp_qemu
WOLFBOOT_SMALL_STACK=1
SIGN?=ECC256
HASH?=SHA256
SIGN?=ECC384
HASH?=SHA384
DEBUG=1
SPMATH=1
FORCE_32BIT=1
ENCRYPTION=0
WOLFBOOT_FIXED_PARTITIONS=1
WOLFBOOT_PARTITION_SIZE=0x800000
WOLFBOOT_NO_PARTITIONS=1
WOLFTPM=1

# TPM Keystore options
Expand All @@ -30,7 +29,8 @@ WOLFBOOT_DATA_ADDRESS=0x1000000
FSP_M_BASE=0xffe30000
FSP_S_BASE=0xffed6000
FSP_T_BASE=0xfffe0000
WOLFBOOT_ORIGIN=0xffff0000
FSP_S_LOAD_BASE=0x0FED5F00
WOLFBOOT_ORIGIN=0xfffa0000
LINUX_PAYLOAD=1

BOOTLOADER_PARTITION_SIZE=0xa0000
Expand All @@ -39,3 +39,4 @@ MACHINE_OBJ=src/x86/qemu_fsp.o
FSP_T_BIN=./src/x86/fsp_t.bin
FSP_M_BIN=./src/x86/fsp_m.bin
FSP_S_BIN=./src/x86/fsp_s.bin
STAGE1_AUTH=1
3 changes: 1 addition & 2 deletions config/examples/x86_fsp_qemu_tpm_keystore.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ DEBUG=1
SPMATH=1
FORCE_32BIT=1
ENCRYPTION=0
WOLFBOOT_FIXED_PARTITIONS=1
WOLFBOOT_PARTITION_SIZE=0x800000
WOLFBOOT_NO_PARTITIONS=1
WOLFTPM=1

# TPM Keystore options
Expand Down
1 change: 0 additions & 1 deletion hal/kontron_vx3060_s2_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#ifdef __WOLFBOOT
#include <printf.h>

extern uint8_t* _stage2_params[];

static void panic(void);

Expand Down
2 changes: 0 additions & 2 deletions hal/x86_fsp_qemu.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
#include <x86/gpt.h>
#include <pci.h>

extern uint8_t* _stage2_params[];

#define PCI_AHCI_BUS 0
#define PCI_AHCI_DEV 31
#define PCI_AHCI_FUN 2
Expand Down
4 changes: 2 additions & 2 deletions hal/x86_fsp_qemu.ld.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ SECTIONS
_start_text = .;
*(.text*)
*(.rodata*)
*(.keystore*)
*(.data*)
. = ALIGN(4);
_end_text = .;
Expand All @@ -29,7 +30,6 @@ SECTIONS
. = ALIGN(4);
_end_bss = .;
__bss_end__ = .;
_end = .;
_stage2_params = .;
_end_wb = .;
}
}
1 change: 0 additions & 1 deletion hal/x86_fsp_qemu_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#ifdef __WOLFBOOT
#include <printf.h>

extern uint8_t* _stage2_params[];

static void panic(void);

Expand Down
41 changes: 36 additions & 5 deletions hal/x86_fsp_qemu_stage1.ld.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ FLASH_SIZE = @BOOTLOADER_PARTITION_SIZE@;
FLASH_START = 0x100000000 - @BOOTLOADER_PARTITION_SIZE@;
BOOTLOADER_JUMP32_START = 0xfffff000;
RESETVECTOR_START = 0xffffffec;
KEYSTORE_START = 0xffffe000;
FSP_T_ORIGIN = @FSP_T_BASE@; /* default base:size 0xFFFFF000:0x3000 [0xfffff000:0x100002000] */
FSP_M_ORIGIN = @FSP_M_BASE@; /* default base:size 0xfffdd000:0x22000 [0xfffdd000:0xfffff000] */
FSP_S_ORIGIN = @FSP_S_BASE@; /* default base:size 0xfffc8000:0x15000 [0xfffdd000:0xfffdd000] */
WOLFBOOT_ORIGIN = @WOLFBOOT_ORIGIN@;
DATA_MEM_START = 0x800000; /* 8 MB */

OUTPUT_FORMAT(elf32-i386)

MEMORY
Expand All @@ -16,25 +19,51 @@ MEMORY

SECTIONS
{
.jmpto32 BOOTLOADER_JUMP32_START :
.jmpto32 BOOTLOADER_JUMP32_START :
{
_off_boot = ABSOLUTE(.) & 0xffff;
KEEP(*(.jmpto32))
}
} > FLASH
.reset_vector RESETVECTOR_START :
{
KEEP(*(.reset_vector))
}
} > FLASH

.keystore KEYSTORE_START :
{
*(.keystore*)
} > FLASH

.bootloader WOLFBOOT_ORIGIN :
{
KEEP(*(.boot*))
*(.text*)
*(.rodata*)
*(.eh_frame*)
*(.data*)
. = ALIGN(256);
}
} > FLASH

_stored_data = .;
.data DATA_MEM_START : AT (_stored_data)
{
_start_data = .;
KEEP(*(.data*))
. = ALIGN(4);
KEEP(*(.ramcode))
. = ALIGN(4);
_end_data = .;
} > RAM

.bss(NOLOAD) : AT (_end_data)
{
_start_bss = .;
__bss_start__ = .;
*(.bss*)
. = ALIGN(4);
_end_bss = .;
__bss_end__ = .;
_end = .;
} > RAM

.wolfboot FLASH_START :
{
Expand Down Expand Up @@ -67,4 +96,6 @@ SECTIONS
_end_fsp_m = .;
}



}
4 changes: 2 additions & 2 deletions hal/x86_fsp_tgl.ld.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ SECTIONS
_start_text = .;
*(.text*)
*(.rodata*)
*(.keystore*)
*(.data*)
. = ALIGN(4);
_end_text = .;
Expand All @@ -29,7 +30,6 @@ SECTIONS
. = ALIGN(4);
_end_bss = .;
__bss_end__ = .;
_end = .;
_stage2_params = .;
_end_wb = .;
}
}
Loading
Loading