Linux Documentation
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: David Disseldorp <ddiss@suse.de>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>
Cc: linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH v2] docs: initramfs: update compression and mtime descriptions
Date: Tue, 1 Apr 2025 21:53:10 -0700	[thread overview]
Message-ID: <edcc6e4d-3270-46f1-aafc-437c6ba5b0a3@infradead.org> (raw)
In-Reply-To: <20250402033949.852-2-ddiss@suse.de>



On 4/1/25 8:39 PM, David Disseldorp wrote:
> Update the document to reflect that initramfs didn't replace initrd
> following kernel 2.5.x.
> The initramfs buffer format now supports many compression types in
> addition to gzip, so include them in the grammar section.
> c_mtime use is dependent on CONFIG_INITRAMFS_PRESERVE_MTIME.
> 
> Signed-off-by: David Disseldorp <ddiss@suse.de>

Reviewed-by: Randy Dunlap <rdunlap@infradead.org>

Thanks.

> ---
> Changes since v1 following feedback from Randy Dunlap:
> - contents -> content
> - format of the initramfs buffer format -> the initramfs buffer format
> 
>  .../early-userspace/buffer-format.rst         | 34 ++++++++++++-------
>  1 file changed, 21 insertions(+), 13 deletions(-)
> 
> diff --git a/Documentation/driver-api/early-userspace/buffer-format.rst b/Documentation/driver-api/early-userspace/buffer-format.rst
> index 7f74e301fdf35..726bfa2fe70da 100644
> --- a/Documentation/driver-api/early-userspace/buffer-format.rst
> +++ b/Documentation/driver-api/early-userspace/buffer-format.rst
> @@ -4,20 +4,18 @@ initramfs buffer format
>  
>  Al Viro, H. Peter Anvin
>  
> -Last revision: 2002-01-13
> -
> -Starting with kernel 2.5.x, the old "initial ramdisk" protocol is
> -getting {replaced/complemented} with the new "initial ramfs"
> -(initramfs) protocol.  The initramfs contents is passed using the same
> -memory buffer protocol used by the initrd protocol, but the contents
> +With kernel 2.5.x, the old "initial ramdisk" protocol was complemented
> +with an "initial ramfs" protocol.  The initramfs content is passed
> +using the same memory buffer protocol used by initrd, but the content
>  is different.  The initramfs buffer contains an archive which is
> -expanded into a ramfs filesystem; this document details the format of
> -the initramfs buffer format.
> +expanded into a ramfs filesystem; this document details the initramfs
> +buffer format.
>  
>  The initramfs buffer format is based around the "newc" or "crc" CPIO
>  formats, and can be created with the cpio(1) utility.  The cpio
> -archive can be compressed using gzip(1).  One valid version of an
> -initramfs buffer is thus a single .cpio.gz file.
> +archive can be compressed using gzip(1), or any other algorithm provided
> +via CONFIG_DECOMPRESS_*.  One valid version of an initramfs buffer is
> +thus a single .cpio.gz file.
>  
>  The full format of the initramfs buffer is defined by the following
>  grammar, where::
> @@ -25,12 +23,20 @@ grammar, where::
>  	*	is used to indicate "0 or more occurrences of"
>  	(|)	indicates alternatives
>  	+	indicates concatenation
> -	GZIP()	indicates the gzip(1) of the operand
> +	GZIP()	indicates gzip compression of the operand
> +	BZIP2()	indicates bzip2 compression of the operand
> +	LZMA()	indicates lzma compression of the operand
> +	XZ()	indicates xz compression of the operand
> +	LZO()	indicates lzo compression of the operand
> +	LZ4()	indicates lz4 compression of the operand
> +	ZSTD()	indicates zstd compression of the operand
>  	ALGN(n)	means padding with null bytes to an n-byte boundary
>  
> -	initramfs  := ("\0" | cpio_archive | cpio_gzip_archive)*
> +	initramfs := ("\0" | cpio_archive | cpio_compressed_archive)*
>  
> -	cpio_gzip_archive := GZIP(cpio_archive)
> +	cpio_compressed_archive := (GZIP(cpio_archive) | BZIP2(cpio_archive)
> +		| LZMA(cpio_archive) | XZ(cpio_archive) | LZO(cpio_archive)
> +		| LZ4(cpio_archive) | ZSTD(cpio_archive))
>  
>  	cpio_archive := cpio_file* + (<nothing> | cpio_trailer)
>  
> @@ -75,6 +81,8 @@ c_chksum      8 bytes		 Checksum of data field if c_magic is 070702;
>  The c_mode field matches the contents of st_mode returned by stat(2)
>  on Linux, and encodes the file type and file permissions.
>  
> +c_mtime is ignored unless CONFIG_INITRAMFS_PRESERVE_MTIME=y is set.
> +
>  The c_filesize should be zero for any file which is not a regular file
>  or symlink.
>  

-- 
~Randy

  reply	other threads:[~2025-04-02  4:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-02  3:39 [PATCH v2] docs: initramfs: update compression and mtime descriptions David Disseldorp
2025-04-02  4:53 ` Randy Dunlap [this message]
2025-04-03  8:17 ` Christian Brauner

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=edcc6e4d-3270-46f1-aafc-437c6ba5b0a3@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=brauner@kernel.org \
    --cc=ddiss@suse.de \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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