Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH RESEND 0/2] new package buildroot-initscripts
@ 2023-03-13  8:15 Michael Walle via buildroot
  2023-03-13  8:15 ` [Buildroot] [PATCH RESEND 1/2] package/urandom-scripts: move to new package busybox-initscripts Michael Walle via buildroot
  2023-03-13  8:15 ` [Buildroot] [PATCH RESEND 2/2] package/buildroot-initscripts: add hwclock initscript Michael Walle via buildroot
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Walle via buildroot @ 2023-03-13  8:15 UTC (permalink / raw)
  To: buildroot; +Cc: Michael Walle, Yann E . MORIN, Thomas Petazzoni

[resend because rejected by the ML mailserver]

I'd like to add a new initscript which saves the date and time on system
shutodwn. There is already an initscript to preserve a random seed during
reboots. Consolidate all custom buildroot initscripts into a new package
buildroot-initscripts.

For this, rename the old urandom-scripts to the new package
buildroot-initscripts first. Make an entry for the package rename in
Config.legacy. Then add the new init script hwclock to our new package.

Targeted for next, i.e. the 2023.05 release.

Michael Walle (2):
  package/urandom-scripts: move to new package busybox-initscripts
  package/buildroot-initscripts: add hwclock initscript

 Config.in.legacy                              | 11 +++++++++
 package/Config.in                             |  2 +-
 package/buildroot-initscripts/Config.in       | 23 +++++++++++++++++++
 package/buildroot-initscripts/S20hwclock      | 21 +++++++++++++++++
 .../S20seedrng                                |  0
 .../buildroot-initscripts.mk                  | 17 ++++++++++++++
 package/urandom-scripts/Config.in             |  7 ------
 package/urandom-scripts/urandom-scripts.mk    | 12 ----------
 8 files changed, 73 insertions(+), 20 deletions(-)
 create mode 100644 package/buildroot-initscripts/Config.in
 create mode 100644 package/buildroot-initscripts/S20hwclock
 rename package/{urandom-scripts => buildroot-initscripts}/S20seedrng (100%)
 create mode 100644 package/buildroot-initscripts/buildroot-initscripts.mk
 delete mode 100644 package/urandom-scripts/Config.in
 delete mode 100644 package/urandom-scripts/urandom-scripts.mk

-- 
2.30.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH RESEND 1/2] package/urandom-scripts: move to new package busybox-initscripts
  2023-03-13  8:15 [Buildroot] [PATCH RESEND 0/2] new package buildroot-initscripts Michael Walle via buildroot
@ 2023-03-13  8:15 ` Michael Walle via buildroot
  2023-03-13  8:21   ` Thomas Petazzoni via buildroot
  2023-03-13  8:15 ` [Buildroot] [PATCH RESEND 2/2] package/buildroot-initscripts: add hwclock initscript Michael Walle via buildroot
  1 sibling, 1 reply; 6+ messages in thread
From: Michael Walle via buildroot @ 2023-03-13  8:15 UTC (permalink / raw)
  To: buildroot; +Cc: Michael Walle, Yann E . MORIN, Thomas Petazzoni

As a preparation to add new initscripts, rename the urandom-scripts
package to a more generic one and prepare the package to support more
than one initscript. This way we don't need one package per initscript.

Individual initscripts are chosen as a configuration option of the
package.

Signed-off-by: Michael Walle <michael@walle.cc>
---
 Config.in.legacy                                | 11 +++++++++++
 package/Config.in                               |  2 +-
 package/buildroot-initscripts/Config.in         | 17 +++++++++++++++++
 .../S20seedrng                                  |  0
 .../buildroot-initscripts.mk                    | 16 ++++++++++++++++
 package/urandom-scripts/Config.in               |  7 -------
 package/urandom-scripts/urandom-scripts.mk      | 12 ------------
 7 files changed, 45 insertions(+), 20 deletions(-)
 create mode 100644 package/buildroot-initscripts/Config.in
 rename package/{urandom-scripts => buildroot-initscripts}/S20seedrng (100%)
 create mode 100644 package/buildroot-initscripts/buildroot-initscripts.mk
 delete mode 100644 package/urandom-scripts/Config.in
 delete mode 100644 package/urandom-scripts/urandom-scripts.mk

diff --git a/Config.in.legacy b/Config.in.legacy
index 7f69462f2e..d82bd0f1f8 100644
--- a/Config.in.legacy
+++ b/Config.in.legacy
@@ -144,6 +144,17 @@ endif
 
 ###############################################################################
 
+comment "Legacy options removed in 2023.05"
+
+config BR2_PACKAGE_URANDOM_SCRIPTS
+	bool "urandom-initscripts package was renamed"
+	select BR2_LEGACY
+	select BR2_PACKAGE_BUILDROOT_INITSCRIPTS
+	select BR2_PACKAGE_BUILDROOT_INITSCRIPTS_URANDOM
+	help
+	  Package urandom-scripts was moved as option to
+	  package buildroot-initscripts.
+
 comment "Legacy options removed in 2023.02"
 
 config BR2_KERNEL_HEADERS_6_0
diff --git a/package/Config.in b/package/Config.in
index 7c32305129..df618c48cb 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2570,7 +2570,6 @@ menu "Security"
 	source "package/selinux-python/Config.in"
 	source "package/semodule-utils/Config.in"
 	source "package/setools/Config.in"
-	source "package/urandom-scripts/Config.in"
 endmenu
 
 menu "Shell and utilities"
@@ -2626,6 +2625,7 @@ menu "System tools"
 	source "package/audit/Config.in"
 	source "package/balena-engine/Config.in"
 	source "package/bubblewrap/Config.in"
+	source "package/buildroot-initscripts/Config.in"
 	source "package/cgroupfs-mount/Config.in"
 	source "package/circus/Config.in"
 	source "package/containerd/Config.in"
diff --git a/package/buildroot-initscripts/Config.in b/package/buildroot-initscripts/Config.in
new file mode 100644
index 0000000000..8e84e975fa
--- /dev/null
+++ b/package/buildroot-initscripts/Config.in
@@ -0,0 +1,17 @@
+config BR2_PACKAGE_BUILDROOT_INITSCRIPTS
+	bool "buildroot-initscripts"
+	default y if BR2_PACKAGE_INITSCRIPTS
+	depends on !BR2_PACKAGE_SYSTEMD
+	help
+	  Support for various initscripts.
+
+if BR2_PACKAGE_BUILDROOT_INITSCRIPTS
+
+config BR2_PACKAGE_BUILDROOT_INITSCRIPTS_URANDOM
+	bool "urandom"
+	default y if BR2_PACKAGE_INITSCRIPTS
+	depends on BR2_PACKAGE_BUSYBOX
+	help
+	  Initscript to preserve the random seed between reboots.
+
+endif
diff --git a/package/urandom-scripts/S20seedrng b/package/buildroot-initscripts/S20seedrng
similarity index 100%
rename from package/urandom-scripts/S20seedrng
rename to package/buildroot-initscripts/S20seedrng
diff --git a/package/buildroot-initscripts/buildroot-initscripts.mk b/package/buildroot-initscripts/buildroot-initscripts.mk
new file mode 100644
index 0000000000..098113bcbd
--- /dev/null
+++ b/package/buildroot-initscripts/buildroot-initscripts.mk
@@ -0,0 +1,16 @@
+################################################################################
+#
+# buildroot-initscripts
+#
+################################################################################
+
+BUILDROOT_INITSCRIPTS_SCRIPTS_$(BR2_PACKAGE_BUILDROOT_INITSCRIPTS_URANDOM) += S20seedrng
+
+define BUILDROOT_INITSCRIPTS_INSTALL_INIT_SYSV
+	for i in $(BUILDROOT_INITSCRIPTS_SCRIPTS_y); do \
+		$(INSTALL) -D -m 0755 $(BUILDROOT_INITSCRIPTS_PKGDIR)/$$i \
+			$(TARGET_DIR)/etc/init.d/$$i || exit 1; \
+	done
+endef
+
+$(eval $(generic-package))
diff --git a/package/urandom-scripts/Config.in b/package/urandom-scripts/Config.in
deleted file mode 100644
index 6b4a609f95..0000000000
--- a/package/urandom-scripts/Config.in
+++ /dev/null
@@ -1,7 +0,0 @@
-config BR2_PACKAGE_URANDOM_SCRIPTS
-	bool "urandom-initscripts"
-	default y if BR2_PACKAGE_INITSCRIPTS
-	depends on BR2_PACKAGE_BUSYBOX
-	depends on !BR2_PACKAGE_SYSTEMD
-	help
-	  Initscript to preserve the random seed between reboots.
diff --git a/package/urandom-scripts/urandom-scripts.mk b/package/urandom-scripts/urandom-scripts.mk
deleted file mode 100644
index 32f3e09343..0000000000
--- a/package/urandom-scripts/urandom-scripts.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-################################################################################
-#
-# urandom-scripts
-#
-################################################################################
-
-define URANDOM_SCRIPTS_INSTALL_INIT_SYSV
-	$(INSTALL) -D -m 0755 $(URANDOM_SCRIPTS_PKGDIR)/S20seedrng \
-		$(TARGET_DIR)/etc/init.d/S20seedrng
-endef
-
-$(eval $(generic-package))
-- 
2.30.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH RESEND 2/2] package/buildroot-initscripts: add hwclock initscript
  2023-03-13  8:15 [Buildroot] [PATCH RESEND 0/2] new package buildroot-initscripts Michael Walle via buildroot
  2023-03-13  8:15 ` [Buildroot] [PATCH RESEND 1/2] package/urandom-scripts: move to new package busybox-initscripts Michael Walle via buildroot
@ 2023-03-13  8:15 ` Michael Walle via buildroot
  2025-05-18 20:47   ` Arnout Vandecappelle via buildroot
  1 sibling, 1 reply; 6+ messages in thread
From: Michael Walle via buildroot @ 2023-03-13  8:15 UTC (permalink / raw)
  To: buildroot; +Cc: Michael Walle, Yann E . MORIN, Thomas Petazzoni

Add a new initscript to save the date and time to the hardware clock
on shutdown.

Signed-off-by: Michael Walle <michael@walle.cc>
---
 package/buildroot-initscripts/Config.in       |  6 ++++++
 package/buildroot-initscripts/S20hwclock      | 21 +++++++++++++++++++
 .../buildroot-initscripts.mk                  |  1 +
 3 files changed, 28 insertions(+)
 create mode 100644 package/buildroot-initscripts/S20hwclock

diff --git a/package/buildroot-initscripts/Config.in b/package/buildroot-initscripts/Config.in
index 8e84e975fa..b30c91b646 100644
--- a/package/buildroot-initscripts/Config.in
+++ b/package/buildroot-initscripts/Config.in
@@ -7,6 +7,12 @@ config BR2_PACKAGE_BUILDROOT_INITSCRIPTS
 
 if BR2_PACKAGE_BUILDROOT_INITSCRIPTS
 
+config BR2_PACKAGE_BUILDROOT_INITSCRIPTS_HWCLOCK
+	bool "hwclock"
+	help
+	  Initscript to save the date and time to the hardware clock on
+	  shutdown.
+
 config BR2_PACKAGE_BUILDROOT_INITSCRIPTS_URANDOM
 	bool "urandom"
 	default y if BR2_PACKAGE_INITSCRIPTS
diff --git a/package/buildroot-initscripts/S20hwclock b/package/buildroot-initscripts/S20hwclock
new file mode 100644
index 0000000000..3e6ea98fe8
--- /dev/null
+++ b/package/buildroot-initscripts/S20hwclock
@@ -0,0 +1,21 @@
+#! /bin/sh
+
+RTC_DEVICE=rtc0
+
+[ -r "/etc/default/hwclock" ] && . "/etc/default/hwclock"
+
+# Quietly do nothing if /dev/rtc0 does not exist
+[ -c /dev/$RTC_DEVICE ] || exit 0
+
+case "$1" in
+	start)
+		exit 0
+		;;
+	stop)
+		echo "Saving the system clock to /dev/$RTC_DEVICE.."
+		/sbin/hwclock -f /dev/$RTC_DEVICE -w
+		;;
+	*)
+		echo "Usage: $0 {start|stop}"
+		exit 1
+esac
diff --git a/package/buildroot-initscripts/buildroot-initscripts.mk b/package/buildroot-initscripts/buildroot-initscripts.mk
index 098113bcbd..980a5fe1e4 100644
--- a/package/buildroot-initscripts/buildroot-initscripts.mk
+++ b/package/buildroot-initscripts/buildroot-initscripts.mk
@@ -4,6 +4,7 @@
 #
 ################################################################################
 
+BUILDROOT_INITSCRIPTS_SCRIPTS_$(BR2_PACKAGE_BUILDROOT_INITSCRIPTS_HWCLOCK) += S20hwclock
 BUILDROOT_INITSCRIPTS_SCRIPTS_$(BR2_PACKAGE_BUILDROOT_INITSCRIPTS_URANDOM) += S20seedrng
 
 define BUILDROOT_INITSCRIPTS_INSTALL_INIT_SYSV
-- 
2.30.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH RESEND 1/2] package/urandom-scripts: move to new package busybox-initscripts
  2023-03-13  8:15 ` [Buildroot] [PATCH RESEND 1/2] package/urandom-scripts: move to new package busybox-initscripts Michael Walle via buildroot
@ 2023-03-13  8:21   ` Thomas Petazzoni via buildroot
  2025-05-18 20:46     ` Arnout Vandecappelle via buildroot
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-03-13  8:21 UTC (permalink / raw)
  To: Michael Walle; +Cc: Yann E . MORIN, buildroot

On Mon, 13 Mar 2023 09:15:48 +0100
Michael Walle <michael@walle.cc> wrote:

> +config BR2_PACKAGE_URANDOM_SCRIPTS
> +	bool "urandom-initscripts package was renamed"
> +	select BR2_LEGACY
> +	select BR2_PACKAGE_BUILDROOT_INITSCRIPTS
> +	select BR2_PACKAGE_BUILDROOT_INITSCRIPTS_URANDOM

This is basically causing to cause the legacy warning to trigger for
virtually all configurations, as this package is enabled in basically
all non-systemd configurations.

It's a bit annoying :-/

One option would be to not have the "select BR2_LEGACY", which would
work OK because of the 2 selects that enable the new package. But
it would also mean that people will keep BR2_PACKAGE_URANDOM_SCRIPTS=y
in their .config forever.

I don't really have a good solution/idea here, just pointing out this
inconvenience.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH RESEND 1/2] package/urandom-scripts: move to new package busybox-initscripts
  2023-03-13  8:21   ` Thomas Petazzoni via buildroot
@ 2025-05-18 20:46     ` Arnout Vandecappelle via buildroot
  0 siblings, 0 replies; 6+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2025-05-18 20:46 UTC (permalink / raw)
  To: Thomas Petazzoni, Michael Walle; +Cc: Yann E . MORIN, buildroot

  Hi Michael,

On 13/03/2023 09:21, Thomas Petazzoni via buildroot wrote:
> On Mon, 13 Mar 2023 09:15:48 +0100
> Michael Walle <michael@walle.cc> wrote:
> 
>> +config BR2_PACKAGE_URANDOM_SCRIPTS
>> +	bool "urandom-initscripts package was renamed"
>> +	select BR2_LEGACY
>> +	select BR2_PACKAGE_BUILDROOT_INITSCRIPTS
>> +	select BR2_PACKAGE_BUILDROOT_INITSCRIPTS_URANDOM
> 
> This is basically causing to cause the legacy warning to trigger for
> virtually all configurations, as this package is enabled in basically
> all non-systemd configurations.
> 
> It's a bit annoying :-/
> 
> One option would be to not have the "select BR2_LEGACY", which would
> work OK because of the 2 selects that enable the new package. But
> it would also mean that people will keep BR2_PACKAGE_URANDOM_SCRIPTS=y
> in their .config forever.
> 
> I don't really have a good solution/idea here, just pointing out this
> inconvenience.

  We _finally_ got around to reviewing this patch, and decided that the added 
value of a buildroot-initscripts package is too low to be worth the bother of 
the legacy stuff. So we marked this patch as Rejected.

  Regards,
  Arnout
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH RESEND 2/2] package/buildroot-initscripts: add hwclock initscript
  2023-03-13  8:15 ` [Buildroot] [PATCH RESEND 2/2] package/buildroot-initscripts: add hwclock initscript Michael Walle via buildroot
@ 2025-05-18 20:47   ` Arnout Vandecappelle via buildroot
  0 siblings, 0 replies; 6+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2025-05-18 20:47 UTC (permalink / raw)
  To: Michael Walle, buildroot; +Cc: Yann E . MORIN, Thomas Petazzoni



On 13/03/2023 09:15, Michael Walle via buildroot wrote:
> Add a new initscript to save the date and time to the hardware clock
> on shutdown.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>

  We decided to put this instead into a package hwclock-initscript in the System 
Tools menu.

  I've made a few further changes and applied to master, thanks.
- mention in help text that it isn't needed at boot;
  rewrite initscript according to our usual pattern;
  fix shellcheck errors.


  Regards,
  Arnout

> ---
>   package/buildroot-initscripts/Config.in       |  6 ++++++
>   package/buildroot-initscripts/S20hwclock      | 21 +++++++++++++++++++
>   .../buildroot-initscripts.mk                  |  1 +
>   3 files changed, 28 insertions(+)
>   create mode 100644 package/buildroot-initscripts/S20hwclock
> 
> diff --git a/package/buildroot-initscripts/Config.in b/package/buildroot-initscripts/Config.in
> index 8e84e975fa..b30c91b646 100644
> --- a/package/buildroot-initscripts/Config.in
> +++ b/package/buildroot-initscripts/Config.in
> @@ -7,6 +7,12 @@ config BR2_PACKAGE_BUILDROOT_INITSCRIPTS
>   
>   if BR2_PACKAGE_BUILDROOT_INITSCRIPTS
>   
> +config BR2_PACKAGE_BUILDROOT_INITSCRIPTS_HWCLOCK
> +	bool "hwclock"
> +	help
> +	  Initscript to save the date and time to the hardware clock on
> +	  shutdown.
> +
>   config BR2_PACKAGE_BUILDROOT_INITSCRIPTS_URANDOM
>   	bool "urandom"
>   	default y if BR2_PACKAGE_INITSCRIPTS
> diff --git a/package/buildroot-initscripts/S20hwclock b/package/buildroot-initscripts/S20hwclock
> new file mode 100644
> index 0000000000..3e6ea98fe8
> --- /dev/null
> +++ b/package/buildroot-initscripts/S20hwclock
> @@ -0,0 +1,21 @@
> +#! /bin/sh
> +
> +RTC_DEVICE=rtc0
> +
> +[ -r "/etc/default/hwclock" ] && . "/etc/default/hwclock"
> +
> +# Quietly do nothing if /dev/rtc0 does not exist
> +[ -c /dev/$RTC_DEVICE ] || exit 0
> +
> +case "$1" in
> +	start)
> +		exit 0
> +		;;
> +	stop)
> +		echo "Saving the system clock to /dev/$RTC_DEVICE.."
> +		/sbin/hwclock -f /dev/$RTC_DEVICE -w
> +		;;
> +	*)
> +		echo "Usage: $0 {start|stop}"
> +		exit 1
> +esac
> diff --git a/package/buildroot-initscripts/buildroot-initscripts.mk b/package/buildroot-initscripts/buildroot-initscripts.mk
> index 098113bcbd..980a5fe1e4 100644
> --- a/package/buildroot-initscripts/buildroot-initscripts.mk
> +++ b/package/buildroot-initscripts/buildroot-initscripts.mk
> @@ -4,6 +4,7 @@
>   #
>   ################################################################################
>   
> +BUILDROOT_INITSCRIPTS_SCRIPTS_$(BR2_PACKAGE_BUILDROOT_INITSCRIPTS_HWCLOCK) += S20hwclock
>   BUILDROOT_INITSCRIPTS_SCRIPTS_$(BR2_PACKAGE_BUILDROOT_INITSCRIPTS_URANDOM) += S20seedrng
>   
>   define BUILDROOT_INITSCRIPTS_INSTALL_INIT_SYSV

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2025-05-18 20:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-13  8:15 [Buildroot] [PATCH RESEND 0/2] new package buildroot-initscripts Michael Walle via buildroot
2023-03-13  8:15 ` [Buildroot] [PATCH RESEND 1/2] package/urandom-scripts: move to new package busybox-initscripts Michael Walle via buildroot
2023-03-13  8:21   ` Thomas Petazzoni via buildroot
2025-05-18 20:46     ` Arnout Vandecappelle via buildroot
2023-03-13  8:15 ` [Buildroot] [PATCH RESEND 2/2] package/buildroot-initscripts: add hwclock initscript Michael Walle via buildroot
2025-05-18 20:47   ` Arnout Vandecappelle via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox