/** @file\r
*\r
-* Copyright (c) 2011, ARM Limited. All rights reserved.\r
+* Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
*\r
* This program and the accompanying materials\r
* are licensed and made available under the terms and conditions of the BSD License\r
\r
#include "BdsInternal.h"\r
\r
+#include <Guid/ArmGlobalVariableHob.h>\r
+\r
extern EFI_HANDLE mImageHandle;\r
extern BDS_LOAD_OPTION_SUPPORT *BdsLoadOptionSupportList;\r
\r
+\r
EFI_STATUS\r
SelectBootDevice (\r
OUT BDS_SUPPORTED_DEVICE** SupportedBootDevice\r
}\r
Index++;\r
}\r
- \r
+\r
EXIT:\r
BootDeviceListSupportedFree (&SupportedDeviceList, *SupportedBootDevice);\r
return Status;\r
InitrdSize = GetDevicePathSize (InitrdPath);\r
\r
BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize);\r
- \r
+\r
BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;\r
BootArguments->LinuxArguments.InitrdSize = InitrdSize;\r
CopyMem ((VOID*)(&BootArguments->LinuxArguments + 1), CmdLine, CmdLineSize);\r
FREE_DEVICE_PATH:\r
FreePool (DevicePath);\r
\r
- \r
+\r
EXIT:\r
if (Status == EFI_ABORTED) {\r
Print(L"\n");\r
ARM_BDS_LOADER_ARGUMENTS* BootArguments;\r
CHAR16 BootDescription[BOOT_DEVICE_DESCRIPTION_MAX];\r
CHAR8 CmdLine[BOOT_DEVICE_OPTION_MAX];\r
- EFI_DEVICE_PATH* DevicePath;\r
+ EFI_DEVICE_PATH *DevicePath;\r
+ EFI_DEVICE_PATH *TempInitrdPath;\r
ARM_BDS_LOADER_TYPE BootType;\r
ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;\r
ARM_BDS_LINUX_ARGUMENTS* LinuxArguments;\r
if (InitrdSupport) {\r
if (InitrdSize > 0) {\r
// Case we update the initrd device path\r
- Status = DeviceSupport->UpdateDevicePathNode ((EFI_DEVICE_PATH*)((LinuxArguments + 1) + CmdLineSize), L"initrd", &InitrdPath, NULL, NULL);\r
+ Status = DeviceSupport->UpdateDevicePathNode ((EFI_DEVICE_PATH*)((UINTN)(LinuxArguments + 1) + CmdLineSize), L"initrd", &InitrdPath, NULL, NULL);\r
if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) {// EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd\r
Status = EFI_ABORTED;\r
goto EXIT;\r
\r
if (InitrdPathNode != NULL) {\r
// Duplicate Linux kernel Device Path\r
- DevicePath = DuplicateDevicePath (BootOption->FilePathList);\r
+ TempInitrdPath = DuplicateDevicePath (BootOption->FilePathList);\r
// Replace Linux kernel Node by EndNode\r
- SetDevicePathEndNode (GetLastDevicePathNode (DevicePath));\r
+ SetDevicePathEndNode (GetLastDevicePathNode (TempInitrdPath));\r
// Append the Device Path node to the select device path\r
- InitrdPath = AppendDevicePathNode (DevicePath, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNode);\r
+ InitrdPath = AppendDevicePathNode (TempInitrdPath, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNode);\r
+ FreePool (TempInitrdPath);\r
+ InitrdSize = GetDevicePathSize (InitrdPath);\r
} else {\r
InitrdPath = NULL;\r
}\r
InitrdSize = 0;\r
}\r
\r
- Print(L"Arguments to pass to the binary: "); \r
+ Print(L"Arguments to pass to the binary: ");\r
if (CmdLineSize > 0) {\r
AsciiStrnCpy(CmdLine, (CONST CHAR8*)(LinuxArguments + 1), CmdLineSize);\r
} else {\r
BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;\r
BootArguments->LinuxArguments.InitrdSize = InitrdSize;\r
CopyMem (&BootArguments->LinuxArguments + 1, CmdLine, CmdLineSize);\r
- CopyMem ((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLine, InitrdPath, InitrdSize);\r
+ CopyMem ((VOID*)((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLineSize), InitrdPath, InitrdSize);\r
} else {\r
BootArguments = NULL;\r
}\r
// Append the Device Path node to the select device path\r
FdtDevicePath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, FdtDevicePathNode);\r
FdtDevicePathSize = GetDevicePathSize (FdtDevicePath);\r
- Status = gRT->SetVariable ((CHAR16*)L"Fdt", &gEfiGlobalVariableGuid, (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS ), FdtDevicePathSize, FdtDevicePath);\r
+ Status = gRT->SetVariable (\r
+ (CHAR16*)L"Fdt",\r
+ &gArmGlobalVariableGuid,\r
+ EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
+ FdtDevicePathSize,\r
+ FdtDevicePath\r
+ );\r
ASSERT_EFI_ERROR(Status);\r
} else {\r
- gRT->SetVariable ((CHAR16*)L"Fdt", &gEfiGlobalVariableGuid, (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS ), 0, NULL);\r
+ gRT->SetVariable (\r
+ (CHAR16*)L"Fdt",\r
+ &gArmGlobalVariableGuid,\r
+ EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
+ 0,\r
+ NULL\r
+ );\r
ASSERT_EFI_ERROR(Status);\r
}\r
\r
}\r
\r
EFI_STATUS\r
-BootEBL (\r
+BootShell (\r
IN LIST_ENTRY *BootOptionsList\r
)\r
{\r
EFI_STATUS Status;\r
\r
// Start EFI Shell\r
- Status = BdsLoadApplication (mImageHandle, L"Ebl", 0, NULL);\r
+ Status = BdsLoadApplication (mImageHandle, L"Shell", 0, NULL);\r
if (Status == EFI_NOT_FOUND) {\r
Print (L"Error: EFI Application not found.\n");\r
} else if (EFI_ERROR(Status)) {\r
CONST CHAR16* Description;\r
EFI_STATUS (*Callback) (IN LIST_ENTRY *BootOptionsList);\r
} BootMainEntries[] = {\r
- { L"EBL", BootEBL },\r
+ { L"Shell", BootShell },\r
{ L"Boot Manager", BootMenuManager },\r
};\r
\r