From 24a40bb68692350ced4d0060ccb7f1d4cfd74832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=BBygowski?= Date: Mon, 30 Sep 2024 13:31:36 +0200 Subject: [PATCH 1/6] build.sh: Add DOROID H4 build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Żygowski --- build.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/build.sh b/build.sh index ce7191d4e43..0b0326f3b37 100755 --- a/build.sh +++ b/build.sh @@ -23,6 +23,7 @@ usage() { echo -e "\toptiplex_9010 - build Dasharo compatible with Dell OptiPlex 7010/9010" echo -e "\tqemu - build Dasharo for QEMU Q35" echo -e "\tqemu_full - build Dasharo for QEMU Q35 with all menus available" + echo -e "\todroid_h4 - build Dasharo compatible with Hardkernel ODROID H4" } SDKVER="2023-11-24_2731fa619b" @@ -220,6 +221,39 @@ function build_qemu { fi } +function build_odroid_h4 { + DEFCONFIG="configs/config.hardkernel_odroid_h4" + FW_VERSION=$(cat ${DEFCONFIG} | grep CONFIG_LOCALVERSION | cut -d '=' -f 2 | tr -d '"') + + # checkout several submodules needed by these boards (some others are checked + # out by coreboot's Makefile) + git submodule update --init --force --checkout \ + 3rdparty/dasharo-blobs + + docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \ + -v $HOME/.ssh:/home/coreboot/.ssh \ + -w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \ + /bin/bash -c "make distclean" + + cp $DEFCONFIG .config + + echo "Building Dasharo compatbile with Hardkernel ODROID H4 (version $FW_VERSION)" + + docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \ + -v $HOME/.ssh:/home/coreboot/.ssh \ + -w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \ + /bin/bash -c "make olddefconfig && make -j$(nproc)" + + cp build/coreboot.rom hardkernel_odroid_h4_${FW_VERSION}.rom + if [ $? -eq 0 ]; then + echo "Result binary placed in $PWD/hardkernel_odroid_h4_${FW_VERSION}.rom" + sha256sum hardkernel_odroid_h4_${FW_VERSION}.rom > hardkernel_odroid_h4_${FW_VERSION}.rom.sha256 + else + echo "Build failed!" + exit 1 + fi +} + CMD="$1" case "$CMD" in @@ -289,6 +323,9 @@ case "$CMD" in "qemu_full" | "QEMU_full" | "q35_full" | "Q35_full" ) build_qemu "_all_menus" ;; + "odroid_h4" | "odroid_H4" | "ODROID_H4" ) + build_odroid_h4 + ;; *) echo "Invalid command: \"$CMD\"" usage From 238f375c5000fd880fc01772d2c351e6e341ab81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=BBygowski?= Date: Fri, 11 Oct 2024 13:19:08 +0200 Subject: [PATCH 2/6] configs/config.hardkernel_odroid_h4_btg: Add BootGuard config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Żygowski --- configs/config.hardkernel_odroid_h4_btg | 69 +++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 configs/config.hardkernel_odroid_h4_btg diff --git a/configs/config.hardkernel_odroid_h4_btg b/configs/config.hardkernel_odroid_h4_btg new file mode 100644 index 00000000000..6e05f2b6109 --- /dev/null +++ b/configs/config.hardkernel_odroid_h4_btg @@ -0,0 +1,69 @@ +CONFIG_LOCALVERSION="v0.9.0-rc2" +CONFIG_OPTION_BACKEND_NONE=y +CONFIG_VENDOR_HARDKERNEL=y +CONFIG_VBOOT=y +CONFIG_EDK2_CPU_THROTTLING_THRESHOLD_DEFAULT=10 +CONFIG_IFD_BIN_PATH="3rdparty/dasharo-blobs/$(MAINBOARDDIR)/descriptor.bin" +CONFIG_ME_BIN_PATH="3rdparty/dasharo-blobs/$(MAINBOARDDIR)/me.bin" +CONFIG_CONSOLE_CBMEM_BUFFER_SIZE=0x100000 +CONFIG_PCIEXP_DEFAULT_MAX_RESIZABLE_BAR_BITS=36 +CONFIG_HAVE_IFD_BIN=y +CONFIG_EDK2_BOOTSPLASH_FILE="3rdparty/dasharo-blobs/dasharo/bootsplash.bmp" +CONFIG_TPM_MEASURED_BOOT=y +CONFIG_POWER_STATE_OFF_AFTER_FAILURE=y +CONFIG_HAVE_ME_BIN=y +CONFIG_DASHARO_PREFER_S3_SLEEP=y +CONFIG_PCIEXP_SUPPORT_RESIZABLE_BARS=y +CONFIG_DRIVERS_EFI_VARIABLE_STORE=y +CONFIG_DRIVERS_GENERIC_CBFS_SERIAL=y +CONFIG_DRIVERS_GENERIC_CBFS_UUID=y +# CONFIG_DRIVERS_MTK_WIFI is not set +CONFIG_CBFS_VERIFICATION=y +CONFIG_VBOOT_CBFS_INTEGRATION=y +CONFIG_TPM2=y +CONFIG_INTEL_TXT_BIOSACM_FILE="ADL_BIOSAC_v1_18_16_20230427_REL_NT_O1.PW_signed_256K.bin" +CONFIG_INTEL_CBNT_SUPPORT=y +CONFIG_INTEL_CBNT_LOGGING=y +# CONFIG_INTEL_CBNT_GENERATE_KM is not set +# CONFIG_INTEL_CBNT_GENERATE_BPM is not set +CONFIG_INTEL_CBNT_KEY_MANIFEST_BINARY="key_manifest.bin" +CONFIG_INTEL_CBNT_BOOT_POLICY_MANIFEST_BINARY="bpm_manifest.bin" +CONFIG_BOOTMEDIA_LOCK_CONTROLLER=y +CONFIG_BOOTMEDIA_LOCK_WPRO_VBOOT_RO=y +CONFIG_BOOTMEDIA_LOCK_IN_VERSTAGE=y +CONFIG_BOOTMEDIA_SMM_BWP=y +CONFIG_DEFAULT_CONSOLE_LOGLEVEL_0=y +CONFIG_PAYLOAD_EDK2=y +CONFIG_EDK2_REPOSITORY="https://github.com/Dasharo/edk2" +CONFIG_EDK2_TAG_OR_REV="origin/rebased" +CONFIG_EDK2_CBMEM_LOGGING=y +CONFIG_EDK2_FOLLOW_BGRT_SPEC=y +CONFIG_EDK2_SERIAL_SUPPORT=y +CONFIG_BUILD_IPXE=y +# CONFIG_IPXE_SERIAL_CONSOLE is not set +CONFIG_IPXE_NO_PROMPT=y +CONFIG_IPXE_ADD_SCRIPT=y +CONFIG_IPXE_SCRIPT="3rdparty/dasharo-blobs/dasharo/dasharo.ipxe" +CONFIG_IPXE_CUSTOM_BUILD_ID="0123456789" +CONFIG_EDK2_SKIP_PS2_DETECT=y +CONFIG_EDK2_ENABLE_IPXE=y +# CONFIG_EDK2_SECURE_BOOT_DEFAULT_ENABLE is not set +CONFIG_EDK2_SATA_PASSWORD=y +CONFIG_EDK2_OPAL_PASSWORD=y +CONFIG_EDK2_SETUP_PASSWORD=y +CONFIG_EDK2_DASHARO_SYSTEM_FEATURES=y +CONFIG_EDK2_DASHARO_SECURITY_OPTIONS=y +CONFIG_EDK2_DASHARO_USB_CONFIG=y +CONFIG_EDK2_DASHARO_NETWORK_CONFIG=y +CONFIG_EDK2_DASHARO_POWER_CONFIG=y +CONFIG_EDK2_CPU_THROTTLING_THRESHOLD_OPTION=y +CONFIG_EDK2_DASHARO_PCI_CONFIG=y +CONFIG_EDK2_DASHARO_SERIAL_REDIRECTION_DEFAULT_ENABLE=y +CONFIG_EDK2_DASHARO_CPU_CONFIG=y +CONFIG_EDK2_CORE_DISABLE_OPTION=y +CONFIG_EDK2_HYPERTHREADING_OPTION=y +CONFIG_EDK2_BOOT_MENU_KEY=0x0015 +CONFIG_EDK2_SETUP_MENU_KEY=0x0008 +CONFIG_EDK2_CREATE_PREINSTALLED_BOOT_OPTIONS=y +CONFIG_DISPLAY_FSP_CALLS_AND_STATUS=y +CONFIG_DISPLAY_FSP_HEADER=y From e97858b2157b4274bfd8efefd43a394658b3b1cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Tue, 15 Oct 2024 16:33:18 +0200 Subject: [PATCH 3/6] build.sh: use dasharo-sdk for odroid_h4 builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- build.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 0b0326f3b37..4d244bbae34 100755 --- a/build.sh +++ b/build.sh @@ -27,6 +27,7 @@ usage() { } SDKVER="2023-11-24_2731fa619b" +CONTAINER="ghcr.io/dasharo/dasharo-sdk:latest" function build_optiplex_9010 { @@ -232,7 +233,7 @@ function build_odroid_h4 { docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \ -v $HOME/.ssh:/home/coreboot/.ssh \ - -w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \ + -w /home/coreboot/coreboot ${CONTAINER} \ /bin/bash -c "make distclean" cp $DEFCONFIG .config @@ -241,7 +242,7 @@ function build_odroid_h4 { docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \ -v $HOME/.ssh:/home/coreboot/.ssh \ - -w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \ + -w /home/coreboot/coreboot ${CONTAINER} \ /bin/bash -c "make olddefconfig && make -j$(nproc)" cp build/coreboot.rom hardkernel_odroid_h4_${FW_VERSION}.rom From 45972536bc94c5977c2131aad28d6c806709524d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Fri, 18 Oct 2024 09:36:25 +0200 Subject: [PATCH 4/6] configs: use local path for edk2 repository MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- configs/config.hardkernel_odroid_h4 | 4 ++-- configs/config.hardkernel_odroid_h4_btg | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/config.hardkernel_odroid_h4 b/configs/config.hardkernel_odroid_h4 index ac76d121c2b..dd26f4c1275 100644 --- a/configs/config.hardkernel_odroid_h4 +++ b/configs/config.hardkernel_odroid_h4 @@ -25,8 +25,8 @@ CONFIG_BOOTMEDIA_LOCK_IN_VERSTAGE=y CONFIG_BOOTMEDIA_SMM_BWP=y CONFIG_DEFAULT_CONSOLE_LOGLEVEL_0=y CONFIG_PAYLOAD_EDK2=y -CONFIG_EDK2_REPOSITORY="https://github.com/Dasharo/edk2" -CONFIG_EDK2_TAG_OR_REV="origin/rebased" +CONFIG_EDK2_REPOSITORY="/home/user/training_materials/src/edk2" +CONFIG_EDK2_TAG_OR_REV="rebased" CONFIG_EDK2_CBMEM_LOGGING=y CONFIG_EDK2_FOLLOW_BGRT_SPEC=y CONFIG_EDK2_SERIAL_SUPPORT=y diff --git a/configs/config.hardkernel_odroid_h4_btg b/configs/config.hardkernel_odroid_h4_btg index 6e05f2b6109..cc042e08ef0 100644 --- a/configs/config.hardkernel_odroid_h4_btg +++ b/configs/config.hardkernel_odroid_h4_btg @@ -34,8 +34,8 @@ CONFIG_BOOTMEDIA_LOCK_IN_VERSTAGE=y CONFIG_BOOTMEDIA_SMM_BWP=y CONFIG_DEFAULT_CONSOLE_LOGLEVEL_0=y CONFIG_PAYLOAD_EDK2=y -CONFIG_EDK2_REPOSITORY="https://github.com/Dasharo/edk2" -CONFIG_EDK2_TAG_OR_REV="origin/rebased" +CONFIG_EDK2_REPOSITORY="/home/user/training_materials/src/edk2" +CONFIG_EDK2_TAG_OR_REV="rebased" CONFIG_EDK2_CBMEM_LOGGING=y CONFIG_EDK2_FOLLOW_BGRT_SPEC=y CONFIG_EDK2_SERIAL_SUPPORT=y From 7471957cf5ba0c142c4f5812363304e86525be4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Fri, 18 Oct 2024 09:37:41 +0200 Subject: [PATCH 5/6] build.sh: do not clean and add odroid_h4_btg build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- build.sh | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 4d244bbae34..0df87da10ab 100755 --- a/build.sh +++ b/build.sh @@ -231,10 +231,45 @@ function build_odroid_h4 { git submodule update --init --force --checkout \ 3rdparty/dasharo-blobs + # do not do distclean, because it removes all downloaded artifacts docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \ -v $HOME/.ssh:/home/coreboot/.ssh \ -w /home/coreboot/coreboot ${CONTAINER} \ - /bin/bash -c "make distclean" + /bin/bash -c "make clean" + + cp $DEFCONFIG .config + + echo "Building Dasharo compatbile with Hardkernel ODROID H4 (version $FW_VERSION)" + + docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \ + -v $HOME/.ssh:/home/coreboot/.ssh \ + -w /home/coreboot/coreboot ${CONTAINER} \ + /bin/bash -c "make olddefconfig && make -j$(nproc)" + + cp build/coreboot.rom hardkernel_odroid_h4_${FW_VERSION}.rom + if [ $? -eq 0 ]; then + echo "Result binary placed in $PWD/hardkernel_odroid_h4_${FW_VERSION}.rom" + sha256sum hardkernel_odroid_h4_${FW_VERSION}.rom > hardkernel_odroid_h4_${FW_VERSION}.rom.sha256 + else + echo "Build failed!" + exit 1 + fi +} + +function build_odroid_h4_btg { + DEFCONFIG="configs/config.hardkernel_odroid_h4_btg" + FW_VERSION=$(cat ${DEFCONFIG} | grep CONFIG_LOCALVERSION | cut -d '=' -f 2 | tr -d '"') + + # checkout several submodules needed by these boards (some others are checked + # out by coreboot's Makefile) + git submodule update --init --force --checkout \ + 3rdparty/dasharo-blobs + + # do not do distclean, because it removes all downloaded artifacts + docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \ + -v $HOME/.ssh:/home/coreboot/.ssh \ + -w /home/coreboot/coreboot ${CONTAINER} \ + /bin/bash -c "make clean" cp $DEFCONFIG .config @@ -327,6 +362,9 @@ case "$CMD" in "odroid_h4" | "odroid_H4" | "ODROID_H4" ) build_odroid_h4 ;; + "odroid_h4_btg" ) + build_odroid_h4_btg + ;; *) echo "Invalid command: \"$CMD\"" usage From 5dc45e6b1ec3ed3455a9037d870b47255146c8ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kr=C3=B3l?= Date: Fri, 18 Oct 2024 16:15:49 +0200 Subject: [PATCH 6/6] build.sh: add support for edk2 repo mounted through EDK2_REPO_PATH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Król --- build.sh | 4 ++++ configs/config.hardkernel_odroid_h4 | 4 ++-- configs/config.hardkernel_odroid_h4_btg | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 0df87da10ab..71204b3c563 100755 --- a/build.sh +++ b/build.sh @@ -234,6 +234,7 @@ function build_odroid_h4 { # do not do distclean, because it removes all downloaded artifacts docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \ -v $HOME/.ssh:/home/coreboot/.ssh \ + ${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/edk2} \ -w /home/coreboot/coreboot ${CONTAINER} \ /bin/bash -c "make clean" @@ -243,6 +244,7 @@ function build_odroid_h4 { docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \ -v $HOME/.ssh:/home/coreboot/.ssh \ + ${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/edk2} \ -w /home/coreboot/coreboot ${CONTAINER} \ /bin/bash -c "make olddefconfig && make -j$(nproc)" @@ -268,6 +270,7 @@ function build_odroid_h4_btg { # do not do distclean, because it removes all downloaded artifacts docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \ -v $HOME/.ssh:/home/coreboot/.ssh \ + ${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/edk2} \ -w /home/coreboot/coreboot ${CONTAINER} \ /bin/bash -c "make clean" @@ -277,6 +280,7 @@ function build_odroid_h4_btg { docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \ -v $HOME/.ssh:/home/coreboot/.ssh \ + ${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/edk2} \ -w /home/coreboot/coreboot ${CONTAINER} \ /bin/bash -c "make olddefconfig && make -j$(nproc)" diff --git a/configs/config.hardkernel_odroid_h4 b/configs/config.hardkernel_odroid_h4 index dd26f4c1275..4f35f7f59d6 100644 --- a/configs/config.hardkernel_odroid_h4 +++ b/configs/config.hardkernel_odroid_h4 @@ -25,8 +25,8 @@ CONFIG_BOOTMEDIA_LOCK_IN_VERSTAGE=y CONFIG_BOOTMEDIA_SMM_BWP=y CONFIG_DEFAULT_CONSOLE_LOGLEVEL_0=y CONFIG_PAYLOAD_EDK2=y -CONFIG_EDK2_REPOSITORY="/home/user/training_materials/src/edk2" -CONFIG_EDK2_TAG_OR_REV="rebased" +CONFIG_EDK2_REPOSITORY="/home/coreboot/edk2" +CONFIG_EDK2_TAG_OR_REV="e91a6e499eff7ff601fe65383d16811ee96fce2c" CONFIG_EDK2_CBMEM_LOGGING=y CONFIG_EDK2_FOLLOW_BGRT_SPEC=y CONFIG_EDK2_SERIAL_SUPPORT=y diff --git a/configs/config.hardkernel_odroid_h4_btg b/configs/config.hardkernel_odroid_h4_btg index cc042e08ef0..f4da6d8632f 100644 --- a/configs/config.hardkernel_odroid_h4_btg +++ b/configs/config.hardkernel_odroid_h4_btg @@ -34,7 +34,7 @@ CONFIG_BOOTMEDIA_LOCK_IN_VERSTAGE=y CONFIG_BOOTMEDIA_SMM_BWP=y CONFIG_DEFAULT_CONSOLE_LOGLEVEL_0=y CONFIG_PAYLOAD_EDK2=y -CONFIG_EDK2_REPOSITORY="/home/user/training_materials/src/edk2" +CONFIG_EDK2_REPOSITORY="/home/coreboot/edk2" CONFIG_EDK2_TAG_OR_REV="rebased" CONFIG_EDK2_CBMEM_LOGGING=y CONFIG_EDK2_FOLLOW_BGRT_SPEC=y