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

[ImageBuilder] Add zstd compression support


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Tue, 17 Dec 2024 16:19:03 -0500
  • 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 (0)
  • 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=j4uW22R7L//WOI3zTt03o+J5QXM2VE11hPWTrbGf9bc=; b=WfST7oHfqlQCSQePoSMjmlgicckyIuSb4a6oGp+yWbM8iOiltIilmS3KFOLBKbEQaZwNIwD0eBMvFS5CGik2kuE6/DvAjQqs3psaIhokB5pd81ZQAl1w12K5E0hKfkS269WY6aTP5fU8yKCGnJFFUN40CJiW9kYsucH6aLiBkr2fw2GSH3Ld9Mea0eAi6+i6ZogiXE+WZ2sMq4rjboyEnMnlFVoQsJyfkLaXPPl4ESUSMkezNE6Pfv5P0T/cCTeqz+I3hFujp/AVxCewxhJlcXA0DHlNLVvNIngP981ZeysHnQFy/GGaE+ivp7ZvEnmxmUEHpNg/YpRw/pjk1V6mfw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CNYU6mEQ+Pwj/1CJAfTcpFuYaY6MNoBREdUsrX0UY23XUaHq5h7nGv4mC1KHpgF7c3xslwHccUgObkwoN3iOpUOwg2emXxQVwuuW13VZfkUMT20F34o9Yh0EcBWYMRVWiWDj0cgKb9JDVBtHmfh/NPoaGPJL4QsXriLXouVRZst1CYw9szEJRAEZ5bDsXcqWjLRU/iqxQ95vrOsiQRPo45eaw/7xaVDQv7B8fKXKzTgTDwyaVN14yLSAWCpU73L6iu3K111HL+uRuGzn2W5o4MrLX7R5fKbptPPOE4qfe9wna7j5QQ/UaImGNl/ZkMGhfZJKY3E/F9xCKS+Xke/5ig==
  • Cc: Stefano Stabellini <stefano.stabellini@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>
  • Delivery-date: Tue, 17 Dec 2024 21:19:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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
+        filename=$tmp
     fi
     check_file_type $filename "$type"
 }
-- 
2.34.1




 


Rackspace

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