+ OptionalData = BootOption->OptionalData;\r
+ BootType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((UINT32 *)(&OptionalData->Header.LoaderType));\r
+\r
+ // TODO: Allow adding an initrd to a boot entry without one\r
+ if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {\r
+ LinuxArguments = &OptionalData->Arguments.LinuxArguments;\r
+\r
+ CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize);\r
+\r
+ InitrdSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->InitrdSize);\r
+ if (InitrdSize > 0) {\r
+ Print(L"File path of the initrd: ");\r
+ Status = DeviceSupport->UpdateDevicePathNode ((EFI_DEVICE_PATH*)((LinuxArguments + 1) + CmdLineSize), &InitrdPathList, 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
+ InitrdSize = GetDevicePathSize (InitrdPathList);\r
+ }\r
+\r
+ Print(L"Arguments to pass to the binary: "); \r
+ if (CmdLineSize > 0) {\r
+ AsciiStrnCpy(CmdLine, (CONST CHAR8*)(LinuxArguments + 1), CmdLineSize);\r
+ } else {\r
+ CmdLine[0] = '\0';\r
+ }\r
+ Status = EditHIInputAscii (CmdLine, BOOT_DEVICE_OPTION_MAX);\r
+ if (EFI_ERROR(Status)) {\r
+ Status = EFI_ABORTED;\r
+ goto FREE_DEVICE_PATH;\r
+ }\r
+\r
+ CmdLineSize = AsciiStrSize (CmdLine);\r
+\r
+ BootArguments = (ARM_BDS_LOADER_ARGUMENTS*)AllocatePool(sizeof(ARM_BDS_LOADER_ARGUMENTS) + CmdLineSize + InitrdSize);\r
+ BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;\r
+ BootArguments->LinuxArguments.InitrdSize = InitrdSize;\r
+ CopyMem (&BootArguments->LinuxArguments + 1, CmdLine, CmdLineSize);\r
+ CopyMem ((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLine, InitrdPathList, InitrdSize);\r