Skip to content

Commit

Permalink
Merge pull request #365 from rizlik/misc_improvements
Browse files Browse the repository at this point in the history
x86: fsp: misc improvements
  • Loading branch information
dgarske authored Sep 19, 2023
2 parents bc90f85 + f5bd675 commit ec59410
Show file tree
Hide file tree
Showing 33 changed files with 398 additions and 188 deletions.
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

0 comments on commit ec59410

Please sign in to comment.