Index: sysutils/edk2/Makefile =================================================================== --- sysutils/edk2/Makefile +++ sysutils/edk2/Makefile @@ -11,7 +11,7 @@ ONLY_FOR_ARCHS_REASON= only provides firmware for aarch64 and amd64 PKGNAMESUFFIX= -${FLAVOR:C/_/-/g} -FLAVORS= macchiatobin fvp rpi3 rpi4 xen_x64 +FLAVORS= macchiatobin fvp rpi3 rpi4 xen_x64 bhyve FLAVOR?= macchiatobin USES= cpe gmake python:3.7+,build @@ -94,7 +94,33 @@ PLAT_FILENAME= XEN_X64_EFI.fd .endif +.if ${FLAVOR} == bhyve +ONLY_FOR_ARCHS= amd64 +ONLY_FOR_ARCHS_REASON= Bhyve only runs on x64 +PLAT= bhyve +PLAT_ARCH= X64 +PLAT_TARGET= RELEASE +PLATFILE= OvmfPkg/Bhyve/BhyveX64.dsc +PLAT_RESULT= BhyveX64/${PLAT_TARGET}_GCC5/FV/BHYVE.fd +PLAT_RESULT_CODE= BhyveX64/${PLAT_TARGET}_GCC5/FV/BHYVE_CODE.fd +PLAT_RESULT_VARS= BhyveX64/${PLAT_TARGET}_GCC5/FV/BHYVE_VARS.fd +PLAT_FILENAME= BHYVE_UEFI.fd +PLAT_FILENAME_CODE = BHYVE_UEFI_CODE.fd +PLAT_FILENAME_VARS = BHYVE_UEFI_VARS.fd +.endif + PLIST_FILES= ${PREFIX}/share/${PORTNAME}-${PLAT}/${PLAT_FILENAME} +.if defined(PLAT_FILENAME_CODE) +PLIST_FILES+= ${PREFIX}/share/${PORTNAME}-${PLAT}/${PLAT_FILENAME_CODE} +.endif +.if defined(PLAT_FILENAME_VARS) +PLIST_FILES+= ${PREFIX}/share/${PORTNAME}-${PLAT}/${PLAT_FILENAME_VARS} +.endif +.if ${FLAVOR} == bhyve +PLIST_FILES+= ${PREFIX}/share/uefi-firmware/${PLAT_FILENAME} +PLIST_FILES+= ${PREFIX}/share/uefi-firmware/${PLAT_FILENAME_CODE} +PLIST_FILES+= ${PREFIX}/share/uefi-firmware/${PLAT_FILENAME_VARS} +.endif # Emulate source edk2/edksetup.sh MAKE_ENV+= WORKSPACE=${WRKDIR} \ @@ -133,5 +159,18 @@ do-install: ${MKDIR} ${STAGEDIR}/${PREFIX}/share/${PORTNAME}-${PLAT}/ ${INSTALL_DATA} ${WRKDIR}/Build/${PLAT_RESULT} ${STAGEDIR}/${PREFIX}/share/${PORTNAME}-${PLAT}/${PLAT_FILENAME} +.if defined(PLAT_FILENAME_CODE) + ${INSTALL_DATA} ${WRKDIR}/Build/${PLAT_RESULT_CODE} ${STAGEDIR}/${PREFIX}/share/${PORTNAME}-${PLAT}/${PLAT_FILENAME_CODE} +.endif +.if defined(PLAT_FILENAME_VARS) + ${INSTALL_DATA} ${WRKDIR}/Build/${PLAT_RESULT_VARS} ${STAGEDIR}/${PREFIX}/share/${PORTNAME}-${PLAT}/${PLAT_FILENAME_VARS} +.endif +.if ${FLAVOR} == bhyve + # For backwards compatibility + ${MKDIR} ${STAGEDIR}/${PREFIX}/share/uefi-firmware/ + ${RLN} ${STAGEDIR}/${PREFIX}/share/${PORTNAME}-${PLAT}/${PLAT_FILENAME} ${STAGEDIR}/${PREFIX}/share/uefi-firmware/${PLAT_FILENAME} + ${RLN} ${STAGEDIR}/${PREFIX}/share/${PORTNAME}-${PLAT}/${PLAT_FILENAME_CODE} ${STAGEDIR}/${PREFIX}/share/uefi-firmware/${PLAT_FILENAME_CODE} + ${RLN} ${STAGEDIR}/${PREFIX}/share/${PORTNAME}-${PLAT}/${PLAT_FILENAME_VARS} ${STAGEDIR}/${PREFIX}/share/uefi-firmware/${PLAT_FILENAME_VARS} +.endif .include Index: sysutils/uefi-edk2-bhyve/Makefile =================================================================== --- sysutils/uefi-edk2-bhyve/Makefile +++ /dev/null @@ -1,92 +0,0 @@ -PORTNAME= uefi-edk2-bhyve -PORTVERSION= g20210226 -PORTREVISION= 1 -PORTEPOCH= 2 -CATEGORIES= sysutils - -MAINTAINER= bcran@FreeBSD.org -COMMENT= UEFI EDK2 firmware for bhyve - -LICENSE= BSD2CLAUSE+PATENT -LICENSE_GROUPS= FSF OSI COPYFREE -LICENSE_NAME= BSD-2-Clause Plus Patent License -LICENSE_FILE= ${WRKSRC}/License.txt -LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept - -ONLY_FOR_ARCHS= amd64 -ONLY_FOR_ARCHS_REASON= bhyve firmware has only been ported to X64 - -BUILD_DEPENDS= nasm:devel/nasm \ - bash:shells/bash - -USES= gmake \ - python:3.7+,build -USE_GCC= yes:build -USE_GITHUB= yes -GH_ACCOUNT= tianocore -GH_PROJECT= edk2 -GH_TAGNAME= edk2-stable202102 -GH_TUPLE= ucb-bar:berkeley-softfloat-3:master:softfloat/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 \ - google:brotli:v1.0.7-17-g666c328:brotli/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli \ - openssl:openssl:OpenSSL_1_1_1g:openssl/CryptoPkg/Library/OpensslLib/openssl \ - kkos:oniguruma:v6.9.4_mark1:oniguruma/MdeModulePkg/Universal/RegularExpressionDxe/oniguruma \ - akheron:jansson:v2.13.1:jansson/RedfishPkg/Library/JsonLib/jansson \ - -BINARY_ALIAS= make=${LOCALBASE}/bin/gmake \ - gcc=${LOCALBASE}/bin/gcc${GCC_DEFAULT} \ - gcc-ar=${LOCALBASE}/bin/gcc-ar${GCC_DEFAULT} \ - g++=${LOCALBASE}/bin/g++${GCC_DEFAULT} \ - python3=${PYTHON_CMD} python=${PYTHON_CMD} - -PLAT_ARCH= X64 -PLAT_FILE= OvmfPkg/Bhyve/BhyveX64.dsc -PLAT_RESULT= BhyveX64/${PLAT_TARGET}_GCC5/FV/BHYVE.fd -PLAT_RESULT_CODE= BhyveX64/${PLAT_TARGET}_GCC5/FV/BHYVE_CODE.fd -PLAT_RESULT_VARS= BhyveX64/${PLAT_TARGET}_GCC5/FV/BHYVE_VARS.fd - -PLIST_FILES= ${PREFIX}/share/uefi-firmware/BHYVE_UEFI.fd \ - ${PREFIX}/share/uefi-firmware/BHYVE_UEFI_CODE.fd \ - ${PREFIX}/share/uefi-firmware/BHYVE_UEFI_VARS.fd - -OPTIONS_DEFINE= DEBUG HTTP_BOOT -OPTIONS_DEFAULT= HTTP_BOOT - -DEBUG_DESC= Build a debug configuration -HTTP_BOOT_DESC= Build with HTTP(S) boot support - -DEBUG_VARS= PLAT_TARGET=DEBUG -DEBUG_VARS_OFF= PLAT_TARGET=RELEASE -HTTP_BOOT_VARS= PLAT_ARGS+=-DNETWORK_HTTP_BOOT_ENABLE=TRUE - -PLAT_ARGS+= -DDEBUG_ON_SERIAL_PORT=TRUE - -# Emulate source edk2/edksetup.sh -MAKE_ENV+= WORKSPACE=${WRKDIR} \ - PACKAGES_PATH=${WRKDIR}/edk2-${GH_TAGNAME} \ - CONF_PATH=${WRKDIR}/edk2-${GH_TAGNAME}/Conf \ - EDK_TOOLS_PATH=${WRKDIR}/edk2-${GH_TAGNAME}/BaseTools \ - PATH=${WRKDIR}/edk2-${GH_TAGNAME}/BaseTools/BinWrappers/PosixLike:${PATH} \ - PYTHON_COMMAND=python3 \ - PYTHONHASHSEED=1 - -# We can't have two submodule with the same origin in GH_TUPLE -post-extract: - (cd ${WRKDIR}/edk2-${GH_TAGNAME}/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli && tar cf - * | tar xf - -C ../../../../BaseTools/Source/C/BrotliCompress/brotli) - -do-build: - # This is normaly done during source edksetup.sh - (cp ${WRKDIR}/edk2-${GH_TAGNAME}/BaseTools/Conf/build_rule.template ${WRKDIR}/edk2-${GH_TAGNAME}/Conf/build_rule.txt) - (cp ${WRKDIR}/edk2-${GH_TAGNAME}/BaseTools/Conf/tools_def.template ${WRKDIR}/edk2-${GH_TAGNAME}/Conf/tools_def.txt) - (cp ${WRKDIR}/edk2-${GH_TAGNAME}/BaseTools/Conf/target.template ${WRKDIR}/edk2-${GH_TAGNAME}/Conf/target.txt) - # Build the basetools - (cd ${WRKDIR} && ${SETENV} ${MAKE_ENV} ${MAKE_CMD} -C edk2-${GH_TAGNAME}/BaseTools -j ${MAKE_JOBS_NUMBER} ${_MAKE_JOBS}) - # Build EDK2 - (cd ${WRKDIR}/edk2-${GH_TAGNAME} && ${SETENV} ${MAKE_ENV} BaseTools/BinWrappers/PosixLike/build -a ${PLAT_ARCH} -p ${PLAT_FILE} -n ${MAKE_JOBS_NUMBER} -t GCC5 -b ${PLAT_TARGET} ${PLAT_ARGS}) - -do-install: - ${MKDIR} ${STAGEDIR}/${PREFIX}/share/uefi-firmware/ - ${INSTALL_DATA} ${WRKDIR}/Build/${PLAT_RESULT_CODE} ${STAGEDIR}/${PREFIX}/share/uefi-firmware/BHYVE_UEFI.fd - ${INSTALL_DATA} ${WRKDIR}/Build/${PLAT_RESULT_CODE} ${STAGEDIR}/${PREFIX}/share/uefi-firmware/BHYVE_UEFI_CODE.fd - ${INSTALL_DATA} ${WRKDIR}/Build/${PLAT_RESULT_VARS} ${STAGEDIR}/${PREFIX}/share/uefi-firmware/BHYVE_UEFI_VARS.fd - -.include Index: sysutils/uefi-edk2-bhyve/distinfo =================================================================== --- sysutils/uefi-edk2-bhyve/distinfo +++ /dev/null @@ -1,13 +0,0 @@ -TIMESTAMP = 1619914029 -SHA256 (tianocore-edk2-g20210226-edk2-stable202102_GH0.tar.gz) = 268591f0db8fd1f8c977509e8ac37bd6090c8373bf63a9657c88bb27bb43a279 -SIZE (tianocore-edk2-g20210226-edk2-stable202102_GH0.tar.gz) = 13604550 -SHA256 (ucb-bar-berkeley-softfloat-3-master_GH0.tar.gz) = a40ccfa8d5c04971e6af8014217c93b58fba4d08c337bc0436bb141e9e79426a -SIZE (ucb-bar-berkeley-softfloat-3-master_GH0.tar.gz) = 148747 -SHA256 (google-brotli-v1.0.7-17-g666c328_GH0.tar.gz) = caed254751585590b20b4a34d6600e9c9aae153ab1f9e1ae6b67f9bc3ee09b92 -SIZE (google-brotli-v1.0.7-17-g666c328_GH0.tar.gz) = 23854268 -SHA256 (openssl-openssl-OpenSSL_1_1_1g_GH0.tar.gz) = 281e4f13142b53657bd154481e18195b2d477572fdffa8ed1065f73ef5a19777 -SIZE (openssl-openssl-OpenSSL_1_1_1g_GH0.tar.gz) = 9975550 -SHA256 (kkos-oniguruma-v6.9.4_mark1_GH0.tar.gz) = 7f7576c926f7d4a071d594a01691c477bbb9391df250378bd5e1c003d42b4318 -SIZE (kkos-oniguruma-v6.9.4_mark1_GH0.tar.gz) = 592141 -SHA256 (akheron-jansson-v2.13.1_GH0.tar.gz) = f22901582138e3203959c9257cf83eba9929ac41d7be4a42557213a22ebcc7a0 -SIZE (akheron-jansson-v2.13.1_GH0.tar.gz) = 144979 Index: sysutils/uefi-edk2-bhyve/files/patch-fix-warnings =================================================================== --- sysutils/uefi-edk2-bhyve/files/patch-fix-warnings +++ /dev/null @@ -1,29 +0,0 @@ ---- BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c -+++ BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c -@@ -2033,8 +2033,10 @@ static BROTLI_NOINLINE BrotliDecoderErrorCode SafeProcessCommands( - } - - BrotliDecoderResult BrotliDecoderDecompress( -- size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size, -- uint8_t* decoded_buffer) { -+ size_t encoded_size, -+ const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)], -+ size_t* decoded_size, -+ uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]) { - BrotliDecoderState s; - BrotliDecoderResult result; - size_t total_out = 0; ---- BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c -+++ BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c -@@ -1470,8 +1470,9 @@ static size_t MakeUncompressedStream( - - BROTLI_BOOL BrotliEncoderCompress( - int quality, int lgwin, BrotliEncoderMode mode, size_t input_size, -- const uint8_t* input_buffer, size_t* encoded_size, -- uint8_t* encoded_buffer) { -+ const uint8_t input_buffer[BROTLI_ARRAY_PARAM(input_size)], -+ size_t* encoded_size, -+ uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(*encoded_size)]) { - BrotliEncoderState* s; - size_t out_size = *encoded_size; - const uint8_t* input_start = input_buffer; Index: sysutils/uefi-edk2-bhyve/files/patch-stringpop-overflows =================================================================== --- sysutils/uefi-edk2-bhyve/files/patch-stringpop-overflows +++ /dev/null @@ -1,22 +0,0 @@ ---- MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c -+++ MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c -@@ -285,7 +285,7 @@ UsbHcBulkTransfer ( - IN UINT8 DevSpeed, - IN UINTN MaxPacket, - IN UINT8 BufferNum, -- IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM], -+ IN OUT VOID **Data, - IN OUT UINTN *DataLength, - IN OUT UINT8 *DataToggle, - IN UINTN TimeOut, ---- MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.h -+++ MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.h -@@ -149,7 +149,7 @@ UsbHcBulkTransfer ( - IN UINT8 DevSpeed, - IN UINTN MaxPacket, - IN UINT8 BufferNum, -- IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM], -+ IN OUT VOID **Data, - IN OUT UINTN *DataLength, - IN OUT UINT8 *DataToggle, - IN UINTN TimeOut, Index: sysutils/uefi-edk2-bhyve/pkg-descr =================================================================== --- sysutils/uefi-edk2-bhyve/pkg-descr +++ /dev/null @@ -1,17 +0,0 @@ -UEFI EDK2 firmware for bhyve. - -From https://github.com/tianocore/tianocore/wiki/UEFI : -"The Unified Extensible Firmware Interface, or UEFI, specifies the -firmware layer between an operating system and platform hardware. UEFI -replaces the legacy Basic Input Output System (BIOS)." - -EDK2 is the project from TianoCore (https://tianocore.org) that provides -"a modern, feature-rich, cross-platform development environment for the -UEFI and UEFI Platform Initialization (PI) specifications." - -It's open source under the BSD-2-Clause-Patent license. - -This port provides a version of EDK2 for use with VMs running -operating systems which have UEFI support. - -WWW: https://github.com/tianocore/edk2/tree/master/OvmfPkg/Bhyve