public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ryan Harkin <ryan.harkin@linaro.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	Leif Lindholm <leif.lindholm@linaro.org>
Subject: Re: [PATCH 1/3] EmbeddedPkg/AndroidFastboot: drop dependency on the LinuxLoader
Date: Tue, 22 Nov 2016 17:07:05 +0000	[thread overview]
Message-ID: <CAD0U-h+iewv42jj9VzVOSkxmAFftJM9yz5m_5VkSy5f9s-O14w@mail.gmail.com> (raw)
In-Reply-To: <1479731290-22497-2-git-send-email-ard.biesheuvel@linaro.org>

On 21 November 2016 at 12:28, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> When booting the kernel via Fastboot, invoke the kernel image directly
> rather than passing it to the LinuxLoader app. This requires the kernel
> image to be built with UEFI stub support.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> Build tested only.
>
>  EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c | 70 ++++++--------------
>  1 file changed, 22 insertions(+), 48 deletions(-)
>
> diff --git a/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c b/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c
> index acedd3e0e3cd..46a7ceb3a41c 100644
> --- a/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c
> +++ b/EmbeddedPkg/Application/AndroidFastboot/Arm/BootAndroidBootImg.c
> @@ -21,11 +21,6 @@
>  #include <Library/UefiBootServicesTableLib.h>
>  #include <Library/UefiLib.h>
>
> -#define LINUX_LOADER_COMMAND_LINE       L"%s -f %s -c %s"
> -
> -// This GUID is defined in the INGF file of ArmPkg/Application/LinuxLoader
> -CONST EFI_GUID mLinuxLoaderAppGuid = { 0x701f54f2, 0x0d70, 0x4b89, { 0xbc, 0x0a, 0xd9, 0xca, 0x25, 0x37, 0x90, 0x59 }};
> -
>  // Device Path representing an image in memory
>  #pragma pack(1)
>  typedef struct {
> @@ -68,11 +63,7 @@ BootAndroidBootImg (
>    VOID                               *Ramdisk;
>    UINTN                               RamdiskSize;
>    MEMORY_DEVICE_PATH                  KernelDevicePath;
> -  MEMORY_DEVICE_PATH*                 RamdiskDevicePath;
> -  CHAR16*                             KernelDevicePathTxt;
> -  CHAR16*                             RamdiskDevicePathTxt;
> -  EFI_DEVICE_PATH*                    LinuxLoaderDevicePath;
> -  CHAR16*                             LoadOptions;
> +  CHAR16                              *LoadOptions, *NewLoadOptions;
>
>    Status = ParseAndroidBootImg (
>              Buffer,
> @@ -93,55 +84,38 @@ BootAndroidBootImg (
>    KernelDevicePath.Node1.StartingAddress = (EFI_PHYSICAL_ADDRESS)(UINTN) Kernel;
>    KernelDevicePath.Node1.EndingAddress   = (EFI_PHYSICAL_ADDRESS)(UINTN) Kernel + KernelSize;
>
> -  RamdiskDevicePath = NULL;
> -  if (RamdiskSize != 0) {
> -    RamdiskDevicePath = (MEMORY_DEVICE_PATH*)DuplicateDevicePath ((EFI_DEVICE_PATH_PROTOCOL*) &MemoryDevicePathTemplate);
> -
> -    RamdiskDevicePath->Node1.StartingAddress = (EFI_PHYSICAL_ADDRESS)(UINTN) Ramdisk;
> -    RamdiskDevicePath->Node1.EndingAddress   = ((EFI_PHYSICAL_ADDRESS)(UINTN) Ramdisk) + RamdiskSize;
> -  }
> -
> -  //
> -  // Boot Linux using the Legacy Linux Loader
> -  //
> -
> -  Status = LocateEfiApplicationInFvByGuid (&mLinuxLoaderAppGuid, &LinuxLoaderDevicePath);
> -  if (EFI_ERROR (Status)) {
> -    Print (L"Couldn't Boot Linux: %d\n", Status);
> -    return EFI_DEVICE_ERROR;
> -  }
> -
> -  KernelDevicePathTxt = ConvertDevicePathToText ((EFI_DEVICE_PATH_PROTOCOL *) &KernelDevicePath, FALSE, FALSE);
> -  if (KernelDevicePathTxt == NULL) {
> -    return EFI_OUT_OF_RESOURCES;
> -  }
> -
> -  RamdiskDevicePathTxt = ConvertDevicePathToText ((EFI_DEVICE_PATH_PROTOCOL *) RamdiskDevicePath, FALSE, FALSE);
> -  if (RamdiskDevicePathTxt == NULL) {
> +  // Initialize Linux command line
> +  LoadOptions = CatSPrint (NULL, L"%a", KernelArgs);
> +  if (LoadOptions == NULL) {
>      return EFI_OUT_OF_RESOURCES;
>    }
>
> -  // Initialize Legacy Linux loader command line
> -  LoadOptions = CatSPrint (NULL, LINUX_LOADER_COMMAND_LINE, KernelDevicePathTxt, RamdiskDevicePathTxt, KernelArgs);
> -  if (LoadOptions == NULL) {
> -    return EFI_OUT_OF_RESOURCES;
> +  if (RamdiskSize != 0) {
> +    NewLoadOptions = CatSPrint (LoadOptions, L" initrd=0x%x,0x%x",
> +                       (UINTN)Ramdisk, RamdiskSize);
> +    FreePool (LoadOptions);
> +    if (NewLoadOptions == NULL) {
> +      return EFI_OUT_OF_RESOURCES;
> +    }
> +    LoadOptions = NewLoadOptions;
>    }
>
> -  Status = BdsStartEfiApplication (gImageHandle, LinuxLoaderDevicePath, StrSize (LoadOptions), LoadOptions);
> +  Status = BdsStartEfiApplication (gImageHandle,
> +             (EFI_DEVICE_PATH_PROTOCOL *) &KernelDevicePath,
> +             StrSize (LoadOptions),
> +             LoadOptions);
>    if (EFI_ERROR (Status)) {
>      DEBUG ((EFI_D_ERROR, "Couldn't Boot Linux: %d\n", Status));
> -    return EFI_DEVICE_ERROR;
> -  }
> -
> -  if (RamdiskDevicePath) {
> -    FreePool (RamdiskDevicePathTxt);
> -    FreePool (RamdiskDevicePath);
> +    Status = EFI_DEVICE_ERROR;
> +    goto FreeLoadOptions;
>    }
>
> -  FreePool (KernelDevicePathTxt);
> -
>    // If we got here we do a confused face because BootLinuxFdt returned,
>    // reporting success.
>    DEBUG ((EFI_D_ERROR, "WARNING: BdsBootLinuxFdt returned EFI_SUCCESS.\n"));

This comment has nothing to do with your change, but this DEBUG
message hasn't been true since commit
bd9a5182a59696870690b54aaa63632c80694000 removed the call to
BdsBootLinuxFdt :-/


>    return EFI_SUCCESS;
> +
> +FreeLoadOptions:
> +  FreePool (LoadOptions);
> +  return Status;
>  }
> --
> 2.7.4
>


  reply	other threads:[~2016-11-22 17:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-21 12:28 [PATCH 0/3] Remove the ArmPkg LinuxLoader Ard Biesheuvel
2016-11-21 12:28 ` [PATCH 1/3] EmbeddedPkg/AndroidFastboot: drop dependency on the LinuxLoader Ard Biesheuvel
2016-11-22 17:07   ` Ryan Harkin [this message]
2016-11-21 12:28 ` [PATCH 2/3] BeagleBoardPkg/BeagleBoardPkg.dsc: remove the LinuxLoader application Ard Biesheuvel
2016-11-21 12:28 ` [PATCH 3/3] ArmPkg: " Ard Biesheuvel
2016-11-21 12:29 ` [PATCH 0/3] Remove the ArmPkg LinuxLoader Ard Biesheuvel
2016-11-21 17:28   ` Ryan Harkin
2016-11-22 17:09     ` Ryan Harkin
2016-11-25 12:59       ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAD0U-h+iewv42jj9VzVOSkxmAFftJM9yz5m_5VkSy5f9s-O14w@mail.gmail.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox