diff --git a/build.sh b/build.sh index ce7191d4e43..71204b3c563 100755 --- a/build.sh +++ b/build.sh @@ -23,9 +23,11 @@ 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" +CONTAINER="ghcr.io/dasharo/dasharo-sdk:latest" function build_optiplex_9010 { @@ -220,6 +222,78 @@ 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 + + # 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" + + 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 \ + ${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/edk2} \ + -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 \ + ${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/edk2} \ + -w /home/coreboot/coreboot ${CONTAINER} \ + /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 \ + ${EDK2_REPO_PATH:+-v $EDK2_REPO_PATH:/home/coreboot/edk2} \ + -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 +} + CMD="$1" case "$CMD" in @@ -289,6 +363,12 @@ case "$CMD" in "qemu_full" | "QEMU_full" | "q35_full" | "Q35_full" ) build_qemu "_all_menus" ;; + "odroid_h4" | "odroid_H4" | "ODROID_H4" ) + build_odroid_h4 + ;; + "odroid_h4_btg" ) + build_odroid_h4_btg + ;; *) echo "Invalid command: \"$CMD\"" usage diff --git a/configs/config.hardkernel_odroid_h4 b/configs/config.hardkernel_odroid_h4 index ac76d121c2b..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="https://github.com/Dasharo/edk2" -CONFIG_EDK2_TAG_OR_REV="origin/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 new file mode 100644 index 00000000000..f4da6d8632f --- /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="/home/coreboot/edk2" +CONFIG_EDK2_TAG_OR_REV="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