From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400d:c0d::229; helo=mail-qt0-x229.google.com; envelope-from=rafaelrodrigues.machado@gmail.com; receiver=edk2-devel@lists.01.org Received: from mail-qt0-x229.google.com (mail-qt0-x229.google.com [IPv6:2607:f8b0:400d:c0d::229]) (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 909C32219BCB0 for ; Wed, 20 Dec 2017 09:27:06 -0800 (PST) Received: by mail-qt0-x229.google.com with SMTP id a16so29238295qtj.3 for ; Wed, 20 Dec 2017 09:31:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PuMcwXMg4XEO790Wi+K956d785u0rT2c+Y+i9wK/w6k=; b=OXdNXWUbsn1+ar9/FSjcGv0b58S2CT0GSEuH/iEHB/f6r6uIj2HreRIEQxfO+0JdUt dU3EG3hAUzzcZuLk3CJZFBH5Zj6IgQOjQlhqoCZzc4+u+x8iEj3PJcdY5v1zTMA2eacR +AvbMBGpw0QjxxHcK8y7shmnz9ZkUeLspu+lpo8zHZX/HvzWGb4LuN1/jgySvK+8L1is nzzS5muFXNdKrY6NARNh0k0rZ9tRo7Rhd6i0buMr5Sqmtx9adhVv7Z0Hy6m1sEotVy5F O4+mc2L8/I9Ob7WztuVAKi15o57mFgGNlXjXdIqUsG09xsdyX4HiFm2wQr62SxZvCOBt aI1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PuMcwXMg4XEO790Wi+K956d785u0rT2c+Y+i9wK/w6k=; b=iDYyOwT33jLj2sftswzEtCNgfYnNAfkUfOfh6ms54lSWYu+nb0DJP52QCA0mnENTJF 3vog3G7ZFsP19w+zj7Q+qNPEy5uwzg5XYaXgMHsMuwts/ICKzvTkKxx49ICpJHiLYv0j sURjqjaPmpzOTuiUZuwfYWYKIhlAs89iC+ZcVLUzWKgo2+5frlnv/IKXxlV3X8J8p2cz pDIUxpF+1qNql3EBYkFV2kmep61NLv6uKRNAbWnsTObU7yUnqVGivp/a5ubO3ZYIXrYn htqA8etA7tbXCNIG4tcTS41L4Xg8To28HCL8vLv+J+PzIHhOqvhmw+KS9e1Ljq8Pi5YN wzWw== X-Gm-Message-State: AKGB3mJSWNR8FdlCMfYtRH1GVoYRnVTvwxMCi+wBAAhywZKfZqNiABWz VM4qXfXKXKXzwcqTflK2Thk7wxEUlmkaLXkAs9A= X-Google-Smtp-Source: ACJfBotYdqaZnnpJ/LQqcKfgtm1NUQdwveCohxTOxMbdv3USSHIyNK3pePRjC4HT4UeXR1VmtXXgkLA1z7FLCkL0cZA= X-Received: by 10.200.41.249 with SMTP id 54mr11295976qtt.312.1513791113449; Wed, 20 Dec 2017 09:31:53 -0800 (PST) MIME-Version: 1.0 References: <82e7b859-9184-bb1c-828f-ecde7772231d@Intel.com> In-Reply-To: <82e7b859-9184-bb1c-828f-ecde7772231d@Intel.com> From: Rafael Machado Date: Wed, 20 Dec 2017 17:31:42 +0000 Message-ID: To: "Ni, Ruiyu" Cc: "edk2-devel@lists.01.org" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 Subject: Re: UEFI App embedded on another uefi app X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Dec 2017 17:27:07 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Ruiyu Thanks for the answer. The case is similar. The only difference is that we are not allowed to use some external code besides the UDK references and modules. This is why we're trying to find a way to embed a binary on another one. I did some tests here but I have a question. Is it possible to create a PCD that points to an embedded binary? For example. At the MdeModulePkg/Application/HelloWorld/HelloWorld.c we have some example of how to access a string that is declared at the .dec and and filled at the .uni: Print ((CHAR16*)PcdGetPtr (PcdHelloWorldPrintString)); I was able to compile this application adding the Logo.bmp to the HelloWorld.inf file, just to check how this would work. So the question is. How could I create a PCD that points to a binary that is added to a .efi? Based on the code I believe the only what to do that is creating a .fdf and setting the PCD to point to the binary, on the same way it's done with the: MdeModulePkg\Logo\Logo.inf CorebootPayloadPkg\CorebootPayloadPkg.fdf The problem is that at our case, we need to have a single .efi that has an embedded binary. Any idea on how to do that? (Not sure if this is to intrusive for the PE format. Still learning this) Thanks and Regards Rafael R. Machado Em seg, 18 de dez de 2017 =C3=A0s 03:13, Ni, Ruiyu esc= reveu: > On 12/15/2017 7:45 PM, Rafael Machado wrote: > > Hi Everyone. > > > > I have a limited space problem at a project. > > To solve this we had an idea, but would like to ask to you before > expending > > time on trying to do it, due to some tight schedule. (We know that the > best > > is to try before ask, but we do not have time for that now. Sorry for > that.) > > > > The idea is to create a kind of DecompressorApp.efi, that > > uses EFI_DECOMPRESS_PROTOCOL > > > > During the compilation process of the application the tasks would be: > > > > - Compile App.efi > > - Compress App.efi, generating the App.efi.compressed (using > > tianoCompress.exe) > > - Compile the Decompressor.efi app (with the App.efi.compressed embedde= d) > > - The idea to do this is to add the compressed app as a Binary = at > > the DecompressorApp.efi .inf file using the [Binaries] tag > > > > > > So during the entrypoint of the Decompressor.efi app, the application > will > > need to copy the compressed part of the app (App.efi.compressed), to a > > buffer, and after that this buffer will be decompressed using the > > EFI_DECOMPRESS_PROTOCOL. Finally the execution control is passed to the > > App.efi decompressed (not sure how to do that yet). > > > > So the questions we have for know are: > > > > - How to detect the App.efi.compressed insyde the loaded app, so we can > > have an address to decompress > Is your usage case similar to the upx? > > If the App.efi is compressed and embedded as binary in the application, > the application itself should know that the binary should be > decompressed and executed. > > > > - How to pass the application executions control to another app, that i= s > in > > a buffer (not sure if this can be done with the EFI Boot Service > > LoadImage(), since this buffer does not have a valid file device path) > Yes you could use LoadImage(). The API also accepts a PE buffer to load. > Then you could use StartImage() to execute the PE buffer. > Make sure you use the correct entrypoint prototype for the PE buffer. > typedef > EFI_STATUS > (EFIAPI *EFI_IMAGE_ENTRY_POINT)( > IN EFI_HANDLE ImageHandle, > IN EFI_SYSTEM_TABLE *SystemTable > ); > > > > > Could you help us on understanding if this is possible? > > > > Thanks and Regards > > Rafael R. Machado > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel > > > > > -- > Thanks, > Ray >