[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ImageBuilder PATCH v2] uboot-script-gen: use size from arm64 Image header


  • To: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Wed, 13 Sep 2023 15:36:25 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=d5dYe2H+xWSbIMkmTT7oWuL4uPScGFRTG23ethSVjfs=; b=jTvrtR2+LQ+pw1V0GDJTdaboeIewmT+Z4ucubLZCIOr09YYRE+MIHe6PTdDmIv/sPcAlIUvsWrzh20PVQl6myghHVDPpr6OwGt9jGQYFLcpdqqOdJrSLqFPKcrdtW6nu9DRCze20c7mfWR5bvg6JEj2j6ujYaeccOB124rzuPrUancR0+WZHOe3q1+Dqmey5UJERJlJAplIMaDDbiPXUYbRNuxomVoOu0EwskxzWSotFw0t20Wsn9+8OVGxsCLck6ts8GamtdbwKkUkSD/AYAbBQGsGT0YrOrfUm+4zofjDd1l+wGYedzmM4swZ9tYO3f2q/a9fsgIvviHSVohjg2Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mFK+qv8ZtoyLiWmVwRdYGaEJgM17z5dqB+oDHkGq9K8UK9n2Ed/AiYd8c6/tAgxQcKDwwZIb5NtofwGVr7KtYO57+Q0BxUafyfNVulCwDU+5LnxtLN5s0AfHfF2IncBjcpep3xdzAQxDzkKSuYODoMl/+lce5i2Ax//Atu9kaePNxKFJkyut5KguLldi5v4misY2bpnEu93F+J82+DOkkQN9lLtht4cvu9ICj/B5LmNXkbJQYNS98EsmvXb/BqevofyrKu0E2OTzzvGlDKNVjNxKKX9Z1taB4MsB3vrpRMdiSFnr0puO9aEg5DvhsUd8QJazUvxKr6z1OcBPaq+mMA==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Wed, 13 Sep 2023 13:36:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Stewart,

On 13/09/2023 15:31, Stewart Hildebrand wrote:
> On 9/13/23 03:27, Michal Orzel wrote:
>> Hi Stewart,
>>
>> On 12/09/2023 22:43, Stewart Hildebrand wrote:
>>> There is a corner case where the filesizes of the xen and Linux kernel 
>>> images
>>> are not sufficient. These binaries likely contain NOLOAD sections (e.g. 
>>> bss),
>>> which are not accounted in the filesize.
>>>
>>> Check for the presence of an arm64 kernel image header, and get the 
>>> effective
>>> image size from the header. Use the effective image size for calculating the
>>> next load address and for populating the size in the /chosen/dom*/reg 
>>> property.
>>>
>>> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
>> The patch works, thanks!
>> Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
>>
>> with one little suggestion...
>>
>>> ---
>>> v1->v2:
>>> * add in-code comments
>>> * use variables more
>>> ---
>>>  scripts/uboot-script-gen | 17 ++++++++++++++++-
>>>  1 file changed, 16 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen
>>> index 9656a458ac00..f0972d983017 100755
>>> --- a/scripts/uboot-script-gen
>>> +++ b/scripts/uboot-script-gen
>>> @@ -2,7 +2,7 @@
>>>  
>>>  offset=$((2*1024*1024))
>>>  filesize=0
>>> -prog_req=(mkimage file fdtput mktemp awk)
>>> +prog_req=(mkimage file fdtput mktemp awk od)
>>>  
>>>  function cleanup_and_return_err()
>>>  {
>>> @@ -435,6 +435,21 @@ function add_size()
>>>  {
>>>      local filename=$1
>>>      local size=`stat -L --printf="%s" $filename`
>>> +    # Read arm64 header magic 
>>> (https://www.kernel.org/doc/Documentation/arm64/booting.txt)
>>> +    local arm64_header_magic=$(od -j 56 -N 4 -t x4 ${filename} | head -n 1 
>>> | awk -F' ' '{ print $2 }')
>> can we simplify:
>> head -n 1 | awk -F' ' '{ print $2 }'
>> by just doing:
>> awk 'NR==1 {print $2}'
> 
> Yes. I'll send v3.
I think it can be done on commit, so please check with Stefano.

~Michal



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.