From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk0-x236.google.com (mail-qk0-x236.google.com [IPv6:2607:f8b0:400d:c09::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 88C9F81E1F for ; Tue, 22 Nov 2016 09:07:07 -0800 (PST) Received: by mail-qk0-x236.google.com with SMTP id q130so34068529qke.1 for ; Tue, 22 Nov 2016 09:07:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xLvHHDT5pDm5/6HWcmywe/g+/Z911K7T2IqdKNUbFBA=; b=ZxBkae3365ZyY7po0WgttDM5u5Nzk4aROEBz0R0EudId17DV2BN8pXJWtnIxzbf10F 9iV7QCi61/uyIFzMYTRzbDozp+KxXgokWBP6Q9CIZSWWhBtuqVQr0g31i51VJbe0R11z 5tPOhE/CWB/S5E/18ffOD4ZvFv+PMeOXZ5XCM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xLvHHDT5pDm5/6HWcmywe/g+/Z911K7T2IqdKNUbFBA=; b=SQayx8rqWOu/vgKDX+v0H7zOeCsxXHHpGomgcWpiyhWfjYKG3p1lpj4nU/HBlQTYPf BvOM6FXDx0KDTT3q4D0q6GgCVKtbG1w3hX97hUow29zFap6sE7F6uSCR3TcYgdTnhtMa vzFRFZ1/bxg6mhscVBQFggJTmFfGxzdRNmG3zV69cx7/jh52BhahDIGTP3M9eWURYWqi h6yPIj67TWbEUQWp8sFAqNzPjk4dNmkmiGCUL6DuR1cyDx8j6+HQsRlgZc63dfHoJuX6 eHotmq4PZbtM67vl3DYORL2SaMWDT7pWuxAjYGm/5rNgqhfX/funNBOBPS/nfSrqcgVc vp0Q== X-Gm-Message-State: AKaTC036aOCTA+v2/WMh39wMasAlFaBSdAizdLpU5vao66a8agEVq8FP8L5s7ARh+yAo1sObyOPUM4kf82oihIhW X-Received: by 10.46.69.2 with SMTP id s2mr11697938lja.56.1479834426172; Tue, 22 Nov 2016 09:07:06 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.27.68 with HTTP; Tue, 22 Nov 2016 09:07:05 -0800 (PST) In-Reply-To: <1479731290-22497-2-git-send-email-ard.biesheuvel@linaro.org> References: <1479731290-22497-1-git-send-email-ard.biesheuvel@linaro.org> <1479731290-22497-2-git-send-email-ard.biesheuvel@linaro.org> From: Ryan Harkin Date: Tue, 22 Nov 2016 17:07:05 +0000 Message-ID: To: Ard Biesheuvel Cc: "edk2-devel@lists.01.org" , Leif Lindholm Subject: Re: [PATCH 1/3] EmbeddedPkg/AndroidFastboot: drop dependency on the LinuxLoader X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Nov 2016 17:07:07 -0000 Content-Type: text/plain; charset=UTF-8 On 21 November 2016 at 12:28, Ard Biesheuvel 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 > --- > 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 > #include > > -#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 >