Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Seamus Connor <sconnor@lynx.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/1] fs/cpio: add option to manually specify file list
Date: Thu, 26 Oct 2017 12:16:27 -0700	[thread overview]
Message-ID: <20171026191627.18949-2-sconnor@lynx.com> (raw)
In-Reply-To: <20171026191627.18949-1-sconnor@lynx.com>

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) $@
-- 
2.14.2

  reply	other threads:[~2017-10-26 19:16 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   ` Seamus Connor [this message]
2017-10-26 20:13     ` [Buildroot] [PATCH 1/1] " Seamus Connor
2018-01-01 11:54     ` Thomas Petazzoni
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=20171026191627.18949-2-sconnor@lynx.com \
    --to=sconnor@lynx.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