From da399b0b76385efc830ef089a33990ae6dc2f644 Mon Sep 17 00:00:00 2001 From: PoliEcho Date: Tue, 12 Aug 2025 10:49:20 +0200 Subject: [PATCH] initial commit --- .gitignore | 1 + .gitmodules | 3 +++ UEFI_fireworks.dec | 29 +++++++++++++++++++++++++ UEFI_fireworks.dsc | 28 ++++++++++++++++++++++++ build.sh | 5 +++++ edk2 | 1 + src/UEFI_fireworks/UEFI_fireworks.inf | 31 +++++++++++++++++++++++++++ src/UEFI_fireworks/UefiMain.c | 28 ++++++++++++++++++++++++ 8 files changed, 126 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 UEFI_fireworks.dec create mode 100644 UEFI_fireworks.dsc create mode 100755 build.sh create mode 160000 edk2 create mode 100644 src/UEFI_fireworks/UEFI_fireworks.inf create mode 100644 src/UEFI_fireworks/UefiMain.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d163863 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c879427 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "edk2"] + path = edk2 + url = https://github.com/tianocore/edk2.git diff --git a/UEFI_fireworks.dec b/UEFI_fireworks.dec new file mode 100644 index 0000000..6713129 --- /dev/null +++ b/UEFI_fireworks.dec @@ -0,0 +1,29 @@ +[Defines] + DEC_SPECIFICATION = 0x00010005 + PACKAGE_NAME = UEFI_fireworks + PACKAGE_GUID = E0EBB5C7-E372-485F-AE86-38BF05792885 + PACKAGE_VERSION = 1.0 + +[Includes] + src + +[LibraryClasses] + UefiApplicationEntryPoint|edk2/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf + UefiLib|edk2/MdePkg/Library/UefiLib/UefiLib.inf + BaseLib|edk2/MdePkg/Library/BaseLib/BaseLib.inf + BaseMemoryLib|edk2/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + MemoryAllocationLib|edk2/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + DevicePathLib|edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + UefiBootServicesTableLib|edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf + UefiRuntimeServicesTableLib|edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf + DebugLib|edk2/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + PrintLib|edk2/MdePkg/Library/BasePrintLib/BasePrintLib.inf + PcdLib|edk2/MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + RegisterFilterLib|edk2/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf + + +[Guids] + +[Ppis] + +[Protocols] diff --git a/UEFI_fireworks.dsc b/UEFI_fireworks.dsc new file mode 100644 index 0000000..e0d44ed --- /dev/null +++ b/UEFI_fireworks.dsc @@ -0,0 +1,28 @@ +[Defines] + PLATFORM_NAME = UEFI_fireworks + PLATFORM_GUID = A05265BC-6F89-4969-9CC3-5F2D8C99CF39 + PLATFORM_VERSION = 1.0 + DSC_SPECIFICATION = 0x00010005 + OUTPUT_DIRECTORY = Build/UEFI_fireworks + SUPPORTED_ARCHITECTURES = X64 + BUILD_TARGETS = DEBUG|RELEASE + SKUID_IDENTIFIER = DEFAULT + +[LibraryClasses] +UefiApplicationEntryPoint|edk2/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf +UefiLib|edk2/MdePkg/Library/UefiLib/UefiLib.inf +BaseLib|edk2/MdePkg/Library/BaseLib/BaseLib.inf +BaseMemoryLib|edk2/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf +MemoryAllocationLib|edk2/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf +DevicePathLib|edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf +UefiBootServicesTableLib|edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf +UefiRuntimeServicesTableLib|edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf +DebugLib|edk2/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf +PrintLib|edk2/MdePkg/Library/BasePrintLib/BasePrintLib.inf +PcdLib|edk2/MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf +RegisterFilterLib|edk2/MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf +StackCheckLib|edk2/MdePkg/Library/StackCheckLibNull/StackCheckLibNull.inf + + +[Components] + src/UEFI_fireworks/UEFI_fireworks.inf diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..e9053e8 --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash +export PACKAGES_PATH=$PWD:$PWD/edk2 +build -a X64 -t GCC5 -p UEFI_fireworks.dsc +mkdir -p build +cp edk2/Build/UEFI_fireworks/DEBUG_GCC5/X64/UEFI_fireworks.efi build/ \ No newline at end of file diff --git a/edk2 b/edk2 new file mode 160000 index 0000000..808f1f1 --- /dev/null +++ b/edk2 @@ -0,0 +1 @@ +Subproject commit 808f1f1f87c87b4005d9bdf1076b7fc92ad64736 diff --git a/src/UEFI_fireworks/UEFI_fireworks.inf b/src/UEFI_fireworks/UEFI_fireworks.inf new file mode 100644 index 0000000..23a20bf --- /dev/null +++ b/src/UEFI_fireworks/UEFI_fireworks.inf @@ -0,0 +1,31 @@ +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = UEFI_fireworks + FILE_GUID = 84D67930-D3DD-48F7-8B01-42CE018232AB + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = UefiMain + +[Sources] + UefiMain.c + +[Packages] + edk2/MdePkg/MdePkg.dec + +[LibraryClasses] + UefiApplicationEntryPoint + UefiLib + BaseLib + BaseMemoryLib + MemoryAllocationLib + DevicePathLib + UefiBootServicesTableLib + UefiRuntimeServicesTableLib + DebugLib + PrintLib + +[Protocols] + +[Guids] + +[Pcd] diff --git a/src/UEFI_fireworks/UefiMain.c b/src/UEFI_fireworks/UefiMain.c new file mode 100644 index 0000000..9fa0a7c --- /dev/null +++ b/src/UEFI_fireworks/UefiMain.c @@ -0,0 +1,28 @@ +#include +#include +#include + +EFI_STATUS EFIAPI UefiMain(IN EFI_HANDLE imgHandle, + IN EFI_SYSTEM_TABLE *sysTable) { + gST = sysTable; + gBS = sysTable->BootServices; + gImageHandle = imgHandle; + + // UEFI apps automatically exit after 5 minutes. Stop that here + gBS->SetWatchdogTimer(0, 0, 0, NULL); + + Print(L"Hello, world!\r\n"); + + // Allocate a string + CHAR16 *str = NULL; + gBS->AllocatePool(EfiLoaderData, 36, (VOID **)&str); + + // Copy over a string + CHAR16 *str2 = L"Allocated string\r\n"; + gBS->CopyMem((VOID *)str, (VOID *)str2, 36); + + Print(str); + gBS->FreePool(str); + + return EFI_SUCCESS; +}