暑期實習,找到一份作固件的實習。跟我一直所追求的仍是有一些差距。不過正是之前的積累,可以對我學習新的知識有很大幫助。php
第一個代碼依然仍是擁抱世界 hello world 啦shell
咱們須要修改三個文件app
text1.cide
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
其實就編寫的基本流程來講,分爲一下幾個步驟學習
在編譯過程當中,出現了一點小問題。就是在根目錄下采用 build -p Nt32Pkg\Nt32Pkg.dsc 編譯後並不能編譯出新的可執行的 *.elf 文件ui
只能採用build -p Nt32Pkg\Nt32Pkg.dsc -a IA32 -m ShellPkg\Application\text1\text1.inf 進入文件目錄後編譯才能夠。this
另一個問題就是若是在*.c文件中輸出字符串後面不加\r\n。 會致使字符輸出不全,個人只顯示 orld 四個字符。詢問前輩得知是因爲被覆蓋,具體不詳spa