add missing files

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2020-02-15 17:51:18 +03:00
parent d2ac4d7de9
commit 86cb372de2
18 changed files with 6506 additions and 2 deletions

690
Clover_cpp.dsc Normal file
View File

@ -0,0 +1,690 @@
## @file
# An EFI/Framework Emulation Platform with UEFI HII interface supported.
#
# Developer's UEFI Emulation. DUET provides an EFI/UEFI IA32/X64 environment on legacy BIOS,
# to help developing and debugging native EFI/UEFI drivers.
#
# Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
##
[Defines]
PLATFORM_NAME = Clover
PLATFORM_GUID = 199E24E0-0989-42aa-87F2-611A8C397E72
PLATFORM_VERSION = 0.92
DSC_SPECIFICATION = 0x00010006
OUTPUT_DIRECTORY = Build/Clover
SUPPORTED_ARCHITECTURES = X64|IA32
BUILD_TARGETS = RELEASE|DEBUG
SKUID_IDENTIFIER = DEFAULT
!ifndef SKIP_FLASH
FLASH_DEFINITION = Clover_cpp.fdf
!endif
!ifndef OPENSSL_VERSION
DEFINE OPENSSL_VERSION = 1.0.1e
!endif
################################################################################
#
# Library Class section - list of all Library Classes needed by this Platform.
#
################################################################################
[LibraryClasses]
#
# Entry point
#
PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
#
# Basic
#
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseRngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
#BaseMemoryLib|MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf
#BaseMemoryLib|MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
#PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
#PciExpressLib|MdePkg/Library/DxeRuntimePciExpressLib/DxeRuntimePciExpressLib.inf
CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
#PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
PeCoffLib|Library/VBoxPeCoffLib/VBoxPeCoffLib.inf
PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
#
# UEFI & PI
#
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
#UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
UefiHiiServicesLib|Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
#EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf
#EblNetworkLib|EmbeddedPkg/Library/EblNetworkLib/EblNetworkLib.inf
#EblCmdLib|EmbeddedPkg/Library/EblCmdLibNull/EblCmdLibNull.inf
FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
UefiCpuLib|CloverEFI/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
!ifdef ENABLE_SECURE_BOOT
OpensslLib|Library/OpensslLib/openssl-$(OPENSSL_VERSION)/OpensslLib.inf
IntrinsicLib|Library/IntrinsicLib/IntrinsicLib.inf
!else
OpensslLib|Library/OpensslLib/OpensslLibNull.inf
!endif
#
# Generic Modules
#
UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
#GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
GenericBdsLib|Library/GenericBdsLib/GenericBdsLib.inf
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
#PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
NetLib|NetworkPkg/Library/DxeNetLib/DxeNetLib.inf
#
# Platform
#
#PlatformBdsLib|DuetPkg/Library/DuetBdsLib/PlatformBds.inf
PlatformBdsLib|Library/OsxBdsPlatformLib/PlatformBds.inf
#TimerLib|DuetPkg/Library/DuetTimerLib/DuetTimerLib.inf
TimerLib|Library/DuetTimerLib/DuetTimerLib.inf
#
# Misc
#
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
# PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf
CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf
SmbusLib|MdePkg/Library/DxeSmbusLib/DxeSmbusLib.inf
S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf
#SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
MtrrLib|CloverEFI/UefiCpuPkg/Library/MtrrLib/MtrrLib.inf
IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf
LocalApicLib|CloverEFI/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
#LocalApicLib|CloverEFI/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
#
# To save size, use NULL library for DebugLib and ReportStatusCodeLib.
# If need status code output, do library instance overriden as below DxeMain.inf does
#
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
#
# Our libs
#
MemLogLib|Library/MemLogLibDefault/MemLogLibDefault.inf
VideoBiosPatchLib|Library/VideoBiosPatchLib/VideoBiosPatchLib.inf
WaveLib|Library/WaveLib/WaveLib.inf
HdaDevicesLib|Library/HdaDevicesLib/HdaDevicesLib.inf
OcGuardLib|Library/OcGuardLib/OcGuardLib.inf
MachoLib|Library/MachoLib/MachoLib.inf
DeviceTreeLib|Library/DeviceTreeLib/DeviceTreeLib.inf
ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
!ifndef NO_CLOVER_SHELL
#Shell
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
!endif
[LibraryClasses.common.DXE_CORE]
HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
[LibraryClasses.common.PEIM]
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf
[LibraryClasses.IA32.PEIM, LibraryClasses.X64.PEIM]
PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/PeiServicesTablePointerLibIdt.inf
[LibraryClasses.common.DXE_DRIVER]
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
[LibraryClasses.common.DXE_SMM_DRIVER]
SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
###################################################################################################
#
# Components Section - list of the modules and components that will be processed by compilation
# tools and the EDK II tools to generate PE32/PE32+/Coff image files.
#
# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
# into firmware volume images. This section is just a list of modules to compile from
# source into UEFI-compliant binaries.
# It is the FDF file that contains information on combining binary files into firmware
# volume images, whose concept is beyond UEFI and is described in PI specification.
# Binary modules do not need to be listed in this section, as they should be
# specified in the FDF file. For example: Shell binary (Shell_Full.efi), FAT binary (Fat.efi),
# Logo (Logo.bmp), and etc.
# There may also be modules listed in this section that are not required in the FDF file,
# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
# generated for it, but the binary will not be put into any firmware volume.
#
###################################################################################################
[Components]
#DuetPkg/BootSector/BootSector.inf
#DuetPkg/DxeIpl/DxeIpl.inf {
CloverEFI/OsxDxeIpl/DxeIpl.inf {
<LibraryClasses>
#
# If no following overriden for ReportStatusCodeLib library class,
# All other module can *not* output debug information even they are use not NULL library
# instance for DebugLib and ReportStatusCodeLib
#
#ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
}
#MdeModulePkg/Core/Dxe/DxeMain.inf {
CloverEFI/OsxDxeCore/DxeMain.inf {
#
# Enable debug output for DxeCore module, this is a sample for how to enable debug output
# for a module. If need turn on debug output for other module, please copy following overriden
# PCD and library instance to other module's override section.
#
<PcdsFixedAtBuild>
gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x0
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x82
#0x82
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000042
#0x80000042
<LibraryClasses>
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
# DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
# ReportStatusCodeLib|DuetPkg/Library/DxeCoreReportStatusCodeLibFromHob/DxeCoreReportStatusCodeLibFromHob.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
PeCoffLib|Library/VBoxPeCoffLib/VBoxPeCoffLib.inf
}
MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
#DuetPkg/FSVariable/FSVariable.inf
!ifndef REAL_NVRAM
!ifdef HAVE_LEGACY_EMURUNTIMEDXE
MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
!else
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
<PcdsFixedAtBuild>
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE
<LibraryClasses>
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
}
!endif
!else
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
<LibraryClasses>
NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
}
!endif
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf {
<LibraryClasses>
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
<PcdsPatchableInModule>
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|0
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|0
}
MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
#MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
CloverEFI/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
#MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
#DuetPkg/SmbiosGenDxe/SmbiosGen.inf
#OsxSmbiosDxe/SmbiosDxe.inf
CloverEFI/OsxSmbiosGenDxe/SmbiosGen.inf
#DuetPkg/EfiLdr/EfiLdr.inf {
CloverEFI/OsxEfiLdr/EfiLdr.inf {
<LibraryClasses>
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
#NULL|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
NULL|Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
}
#IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf {
CloverEFI/OsxBdsDxe/BdsDxe.inf {
<LibraryClasses>
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
}
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
CloverEFI/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
#UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
#UefiCpuPkg/CpuDxe/CpuDxe.inf
#UefiCpuPkg/CpuDxe/CpuDxe.inf
CloverEFI/CpuDxe/Cpu.inf
PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf {
<PcdsFixedAtBuild>
gPcAtChipsetPkgTokenSpaceGuid.Pcd8259LegacyModeMask|0xFFFC
}
#DuetPkg/AcpiResetDxe/Reset.inf
CloverEFI/AcpiReset/Reset.inf
#DuetPkg/LegacyMetronome/Metronome.inf
MdeModulePkg/Universal/Metronome/Metronome.inf
# EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/MpServicesOnFrameworkMpServicesThunk.inf
#Chipset
#PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
CloverEFI/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
PcAtChipsetPkg/8254TimerDxe/8254Timer.inf
#PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
#PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf
#DuetPkg/PciRootBridgeNoEnumerationDxe/PciRootBridgeNoEnumeration.inf
CloverEFI/PciRootBridgeDxe/PciRootBridge.inf
#DuetPkg/PciBusNoEnumerationDxe/PciBusNoEnumeration.inf
CloverEFI/OsxPciBusNoEnumerationDxe/PciBusNoEnumeration.inf
#MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
#PciBusDxe/PciBusDxe.inf
MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
#DataHub
#VBoxAppleSim/VBoxAppleSim.inf
#IntelFrameworkModulePkg/Universal/DataHubDxe/DataHubDxe.inf
Protocols/DataHubDxe/DataHubDxe.inf
#Protocols/DataHubStdErrDxe/DataHubStdErrDxe.inf
# foreign file system support
Protocols/DriverOverride/DriverOverride.inf
FileSystems/VBoxFsDxe/VBoxHfs.inf
FileSystems/VBoxFsDxe/VBoxIso9660.inf
#FileSystems/VBoxFsDxe/VBoxFsDxe.inf
FileSystems/VBoxFsDxe/VBoxExt2.inf
FileSystems/VBoxFsDxe/VBoxExt4.inf
FileSystems/VBoxFsDxe/VBoxReiserFS.inf
#EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf
#OsxMmcDxe/MmcDxe.inf
FileSystems/FatPkg/EnhancedFatDxe/Fat.inf
FileSystems/ApfsDriverLoader/ApfsDriverLoader.inf
# FS from grub
!ifndef NO_GRUB_DRIVERS
FileSystems/GrubFS/src/EXFAT.inf
FileSystems/GrubFS/src/HFSPLUS.inf
FileSystems/GrubFS/src/ISO9660.inf
FileSystems/GrubFS/src/NTFS.inf
FileSystems/GrubFS/src/UDF.inf
#FileSystems/GrubFS/src/ZFS.inf
#FileSystems/GrubFS/src/UFS.inf
#FileSystems/GrubFS/src/UFS2.inf
#FileSystems/GrubFS/src/XFS.inf
!endif
#Video
#IntelFrameworkModulePkg/Bus/Pci/VgaMiniPortDxe/VgaMiniPortDxe.inf
#VBoxVgaMiniPort/VgaMiniPortDxe.inf
#IntelFrameworkModulePkg/Universal/Console/VgaClassDxe/VgaClassDxe.inf
#VgaClassDxe/VgaClassDxe.inf
#IntelGmaDxe/Gop.inf
#DuetPkg/BiosVideoThunkDxe/BiosVideo.inf
CloverEFI/BiosVideo/BiosVideo.inf
#BiosVideoAuto/BiosVideo.inf
LegacyBios/VideoDxe/VideoDxe.inf
LegacyBios/VideoDxe/VideoDxe2.inf
# IDE/AHCI Support
!ifdef USE_BIOS_BLOCKIO
LegacyBios/BlockIoDxe/BlockIoDxe.inf
!else
#Trash/VBoxIdeControllerDxe/VBoxIdeControllerDxe.inf
#Trash/VBoxIdeBusDxe/VBoxIdeBusDxe.inf
#DuetPkg/SataControllerDxe/SataControllerDxe.inf
Drivers/SataControllerDxe/SataControllerDxe.inf
#MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
Drivers/AtaAtapi/AtaAtapiPassThru.inf
#MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
Drivers/AtaBus/AtaBusDxe.inf
#MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
Drivers/DVDBus/ScsiBusDxe.inf
#MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
Drivers/DVDDisk/ScsiDiskDxe.inf
#IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf
!endif
# Usb Support
MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf
Drivers/OhciDxe/OhciDxe.inf
MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf
# MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
Drivers/XhciDxe/XhciDxe.inf
# MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
Drivers/UsbBusDxe/UsbBusDxe.inf
# MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
Drivers/UsbKbDxe/UsbKbDxe.inf
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
#Drivers/UsbMouseDxe/UsbMouseDxe.inf
# ISA Support
PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.inf
Drivers/Isa/IsaBusDxe/IsaBusDxe.inf
#IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf
Drivers/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
#IntelFrameworkModulePkg/Bus/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
Drivers/Isa/Ps2MouseAbsolutePointerDxe/Ps2MouseAbsolutePointerDxe.inf
#IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2MouseDxe.inf
Drivers/Isa/Ps2MouseDxe/Ps2MouseDxe.inf
# ACPI Support
#MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
CloverEFI/OsxAcpiTableDxe/AcpiTableDxe.inf
#MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
#CloverEFI/OsxAcpiPlatformDxe/AcpiPlatformDxe.inf
MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf {
<LibraryClasses>
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
}
#MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
Drivers/PartitionDxe/PartitionDxe.inf
#FD
#IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
#SaveResume/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
#MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
#MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.inf
#MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
#SaveResume/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
#CloverEFI/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
# Bios Thunk
#IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf
#IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
#IntelFrameworkModulePkg/Csm/BiosThunk/BlockIoDxe/BlockIoDxe.inf
#IntelFrameworkModulePkg/Csm/BiosThunk/KeyboardDxe/KeyboardDxe.inf
CloverEFI/BiosKeyboard/KeyboardDxe.inf
#IntelFrameworkModulePkg/Universal/LegacyRegionDxe/LegacyRegionDxe.inf
#MdeModulePkg/Universal/LegacyRegion2Dxe/LegacyRegion2Dxe.inf
LegacyBios/Region2Dxe/LegacyRegion2Dxe.inf
# Misc
FSInject/FSInject.inf
Protocols/MsgLog/MsgLog.inf
Protocols/SMCHelper/SMCHelper.inf
Protocols/FirmwareVolume/FirmwareVolume.inf
Protocols/AppleImageCodec/AppleImageCodec.inf
Protocols/AppleUITheme/AppleUITheme.inf
Protocols/HashServiceFix/HashServiceFix.inf
Protocols/AppleKeyAggregator/AppleKeyAggregator.inf
Protocols/AppleKeyFeeder/AppleKeyFeeder.inf
Protocols/AptioInputFix/AptioInputFix.inf
!ifdef DEBUG_ON_SERIAL_PORT
Protocols/DumpUefiCalls/DumpUefiCalls.inf {
<PcdsFixedAtBuild>
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x07
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0xFFFFFFFF
<LibraryClasses>
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
}
!else
Protocols/DumpUefiCalls/DumpUefiCalls.inf {
<LibraryClasses>
PeCoffLib|Library/VBoxPeCoffLib/VBoxPeCoffLib.inf
}
!endif
# Drivers for Aptio loading - should go to Clover's /EFI/drivers/UEFI dir
Protocols/OsxFatBinaryDrv/OsxFatBinaryDrv.inf
# Drivers for Phoenix UEFI loading - should go to Clover's /EFI/drivers64UEFI dir
Protocols/EmuVariableUefi/EmuVariableRuntimeDxe.inf {
<PcdsFixedAtBuild>
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x3000
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000
gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x40000
gEfiMdeModulePkgTokenSpaceGuid.PcdVariableCollectStatistics|FALSE
gEfiMdeModulePkgTokenSpaceGuid.PcdHwErrStorageSize|0x0000
}
# Driver Audio
Drivers/AudioDxe/AudioDxe.inf
#
# Sample Application
#
#MdeModulePkg/Application/HelloWorld/HelloWorld.inf
#MdeModulePkg/Application/VariableInfo/VariableInfo.inf
#Sample/Application/Sample.inf
#gptsync/gptsync.inf
bdmesg_efi/bdmesg.inf
!ifndef NO_CLOVER_SHELL
ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.inf
ShellPkg/Application/Shell/Shell.inf {
<PcdsFixedAtBuild>
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF
gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|16000
!ifdef $(NO_SHELL_PROFILES)
gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask|0x00
!endif #$(NO_SHELL_PROFILES)
<LibraryClasses>
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf
NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf
NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf
!ifndef $(NO_SHELL_PROFILES)
NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
NULL|ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.inf
!ifdef $(INCLUDE_DP)
NULL|ShellPkg/Library/UefiDpLib/UefiDpLib.inf
!endif #$(INCLUDE_DP)
!ifdef $(INCLUDE_TFTP_COMMAND)
NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLib.inf
!endif #$(INCLUDE_TFTP_COMMAND)
!endif #$(NO_SHELL_PROFILES)
}
!endif
!ifdef DEBUG_ON_SERIAL_PORT
rEFIt_UEFI/refit_cpp.inf {
#
# Enable debug output.
#
<PcdsFixedAtBuild>
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x07
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0xFFFFFFFF
<LibraryClasses>
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
}
!else
rEFIt_UEFI/refit_cpp.inf {
<LibraryClasses>
BaseMemoryLib|MdePkg/Library/UefiMemoryLib/UefiMemoryLib.inf
}
!endif
[Components.X64]
# MemoryFix/OsxAptioFixDrv/OsxAptioFix2Drv.inf
MemoryFix/OsxAptioFixDrv/OsxAptioFix3Drv.inf
MemoryFix/OsxLowMemFixDrv/OsxLowMemFixDrv.inf
MemoryFix/AptioMemoryFix/AptioMemoryFix.inf
!ifdef DEBUG_ON_SERIAL_PORT
MemoryFix/OsxAptioFixDrv/OsxAptioFixDrv.inf {
#
# Enable debug output.
#
<PcdsFixedAtBuild>
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x07
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0xFFFFFFFF
<LibraryClasses>
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
}
!else
MemoryFix/OsxAptioFixDrv/OsxAptioFixDrv.inf
!endif
###################################################################################################
#
# BuildOptions Section - Define the module specific tool chain flags that should be used as
# the default flags for a module. These flags are appended to any
# standard flags that are defined by the build process. They can be
# applied for any modules or only those modules with the specific
# module style (EDK or EDKII) specified in [Components] section.
#
###################################################################################################
[BuildOptions]
!ifdef ENABLE_VBIOS_PATCH_CLOVEREFI
DEFINE VBIOS_PATCH_CLOVEREFI_FLAG = -DCLOVER_VBIOS_PATCH_IN_CLOVEREFI
!endif
!ifdef ONLY_SATA_0
DEFINE ONLY_SATA_0_FLAG = -DONLY_SATA_0
!endif
!ifdef USE_BIOS_BLOCKIO
DEFINE BLOCKIO_FLAG = -DUSE_BIOS_BLOCKIO
!ifdef DISABLE_USB_CONTROLLERS_WHEN_BLOCKIO
DEFINE DISABLE_USB_CONTROLLERS = 1
!endif
!endif
!ifdef DISABLE_USB_CONTROLLERS
DEFINE NOUSB_FLAG = -DDISABLE_USB_SUPPORT
!endif
!ifdef DISABLE_USB_SUPPORT
DEFINE NOUSB_FLAG = -DDISABLE_USB_SUPPORT
!endif
!ifdef DISABLE_UDMA_SUPPORT
DEFINE NOUDMA_FLAG = -DDISABLE_UDMA_SUPPORT
!endif
# Slice: I propose this flag always true
#!ifdef AMD_SUPPORT
DEFINE AMD_FLAG = -DAMD_SUPPORT
#!endif
!ifdef ENABLE_SECURE_BOOT
DEFINE SECURE_BOOT_FLAG = -DENABLE_SECURE_BOOT
!endif
#!ifdef ANDX86
DEFINE ANDX86_FLAG = -DANDX86
#!endif
#!ifdef LODEPNG
DEFINE LODEPNG_FLAG = -DLODEPNG
#!endif
!ifdef ENABLE_PS2MOUSE_LEGACYBOOT
DEFINE PS2MOUSE_LEGACYBOOT_FLAG = -DENABLE_PS2MOUSE_LEGACYBOOT
!endif
!ifdef DEBUG_ON_SERIAL_PORT
DEFINE DEBUG_ON_SERIAL_PORT_FLAG = -DDEBUG_ON_SERIAL_PORT
!endif
!ifdef DISABLE_LTO
DEFINE DISABLE_LTO_FLAG = -fno-lto -UUSING_LTO
!endif
!ifdef EXIT_USBKB
DEFINE EXIT_USBKB_FLAG = -DEXIT_USBKB
!endif
DEFINE BUILD_OPTIONS=-DMDEPKG_NDEBUG -DCLOVER_BUILD $(VBIOS_PATCH_CLOVEREFI_FLAG) $(ONLY_SATA_0_FLAG) $(BLOCKIO_FLAG) $(NOUSB_FLAG) $(NOUDMA_FLAG) $(AMD_FLAG) $(SECURE_BOOT_FLAG) $(ANDX86_FLAG) $(LODEPNG_FLAG) $(PS2MOUSE_LEGACYBOOT_FLAG) $(DEBUG_ON_SERIAL_PORT_FLAG) $(EXIT_USBKB_FLAG)
#MSFT:*_*_*_CC_FLAGS = /FAcs /FR$(@R).SBR /wd4701 /wd4703 $(BUILD_OPTIONS)
MSFT:*_*_*_CC_FLAGS = /FAcs /FR$(@R).SBR $(BUILD_OPTIONS) -Dinline=__inline
XCODE:*_*_*_CC_FLAGS = -fno-unwind-tables -Wno-msvc-include -Os $(BUILD_OPTIONS) $(DISABLE_LTO_FLAG)
GCC:*_*_*_CC_FLAGS = $(BUILD_OPTIONS) $(DISABLE_LTO_FLAG)
#-Wunused-but-set-variable
# -Os -fno-omit-frame-pointer -maccumulate-outgoing-args

352
Clover_cpp.fdf Normal file
View File

@ -0,0 +1,352 @@
## @file
# This is DUET FDF file with UEFI HII features enabled
#
# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
# Clover EFI FDF file to be differ from DUET
################################################################################
#
# FV Section
#
# [FV] section is used to define what components or modules are placed within a flash
# device file. This section also defines order the components and modules are positioned
# within the image. The [FV] section consists of define statements, set statements and
# module statements.
#
################################################################################
[Defines]
!if ($(ARCH) == X64)
[FV.DuetEfiMainFvX64]
!elseif ($(ARCH) == IA32)
[FV.DuetEfiMainFvIA32]
!else
[FV.DuetEfiMainFvEBC]
!endif
BlockSize = 0x10000
NumBlocks = 0x2a
FvAlignment = 16 #FV alignment and FV attributes setting.
ERASE_POLARITY = 1
MEMORY_MAPPED = TRUE
STICKY_WRITE = TRUE
LOCK_CAP = TRUE
LOCK_STATUS = TRUE
WRITE_DISABLED_CAP = TRUE
WRITE_ENABLED_CAP = TRUE
WRITE_STATUS = TRUE
WRITE_LOCK_CAP = TRUE
WRITE_LOCK_STATUS = TRUE
READ_DISABLED_CAP = TRUE
READ_ENABLED_CAP = TRUE
READ_STATUS = TRUE
READ_LOCK_CAP = TRUE
READ_LOCK_STATUS = TRUE
#APRIORI PEI {
# INF MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf
# INF MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf
# INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
# }
APRIORI DXE {
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
INF PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
INF Protocols/MsgLog/MsgLog.inf
}
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
#INF DuetPkg/FSVariable/FSVariable.inf
!ifdef REAL_NVRAM
INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
!else
!ifdef HAVE_LEGACY_EMURUNTIMEDXE
INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
!else
INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
!endif
!endif
INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
INF MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
#INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
INF CloverEFI/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
#INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
#INF DuetPkg/SmbiosGenDxe/SmbiosGen.inf
#INF OsxSmbiosDxe/SmbiosDxe.inf
INF CloverEFI/OsxSmbiosGenDxe/SmbiosGen.inf
#INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
INF CloverEFI/OsxBdsDxe/BdsDxe.inf
INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
INF CloverEFI/UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
#INF UefiCpuPkg/CpuDxe/CpuDxe.inf
#INF IntelFrameworkModulePkg/Universal/CpuIoDxe/CpuIoDxe.inf
INF CloverEFI/CpuDxe/Cpu.inf
!ifndef CLANG
#INF UefiCpuPkg/CpuDxe/CpuDxe.inf
!else
#INF RuleOverride=BINARY CpuDxeBin/CpuDxeBin.inf
!endif
# DataHub
#INF VBoxAppleSim/VBoxAppleSim.inf
INF Protocols/DataHubDxe/DataHubDxe.inf
#INF Protocols/DataHubStdErrDxe/DataHubStdErrDxe.inf
#INF EdkCompatibilityPkg/Compatibility/PiSmbiosRecordOnDataHubSmbiosRecordThunk/PiSmbiosRecordOnDataHubSmbiosRecordThunk.inf
# foreign file system support
INF Protocols/DriverOverride/DriverOverride.inf
!ifndef NO_GRUB_DRIVERS_EMBEDDED
!ifndef NO_GRUB_DRIVERS
INF FileSystems/GrubFS/src/EXFAT.inf
#INF FileSystems/GrubFS/src/NTFS.inf
!endif
!endif
#INF FileSystems/VBoxFsDxe/VBoxFsDxe.inf
#INF FileSystems/VBoxFsDxe/VBoxIso9660.inf
#INF FileSystems/VBoxFsDxe/VBoxExt2.inf
#INF FileSystems/VBoxFsDxe/VBoxExt4.inf
#INF FileSystems/VBoxFsDxe/VBoxReiserFS.inf
!if $(USE_APPLE_HFSPLUS_DRIVER) AND ( $(ARCH) == X64 )
INF RuleOverride=BINARY FileSystems/HFSPlus/HFSPlus.inf
!else
INF FileSystems/VBoxFsDxe/VBoxHfs.inf
!endif
INF PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
#INF DuetPkg/AcpiResetDxe/Reset.inf
INF CloverEFI/AcpiReset/Reset.inf
#INF DuetPkg/LegacyMetronome/Metronome.inf
INF MdeModulePkg/Universal/Metronome/Metronome.inf
INF PcAtChipsetPkg/8254TimerDxe/8254Timer.inf
#INF PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
#INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
INF CloverEFI/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
#INF PcAtChipsetPkg/PciHostBridgeDxe/PciHostBridgeDxe.inf
#INF DuetPkg/PciRootBridgeNoEnumerationDxe/PciRootBridgeNoEnumeration.inf
INF CloverEFI/PciRootBridgeDxe/PciRootBridge.inf
#INF DuetPkg/PciBusNoEnumerationDxe/PciBusNoEnumeration.inf
INF CloverEFI/OsxPciBusNoEnumerationDxe/PciBusNoEnumeration.inf
#INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
#INF CloverEFI/PciBusDxe/PciBusDxe.inf
# Video
#INF IntelFrameworkModulePkg/Bus/Pci/VgaMiniPortDxe/VgaMiniPortDxe.inf
#INF VBoxVgaMiniPort/VgaMiniPortDxe.inf
#INF IntelFrameworkModulePkg/Universal/Console/VgaClassDxe/VgaClassDxe.inf
#INF VgaClassDxe/VgaClassDxe.inf
#INF DuetPkg/BiosVideoThunkDxe/BiosVideo.inf
INF CloverEFI/BiosVideo/BiosVideo.inf
#INF BiosVideoAuto/BiosVideo.inf
#INF IntelGmaDxe/Gop.inf
#INF LegacyBios/VideoDxe/VideoDxe.inf
# BIOS CSM
#INF IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
#INF IntelFrameworkModulePkg/Csm/BiosThunk/BlockIoDxe/BlockIoDxe.inf
#INF IntelFrameworkModulePkg/Csm/BiosThunk/KeyboardDxe/KeyboardDxe.inf
INF CloverEFI/BiosKeyboard/KeyboardDxe.inf
#INF IntelFrameworkModulePkg/Universal/LegacyRegionDxe/LegacyRegionDxe.inf
#INF MdeModulePkg/Universal/LegacyRegion2Dxe/LegacyRegion2Dxe.inf
#INF LegacyBios/RegionDxe/LegacyRegion2Dxe.inf
INF LegacyBios/Region2Dxe/LegacyRegion2Dxe.inf
#INF IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf
# IDE/AHCI Support
!ifdef USE_BIOS_BLOCKIO
INF LegacyBios/BlockIoDxe/BlockIoDxe.inf
!ifdef DISABLE_USB_CONTROLLERS_WHEN_BLOCKIO
DEFINE DISABLE_USB_CONTROLLERS = 1
!endif
!else
!ifdef USE_ION
INF RuleOverride=BINARY ION/ION.inf
!else
#INF VBoxIdeControllerDxe/VBoxIdeControllerDxe.inf
#INF VBoxIdeBusDxe/VBoxIdeBusDxe.inf
#INF DuetPkg/SataControllerDxe/SataControllerDxe.inf
INF Drivers/SataControllerDxe/SataControllerDxe.inf
#INF MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
INF Drivers/AtaAtapi/AtaAtapiPassThru.inf
#INF MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
INF Drivers/AtaBus/AtaBusDxe.inf
#INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
INF Drivers/DVDBus/ScsiBusDxe.inf
#INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
INF Drivers/DVDDisk/ScsiDiskDxe.inf
#INF IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf
!endif
!endif
# Usb Support
!ifndef DISABLE_USB_SUPPORT
!ifndef DISABLE_USB_CONTROLLERS
INF MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf
!ifndef DISABLE_USB_MASS_STORAGE
INF MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf
!endif
!endif
!ifdef ENABLE_USB_OHCI
INF Drivers/OhciDxe/OhciDxe.inf
!endif
!ifdef ENABLE_USB_XHCI
#INF MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
INF Drivers/XhciDxe/XhciDxe.inf
!endif
#INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
INF Drivers/UsbBusDxe/UsbBusDxe.inf
#INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
INF Drivers/UsbKbDxe/UsbKbDxe.inf
INF MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
!ifndef DISABLE_USB_MASS_STORAGE
INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
!endif
!endif
# ISA Support
INF PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.inf
INF Drivers/Isa/IsaBusDxe/IsaBusDxe.inf
#INF Drivers/Isa/IsaSerialDxe/IsaSerialDxe.inf
#INF Drivers/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
#INF Drivers/Isa/IsaFloppyDxe/IsaFloppyDxe.inf
INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
#INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
INF Drivers/PartitionDxe/PartitionDxe.inf
# ACPI Support
#INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
INF CloverEFI/OsxAcpiTableDxe/AcpiTableDxe.inf
#INF MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
#INF CloverEFI/OsxAcpiPlatformDxe/AcpiPlatformDxe.inf
# FD
#INF IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
#INF SaveResume/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
#INF MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
#INF MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.inf
#INF MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
#INF SaveResume/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
#INF UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf
# Misc
INF Protocols/MsgLog/MsgLog.inf
# Binary INF file to support toggle among different CPU architectures.
#INF RuleOverride=BINARY FatBinPkg/EnhancedFatDxe/Fat.inf
INF FileSystems/FatPkg/EnhancedFatDxe/Fat.inf
#FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
# SECTION RAW = Logo/Logo.bmp
# }
[Rule.Common.SEC]
FILE SEC = $(NAMED_GUID) {
PE32 PE32 Align=32 $(INF_OUTPUT)/$(MODULE_NAME).efi
UI STRING ="$(MODULE_NAME)" Optional
VERSION STRING ="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
}
[Rule.Common.PEI_CORE]
FILE PEI_CORE = $(NAMED_GUID) {
PE32 PE32 Align=32 $(INF_OUTPUT)/$(MODULE_NAME).efi
UI STRING ="$(MODULE_NAME)" Optional
VERSION STRING ="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
}
[Rule.Common.PEIM]
FILE PEIM = $(NAMED_GUID) {
PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
PE32 PE32 Align=32 $(INF_OUTPUT)/$(MODULE_NAME).efi
UI STRING="$(MODULE_NAME)" Optional
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
}
[Rule.Common.DXE_CORE]
FILE DXE_CORE = $(NAMED_GUID) {
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
UI STRING ="$(MODULE_NAME)" Optional
VERSION STRING ="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
}
[Rule.Common.UEFI_DRIVER]
FILE DRIVER = $(NAMED_GUID) {
DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
UI STRING ="$(MODULE_NAME)" Optional
VERSION STRING ="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
}
[Rule.Common.DXE_DRIVER]
FILE DRIVER = $(NAMED_GUID) {
DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
UI STRING ="$(MODULE_NAME)" Optional
VERSION STRING ="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
}
[Rule.Common.DXE_RUNTIME_DRIVER]
FILE DRIVER = $(NAMED_GUID) {
DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
UI STRING ="$(MODULE_NAME)" Optional
VERSION STRING ="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
}
[Rule.Common.UEFI_APPLICATION]
FILE APPLICATION = $(NAMED_GUID) {
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
UI STRING ="$(MODULE_NAME)" Optional
VERSION STRING ="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
}
[Rule.Common.UEFI_APPLICATION.BINARY]
FILE APPLICATION = $(NAMED_GUID) {
DXE_DEPEX DXE_DEPEX Optional |.depex
PE32 PE32 |.efi
UI STRING ="$(MODULE_NAME)" Optional
VERSION STRING ="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
}
[Rule.Common.UEFI_DRIVER.BINARY]
FILE DRIVER = $(NAMED_GUID) {
DXE_DEPEX DXE_DEPEX Optional |.depex
PE32 PE32 |.efi
UI STRING ="$(MODULE_NAME)" Optional
VERSION STRING ="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
}

View File

@ -124,11 +124,11 @@
<Command.GCC, Command.RVCT>
# For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
@"$(CC)" $(CXX_FLAGS) -c -o ${dst} $(INC) ${src}
@"echo" [CC] ${s_base}
@"echo" [CPP] ${s_base}
<Command.XCODE>
@"$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src}
@"echo" [CC] ${s_base}
@"echo" [CPP] ${s_base}
[C-Code-File]
<InputFile>

906
gbuild.sh Executable file
View File

@ -0,0 +1,906 @@
#!/bin/bash
# ebuild.sh ->ebuild.sh //renamed to be unique file begining from E
# Script for building CloverEFI source under OS X or Linux
# Supported chainloads(compilers) are XCODE*, GCC*, UNIXGCC and CLANG
#
#
# Created by Jadran Puharic on 1/6/12.
# Modified by JrCs on 3/9/13.
# Zenith432, STLVNUB, cecekpawon 2016
# Micky1979 2016
# Go to the Clover root directory
cd "$(dirname $0)"
# Global variables
declare -r SELF="${0##*/}"
declare -r CLOVERROOT="$PWD"
declare -r SYSNAME="$(uname)"
declare -r DRIVERS_LEGACY="BIOS" # same in buildpkg.sh/makeiso
declare -r DRIVERS_UEFI="UEFI" # same in buildpkg.sh/makeiso
declare -r DRIVERS_OFF="off" # same in buildpkg.sh/makeiso
if [[ "$SYSNAME" == Linux ]]; then
declare -r NUMBER_OF_CPUS=$(nproc)
else
declare -r NUMBER_OF_CPUS=$(sysctl -n hw.logicalcpu)
fi
declare -a EDK2_BUILD_OPTIONS=
print_option_help_wc=
have_fmt=
PLATFORMFILE=
MODULEFILE=
TARGETRULE=
SCRIPT_VERS="2019-09-06"
# Macro
M_NOGRUB=0
M_APPLEHFS=0
# Default values
export TOOLCHAIN=GCC53
export TARGETARCH=X64
export BUILDTARGET=RELEASE
export BUILDTHREADS=$(( NUMBER_OF_CPUS + 1 ))
export WORKSPACE=${WORKSPACE:-}
export CONF_PATH=${CONF_PATH:-}
#export NASM_PREFIX=
export EDK_TOOLS_PATH="${PWD}"/BaseTools
# if building through Xcode, then TOOLCHAIN_DIR is not defined
# checking if it is where CloverGrowerPro put it
if [[ "$SYSNAME" == Linux ]]; then
export TOOLCHAIN=GCC53
TOOLCHAIN_DIR=${TOOLCHAIN_DIR:-/usr}
else
TOOLCHAIN_DIR=${TOOLCHAIN_DIR:-"$CLOVERROOT"/../../toolchain}
fi
if [[ ! -d $TOOLCHAIN_DIR ]]; then
TOOLCHAIN_DIR="${PWD}"/../opt/local
fi
export TOOLCHAIN_DIR
echo "TOOLCHAIN_DIR: $TOOLCHAIN_DIR"
VBIOSPATCHCLOVEREFI=0
ONLYSATA0PATCH=0
USE_BIOS_BLOCKIO=0
USE_LOW_EBDA=1
CLANG=0
GENPAGE=0
FORCEREBUILD=0
NOBOOTFILES=0
declare -r GIT=`which git`
#declare -r GITDIR=`git status 2> /dev/null` # unsafe as git repository may exist in parent directory
#declare -r VERSTXT="vers.txt"
if [[ -x "/usr/bin/sw_vers" ]]; then
declare -r OSVER="$(sw_vers -productVersion | sed -e 's/\.0$//g')"
elif [[ -x "/usr/bin/lsb_release" ]]; then
# Linux print the name+version in in two lines, sed serves to made it in one line!
# ..otherwise Clover fail because Version.h will have a line with no null terminated char.
declare -r OSVER="$(lsb_release -sir | sed -e ':a;N;$!ba;s/\n/ /g')"
fi
# Bash options
set -e # errexit
set -u # Blow on unbound variable
## FUNCTIONS ##
print_option_help () {
if [[ x$print_option_help_wc = x ]]; then
if wc -L </dev/null > /dev/null 2>&1; then
print_option_help_wc=-L
elif wc -m </dev/null > /dev/null 2>&1; then
print_option_help_wc=-m
else
print_option_help_wc=-b
fi
fi
if [[ x$have_fmt = x ]]; then
if fmt -w 40 </dev/null > /dev/null 2>&1; then
have_fmt=y;
else
have_fmt=n;
fi
fi
local print_option_help_lead=" $1"
local print_option_help_lspace="$(echo "$print_option_help_lead" | wc $print_option_help_wc)"
local print_option_help_fill="$((26 - print_option_help_lspace))"
printf "%s" "$print_option_help_lead"
local print_option_help_nl=
if [[ $print_option_help_fill -le 0 ]]; then
print_option_help_nl=y
echo
else
print_option_help_i=0;
while [[ $print_option_help_i -lt $print_option_help_fill ]]; do
printf " "
print_option_help_i=$((print_option_help_i+1))
done
print_option_help_nl=n
fi
local print_option_help_split=
if [[ x$have_fmt = xy ]]; then
print_option_help_split="$(echo "$2" | fmt -w 50)"
else
print_option_help_split="$2"
fi
if [[ x$print_option_help_nl = xy ]]; then
echo "$print_option_help_split" | awk '{ print " " $0; }'
else
echo "$print_option_help_split" | awk 'BEGIN { n = 0 }
{ if (n == 1) print " " $0; else print $0; n = 1 ; }'
fi
}
# Function to manage PATH
pathmunge () {
if [[ ! $PATH =~ (^|:)$1(:|$) ]]; then
if [[ "${2:-}" = "after" ]]; then
export PATH=$PATH:$1
else
export PATH=$1:$PATH
fi
fi
}
packagesPathmunge () {
if [[ -z "${PACKAGES_PATH:-}" ]]; then
export PACKAGES_PATH="$WORKSPACE" # must be always the first
fi
if [[ ! $PACKAGES_PATH =~ (^|:)$1(:|$) ]]; then
if [[ "${2:-}" = "after" ]]; then
export PACKAGES_PATH=$PACKAGES_PATH:$1
else
export PACKAGES_PATH=$1:$PACKAGES_PATH
fi
fi
}
# Add edk2 build option
addEdk2BuildOption() {
EDK2_BUILD_OPTIONS=("${EDK2_BUILD_OPTIONS[@]}" $@)
}
# Add edk2 build macro
addEdk2BuildMacro() {
local macro="$1"
[[ "$macro" == "NO_GRUB_DRIVERS" ]] && M_NOGRUB=1
addEdk2BuildOption "-D" "$macro"
}
# Check NASM
IsNumericOnly() {
if [[ "${1}" =~ ^-?[0-9]+$ ]]; then
return 0 # no, contains other or is empty
else
return 1 # yes is an integer (no matter for bash if there are zeroes at the beginning comparing it as integer)
fi
}
isNASMGood() {
# nasm should be greater or equal to 2.12.02 to be good building Clover.
# There was a bad macho relocation in outmacho.c, fixed by Zenith432
# and accepted by nasm devel during 2.12.rcxx (release candidate)
result=1
local nasmver=$( "${1}" -v | grep 'NASM version' | awk '{print $3}' )
case "$nasmver" in
2.12.0[2-9]* | 2.12.[1-9]* | 2.1[3-9]* | 2.[2-9]* | [3-9]* | [1-9][1-9]*)
result=0;;
*)
printf "\n\e[1;33mUnknown or unsupported NASM version found at:\n${1}\n\n\e[0m";;
esac
return $result
}
# Check Xcode toolchain
checkXcode () {
XCODE_BUILD="/usr/bin/xcodebuild"
local LOCALBIN="/usr/local/bin"
if [[ ! -x "${XCODE_BUILD}" ]]; then
echo "ERROR: Install Xcode Tools from Apple before using this script." >&2; exit 1
fi
if [[ -x "/opt/local/bin/mtoc.NEW" ]]; then
export MTOC_PREFIX="/opt/local/bin/"
elif [[ -x "${LOCALBIN}/mtoc.NEW" ]]; then
export MTOC_PREFIX="${LOCALBIN}/"
elif [[ -x "${TOOLCHAIN_DIR}/bin/mtoc.NEW" ]]; then
export MTOC_PREFIX="${TOOLCHAIN_DIR}/bin/"
else
export MTOC_PREFIX="${TOOLCHAIN_DIR}/bin/"
./buildmtoc.sh
fi
echo "MTOC_PREFIX: $MTOC_PREFIX"
}
# Print the usage.
usage() {
echo "Script for building CloverEFI sources on Darwin OS X"
echo "Version from ${SCRIPT_VERS}"
printf "Usage: %s [OPTIONS] [all|fds|genc|genmake|clean|cleanpkg|cleanall|cleanlib|modules|libraries]\n" "$SELF"
echo
echo "Configuration:"
print_option_help "-n THREADNUMBER" "Build the platform using multi-threaded compiler [default is number of CPUs + 1]"
print_option_help "-h, --help" "print this message and exit"
print_option_help "-v, --version" "print the version information and exit"
echo
echo "Toolchain:"
print_option_help "-clang" "use XCode Clang toolchain"
print_option_help "-llvm" "use LLVM toolchain"
print_option_help "-gcc49" "use GCC 4.9 toolchain"
print_option_help "-gcc53" "use GCC 5.3 toolchain"
print_option_help "-unixgcc" "use UNIXGCC toolchain"
print_option_help "-xcode" "use XCode 3.2 toolchain"
print_option_help "-xcode5" "use XCode 5-7 toolchain "
print_option_help "-xcode8" "use XCode 8 toolchain [Default]"
print_option_help "-t TOOLCHAIN, --tagname=TOOLCHAIN" "force to use a specific toolchain"
echo
echo "Target:"
print_option_help "-x64" "build Clover in 64-bit [boot6] [Default]"
print_option_help "-mc, --x64-mcp" "build Clover in 64-bit [boot7] using BiosBlockIO (compatible with MCP chipset)"
print_option_help "-p PLATFORMFILE, --platform=PLATFORMFILE" "Build the platform specified by the DSC filename argument"
print_option_help "-m MODULEFILE, --module=MODULEFILE" "Build only the module specified by the INF filename argument"
print_option_help "-b BUILDTARGET, --buildtarget=BUILDTARGET" "using the BUILDTARGET to build the platform"
print_option_help "-clean" "same as clean"
print_option_help "-cleanall" "same as cleanall"
echo
echo "Options:"
print_option_help "-D MACRO, --define=MACRO" "Macro: \"Name[=Value]\"."
print_option_help "--vbios-patch-cloverefi" "activate vbios patch in CloverEFI"
print_option_help "--only-sata0" "activate only SATA0 patch"
print_option_help "--std-ebda" "ebda offset dont shift to 0x88000"
print_option_help "--genpage" "dynamically generate page table under ebda"
print_option_help "--no-usb" "disable USB support"
print_option_help "--no-lto" "disable Link Time Optimisation"
print_option_help "--ext-pre" "deprecated option"
print_option_help "--ext-co" "deprecated option"
print_option_help "--ext-build" "deprecated option"
print_option_help "--edk2shell <MinimumShell|FullShell>" "copy edk2 Shell to EFI tools dir"
echo
echo "build options:"
print_option_help "-fr, --force-rebuild" "force rebuild all targets"
print_option_help "-nb, --no-bootfiles" "don't generate boot files"
echo
echo "Report bugs to https://sourceforge.net/p/cloverefiboot/discussion/1726372/"
}
# Manage option argument
argument () {
local opt=$1
shift
if [[ $# -eq 0 ]]; then
printf "%s: option \`%s' requires an argument\n" "$0" "$opt"
exit 1
fi
echo $1
}
# Check the command line arguments
checkCmdlineArguments() {
while [[ $# -gt 0 ]]; do
local option=$1
shift
case "$option" in
-clang | --clang) TOOLCHAIN=XCLANG ; CLANG=1 ;;
-llvm | --llvm) TOOLCHAIN=LLVM ; CLANG=1 ;;
-xcode5 | --xcode5 ) TOOLCHAIN=XCODE5 ; CLANG=1 ;;
-xcode8 | --xcode8 ) TOOLCHAIN=XCODE8 ; CLANG=1 ;;
-GCC49 | --GCC49) TOOLCHAIN=GCC49 ;;
-gcc49 | --gcc49) TOOLCHAIN=GCC49 ;;
-GCC53 | --GCC53) TOOLCHAIN=GCC53 ;;
-gcc53 | --gcc53) TOOLCHAIN=GCC53 ;;
-unixgcc | --gcc) TOOLCHAIN=UNIXGCC ;;
-xcode | --xcode ) TOOLCHAIN=XCODE32 ;;
-x64 | --x64)
printf "\`%s' is deprecated because Clover is 64 bit only. This message will be removed soon\n" "$option" 1>&2
sleep 4
;;
-mc | --x64-mcp) USE_BIOS_BLOCKIO=1 ;;
-clean) TARGETRULE=clean ;;
-cleanall) TARGETRULE=cleanall ;;
-fr | --force-rebuild) FORCEREBUILD=1 ;;
-nb | --no-bootfiles) NOBOOTFILES=1 ;;
# -d | -debug | --debug) BUILDTARGET=DEBUG ;;
# -r | -release | --release) BUILDTARGET=RELEASE ;;
-a) TARGETARCH=$(argument $option "$@")
printf "\`%s' is deprecated because Clover is 64 bit only. This message will be removed soon\n" "$option" 1>&2
sleep 4
;;
--arch=*)
printf "\`%s' is deprecated because Clover is 64 bit only. This message will be removed soon\n" "$option" 1>&2
sleep 4
;;
-p) PLATFORMFILE=$(argument $option "$@"); shift
;;
--platform=*)
PLATFORMFILE=$(echo "$option" | sed 's/--platform=//')
;;
-m) MODULEFILE=$(argument $option "$@"); shift
;;
--module=*)
MODULEFILE=$(echo "$option" | sed 's/--module=//')
;;
-b) BUILDTARGET=$(argument $option "$@"); shift
;;
--buildtarget=*)
BUILDTARGET=$(echo "$option" | sed 's/--buildtarget=//')
;;
-t) TOOLCHAIN=$(argument $option "$@"); shift
;;
--tagname=*)
TOOLCHAIN=$(echo "$option" | sed 's/--tagname=//')
;;
-D)
addEdk2BuildMacro $(argument $option "$@"); shift
;;
--define=*)
addEdk2BuildMacro $(echo "$option" | sed 's/--define=//')
;;
-n)
BUILDTHREADS=$(argument $option "$@"); shift
;;
--vbios-patch-cloverefi)
VBIOSPATCHCLOVEREFI=1
;;
--only-sata0)
ONLYSATA0PATCH=1
;;
--std-ebda)
USE_LOW_EBDA=0
;;
--genpage)
GENPAGE=1
;;
--no-usb)
addEdk2BuildMacro DISABLE_USB_SUPPORT
;;
--no-lto)
addEdk2BuildMacro DISABLE_LTO
;;
--ext-pre | --ext-co | --ext-build)
printf "\`%s' is deprecated. This message will be removed soon\n" "$option" 1>&2
sleep 4
;;
--edk2shell) EDK2SHELL=$(argument $option "$@"); shift
;;
-h | -\? | -help | --help)
usage && exit 0
;;
-v | --version)
echo "$SELF vers from $SCRIPT_VERS" && exit 0
;;
-*)
printf "Unrecognized option \`%s'\n" "$option" 1>&2
exit 1
;;
*)
TARGETRULE="$option"
;;
esac
done
# Update variables
PLATFORMFILE="${PLATFORMFILE:-Clover.dsc}"
if [ ! -z "${MODULEFILE}" ]; then
MODULEFILE=" -m $MODULEFILE"
fi
# Allow custom config path
if [[ -f "${CONF_PATH}/target.txt" ]]; then
addEdk2BuildOption "--conf=${CONF_PATH%/}"
elif [[ -f "${CLOVERROOT}/Conf/target.txt" ]]; then
addEdk2BuildOption "--conf=${CLOVERROOT}/Conf"
fi
}
## Check tools for the toolchain
checkToolchain() {
case "$TOOLCHAIN" in
XCLANG|XCODE*) checkXcode ;;
esac
if [[ "$SYSNAME" == Linux ]]; then
export GCC53_BIN="$TOOLCHAIN_DIR/bin/"
if [[ ! -x "${GCC53_BIN}gcc" ]]; then
echo "No clover toolchain found !" >&2
echo "Install on your system or define the TOOLCHAIN_DIR variable." >&2
exit 1
fi
else
export GCC53_BIN="$TOOLCHAIN_DIR/cross/bin/x86_64-clover-linux-gnu-"
if [[ $TOOLCHAIN == GCC* ]] && [[ ! -x "${GCC53_BIN}gcc" ]]; then
echo "No clover toolchain found !" >&2
echo "Build it with the build_gcc8.sh script or define the TOOLCHAIN_DIR variable." >&2
exit 1
fi
fi
if [[ -x "/opt/local/bin/nasm" ]]; then
export NASM_PREFIX="/opt/local/bin/"
elif [[ -x "${TOOLCHAIN_DIR}/bin/nasm" ]]; then
# using $TOOLCHAIN_DIR here should allow Clover source to be
# inside any sub folder instead of only in ~/
export NASM_PREFIX="${TOOLCHAIN_DIR}/bin/"
else
export NASM_PREFIX="${TOOLCHAIN_DIR}/bin/"
./buildnasm.sh
fi
echo "NASM_PREFIX: $NASM_PREFIX"
#NASM_VER=`nasm -v | awk '/version/ {print $3}'`
NASM_VER=`${NASM_PREFIX}nasm -v | sed -nE 's/^.*version.([0-9\.]+).*$/\1/p'`
echo "NASM_VER: $NASM_VER"
if [[ "$SYSNAME" == Darwin ]]; then
if ! isNASMGood "${NASM_PREFIX}nasm"; then echo "your nasm is not good to build Clover!" && exit 1; fi
fi
}
# Main build script
MainBuildScript() {
checkCmdlineArguments $@
checkToolchain
local repoRev=$(git describe --tags $(git rev-list --tags --max-count=1))
#
# we are building the same rev as before?
local SkipAutoGen=0
#
if [[ -f "$CLOVERROOT"/rEFIt_UEFI/Version.h ]]; then
local builtedRev=$(cat "$CLOVERROOT"/rEFIt_UEFI/Version.h \
| grep '#define FIRMWARE_REVISION L' | awk -v FS="(\"|\")" '{print $2}')
# echo "old revision ${builtedRev}" >echo.txt
# echo "new revision ${repoRev}" >>echo.txt
if [ "${repoRev}" = "${builtedRev}" ]; then SkipAutoGen=1; fi
fi
#
# Setup workspace if it is not set
#
local EDK2DIR=$(cd "$CLOVERROOT" && echo "$PWD")
if [[ -z "$WORKSPACE" ]]; then
echo "Initializing workspace"
if [[ ! -x "${EDK2DIR}"/edksetup.sh ]]; then
echo "Error: Can't find edksetup.sh script !" >&2
exit 1
fi
# This version is for the tools in the BaseTools project.
# this assumes svn pulls have the same root dir
# export EDK_TOOLS_PATH=`pwd`/../BaseTools
# This version is for the tools source in edk2
# cd "$EDK2DIR"
export EDK_TOOLS_PATH="${PWD}"/BaseTools
set +u
source ./edksetup.sh BaseTools
set -u
cd "$CLOVERROOT"
WORKSPACE="${PWD}"
else
echo "Building from: $WORKSPACE"
fi
export CLOVER_PKG_DIR="$CLOVERROOT"/CloverPackage/CloverV2
# Cleaning part of the script if we have told to do it
if [[ "$TARGETRULE" == cleanpkg ]]; then
if [[ "$SYSNAME" != Linux ]]; then
# Make some house cleaning
echo "Cleaning CloverUpdater files..."
make -C "$CLOVERROOT"/CloverPackage/CloverUpdater clean
echo "Cleaning CloverPrefpane files..."
make -C "$CLOVERROOT"/CloverPackage/CloverPrefpane clean
fi
echo "Cleaning bootsector files..."
local BOOTHFS="$CLOVERROOT"/BootHFS
DESTDIR="$CLOVER_PKG_DIR"/BootSectors make -C $BOOTHFS clean
echo
# Use subshell to use shopt
(
echo "Cleaning packaging files..."
shopt -s nullglob
find "$CLOVER_PKG_DIR"/Bootloaders/x64/ -mindepth 1 -not -path "**/.svn*" -delete
if [[ -d "$CLOVER_PKG_DIR"/EFI/BOOT ]]; then
find "$CLOVER_PKG_DIR"/EFI/BOOT/ -name '*.efi' -mindepth 1 -not -path "**/.svn*" -delete
rmdir "$CLOVER_PKG_DIR"/EFI/BOOT &>/dev/null
fi
local dir
for dir in "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers*; do
find "$dir" -mindepth 1 -not -path "**/.svn*" -delete
rmdir "$dir" &>/dev/null
done
find "$CLOVER_PKG_DIR"/EFI/CLOVER/ -name '*.efi' -maxdepth 1 -not -path "**/.svn*" -delete
for dir in "$CLOVER_PKG_DIR"/drivers/$DRIVERS_OFF/*; do
find "$dir" -mindepth 1 -not -path "**/.svn*" -delete
done
)
echo "Done!"
exit $?
elif [[ "$TARGETRULE" == clean || "$TARGETRULE" == cleanall ]]; then
build --quiet -p $PLATFORMFILE -b $BUILDTARGET \
-t $TOOLCHAIN -n $BUILDTHREADS $TARGETRULE
[[ "$TARGETRULE" == cleanall ]] && make -C $WORKSPACE/BaseTools clean
exit $?
fi
# Create edk tools if necessary
if [[ ! -x "$EDK_TOOLS_PATH/Source/C/bin/GenFv" ]]; then
echo "Building tools as they are not found"
make -C "$WORKSPACE"/BaseTools CC="gcc -Wno-deprecated-declarations"
fi
# Apply options
[[ "$USE_BIOS_BLOCKIO" -ne 0 ]] && addEdk2BuildMacro 'USE_BIOS_BLOCKIO'
[[ "$VBIOSPATCHCLOVEREFI" -ne 0 ]] && addEdk2BuildMacro 'ENABLE_VBIOS_PATCH_CLOVEREFI'
[[ "$ONLYSATA0PATCH" -ne 0 ]] && addEdk2BuildMacro 'ONLY_SATA_0'
[[ "$USE_LOW_EBDA" -ne 0 ]] && addEdk2BuildMacro 'USE_LOW_EBDA'
[[ -d "$WORKSPACE/MdeModulePkg/Universal/Variable/EmuRuntimeDxe" ]] && addEdk2BuildMacro 'HAVE_LEGACY_EMURUNTIMEDXE'
[[ "$CLANG" -ne 0 ]] && addEdk2BuildMacro 'CLANG'
local cmd="${EDK2_BUILD_OPTIONS[@]}"
if (( $SkipAutoGen == 1 )) && (( $FORCEREBUILD == 0 )); then
cmd="build --skip-autogen $cmd"
else
cmd="build $cmd"
fi
cmd="$cmd -p $PLATFORMFILE $MODULEFILE -a $TARGETARCH -b $BUILDTARGET"
cmd="$cmd -t $TOOLCHAIN -n $BUILDTHREADS $TARGETRULE"
echo
echo "Running edk2 build for Clover$TARGETARCH using the command:"
echo "$cmd"
echo
# Build Clover version
if (( $SkipAutoGen == 0 )) || (( $FORCEREBUILD == 1 )); then
# local clover_revision=$(cat "${CLOVERROOT}/${VERSTXT}")
local clover_revision=$(git describe --tags $(git rev-list --tags --max-count=1))
local clover_build_date=$(date '+%Y-%m-%d %H:%M:%S')
#echo "#define FIRMWARE_VERSION \"2.31\"" > "$CLOVERROOT"/Version.h
echo "#define FIRMWARE_BUILDDATE \"${clover_build_date}\"" > "$CLOVERROOT"/Version.h
echo "#define FIRMWARE_REVISION L\"${clover_revision}\"" >> "$CLOVERROOT"/Version.h
local sha1="(github unknown)"
if [[ -d "${CLOVERROOT}"/.git ]]; then
sha1="($(git rev-parse --abbrev-ref HEAD), commit $(git rev-parse --short HEAD))"
fi
echo "#define REVISION_STR \"Clover revision: ${clover_revision} $sha1\"" >> "$CLOVERROOT"/Version.h
# echo "#define REVISION_STR \"Clover revision: ${clover_revision}\"" >> "$CLOVERROOT"/Version.h
local clover_build_info="Args: "
if [[ -n "$@" ]]; then
clover_build_info="${clover_build_info} $@"
fi
clover_build_info="${clover_build_info} | $(echo $cmd | xargs | sed -e "s, -p ${PLATFORMFILE} , ,")"
if [[ -n "${OSVER:-}" ]]; then
clover_build_info="${clover_build_info} | OS: ${OSVER}"
fi
if [[ -n "${XCODE_VERSION:-}" ]]; then
clover_build_info="${clover_build_info} | XCODE: ${XCODE_VERSION}"
fi
# removing force rebuild related flags, and ensure only one blank space is used as separator
clover_build_info=$(echo ${clover_build_info} | sed -e 's/ -fr / /' \
| sed -e 's/ --force-rebuild / /' | sed -e 's/ --skip-autogen / /' \
| sed -e 's/build//' | sed -e 's/Args: | /Args: /' | sed -e 's/ / /')
echo "#define BUILDINFOS_STR \"${clover_build_info}\"" >> "$CLOVERROOT"/Version.h
cp "$CLOVERROOT"/Version.h "$CLOVERROOT"/rEFIt_UEFI/
fi
eval "$cmd"
}
copyBin() {
local cpSrc="$1"
local cpDest="$2"
local cpFile=$(basename "$2")
local cpDestDIR=$(dirname "$cpDest")
[[ ! -f "$cpSrc" || ! -d "$cpDestDIR" ]] && return
[[ -d "$cpDest" ]] && cpFile=$(basename "$cpSrc")
echo " -> $cpFile"
cp -f "$cpSrc" "$cpDest" 2>/dev/null
}
setInitBootMsg(){
local byte="35"
case "${1}" in
*boot2)
byte="32"
;;
*boot3)
byte="33"
;;
*boot4)
byte="34"
;;
*boot5)
byte="35"
;;
*boot6)
byte="36"
;;
*boot7)
byte="37"
;;
*boot7-MCP79)
byte="4d"
;;
*boot8)
byte="38"
;;
*boot9)
byte="39"
;;
*)
return;
;;
esac
if [[ -f "${1}" ]]; then
echo -e "Changing byte at 0xa9 of $(basename ${1}) to show \x${byte} as init message:"
printf "\x${byte}" | dd conv=notrunc of="${1}" bs=1 seek=$((0xa9))
fi
}
# Deploy Clover files for packaging
MainPostBuildScript() {
# if [[ -z "$EDK_TOOLS_PATH" ]]; then
export BASETOOLS_DIR="$WORKSPACE"/BaseTools/Source/C/bin
# else
# export BASETOOLS_DIR="$EDK_TOOLS_PATH"/Source/C/bin
# fi
export BOOTSECTOR_BIN_DIR="$CLOVERROOT"/CloverEFI/BootSector/bin
if (( $NOBOOTFILES == 0 )); then
echo Compressing DUETEFIMainFv.FV ...
"$BASETOOLS_DIR"/LzmaCompress -e -o "${BUILD_DIR}/FV/DUETEFIMAINFV${TARGETARCH}.z" "${BUILD_DIR}/FV/DUETEFIMAINFV${TARGETARCH}.Fv"
echo Compressing DxeCore.efi ...
"$BASETOOLS_DIR"/LzmaCompress -e -o "${BUILD_DIR}/FV/DxeMain${TARGETARCH}.z" "$BUILD_DIR_ARCH/DxeCore.efi"
echo Compressing DxeIpl.efi ...
"$BASETOOLS_DIR"/LzmaCompress -e -o "${BUILD_DIR}/FV/DxeIpl${TARGETARCH}.z" "$BUILD_DIR_ARCH/DxeIpl.efi"
echo "Generate Loader Image ..."
fi
cloverEFIFile=boot$((6 + USE_BIOS_BLOCKIO))
if (( $NOBOOTFILES == 0 )); then
"$BASETOOLS_DIR"/GenFw --rebase 0x10000 -o "$BUILD_DIR_ARCH/EfiLoader.efi" "$BUILD_DIR_ARCH/EfiLoader.efi"
"$BASETOOLS_DIR"/EfiLdrImage -o "${BUILD_DIR}"/FV/Efildr64 \
"$BUILD_DIR_ARCH"/EfiLoader.efi \
"${BUILD_DIR}"/FV/DxeIpl${TARGETARCH}.z \
"${BUILD_DIR}"/FV/DxeMain${TARGETARCH}.z \
"${BUILD_DIR}"/FV/DUETEFIMAINFV${TARGETARCH}.z
if [[ "$GENPAGE" -eq 0 && "$USE_LOW_EBDA" -ne 0 ]]; then
if [[ "$SYSNAME" == Linux ]]; then
local -r EL_SIZE=$(stat -c "%s" "${BUILD_DIR}"/FV/Efildr64)
else
local -r EL_SIZE=$(stat -f "%z" "${BUILD_DIR}"/FV/Efildr64)
fi
if (( $((EL_SIZE)) > 417792 )); then
echo 'warning: boot file bigger than low-ebda permits, switching to --std-ebda'
USE_LOW_EBDA=0
fi
fi
local -ar COM_NAMES=(H H2 H3 H4 H5 H6 H5 H6) # Note: (H{,2,3,4,5,6,5,6}) works in Linux bash, but not Darwin bash
startBlock=Start64${COM_NAMES[$((GENPAGE << 2 | USE_LOW_EBDA << 1 | USE_BIOS_BLOCKIO))]}.com
if [[ "$GENPAGE" -ne 0 ]]; then
cat $BOOTSECTOR_BIN_DIR/$startBlock $BOOTSECTOR_BIN_DIR/efi64.com3 "${BUILD_DIR}"/FV/Efildr64 > "${BUILD_DIR}"/FV/boot
else
cat $BOOTSECTOR_BIN_DIR/$startBlock $BOOTSECTOR_BIN_DIR/efi64.com3 "${BUILD_DIR}"/FV/Efildr64 > "${BUILD_DIR}"/FV/Efildr20Pure
if [[ "$USE_LOW_EBDA" -ne 0 ]]; then
"$BASETOOLS_DIR"/GenPage "${BUILD_DIR}"/FV/Efildr20Pure -b 0x88000 -f 0x68000 -o "${BUILD_DIR}"/FV/Efildr20
else
"$BASETOOLS_DIR"/GenPage "${BUILD_DIR}"/FV/Efildr20Pure -o "${BUILD_DIR}"/FV/Efildr20
fi
# Create CloverEFI file
dd if="${BUILD_DIR}"/FV/Efildr20 of="${BUILD_DIR}"/FV/boot bs=512 skip=1
fi
rm -rf "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers 2> /dev/null
# clean old drivers directories
if [[ "$DRIVERS_LEGACY" != drivers64 ]]; then
rm -rf "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers64
fi
if [[ "$DRIVERS_UEFI" != drivers64UEFI ]]; then
rm -rf "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers64UEFI
fi
rm -rf "$CLOVER_PKG_DIR"/CloverV2/drivers-Off
# Be sure that all needed directories exists
mkdir -p "$CLOVER_PKG_DIR"/Bootloaders/x64
mkdir -p "$CLOVER_PKG_DIR"/EFI/BOOT
mkdir -p "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_LEGACY
mkdir -p "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_UEFI
# off drivers
mkdir -p "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_OFF/$DRIVERS_LEGACY/FileVault2
mkdir -p "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_OFF/$DRIVERS_UEFI/FileVault2
mkdir -p "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_OFF/$DRIVERS_UEFI/MemoryFix
mkdir -p "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_OFF/$DRIVERS_LEGACY/FileSystem
mkdir -p "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_OFF/$DRIVERS_UEFI/FileSystem
mkdir -p "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_OFF/$DRIVERS_UEFI/HID
mkdir -p "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_OFF/$DRIVERS_UEFI/Other
# Install CloverEFI file
echo "Copy CloverEFI:"
copyBin "${BUILD_DIR}"/FV/boot "$CLOVER_PKG_DIR"/Bootloaders/x64/$cloverEFIFile
# For GENPAGE, the character "[TX]" is at offset 0x74 of Start64H[56].com, not offset 0xa9 - zenith432
if [[ "$GENPAGE" -eq 0 ]]; then
setInitBootMsg "$CLOVER_PKG_DIR"/Bootloaders/x64/$cloverEFIFile
fi
copyBin "$BUILD_DIR_ARCH"/CLOVER.efi "$CLOVER_PKG_DIR"/EFI/BOOT/BOOTX64.efi
copyBin "$BUILD_DIR_ARCH"/CLOVER.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/CLOVERX64.efi
# Mandatory drivers
echo "Copy Mandatory drivers:"
binArray=( FSInject XhciDxe SMCHelper AudioDxe )
for efi in "${binArray[@]}"
do
copyBin "$BUILD_DIR_ARCH"/$efi.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_LEGACY/$efi.efi
done
binArray=( AppleImageCodec AppleKeyAggregator AppleUITheme FirmwareVolume )
for efi in "${binArray[@]}"
do
copyBin "$BUILD_DIR_ARCH"/$efi.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_OFF/$DRIVERS_LEGACY/FileVault2/$efi.efi
done
binArray=( ApfsDriverLoader )
for efi in "${binArray[@]}"
do
copyBin "$BUILD_DIR_ARCH"/$efi.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_OFF/$DRIVERS_LEGACY/FileSystem/$efi.efi
done
if [[ $M_APPLEHFS -eq 1 ]]; then
copyBin "${CLOVERROOT}"/FileSystems/HFSPlus/X64/HFSPlus.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_OFF/$DRIVERS_LEGACY/FileSystem/HFSPlus.efi
fi
binArray=( FSInject DataHubDxe SMCHelper AudioDxe )
for efi in "${binArray[@]}"
do
copyBin "$BUILD_DIR_ARCH"/$efi.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_UEFI/$efi.efi
done
binArray=( AppleImageCodec AppleUITheme AppleKeyAggregator FirmwareVolume )
for efi in "${binArray[@]}"
do
copyBin "$BUILD_DIR_ARCH"/$efi.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_OFF/$DRIVERS_UEFI/FileVault2/$efi.efi
done
if [[ $M_NOGRUB -eq 0 ]]; then
binArray=( GrubEXFAT GrubISO9660 GrubNTFS GrubUDF )
for efi in "${binArray[@]}"
do
copyBin "$BUILD_DIR_ARCH"/$efi.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_OFF/$DRIVERS_LEGACY/FileSystem/$efi.efi
done
fi
# drivers64UEFI
binArray=( CsmVideoDxe EnglishDxe EmuVariableUefi NvmExpressDxe OsxFatBinaryDrv PartitionDxe )
for efi in "${binArray[@]}"
do
copyBin "$BUILD_DIR_ARCH"/$efi.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_OFF/$DRIVERS_UEFI/Other/$efi.efi
done
binArray=( Ps2MouseDxe UsbKbDxe UsbMouseDxe AptioInputFix )
for efi in "${binArray[@]}"
do
copyBin "$BUILD_DIR_ARCH"/$efi.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_OFF/$DRIVERS_UEFI/HID/$efi.efi
done
binArray=( ApfsDriverLoader Fat VBoxExt2 VBoxExt4 VBoxIso9600 VBoxHfs )
for efi in "${binArray[@]}"
do
copyBin "$BUILD_DIR_ARCH"/$efi.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_OFF/$DRIVERS_UEFI/FileSystem/$efi.efi
done
if [[ $M_APPLEHFS -eq 1 ]]; then
copyBin "${CLOVERROOT}"/FileSystems/HFSPlus/X64/HFSPlus.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_OFF/$DRIVERS_UEFI/FileSystem/HFSPlus.efi
fi
# drivers64UEFI/FileVault2
binArray=( AppleKeyFeeder HashServiceFix )
for efi in "${binArray[@]}"
do
copyBin "$BUILD_DIR_ARCH"/$efi.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_OFF/$DRIVERS_UEFI/FileVault2/$efi.efi
done
# drivers64UEFI/MemoryFix
binArray=( OsxAptioFixDrv OsxLowMemFixDrv OsxAptioFix3Drv AptioMemoryFix )
for efi in "${binArray[@]}"
do
copyBin "$BUILD_DIR_ARCH"/$efi.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/drivers/$DRIVERS_OFF/$DRIVERS_UEFI/MemoryFix/$efi.efi
done
# Applications
echo "Copy Applications:"
copyBin "$BUILD_DIR_ARCH"/bdmesg.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/tools/
if [[ "${EDK2SHELL:-}" == "MinimumShell" ]]; then
copyBin "${WORKSPACE}"/ShellBinPkg/MinUefiShell/X64/Shell.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/tools/Shell64U.efi
elif [[ "${EDK2SHELL:-}" == "FullShell" ]]; then
copyBin "${WORKSPACE}"/ShellBinPkg/UefiShell/X64/Shell.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/tools/Shell64U.efi
else
copyBin "$BUILD_DIR_ARCH"/Shell.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/tools/Shell64U.efi
fi
fi
echo "Done!"
# Build and install Bootsectors
echo
echo "Generating BootSectors"
local BOOTHFS="$CLOVERROOT"/BootHFS
DESTDIR="$CLOVER_PKG_DIR"/BootSectors make -C $BOOTHFS
echo "Done!"
}
# BUILD START #
# Default locale
export LC_ALL=POSIX
# Add toolchain bin directory to the PATH
if [[ "$SYSNAME" != Linux ]]; then
pathmunge "$TOOLCHAIN_DIR/bin"
fi
MainBuildScript $@
export BUILD_DIR="${WORKSPACE}/Build/Clover/${BUILDTARGET}_${TOOLCHAIN}"
export BUILD_DIR_ARCH="${BUILD_DIR}/$TARGETARCH"
if [[ -z $MODULEFILE ]] && (( $NOBOOTFILES == 0 )); then
MainPostBuildScript
else
copyBin "$BUILD_DIR_ARCH"/CLOVER.efi "$CLOVER_PKG_DIR"/EFI/CLOVER/CLOVERX64.efi
copyBin "$BUILD_DIR_ARCH"/CLOVER.efi "$CLOVER_PKG_DIR"/EFI/BOOT/BOOTX64.efi
fi
# Local Variables: #
# mode: ksh #
# tab-width: 4 #
# indent-tabs-mode: nil #
# End: #
#
# vi: set expandtab ts=4 sw=4 sts=4: #

12
makeall.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
#./ebuild.sh -fr --no-lto --ia32 -D NO_GRUB_DRIVERS_EMBEDDED
./ebuild.sh -fr -mc --no-usb -D NO_GRUB_DRIVERS_EMBEDDED
./ebuild.sh -fr -D NO_GRUB_DRIVERS_EMBEDDED
cd CloverPackage
./makepkg
./makeiso
#make iso
cd ..
echo "done!"

491
rEFIt_UEFI/cpp_util/XStringW.cpp Executable file
View File

@ -0,0 +1,491 @@
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// STRING
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#if !defined(__XStringW_CPP__)
#define __XStringW_CPP__
#if 0
#define DBG(...) DebugLog(2, __VA_ARGS__)
#else
#define DBG(...)
#endif
#include "XStringW.h"
extern "C" {
#include <Library/MemoryAllocationLib.h>
#include <Library/BaseMemoryLib.h>
#include "Platform/Platform.h"
#include "refit/IO.h"
}
UINTN XStringWGrowByDefault = 1024;
//const XStringW NullXStringW;
void XStringW::Init(UINTN aSize)
{
//DBG("Init aSize=%d\n", aSize);
m_data = (wchar_t*)AllocatePool( (aSize+1)*sizeof(wchar_t) ); /* le 0 terminal n'est pas compté dans mSize */
if ( !m_data ) {
DBG("XStringW::Init(%d) : AllocatePool returned NULL. Cpu halted\n", (aSize+1)*sizeof(wchar_t));
CpuDeadLoop();
}
m_size = aSize;
m_len = 0;
m_data[0] = 0;
}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// Constructor
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
XStringW::XStringW()
{
DBG("Construteur\n");
Init();
}
XStringW::XStringW(const XStringW &aString)
{
DBG("Constructor(const XStringW &aString) : %s\n", aString.data());
Init(aString.length());
StrnCpy(aString.data(), aString.length());
}
XStringW::XStringW(const wchar_t *S)
{
DBG("Constructor(const wchar_t *S) : %s, StrLen(S)=%d\n", S, StrLen(S));
Init(StrLen(S));
if ( S ) StrCpy(S);
}
XStringW::XStringW(const wchar_t *S, UINTN count)
{
DBG("Constructor(const wchar_t *S, UINTN count) : %s, %d\n", S, count);
Init(count);
StrnCpy(S, count);
}
XStringW::XStringW(const wchar_t aChar)
{
DBG("Constructor(const wchar_t aChar)\n");
Init(1);
StrnCpy(&aChar, 1);
}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// Destructor
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
XStringW::~XStringW()
{
DBG("Destructor :%s\n", data());
FreePool((void*)m_data);
}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
void XStringW::SetLength(UINTN len)
{
//DBG("SetLength(%d)\n", len);
m_len = len;
m_data[len] = 0;
if ( StrLen(data()) != len ) {
DBG("XStringW::SetLength(UINTN len) : StrLen(data()) != len (%d != %d). System halted\n", StrLen(data()), len);
CpuDeadLoop();
}
}
/* CheckSize() */
wchar_t *XStringW::CheckSize(UINTN nNewSize, UINTN nGrowBy)
{
//DBG("CheckSize: m_size=%d, nNewSize=%d\n", m_size, nNewSize);
if ( m_size < nNewSize )
{
nNewSize += nGrowBy;
m_data = (wchar_t*)ReallocatePool(m_size*sizeof(wchar_t), (nNewSize+1)*sizeof(wchar_t), m_data);
if ( !m_data ) {
DBG("XStringW::CheckSize(%d, %d) : ReallocatePool(%d, %d, %d) returned NULL. System halted\n", nNewSize, nGrowBy, m_size, (nNewSize+1)*sizeof(wchar_t), m_data);
CpuDeadLoop();
}
m_size = nNewSize;
}
return m_data;
}
void XStringW::StrnCpy(const wchar_t *buf, UINTN len)
{
if ( buf && *buf && len > 0 ) {
CheckSize(len, 0);
CopyMem(data(), buf, len*sizeof(wchar_t));
}
SetLength(len); /* data()[len]=0 done in SetLength */
}
void XStringW::StrCpy(const wchar_t *buf)
{
if ( buf && *buf ) {
StrnCpy(buf, StrLen(buf));
}else{
SetLength(0); /* data()[0]=0 done in SetLength */
}
}
//inline
void XStringW::StrnCat(const wchar_t *buf, UINTN len)
{
UINTN NewLen;
if ( buf && *buf && len > 0 ) {
NewLen = length()+len;
CheckSize(NewLen, 0);
CopyMem(data(length()), buf, len*sizeof(wchar_t));
SetLength(NewLen); /* data()[NewLen]=0 done in SetLength */
}
}
inline void XStringW::StrCat(const wchar_t *buf)
{
if ( buf && *buf ) {
StrnCat(buf, StrLen(buf));
}
}
void XStringW::StrCat(const XStringW &uneXStringWW)
{
StrnCat(uneXStringWW.data(), uneXStringWW.length());
}
void XStringW::Delete(UINTN pos, UINTN count)
{
if ( pos < length() ) {
if ( count != MAX_UINTN && pos + count < length() ) {
CopyMem( data(pos), data(pos+count), (length()-pos-count)*sizeof(wchar_t)); // CopyMem handles overlapping memory move
SetLength(length()-count);/* data()[length()-count]=0 done in SetLength */
}else{
SetLength(pos);/* data()[pos]=0 done in SetLength */
}
}
}
void XStringW::Insert(UINTN pos, const XStringW& Str)
{
if ( pos < length() ) {
CheckSize(length()+Str.length());
CopyMem(data(pos + Str.length()), data(pos), (length()-pos)*sizeof(wchar_t));
CopyMem(data(pos), Str.data(), Str.length()*sizeof(wchar_t));
SetLength(length()+Str.length());
}else{
StrCat(Str);
}
}
void XStringW::Replace(wchar_t c1, wchar_t c2)
{
wchar_t* p;
p = data();
while ( *p ) {
if ( *p == c1 ) *p = c2;
p += 1;
}
}
XStringW XStringW::SubStringReplace(wchar_t c1, wchar_t c2)
{
wchar_t* p;
XStringW Result;
p = data();
while ( *p ) {
if ( *p == c1 ) Result += c2;
else Result += *p;
p++;
}
return Result;
}
void XStringW::vSPrintf(const wchar_t *format, VA_LIST va)
{
POOL_PRINT spc;
PRINT_STATE ps;
ZeroMem(&spc, sizeof (spc));
spc.Str = data();
SetLength(0);
spc.Len = 0;
spc.Maxlen = m_size;
ZeroMem(&ps, sizeof (ps));
ps.Output = (IN EFI_STATUS (EFIAPI *)(VOID *context, CHAR16 *str))_PoolPrint;
ps.Context = (void*)&spc;
ps.fmt.u.pw = format;
VA_COPY(ps.args, va);
_PPrint (&ps);
VA_END(ps.args);
}
void XStringW::SPrintf(const wchar_t *format, ...)
{
VA_LIST va;
VA_START (va, format);
vSPrintf(format, va);
VA_END(va);
}
XStringW XStringW::basename() const
{
UINTN idx = RIdxOf(LPATH_SEPARATOR);
if ( idx == MAX_UINTN ) return XStringW();
return SubString(idx+1, length()-idx-1);
}
XStringW XStringW::dirname() const
{
UINTN idx = RIdxOf(LPATH_SEPARATOR);
if ( idx == MAX_UINTN ) return XStringW();
return SubString(0, idx);
}
XStringW XStringW::SubString(UINTN pos, UINTN count) const
{
if ( count > length()-pos ) count = length()-pos;
return XStringW( &(data()[pos]), count);
}
UINTN XStringW::IdxOf(wchar_t aChar, UINTN Pos) const
{
UINTN Idx;
for ( Idx=Pos ; Idx<length() ; Idx+=1 ) {
if ( data()[Idx] == aChar ) return Idx;
}
return MAX_UINTN;
}
UINTN XStringW::IdxOf(const XStringW &S, UINTN Pos) const
{
UINTN i;
UINTN Idx;
if ( length() < S.length() ) return MAX_UINTN;
for ( Idx=Pos ; Idx<=length()-S.length() ; Idx+=1 ) {
i = 0;
while( i<S.length() && ( data()[Idx+i] - S[i] ) == 0 ) i += 1;
if ( i == S.length() ) return Idx;
}
return MAX_UINTN;
}
UINTN XStringW::RIdxOf(const wchar_t charToSearch, UINTN Pos) const
{
UINTN Idx;
if ( Pos > length() ) Pos = length();
if ( Pos < 1 ) return MAX_UINTN;
for ( Idx=Pos ; Idx-- > 0 ; ) {
if ( m_data[Idx] == charToSearch ) return Idx;
}
return MAX_UINTN;
}
UINTN XStringW::RIdxOf(const XStringW &S, UINTN Pos) const
{
UINTN i;
UINTN Idx;
if ( S.length() == 0 ) return MAX_UINTN;
if ( Pos > length() ) Pos = length();
if ( Pos < S.length() ) return MAX_UINTN;
Pos -= S.length();
for ( Idx=Pos+1 ; Idx-- > 0 ; ) {
i = 0;
while( i<S.length() && data()[Idx+i] == S[i] ) i += 1;
if ( i == S.length() ) return Idx;
}
return MAX_UINTN;
}
bool XStringW::IsDigits() const
{
const wchar_t *p;
p = data();
if ( !*p ) return false;
for ( ; *p ; p+=1 ) {
if ( *p < '0' ) return false;
if ( *p > '9' ) return false;
}
return true;
}
bool XStringW::IsDigits(UINTN pos, UINTN count) const
{
const wchar_t *p;
const wchar_t *q;
if ( pos >= length() ) {
return false;
}
if ( pos+count > length() ) {
return false;
}
p = data() + pos;
q = p + count;
for ( ; p < q ; p+=1 ) {
if ( *p < '0' ) return false;
if ( *p > '9' ) return false;
}
return true;
}
void XStringW::RemoveLastEspCtrl()
{
wchar_t *p;
if ( length() > 0 ) {
p = data() + length() - 1;
if ( *p >= 0 && *p <= ' ' ) {
p -= 1;
while ( p>data() && *p >= 0 && *p <= ' ' ) p -= 1;
if ( p>data() ) {
SetLength( (UINTN)(p-data())+1);
}else{
if ( *p >= 0 && *p <= ' ' ) SetLength(0);
else SetLength(1);
}
}
}
}
//-------------------------------------------------------------------------------------------------
//
//-------------------------------------------------------------------------------------------------
//bool XStringW::ReadFromFILE(FILE *fp)
//{
// UINTN longueur;
//
// if ( fread(&longueur, sizeof(longueur), 1, fp) != 1 ) goto fin;
// if ( longueur > 0 && fread(dataWithSizeMin(0, longueur), sizeof(wchar_t), longueur, fp) != 1 ) goto fin;
// SetLength(longueur);
// return true;
// fin:
// SetNull();
// return false;
//}
//
//bool XStringW::WriteToFILE(FILE *fp) const
//{
// UINTN longueur;
//
// longueur = length();
// if ( fwrite(&longueur, sizeof(longueur), 1, fp) != 1 ) return false;
// if ( longueur > 0 && fwrite(data(), sizeof(wchar_t), longueur, fp) != 1 ) return false;
// return true;
//}
//*************************************************************************************************
//
// Operators =
//
//*************************************************************************************************
const XStringW &XStringW::operator =(wchar_t aChar)
{
//TRACE("Operator =wchar_t \n");
StrnCpy(&aChar, 1);
return *this;
}
const XStringW &XStringW::operator =(const XStringW &aString)
{
//TRACE("Operator =const XStringW&\n");
StrnCpy(aString.data(), aString.length());
return *this;
}
const XStringW &XStringW::operator =(const wchar_t *S)
{
//TRACE("Operator =const wchar_t *\n");
StrCpy(S);
return *this;
}
//*************************************************************************************************
//
// Operators +=
//
//*************************************************************************************************
const XStringW &XStringW::operator +=(wchar_t aChar)
{
//TRACE("Operator +=wchar_t \n");
StrnCat(&aChar, 1);
return *this;
}
const XStringW &XStringW::operator +=(const XStringW &aString)
{
//TRACE("Operator +=const XStringW&\n");
StrnCat(aString.data(), aString.length());
return *this;
}
const XStringW &XStringW::operator +=(const wchar_t *S)
{
//TRACE("operator +=const wchar_t *\n");
StrCat(S);
return *this;
}
//-----------------------------------------------------------------------------
// Functions
//-----------------------------------------------------------------------------
XStringW SPrintf(const wchar_t *format, ...)
{
VA_LIST va;
XStringW str;
VA_START (va, format);
str.vSPrintf(format, va);
VA_END(va);
return str;
}
XStringW SubString(const wchar_t *S, UINTN pos, UINTN count)
{
if ( StrLen(S)-pos < count ) count = StrLen(S)-pos;
return ( XStringW(S+pos, count) );
}
XStringW CleanCtrl(const XStringW &S)
{
XStringW ReturnValue;
UINTN i;
for ( i=0 ; i<S.length() ; i+=1 ) {
if ( S[i] >=0 && S[i] < ' ' ) ReturnValue += 'x'; /* wchar_t are signed !!! */
else ReturnValue += S[i];
}
return ReturnValue;
}
#endif

181
rEFIt_UEFI/cpp_util/XStringW.h Executable file
View File

@ -0,0 +1,181 @@
//*************************************************************************************************
//*************************************************************************************************
//
// STRING
//
//*************************************************************************************************
//*************************************************************************************************
#if !defined(__XSTRINGW_H__)
#define __XSTRINGW_H__
//#include "XToolsCommon.h"
//#include "XConstStringW.h"
extern "C" {
#include <Library/BaseLib.h>
}
#define LPATH_SEPARATOR L'\\'
extern UINTN XStringWGrowByDefault;
extern void __GLOBAL__sub_I_XStringW();
class XStringW
{
protected:
wchar_t *m_data;
UINTN m_len;
UINTN m_size;
public:
void Init(UINTN aSize=0);
XStringW();
XStringW(const XStringW &aString);
XStringW(const wchar_t *);
XStringW(const wchar_t* S, UINTN count);
XStringW(const wchar_t);
~XStringW();
protected:
wchar_t *CheckSize(UINTN nNewSize, UINTN nGrowBy = XStringWGrowByDefault);
public:
const wchar_t *data(UINTN ui=0) const { return m_data+ui; }
wchar_t *data(UINTN ui=0) { return m_data+ui; }
wchar_t *dataWithSizeMin(UINTN pos, UINTN sizeMin, UINTN nGrowBy=XStringWGrowByDefault) { CheckSize(sizeMin, nGrowBy); return data(pos); }
UINTN length() const { return m_len; }
UINTN size() const { return m_size; }
void SetLength(UINTN len);
/* IsNull ? */
bool IsNull() const { return length() == 0 ; }
bool NotNull() const { return length() > 0 ; }
/* Cast */
operator const wchar_t *() const { return data(); }
#if defined(__APPLE__) && defined(__OBJC__)
operator NSString*() const { return [[[NSString alloc] initWithBytes:data() length:length()*sizeof(wchar_t) encoding:NSUTF32LittleEndianStringEncoding] autorelease]; }
#endif
int ToInt() const;
UINTN ToUInt() const;
// XString mbs() const;
/* [] */
wchar_t operator [](int i) const { return *data(i); }
wchar_t operator [](UINTN i) const { return *data(i); }
wchar_t& operator [](int i) { return *data(i); }
wchar_t& operator [](UINTN i) { return *data(i); }
wchar_t LastChar() const { if ( length() > 0 ) return data()[length()-1]; else return 0; }
void RemoveLastEspCtrl();
void SetNull() { SetLength(0); };
void StrnCpy(const wchar_t *buf, UINTN len);
void StrCpy(const wchar_t *buf);
void StrnCat(const wchar_t *buf, UINTN len);
void StrCat(const wchar_t *buf);
void StrCat(const XStringW &uneXStringW);
void Delete(UINTN pos, UINTN count=1);
void Insert(UINTN pos, const XStringW& Str);
void vSPrintf(const wchar_t *format, VA_LIST va);
void SPrintf(const wchar_t *format, ...);
const XStringW &operator =(const XStringW &aString);
const XStringW &operator =(const wchar_t* S);
const XStringW &operator =(wchar_t);
const XStringW &operator += (const XStringW &);
const XStringW &operator += (const wchar_t* S);
const XStringW &operator += (wchar_t);
XStringW SubString(UINTN pos, UINTN count) const;
UINTN IdxOf(wchar_t c, UINTN Pos = 0) const;
UINTN IdxOf(const XStringW& S, UINTN Pos = 0) const;
UINTN RIdxOf(const wchar_t c, UINTN Pos = MAX_UINTN) const;
UINTN RIdxOf(const XStringW& S, UINTN Pos = MAX_UINTN) const;
void ToLower(bool FirstCharIsCap = false);
bool IsLetters() const;
bool IsLettersNoAccent() const;
bool IsDigits() const;
bool IsDigits(UINTN pos, UINTN count) const;
bool ExistIn(const XStringW &S) const { return IdxOf(S) != MAX_UINTN; }
void Replace(wchar_t c1, wchar_t c2);
XStringW SubStringReplace(wchar_t c1, wchar_t c2);
INTN Compare(const wchar_t* S) const { return StrCmp(data(), S) ; }
bool Equal(const wchar_t* S) const { return Compare(S) == 0; };
bool BeginingEqual(const wchar_t* S) const { return StrnCmp(data(), S, StrLen(S)); }
bool SubStringEqual(UINTN Pos, const wchar_t* S) const { return StrCmp(data(Pos), S); }
XStringW basename() const;
XStringW dirname() const;
// bool ReadFromBuf(const char *buf, UINTN *idx, UINTN count);
// bool WriteToBuf(char *buf, UINTN *idx, UINTN count) const;
// bool ReadFromFILE(FILE *fp);
// bool WriteToFILE(FILE *fp) const;
//
// bool ReadFromXBuffer(XRBuffer &unXBuffer); // Impossible de mettre le XBuffer en const car il y a une variable d'instance de XBuffer incrémentée par ReadFromXBuffer
// void CatToXBuffer(XBuffer *unXBuffer) const;
// void WriteToXBuffer(XBuffer *unXBuffer, UINTN *idx) const;
public:
// + operator
// with XStringW
friend XStringW operator + (const XStringW& p1, const XStringW& p2) { XStringW s; s=p1; s+=p2; return s; }
// with const wchar_t
friend XStringW operator + (const XStringW& p1, const wchar_t *p2 ) { XStringW s; s=p1; s+=p2; return s; }
friend XStringW operator + (const wchar_t *p1, const XStringW& p2) { XStringW s; s=p1; s+=p2; return s; }
// // with wchar_t
// friend XStringW operator + (const XStringW& p1, wchar_t p2 ) { XStringW s; s=p1; s+=p2; return s; }
// friend XStringW operator + (wchar_t p1, const XStringW& p2 ) { XStringW s; s=p1; s+=p2; return s; }
// == operator
friend bool operator == (const XStringW& s1, const XStringW& s2) { return s1.Compare(s2) == 0; }
friend bool operator == (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) == 0; }
friend bool operator == (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) == 0; }
friend bool operator != (const XStringW& s1, const XStringW& s2) { return s1.Compare(s2) != 0; }
friend bool operator != (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) != 0; }
friend bool operator != (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) != 0; }
friend bool operator < (const XStringW& s1, const XStringW& s2) { return s1.Compare(s2) < 0; }
friend bool operator < (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) < 0; }
friend bool operator < (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) > 0; }
friend bool operator > (const XStringW& s1, const XStringW& s2) { return s1.Compare(s2) > 0; }
friend bool operator > (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) > 0; }
friend bool operator > (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) < 0; }
friend bool operator <= (const XStringW& s1, const XStringW& s2) { return s1.Compare(s2) <= 0; }
friend bool operator <= (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) <= 0; }
friend bool operator <= (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) >= 0; }
friend bool operator >= (const XStringW& s1, const XStringW& s2) { return s1.Compare(s2) >= 0; }
friend bool operator >= (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) >= 0; }
friend bool operator >= (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) <= 0; }
};
//extern const XStringW NullXStringW;
XStringW SPrintf(const wchar_t *format, ...);
XStringW SubString(const wchar_t *S, UINTN pos, UINTN count);
XStringW CleanCtrl(const XStringW &S);
#endif

View File

@ -0,0 +1,2 @@
#include "XStringW.h"
XStringW global_str1(L"global_str1");

View File

@ -0,0 +1,2 @@
#include "XStringW.h"
XStringW global_str2(L"global_str2");

View File

@ -0,0 +1,106 @@
//===-- crtbegin.c - Start of constructors and destructors ----------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#if 0
#define DBG(...) DebugLog(2, __VA_ARGS__)
#else
#define DBG(...)
#endif
extern "C" {
#include <stddef.h>
}
#include <Platform/Platform.h>
typedef void (ctor)(void);
typedef ctor* ctor_ptr;
#if defined(__clang__)
extern "C" {
/*
* This symbol will be placed at the beginning of the section following the __mod_init_func section.
* This way, will know the size of the __mod_init_func section.
* In the efi file, __mod_init_func section has been merged with the following section. That's why we need this trick.
*/
void __attribute__((section ("__DATA,__const"))) __attribute__((optnone)) beginning_of_section_next_to_mod_init_func() {};
}
void construct_globals_objects()
{
// beginning_of_section_next_to_mod_init_func(); // to not be optimized out
ctor_ptr* beginning_of_section_next_to_mod_init_func_ptr = (ctor_ptr*)&beginning_of_section_next_to_mod_init_func;
DBG("beginning_of_section_next_to_mod_init_func_ptr=%08x\n", (UINTN)beginning_of_section_next_to_mod_init_func_ptr);
UINT32 PeCoffHeaderOffset = 0;
EFI_IMAGE_DOS_HEADER* DosHdr = (EFI_IMAGE_DOS_HEADER*)SelfLoadedImage->ImageBase;
if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
// DOS image header is present, so read the PE header after the DOS image header
PeCoffHeaderOffset = DosHdr->e_lfanew;
}
DBG("ImageContext.PeCoffHeaderOffset: %08x %d\n", PeCoffHeaderOffset, PeCoffHeaderOffset);
EFI_IMAGE_OPTIONAL_HEADER_UNION* ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *) ((UINTN) (SelfLoadedImage->ImageBase) + PeCoffHeaderOffset);
EFI_IMAGE_SECTION_HEADER* SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINTN) ImgHdr + sizeof(UINT32) + sizeof(EFI_IMAGE_FILE_HEADER) + ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader);
for (int Index = 0; Index < ImgHdr->Pe32.FileHeader.NumberOfSections; Index++, SectionHeader++)
{
DBG("name=%a\n", SectionHeader->Name);
if (AsciiStrCmp((CONST CHAR8*) SectionHeader->Name, ".data") == 0)
{
DBG("SectionHeader->PointerToRawData=%8x\n", SectionHeader->PointerToRawData);
ctor_ptr* myctor = (ctor_ptr*) (((UINTN) (SelfLoadedImage->ImageBase)) + SectionHeader->PointerToRawData);
while (myctor < beginning_of_section_next_to_mod_init_func_ptr)
{
DBG("&myctor %x %d\n", (UINTN) (myctor), (UINTN) (myctor));
DBG("myctor %x %d\n", (UINTN) (*myctor), (UINTN) (*myctor));
if (*myctor != NULL) (*myctor)();
myctor++;
}
}
}
}
#elif defined(__GNUC__)
__attribute__((visibility("hidden"))) void *__dso_handle = &__dso_handle;
extern int __beginning_of_section_ctors, __end_of_section_ctors;
ctor_ptr* p = (ctor_ptr*)&__beginning_of_section_ctors;
ctor_ptr* pend = (ctor_ptr*)&__end_of_section_ctors;
void construct_globals_objects() {
DBG("CTOR %x %d\n", (UINTN)p, (UINTN)p);
// DBG("CTOR %x %d\n", (UINTN)p[0], (UINTN)p[0]);
while ( p < pend ) {
DBG("CTOR %x %d\n", (UINTN)p[0], (UINTN)p[0]);
(*p)();
p++;
}
// DBG("CTOR %x %d\n", (UINTN)__CTOR_LIST__, (UINTN)__CTOR_LIST__);
// __do_init();
// const size_t n = __CTOR_LIST_END__ - __CTOR_LIST__ - 1;
// size_t n = 10;
// for (size_t i = 0; i < n; i++) {
// DBG("CTOR %x %d\n", (UINTN)__CTOR_LIST__[i], (UINTN)__CTOR_LIST__[i]);
// }
// __CTOR_LIST__[0]();
}
#elif defined(_MSC_VER)
#endif

View File

@ -0,0 +1,5 @@
/*
* NOTE : SelfLoadedImage must be initialized to call this.
*/
extern void construct_globals_objects();

View File

@ -0,0 +1,105 @@
#include <Platform/Platform.h>
#if 0
#define DBG(...) DebugLog(2, __VA_ARGS__)
#else
#define DBG(...)
#endif
#if defined(__clang__)
typedef void (destructor_func_t)();
#elif defined(__GNUC__)
typedef void (destructor_func_t)(void*);
#else
# error compiler not supported
#endif
typedef destructor_func_t* destructor_func_ptr_t;
struct atexit_func_entry_t
{
destructor_func_ptr_t destructor_func;
#if !defined(__clang__) && defined(__GNUC__)
void *obj_ptr;
void *dso_handle;
#endif
};
static atexit_func_entry_t*atexit_func_entry_array = NULL;
static UINTN atexit_func_entry_count = 0;
static UINTN atexit_func_entry_size = 0;
#if defined (__clang__)
extern "C" int atexit(destructor_func_ptr_t destructor_func)
{
DBG("atexit(%p) sizeof=%d\n", destructor_func, sizeof(atexit_func_entry_t));
#elif defined(__GNUC__)
extern "C" int __cxa_atexit(destructor_func_ptr_t destructor_func, void *objptr, void *dso)
{
DBG("atexit(%p, %p, %p, %d)\n", destructor_func, objptr, dso, sizeof(atexit_func_entry_t));
#endif
if ( !atexit_func_entry_array )
{
DBG("atexit : allocate\n");
atexit_func_entry_array = (atexit_func_entry_t*)AllocatePool(16*sizeof(atexit_func_entry_t));
if ( !atexit_func_entry_array ) {
DBG("atexit : allocate returned NULL\n");
CpuDeadLoop();
}
atexit_func_entry_count = 0;
atexit_func_entry_size = 16;
}
if (atexit_func_entry_count >= atexit_func_entry_size)
{
DBG("atexit : reallocate atexit_func_entry_array=%d\n", (UINTN)atexit_func_entry_array);
atexit_func_entry_array = (atexit_func_entry_t *)ReallocatePool(atexit_func_entry_size*sizeof(atexit_func_entry_t), (atexit_func_entry_size+16)*sizeof(atexit_func_entry_t), atexit_func_entry_array);
if ( !atexit_func_entry_array ) {
DBG("atexit : reallocate returned NULL\n");
CpuDeadLoop();
}
atexit_func_entry_size += 16;
}
atexit_func_entry_array[atexit_func_entry_count].destructor_func = destructor_func;
#if !defined(__clang__) && defined(__GNUC__)
atexit_func_entry_array[atexit_func_entry_count].obj_ptr = objptr;
atexit_func_entry_array[atexit_func_entry_count].dso_handle = dso;
#endif
atexit_func_entry_count++;
DBG("atexit : exit (atexit_func_entry_count=%d)\n", atexit_func_entry_count);
return 0; /*I would prefer if functions returned 1 on success, but the ABI says...*/
}
void destruct_globals_objects(void *f)
{
UINTN i = atexit_func_entry_count;
while (i--)
{
# if defined(__clang__)
DBG("destruct_globals_objects: idx=%d %p\n", i, atexit_func_entry_array[i].destructor_func);
(*atexit_func_entry_array[i].destructor_func)();
atexit_func_entry_array[i].destructor_func = NULL;
atexit_func_entry_count--;
# elif defined(__GNUC__)
DBG("destruct_globals_objects: idx=%d %d, %p, %p\n", i, atexit_func_entry_array[i].destructor_func, atexit_func_entry_array[i].obj_ptr, atexit_func_entry_array[i].dso_handle);
(*atexit_func_entry_array[i].destructor_func)(atexit_func_entry_array[i].obj_ptr);
atexit_func_entry_array[i].destructor_func = NULL;
atexit_func_entry_count--;
# endif
}
}

View File

@ -0,0 +1,4 @@
/*
* Needs to be called manually before exiting Clover.efi module.
*/
void destruct_globals_objects(void *f);

View File

@ -0,0 +1,25 @@
#include <Platform/Platform.h>
#if 0
#define DBG(...) DebugLog(2, __VA_ARGS__)
#else
#define DBG(...)
#endif
void* operator new ( unsigned long count )
{
void* ptr = AllocatePool(count);
if ( !ptr ) {
DebugLog(2, "AllocatePool(%d) returned NULL. Cpu halted\n", count);
CpuDeadLoop();
}
return ptr;
}
void operator delete ( void* ptr ) noexcept
{
return FreePool(ptr);
}

View File

@ -0,0 +1,17 @@
#ifdef __cplusplus
extern "C" {
#endif
/*
* Generated by c++ compiler, but needs to be called manually from main.
*/
void __cxx_global_var_init();
/*
* Needs to be called manually before exiting Clover.efi module.
*/
void __cxa_finalize(void *f);
#ifdef __cplusplus
}
#endif

2999
rEFIt_UEFI/refit/main.cpp Normal file

File diff suppressed because it is too large Load Diff

323
rEFIt_UEFI/refit_cpp.inf Normal file
View File

@ -0,0 +1,323 @@
## @file
# Sample UEFI Application Reference EDKII Module
#
#
# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#
##
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = CLOVER
FILE_GUID = 8F7D7B1E-0E1C-4C98-B12E-4EC99C4081AC
MODULE_TYPE = UEFI_APPLICATION
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00010000
VERSION_STRING = 1.0
ENTRY_POINT = RefitMain
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources]
# EfiLib/GenericBdsLib.h
# EfiLib/BmLib.c
# Platform/DevicePath.c #included into GenericBdsLib
Platform/BdsConnect.c #included into GenericBdsLib
refit/main.cpp
refit/icns.c
refit/lib.c
refit/lib.h
refit/menu.c
refit/screen.c
refit/IO.c
refit/IO.h
entry_scan/common.c
entry_scan/legacy.c
entry_scan/loader.c
entry_scan/tool.c
entry_scan/secureboot.c
entry_scan/securehash.c
entry_scan/securemenu.c
entry_scan/securevars.c
entry_scan/bootscreen.c
entry_scan/lockedgraphics.c
entry_scan/CanonicalDB.h
entry_scan/CloverDB.h
entry_scan/CloverKEK.h
entry_scan/MSKEK.h
entry_scan/MSPCADB.h
entry_scan/MSUEFICADB.h
entry_scan/entry_scan.h
entry_scan/securebootkeys.h
libeg/egemb_icons.c
libeg/egemb_icons_dark.c
libeg/egemb_font.c
libeg/scroll_images.c
libeg/BmLib.c
libeg/image.c
# libeg/load_bmp.c
libeg/load_icns.c
libeg/libscreen.c
libeg/lodepng.c
libeg/lodepng.h
libeg/text.c
libeg/FloatLib.c
libeg/FloatLib.h
libeg/nanosvg.c
libeg/nanosvg.h
libeg/nanosvgrast.c
libeg/VectorGraphics.c
libeg/libeg.h
libeg/libegint.h
Platform/AcpiPatcher.c
Platform/ati_reg.h
Platform/AmlGenerator.c
Platform/AmlGenerator.h
Platform/ati.c
Platform/ati.h
# Platform/BiosVideo.h
# Platform/Bmp.h
Platform/boot.h
Platform/BootLog.c
Platform/BootOptions.c
Platform/Console.c
Platform/cpu.c
Platform/DataHubCpu.c
# Platform/DataHubRecords.h
Platform/device_inject.c
Platform/device_inject.h
# Platform/device_tree.c
# Platform/device_tree.h
Platform/Edid.c
Platform/Events.c
Platform/hda.c
Platform/hda.h
Platform/HdaCodecDump.c
Platform/HdaCodecDump.h
Platform/gma.c
Platform/gma.h
Platform/guid.c
Platform/Injectors.c
Platform/LegacyBiosThunk.c
Platform/LegacyBiosThunk.h
Platform/LegacyBoot.c
Platform/memvendors.h
Platform/nvidia.c
Platform/nvidia.h
# Platform/pci.c
# Platform/picopng.c
# Platform/picopng.h
Platform/Platform.h
Platform/platformdata.c
Platform/plist.c
Platform/Pointer.c
Platform/Settings.c
Platform/smbios.c
# Platform/SmBios.h
Platform/spd.c
Platform/spd.h
Platform/string.c
Platform/string.h
Platform/StateGenerator.c
Platform/StateGenerator.h
# Platform/stringTable.c
Platform/usbfix.c
# Platform/UsbMass.h
# Platform/UsbMassBoot.h
# Platform/UsbMassImpl.h
# Platform/VesaBiosExtensions.h
Platform/b64cdecode.h
Platform/b64cdecode.c
Platform/FixBiosDsdt.c
Platform/loader.h
Platform/LoaderUefi.h
Platform/kernel_patcher.h
Platform/kernel_patcher.c
Platform/kext_patcher.c
Platform/kext_inject.c
Platform/kext_inject.h
Platform/Nvram.c
Platform/card_vlist.c
Platform/PlatformDriverOverride.c
Platform/Hibernate.c
Platform/Net.c
Platform/sound.c
Platform/StartupSound.c
Platform/sse3_patcher.h
Platform/sse3_5_patcher.h
Version.h
cpp_util/XStringW.h
cpp_util/XStringW.cpp
cpp_util/global1.cpp
cpp_util/global2.cpp
cpp_util/globals_ctor.cpp
cpp_util/globals_ctor.h
cpp_util/globals_dtor.cpp
cpp_util/globals_dtor.h
cpp_util/operatorNewDelete.cpp
cpp_util/operatorNewDelete.h
[Sources.IA32]
libeg/ftol.asm | MSFT
[Packages]
CloverPkg.dec
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
NetworkPkg/NetworkPkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
[LibraryClasses]
UefiApplicationEntryPoint
UefiBootServicesTableLib
UefiLib
MemoryAllocationLib
BaseMemoryLib
BaseLib
DevicePathLib
DeviceTreeLib
DebugLib
DxeServicesLib
DxeServicesTableLib
HdaDevicesLib
HobLib
IoLib
# HiiLib
# EfiFileLib
PeCoffLib
# GenericBdsLib
MemLogLib
VideoBiosPatchLib
OpensslLib
NetLib
WaveLib
[Guids]
gEfiAcpiTableGuid
gEfiAcpi10TableGuid
gEfiAcpi20TableGuid
gEfiAppleBootGuid
gEfiAppleNvramGuid
gEfiAppleVendorGuid
gAppleCoreStorageVariableGuid
gAppleTamperResistantBootVariableGuid
gAppleWirelessNetworkVariableGuid
gApplePersonalizationVariableGuid
gAppleNetbootVariableGuid
gAppleSecureBootVariableGuid
gAppleTamperResistantBootSecureVariableGuid
gAppleTamperResistantBootEfiUserVariableGuid
gEfiDxeServicesTableGuid
gEfiEventReadyToBootGuid
gEfiEventVirtualAddressChangeGuid
gEfiEventExitBootServicesGuid
gEfiFileInfoGuid ## CONSUMES ## GUID
gEfiFileSystemInfoGuid ## CONSUMES ## GUID
gEfiFileSystemVolumeLabelInfoIdGuid
gEfiGlobalVariableGuid
gEfiPartTypeLegacyMbrGuid
gEfiPartTypeSystemPartGuid
gEfiSmbiosTableGuid
gEfiSmbios3TableGuid
gEfiSasDevicePathGuid
gEfiImageSecurityDatabaseGuid
gEfiCertX509Guid
gEfiCertSha1Guid
gEfiCertSha256Guid
gEfiCertPkcs7Guid
gEfiCertRsa2048Guid
gEfiCertRsa2048Sha256Guid
gEfiCertTypeRsa2048Sha256Guid
gAppleOsLoadedNamedEventGuid
gBootChimeVendorVariableGuid
[Ppis]
[Protocols]
gEfiComponentName2ProtocolGuid # ALWAYS_CONSUMED
gEfiDevicePathToTextProtocolGuid # ALWAYS_CONSUMED
gEfiSimpleFileSystemProtocolGuid # ALWAYS_CONSUMED
gEfiSimpleTextInProtocolGuid # ALWAYS_CONSUMED
gEfiSimpleTextInputExProtocolGuid # ALWAYS_CONSUMED
gEfiSimpleTextOutProtocolGuid # ALWAYS_CONSUMED
gEfiUnicodeCollationProtocolGuid # ALWAYS_CONSUMED
gEfiUnicodeCollation2ProtocolGuid # ALWAYS_CONSUMED
gEfiAcpiS3SaveProtocolGuid # PROTOCOL CONSUMES
gEfiBlockIoProtocolGuid # PROTOCOL CONSUMES
gEfiCpuArchProtocolGuid # PROTOCOL CONSUMES
gEfiDebugPortProtocolGuid # PROTOCOL CONSUMES
gEfiDevicePathProtocolGuid # PROTOCOL CONSUMES
gEfiDiskIoProtocolGuid # PROTOCOL CONSUMES
gEfiExtScsiPassThruProtocolGuid ## PROTOCOL SOMETIMES_CONSUMES
gEfiFirmwareVolume2ProtocolGuid # PROTOCOL CONSUMES
gEfiGraphicsOutputProtocolGuid # PROTOCOL SOMETIMES_CONSUMES
gEfiHiiFontProtocolGuid # PROTOCOL CONSUMES
gEfiLegacy8259ProtocolGuid ## PROTOCOL SOMETIMES_CONSUMES
gEfiLoadedImageProtocolGuid # PROTOCOL CONSUMES
gEfiOEMBadgingProtocolGuid # PROTOCOL CONSUMES
gEfiPciIoProtocolGuid # PROTOCOL CONSUMES
gEfiScsiIoProtocolGuid ## PROTOCOL SOMETIMES_CONSUMES
gEfiScsiPassThruProtocolGuid ## PROTOCOL SOMETIMES_CONSUMES
gEfiSimpleNetworkProtocolGuid # PROTOCOL CONSUMES
gEfiStatusCodeRuntimeProtocolGuid # PROTOCOL CONSUMES
gEfiUgaDrawProtocolGuid |PcdUgaConsumeSupport # PROTOCOL SOMETIMES_CONSUMES
gEfiManagedNetworkServiceBindingProtocolGuid
gEfiAbsolutePointerProtocolGuid
gEfiAcpiTableProtocolGuid
gEfiEdidActiveProtocolGuid
gEfiEdidDiscoveredProtocolGuid
gEfiEdidOverrideProtocolGuid
gEfiHiiDatabaseProtocolGuid
gEfiHiiImageProtocolGuid
gEfiHiiProtocolGuid
gEfiSimplePointerProtocolGuid
gEfiSmbiosProtocolGuid
gEfiSecurityArchProtocolGuid
gEfiSecurity2ArchProtocolGuid
gAppleDevicePropertyProtocolGuid
gAppleFramebufferInfoProtocolGuid
gEfiConsoleControlProtocolGuid
gAppleGraphConfigProtocolGuid
gEfiLegacyBiosProtocolGuid
gEfiTimerArchProtocolGuid
gAppleImageCodecProtocolGuid
gAppleEventProtocolGuid
gEfiOSInfoProtocolGuid
gEfiKeyboardInfoProtocolGuid
gFSInjectProtocolGuid
gMsgLogProtocolGuid
gEfiPlatformDriverOverrideProtocolGuid
gEmuVariableControlProtocolGuid
gEfiAudioIoProtocolGuid # CONSUMES
[FeaturePcd]
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
[Pcd]
[BuildOptions]
# XCODE:*_*_*_CC_FLAGS = -fsigned-char -O2 -fno-common
XCODE:*_*_*_CC_FLAGS = -fsigned-char -O2 -fno-omit-frame-pointer -ffreestanding -fno-rtti -fno-exceptions -Wno-deprecated -Wno-writable-strings -Wno-unused-const-variable
XCODE:*_*_*_DLINK_FLAGS = -order_file $(EDK_TOOLS_PATH)/Scripts/ClangLinkOrder.txt
GCC:*_*_*_CC_FLAGS = -std=c99 -Os -fno-omit-frame-pointer -maccumulate-outgoing-args
GCC:*_*_*_CXX_FLAGS = -std=c++11 -Os -fno-omit-frame-pointer -maccumulate-outgoing-args -ffreestanding -fno-rtti -fno-exceptions -Wno-deprecated -Wno-write-strings -Wno-unused-const-variable
MSFT:*_*_*_CC_FLAGS = /Os /wd4201

284
xbuildme Executable file
View File

@ -0,0 +1,284 @@
#!/bin/bash
# created by vector sigma on July 15 2019
# github version
# Linux users should be able to use this wrapper, although the following are needed:
# gcc (check for ./build_gcc8.sh or newer)
# python (sudo apt-get install python)
# uuid-dev (sudo apt-get install uuid-dev)
# git (sudo apt-get install git)
# $1 argument override MYTOOLCHAIN variable, in case you want GCC53 for example
cd "$(dirname $0)"
declare -r CLOVERROOT="$PWD"
declare -r MYTOOLCHAIN=${1:-GCC53}
TOOLCHAIN_DIR=${TOOLCHAIN_DIR:-$(dirname $CLOVERROOT)/opt/local}
# Functions
pathmunge() {
if [[ ! $PATH =~ (^|:)$1(:|$) ]]; then
if [[ "${2:-}" = "after" ]]; then
export PATH=$PATH:$1
else
export PATH=$1:$PATH
fi
fi
}
checkXCODE() {
echo "[CHECK XCODE]"
if [[ ! -x /usr/bin/xcodebuild ]]; then
echo "ERROR: Install Xcode Tools from Apple before using this script."
exit 1
fi
if [[ ! -d "$(xcode-select --print-path)" ]]; then
echo "ERROR: Xcode Command Line Tools not selected:"
echo " open Xcode.app and go in Preferences->Locations,"
echo " and select the Command Line Tools"
exit 1
fi
}
checkGETTEXT() {
if [[ ! -x $(which gettext) ]]; then
"${CLOVERROOT}"/buildgettext.sh
fi
}
exportPaths() {
if [[ "$(uname)" == Darwin ]]; then
pathmunge "$(xcode-select --print-path)"/usr/bin
fi
pathmunge "$TOOLCHAIN_DIR"/bin
export TOOLCHAIN_DIR=$TOOLCHAIN_DIR
export DIR_MAIN=${DIR_MAIN:-$(dirname $CLOVERROOT)}
export DIR_TOOLS=${DIR_TOOLS:-$DIR_MAIN/tools}
export DIR_DOWNLOADS=${DIR_DOWNLOADS:-$DIR_TOOLS/download}
export DIR_LOGS=${DIR_LOGS:-$DIR_TOOLS/logs}
}
checkTools() {
if [[ "$(uname)" == Darwin && $MYTOOLCHAIN != GCC* ]]; then
checkXCODE
fi
exportPaths
if [[ "$(uname)" == Darwin ]]; then
checkGETTEXT
fi
}
updateClover() {
echo "[UPDATE CLOVER]"
cd "${CLOVERROOT}"
if [[ -d .git ]]; then
git fetch --all
git pull origin master
else
echo "Error: this is not a git repository, can't update!"
fi
}
updateResetClover() {
echo "[UPDATE RESET CLOVER]"
cd "${CLOVERROOT}"
if [[ -d .git ]]; then
git fetch --all
git reset --hard origin/master
git pull origin master
else
echo "Error: this is not a git repository, can't update!"
fi
}
buildClover() {
checkTools
cd "${CLOVERROOT}"
if [[ -z "$WORKSPACE" ]]; then
export EDK_TOOLS_PATH="${PWD}"/BaseTools
set +u
source ./edksetup.sh BaseTools
set -u
cd "$CLOVERROOT"
WORKSPACE="${PWD}"
fi
echo "[BUILD CLOVER]"
# Run a custom build script if exist (~/src/tools/Scripts/build.sh)
# This allow the user to run ebuild.sh with own parameters
if [[ -x "${DIR_TOOLS}"/Scripts/build.sh ]]; then
echo "Running custom build script"
"${DIR_TOOLS}"/Scripts/build.sh "${CLOVERROOT}" $MYTOOLCHAIN
else
./ebuild.sh -fr -t $MYTOOLCHAIN
./ebuild.sh -fr -mc --no-usb -D NO_GRUB_DRIVERS_EMBEDDED -t $MYTOOLCHAIN
fi
# Run a post build script if exist (~/src/tools/Scripts/postbuild.sh)
if [[ -x "${DIR_TOOLS}"/Scripts/postbuild.sh ]]; then
echo "Running postbuild script"
"${DIR_TOOLS}"/Scripts/postbuild.sh "${CLOVERROOT}" $MYTOOLCHAIN
fi
}
buildCloverTest() {
checkTools
cd "${CLOVERROOT}"
if [[ -z "$WORKSPACE" ]]; then
export EDK_TOOLS_PATH="${PWD}"/BaseTools
set +u
source ./edksetup.sh BaseTools
set -u
cd "$CLOVERROOT"
WORKSPACE="${PWD}"
fi
echo "[BUILD CLOVER TEST]"
./ebuild.sh -t $MYTOOLCHAIN
}
buildPkg() {
cd "${CLOVERROOT}"/CloverPackage
echo "[BUILD PKG]"
make pkg
}
buildIso() {
cd "${CLOVERROOT}"/CloverPackage
echo "[BUILD ISO]"
make iso
}
checkStatus() {
cd "${CLOVERROOT}"
if [[ -d .git ]]; then
git fetch origin
git status
else
echo "Error: this is not a git repository, can't get info!"
fi
}
showdiff() {
cd "${CLOVERROOT}"
if [[ -d .git ]]; then
git fetch origin
git diff
else
echo "Error: this is not a git repository, can't get info!"
fi
}
cleanBaseTools() {
cd "${CLOVERROOT}"/BaseTools
make clean
}
menu() {
echo
echo '------------------------------------------------------------------------'
cd "${CLOVERROOT}"
local lsha1="not a git repo"
if [[ -d .git ]]; then
lsha1=$(git rev-parse --short HEAD)
fi
echo "buildme, Clover v2.5k r$(cat vers.txt) (SHA: $lsha1)"
echo "TOOLCHAIN: $MYTOOLCHAIN (override example: './buildme GCC53')"
echo
PS3='Please enter your choice: '
options=( 'build Clover'
'make pkg'
'make iso'
'build all'
'test build (no autogen, no boot files)'
'status'
'update Clover'
'update Clover (reset changes)'
'show diff'
'open drivers directory'
'clean BaseTools'
'quit')
select opt in "${options[@]}"
do
case $opt in
"build Clover")
buildClover
break
;;
"make pkg")
buildPkg
break
;;
"make iso")
buildIso
break
;;
"build all")
buildClover
buildPkg
buildIso
break
;;
"test build (no autogen, no boot files)")
buildCloverTest
break
;;
"update Clover")
updateClover
break
;;
"update Clover (reset changes)")
updateResetClover
break
;;
"status")
checkStatus
break
;;
"show diff")
showdiff
break
;;
"open drivers directory")
if [[ -d "${CLOVERROOT}"/CloverPackage/CloverV2/EFI/CLOVER/drivers ]]; then
open "${CLOVERROOT}"/CloverPackage/CloverV2/EFI/CLOVER/drivers
else
echo && echo "Directory not found. Compile Clover first!!"
sleep 2
fi
break
;;
"clean BaseTools")
cleanBaseTools
break
;;
"quit")
exit 0
;;
*)
echo "invalid option $REPLY"
break
;;
esac
done
menu
}
# Main
set -e
menu