You are currently reviewing an older revision of this page.
The Total Compute 2022 (TC2) LSC software stack uses bash scripts to build an integrated solution comprising Board Support Package (BSP) and Debian distribution.
The detial software component can be found here. For this tc2-2024.02.22-lsc release, the BL33 is implemented as EDK2 boot loader. TF-A BL31 passes execution control to EDK2 UEFI FW bootloader (BL33). EDK2 UEFI FW will load and verify signature of Grub.
This article will demo how to add one simple "HellowWorld" application into edk2 for tc2 lsc platform, you can perform the following steps to achieve the goal.
You can follow the user-guide to set up the work space on your local host machine, once you set up and build out the images successfully, there will be below image is created in directory "$workspace/output/debian/deploy/tc2/ ":
You can create the HelloWorld directory into EDK2 code base:
cd $workspace/src/uefi/edk2 mkdir HelloWorld
Then add the related source into "HelloWorld" directory as below:
HelloWorld/HelloWorld.c | 18 ++++++++++++++++++ HelloWorld/HelloWorld.inf | 28 ++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 HelloWorld/HelloWorld.c create mode 100644 HelloWorld/HelloWorld.inf diff --git a/HelloWorld/HelloWorld.c b/HelloWorld/HelloWorld.c new file mode 100644 index 0000000000..3d7b10a6b0 --- /dev/null +++ b/HelloWorld/HelloWorld.c @@ -0,0 +1,18 @@ +#include <Uefi.h> +//#include <Library/UefiBootServicesTableLib.h> +#include <Library/UefiApplicationEntryPoint.h> +#include <Library/UefiLib.h> + +EFI_STATUS +EFIAPI +UefiMain( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + // Hello World + Print(L"Hello, World!\n"); + + return EFI_SUCCESS; +} + diff --git a/HelloWorld/HelloWorld.inf b/HelloWorld/HelloWorld.inf new file mode 100644 index 0000000000..60a7d3bc53 --- /dev/null +++ b/HelloWorld/HelloWorld.inf @@ -0,0 +1,28 @@ +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = HelloWorld + FILE_GUID = 35f8c5d2-1a18-45de-960a-5ba95954cad7 + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = UefiMain + +[Sources] + HelloWorld.c + +[Packages] + MdePkg/MdePkg.dec + +[LibraryClasses] + UefiApplicationEntryPoint + UefiLib + +[Guids] + +[Ppis] + +[Protocols] + +[FeaturePcd] + +[Pcd] +
The HelloWorld application need to be added into TC22 platform description files and flash definition file, they are part of "$workspace/src/uefi/edk2/edk2-platforms/Platform/ARM/Tc" directory, you can modify it as below:
diff --git a/Platform/ARM/Tc/Tc.dsc.inc b/Platform/ARM/Tc/Tc.dsc.inc index f7a4c65675..4f90750905 100644 --- a/Platform/ARM/Tc/Tc.dsc.inc +++ b/Platform/ARM/Tc/Tc.dsc.inc @@ -236,5 +236,8 @@ PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf } + #Hello World + HelloWorld/HelloWorld.inf + # RAM Disk MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf diff --git a/Platform/ARM/Tc/Tc.fdf b/Platform/ARM/Tc/Tc.fdf index 637b2517fa..2f5f7e72a4 100644 --- a/Platform/ARM/Tc/Tc.fdf +++ b/Platform/ARM/Tc/Tc.fdf @@ -142,6 +142,8 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf + # Hello world + INF HelloWorld/HelloWorld.inf [FV.FVMAIN_COMPACT] FvAlignment = 8
If you would like to build the uefi standlone, you need to follow below commands:
./run_docker.sh build-uefi.sh clean ./run_docker.sh build-uefi.sh build ./run_docker.sh build-tfa.sh build ./run_docker.sh build-tfa.sh deploy ./run_docker.sh build-flash-image.sh deploy
Then you can find the HelloWorld.efi is built out in directroy "$workspace/src/uefi/edk2/Build" as below:
./Tc2/DEBUG_GCC5/AARCH64/HelloWorld/HelloWorld/DEBUG/HelloWorld.efi
If you would like to build the software stack totally, you can use below command:
./run_docker.sh build-all.sh clean ./run_docker.sh build-all.sh build
Run the command "./run-scripts/tc2/run_model.sh -m /fvp/FVP_TC2_11.23_28/models/normal/FVP_TC2 -d debian -b uefi -t tap0".
Note: If you have not installed the TC22 FVP fast model yet, it can be downloaded from here.
Then, you can see the HelloWorld.efi application from edk2 shell:
You can run the HelloWorld.efi application as following: