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

Re: [ImageBuilder] Add zstd compression support


  • To: Jason Andryuk <jason.andryuk@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Ayan Kumar Halder <ayankuma@xxxxxxx>
  • Date: Mon, 30 Dec 2024 11:10:15 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=5UVhejHqxEzhbFwNr0JP6tJ8LiLWKLfLpzm4C5uK/3k=; b=VVsuzcSOn93E+t/O1YphtkZJJMs9h0k9JJoEoBy1qjyHwzcPXfcK48mI05ap0CkyuyBKeUl4vinjEoayy/Jqt/VIccVrgEzfbY7e4swSnao570/CKymZm0/+K7B6Pgr0uVfsWPZiLFDfWm9UCFHz2WbxiD2P7buyMkKFrsjVBOXTfM6f0bPdkfpoztB5oxhYi6cYSmNgBESBSYg1LgTXPD4khH+O8x4KQc4MM9wGbWwKtp/kBtr1J213J1BF9JWtPZNp13VG7GleSrTMqfchIDoyNQPwPH02Lh+fLbXwuYQPz5fxkAp46L6gxC/MJP6/eeLTWC7c0CE+Z4+waHf46w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rsq1FaqOgxoTzT0fDM/T3HCzu3uPtz2v5jRVVQTtSTV7K4oAt7dQKbGTwatugO2xJRqGYp+Ow+kZZIyiml+ujMXcanjjiayqDCWP6kYYaqP9Rd14VU8uMfiMUxTimLiwyIhdnn393XEbdZ8/jzr6t5zLoP0UEzcv1/+GCXHNBrd1wU6Ma0pTOMTDIYnnlHyrD6rHtvqwkq1t1C546sVhMlTCrqlC6GBcqUmdjUD7cGk9pwiPGbT1BEoPAEefsimVHHRKB+lmXsxIHlsjNb1qkc67f+hjFfZe/h8J7nkfRxrTnTT9t1mGloRDEZ+LDVL5CvMK611W9ZZA23llygq7UQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: Stefano Stabellini <stefano.stabellini@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Mon, 30 Dec 2024 11:11:08 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Jason

On 17/12/2024 21:19, Jason Andryuk wrote:
uboot-script-gen fails to process a zstd-compressed initramdisk, exiting
with:
Wrong file type initrd.img. It should be cpio archive, exiting.

Extend the existing approach to also check zstd.

Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
  scripts/uboot-script-gen | 11 ++++++++---
  1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen
index fc63702..db2c011 100755
--- a/scripts/uboot-script-gen
+++ b/scripts/uboot-script-gen
@@ -567,6 +567,7 @@ function check_compressed_file_type()
  {
      local filename=$1
      local type="$2"
+    local file_type
if [ ! -f $filename ]
      then
@@ -574,13 +575,17 @@ function check_compressed_file_type()
          cleanup_and_return_err
      fi
- file -L $filename | grep "gzip compressed data" &> /dev/null
-    if test $? == 0
-    then
+    file_type=$( file -L $filename )
+    if echo "$file_type" | grep -q "gzip compressed data" ; then
          local tmp=`mktemp`
          tmp_files+=($tmp)
          cat $filename | gunzip > $tmp
          filename=$tmp
+    elif echo "$file_type" | grep -q "Zstandard compressed data" ; then
+        local tmp=`mktemp`
+        tmp_files+=($tmp)
+        zstdcat $filename > $tmp

I think you need to list zstd in |prog_req
|

|See https://gitlab.com/xen-project/imagebuilder/-/blob/master/scripts/uboot-script-gen?ref_type=heads#L5|

|Also you need to include this as a part of the dockerfiles like|

|https://gitlab.com/xen-project/xen/-/blob/staging/automation/tests-artifacts/qemu-system-aarch64/6.0.0-arm64v8.dockerfile?ref_type=heads|

|https://gitlab.com/xen-project/xen/-/blob/staging/automation/tests-artifacts/alpine/3.18-arm64v8.dockerfile?ref_type=heads
|

+        filename=$tmp
      fi
      check_file_type $filename "$type"
  }
- Ayan



 


Rackspace

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