diff options
-rw-r--r-- | auto_boot.patch | 107 | ||||
-rwxr-xr-x | uefi.sh | 1 |
2 files changed, 108 insertions, 0 deletions
diff --git a/auto_boot.patch b/auto_boot.patch new file mode 100644 index 0000000..017bb8f --- /dev/null +++ b/auto_boot.patch @@ -0,0 +1,107 @@ +--- a/ArmPlatformPkg/Bds/BootOption.c ++++ b/ArmPlatformPkg/Bds/BootOption.c +@@ -14,6 +14,13 @@ +
+ #include "BdsInternal.h"
+
++//CHANGE -- START
++#include <Library/DxeServicesTableLib.h>
++#include <Protocol/BlockIo.h>
++#include <Guid/DebugImageInfoTable.h>
++#include <Protocol/DevicePathToText.h>
++//CHANGE -- END
++
+ extern EFI_HANDLE mImageHandle;
+
+ EFI_STATUS
+@@ -34,6 +41,17 @@ + EFI_DEVICE_PATH* Initrd;
+ UINT16 LoadOptionIndexSize;
+
++//CHANGE -- START
++ UINTN HandleCount;
++ EFI_HANDLE *HandleBuffer;
++ UINTN Index;
++ //CHAR16* String;
++ //EFI_DEVICE_PATH_PROTOCOL* DevicePathProtocol;
++ EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
++ EFI_DEVICE_PATH_PROTOCOL *LoadImageDevicePath;
++ EFI_DEVICE_PATH_PROTOCOL *FileSystemDevicePath;
++//CHANGE -- END
++
+ if (IS_ARM_BDS_BOOTENTRY (BootOption)) {
+ Status = EFI_UNSUPPORTED;
+ OptionalData = BootOption->OptionalData;
+@@ -55,9 +73,72 @@ + Initrd = NULL;
+ }
+
++//CHANGE CODE -- START
++ do {
++ // Locate all the driver handles
++ Status = gBS->LocateHandleBuffer (
++ AllHandles,
++ NULL,
++ NULL,
++ &HandleCount,
++ &HandleBuffer
++ );
++ if (EFI_ERROR (Status)) {
++ break;
++ }
++
++ // Connect every handles
++ for (Index = 0; Index < HandleCount; Index++) {
++ gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
++ }
++
++ if (HandleBuffer != NULL) {
++ FreePool (HandleBuffer);
++ }
++
++ // Check if new handles have been created after the start of the previous handles
++ Status = gDS->Dispatch ();
++ } while (!EFI_ERROR(Status));
++
++
++ Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
++ if (EFI_ERROR (Status)) {
++ AsciiPrint ("Did not find the DevicePathToTextProtocol.\n");
++ return Status;
++ }
++
++ Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiBlockIoProtocolGuid, NULL, &HandleCount, &HandleBuffer);
++ if (EFI_ERROR (Status)) {
++ AsciiPrint ("No device path found\n");
++ return Status;
++ }
++
++ /*for (Index = 0; Index < HandleCount; Index++) {
++ Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **)&DevicePathProtocol);
++ String = DevicePathToTextProtocol->ConvertDevicePathToText(DevicePathProtocol,TRUE,TRUE);
++ Print (L"[0x%X] %s\n",(UINT32)HandleBuffer[Index], String);
++ }*/
++
++ for (Index = 0; Index < HandleCount; Index++) {
++ //Get the device path
++ FileSystemDevicePath = DevicePathFromHandle(HandleBuffer[Index]);
++ if (FileSystemDevicePath == NULL) {
++ continue;
++ }
++
++ //Check if zImage file on SD-MMC.
++ LoadImageDevicePath = FileDevicePath(HandleBuffer[Index], L"uImage");
++ Status = BdsBootLinuxAtag (LoadImageDevicePath, Initrd, (CHAR8*)(LinuxArguments + 1));
++ if (EFI_ERROR(Status)) {
++ continue;
++ }
++ }
++//CHANGE CODE -- END
++#if 0 //remove while removing CHANGE CODE
+ Status = BdsBootLinuxAtag (BootOption->FilePathList,
+ Initrd, // Initrd
+ (CHAR8*)(LinuxArguments + 1)); // CmdLine
++#endif
+ } else if (LoaderType == BDS_LOADER_KERNEL_LINUX_FDT) {
+ LinuxArguments = &(OptionalData->Arguments.LinuxArguments);
+ CmdLineSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->CmdLineSize);
@@ -20,6 +20,7 @@ cd ${EDK_WORKSPACE} patch -p1 < ${WORKSPACE}/origen-uefi-ci/Removed_-combine.patch patch -p1 < ${WORKSPACE}/origen-uefi-ci/Fixed_GCC_4.6_build.patch patch -p1 < ${WORKSPACE}/origen-uefi-ci/Fixed_debug_build_with_-Werror_unused-but-set-variable.patch +patch -p1 < ${WORKSPACE}/origen-uefi-ci/auto_boot.patch cd ${WORKSPACE} # Create source tarball |