From 3c8f71a16ca0606a5fcb6d93eba79daedbc16206 Mon Sep 17 00:00:00 2001 From: Maurice Ma Date: Fri, 19 Apr 2019 10:20:37 -0700 Subject: [PATCH] Enhance error message print for OsLoader This patch added some additional error message print during the boot media initializtion and file loading. It makes it easier to identify issues in case of failure. Signed-off-by: Maurice Ma --- PayloadPkg/OsLoader/LoadImage.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/PayloadPkg/OsLoader/LoadImage.c b/PayloadPkg/OsLoader/LoadImage.c index 3d4285c9..46a79f70 100644 --- a/PayloadPkg/OsLoader/LoadImage.c +++ b/PayloadPkg/OsLoader/LoadImage.c @@ -52,14 +52,14 @@ FindBootPartition ( // Status = MediaSetInterfaceType (BootOption->DevType); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "Invalid Boot device configured\n")); + DEBUG ((DEBUG_ERROR, "Failed to set media interface - %r\n", Status)); return RETURN_UNSUPPORTED; } - DEBUG ((DEBUG_INFO, "Getting boot image from... %a\n", GetBootDeviceNameString(BootOption->DevType))); - + DEBUG ((DEBUG_INFO, "Getting boot image from %a\n", GetBootDeviceNameString(BootOption->DevType))); Status = MediaInitialize (BootMediumPciBase, DevInitAll); if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Failed to init media - %r\n", Status)); return Status; } @@ -70,6 +70,7 @@ FindBootPartition ( DEBUG ((DEBUG_INFO, "Try to find boot partition\n")); Status = FindPartitions (BootOption->HwPart, HwPartHandle); if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Failed to find partition - %r\n", Status)); return Status; } AddMeasurePoint (0x4060); @@ -295,7 +296,7 @@ LoadLinuxFile ( } Ptr[FileInfo->Len] = 0; - AsciiStrToUnicodeStrS (Ptr, FileName, sizeof(FileName) / sizeof(CHAR16)); + AsciiStrToUnicodeStrS (Ptr, FileName, sizeof(FileName) / sizeof(CHAR16)); FileSize = 0; FileBuffer = NULL; Status = GetFileByName (FsHandle, FileName, &FileBuffer, &FileSize); @@ -373,13 +374,13 @@ GetTraditionalLinux ( MenuEntry = LinuxBootCfg.MenuEntry; MenuEntry[0].Name.Pos = 0; MenuEntry[0].Name.Len = 5; - AsciiStrCpyS (MenuEntry[0].Name.Buf, sizeof(MenuEntry[0].Name.Buf), "Linux"); + AsciiStrCpyS (MenuEntry[0].Name.Buf, sizeof(MenuEntry[0].Name.Buf), "Linux"); MenuEntry[0].InitRd.Pos = 0; MenuEntry[0].InitRd.Len = 6; - AsciiStrCpyS (MenuEntry[0].InitRd.Buf, sizeof(MenuEntry[0].InitRd.Buf), "initrd"); + AsciiStrCpyS (MenuEntry[0].InitRd.Buf, sizeof(MenuEntry[0].InitRd.Buf), "initrd"); MenuEntry[0].Kernel.Pos = 0; MenuEntry[0].Kernel.Len = 7; - AsciiStrCpyS (MenuEntry[0].Kernel.Buf, sizeof(MenuEntry[0].Kernel.Buf), "vmlinuz"); + AsciiStrCpyS (MenuEntry[0].Kernel.Buf, sizeof(MenuEntry[0].Kernel.Buf), "vmlinuz"); MenuEntry[0].Command.Pos = 0; MenuEntry[0].Command.Len = ConfigFileSize; EntryIdx = 0;