*\r
**/\r
\r
+#include <Guid/Fdt.h>\r
+#include <libfdt.h>\r
+\r
#include "BdsInternal.h"\r
#include "BdsLinuxLoader.h"\r
\r
/**\r
Start a Linux kernel from a Device Path\r
\r
- @param LinuxKernel Device Path to the Linux Kernel\r
- @param Parameters Linux kernel arguments\r
- @param Fdt Device Path to the Flat Device Tree\r
+ @param LinuxKernelDevicePath Device Path to the Linux Kernel\r
+ @param InitrdDevicePath Device Path to the Initrd\r
+ @param CommandLineArguments Linux command line\r
\r
@retval EFI_SUCCESS All drivers have been connected\r
@retval EFI_NOT_FOUND The Linux kernel Device Path has not been found\r
BdsBootLinuxFdt (\r
IN EFI_DEVICE_PATH_PROTOCOL* LinuxKernelDevicePath,\r
IN EFI_DEVICE_PATH_PROTOCOL* InitrdDevicePath,\r
- IN CONST CHAR8* CommandLineArguments,\r
- IN EFI_DEVICE_PATH_PROTOCOL* FdtDevicePath\r
+ IN CONST CHAR8* CommandLineArguments\r
)\r
{\r
- EFI_STATUS Status;\r
- UINT32 LinuxImageSize;\r
- UINT32 InitrdImageBaseSize = 0;\r
- UINT32 InitrdImageSize = 0;\r
- UINT32 FdtBlobSize;\r
- EFI_PHYSICAL_ADDRESS FdtBlobBase;\r
- EFI_PHYSICAL_ADDRESS LinuxImage;\r
- EFI_PHYSICAL_ADDRESS InitrdImageBase = 0;\r
- EFI_PHYSICAL_ADDRESS InitrdImage = 0;\r
+ EFI_STATUS Status;\r
+ UINT32 LinuxImageSize;\r
+ UINT32 InitrdImageBaseSize = 0;\r
+ UINT32 InitrdImageSize = 0;\r
+ VOID *InstalledFdtBase;\r
+ UINT32 FdtBlobSize;\r
+ EFI_PHYSICAL_ADDRESS FdtBlobBase;\r
+ EFI_PHYSICAL_ADDRESS LinuxImage;\r
+ EFI_PHYSICAL_ADDRESS InitrdImageBase = 0;\r
+ EFI_PHYSICAL_ADDRESS InitrdImage = 0;\r
\r
PERF_START (NULL, "BDS", NULL, 0);\r
\r
}\r
}\r
\r
- // Load the FDT binary from a device path. The FDT will be reloaded later to a more appropriate location for the Linux kernel.\r
- FdtBlobBase = 0;\r
- Status = BdsLoadImage (FdtDevicePath, AllocateAnyPages, &FdtBlobBase, &FdtBlobSize);\r
- if (EFI_ERROR(Status)) {\r
- Print (L"ERROR: Did not find Device Tree blob.\n");\r
+ //\r
+ // Get the FDT from the Configuration Table.\r
+ // The FDT will be reloaded in PrepareFdt() to a more appropriate\r
+ // location for the Linux Kernel.\r
+ //\r
+ Status = EfiGetSystemConfigurationTable (&gFdtTableGuid, &InstalledFdtBase);\r
+ if (EFI_ERROR (Status)) {\r
+ Print (L"ERROR: Did not get the Device Tree blob (%r).\n", Status);\r
goto EXIT_FREE_INITRD;\r
}\r
+ FdtBlobBase = (EFI_PHYSICAL_ADDRESS)(UINTN)InstalledFdtBase;\r
+ FdtBlobSize = fdt_totalsize (InstalledFdtBase);\r
\r
// Update the Fdt with the Initrd information. The FDT will increase in size.\r
// By setting address=0 we leave the memory allocation to the function\r