mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Christian Melki <christian.melki@t2data.com>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [RFC: PATCH] rootfs: Add possibility to add custom directories and files.
Date: Tue, 11 Jan 2022 10:58:48 +0100	[thread overview]
Message-ID: <20220111095848.835429-1-christian.melki@t2data.com> (raw)

Add two custom targets in the rootfs configuration.
Rationale behind this is that I often find myself maintaining
a copy of a package ruleset just to be able to copy a file or add
a directory.
These changes are often things that are project specific and
are useless upstream.
Now this type of project specific maintenance can go away.

Signed-off-by: Christian Melki <christian.melki@t2data.com>
---
 rules/rootfs.in   | 20 ++++++++++++++++++++
 rules/rootfs.make |  5 +++++
 2 files changed, 25 insertions(+)

diff --git a/rules/rootfs.in b/rules/rootfs.in
index 34e9bdcff..3183abc6b 100644
--- a/rules/rootfs.in
+++ b/rules/rootfs.in
@@ -257,6 +257,15 @@ config ROOTFS_VAR_TMP
 	  available at run-time.
 
 endmenu
+
+config ROOTFS_CUSTOM_DIRS
+	string "custom directories"
+	default ""
+	help
+	  Create custom directories in the root filesystem.
+	  Directories will be created with a standard 0755 permission.
+	  Multiple directories can be specified, separated by spaces.
+
 endif # ROOTFS
 
 # ----------------------------------------------------------------------------
@@ -488,4 +497,15 @@ choice
 		  If enabled, no /init will be install.
 endchoice
 
+config ROOTFS_CUSTOM_FILES
+	string "custom files"
+	default ""
+	help
+	  Copy custom files from projectroot to the root filesystem.
+	  Files will be created with a standard 0644 permission.
+	  Multiple files can be specified, separated by spaces.
+	  Use this if you want to add various scripts, data files,
+	  etc but to not wish to maintain a copy of a package file
+	  solely for that purpose.
+
 endmenu
diff --git a/rules/rootfs.make b/rules/rootfs.make
index 1c1e5501c..55fb06486 100644
--- a/rules/rootfs.make
+++ b/rules/rootfs.make
@@ -145,6 +145,8 @@ ifdef PTXCONF_ROOTFS_VAR_OVERLAYFS
 	@$(call install_link, rootfs, ../var.mount, \
 		/usr/lib/systemd/system/local-fs.target.requires/var.mount)
 endif
+	@$(foreach customdir, $(call remove_quotes,$(PTXCONF_ROOTFS_CUSTOM_DIRS)), \
+		$(call install_copy, rootfs, 0, 0, 0755, $(customdir))$(ptx/nl))
 
 #	#
 #	# install files in rootfs
@@ -277,6 +279,9 @@ ifdef PTXCONF_ROOTFS_INIT_BIN
 	@$(call install_alternative, rootfs, 0, 0, 0755, /init)
 endif
 
+	@$(foreach customfiles, $(call remove_quotes,$(PTXCONF_ROOTFS_CUSTOM_FILES)), \
+		$(call install_alternative, rootfs, 0, 0, 0644, $(customfiles))$(ptx/nl))
+
 	@$(call install_finish, rootfs)
 
 	@$(call touch)
-- 
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-01-11  9:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11  9:58 Christian Melki [this message]
2022-01-11 14:16 ` Felix Mellmann
2022-01-12 11:46   ` Christian Melki
2022-01-12 11:56     ` Felix Mellmann

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=20220111095848.835429-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