Summer internship, find a job as a firmware internship. And I have been pursued there are some gaps. But it is before the accumulation of new knowledge can learn a great help to me.
The first code is still the world hello world embrace it
We need to modify three files
text1.c
text1.inf
Nt32Pkg.dsc
/** @file This is a simple shell application Copyright (c) 2008 - 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. **/ #include <Uefi.h> #include <Library/UefiApplicationEntryPoint.h> #include <Library/UefiLib.h> /** 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 main ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { Print(L"hello world\r\n"); return EFI_SUCCESS; }
## @file # Sample UEFI Application Reference EDKII Module # # This is a simple shell application # # 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 = text1 FILE_GUID = 1D73FF57-579C-40F2-BA4F-851DFE50B614 MODULE_TYPE = UEFI_APPLICATION VERSION_STRING = 1.0 ENTRY_POINT = main # # The following information is for reference only and not required by the build tools. # # VALID_ARCHITECTURES = IA32 X64 IPF EBC # [Sources] text1.c [Packages] MdePkg/MdePkg.dec [LibraryClasses] UefiApplicationEntryPoint UefiLib
In fact, the basic flow is written, it is divided into several steps
- To write a program to copy the template, including at least * .c * .inf file
- * .C file, we need to do two things
- Modify the entry function name you want
- Achieve the desired function in the main function
- * .Inf file, we do the following things
- In defines in
- Modify BASE_NAME -> generated by the module name
- Modify GUID identifier (using VS comes with tools)
- Modify ENTRY_POINT -> entry function name (* .c file corresponding with)
- In the sources, the statements contained in subfolders. In this experiment contains only one file text1.c
- In defines in
- In NT32Pkg find Nt32Pkg.dsc directory, we need to add in a new compilation * .inf file Components in complete statement.
During compilation, there has been little problem. It is to use the root directory build -p Nt32Pkg \ Nt32Pkg.dsc compiled and can not compile a new executable file * .elf
But to use build -p Nt32Pkg \ Nt32Pkg.dsc -a IA32 -m ShellPkg \ Application \ text1 \ text1.inf into the file directory compiler can.
Another problem is that if the output end of the string * .c file without \ r \ n. Character output will lead to failure, I only show orld four characters. He asked the older generation that is due to be covered, specifically unknown