mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Christian Melki <christian.melki@t2data.com>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [PATCH v2] image-root-cpio: Move compression options into one menu.
Date: Mon, 21 Feb 2022 22:26:03 +0100	[thread overview]
Message-ID: <20220221212603.3825997-1-christian.melki@t2data.com> (raw)

* Clean cpio generation, drop separate in and make for gz.
* Extend image-root-cpio.in with compression methods
(raw, gz, zstd, xz, lzop).
* Compression mode selects compression utility.
* Filename suffix depends on compression mode.
* Platform migration from PTXCONF_IMAGE_ROOT_CPIO_GZ to
PTXCONF_IMAGE_ROOT_CPIO and PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_MODE_GZ

Signed-off-by: Christian Melki <christian.melki@t2data.com>
---
 platforms/image-root-cpio-gz.in  | 10 ------
 platforms/image-root-cpio.in     | 58 ++++++++++++++++++++++++++++++--
 rules/image-root-cpio-gz.make    | 38 ---------------------
 rules/image-root-cpio.make       |  4 +--
 scripts/migrate/migrate_platform |  8 +++++
 5 files changed, 66 insertions(+), 52 deletions(-)
 delete mode 100644 platforms/image-root-cpio-gz.in
 delete mode 100644 rules/image-root-cpio-gz.make

diff --git a/platforms/image-root-cpio-gz.in b/platforms/image-root-cpio-gz.in
deleted file mode 100644
index e1feb5f9b..000000000
--- a/platforms/image-root-cpio-gz.in
+++ /dev/null
@@ -1,10 +0,0 @@
-## SECTION=image
-
-config IMAGE_ROOT_CPIO_GZ
-	tristate
-	select HOST_GENIMAGE
-	select IMAGE_ROOT_TGZ
-	prompt "Generate images/root.cpio.gz"
-	help
-	  Build the traditionally initrd RAM disk to be used
-	  as initramfs by the kernel.
diff --git a/platforms/image-root-cpio.in b/platforms/image-root-cpio.in
index f5ee4c1d8..e3e675fd6 100644
--- a/platforms/image-root-cpio.in
+++ b/platforms/image-root-cpio.in
@@ -1,10 +1,64 @@
 ## SECTION=image
 
-config IMAGE_ROOT_CPIO
+menuconfig IMAGE_ROOT_CPIO
 	tristate
 	select HOST_GENIMAGE
 	select IMAGE_ROOT_TGZ
-	prompt "Generate images/root.cpio"
+	select HOST_ZSTD		if IMAGE_ROOT_CPIO_COMPRESSION_MODE_ZSTD
+	select HOST_XZ			if IMAGE_ROOT_CPIO_COMPRESSION_MODE_XZ
+	select HOST_LZOP		if IMAGE_ROOT_CPIO_COMPRESSION_MODE_LZOP
+	prompt "Generate images/root.cpio     "
 	help
 	  Build the traditionally initrd RAM disk to be used
 	  as initramfs by the kernel.
+
+if IMAGE_ROOT_CPIO
+
+config IMAGE_ROOT_CPIO_COMPRESSION_MODE_NONE
+	bool
+	prompt "CPIO raw, no compression"
+	default y
+	help
+	  No compression.
+
+config IMAGE_ROOT_CPIO_COMPRESSION_MODE_GZ
+	bool
+	prompt "CPIO gz compression"
+	help
+	  Compress root.cpio with gz
+
+config IMAGE_ROOT_CPIO_COMPRESSION_MODE_ZSTD
+	bool
+	prompt "CPIO zstd compression"
+	help
+	  Compress root.cpio with zstd
+
+config IMAGE_ROOT_CPIO_COMPRESSION_MODE_XZ
+	bool
+	prompt "CPIO xz compression"
+	help
+	  Compress root.cpio with xz
+
+config IMAGE_ROOT_CPIO_COMPRESSION_MODE_LZOP
+	bool
+	prompt "CPIO lzop compression"
+	help
+	  Compress root.cpio with lzop
+
+config IMAGE_ROOT_CPIO_COMPRESSION_SUFFIX
+	string
+	default ""		if IMAGE_ROOT_CPIO_COMPRESSION_MODE_NONE
+	default ".gz"		if IMAGE_ROOT_CPIO_COMPRESSION_MODE_GZ
+	default ".zst"		if IMAGE_ROOT_CPIO_COMPRESSION_MODE_ZSTD
+	default ".xz"		if IMAGE_ROOT_CPIO_COMPRESSION_MODE_XZ
+	default ".lzo"		if IMAGE_ROOT_CPIO_COMPRESSION_MODE_LZOP
+
+config IMAGE_ROOT_CPIO_COMPRESSION_UTIL
+	string
+	default ""		if IMAGE_ROOT_CPIO_COMPRESSION_MODE_NONE
+	default "gzip"		if IMAGE_ROOT_CPIO_COMPRESSION_MODE_GZIP
+	default "zstd"		if IMAGE_ROOT_CPIO_COMPRESSION_MODE_ZSTD
+	default "xz"		if IMAGE_ROOT_CPIO_COMPRESSION_MODE_XZ
+	default "lzop"		if IMAGE_ROOT_CPIO_COMPRESSION_MODE_LZOP
+
+endif
diff --git a/rules/image-root-cpio-gz.make b/rules/image-root-cpio-gz.make
deleted file mode 100644
index 52a6a4bd9..000000000
--- a/rules/image-root-cpio-gz.make
+++ /dev/null
@@ -1,38 +0,0 @@
-# -*-makefile-*-
-#
-# Copyright (C) 2012 by Michael Olbrich <m.olbrich@pengutronix.de>
-#
-# For further information about the PTXdist project and license conditions
-# see the README file.
-#
-
-#
-# We provide this package
-#
-IMAGE_PACKAGES-$(PTXCONF_IMAGE_ROOT_CPIO_GZ) += image-root-cpio-gz
-
-#
-# Paths and names
-#
-IMAGE_ROOT_CPIO_GZ		:= image-root-cpio-gz
-IMAGE_ROOT_CPIO_GZ_DIR		:= $(BUILDDIR)/$(IMAGE_ROOT_CPIO_GZ)
-IMAGE_ROOT_CPIO_GZ_IMAGE	:= $(IMAGEDIR)/root.cpio.gz
-IMAGE_ROOT_CPIO_GZ_FILES	:= $(IMAGEDIR)/root.tgz
-IMAGE_ROOT_CPIO_GZ_CONFIG	:= cpio.config
-
-# ----------------------------------------------------------------------------
-# Image
-# ----------------------------------------------------------------------------
-
-IMAGE_ROOT_CPIO_GZ_ENV := \
-	FORMAT="newc" \
-	COMPRESS=gzip
-
-ifdef PTXCONF_IMAGE_ROOT_CPIO_GZ
-$(IMAGE_ROOT_CPIO_GZ_IMAGE):
-	@$(call targetinfo)
-	@$(call image/genimage, IMAGE_ROOT_CPIO_GZ)
-	@$(call finish)
-endif
-
-# vim: syntax=make
diff --git a/rules/image-root-cpio.make b/rules/image-root-cpio.make
index ab6afdd42..fdb0ccfff 100644
--- a/rules/image-root-cpio.make
+++ b/rules/image-root-cpio.make
@@ -16,7 +16,7 @@ IMAGE_PACKAGES-$(PTXCONF_IMAGE_ROOT_CPIO) += image-root-cpio
 #
 IMAGE_ROOT_CPIO		:= image-root-cpio
 IMAGE_ROOT_CPIO_DIR	:= $(BUILDDIR)/$(IMAGE_ROOT_CPIO)
-IMAGE_ROOT_CPIO_IMAGE	:= $(IMAGEDIR)/root.cpio
+IMAGE_ROOT_CPIO_IMAGE	:= $(IMAGEDIR)/root.cpio$(call remove_quotes, $(PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_SUFFIX))
 IMAGE_ROOT_CPIO_FILES	:= $(IMAGEDIR)/root.tgz
 IMAGE_ROOT_CPIO_CONFIG	:= cpio.config
 
@@ -26,7 +26,7 @@ IMAGE_ROOT_CPIO_CONFIG	:= cpio.config
 
 IMAGE_ROOT_CPIO_ENV := \
 	FORMAT="newc" \
-	COMPRESS=
+	COMPRESS=$(call remove_quotes, $(PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_UTIL))
 
 ifdef PTXCONF_IMAGE_ROOT_CPIO
 $(IMAGE_ROOT_CPIO_IMAGE):
diff --git a/scripts/migrate/migrate_platform b/scripts/migrate/migrate_platform
index e9b4854d5..c75705f3a 100755
--- a/scripts/migrate/migrate_platform
+++ b/scripts/migrate/migrate_platform
@@ -51,3 +51,11 @@ s/^\(\(# \)\?PTXCONF_TF_A_PLATFORM\>\)\(.*$\)/\1S\3/
 #
 s/^\(\(# \)\?PTXCONF\)_DTC\>\(.*$\)/\1_KERNEL_DTB\3/
 s/^\(\(# \)\?PTXCONF\)_DTC_OFTREE\(_DTS\(\|_PATH\)\)\(.*$\)/\1_KERNEL\3\5/
+
+#
+# from   : ptxdist-2022.02.0
+# to     : ptxdist-2022.03.0
+# symbol : PTXCONF_IMAGE_ROOT_CPIO_GZ -> PTXCONF_IMAGE_ROOT_CPIO, PTXCONF_IMAGE_ROOT_CPIO_COMPRESSION_MODE_GZ
+# reason : root.cpio generation consolidated. gz generation now dependent on regular cpio generation.
+#
+s/^\(\(# \)\?PTXCONF_\)IMAGE_ROOT_CPIO_GZ\>\(.*\)$/\1IMAGE_ROOT_CPIO\3\n\1IMAGE_ROOT_CPIO_COMPRESSION_MODE_GZ\3/
-- 
2.30.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


             reply	other threads:[~2022-02-21 21:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21 21:26 Christian Melki [this message]
2022-02-22  7:37 ` Michael Olbrich

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-all 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=20220221212603.3825997-1-christian.melki@t2data.com \
    --to=christian.melki@t2data.com \
    --cc=ptxdist@pengutronix.de \
    /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