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 that includes the Board Support Package (BSP) and the Debian distribution, as shown in the following figure:
Total Compute Platform Software Components
The software component is available here. In the tc2-2024.02.22-lsc release, BL33 is implemented as the EDK2 boot loader. TF-A BL31 transfers execution control to the EDK2 UEFI FW bootloader (BL33). The EDK2 UEFI firmware loads and verifies the signature of Grub.
To add the HellowWorld application to edk2 for the TC2 LSC platform, perform the following steps:.
Follow the Total Compute User Guide to set up the work space on your local host machine. After you set up and build the images successfully, you can find the images in the $workspace/output/debian/deploy/tc2/ directory, as shown in the following figure:
$workspace/output/debian/deploy/tc2/
HelloWorld
cd $workspace/src/uefi/edk2 mkdir HelloWorld
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 must be added to the TC22 platform description files and the flash definition file.
You can find these files in the $workspace/src/uefi/edk2/edk2-platforms/Platform/ARM/Tc directory, and modify the files as follows:
$workspace/src/uefi/edk2/edk2-platforms/Platform/ARM/Tc
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 want to build the UEFI standalone, use the following 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 want to build the entire software stack, use the following commands:
./run_docker.sh build-all.sh clean ./run_docker.sh build-all.sh build
Run the following 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 do not install the TC22 FVP Fast Model, you can download it here.
Then, you can find the HelloWorld.efi application in the EDK2 shell: