All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 0/2] A better solution for the swapon/swapoff issue in inittag
@ 2020-02-07 22:33 unixmania at gmail.com
  2020-02-07 22:33 ` [Buildroot] [PATCH v2 1/2] Revert "system: don't attempt swapon/swapoff in inittab if not available" unixmania at gmail.com
  2020-02-07 22:33 ` [Buildroot] [PATCH v2 2/2] package/skeleton-init-sysv: conditionally enable swapon/swapoff in inittab unixmania at gmail.com
  0 siblings, 2 replies; 5+ messages in thread
From: unixmania at gmail.com @ 2020-02-07 22:33 UTC (permalink / raw)
  To: buildroot

From: Carlos Santos <unixmania@gmail.com>

The current solution adds target-finalize hooks to two packages and
defines the hook in system/system.mk. The hook code is more complex than
it needs to be.

This solution adds the hook to skeleton-init-sysv, only, and uses a
simpler logic.
---
CC: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
CC: Peter Korsgaard <peter@korsgaard.com>
---

Carlos Santos (2):
  Revert "system: don't attempt swapon/swapoff in inittab if not
    available"
  package/skeleton-init-sysv: conditionally enable swapon/swapoff in
    inittab

 package/busybox/busybox.mk                       |  1 -
 package/skeleton-init-sysv/skeleton-init-sysv.mk | 10 ++++++++++
 package/sysvinit/sysvinit.mk                     |  1 -
 system/system.mk                                 | 13 -------------
 4 files changed, 10 insertions(+), 15 deletions(-)

-- 
2.18.2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v2 1/2] Revert "system: don't attempt swapon/swapoff in inittab if not available"
  2020-02-07 22:33 [Buildroot] [PATCH v2 0/2] A better solution for the swapon/swapoff issue in inittag unixmania at gmail.com
@ 2020-02-07 22:33 ` unixmania at gmail.com
  2020-02-08 19:19   ` Peter Korsgaard
  2020-02-07 22:33 ` [Buildroot] [PATCH v2 2/2] package/skeleton-init-sysv: conditionally enable swapon/swapoff in inittab unixmania at gmail.com
  1 sibling, 1 reply; 5+ messages in thread
From: unixmania at gmail.com @ 2020-02-07 22:33 UTC (permalink / raw)
  To: buildroot

From: Carlos Santos <unixmania@gmail.com>

This reverts commit c4dce0ae0f5d5d7fecb6f493e974e131a6df43da.

A different fix will be provided in a forthcoming patch.
---
CC: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
CC: Peter Korsgaard <peter@korsgaard.com>
---
 package/busybox/busybox.mk   |  1 -
 package/sysvinit/sysvinit.mk |  1 -
 system/system.mk             | 13 -------------
 3 files changed, 15 deletions(-)

diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk
index 45f74271f2..6283bc96ea 100644
--- a/package/busybox/busybox.mk
+++ b/package/busybox/busybox.mk
@@ -226,7 +226,6 @@ endif # BR2_TARGET_GENERIC_GETTY
 BUSYBOX_TARGET_FINALIZE_HOOKS += BUSYBOX_SET_GETTY
 
 BUSYBOX_TARGET_FINALIZE_HOOKS += SYSTEM_REMOUNT_ROOT_INITTAB
-BUSYBOX_TARGET_FINALIZE_HOOKS += SYSTEM_UPDATE_SWAPON_SWAPOFF_INITTAB
 
 endif # BR2_INIT_BUSYBOX
 
diff --git a/package/sysvinit/sysvinit.mk b/package/sysvinit/sysvinit.mk
index a717ae0459..c778a9cde5 100644
--- a/package/sysvinit/sysvinit.mk
+++ b/package/sysvinit/sysvinit.mk
@@ -45,6 +45,5 @@ endif # BR2_TARGET_GENERIC_GETTY
 SYSVINIT_TARGET_FINALIZE_HOOKS += SYSVINIT_SET_GETTY
 
 SYSVINIT_TARGET_FINALIZE_HOOKS += SYSTEM_REMOUNT_ROOT_INITTAB
-SYSVINIT_TARGET_FINALIZE_HOOKS += SYSTEM_UPDATE_SWAPON_SWAPOFF_INITTAB
 
 $(eval $(generic-package))
diff --git a/system/system.mk b/system/system.mk
index 6f1f5c27b1..8fe2c138b0 100644
--- a/system/system.mk
+++ b/system/system.mk
@@ -96,19 +96,6 @@ define SYSTEM_REMOUNT_ROOT_INITTAB
 endef
 endif
 
-define SYSTEM_UPDATE_SWAPON_SWAPOFF_INITTAB
-	if [ -x $(TARGET_DIR)/sbin/swapon ]; then \
-		$(SED) '\%:/sbin/swapon%s/^#*//' $(TARGET_DIR)/etc/inittab ; \
-	else \
-		$(SED) '\%:/sbin/swapon%s/^#*/#/' $(TARGET_DIR)/etc/inittab ; \
-	fi
-	if [ -x $(TARGET_DIR)/sbin/swapoff ]; then \
-		$(SED) '\%:/sbin/swapoff%s/^#*//' $(TARGET_DIR)/etc/inittab ; \
-	else \
-		$(SED) '\%:/sbin/swapoff%s/^#*/#/' $(TARGET_DIR)/etc/inittab ; \
-	fi
-endef
-
 ifeq ($(BR_BUILDING)$(BR2_SYSTEM_DEFAULT_PATH),y"")
 $(error BR2_SYSTEM_DEFAULT_PATH can't be empty)
 endif
-- 
2.18.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v2 2/2] package/skeleton-init-sysv: conditionally enable swapon/swapoff in inittab
  2020-02-07 22:33 [Buildroot] [PATCH v2 0/2] A better solution for the swapon/swapoff issue in inittag unixmania at gmail.com
  2020-02-07 22:33 ` [Buildroot] [PATCH v2 1/2] Revert "system: don't attempt swapon/swapoff in inittab if not available" unixmania at gmail.com
@ 2020-02-07 22:33 ` unixmania at gmail.com
  2020-02-08 19:19   ` Peter Korsgaard
  1 sibling, 1 reply; 5+ messages in thread
From: unixmania at gmail.com @ 2020-02-07 22:33 UTC (permalink / raw)
  To: buildroot

From: Carlos Santos <unixmania@gmail.com>

The default inittab files added by busybox and sysvinit run 'swapon -a'
during init and 'swapoff -a' during shutdown but those programs are not
guaranteed to be available, so the boot log may become polluted by error
messages like this:

    swapon: not found

Add a targe-finalize to skeleton-init-sysv that enables or disables the
swapon/swapoff lines in /etc/inittab, depending on the existence of
$(TARGET_DIR)/sbin/swap{on,off}.

Based on a previous patch sent by Thomas De Schampheleire.

Signed-off-by: Carlos Santos <unixmania@gmail.com>
---
CC: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
CC: Peter Korsgaard <peter@korsgaard.com>
---
 package/skeleton-init-sysv/skeleton-init-sysv.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/package/skeleton-init-sysv/skeleton-init-sysv.mk b/package/skeleton-init-sysv/skeleton-init-sysv.mk
index c89c2dc1fd..6c9c2e80fb 100644
--- a/package/skeleton-init-sysv/skeleton-init-sysv.mk
+++ b/package/skeleton-init-sysv/skeleton-init-sysv.mk
@@ -19,4 +19,14 @@ define SKELETON_INIT_SYSV_INSTALL_TARGET_CMDS
 	$(call SYSTEM_RSYNC,$(SKELETON_INIT_SYSV_PKGDIR)/skeleton,$(TARGET_DIR))
 endef
 
+define SKELETON_INIT_SYSV_SWAPON_SWAPOFF_INITTAB
+	if [ -x $(TARGET_DIR)/sbin/swapon -a -x $(TARGET_DIR)/sbin/swapoff ]; then \
+		$(SED) '/^#.*\/sbin\/swap/s/^#\+[[:blank:]]*//' $(TARGET_DIR)/etc/inittab;\
+	else \
+		$(SED) '/^[^#].*\/sbin\/swap/s/^/#/' $(TARGET_DIR)/etc/inittab; \
+	fi
+endef
+
+SKELETON_INIT_SYSV_TARGET_FINALIZE_HOOKS += SKELETON_INIT_SYSV_SWAPON_SWAPOFF_INITTAB
+
 $(eval $(generic-package))
-- 
2.18.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v2 1/2] Revert "system: don't attempt swapon/swapoff in inittab if not available"
  2020-02-07 22:33 ` [Buildroot] [PATCH v2 1/2] Revert "system: don't attempt swapon/swapoff in inittab if not available" unixmania at gmail.com
@ 2020-02-08 19:19   ` Peter Korsgaard
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2020-02-08 19:19 UTC (permalink / raw)
  To: buildroot

>>>>> "unixmania" == unixmania  <unixmania@gmail.com> writes:

 > From: Carlos Santos <unixmania@gmail.com>
 > This reverts commit c4dce0ae0f5d5d7fecb6f493e974e131a6df43da.

 > A different fix will be provided in a forthcoming patch.
 > ---
 > CC: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
 > CC: Peter Korsgaard <peter@korsgaard.com>

Committed, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v2 2/2] package/skeleton-init-sysv: conditionally enable swapon/swapoff in inittab
  2020-02-07 22:33 ` [Buildroot] [PATCH v2 2/2] package/skeleton-init-sysv: conditionally enable swapon/swapoff in inittab unixmania at gmail.com
@ 2020-02-08 19:19   ` Peter Korsgaard
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2020-02-08 19:19 UTC (permalink / raw)
  To: buildroot

>>>>> "unixmania" == unixmania  <unixmania@gmail.com> writes:

 > From: Carlos Santos <unixmania@gmail.com>
 > The default inittab files added by busybox and sysvinit run 'swapon -a'
 > during init and 'swapoff -a' during shutdown but those programs are not
 > guaranteed to be available, so the boot log may become polluted by error
 > messages like this:

 >     swapon: not found

 > Add a targe-finalize to skeleton-init-sysv that enables or disables the

target-finalize hook

 > swapon/swapoff lines in /etc/inittab, depending on the existence of
 > $(TARGET_DIR)/sbin/swap{on,off}.

 > Based on a previous patch sent by Thomas De Schampheleire.

 > Signed-off-by: Carlos Santos <unixmania@gmail.com>
 > ---
 > CC: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
 > CC: Peter Korsgaard <peter@korsgaard.com>
 > ---
 >  package/skeleton-init-sysv/skeleton-init-sysv.mk | 10 ++++++++++
 >  1 file changed, 10 insertions(+)

 > diff --git a/package/skeleton-init-sysv/skeleton-init-sysv.mk b/package/skeleton-init-sysv/skeleton-init-sysv.mk
 > index c89c2dc1fd..6c9c2e80fb 100644
 > --- a/package/skeleton-init-sysv/skeleton-init-sysv.mk
 > +++ b/package/skeleton-init-sysv/skeleton-init-sysv.mk
 > @@ -19,4 +19,14 @@ define SKELETON_INIT_SYSV_INSTALL_TARGET_CMDS
 >  	$(call SYSTEM_RSYNC,$(SKELETON_INIT_SYSV_PKGDIR)/skeleton,$(TARGET_DIR))
 >  endef
 
 > +define SKELETON_INIT_SYSV_SWAPON_SWAPOFF_INITTAB

I added a comment explaining what / why this is done and committed,
thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-02-08 19:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-07 22:33 [Buildroot] [PATCH v2 0/2] A better solution for the swapon/swapoff issue in inittag unixmania at gmail.com
2020-02-07 22:33 ` [Buildroot] [PATCH v2 1/2] Revert "system: don't attempt swapon/swapoff in inittab if not available" unixmania at gmail.com
2020-02-08 19:19   ` Peter Korsgaard
2020-02-07 22:33 ` [Buildroot] [PATCH v2 2/2] package/skeleton-init-sysv: conditionally enable swapon/swapoff in inittab unixmania at gmail.com
2020-02-08 19:19   ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.