mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: "yd.zhang" <yd.zhang@ilabservice.com>
To: ptxdist@pengutronix.de
Cc: "yd.zhang" <yd.zhang@ilabservice.com>
Subject: [ptxdist] [PATCH 1/2] bbinit: Add rootrw script
Date: Mon, 28 Dec 2020 11:59:36 +0800	[thread overview]
Message-ID: <20201228035937.3489293-2-yd.zhang@ilabservice.com> (raw)
In-Reply-To: <20201228035937.3489293-1-yd.zhang@ilabservice.com>

The script is remount root as rw. Some embedded systems to root mounted as ro,
and cannot use custom u-boot and linux-kernel.

Signed-off-by: yd.zhang <yd.zhang@ilabservice.com>
---
 projectroot/etc/init.d/rootrw | 16 ++++++++++++++++
 rules/initmethod-bbinit.in    | 14 ++++++++++++++
 rules/initmethod-bbinit.make  | 12 ++++++++++++
 3 files changed, 42 insertions(+)
 create mode 100644 projectroot/etc/init.d/rootrw

diff --git a/projectroot/etc/init.d/rootrw b/projectroot/etc/init.d/rootrw
new file mode 100644
index 000000000..50e7e5686
--- /dev/null
+++ b/projectroot/etc/init.d/rootrw
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#
+# /etc/init.d/rootrw - remount root as rw
+#
+
+case $1 in
+	start)
+		mount -o remount,rw /	
+		;;
+	stop)
+		;;
+	*)
+		echo "Usage: $0 [start|stop]"
+		;;
+esac
diff --git a/rules/initmethod-bbinit.in b/rules/initmethod-bbinit.in
index e0b3be178..2ed37c627 100644
--- a/rules/initmethod-bbinit.in
+++ b/rules/initmethod-bbinit.in
@@ -2,6 +2,14 @@
 
 if INITMETHOD_BBINIT
 
+config INITMETHOD_BBINIT_ETC_INITD_ROOTRW
+	bool
+	prompt "install /etc/init.d/rootrw"
+	default y
+	select BUSYBOX_MOUNT     if BUSYBOX
+	help
+		The /etc/init.d/rootrw script remount root as rw.
+
 config INITMETHOD_BBINIT_ETC_INITD_MODULES
 	bool
 	prompt "install /etc/init.d/modules"
@@ -43,6 +51,12 @@ menu "service startup configuration "
 
 source "generated/initmethod_bbinit.in"
 
+config INITMETHOD_BBINIT_LINK_ROOTRW
+  string
+  depends on INITMETHOD_BBINIT_ETC_INITD_ROOTRW
+  prompt "rootrw"
+  default "S01rootrw"
+
 config INITMETHOD_BBINIT_LINK_LOGROTATE
 	string
 	depends on INITMETHOD_BBINIT_ETC_INITD_LOGROTATE
diff --git a/rules/initmethod-bbinit.make b/rules/initmethod-bbinit.make
index 75d381e29..5440b6032 100644
--- a/rules/initmethod-bbinit.make
+++ b/rules/initmethod-bbinit.make
@@ -45,6 +45,11 @@ $(STATEDIR)/initmethod-bbinit.targetinstall:
 #	#
 #	# start scripts
 #	#
+
+ifdef PTXCONF_INITMETHOD_BBINIT_ETC_INITD_ROOTRW
+	@$(call install_alternative, initmethod-bbinit, 0, 0, 0755, /etc/init.d/rootrw, n)
+endif
+
 ifdef PTXCONF_INITMETHOD_BBINIT_ETC_INITD_MODULES
 	@$(call install_alternative, initmethod-bbinit, 0, 0, 0755, /etc/init.d/modules, n)
 	@$(call install_alternative, initmethod-bbinit, 0, 0, 0644, /etc/modules, n)
@@ -72,6 +77,13 @@ endif
 #	#
 #	# collect start links
 #	#
+
+ifneq ($(call remove_quotes,$(PTXCONF_INITMETHOD_BBINIT_LINK_ROOTRW)),)
+	@$(call install_link, initmethod-bbinit, \
+		../init.d/rootrw, \
+		/etc/rc.d/$(PTXCONF_INITMETHOD_BBINIT_LINK_ROOTRW))
+endif
+
 ifneq ($(call remove_quotes,$(PTXCONF_INITMETHOD_BBINIT_LINK_LOGROTATE)),)
 	@$(call install_link, initmethod-bbinit, \
 		../init.d/logrotate, \
-- 
2.29.2


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

  reply	other threads:[~2020-12-28  3:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-28  3:59 [ptxdist] [PATCH 0/2] " yd.zhang
2020-12-28  3:59 ` yd.zhang [this message]
2020-12-28 10:40   ` [ptxdist] [PATCH 1/2] " Ladislav Michl
2021-01-08  8:55   ` Michael Olbrich
2020-12-28  3:59 ` [ptxdist] [PATCH 2/2] bbinit: Modify the start order of the rc-once script yd.zhang
2021-01-08  8:47   ` Michael Olbrich

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=20201228035937.3489293-2-yd.zhang@ilabservice.com \
    --to=yd.zhang@ilabservice.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