]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Add sample help information for HelloWorld application.
authorQiu Shumin <shumin.qiu@intel.com>
Sun, 21 Feb 2016 07:55:14 +0000 (15:55 +0800)
committerQiu Shumin <shumin.qiu@intel.com>
Wed, 24 Feb 2016 07:11:14 +0000 (15:11 +0800)
Since Shell supports finding help information from resource section
of application image. We enhance the HelloWorld to add help information
string. After the HelloWorld are loaded in system the help string will
be stored in resource section of the application image.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdeModulePkg/Application/HelloWorld/HelloWorld.c
MdeModulePkg/Application/HelloWorld/HelloWorld.inf
MdeModulePkg/Application/HelloWorld/HelloWorldStr.uni [new file with mode: 0644]

index 1821b2dd7642a85b6839ecc21e1f132120b225a1..164571bfb0ce43ce393d7f37939a7bad7bff7f44 100644 (file)
@@ -2,7 +2,7 @@
   This sample application bases on HelloWorld PCD setting \r
   to print "UEFI Hello World!" to the UEFI Console.\r
 \r
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials                          \r
   are licensed and made available under the terms and conditions of the BSD License         \r
   which accompanies this distribution.  The full text of the license may be found at        \r
 #include <Library/UefiLib.h>\r
 #include <Library/UefiApplicationEntryPoint.h>\r
 \r
+//\r
+// String token ID of help message text.\r
+// Shell supports to find help message in the resource section of an application image if\r
+// .MAN file is not found. This global variable is added to make build tool recognizes\r
+// that the help string is consumed by user and then build tool will add the string into\r
+// the resource section. Thus the application can use '-?' option to show help message in\r
+// Shell.\r
+//\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId = STRING_TOKEN (STR_HELLO_WORLD_HELP_INFORMATION);\r
 \r
 /**\r
   The user Entry Point for Application. The user code starts with this function\r
index 6514ef32ec1c91d2e8e03b3080c9172c3a2c2fe0..2240e17b72fea61962e99150b4e33e207420de53 100644 (file)
@@ -6,7 +6,7 @@
 #\r
 #  It demos how to use EDKII PCD mechanism to make code more flexible.\r
 #\r
-#  Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
   VERSION_STRING                 = 1.0\r
   ENTRY_POINT                    = UefiMain\r
 \r
+#\r
+#  This flag specifies whether HII resource section is generated into PE image.\r
+#\r
+  UEFI_HII_RESOURCE_SECTION      = TRUE\r
+\r
 #\r
 # The following information is for reference only and not required by the build tools.\r
 #\r
@@ -35,6 +40,7 @@
 \r
 [Sources]\r
   HelloWorld.c\r
+  HelloWorldStr.uni\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
diff --git a/MdeModulePkg/Application/HelloWorld/HelloWorldStr.uni b/MdeModulePkg/Application/HelloWorld/HelloWorldStr.uni
new file mode 100644 (file)
index 0000000..3b8b33a
--- /dev/null
@@ -0,0 +1,27 @@
+// /** @file\r
+// Sample UEFI Application Reference EDKII Module.\r
+//\r
+// This is a sample shell application that will print "UEFI Hello World!" to the\r
+// UEFI Console based on PCD setting.\r
+//\r
+// It demos how to use EDKII PCD mechanism to make code more flexible.\r
+//\r
+// Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+//\r
+// This program and the accompanying materials\r
+// are licensed and made available under the terms and conditions of the BSD License\r
+// which accompanies this distribution. The full text of the license may be found at\r
+// http://opensource.org/licenses/bsd-license.php\r
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+//\r
+// **/\r
+\r
+/=#\r
+\r
+#langdef en-US "English"\r
+\r
+#string STR_HELLO_WORLD_HELP_INFORMATION        #language en-US ""\r
+".TH HelloWorld 0 "Displays a \"UEFI Hello World!\" string."\r\n"\r
+".SH NAME\r\n"\r
+"HelloWorld application.\r\n"\r