public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ashish Singhal via groups.io" <ashishsingha=nvidia.com@groups.io>
To: <devel@edk2.groups.io>, <quic_llindhol@quicinc.com>,
	<ardb+tianocore@kernel.org>, <abner.chang@amd.com>,
	<git@danielschaefer.me>, <jbrasen@nvidia.com>
Cc: Ashish Singhal <ashishsingha@nvidia.com>
Subject: [edk2-devel] [PATCH v2 2/2] EmbeddedPkg: Allow longer android kernel command line
Date: Tue, 14 Nov 2023 20:12:22 -0700	[thread overview]
Message-ID: <888db180ae77070619a13ec4e6d6356a97a03176.1700008662.git.ashishsingha@nvidia.com> (raw)
In-Reply-To: <3ab879ada6d9f2b01496ecc05102510564888044.1700008662.git.ashishsingha@nvidia.com>

AndroidBootImgLib allows for platforms to append to kernel command
line but does not allow for the overall kernel command line to go
beyond the limit set by the image header. Address this limitation
by adding a pcd where platform can tell how many extra characters
they expect on their platform in addition to what the image header
specifies.

Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
---
 EmbeddedPkg/EmbeddedPkg.dec                                 | 5 +++++
 EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c   | 2 +-
 EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.inf | 3 ++-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec
index 341ef5e6a6..94dc3c9b76 100644
--- a/EmbeddedPkg/EmbeddedPkg.dec
+++ b/EmbeddedPkg/EmbeddedPkg.dec
@@ -183,3 +183,8 @@
   # Selection between DT and ACPI as a default
   #
   gEmbeddedTokenSpaceGuid.PcdDefaultDtPref|TRUE|BOOLEAN|0x0000059
+
+  #
+  # Expected Overflow Android Kernel Command Line Characters
+  #
+  gEmbeddedTokenSpaceGuid.PcdAndroidKernelCommandLineOverflow|0|UINT32|0x000005C
diff --git a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c
index f63648e60d..d16929f2bb 100644
--- a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c
+++ b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c
@@ -335,7 +335,7 @@ AndroidBootImgUpdateArgs (
     return Status;
   }
 
-  NewKernelArgSize = ANDROID_BOOTIMG_KERNEL_ARGS_SIZE;
+  NewKernelArgSize = ANDROID_BOOTIMG_KERNEL_ARGS_SIZE + PcdGet32 (PcdAndroidKernelCommandLineOverflow);
   *KernelArgs      = AllocateZeroPool (sizeof (CHAR16) * NewKernelArgSize);
   if (*KernelArgs == NULL) {
     DEBUG ((DEBUG_ERROR, "Fail to allocate memory\n"));
diff --git a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.inf b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.inf
index 8eefeef4f9..9754664df5 100644
--- a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.inf
+++ b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.inf
@@ -45,5 +45,6 @@
   gEfiAcpiTableGuid
   gFdtTableGuid
 
-[FeaturePcd]
+[Pcd]
   gEmbeddedTokenSpaceGuid.PcdAndroidBootLoadFile2
+  gEmbeddedTokenSpaceGuid.PcdAndroidKernelCommandLineOverflow
-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111228): https://edk2.groups.io/g/devel/message/111228
Mute This Topic: https://groups.io/mt/102598723/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2023-11-15  3:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15  3:12 [edk2-devel] [PATCH v2 1/2] EmbeddedPkg: Fix Android Boot Command Line Length Bug Ashish Singhal via groups.io
2023-11-15  3:12 ` Ashish Singhal via groups.io [this message]
2023-11-20 12:30   ` [edk2-devel] [PATCH v2 2/2] EmbeddedPkg: Allow longer android kernel command line Chang, Abner via groups.io
2023-11-20 17:18     ` Ashish Singhal via groups.io
2023-11-21  1:52       ` Chang, Abner via groups.io
2023-11-20 12:13 ` [edk2-devel] [PATCH v2 1/2] EmbeddedPkg: Fix Android Boot Command Line Length Bug Chang, Abner via groups.io
2023-11-20 19:33   ` Ashish Singhal via groups.io
2023-11-21  1:57     ` Chang, Abner via groups.io
2023-11-29 16:37       ` Ashish Singhal via groups.io
2023-11-30  2:13         ` Chang, Abner via groups.io
2023-11-30  2:15           ` Ashish Singhal via groups.io
2023-11-30  2:20             ` Chang, Abner via groups.io

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=888db180ae77070619a13ec4e6d6356a97a03176.1700008662.git.ashishsingha@nvidia.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