Skip to contentSkip to conversation

package/openrc: new package (v0.41.2)

PATCH New Michał Łyszczek 2 participants 24 messages May 12, 2019 – Jul 23, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/13 package/openrc: new package (v0.41.2)

This adds openrc init system package. This performs default openrc installation with openrc-init that acts as pid1.

MKPKGCONFIG=no:
openrc does not use pkg-config per se, if MKPKGCONFIG is enabled, it will just install *.pc files on rootfs for other programs to find librc and libeinfo. These libs expose C api to control openrc (al rc-* functions use it). From the looks of it, these libs would be usefull if user wanted to write his own programs to manage services, and vast majority of people using openrc won't need it. Also, that's the reason why there is not INSTALL_STAGING=yes.

---
Changes v1 -> v2
Suggested by Thomas Petazzoni:
- new commit short message
- remove OPENRC_SOURCE (default is enough)
- remove += from first OPENRC_DEPENDENCIES
- use single OPENRC_MAKE_OPTS = (with line breaks)
- Remove TARGETDIR from make opts (leftover from different solution)
- Move conditional make opts below first OPENRC_MAKE_OPTS =
- move DESTDIR after OPENRC_MAKE_OPTS in OPENRC_INSTALL_TARGET_CMDS
- add links to sources and wiki in Config.in
- add hash for LICENSE file

Suggested by Yann E. MORIN:
- add description about MKPKGCONFIG=no to commit message

---
 DEVELOPERS                 |  1 +
 package/Config.in          |  1 +
 package/openrc/Config.in   | 17 ++++++++++++++
 package/openrc/openrc.hash |  3 +++
 package/openrc/openrc.mk   | 45 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 67 insertions(+)
 create mode 100644 package/openrc/Config.in
 create mode 100644 package/openrc/openrc.hash
 create mode 100644 package/openrc/openrc.mk
DEVELOPERS +1 -0
index 6ccb0afaf6..0f89e49b92 100644
@@ -1615,6 +1615,7 @@ F:	board/altera/socrates_cyclone5/
 F:	board/pine64/rock64
 F:	configs/rock64_defconfig
 F:	configs/socrates_cyclone5_defconfig
+F:	package/openrc/
 
 N:	Michel Stempin <[email protected]>
 F:	board/licheepi/
package/Config.in +1 -0
index f592e74a99..d9cb755d68 100644
@@ -2194,6 +2194,7 @@ menu "System tools"
 	source "package/ncdu/Config.in"
 	source "package/numactl/Config.in"
 	source "package/nut/Config.in"
+	source "package/openrc/Config.in"
 	source "package/openvmtools/Config.in"
 	source "package/pamtester/Config.in"
 	source "package/polkit/Config.in"
package/openrc/Config.in new file +17 -0
new file mode 100644
index 0000000000..4baeed60ae
@@ -0,0 +1,17 @@
+config BR2_PACKAGE_OPENRC
+	bool "OpenRC"
+	select BR2_PACKAGE_NCURSES
+	help
+	  Init that works on top of pid 1 (for example openrc-init). By default
+	  it does quite a lot on startup (like setting hwclock, mounting
+	  directories, configuring interfaces and so on). So for this init to
+	  properly work you need at least these tools on the root filesystem
+	  (default busybox configuration provides them all):
+
+	  swapon, fsck, hwclock, getty, login, grep, mount, coreutils, procps,
+	  modprobe (kmod), net-tools
+
+	  Number of tools may be decreased by removing services that use them.
+
+	  sources: https://github.com/OpenRC/openrc
+	  wiki: https://wiki.gentoo.org/wiki/OpenRC
package/openrc/openrc.hash new file +3 -0
new file mode 100644
index 0000000000..c8befc63ea
@@ -0,0 +1,3 @@
+# Calculated manually
+sha256	c99488ca54f2b795328d07bbd456ade49b571136bba7501f7eaaeb1ca9f9ecc4	openrc-0.41.2.tar.gz
+sha256	96862463f4e77e2508e4fc2c83773fd24807cb699368b63fd93a5e2b466dd624	LICENSE
package/openrc/openrc.mk new file +45 -0

45 lines not on this page · raw message

Signature · 1 line
2.18.1
#1 lore raw

PATCH v2 2/13 package/skeleton-init-openrc: basic skeleton for openrc

This basic skeleton is similar to skeleton-init-sysv.
All links in /var are same as in skeleton-init-sysv to be compatible with current default filesystem scheme.

Exceptions:

* /dev/shm and /dev/pts dirs were removed, since they are created by openrc devfs service
* /etc/fstab does not need /dev/shm, /dev/pts and /sys entries becuse they are mounted by devfs and sysfs services respectively

---
Changes v1 -> v2
None

---
 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 package/skeleton-init-openrc/Config.in        |  7 ++++++
 .../skeleton-init-sysv.mk                     | 22 +++++++++++++++++++
 package/skeleton-init-openrc/skeleton/dev/log |  1 +
 .../skeleton-init-openrc/skeleton/etc/fstab   |  3 +++
 .../skeleton-init-openrc/skeleton/var/cache   |  1 +
 .../skeleton/var/lib/misc                     |  1 +
 .../skeleton-init-openrc/skeleton/var/lock    |  1 +
 package/skeleton-init-openrc/skeleton/var/log |  1 +
 package/skeleton-init-openrc/skeleton/var/run |  1 +
 .../skeleton-init-openrc/skeleton/var/spool   |  1 +
 package/skeleton-init-openrc/skeleton/var/tmp |  1 +
 13 files changed, 42 insertions(+)
 create mode 100644 package/skeleton-init-openrc/Config.in
 create mode 100644 package/skeleton-init-openrc/skeleton-init-sysv.mk
 create mode 120000 package/skeleton-init-openrc/skeleton/dev/log
 create mode 100644 package/skeleton-init-openrc/skeleton/etc/fstab
 create mode 120000 package/skeleton-init-openrc/skeleton/var/cache
 create mode 120000 package/skeleton-init-openrc/skeleton/var/lib/misc
 create mode 120000 package/skeleton-init-openrc/skeleton/var/lock
 create mode 120000 package/skeleton-init-openrc/skeleton/var/log
 create mode 120000 package/skeleton-init-openrc/skeleton/var/run
 create mode 120000 package/skeleton-init-openrc/skeleton/var/spool
 create mode 120000 package/skeleton-init-openrc/skeleton/var/tmp
DEVELOPERS +1 -0
index 0f89e49b92..92aa5381f8 100644
@@ -1616,6 +1616,7 @@ F:	board/pine64/rock64
 F:	configs/rock64_defconfig
 F:	configs/socrates_cyclone5_defconfig
 F:	package/openrc/
+F:	package/skeleton-init-openrc/
 
 N:	Michel Stempin <[email protected]>
 F:	board/licheepi/
package/Config.in +1 -0
index d9cb755d68..584c7e4e5a 100644
@@ -5,6 +5,7 @@ menu "Target packages"
 	source "package/skeleton-custom/Config.in"
 	source "package/skeleton-init-common/Config.in"
 	source "package/skeleton-init-none/Config.in"
+	source "package/skeleton-init-openrc/Config.in"
 	source "package/skeleton-init-systemd/Config.in"
 	source "package/skeleton-init-sysv/Config.in"
 
package/skeleton-init-openrc/Config.in new file +7 -0
new file mode 100644
index 0000000000..8f4dd17ebd
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_SKELETON_INIT_OPENRC
+	bool
+	select BR2_PACKAGE_HAS_SKELETON
+	select BR2_PACKAGE_SKELETON_INIT_COMMON
+
+config BR2_PACKAGE_PROVIDES_SKELETON
+	default "skeleton-init-openrc" if BR2_PACKAGE_SKELETON_INIT_OPENRC
package/skeleton-init-openrc/skeleton-init-sysv.mk new file +22 -0
new file mode 100644
index 0000000000..5ee2192093
@@ -0,0 +1,22 @@
+################################################################################
+#
+# skeleton-init-openrc
+#
+################################################################################
+
+# The skeleton can't depend on the toolchain, since all packages depends on the
+# skeleton and the toolchain is a target package, as is skeleton.
+# Hence, skeleton would depends on the toolchain and the toolchain would depend
+# on skeleton.
+SKELETON_INIT_OPENRC_ADD_TOOLCHAIN_DEPENDENCY = NO
+SKELETON_INIT_OPENRC_ADD_SKELETON_DEPENDENCY = NO
+
+SKELETON_INIT_OPENRC_DEPENDENCIES = skeleton-init-common
+
+SKELETON_INIT_OPENRC_PROVIDES = skeleton
+
+define SKELETON_INIT_OPENRC_INSTALL_TARGET_CMDS
+	$(call SYSTEM_RSYNC,$(SKELETON_INIT_OPENRC_PKGDIR)/skeleton,$(TARGET_DIR))
+endef
+
+$(eval $(generic-package))
package/skeleton-init-openrc/skeleton/dev/log new file +1 -0
new file mode 120000
index 0000000000..d96b3b1cb8
@@ -0,0 +1 @@
+../tmp/log
\ No newline at end of file
package/skeleton-init-openrc/skeleton/etc/fstab new file +3 -0
new file mode 100644
index 0000000000..3ec96cf634
@@ -0,0 +1,3 @@
+# <file system>	<mount pt>	<type>	<options>	<dump>	<pass>
+tmpfs		/tmp		tmpfs	mode=1777	0	0
+tmpfs		/run		tmpfs	mode=0755,nosuid,nodev	0	0
package/skeleton-init-openrc/skeleton/var/cache new file +1 -0
new file mode 120000
index 0000000000..1431b0e432
@@ -0,0 +1 @@
+../tmp
\ No newline at end of file
package/skeleton-init-openrc/skeleton/var/lib/misc new file +1 -0
new file mode 120000
index 0000000000..f1fde8c107
@@ -0,0 +1 @@
+../../tmp
\ No newline at end of file
package/skeleton-init-openrc/skeleton/var/lock new file +1 -0
new file mode 120000
index 0000000000..1431b0e432
@@ -0,0 +1 @@
+../tmp
\ No newline at end of file
package/skeleton-init-openrc/skeleton/var/log new file +1 -0
new file mode 120000
index 0000000000..1431b0e432
@@ -0,0 +1 @@
+../tmp
\ No newline at end of file
package/skeleton-init-openrc/skeleton/var/run new file +1 -0
new file mode 120000
index 0000000000..84ba55b912
@@ -0,0 +1 @@
+../run
\ No newline at end of file
package/skeleton-init-openrc/skeleton/var/spool new file +1 -0
new file mode 120000
index 0000000000..1431b0e432
@@ -0,0 +1 @@
+../tmp
\ No newline at end of file
package/skeleton-init-openrc/skeleton/var/tmp new file +1 -0
new file mode 120000
index 0000000000..1431b0e432
@@ -0,0 +1 @@
+../tmp
\ No newline at end of file
Signature · 1 line
2.18.1
#2 lore raw

PATCH v2 2/13 package/skeleton-init-openrc: basic skeleton for openrc

Hello,

Quoted 4 lines · On Sun, 12 May 2019 21:55:39 +0200 Micha? ?yszczek <[email protected]>…

This basic skeleton is similar to skeleton-init-sysv.
All links in /var are same as in skeleton-init-sysv to be compatible with current default filesystem scheme.

Quoted 8 lines

Exceptions:

* /dev/shm and /dev/pts dirs were removed, since they are created by openrc devfs service
* /etc/fstab does not need /dev/shm, /dev/pts and /sys entries becuse they are mounted by devfs and sysfs services respectively

Applied to next, after doing one change, see below.

Quoted 1 line

+++ b/package/skeleton-init-openrc/skeleton-init-sysv.mk

Too much copy paste here: this file should have been named skeleton-init-openrc.mk. I fixed that when applying.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH v2 3/13 system/Config.in: add new init - openrc

In reply to Michał Łyszczek

This is very basic settings for openrc init.

* system/Config.in
Allows to select openrc as init system (which auto selects openrc-skeleton and openrc package).

* package/ifupdown-scripts/Config.in
openrc has its own service to bring up/down interfaces, so ifupdown-scripts should not be enabled when openrc is enabled to prevent service clash.

---
Changes v1 -> v2
None

---
 package/ifupdown-scripts/Config.in | 2 +-
 package/openrc/Config.in           | 1 +
 system/Config.in                   | 6 ++++++
 3 files changed, 8 insertions(+), 1 deletion(-)
package/ifupdown-scripts/Config.in +1 -1
index 2f4b0d5467..4b984bc30c 100644
@@ -1,7 +1,7 @@
 config BR2_PACKAGE_IFUPDOWN_SCRIPTS
 	bool "ifupdown scripts"
 	default y if BR2_ROOTFS_SKELETON_DEFAULT
-	depends on !BR2_PACKAGE_SYSTEMD_NETWORKD
+	depends on !BR2_PACKAGE_SYSTEMD_NETWORKD && !BR2_PACKAGE_OPENRC
 	help
 	  Set of scripts used by ifupdown (either the standalone one,
 	  or the busybox one) to bring network up, or tear it down.
package/openrc/Config.in +1 -0
index 4baeed60ae..f79279533f 100644
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_OPENRC
 	bool "OpenRC"
 	select BR2_PACKAGE_NCURSES
+	depends on BR2_INIT_OPENRC
 	help
 	  Init that works on top of pid 1 (for example openrc-init). By default
 	  it does quite a lot on startup (like setting hwclock, mounting
system/Config.in +6 -0
index 498b56e222..808fc070f3 100644
@@ -11,6 +11,7 @@ config BR2_ROOTFS_SKELETON_DEFAULT
 	bool "default target skeleton"
 	select BR2_PACKAGE_SKELETON_INIT_SYSV if BR2_INIT_SYSV
 	select BR2_PACKAGE_SKELETON_INIT_SYSV if BR2_INIT_BUSYBOX
+	select BR2_PACKAGE_SKELETON_INIT_OPENRC if BR2_INIT_OPENRC
 	select BR2_PACKAGE_SKELETON_INIT_SYSTEMD if BR2_INIT_SYSTEMD
 	select BR2_PACKAGE_SKELETON_INIT_NONE if BR2_INIT_NONE
 	help
@@ -98,6 +99,11 @@ config BR2_INIT_SYSV
 	select BR2_PACKAGE_INITSCRIPTS
 	select BR2_PACKAGE_SYSVINIT
 
+config BR2_INIT_OPENRC
+	bool "OpenRC"
+	depends on BR2_USE_MMU
+	select BR2_PACKAGE_OPENRC
+
 # In Buildroot, we decided not to support a split-usr when systemd is
 # used as an init system. This is a design decision, not a systemd
 # issue. Thus the select is with BR2_INIT_SYSTEMD (below) rather than
Signature · 1 line
2.18.1
#4 lore raw

PATCH v2 3/13 system/Config.in: add new init - openrc

Hello,

Quoted 6 lines · On Sun, 12 May 2019 21:55:40 +0200 Micha? ?yszczek <[email protected]>…

This is very basic settings for openrc init.

* system/Config.in
Allows to select openrc as init system (which auto selects openrc-skeleton and openrc package).

Quoted 6 lines

* package/ifupdown-scripts/Config.in
openrc has its own service to bring up/down interfaces, so ifupdown-scripts should not be enabled when openrc is enabled to prevent service clash.

I've applied, with some changes, see below.

package/openrc/Config.in line 4

Quoted 9 lines
package/openrc/Config.in +1 -0
index 4baeed60ae..f79279533f 100644
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_OPENRC
 	bool "OpenRC"
 	select BR2_PACKAGE_NCURSES
+	depends on BR2_INIT_OPENRC

"depends on" must be before selects, otherwise "make check-package" complains.

package/openrc/Config.in line 7

Quoted 3 lines
package/openrc/Config.in +3 -0
+config BR2_INIT_OPENRC
+	bool "OpenRC"
+	depends on BR2_USE_MMU

I have replicated this BR2_USE_MMU dependency on the openrc package. Also, a !BR2_STATIC_LIBS dependency was missing, which I have added to both BR2_PACKAGE_OPENRC and BR2_INIT_OPENRC.

And due to this !BR2_STATIC_LIBS dependency, I've added a Config.in comment as well.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw

PATCH v2 4/13 package/openrc: add support for spawning getty

In reply to Michał Łyszczek

* package/openrc/openrc.mk
add code that monitors BR2_TARGET_GENERIC_GETTY and if set, creates configuration file (with SYSTEM_GETTY_*) for port in /etc/conf.d/getty.$(SYSTEM_GETTY_PORT) and links so openrc starts service.

* package/skeleton-init-openrc/skeleton/etc/init.d/getty openrc service that spawns getty on configured port.

* system/Config.in
change dependency of BR2_TARGET_GENERIC_GETTY_TERM and BR2_TARGET_GENERIC_GETTY_OPTIONS so openrc can make use of these fields too.

---
Changes v1 -> v2
None

---
 package/openrc/openrc.mk                      | 13 ++++++++
 .../skeleton/etc/conf.d/.empty                |  0
 .../skeleton/etc/init.d/getty                 | 31 +++++++++++++++++++
 .../skeleton/etc/runlevels/default/.empty     |  0
 system/Config.in                              |  8 ++---
 5 files changed, 48 insertions(+), 4 deletions(-)
 create mode 100644 package/skeleton-init-openrc/skeleton/etc/conf.d/.empty
 create mode 100755 package/skeleton-init-openrc/skeleton/etc/init.d/getty
 create mode 100644 package/skeleton-init-openrc/skeleton/etc/runlevels/default/.empty
package/openrc/openrc.mk +13 -0
index 53f2947dcc..0feea22818 100644
@@ -42,4 +42,17 @@ define OPENRC_REMOVE_UNNEEDED
 endef
 OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_REMOVE_UNNEEDED
 
+ifeq ($(BR2_TARGET_GENERIC_GETTY),y)
+GETTY_SVCNAME = getty.$(SYSTEM_GETTY_PORT)
+GETTY_CONF_D = $(TARGET_DIR)/etc/conf.d/$(GETTY_SVCNAME)
+define OPENRC_SET_GETTY
+	echo "baud=\"$(SYSTEM_GETTY_BAUDRATE)\"" > $(GETTY_CONF_D)
+	echo "term_type=\"$(SYSTEM_GETTY_TERM)\"" >> $(GETTY_CONF_D)
+	echo "getty_options=\"-L $(SYSTEM_GETTY_OPTIONS)\"" >> $(GETTY_CONF_D)
+	ln -sf getty $(TARGET_DIR)/etc/init.d/$(GETTY_SVCNAME)
+	ln -sf /etc/init.d/$(GETTY_SVCNAME) $(TARGET_DIR)/etc/runlevels/default/$(GETTY_SVCNAME)
+endef
+OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_SET_GETTY
+endif # BR2_TARGET_GENERIC_GETTY
+
 $(eval $(generic-package))
package/skeleton-init-openrc/skeleton/etc/conf.d/.empty new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
package/skeleton-init-openrc/skeleton/etc/init.d/getty new file +31 -0
new file mode 100755
index 0000000000..acae1b218b
@@ -0,0 +1,31 @@
+#!/sbin/openrc-run
+# based on agetty service from OpenRC package
+
+description="start getty on terminal"
+supervisor=supervise-daemon
+port="${RC_SVCNAME#*.}"
+term_type="${term_type:-linux}"
+command=/sbin/getty
+command_args_foreground="${getty_options} ${baud} ${port} ${term_type}"
+pidfile="/run/${RC_SVCNAME}.pid"
+
+depend() {
+	# start getty at the very end of init
+	after *
+	keyword -prefix
+}
+
+start_pre() {
+	if [ -z "$port" ]; then
+		eerror "${RC_SVCNAME} cannot be started directly. You must create"
+		eerror "symbolic links to it for the ports you want to start"
+		eerror "agetty on and add those to the appropriate runlevels."
+		return 1
+	else
+		export EINFO_QUIET="${quiet:-yes}"
+	fi
+}
+
+stop_pre() {
+	export EINFO_QUIET="${quiet:-yes}"
+}
package/skeleton-init-openrc/skeleton/etc/runlevels/default/.empty new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
system/Config.in +4 -4
index 808fc070f3..90aa0e52b9 100644
@@ -343,16 +343,16 @@ config BR2_TARGET_GENERIC_GETTY_BAUDRATE
 config BR2_TARGET_GENERIC_GETTY_TERM
 	string "TERM environment variable"
 	default "vt100"
-	# currently observed only by busybox and sysvinit
-	depends on BR2_INIT_BUSYBOX || BR2_INIT_SYSV
+	# currently observed by all but systemd
+	depends on !BR2_INIT_SYSTEMD
 	help
 	  Specify a TERM type.
 
 config BR2_TARGET_GENERIC_GETTY_OPTIONS
 	string "other options to pass to getty"
 	default ""
-	# currently observed only by busybox and sysvinit
-	depends on BR2_INIT_BUSYBOX || BR2_INIT_SYSV
+	# currently observed by all but systemd
+	depends on !BR2_INIT_SYSTEMD
 	help
 	  Any other flags you want to pass to getty,
 	  Refer to getty --help for details.
Signature · 1 line
2.18.1
#6 lore raw

PATCH v2 4/13 package/openrc: add support for spawning getty

Hello,

package/openrc/openrc.mk define OPENRC_REMOVE_UNNEEDED · line 47

Quoted 11 lines · On Sun, 12 May 2019 21:55:41 +0200 Micha? ?yszczek <[email protected]>…
package/openrc/openrc.mk +3 -0
index 53f2947dcc..0feea22818 100644
@@ -42,4 +42,17 @@ define OPENRC_REMOVE_UNNEEDED
 endef
 OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_REMOVE_UNNEEDED
 
+ifeq ($(BR2_TARGET_GENERIC_GETTY),y)
+GETTY_SVCNAME = getty.$(SYSTEM_GETTY_PORT)
+GETTY_CONF_D = $(TARGET_DIR)/etc/conf.d/$(GETTY_SVCNAME)

The namespace of variables is global, so all variables defined by a package must be prefixed by the package name, here OPENRC_.

package/skeleton-init-openrc/skeleton/etc/init.d/getty

Quoted 19 lines
package/openrc/openrc.mk +10 -0
+define OPENRC_SET_GETTY
+	echo "baud=\"$(SYSTEM_GETTY_BAUDRATE)\"" > $(GETTY_CONF_D)
+	echo "term_type=\"$(SYSTEM_GETTY_TERM)\"" >> $(GETTY_CONF_D)
+	echo "getty_options=\"-L $(SYSTEM_GETTY_OPTIONS)\"" >> $(GETTY_CONF_D)
+	ln -sf getty $(TARGET_DIR)/etc/init.d/$(GETTY_SVCNAME)
+	ln -sf /etc/init.d/$(GETTY_SVCNAME) $(TARGET_DIR)/etc/runlevels/default/$(GETTY_SVCNAME)
+endef
+OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_SET_GETTY
+endif # BR2_TARGET_GENERIC_GETTY
+
 $(eval $(generic-package))
package/skeleton-init-openrc/skeleton/etc/conf.d/.empty new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
package/skeleton-init-openrc/skeleton/etc/init.d/getty new file +0 -0
new file mode 100755
index 0000000000..acae1b218b

I am not sure: should this be part of the OpenRC skeleton package ? Or the OpenRC package itself ?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#7 lore raw

PATCH v2 4/13 package/openrc: add support for spawning getty

Hello Thomas

Quoted 13 lines · Thomas Petazzoni

Hello,

Quoted 8 lines · On Sun, 12 May 2019 21:55:41 +0200 Micha? ?yszczek <[email protected]>…
package/openrc/openrc.mk +0 -0
index 53f2947dcc..0feea22818 100644
@@ -42,4 +42,17 @@ define OPENRC_REMOVE_UNNEEDED
 endef
 OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_REMOVE_UNNEEDED
 
Quoted 6 lines

package/openrc/openrc.mk define OPENRC_REMOVE_UNNEEDED · line 47

Quoted 3 lines
package/openrc/openrc.mk +3 -0
+ifeq ($(BR2_TARGET_GENERIC_GETTY),y)
+GETTY_SVCNAME = getty.$(SYSTEM_GETTY_PORT)
+GETTY_CONF_D = $(TARGET_DIR)/etc/conf.d/$(GETTY_SVCNAME)

The namespace of variables is global, so all variables defined by a package must be prefixed by the package name, here OPENRC_.

Right, didn't know that, thanks. Will fix.

Quoted 14 lines
Quoted 14 lines
package/openrc/openrc.mk +10 -0
+define OPENRC_SET_GETTY
+	echo "baud=\"$(SYSTEM_GETTY_BAUDRATE)\"" > $(GETTY_CONF_D)
+	echo "term_type=\"$(SYSTEM_GETTY_TERM)\"" >> $(GETTY_CONF_D)
+	echo "getty_options=\"-L $(SYSTEM_GETTY_OPTIONS)\"" >> $(GETTY_CONF_D)
+	ln -sf getty $(TARGET_DIR)/etc/init.d/$(GETTY_SVCNAME)
+	ln -sf /etc/init.d/$(GETTY_SVCNAME) $(TARGET_DIR)/etc/runlevels/default/$(GETTY_SVCNAME)
+endef
+OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_SET_GETTY
+endif # BR2_TARGET_GENERIC_GETTY
+
 $(eval $(generic-package))
package/skeleton-init-openrc/skeleton/etc/conf.d/.empty new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
Quoted 8 lines

package/skeleton-init-openrc/skeleton/etc/init.d/getty

Quoted 5 lines
package/skeleton-init-openrc/skeleton/etc/init.d/getty new file +0 -0
new file mode 100755
index 0000000000..acae1b218b

I am not sure: should this be part of the OpenRC skeleton package ? Or the OpenRC package itself ?

All init sysvinit/sysvinit.mk, busybox/busybox.mk systemd/systemd.mk has BR2_TARGET_GENERIC_GETTY defined in their packages makefile and not
skeleton. It seemed consistent for me.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20190519/c363eff9/attachment.asc>

#8 lore raw

PATCH v2 5/13 package/pkg-generic.mk: add _INSTALL_INIT_OPENRC

In reply to Michał Łyszczek

* package/pkg-generic.mk
Add _INSTALL_INIT_OPENRC so packages can define own steps to perform to install openrc service scripts.

* docs/manual/adding-packages-generic.txt
update documentation about new hook.

---
Changes v1 -> v2
Suggested by Thomas Petazzoni:
- update "adding-packages-generic.txt" about new hook

---
 docs/manual/adding-packages-generic.txt | 13 +++++++------
 package/pkg-generic.mk                  |  2 ++
 2 files changed, 9 insertions(+), 6 deletions(-)
docs/manual/adding-packages-generic.txt +7 -6
index 7be1754f54..5ac07a81b4 100644
@@ -536,12 +536,13 @@ different steps of the build process.
   should utilize this step if it has binaries which would be similar
   to the kernel image, bootloader or root filesystem images.
 
-* +LIBFOO_INSTALL_INIT_SYSV+ and +LIBFOO_INSTALL_INIT_SYSTEMD+ list the
-  actions to install init scripts either for the systemV-like init systems
-  (busybox, sysvinit, etc.) or for the systemd units. These commands
-  will be run only when the relevant init system is installed (i.e. if
-  systemd is selected as the init system in the configuration, only
-  +LIBFOO_INSTALL_INIT_SYSTEMD+ will be run).
+* +LIBFOO_INSTALL_INIT_SYSV+, +LIBFOO_INSTALL_INIT_OPENRC+ and
+  +LIBFOO_INSTALL_INIT_SYSTEMD+ list the actions to install init
+  scripts either for the systemV-like init systems (busybox,
+  sysvinit, etc.), openrc or for the systemd units. These commands
+  will be run only when the relevant init system is installed (i.e.
+  if systemd is selected as the init system in the configuration,
+  only +LIBFOO_INSTALL_INIT_SYSTEMD+ will be run).
 
 * +LIBFOO_HELP_CMDS+ lists the actions to print the package help, which
   is included to the main +make help+ output. These commands can print
package/pkg-generic.mk +2 -0
index 67782138b4..6d63c46a5b 100644
@@ -337,6 +337,8 @@ $(BUILD_DIR)/%/.stamp_target_installed:
 		$($(PKG)_INSTALL_INIT_SYSTEMD))
 	$(if $(BR2_INIT_SYSV)$(BR2_INIT_BUSYBOX),\
 		$($(PKG)_INSTALL_INIT_SYSV))
+	$(if $(BR2_INIT_OPENRC), \
+		$($(PKG)_INSTALL_INIT_OPENRC))
 	$(foreach hook,$($(PKG)_POST_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep))
 	$(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \
 		$(RM) -f $(addprefix $(TARGET_DIR)/usr/bin/,$($(PKG)_CONFIG_SCRIPTS)) ; \
Signature · 1 line
2.18.1
#9 lore raw

PATCH v2 5/13 package/pkg-generic.mk: add _INSTALL_INIT_OPENRC

Quoted 9 lines · On Sun, 12 May 2019 21:55:42 +0200 Micha? ?yszczek <[email protected]>…

* package/pkg-generic.mk
Add _INSTALL_INIT_OPENRC so packages can define own steps to perform to install openrc service scripts.

* docs/manual/adding-packages-generic.txt
update documentation about new hook.

Quoted 8 lines

---
Changes v1 -> v2
Suggested by Thomas Petazzoni:
- update "adding-packages-generic.txt" about new hook

---
 docs/manual/adding-packages-generic.txt | 13 +++++++------
 package/pkg-generic.mk                  |  2 ++
 2 files changed, 9 insertions(+), 6 deletions(-)

Applied to next, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#10 lore raw

PATCH v2 6/13 package/skeleton-init-openrc: add support to remount rootfs as rw

In reply to Michał Łyszczek

Adds support to openrc skeleton to monitor BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW and remount rootfs as rw when options is set.

---
Changes v1 -> v2
None

---
 .../skeleton-init-openrc/skeleton-init-sysv.mk    | 15 +++++++++++++++
 package/skeleton-init-openrc/skeleton/etc/fstab   |  1 +
 2 files changed, 16 insertions(+)
package/skeleton-init-openrc/skeleton-init-sysv.mk +15 -0
index 5ee2192093..bbe80071ae 100644
@@ -15,8 +15,23 @@ SKELETON_INIT_OPENRC_DEPENDENCIES = skeleton-init-common
 
 SKELETON_INIT_OPENRC_PROVIDES = skeleton
 
+ifeq ($(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW),y)
+# Comment /dev/root entry in fstab. When openrc does not find fstab entry for
+# "/", it will try to remount "/" as "rw".
+define SKELETON_INIT_OPENRC_ROOT_RO_OR_RW
+	$(SED) '/^ *\/dev\/root.*$$/s~^~#~' $(TARGET_DIR)/etc/fstab
+endef
+else
+# Uncomment /dev/root entry in fstab which has "ro" option so openrc notices
+# it and doesn't remount root to rw.
+define SKELETON_INIT_OPENRC_ROOT_RO_OR_RW
+	$(SED) '/^# *\/dev\/root.*$$/s~^#\+~~' $(TARGET_DIR)/etc/fstab
+endef
+endif # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW
+
 define SKELETON_INIT_OPENRC_INSTALL_TARGET_CMDS
 	$(call SYSTEM_RSYNC,$(SKELETON_INIT_OPENRC_PKGDIR)/skeleton,$(TARGET_DIR))
+	$(SKELETON_INIT_OPENRC_ROOT_RO_OR_RW)
 endef
 
 $(eval $(generic-package))
package/skeleton-init-openrc/skeleton/etc/fstab +1 -0
index 3ec96cf634..21cf49ba5a 100644
@@ -1,3 +1,4 @@
 # <file system>	<mount pt>	<type>	<options>	<dump>	<pass>
+/dev/root	/		ext2	ro,noauto	0	0
 tmpfs		/tmp		tmpfs	mode=1777	0	0
 tmpfs		/run		tmpfs	mode=0755,nosuid,nodev	0	0
Signature · 1 line
2.18.1
#11 lore raw

PATCH v2 6/13 package/skeleton-init-openrc: add support to remount rootfs as rw

Hello,

Quoted 11 lines · On Sun, 12 May 2019 21:55:43 +0200 Micha? ?yszczek <[email protected]>…
package/skeleton-init-openrc/skeleton-init-sysv.mk +3 -0
index 5ee2192093..bbe80071ae 100644
@@ -15,8 +15,23 @@ SKELETON_INIT_OPENRC_DEPENDENCIES = skeleton-init-common
 
 SKELETON_INIT_OPENRC_PROVIDES = skeleton
 
+ifeq ($(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW),y)
+# Comment /dev/root entry in fstab. When openrc does not find fstab entry for
+# "/", it will try to remount "/" as "rw".

package/skeleton-init-openrc/skeleton-init-sysv.mk SKELETON_INIT_OPENRC_DEPENDENCIES = skeleton-init-common · line 30

Quoted 10 lines
package/skeleton-init-openrc/skeleton-init-sysv.mk +10 -0
+define SKELETON_INIT_OPENRC_ROOT_RO_OR_RW
+	$(SED) '/^ *\/dev\/root.*$$/s~^~#~' $(TARGET_DIR)/etc/fstab
+endef
+else
+# Uncomment /dev/root entry in fstab which has "ro" option so openrc notices
+# it and doesn't remount root to rw.
+define SKELETON_INIT_OPENRC_ROOT_RO_OR_RW
+	$(SED) '/^# *\/dev\/root.*$$/s~^#\+~~' $(TARGET_DIR)/etc/fstab
+endef
+endif # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW

Why are you handling the ro/rw rootfs topic from skeleton-init-sysv.mk, but the getty topic is handled from openrc.mk (in PATCH 04/13). It doesn't seem very consistent.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#12 lore raw

PATCH v2 6/13 package/skeleton-init-openrc: add support to remount rootfs as rw

Hello Thomas

Quoted 22 lines · Thomas Petazzoni

Hello,

Quoted 17 lines · On Sun, 12 May 2019 21:55:43 +0200 Micha? ?yszczek <[email protected]>…
package/skeleton-init-openrc/skeleton-init-sysv.mk +9 -0
index 5ee2192093..bbe80071ae 100644
@@ -15,8 +15,23 @@ SKELETON_INIT_OPENRC_DEPENDENCIES = skeleton-init-common
 
 SKELETON_INIT_OPENRC_PROVIDES = skeleton
 
+ifeq ($(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW),y)
+# Comment /dev/root entry in fstab. When openrc does not find fstab entry for
+# "/", it will try to remount "/" as "rw".
+define SKELETON_INIT_OPENRC_ROOT_RO_OR_RW
+	$(SED) '/^ *\/dev\/root.*$$/s~^~#~' $(TARGET_DIR)/etc/fstab
+endef
+else
+# Uncomment /dev/root entry in fstab which has "ro" option so openrc notices
+# it and doesn't remount root to rw.
Quoted 8 lines

package/skeleton-init-openrc/skeleton-init-sysv.mk SKELETON_INIT_OPENRC_DEPENDENCIES = skeleton-init-common · line 30

Quoted 4 lines
package/skeleton-init-openrc/skeleton-init-sysv.mk +4 -0
+define SKELETON_INIT_OPENRC_ROOT_RO_OR_RW
+	$(SED) '/^# *\/dev\/root.*$$/s~^#\+~~' $(TARGET_DIR)/etc/fstab
+endef
+endif # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW

Why are you handling the ro/rw rootfs topic from skeleton-init-sysv.mk, but the getty topic is handled from openrc.mk (in PATCH 04/13). It doesn't seem very consistent.

I just followed already established rules here (based on systemd package). BR2_TARGET_GENERIC_GETTY is in systemd.mk, and BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is in skeleton-init-systemd.mk -------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20190519/c8b8a8b6/attachment.asc>

#13 lore raw

PATCH v2 6/13 package/skeleton-init-openrc: add support to remount rootfs as rw

Hello Thomas

Quoted 33 lines · michal.lyszczek at bofc.pl

Hello Thomas

Quoted 22 lines · Thomas Petazzoni

Hello,

Quoted 17 lines · On Sun, 12 May 2019 21:55:43 +0200 Micha? ?yszczek <[email protected]>…
package/skeleton-init-openrc/skeleton-init-sysv.mk +9 -0
index 5ee2192093..bbe80071ae 100644
@@ -15,8 +15,23 @@ SKELETON_INIT_OPENRC_DEPENDENCIES = skeleton-init-common
 
 SKELETON_INIT_OPENRC_PROVIDES = skeleton
 
+ifeq ($(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW),y)
+# Comment /dev/root entry in fstab. When openrc does not find fstab entry for
+# "/", it will try to remount "/" as "rw".
+define SKELETON_INIT_OPENRC_ROOT_RO_OR_RW
+	$(SED) '/^ *\/dev\/root.*$$/s~^~#~' $(TARGET_DIR)/etc/fstab
+endef
+else
+# Uncomment /dev/root entry in fstab which has "ro" option so openrc notices
+# it and doesn't remount root to rw.
Quoted 8 lines

package/skeleton-init-openrc/skeleton-init-sysv.mk SKELETON_INIT_OPENRC_DEPENDENCIES = skeleton-init-common · line 30

Quoted 4 lines
package/skeleton-init-openrc/skeleton-init-sysv.mk +4 -0
+define SKELETON_INIT_OPENRC_ROOT_RO_OR_RW
+	$(SED) '/^# *\/dev\/root.*$$/s~^#\+~~' $(TARGET_DIR)/etc/fstab
+endef
+endif # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW

Why are you handling the ro/rw rootfs topic from skeleton-init-sysv.mk, but the getty topic is handled from openrc.mk (in PATCH 04/13). It doesn't seem very consistent.

Quoted 3 lines

I just followed already established rules here (based on systemd package). BR2_TARGET_GENERIC_GETTY is in systemd.mk, and BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is in skeleton-init-systemd.mk

It's been some time and openrc has been only partialy merged. Any thoughts
about my last comment? Do you want me to move ro/rw handling to openrc.mk
or leave it as it is (to be consistent with systemd.mk)?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20190723/cce7352c/attachment.asc>

#14 lore raw

PATCH v2 7/13 package/openrc-netifrc: net package (v0.6.1)

In reply to Michał Łyszczek

netifrc package is a collection of scripts for openrc that configure network interfaces. It can take advantage of many external binaries like dhcp, wpa_supplicant or ifplugd.

---
Changes v1 -> v2
Suggested by Thomas Petazzoni:
- Add hash for LICENSE
- Merge OPENRC_NETIFRC_MAKE_OPTS into single assignment
- Move DESTDIR after OPENRC_NETIFRC_MAKE_OPTS in install target cmds
- Change short commit message
- Add project related links to Config.in
- Replace += with = in first assignments in makefile

Own initiative:
- Remove OPENRC_NETIFRC_REMOVE_UNNEEDED since it only removes /usr/share/doc/netifrc and /usr/share/doc is removed anyway in target-finalize target in package/Makefile
- Fix grammar in commit message.

---
 DEVELOPERS                                 |  1 +
 package/Config.in                          |  1 +
 package/openrc-netifrc/Config.in           |  9 ++++
 package/openrc-netifrc/openrc-netifrc.hash |  3 ++
 package/openrc-netifrc/openrc-netifrc.mk   | 53 ++++++++++++++++++++++
 5 files changed, 67 insertions(+)
 create mode 100644 package/openrc-netifrc/Config.in
 create mode 100644 package/openrc-netifrc/openrc-netifrc.hash
 create mode 100644 package/openrc-netifrc/openrc-netifrc.mk
DEVELOPERS +1 -0
index 92aa5381f8..4cf9feff21 100644
@@ -1616,6 +1616,7 @@ F:	board/pine64/rock64
 F:	configs/rock64_defconfig
 F:	configs/socrates_cyclone5_defconfig
 F:	package/openrc/
+F:	package/openrc-netifrc/
 F:	package/skeleton-init-openrc/
 
 N:	Michel Stempin <[email protected]>
package/Config.in +1 -0
index 584c7e4e5a..c724b33ce8 100644
@@ -2196,6 +2196,7 @@ menu "System tools"
 	source "package/numactl/Config.in"
 	source "package/nut/Config.in"
 	source "package/openrc/Config.in"
+	source "package/openrc-netifrc/Config.in"
 	source "package/openvmtools/Config.in"
 	source "package/pamtester/Config.in"
 	source "package/polkit/Config.in"
package/openrc-netifrc/Config.in new file +9 -0
new file mode 100644
index 0000000000..3786ba8562
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_OPENRC_NETIFRC
+	bool "Install network interface startup scripts"
+	depends on BR2_PACKAGE_OPENRC
+	help
+	  This package provides a system of modules to manage and configure network
+	  interfaces via individual per-interface scripts in /etc/init.d.
+
+	  wiki: https://wiki.gentoo.org/wiki/Netifrc
+	  source: https://gitweb.gentoo.org/proj/netifrc.git
package/openrc-netifrc/openrc-netifrc.hash new file +3 -0
new file mode 100644
index 0000000000..d811acc4a2
@@ -0,0 +1,3 @@
+# Calculated manually
+sha256	004907e0c3db2d106d6a51d604d79f971f1013fa7642054ad7efe5076e52f7b3	netifrc-0.6.1.tar.gz
+sha256	da376c9e2244f2a7220767ea4dd88cf423ff5b548e7c2f96b0f3b9dac727748a	LICENSE
package/openrc-netifrc/openrc-netifrc.mk new file +53 -0

53 lines not on this page · raw message

Signature · 1 line
2.18.1
#15 lore raw

PATCH v2 8/13 package/openrc-netifrc/openrc-netifrc.mk: add support for BR2_SYSTEM_DHCP

In reply to Michał Łyszczek

This patch makes openrc-netifrc package aware of BR2_SYSTEM_DHCP config, and if set, will start dhcp daemon on configured interface.

* system/Config.in
Changes dependency of BR2_SYSTEM_DHCP config.

When INIT_OPENRC is not set, DHCP is available to set if any of BUSYBOX, IFUPDOWN or NETWORKD is enabled, OPENRC_NETIFRC is ignored and will always be disabled since it depends on OPENRC.

When INIT_OPENRC is set, DHCP is available to set only when OPENRC_NETIFRC is enabled. Rest of the options are ignored and asserted to disable with "&& !BR2_PACKAGE_OPENRC"

---
Changes v1 -> v2
Own initiative:
- add short description about changes in system/Config.in

---
 package/openrc-netifrc/openrc-netifrc.mk | 10 ++++++++++
 system/Config.in                         | 10 +++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)
package/openrc-netifrc/openrc-netifrc.mk +10 -0
index 55421af72f..d9cf03eeb9 100644
@@ -50,4 +50,14 @@ endef
 OPENRC_NETIFRC_TARGET_FINALIZE_HOOKS += OPENRC_NETIFRC_INSTALL
 endif # BR2_PACKAGE_OPENRC_NETIFRC
 
+OPENRC_NETIFRC_DHCP_IFACE = $(call qstrip,$(BR2_SYSTEM_DHCP))
+ifneq ($(OPENRC_NETIFRC_DHCP_IFACE),)
+define OPENRC_NETIFRC_SYSTEM_DHCP
+	echo "config_$(OPENRC_NETIFRC_DHCP_IFACE)=\"dhcp\"" >> $(TARGET_DIR)/etc/conf.d/net
+	ln -sf net.lo $(TARGET_DIR)/etc/init.d/net.$(OPENRC_NETIFRC_DHCP_IFACE)
+	ln -sf /etc/init.d/net.$(OPENRC_NETIFRC_DHCP_IFACE) $(TARGET_DIR)/etc/runlevels/default/net.$(OPENRC_NETIFRC_DHCP_IFACE)
+endef
+OPENRC_NETIFRC_TARGET_FINALIZE_HOOKS += OPENRC_NETIFRC_SYSTEM_DHCP
+endif # BR2_SYSTEM_DHCP
+
 $(eval $(generic-package))
system/Config.in +7 -3
index 90aa0e52b9..32c502e310 100644
@@ -372,7 +372,9 @@ config BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW
 config BR2_SYSTEM_DHCP
 	string "Network interface to configure through DHCP"
 	default ""
-	depends on BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN || BR2_PACKAGE_SYSTEMD_NETWORKD
+	depends on ((BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN || \
+		BR2_PACKAGE_SYSTEMD_NETWORKD) && !BR2_PACKAGE_OPENRC) || \
+		BR2_PACKAGE_OPENRC_NETIFRC
 	help
 	  Enter here the name of the network interface (E.G. eth0) to
 	  automatically configure through DHCP at bootup.
@@ -383,8 +385,10 @@ config BR2_SYSTEM_DHCP
 	  overwrite /etc/network/interfaces or add a networkd
 	  configuration file.
 
-comment "automatic network configuration via DHCP needs ifupdown or busybox or networkd"
-	depends on !(BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN || BR2_PACKAGE_SYSTEMD_NETWORKD)
+comment "automatic network configuration via DHCP needs ifupdown or busybox or networkd or openrc-netifrc"
+	depends on !(((BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN || \
+		BR2_PACKAGE_SYSTEMD_NETWORKD) && !BR2_PACKAGE_OPENRC) || \
+		BR2_PACKAGE_OPENRC_NETIFRC)
 
 endif # BR2_ROOTFS_SKELETON_DEFAULT
 
Signature · 1 line
2.18.1
#16 lore raw

PATCH v2 9/13 package/openrc: add patch to support busybox version of sysctl

In reply to Michał Łyszczek

Busybox version of sysctl does not support --system argument, and files need to be loaded one by one. This patch adds code to sysctl service in openrc to recognize busybox sysctl and execute proper function based on that.

---
Changes v1 -> v2
None

---
 ...tl.in-add-support-for-busybox-sysctl.patch | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 package/openrc/0001-init.d-sysctl.in-add-support-for-busybox-sysctl.patch
package/openrc/0001-init.d-sysctl.in-add-support-for-busybox-sysctl.patch new file +66 -0
new file mode 100644
index 0000000000..da8cf042c6
@@ -0,0 +1,66 @@
+From ec1a0c8fa2e7a7c6cf70f68bdabc07cbb1a567cf Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20=C5=81yszczek?= <[email protected]>
+Date: Sun, 5 May 2019 23:43:40 +0200
+Subject: [PATCH] init.d/sysctl.in: add support for busybox sysctl
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Busybox version of sysctl does not support --system argument,
+and files need to be loaded one by one. This patch adds code
+to recognize busybox sysctl and execute proper function based
+on that.
+
+Signed-off-by: Micha? ?yszczek <[email protected]>
+---
+ init.d/sysctl.in | 27 ++++++++++++++++++++++++++-
+ 1 file changed, 26 insertions(+), 1 deletion(-)
+
+diff --git a/init.d/sysctl.in b/init.d/sysctl.in
+index e49f4db2..a705b3d4 100644
+--- a/init.d/sysctl.in
++++ b/init.d/sysctl.in
+@@ -37,6 +37,23 @@ BSD_sysctl()
+ 	return $retval
+ }
+ 
++Busybox_sysctl()
++{
++	local quiet
++	yesno $rc_verbose || quiet=-q
++
++	eindent
++	for conf in /etc/sysctl.conf /etc/sysctl.d/*.conf; do
++		if [ -r "$conf" ]; then
++			vebegin "applying $conf"
++			sysctl $quiet -p "$conf" || retval=1
++			veend $retval
++		fi
++	done
++	eoutdent
++	return $retval
++}
++
+ Linux_sysctl()
+ {
+ 	local quiet
+@@ -52,7 +69,15 @@ start()
+ 	ebegin "Configuring kernel parameters"
+ 	case "$RC_UNAME" in
+ 	*BSD|GNU) BSD_sysctl; rc=$? ;;
+-	Linux) Linux_sysctl; rc=$? ;;
++	Linux)
++		sysctl -h > /dev/null 2>&1
++		if [ $? -ne 0 ]; then
++			# busybox version of sysctl does not recognize -h option
++			Busybox_sysctl
++		else
++			Linux_sysctl
++		fi
++		rc=$? ;;
+ 	esac
+ 	eend $rc "Unable to configure some kernel parameters"
+ }
+-- 
+2.18.1
+
Signature · 1 line
2.18.1
#17 lore raw

PATCH v2 9/13 package/openrc: add patch to support busybox version of sysctl

Quoted 7 lines · On Sun, 12 May 2019 21:55:46 +0200 Micha? ?yszczek <[email protected]>…

Busybox version of sysctl does not support --system argument, and files need to be loaded one by one. This patch adds code to sysctl service in openrc to recognize busybox sysctl and execute proper function based on that.

Quoted 7 lines

---
Changes v1 -> v2
None

---
 ...tl.in-add-support-for-busybox-sysctl.patch | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 package/openrc/0001-init.d-sysctl.in-add-support-for-busybox-sysctl.patch

Applied to next, thanks. Please submit this patch to upstream OpenRC if not already done. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#18 lore raw

PATCH v2 10/13 package/openrc: change /run/lock from root:uucp to root:daemon

In reply to Michał Łyszczek

On gentoo /run/lock is owned by uucp group because of historical reasons. However uucp does not exist on buildroot by default, and it makes more sense that 'daemon' group should own this directory.

---
Changes v1 -> v2
None

---
 ....in-change-run-lock-from-root-uucp-t.patch | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 package/openrc/0002-sh-init.sh.Linux.in-change-run-lock-from-root-uucp-t.patch
package/openrc/0002-sh-init.sh.Linux.in-change-run-lock-from-root-uucp-t.patch new file +34 -0
new file mode 100644
index 0000000000..66bbba42ba
@@ -0,0 +1,34 @@
+From 5ae8209afad9a4284723712b46d8685e7f7fd72c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20=C5=81yszczek?= <[email protected]>
+Date: Mon, 6 May 2019 00:06:39 +0200
+Subject: [PATCH] sh/init.sh.Linux.in: change /run/lock from root:uucp to
+ root:daemon
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+On gentoo /run/lock is owned by uucp group because of historical
+reasons. However uucp does not exist on buildroot by default, and
+it makes more sense that 'daemon' group should own this directory.
+
+Signed-off-by: Micha? ?yszczek <[email protected]>
+---
+ sh/init.sh.Linux.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
+index 222bbd3b..7f1a88db 100644
+--- a/sh/init.sh.Linux.in
++++ b/sh/init.sh.Linux.in
+@@ -85,7 +85,7 @@ fi
+ 
+ [ -x /sbin/restorecon ] && /sbin/restorecon -rF /run
+ checkpath -d $RC_SVCDIR
+-checkpath -d -m 0775 -o root:uucp /run/lock
++checkpath -d -m 0775 -o root:daemon /run/lock
+ 
+ # Try to mount xenfs as early as possible, otherwise rc_sys() will always
+ # return RC_SYS_XENU and will think that we are in a domU while it's not.
+-- 
+2.18.1
+
Signature · 1 line
2.18.1
#19 lore raw

PATCH v2 10/13 package/openrc: change /run/lock from root:uucp to root:daemon

Quoted 6 lines · On Sun, 12 May 2019 21:55:47 +0200 Micha? ?yszczek <[email protected]>…

On gentoo /run/lock is owned by uucp group because of historical reasons. However uucp does not exist on buildroot by default, and it makes more sense that 'daemon' group should own this directory.

Quoted 7 lines

---
Changes v1 -> v2
None

---
 ....in-change-run-lock-from-root-uucp-t.patch | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 package/openrc/0002-sh-init.sh.Linux.in-change-run-lock-from-root-uucp-t.patch

Applied to next, thanks. Could you please raise this issue with the upstream OpenRC developers ? Perhaps they could add a build-time variable to set the owner/group of /run/lock ? This way we could at some point drop this patch from the openrc package in Buildroot.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#20 lore raw

PATCH v2 11/13 package/openrc: add support to set terminal encoding

In reply to Michał Łyszczek

When openrc init is enabled, user can chose to set terminal encoding to ascii, utf-8 or to keep default settings.

* system/Config.in
New kconfig choice BR2_TARGET_GENERIC_TERMENCODING_* to choose terminal encoding. Depends on openrc init.

* package/openrc/openrc.mk
monitors BR2_TARGET_GENERIC_TERMENCODING_* choice and make proper changes on TARGET_DIR to enable/disable terminal encoding set.

---
Changes v1 -> v2
None

---
 package/openrc/openrc.mk | 19 +++++++++++++++++++
 system/Config.in         | 17 +++++++++++++++++
 2 files changed, 36 insertions(+)
package/openrc/openrc.mk +19 -0
index 0feea22818..8d5e6ec381 100644
@@ -55,4 +55,23 @@ endef
 OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_SET_GETTY
 endif # BR2_TARGET_GENERIC_GETTY
 
+ifeq ($(BR2_TARGET_GENERIC_TERMENCODING_KEEP),y)
+# openrc by default installs service to set terminal encoding, if we want to
+# keep default encoding we need to remove service from boot.
+define OPENRC_TERMENCODING
+	$(RM) $(TARGET_DIR)/etc/runlevels/boot/{termencoding,save-termencoding}
+	$(RM) $(TARGET_DIR)/etc/conf.d/termencoding
+endef
+OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_TERMENCODING
+else
+ifeq ($(BR2_TARGET_GENERIC_TERMENCODING_UTF8),y)
+# By default openrc will set terminal encoding to ASCII, if we want encoding
+# to be utf8, we need to set it.
+define OPENRC_TERMENCODING
+	echo "unicode=\"yes\"" > $(TARGET_DIR)/etc/conf.d/termencoding
+endef
+OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_TERMENCODING
+endif # BR2_TARGET_GENERIC_TERMENCODING_UTF8
+endif # BR2_TARGET_GENERIC_TERMENCODING_KEEP
+
 $(eval $(generic-package))
system/Config.in +17 -0
index 32c502e310..08bcb517e4 100644
@@ -390,6 +390,23 @@ comment "automatic network configuration via DHCP needs ifupdown or busybox or n
 		BR2_PACKAGE_SYSTEMD_NETWORKD) && !BR2_PACKAGE_OPENRC) || \
 		BR2_PACKAGE_OPENRC_NETIFRC)
 
+choice
+	prompt "Terminal encoding"
+	default BR2_TARGET_GENERIC_TERMENCODING_KEEP
+	depends on BR2_INIT_OPENRC
+	help
+	  Set terminal encoding. This makes sense only when you are going to
+	  use virtual terminals with external monitor (or qemu) that uses
+	  /dev/tty[1-12].
+
+config BR2_TARGET_GENERIC_TERMENCODING_KEEP
+	bool "keep default"
+config BR2_TARGET_GENERIC_TERMENCODING_ASCII
+	bool "ascii"
+config BR2_TARGET_GENERIC_TERMENCODING_UTF8
+	bool "utf-8"
+endchoice
+
 endif # BR2_ROOTFS_SKELETON_DEFAULT
 
 config BR2_SYSTEM_DEFAULT_PATH
Signature · 1 line
2.18.1
#21 lore raw

PATCH v2 12/13 package/openrc: add support for setting terminal keymap

In reply to Michał Łyszczek

When openrc init is enabled, user can chose to set terminal keymap or keep default settings.

* system/Config.in
New config BR2_TARGET_GENERIC_TERM_KEYMAP which is available only when openrc is selected and kbd package is installed. Used to set keymap from /usr/share/keymaps

* package/openrc/openrc.mk
monitors BR2_TARGET_GENERIC_TERM_KEYMAP and configures init to use specified keymap. It will also check if keymap exists in the system

---
Changes v1 -> v2
Own initiative:
- fix "kdb" typo in system/Config.in (should be kbd)

---
 package/openrc/openrc.mk | 28 ++++++++++++++++++++++++++++
 system/Config.in         | 12 ++++++++++++
 2 files changed, 40 insertions(+)
package/openrc/openrc.mk +28 -0
index 8d5e6ec381..0498c9c95f 100644
@@ -74,4 +74,32 @@ OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_TERMENCODING
 endif # BR2_TARGET_GENERIC_TERMENCODING_UTF8
 endif # BR2_TARGET_GENERIC_TERMENCODING_KEEP
 
+OPENRC_TERM_KEYMAP = $(call qstrip,$(BR2_TARGET_GENERIC_TERM_KEYMAP))
+ifneq ($(OPENRC_TERM_KEYMAP),)
+OPENRC_DEPENDENCIES += kbd
+# 1) check if passed kaymap exists in the installed system
+# 2) set keymap value in /etc/conf.d/keymaps
+# 3) set keyboard mode to same encoding as terminal encoding
+define OPENRC_SET_TERM_KEYMAP
+	if ! find $(TARGET_DIR)/usr/share/keymaps -name "*$(OPENRC_TERM_KEYMAP).map*" | grep -q ".*"; then \
+		echo "keymap $(OPENRC_TERM_KEYMAP) not found in $(TARGET_DIR)/usr/share/keymaps"; \
+		exit 1; \
+	fi
+	echo "keymap=\"$(OPENRC_TERM_KEYMAP)\"" > $(TARGET_DIR)/etc/conf.d/keymaps
+	if test -f $(TARGET_DIR)/etc/conf.d/termencoding; then \
+		grep "unicode=" $(TARGET_DIR)/etc/conf.d/termencoding >> $(TARGET_DIR)/etc/conf.d/keymaps; \
+	fi
+endef
+else
+# openrc installs keymaps service by default, so if keymap is not set (like
+# because kbd is not installed) we need to remove keymaps service from boot
+# so there are no errors about missing programs. If kbd is installed, but
+# keymap config is empty value, we also remove service to keep default values.
+define OPENRC_SET_TERM_KEYMAP
+	$(RM) $(TARGET_DIR)/etc/runlevels/boot/{keymaps,save-keymaps}
+	$(RM) $(TARGET_DIR)/etc/conf.d/keymaps
+endef
+endif # OPENRC_TERM_KEYMAP
+OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_SET_TERM_KEYMAP
+
 $(eval $(generic-package))
system/Config.in +12 -0
index 08bcb517e4..e0421d8dff 100644
@@ -407,6 +407,18 @@ config BR2_TARGET_GENERIC_TERMENCODING_UTF8
 	bool "utf-8"
 endchoice
 
+config BR2_TARGET_GENERIC_TERM_KEYMAP
+	string "Set terminal keymap"
+	default "us"
+	depends on BR2_INIT_OPENRC && BR2_PACKAGE_KBD
+	help
+	  Configures all virtual terminals (on /dev/tty[1-12]) to use
+	  specified keymap. List of keymaps are installed in /usr/share/keymaps.
+	  Set to empty, to keep default keymap.
+
+comment "Setting terminal keymap requires OpenRC and kbd package"
+	depends on !(BR2_INIT_OPENRC && BR2_PACKAGE_KBD)
+
 endif # BR2_ROOTFS_SKELETON_DEFAULT
 
 config BR2_SYSTEM_DEFAULT_PATH
Signature · 1 line
2.18.1
#22 lore raw

PATCH v2 13/13 package/skeleton-init-openrc: add support for starting sysv scripts

In reply to Michał Łyszczek

* package/skeleton-init-openrc/skeleton/etc/init.d/sysv-rcs This openrc script implements rcS and rcK equivalent which will start or stop any script from /etc/init.d/S??*

* package/skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs symlink to /etc/init.d/sysv-rcs to start service at startup

* package/pkg-generic.mk
When openrc is enabled, evaluate $(PKG)_INSTALL_INIT_OPENRC, but if install steps for openrc are not avilable, then evaluate $(PKG)_INSTALL_INIT_SYSV))

* docs/manual/adding-packages-generic.txt
Add information about openrc exception to docs.

---
Changes v1 -> v2
Suggested by Thomas Petazzoni
- update docs/manual/adding-packages-generic.txt about exception

---
 docs/manual/adding-packages-generic.txt       |  5 +-
 package/pkg-generic.mk                        |  4 +-
 .../skeleton/etc/init.d/sysv-rcs              | 53 +++++++++++++++++++
 .../skeleton/etc/runlevels/default/sysv-rcs   |  1 +
 4 files changed, 61 insertions(+), 2 deletions(-)
 create mode 100755 package/skeleton-init-openrc/skeleton/etc/init.d/sysv-rcs
 create mode 120000 package/skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs
docs/manual/adding-packages-generic.txt +4 -1
index 5ac07a81b4..b402767b05 100644
@@ -542,7 +542,10 @@ different steps of the build process.
   sysvinit, etc.), openrc or for the systemd units. These commands
   will be run only when the relevant init system is installed (i.e.
   if systemd is selected as the init system in the configuration,
-  only +LIBFOO_INSTALL_INIT_SYSTEMD+ will be run).
+  only +LIBFOO_INSTALL_INIT_SYSTEMD+ will be run). The only exception
+  is when openrc is chosen as init system and +LIBFOO_INSTALL_INIT_OPENRC+
+  has not been set, in such situation +LIBFOO_INSTALL_INIT_SYSV+ will
+  be called, since openrc supports sysv init scripts.
 
 * +LIBFOO_HELP_CMDS+ lists the actions to print the package help, which
   is included to the main +make help+ output. These commands can print
package/pkg-generic.mk +3 -1
index 6d63c46a5b..dc335973c7 100644
@@ -338,7 +338,9 @@ $(BUILD_DIR)/%/.stamp_target_installed:
 	$(if $(BR2_INIT_SYSV)$(BR2_INIT_BUSYBOX),\
 		$($(PKG)_INSTALL_INIT_SYSV))
 	$(if $(BR2_INIT_OPENRC), \
-		$($(PKG)_INSTALL_INIT_OPENRC))
+		$(if $($(PKG)_INSTALL_INIT_OPENRC), \
+			$($(PKG)_INSTALL_INIT_OPENRC), \
+			$($(PKG)_INSTALL_INIT_SYSV)))
 	$(foreach hook,$($(PKG)_POST_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep))
 	$(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \
 		$(RM) -f $(addprefix $(TARGET_DIR)/usr/bin/,$($(PKG)_CONFIG_SCRIPTS)) ; \
package/skeleton-init-openrc/skeleton/etc/init.d/sysv-rcs new file +53 -0

53 lines not on this page · raw message

package/skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs new file +1 -0
new file mode 120000
index 0000000000..ef5e00823c
@@ -0,0 +1 @@
+/etc/init.d/sysv-rcs
\ No newline at end of file
Signature · 1 line
2.18.1
#23 lore raw

PATCH v2 1/13 package/openrc: new package (v0.41.2)

In reply to Michał Łyszczek
Quoted 14 lines · On Sun, 12 May 2019 21:55:38 +0200 Micha? ?yszczek <[email protected]>…

This adds openrc init system package. This performs default openrc installation with openrc-init that acts as pid1.

MKPKGCONFIG=no:
openrc does not use pkg-config per se, if MKPKGCONFIG is enabled, it will just install *.pc files on rootfs for other programs to find librc and libeinfo. These libs expose C api to control openrc (al rc-* functions use it). From the looks of it, these libs would be usefull if user wanted to write his own programs to manage services, and vast majority of people using openrc won't need it. Also, that's the reason why there is not INSTALL_STAGING=yes.

Quoted 12 lines

---
Changes v1 -> v2
Suggested by Thomas Petazzoni:
- new commit short message
- remove OPENRC_SOURCE (default is enough)
- remove += from first OPENRC_DEPENDENCIES
- use single OPENRC_MAKE_OPTS = (with line breaks)
- Remove TARGETDIR from make opts (leftover from different solution)
- Move conditional make opts below first OPENRC_MAKE_OPTS =
- move DESTDIR after OPENRC_MAKE_OPTS in OPENRC_INSTALL_TARGET_CMDS
- add links to sources and wiki in Config.in
- add hash for LICENSE file

Applied to next, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com