mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] image-root-cpio: Move compression options into one menu.
@ 2022-02-17 12:55 Christian Melki
  2022-02-18 15:29 ` Michael Olbrich
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Melki @ 2022-02-17 12:55 UTC (permalink / raw)
  To: ptxdist

* Clean cpio generation, drop separate in and make for gz.
* Extend image-root-cpio.in with compression methods
(raw, gz, zstd, xz, lzop).
* Make compression a variable for the single makefile.
* Make filename variable depending on compression method

Signed-off-by: Christian Melki <christian.melki@t2data.com>
---
 platforms/image-root-cpio-gz.in | 10 ------
 platforms/image-root-cpio.in    | 59 +++++++++++++++++++++++++++++++--
 rules/image-root-cpio-gz.make   | 38 ---------------------
 rules/image-root-cpio.make      |  4 +--
 4 files changed, 59 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..4811909c8 100644
--- a/platforms/image-root-cpio.in
+++ b/platforms/image-root-cpio.in
@@ -1,10 +1,65 @@
 ## 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_ZSTD
+	select HOST_XZ			if IMAGE_ROOT_CPIO_XZ
+	select HOST_LZOP		if IMAGE_ROOT_CPIO_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_RAW
+	bool
+	prompt "CPIO raw, no compression"
+	default y
+	help
+	  No compression.
+
+config IMAGE_ROOT_CPIO_GZ
+	bool
+	prompt "CPIO gz compression"
+	help
+	  Compress root.cpio with gz
+
+config IMAGE_ROOT_CPIO_ZSTD
+	bool
+	prompt "CPIO zstd compression"
+	help
+	  Compress root.cpio with zstd
+
+config IMAGE_ROOT_CPIO_XZ
+	bool
+	prompt "CPIO xz compression"
+	help
+	  Compress root.cpio with xz
+
+config IMAGE_ROOT_CPIO_LZOP
+	bool
+	prompt "CPIO lzop compression"
+	help
+	  Compress root.cpio with lzop
+
+config IMAGE_ROOT_CPIO_COMPRESSION
+	string
+	default ""		if IMAGE_ROOT_CPIO_RAW
+	default ".gz"		if IMAGE_ROOT_CPIO_GZ
+	default ".zst"		if IMAGE_ROOT_CPIO_ZSTD
+	default ".xz"		if IMAGE_ROOT_CPIO_XZ
+	default ".lzo"		if IMAGE_ROOT_CPIO_LZOP
+
+config IMAGE_ROOT_CPIO_COMPRESSION_UTIL
+	string
+	default ""		if IMAGE_ROOT_CPIO_RAW
+	default "gzip"		if IMAGE_ROOT_CPIO_GZ
+	default "zstd"		if IMAGE_ROOT_CPIO_ZSTD
+	default "xz"		if IMAGE_ROOT_CPIO_XZ
+	default "lzop"		if IMAGE_ROOT_CPIO_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..4232983dd 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))
 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):
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ptxdist] [PATCH] image-root-cpio: Move compression options into one menu.
  2022-02-17 12:55 [ptxdist] [PATCH] image-root-cpio: Move compression options into one menu Christian Melki
@ 2022-02-18 15:29 ` Michael Olbrich
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Olbrich @ 2022-02-18 15:29 UTC (permalink / raw)
  To: Christian Melki; +Cc: ptxdist

On Thu, Feb 17, 2022 at 01:55:04PM +0100, Christian Melki wrote:
> * Clean cpio generation, drop separate in and make for gz.
> * Extend image-root-cpio.in with compression methods
> (raw, gz, zstd, xz, lzop).
> * Make compression a variable for the single makefile.
> * Make filename variable depending on compression method
> 
> Signed-off-by: Christian Melki <christian.melki@t2data.com>

This needs a migrate helper from:

PTXCONF_IMAGE_ROOT_CPIO_GZ=y

to

PTXCONF_IMAGE_ROOT_CPIO=y
PTXCONF_IMAGE_ROOT_CPIO_GZ=y

in scripts/migrate/migrate_platform

> ---
>  platforms/image-root-cpio-gz.in | 10 ------
>  platforms/image-root-cpio.in    | 59 +++++++++++++++++++++++++++++++--
>  rules/image-root-cpio-gz.make   | 38 ---------------------
>  rules/image-root-cpio.make      |  4 +--
>  4 files changed, 59 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..4811909c8 100644
> --- a/platforms/image-root-cpio.in
> +++ b/platforms/image-root-cpio.in
> @@ -1,10 +1,65 @@
>  ## 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_ZSTD
> +	select HOST_XZ			if IMAGE_ROOT_CPIO_XZ
> +	select HOST_LZOP		if IMAGE_ROOT_CPIO_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_RAW
> +	bool
> +	prompt "CPIO raw, no compression"
> +	default y
> +	help
> +	  No compression.
> +
> +config IMAGE_ROOT_CPIO_GZ
> +	bool
> +	prompt "CPIO gz compression"
> +	help
> +	  Compress root.cpio with gz
> +
> +config IMAGE_ROOT_CPIO_ZSTD
> +	bool
> +	prompt "CPIO zstd compression"
> +	help
> +	  Compress root.cpio with zstd
> +
> +config IMAGE_ROOT_CPIO_XZ
> +	bool
> +	prompt "CPIO xz compression"
> +	help
> +	  Compress root.cpio with xz
> +
> +config IMAGE_ROOT_CPIO_LZOP
> +	bool
> +	prompt "CPIO lzop compression"
> +	help
> +	  Compress root.cpio with lzop

Use a 'choice' for these options. Only on of them is allowed.

> +
> +config IMAGE_ROOT_CPIO_COMPRESSION
> +	string
> +	default ""		if IMAGE_ROOT_CPIO_RAW
> +	default ".gz"		if IMAGE_ROOT_CPIO_GZ
> +	default ".zst"		if IMAGE_ROOT_CPIO_ZSTD
> +	default ".xz"		if IMAGE_ROOT_CPIO_XZ
> +	default ".lzo"		if IMAGE_ROOT_CPIO_LZOP
> +
> +config IMAGE_ROOT_CPIO_COMPRESSION_UTIL
> +	string
> +	default ""		if IMAGE_ROOT_CPIO_RAW
> +	default "gzip"		if IMAGE_ROOT_CPIO_GZ
> +	default "zstd"		if IMAGE_ROOT_CPIO_ZSTD
> +	default "xz"		if IMAGE_ROOT_CPIO_XZ
> +	default "lzop"		if IMAGE_ROOT_CPIO_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..4232983dd 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))

You need to fix rules/kernel-fit.make to use $(IMAGE_ROOT_CPIO_IMAGE).
Don't forget to use '=' instead of ':=' there.

Michael

>  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):
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-18 15:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17 12:55 [ptxdist] [PATCH] image-root-cpio: Move compression options into one menu Christian Melki
2022-02-18 15:29 ` Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox