Skip to content

Commit

Permalink
tools: move tools/x86_fsp in tools/scripts/x86_fsp
Browse files Browse the repository at this point in the history
  • Loading branch information
rizlik committed Apr 29, 2024
1 parent a8cbc61 commit 943edf9
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-x86-fsp-qemu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
22 changes: 11 additions & 11 deletions docs/Targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.

0 comments on commit 943edf9

Please sign in to comment.