diff options
author | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
---|---|---|
committer | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/edk2/MdeModulePkg/Application/HelloWorld | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/edk2/MdeModulePkg/Application/HelloWorld')
5 files changed, 172 insertions, 0 deletions
diff --git a/roms/edk2/MdeModulePkg/Application/HelloWorld/HelloWorld.c b/roms/edk2/MdeModulePkg/Application/HelloWorld/HelloWorld.c new file mode 100644 index 000000000..e45a3746e --- /dev/null +++ b/roms/edk2/MdeModulePkg/Application/HelloWorld/HelloWorld.c @@ -0,0 +1,60 @@ +/** @file
+ This sample application bases on HelloWorld PCD setting
+ to print "UEFI Hello World!" to the UEFI Console.
+
+ Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <Library/PcdLib.h>
+#include <Library/UefiLib.h>
+#include <Library/UefiApplicationEntryPoint.h>
+
+//
+// String token ID of help message text.
+// Shell supports to find help message in the resource section of an application image if
+// .MAN file is not found. This global variable is added to make build tool recognizes
+// that the help string is consumed by user and then build tool will add the string into
+// the resource section. Thus the application can use '-?' option to show help message in
+// Shell.
+//
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_HELLO_WORLD_HELP_INFORMATION);
+
+/**
+ The user Entry Point for Application. The user code starts with this function
+ as the real entry point for the application.
+
+ @param[in] ImageHandle The firmware allocated handle for the EFI image.
+ @param[in] SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The entry point is executed successfully.
+ @retval other Some error occurs when executing this entry point.
+
+**/
+EFI_STATUS
+EFIAPI
+UefiMain (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ UINT32 Index;
+
+ Index = 0;
+
+ //
+ // Three PCD type (FeatureFlag, UINT32 and String) are used as the sample.
+ //
+ if (FeaturePcdGet (PcdHelloWorldPrintEnable)) {
+ for (Index = 0; Index < PcdGet32 (PcdHelloWorldPrintTimes); Index ++) {
+ //
+ // Use UefiLib Print API to print string to UEFI console
+ //
+ Print ((CHAR16*)PcdGetPtr (PcdHelloWorldPrintString));
+ }
+ }
+
+ return EFI_SUCCESS;
+}
diff --git a/roms/edk2/MdeModulePkg/Application/HelloWorld/HelloWorld.inf b/roms/edk2/MdeModulePkg/Application/HelloWorld/HelloWorld.inf new file mode 100644 index 000000000..4520a370e --- /dev/null +++ b/roms/edk2/MdeModulePkg/Application/HelloWorld/HelloWorld.inf @@ -0,0 +1,57 @@ +## @file
+# Sample UEFI Application Reference EDKII Module.
+#
+# This is a sample shell application that will print "UEFI Hello World!" to the
+# UEFI Console based on PCD setting.
+#
+# It demos how to use EDKII PCD mechanism to make code more flexible.
+#
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = HelloWorld
+ MODULE_UNI_FILE = HelloWorld.uni
+ FILE_GUID = 6987936E-ED34-44db-AE97-1FA5E4ED2116
+ MODULE_TYPE = UEFI_APPLICATION
+ VERSION_STRING = 1.0
+ ENTRY_POINT = UefiMain
+
+#
+# This flag specifies whether HII resource section is generated into PE image.
+#
+ UEFI_HII_RESOURCE_SECTION = TRUE
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 EBC
+#
+
+[Sources]
+ HelloWorld.c
+ HelloWorldStr.uni
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+ UefiApplicationEntryPoint
+ UefiLib
+ PcdLib
+
+[FeaturePcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintEnable ## CONSUMES
+
+[Pcd]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintString ## SOMETIMES_CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintTimes ## SOMETIMES_CONSUMES
+
+[UserExtensions.TianoCore."ExtraFiles"]
+ HelloWorldExtra.uni
diff --git a/roms/edk2/MdeModulePkg/Application/HelloWorld/HelloWorld.uni b/roms/edk2/MdeModulePkg/Application/HelloWorld/HelloWorld.uni new file mode 100644 index 000000000..aade016c6 --- /dev/null +++ b/roms/edk2/MdeModulePkg/Application/HelloWorld/HelloWorld.uni @@ -0,0 +1,19 @@ +// /** @file
+// Sample UEFI Application Reference EDKII Module.
+//
+// This is a sample shell application that will print "UEFI Hello World!" to the
+// UEFI Console based on PCD setting.
+//
+// It demos how to use EDKII PCD mechanism to make code more flexible.
+//
+// Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "Sample UEFI Application Reference EDKII Module"
+
+#string STR_MODULE_DESCRIPTION #language en-US "This is a sample shell application that will print UEFI Hello World! to the UEFI Console based on PCD setting. It demonstrates how to use the EDKII PCD mechanism to make code more flexible"
+
diff --git a/roms/edk2/MdeModulePkg/Application/HelloWorld/HelloWorldExtra.uni b/roms/edk2/MdeModulePkg/Application/HelloWorld/HelloWorldExtra.uni new file mode 100644 index 000000000..70dd81e87 --- /dev/null +++ b/roms/edk2/MdeModulePkg/Application/HelloWorld/HelloWorldExtra.uni @@ -0,0 +1,14 @@ +// /** @file
+// HelloWorld Localized Strings and Content
+//
+// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+#string STR_PROPERTIES_MODULE_NAME
+#language en-US
+"Hello World Application"
+
+
diff --git a/roms/edk2/MdeModulePkg/Application/HelloWorld/HelloWorldStr.uni b/roms/edk2/MdeModulePkg/Application/HelloWorld/HelloWorldStr.uni new file mode 100644 index 000000000..eb03b78dd --- /dev/null +++ b/roms/edk2/MdeModulePkg/Application/HelloWorld/HelloWorldStr.uni @@ -0,0 +1,22 @@ +// /** @file
+// Sample UEFI Application Reference EDKII Module.
+//
+// This is a sample shell application that will print "UEFI Hello World!" to the
+// UEFI Console based on PCD setting.
+//
+// It demos how to use EDKII PCD mechanism to make code more flexible.
+//
+// Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+/=#
+
+#langdef en-US "English"
+
+#string STR_HELLO_WORLD_HELP_INFORMATION #language en-US ""
+".TH HelloWorld 0 "Displays a \"UEFI Hello World!\" string."\r\n"
+".SH NAME\r\n"
+"HelloWorld application.\r\n"
|