mirror of
https://github.com/acidanthera/OpenCorePkg.git
synced 2025-12-08 19:25:01 +00:00
Build: Add Windows binaries and cleanup buildscripts (#65)
This commit is contained in:
parent
0c70319eb0
commit
05aeb6d573
@ -3,6 +3,7 @@ env:
|
||||
global:
|
||||
- FORCE_INSTALL=1
|
||||
- HAS_OPENSSL_BUILD=1
|
||||
- HAS_OPENSSL_W32BUILD=0
|
||||
- secure: WPHaDUI0jTv7+l1R/5W3vzkP5+6/B7SM/VpF7PeVQAC5emWOC/BgNLurosjHUfYWE8Fs9sRYYsv6GXvU5n64gyMQhBQInmrEezfbc/LkP1cj+q5jUzFkJvlmFSIY+b570OPzXoIaR0ydmB80UgOezYvqjjDvI3TGXt+JY8Dp6oljqUuRy647UUkH52E7LKW/+Zh7Yq5sx3VJoBeSLrnl/CVUff4T6onITz2jHYNAf0kK/Yo5whcWpz0L+EGwhHUb8TJfQXMyL2PBQRZMbOBwfhFzFDC+j5uaJ4PYEqSRn+cemQhazDAUbNx7kVi1hMsLZZMRIG56zPJPV7DRM2ggCYaFSf0S/Ifm4e5Dj7TyM3uNqs55tGaJd/fHrNcr95bge/kn9yhqc0Lvm+oIiAKGhMnwwFymqLXxWRWYGCSp5zb8BAdUTrVZaLOA/siyNu6I+y0uPbdF8FFTgmJzKGEI09fRnn2o50Ott087E+hr7Xqr1g4OCmHdNX26uAS5gIwTfMVDLL86+gyY2gDBa9yN3HQrJKmppWjt02sR+1McvZY8Z6CjnlwiAUcMudJc9p2f5W3Mnxxv9Snz+fMGSmgCtc3uSWCrHegHHSm70+0/BDN88WLBY5X35cs821GXuFxvOndisZebjiunCtlRu0W0xQISCQ+Dw20xFhgN7aZiN34=
|
||||
|
||||
matrix:
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
.DEFAULT_GOAL := all
|
||||
|
||||
CC ?= gcc
|
||||
MKDIR := mkdir -p
|
||||
|
||||
ifeq ($(UDK_PATH),)
|
||||
ifneq ($(PACKAGES_PATH),)
|
||||
@ -15,8 +16,6 @@ ifeq ($(UDK_PATH),)
|
||||
endif
|
||||
endif
|
||||
|
||||
UDK_ARCH ?= X64
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
DIST ?= Windows
|
||||
else
|
||||
@ -33,7 +32,11 @@ ifeq ($(DIST),Darwin)
|
||||
endif
|
||||
|
||||
ifeq ($(DIST),Windows)
|
||||
SUFFIX := .exe
|
||||
SUFFIX := .exe
|
||||
CFLAGS += -D_ISOC99_SOURCE=1
|
||||
UDK_ARCH ?= Ia32
|
||||
else
|
||||
UDK_ARCH ?= X64
|
||||
endif
|
||||
|
||||
ifeq ($(SANITIZE),1)
|
||||
@ -43,10 +46,18 @@ endif
|
||||
|
||||
ifeq ($(DEBUG),1)
|
||||
CFLAGS += -g -O0
|
||||
#
|
||||
# Forcibly disable stripping when enabling DEBUG mode.
|
||||
#
|
||||
STRIP := @echo No strip in DEBUG mode
|
||||
STRIPFLAGS :=
|
||||
else
|
||||
CFLAGS += -O3
|
||||
STRIP := strip -x
|
||||
#
|
||||
# Default strip command with overriding (e.g. i686-w64-mingw32-strip) allowed.
|
||||
#
|
||||
STRIP ?= strip
|
||||
STRIPFLAGS ?= -x
|
||||
endif
|
||||
|
||||
#
|
||||
@ -87,14 +98,18 @@ ifneq ($(STANDALONE),1)
|
||||
../../Library/OcGuardLib
|
||||
endif
|
||||
|
||||
%.o: %.c
|
||||
OUT_DIR := $(DIST)_$(UDK_ARCH)
|
||||
OBJS := $(addprefix $(OUT_DIR)/,$(OBJS))
|
||||
|
||||
$(OUT_DIR)/%.o: %.c
|
||||
@$(MKDIR) $(OUT_DIR)
|
||||
$(CC) $(CFLAGS) $< -o $@
|
||||
|
||||
all: $(PRODUCT)
|
||||
|
||||
$(PRODUCT): $(OBJS)
|
||||
$(CC) $(LDFLAGS) $(OBJS) -o $(PRODUCT)
|
||||
$(STRIP) $(PRODUCT)
|
||||
$(STRIP) $(STRIPFLAGS) $(PRODUCT)
|
||||
|
||||
clean:
|
||||
rm -rf *.o *.dSYM $(PRODUCT)
|
||||
rm -rf $(OUT_DIR) $(PRODUCT)
|
||||
|
||||
@ -77,7 +77,7 @@ int main(int argc, char** argv) {
|
||||
OC_GLOBAL_CONFIG Config;
|
||||
OcConfigurationInit (&Config, b, f);
|
||||
|
||||
DEBUG ((EFI_D_ERROR, "Done in %llu ms\n", current_timestamp() - a));
|
||||
DEBUG ((EFI_D_ERROR, "Done checking %s in %llu ms\n", argc > 1 ? argv[1] : "./config.plist", current_timestamp() - a));
|
||||
|
||||
OcConfigurationFree (&Config);
|
||||
|
||||
|
||||
177
build_oc.tool
177
build_oc.tool
@ -20,7 +20,20 @@ buildutil() {
|
||||
pushd "${selfdir}/Utilities" || exit 1
|
||||
for util in "${UTILS[@]}"; do
|
||||
cd "$util" || exit 1
|
||||
echo "Building ${util}..."
|
||||
make || exit 1
|
||||
#
|
||||
# FIXME: Do not build RsaTool for Win32 without OpenSSL.
|
||||
#
|
||||
if [ "$util" = "RsaTool" ] && [ "$HAS_OPENSSL_W32BUILD" != "1" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "$(which i686-w64-mingw32-gcc)" != "" ]; then
|
||||
echo "Building ${util} for Windows..."
|
||||
CC=i686-w64-mingw32-gcc STRIP=i686-w64-mingw32-strip DIST=Windows make clean || exit 1
|
||||
CC=i686-w64-mingw32-gcc STRIP=i686-w64-mingw32-strip DIST=Windows make || exit 1
|
||||
fi
|
||||
cd - || exit 1
|
||||
done
|
||||
popd || exit
|
||||
@ -36,76 +49,128 @@ package() {
|
||||
ver=$(grep OPEN_CORE_VERSION ./Include/Acidanthera/OpenCore.h | sed 's/.*"\(.*\)".*/\1/' | grep -E '^[0-9.]+$')
|
||||
if [ "$ver" = "" ]; then
|
||||
echo "Invalid version $ver"
|
||||
ver="UNKNOWN"
|
||||
fi
|
||||
|
||||
selfdir=$(pwd)
|
||||
pushd "$1" || exit 1
|
||||
rm -rf tmp || exit 1
|
||||
mkdir -p tmp/EFI/BOOT || exit 1
|
||||
mkdir -p tmp/EFI/OC/ACPI || exit 1
|
||||
mkdir -p tmp/EFI/OC/Bootstrap || exit 1
|
||||
mkdir -p tmp/EFI/OC/Drivers || exit 1
|
||||
mkdir -p tmp/EFI/OC/Kexts || exit 1
|
||||
mkdir -p tmp/EFI/OC/Tools || exit 1
|
||||
mkdir -p tmp/EFI/OC/Resources/Audio || exit 1
|
||||
mkdir -p tmp/EFI/OC/Resources/Font || exit 1
|
||||
mkdir -p tmp/EFI/OC/Resources/Image || exit 1
|
||||
mkdir -p tmp/EFI/OC/Resources/Label || exit 1
|
||||
mkdir -p tmp/Docs/AcpiSamples || exit 1
|
||||
mkdir -p tmp/Utilities || exit 1
|
||||
|
||||
dirs=(
|
||||
"tmp/EFI/BOOT"
|
||||
"tmp/EFI/OC/ACPI"
|
||||
"tmp/EFI/OC/Bootstrap"
|
||||
"tmp/EFI/OC/Drivers"
|
||||
"tmp/EFI/OC/Kexts"
|
||||
"tmp/EFI/OC/Tools"
|
||||
"tmp/EFI/OC/Resources/Audio"
|
||||
"tmp/EFI/OC/Resources/Font"
|
||||
"tmp/EFI/OC/Resources/Image"
|
||||
"tmp/EFI/OC/Resources/Label"
|
||||
"tmp/Docs/AcpiSamples"
|
||||
"tmp/Utilities"
|
||||
)
|
||||
for dir in "${dirs[@]}"; do
|
||||
mkdir -p "${dir}" || exit 1
|
||||
done
|
||||
|
||||
# copy OpenCore main program.
|
||||
cp OpenCore.efi tmp/EFI/OC/ || exit 1
|
||||
|
||||
# Mark binaries to be recognisable by OcBootManagementLib.
|
||||
dd if="${selfdir}/Library/OcBootManagementLib/BootSignature.bin" \
|
||||
of=BOOTx64.efi seek=64 bs=1 count=64 conv=notrunc || exit 1
|
||||
dd if="${selfdir}/Library/OcBootManagementLib/BootSignature.bin" \
|
||||
of=OpenCore.efi seek=64 bs=1 count=64 conv=notrunc || exit 1
|
||||
cp BootKicker.efi tmp/EFI/OC/Tools/ || exit 1
|
||||
bootsig="${selfdir}/Library/OcBootManagementLib/BootSignature.bin"
|
||||
efiOCBMs=(
|
||||
"BOOTx64.efi"
|
||||
"OpenCore.efi"
|
||||
)
|
||||
for efiOCBM in "${efiOCBMs[@]}"; do
|
||||
dd if="${bootsig}" \
|
||||
of="${efiOCBM}" seek=64 bs=1 count=64 conv=notrunc || exit 1
|
||||
done
|
||||
cp BOOTx64.efi tmp/EFI/BOOT/ || exit 1
|
||||
cp BOOTx64.efi tmp/EFI/OC/Bootstrap/Bootstrap.efi || exit 1
|
||||
cp ChipTune.efi tmp/EFI/OC/Tools/ || exit 1
|
||||
cp CleanNvram.efi tmp/EFI/OC/Tools/ || exit 1
|
||||
cp GopStop.efi tmp/EFI/OC/Tools/ || exit 1
|
||||
cp HdaCodecDump.efi tmp/EFI/OC/Tools/ || exit 1
|
||||
cp HiiDatabase.efi tmp/EFI/OC/Drivers/ || exit 1
|
||||
cp KeyTester.efi tmp/EFI/OC/Tools/ || exit 1
|
||||
cp MmapDump.efi tmp/EFI/OC/Tools/ || exit 1
|
||||
cp ResetSystem.efi tmp/EFI/OC/Tools || exit 1
|
||||
cp RtcRw.efi tmp/EFI/OC/Tools || exit 1
|
||||
cp NvmExpressDxe.efi tmp/EFI/OC/Drivers/ || exit 1
|
||||
cp AudioDxe.efi tmp/EFI/OC/Drivers/ || exit 1
|
||||
cp CrScreenshotDxe.efi tmp/EFI/OC/Drivers/ || exit 1
|
||||
cp OpenCanopy.efi tmp/EFI/OC/Drivers/ || exit 1
|
||||
cp OpenControl.efi tmp/EFI/OC/Tools/ || exit 1
|
||||
cp OpenCore.efi tmp/EFI/OC/ || exit 1
|
||||
cp OpenRuntime.efi tmp/EFI/OC/Drivers/ || exit 1
|
||||
cp OpenUsbKbDxe.efi tmp/EFI/OC/Drivers/ || exit 1
|
||||
cp Ps2MouseDxe.efi tmp/EFI/OC/Drivers/ || exit 1
|
||||
cp Ps2KeyboardDxe.efi tmp/EFI/OC/Drivers/ || exit 1
|
||||
cp UsbMouseDxe.efi tmp/EFI/OC/Drivers/ || exit 1
|
||||
|
||||
efiTools=(
|
||||
"BootKicker.efi"
|
||||
"ChipTune.efi"
|
||||
"CleanNvram.efi"
|
||||
"GopStop.efi"
|
||||
"HdaCodecDump.efi"
|
||||
"KeyTester.efi"
|
||||
"MmapDump.efi"
|
||||
"ResetSystem.efi"
|
||||
"RtcRw.efi"
|
||||
"OpenControl.efi"
|
||||
"VerifyMsrE2.efi"
|
||||
)
|
||||
for efiTool in "${efiTools[@]}"; do
|
||||
cp "${efiTool}" tmp/EFI/OC/Tools/ || exit 1
|
||||
done
|
||||
# Special case: OpenShell.efi
|
||||
cp Shell.efi tmp/EFI/OC/Tools/OpenShell.efi || exit 1
|
||||
cp VerifyMsrE2.efi tmp/EFI/OC/Tools/ || exit 1
|
||||
cp XhciDxe.efi tmp/EFI/OC/Drivers/ || exit 1
|
||||
cp "${selfdir}/Docs/Configuration.pdf" tmp/Docs/ || exit 1
|
||||
cp "${selfdir}/Docs/Differences/Differences.pdf" tmp/Docs/ || exit 1
|
||||
cp "${selfdir}/Docs/Sample.plist" tmp/Docs/ || exit 1
|
||||
cp "${selfdir}/Docs/SampleFull.plist" tmp/Docs/ || exit 1
|
||||
|
||||
efiDrivers=(
|
||||
"HiiDatabase.efi"
|
||||
"NvmExpressDxe.efi"
|
||||
"AudioDxe.efi"
|
||||
"CrScreenshotDxe.efi"
|
||||
"OpenCanopy.efi"
|
||||
"OpenRuntime.efi"
|
||||
"OpenUsbKbDxe.efi"
|
||||
"Ps2MouseDxe.efi"
|
||||
"Ps2KeyboardDxe.efi"
|
||||
"UsbMouseDxe.efi"
|
||||
"XhciDxe.efi"
|
||||
)
|
||||
for efiDriver in "${efiDrivers[@]}"; do
|
||||
cp "${efiDriver}" tmp/EFI/OC/Drivers/ || exit 1
|
||||
done
|
||||
|
||||
docs=(
|
||||
"Configuration.pdf"
|
||||
"Differences/Differences.pdf"
|
||||
"Sample.plist"
|
||||
"SampleFull.plist"
|
||||
)
|
||||
for doc in "${docs[@]}"; do
|
||||
cp "${selfdir}/Docs/${doc}" tmp/Docs/ || exit 1
|
||||
done
|
||||
cp "${selfdir}/Changelog.md" tmp/Docs/ || exit 1
|
||||
cp -r "${selfdir}/Docs/AcpiSamples/" tmp/Docs/AcpiSamples/ || exit 1
|
||||
cp -r "${selfdir}/Utilities/LegacyBoot" tmp/Utilities/ || exit 1
|
||||
cp -r "${selfdir}/Utilities/CreateVault" tmp/Utilities/ || exit 1
|
||||
cp -r "${selfdir}/Utilities/LogoutHook" tmp/Utilities/ || exit 1
|
||||
cp -r "${selfdir}/Utilities/macrecovery" tmp/Utilities/ || exit 1
|
||||
|
||||
|
||||
utilScpts=(
|
||||
"LegacyBoot"
|
||||
"CreateVault"
|
||||
"LogoutHook"
|
||||
"macrecovery"
|
||||
"kpdescribe"
|
||||
)
|
||||
for utilScpt in "${utilScpts[@]}"; do
|
||||
cp -r "${selfdir}/Utilities/${utilScpt}" tmp/Utilities/ || exit 1
|
||||
done
|
||||
|
||||
buildutil || exit 1
|
||||
mkdir -p tmp/Utilities/macserial || exit 1
|
||||
cp "${selfdir}/Utilities/macserial/macserial" tmp/Utilities/macserial || exit 1
|
||||
if [ -f "${selfdir}/Utilities/macserial/macserial.exe" ]; then
|
||||
cp "${selfdir}/Utilities/macserial/macserial.exe" tmp/Utilities/macserial || exit 1
|
||||
fi
|
||||
utils=(
|
||||
"macserial"
|
||||
"ConfigValidity"
|
||||
"disklabel"
|
||||
"icnspack"
|
||||
)
|
||||
for util in "${utils[@]}"; do
|
||||
dest="tmp/Utilities/${util}"
|
||||
mkdir -p "${dest}" || exit 1
|
||||
bin="${selfdir}/Utilities/${util}/${util}"
|
||||
binEXE="${selfdir}/Utilities/${util}/${util}.exe"
|
||||
cp "${bin}" "${dest}" || exit 1
|
||||
if [ -f "${binEXE}" ]; then
|
||||
cp "${binEXE}" "${dest}" || exit 1
|
||||
fi
|
||||
done
|
||||
# additional docs for macserial.
|
||||
cp "${selfdir}/Utilities/macserial/FORMAT.md" tmp/Utilities/macserial/ || exit 1
|
||||
cp "${selfdir}/Utilities/macserial/README.md" tmp/Utilities/macserial/ || exit 1
|
||||
cp "${selfdir}/Utilities/ConfigValidity/ConfigValidity" tmp/Utilities/ || exit 1
|
||||
cp "${selfdir}/Utilities/disklabel/disklabel" tmp/Utilities/ || exit 1
|
||||
cp "${selfdir}/Utilities/icnspack/icnspack" tmp/Utilities/ || exit 1
|
||||
cp "${selfdir}/Utilities/kpdescribe/kpdescribe.sh" tmp/Utilities/ || exit 1
|
||||
|
||||
pushd tmp || exit 1
|
||||
zip -qr -FS ../"OpenCore-${ver}-${2}.zip" ./* || exit 1
|
||||
popd || exit 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user