tools: move tools/x86_fsp in tools/scripts/x86_fsp

pull/443/head
Marco Oliverio 2024-04-29 09:09:24 +02:00
parent a8cbc6140f
commit 943edf93e7
16 changed files with 31 additions and 21 deletions

View File

@ -20,4 +20,4 @@ jobs:
git config --global user.name "Your Name"
- name: run test
run: |
./tools/x86_fsp/qemu/test_qemu.sh
./tools/scripts/x86_fsp/qemu/test_qemu.sh

View File

@ -2084,7 +2084,7 @@ A test ELF/Multiboot2 image is provided as well. To test `config/examples/x86_fs
cp config/examples/x86_fsp_qemu.config .config
# Create necessary Intel FSP binaries from edk2 repo
./tools/x86_fsp/qemu/qemu_build_fsp.sh
./tools/scripts/x86_fsp/qemu/qemu_build_fsp.sh
# build wolfboot
make
@ -2093,10 +2093,10 @@ make
make test-app/image.elf
# make_hd.sh sign the image, creates a file-based hard disk image with GPT table and raw partitions and then copies the signed images into the partitions.
IMAGE=test-app/image.elf tools/x86_fsp/qemu/make_hd.sh
IMAGE=test-app/image.elf tools/scripts/x86_fsp/qemu/make_hd.sh
# run wolfBoot + test-image
./tools/x86_fsp/qemu/qemu.sh
./tools/scripts/x86_fsp/qemu/qemu.sh
```
#### Sample boot output using config/examples/x86_fsp_qemu.config
@ -2316,7 +2316,7 @@ The correct steps to run the example:
cp config/examples/x86_fsp_qemu_seal.config .config
# create necessary Intel FSP binaries from edk2 repo
tools/x86_fsp/qemu/qemu_build_fsp.sh
tools/scripts/x86_fsp/qemu/qemu_build_fsp.sh
# make keytools and tpmtools
make keytools
@ -2329,22 +2329,22 @@ make tpmtools
make CFLAGS_EXTRA="-DHAVE_ECC256"
# compute the value of PCR0 to sign with TPM key
PCR0=$(python ./tools/x86_fsp/compute_pcr.py --target qemu wolfboot_stage1.bin | tail -n 1)
PCR0=$(python ./tools/scripts/x86_fsp/compute_pcr.py --target qemu wolfboot_stage1.bin | tail -n 1)
# sign the policy
./tools/tpm/policy_sign -ecc256 -key=tpm_seal_key.key -pcr=0 -pcrdigest=$PCR0
# install the policy
./tools/x86_fsp/tpm_install_policy.sh policy.bin.sig
./tools/scripts/x86_fsp/tpm_install_policy.sh policy.bin.sig
# make test-app
make test-app/image.elf
# make_hd.sh sign the image, creates a file-based hard disk image with GPT table and raw partitions and then copy the signed images into the partitions.
IMAGE=test-app/image.elf SIGN=--ecc384 tools/x86_fsp/qemu/make_hd.sh
IMAGE=test-app/image.elf SIGN=--ecc384 tools/scripts/x86_fsp/qemu/make_hd.sh
# run wolfBoot + test-image, use -t to emulate a TPM (requires swtpm)
./tools/x86_fsp/qemu/qemu.sh -t
./tools/scripts/x86_fsp/qemu/qemu.sh -t
```
For more advanced uses of TPM, please check [TPM.md](TPM.md) to configure wolfBoot
@ -2359,11 +2359,11 @@ To compile a flashable image run the following steps:
```
cp config/examples/kontron_vx3060_s2.config .config
./tools/x86_fsp/tgl/tgl_download_fsp.sh
./tools/scripts/x86_fsp/tgl/tgl_download_fsp.sh
make tpmtools
./tools/x86_fsp/tgl/assemble_image.sh -k
./tools/scripts/x86_fsp/tgl/assemble_image.sh -k
make CFLAGS_EXTRA="-DHAVE_ECC256"
./tools/x86_fsp/tgl/assemble_image.sh -n /path/to/original/flash/dump
./tools/scripts/x86_fsp/tgl/assemble_image.sh -n /path/to/original/flash/dump
```
they produce a file named `final_image.bin` inside the root folder of the

View File

@ -6,12 +6,17 @@ EDKII_REPO=https://github.com/tianocore/edk2.git
SBL_COMMIT_ID=c80d8d592cf127616daca5df03ac7731e78ffcc1
SBL_PATCH_URL=https://github.com/slimbootloader/slimbootloader/raw/${SBL_COMMIT_ID}/Silicon/QemuSocPkg/FspBin/Patches/0001-Build-QEMU-FSP-2.0-binaries.patch
SCRIPT_DIR=$(readlink -f "$(dirname "$0")")
WOLFBOOT_DIR="${SCRIPT_DIR}/../../.."
WOLFBOOT_DIR="$(pwd)"
FSP_NAME=QEMU_FSP_DEBUG
CONFIG_FILE=${CONFIG_FILE:-"${WOLFBOOT_DIR}/.config"}
set -e
if [ ! -f "${WOLFBOOT_DIR}/arch.mk" ]; then
echo "Error: Current directory is not the root directory of the source tree"
exit 1
fi
if [ ! -d "$WORK_DIR" ]; then
mkdir -p "$WORK_DIR"
fi

View File

@ -23,7 +23,7 @@ if [ "$REBUILD_ONLY" != true ]; then
make distclean
cp "config/examples/${CONFIG}" .config
./tools/x86_fsp/qemu/qemu_build_fsp.sh
./tools/scripts/x86_fsp/qemu/qemu_build_fsp.sh
make keytools
make tpmtools
# generate one key for images and one for the TPM
@ -37,16 +37,16 @@ make CFLAGS_EXTRA="-DHAVE_ECC256"
make test-app/image.elf
# compute pcr0 value
PCR0=$(python ./tools/x86_fsp/compute_pcr.py --target qemu wolfboot_stage1.bin | tail -n 1)
PCR0=$(python ./tools/scripts/x86_fsp/compute_pcr.py --target qemu wolfboot_stage1.bin | tail -n 1)
echo $PCR0
./tools/tpm/policy_sign -ecc256 -key=tpm_seal_key.key -pcr=0 -pcrdigest=$PCR0
./tools/x86_fsp/tpm_install_policy.sh policy.bin.sig
IMAGE=test-app/image.elf SIGN=--ecc384 ./tools/x86_fsp/qemu/make_hd.sh
./tools/scripts/x86_fsp/tpm_install_policy.sh policy.bin.sig
IMAGE=test-app/image.elf SIGN=--ecc384 ./tools/scripts/x86_fsp/qemu/make_hd.sh
echo "RUNNING QEMU"
# launch qemu in background
./tools/x86_fsp/qemu/qemu.sh -p | tee /tmp/qemu_output &
./tools/scripts/x86_fsp/qemu/qemu.sh -t -p | tee /tmp/qemu_output &
echo "WAITING FOR QEMU TO RUN"
sleep 5

View File

@ -26,9 +26,9 @@ build_and_sign_image()
cp "$FLASH_DUMP" "$WOLFBOOT_DIR/temp_image.bin"
truncate -s $SIZE "$WOLFBOOT_DIR/temp_image.bin"
cat "$WOLFBOOT_DIR/temp_image.bin" "$BIOS_REGION_PATH" > "$WOLFBOOT_DIR/final_image.bin"
PCR0=$(python ./tools/x86_fsp/compute_pcr.py "$WOLFBOOT_DIR"/final_image.bin | tail -n 1)
PCR0=$(python ./tools/scripts/x86_fsp/compute_pcr.py "$WOLFBOOT_DIR"/final_image.bin | tail -n 1)
"$WOLFBOOT_DIR"/tools/tpm/policy_sign -ecc256 -key=tpm_seal_key.key -pcr=0 -pcrdigest=$PCR0
IMAGE_FILE="$WOLFBOOT_DIR"/final_image.bin "$WOLFBOOT_DIR"/tools/x86_fsp/tpm_install_policy.sh policy.bin.sig
IMAGE_FILE="$WOLFBOOT_DIR"/final_image.bin "$WOLFBOOT_DIR"/tools/scripts/x86_fsp/tpm_install_policy.sh policy.bin.sig
}
assemble()

View File

@ -8,13 +8,18 @@ FSP_URL=https://github.com/intel/FSP/raw/${FSP_COMMIT_ID}/TigerLakeFspBinPkg/TGL
FSP_REPO=https://github.com/intel/FSP.git
UCODE_URL=https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/raw/6f36ebde4519f8a21a047c3433b80a3fb41361e1/intel-ucode/06-8c-01
SCRIPT_DIR=$(readlink -f "$(dirname "$0")")
WOLFBOOT_DIR="${SCRIPT_DIR}/../../.."
WOLFBOOT_DIR="$(pwd)"
FSP_PREFIX=Fsp
CONFIG_FILE=${CONFIG_FILE:-"${WOLFBOOT_DIR}/.config"}
PATCH="${SCRIPT_DIR}/0001-FSP-wolfboot-patch.patch"
set -e
if [ ! -f "${WOLFBOOT_DIR}/arch.mk" ]; then
echo "Error: Current directory is not the root directory of the source tree"
exit 1
fi
if [ ! -d "$WORK_DIR" ]; then
mkdir -p "$WORK_DIR"
fi