Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/1] fs/cpio: add option to manually specify file list
Date: Mon, 1 Jan 2018 12:54:48 +0100	[thread overview]
Message-ID: <20180101125448.41ee4404@windsurf> (raw)
In-Reply-To: <20171026191627.18949-2-sconnor@lynx.com>

Peter, Arnout, Yann, all,

This patch has been pending since ~2 months with no feedback. Do we
want something like this?

One thing that bothers me a bit is that it would make the
initramfs/cpio image contain a filesystem that is different from other
root filesystem images. But perhaps this is OK, because initramfs is
indeed special.

So I'm inclined to just apply this, as it may be useful for some users.
If you don't voice a concern within the next days, I'll apply.

Thanks!

Thmas

On Thu, 26 Oct 2017 12:16:27 -0700, Seamus Connor wrote:
> For some systems it may be desireable to have an initramfs that is
> smaller than the full root filesystem. This commit adds support for
> creating an initramfs based on a manually specified set of files. It is
> up to the user to define a sensible set of files. This file list could
> either be statically created, or it could be created as the result of a
> pre-fs hook script.
> 
> Signed-off-by: Seamus Connor <sconnor@lynx.com>
> ---
>  fs/cpio/Config.in | 30 ++++++++++++++++++++++++++++++
>  fs/cpio/cpio.mk   | 10 ++++++++++
>  2 files changed, 40 insertions(+)
> 
> diff --git a/fs/cpio/Config.in b/fs/cpio/Config.in
> index 206baca677..21aa2c6fb8 100644
> --- a/fs/cpio/Config.in
> +++ b/fs/cpio/Config.in
> @@ -7,6 +7,36 @@ config BR2_TARGET_ROOTFS_CPIO
>  
>  if BR2_TARGET_ROOTFS_CPIO
>  
> +choice
> +	prompt "Seleted Fileset"
> +	default BR2_TARGET_ROOTFS_CPIO_INCLUDE_ALL
> +	help
> +	  Select the set of files to include in the cpio of the root filesystem.
> +	  This may either be all files installed to the target, or it may be a
> +	  subset defined in the custom file list.
> +
> +config BR2_TARGET_ROOTFS_CPIO_INCLUDE_ALL
> +	bool "Include all files from target"
> +	help
> +	  Include all files from the target directory in the root filesystem.
> +
> +config BR2_TARGET_ROOTFS_CPIO_INCLUDE_CUSTOM
> +	bool "Include a subset of files from target"
> +	help
> +	  Include a subset of the files from the target directory in the root filesystem.
> +	  This requires a custom file list to be defined.  The actual file list may be
> +	  generated by a user script defined as part of the pre-fs hook.
> +
> +endchoice
> +
> +config BR2_TARGET_ROOTFS_CPIO_CUSTOM_FILELIST
> +	string "path to a custom file list"
> +	depends on BR2_TARGET_ROOTFS_CPIO && BR2_TARGET_ROOTFS_CPIO_INCLUDE_CUSTOM
> +	help
> +	  This file defines the contents of the rootfilesystem.  All files and folders
> +	  created in the rootfilesystem must be defined here.  This file can be statically
> +	  defined, or created as part of the pre-fs hook.
> +
>  choice
>  	prompt "Compression method"
>  	default BR2_TARGET_ROOTFS_CPIO_NONE
> diff --git a/fs/cpio/cpio.mk b/fs/cpio/cpio.mk
> index e82167e512..984ff37895 100644
> --- a/fs/cpio/cpio.mk
> +++ b/fs/cpio/cpio.mk
> @@ -27,10 +27,20 @@ endif # BR2_ROOTFS_DEVICE_CREATION_STATIC
>  
>  ROOTFS_CPIO_PRE_GEN_HOOKS += ROOTFS_CPIO_ADD_INIT
>  
> +ifeq ($(BR2_TARGET_ROOTFS_CPIO_INCLUDE_ALL),y)
> +
>  define ROOTFS_CPIO_CMD
>  	cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $@
>  endef
>  
> +else
> +
> +define ROOTFS_CPIO_CMD
> +	cd $(TARGET_DIR) && cpio --quiet -o -H newc < $(BR2_TARGET_ROOTFS_CPIO_CUSTOM_FILELIST) > $@
> +endef
> +
> +endif
> +
>  $(BINARIES_DIR)/rootfs.cpio.uboot: $(BINARIES_DIR)/rootfs.cpio host-uboot-tools
>  	$(MKIMAGE) -A $(MKIMAGE_ARCH) -T ramdisk \
>  		-C none -d $<$(ROOTFS_CPIO_COMPRESS_EXT) $@



-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  parent reply	other threads:[~2018-01-01 11:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Multiple root filesystems for single kernel/toolchain>
2017-10-26 19:16 ` [Buildroot] [PATCH 0/1] fs/cpio: add option to manually specify file list Seamus Connor
2017-10-26 19:16   ` [Buildroot] [PATCH 1/1] " Seamus Connor
2017-10-26 20:13     ` Seamus Connor
2018-01-01 11:54     ` Thomas Petazzoni [this message]
2018-01-01 13:22       ` Yann E. MORIN
2018-01-01 14:47         ` Thomas Petazzoni
2018-02-06 14:55           ` Sam Voss
2018-02-06 23:30           ` Arnout Vandecappelle
2018-02-16 22:51     ` Thomas Petazzoni

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=20180101125448.41ee4404@windsurf \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /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