All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 01/13] new package: openrc-0.41.2
@ 2019-05-08 22:09 Michał Łyszczek
  2019-05-08 22:09 ` [Buildroot] [PATCH 02/13] package/skeleton-init-openrc: basic skeleton for openrc Michał Łyszczek
                   ` (13 more replies)
  0 siblings, 14 replies; 19+ messages in thread
From: Michał Łyszczek @ 2019-05-08 22:09 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Micha? ?yszczek <michal.lyszczek@bofc.pl>
---
 DEVELOPERS                 |  1 +
 package/Config.in          |  1 +
 package/openrc/Config.in   | 14 ++++++++++++
 package/openrc/openrc.hash |  2 ++
 package/openrc/openrc.mk   | 46 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 64 insertions(+)
 create mode 100644 package/openrc/Config.in
 create mode 100644 package/openrc/openrc.hash
 create mode 100644 package/openrc/openrc.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 6ccb0afaf6..0f89e49b92 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -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 <michel.stempin@wanadoo.fr>
 F:	board/licheepi/
diff --git a/package/Config.in b/package/Config.in
index f592e74a99..d9cb755d68 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -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"
diff --git a/package/openrc/Config.in b/package/openrc/Config.in
new file mode 100644
index 0000000000..e98ed624c9
--- /dev/null
+++ b/package/openrc/Config.in
@@ -0,0 +1,14 @@
+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.
diff --git a/package/openrc/openrc.hash b/package/openrc/openrc.hash
new file mode 100644
index 0000000000..0d813b6a14
--- /dev/null
+++ b/package/openrc/openrc.hash
@@ -0,0 +1,2 @@
+# Calculated manually
+sha256	c99488ca54f2b795328d07bbd456ade49b571136bba7501f7eaaeb1ca9f9ecc4	openrc-0.41.2.tar.gz
diff --git a/package/openrc/openrc.mk b/package/openrc/openrc.mk
new file mode 100644
index 0000000000..faffb5beb0
--- /dev/null
+++ b/package/openrc/openrc.mk
@@ -0,0 +1,46 @@
+################################################################################
+#
+# openrc
+#
+################################################################################
+
+OPENRC_VERSION = 0.41.2
+OPENRC_SOURCE = openrc-$(OPENRC_VERSION).tar.gz
+OPENRC_SITE = $(call github,OpenRC,openrc,$(OPENRC_VERSION))
+OPENRC_LICENSE = BSD-2-Clause
+OPENRC_LICENSE_FILES = LICENSE
+
+OPENRC_DEPENDENCIES += ncurses
+
+ifeq ($(BR2_SHARED_LIBS),y)
+OPENRC_MAKE_OPTS += MKSTATICLIBS=no
+else
+OPENRC_MAKE_OPTS += MKSTATICLIBS=yes
+endif
+
+# set LIBNAME so openrc puts files in proper directories and sets proper
+# paths in installed files. Since in buildroot /lib64 and /lib32 always
+# points to /lib, it's safe to hardcode it to "lib"
+OPENRC_MAKE_OPTS += LIBNAME=lib
+OPENRC_MAKE_OPTS += LIBEXECDIR=/usr/libexec/rc
+OPENRC_MAKE_OPTS += TARGETDIR=$(TARGET_DIR)
+OPENRC_MAKE_OPTS += MKPKGCONFIG=no
+OPENRC_MAKE_OPTS += MKSELINUX=no
+OPENRC_MAKE_OPTS += MKSYSVINIT=yes
+OPENRC_MAKE_OPTS += BRANDING="Buildroot $(BR2_VERSION_FULL)"
+OPENRC_MAKE_OPTS += CC=$(TARGET_CC)
+
+define OPENRC_BUILD_CMDS
+	$(MAKE) $(OPENRC_MAKE_OPTS) -C $(@D)
+endef
+
+define OPENRC_INSTALL_TARGET_CMDS
+	DESTDIR=$(TARGET_DIR) $(MAKE) $(OPENRC_MAKE_OPTS) -C $(@D) install
+endef
+
+define OPENRC_REMOVE_UNNEEDED
+	$(RM) -r $(TARGET_DIR)/usr/share/openrc
+endef
+OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_REMOVE_UNNEEDED
+
+$(eval $(generic-package))
-- 
2.18.1

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

* [Buildroot] [PATCH 02/13] package/skeleton-init-openrc: basic skeleton for openrc
  2019-05-08 22:09 [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Michał Łyszczek
@ 2019-05-08 22:09 ` Michał Łyszczek
  2019-05-08 22:09 ` [Buildroot] [PATCH 03/13] system/Config.in: add new init - openrc Michał Łyszczek
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Michał Łyszczek @ 2019-05-08 22:09 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Micha? ?yszczek <michal.lyszczek@bofc.pl>
---
 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

diff --git a/DEVELOPERS b/DEVELOPERS
index 0f89e49b92..92aa5381f8 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -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 <michel.stempin@wanadoo.fr>
 F:	board/licheepi/
diff --git a/package/Config.in b/package/Config.in
index d9cb755d68..584c7e4e5a 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -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"
 
diff --git a/package/skeleton-init-openrc/Config.in b/package/skeleton-init-openrc/Config.in
new file mode 100644
index 0000000000..8f4dd17ebd
--- /dev/null
+++ b/package/skeleton-init-openrc/Config.in
@@ -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
diff --git a/package/skeleton-init-openrc/skeleton-init-sysv.mk b/package/skeleton-init-openrc/skeleton-init-sysv.mk
new file mode 100644
index 0000000000..5ee2192093
--- /dev/null
+++ b/package/skeleton-init-openrc/skeleton-init-sysv.mk
@@ -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))
diff --git a/package/skeleton-init-openrc/skeleton/dev/log b/package/skeleton-init-openrc/skeleton/dev/log
new file mode 120000
index 0000000000..d96b3b1cb8
--- /dev/null
+++ b/package/skeleton-init-openrc/skeleton/dev/log
@@ -0,0 +1 @@
+../tmp/log
\ No newline at end of file
diff --git a/package/skeleton-init-openrc/skeleton/etc/fstab b/package/skeleton-init-openrc/skeleton/etc/fstab
new file mode 100644
index 0000000000..3ec96cf634
--- /dev/null
+++ b/package/skeleton-init-openrc/skeleton/etc/fstab
@@ -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
diff --git a/package/skeleton-init-openrc/skeleton/var/cache b/package/skeleton-init-openrc/skeleton/var/cache
new file mode 120000
index 0000000000..1431b0e432
--- /dev/null
+++ b/package/skeleton-init-openrc/skeleton/var/cache
@@ -0,0 +1 @@
+../tmp
\ No newline at end of file
diff --git a/package/skeleton-init-openrc/skeleton/var/lib/misc b/package/skeleton-init-openrc/skeleton/var/lib/misc
new file mode 120000
index 0000000000..f1fde8c107
--- /dev/null
+++ b/package/skeleton-init-openrc/skeleton/var/lib/misc
@@ -0,0 +1 @@
+../../tmp
\ No newline at end of file
diff --git a/package/skeleton-init-openrc/skeleton/var/lock b/package/skeleton-init-openrc/skeleton/var/lock
new file mode 120000
index 0000000000..1431b0e432
--- /dev/null
+++ b/package/skeleton-init-openrc/skeleton/var/lock
@@ -0,0 +1 @@
+../tmp
\ No newline at end of file
diff --git a/package/skeleton-init-openrc/skeleton/var/log b/package/skeleton-init-openrc/skeleton/var/log
new file mode 120000
index 0000000000..1431b0e432
--- /dev/null
+++ b/package/skeleton-init-openrc/skeleton/var/log
@@ -0,0 +1 @@
+../tmp
\ No newline at end of file
diff --git a/package/skeleton-init-openrc/skeleton/var/run b/package/skeleton-init-openrc/skeleton/var/run
new file mode 120000
index 0000000000..84ba55b912
--- /dev/null
+++ b/package/skeleton-init-openrc/skeleton/var/run
@@ -0,0 +1 @@
+../run
\ No newline at end of file
diff --git a/package/skeleton-init-openrc/skeleton/var/spool b/package/skeleton-init-openrc/skeleton/var/spool
new file mode 120000
index 0000000000..1431b0e432
--- /dev/null
+++ b/package/skeleton-init-openrc/skeleton/var/spool
@@ -0,0 +1 @@
+../tmp
\ No newline at end of file
diff --git a/package/skeleton-init-openrc/skeleton/var/tmp b/package/skeleton-init-openrc/skeleton/var/tmp
new file mode 120000
index 0000000000..1431b0e432
--- /dev/null
+++ b/package/skeleton-init-openrc/skeleton/var/tmp
@@ -0,0 +1 @@
+../tmp
\ No newline at end of file
-- 
2.18.1

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

* [Buildroot] [PATCH 03/13] system/Config.in: add new init - openrc
  2019-05-08 22:09 [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Michał Łyszczek
  2019-05-08 22:09 ` [Buildroot] [PATCH 02/13] package/skeleton-init-openrc: basic skeleton for openrc Michał Łyszczek
@ 2019-05-08 22:09 ` Michał Łyszczek
  2019-05-08 22:09 ` [Buildroot] [PATCH 04/13] package/openrc: add support for spawning getty Michał Łyszczek
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Michał Łyszczek @ 2019-05-08 22:09 UTC (permalink / raw)
  To: buildroot

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.

Signed-off-by: Micha? ?yszczek <michal.lyszczek@bofc.pl>
---
 package/ifupdown-scripts/Config.in | 2 +-
 package/openrc/Config.in           | 1 +
 system/Config.in                   | 6 ++++++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/package/ifupdown-scripts/Config.in b/package/ifupdown-scripts/Config.in
index 2f4b0d5467..4b984bc30c 100644
--- a/package/ifupdown-scripts/Config.in
+++ b/package/ifupdown-scripts/Config.in
@@ -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.
diff --git a/package/openrc/Config.in b/package/openrc/Config.in
index e98ed624c9..2dbcb68e99 100644
--- a/package/openrc/Config.in
+++ b/package/openrc/Config.in
@@ -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
diff --git a/system/Config.in b/system/Config.in
index 498b56e222..808fc070f3 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -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
-- 
2.18.1

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

* [Buildroot] [PATCH 04/13] package/openrc: add support for spawning getty
  2019-05-08 22:09 [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Michał Łyszczek
  2019-05-08 22:09 ` [Buildroot] [PATCH 02/13] package/skeleton-init-openrc: basic skeleton for openrc Michał Łyszczek
  2019-05-08 22:09 ` [Buildroot] [PATCH 03/13] system/Config.in: add new init - openrc Michał Łyszczek
@ 2019-05-08 22:09 ` Michał Łyszczek
  2019-05-08 22:09 ` [Buildroot] [PATCH 05/13] package/pkg-generic.mk: add _INSTALL_INIT_OPENRC Michał Łyszczek
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Michał Łyszczek @ 2019-05-08 22:09 UTC (permalink / raw)
  To: buildroot

* 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.

Signed-off-by: Micha? ?yszczek <michal.lyszczek@bofc.pl>
---
 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

diff --git a/package/openrc/openrc.mk b/package/openrc/openrc.mk
index faffb5beb0..f0aa014256 100644
--- a/package/openrc/openrc.mk
+++ b/package/openrc/openrc.mk
@@ -43,4 +43,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))
diff --git a/package/skeleton-init-openrc/skeleton/etc/conf.d/.empty b/package/skeleton-init-openrc/skeleton/etc/conf.d/.empty
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/package/skeleton-init-openrc/skeleton/etc/init.d/getty b/package/skeleton-init-openrc/skeleton/etc/init.d/getty
new file mode 100755
index 0000000000..acae1b218b
--- /dev/null
+++ b/package/skeleton-init-openrc/skeleton/etc/init.d/getty
@@ -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}"
+}
diff --git a/package/skeleton-init-openrc/skeleton/etc/runlevels/default/.empty b/package/skeleton-init-openrc/skeleton/etc/runlevels/default/.empty
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/system/Config.in b/system/Config.in
index 808fc070f3..90aa0e52b9 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -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.
-- 
2.18.1

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

* [Buildroot] [PATCH 05/13] package/pkg-generic.mk: add _INSTALL_INIT_OPENRC
  2019-05-08 22:09 [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Michał Łyszczek
                   ` (2 preceding siblings ...)
  2019-05-08 22:09 ` [Buildroot] [PATCH 04/13] package/openrc: add support for spawning getty Michał Łyszczek
@ 2019-05-08 22:09 ` Michał Łyszczek
  2019-05-09  6:54   ` Thomas Petazzoni
  2019-05-08 22:09 ` [Buildroot] [PATCH 06/13] package/skeleton-init-openrc: add support to remount rootfs as rw Michał Łyszczek
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 19+ messages in thread
From: Michał Łyszczek @ 2019-05-08 22:09 UTC (permalink / raw)
  To: buildroot

Add _INSTALL_INIT_OPENRC so packages can define own steps to perform
to install openrc service scripts.

Signed-off-by: Micha? ?yszczek <michal.lyszczek@bofc.pl>
---
 package/pkg-generic.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 67782138b4..6d63c46a5b 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -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)) ; \
-- 
2.18.1

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

* [Buildroot] [PATCH 06/13] package/skeleton-init-openrc: add support to remount rootfs as rw
  2019-05-08 22:09 [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Michał Łyszczek
                   ` (3 preceding siblings ...)
  2019-05-08 22:09 ` [Buildroot] [PATCH 05/13] package/pkg-generic.mk: add _INSTALL_INIT_OPENRC Michał Łyszczek
@ 2019-05-08 22:09 ` Michał Łyszczek
  2019-05-08 22:09 ` [Buildroot] [PATCH 07/13] new package: openrc-netifrc-0.6.1 Michał Łyszczek
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Michał Łyszczek @ 2019-05-08 22:09 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Micha? ?yszczek <michal.lyszczek@bofc.pl>
---
 .../skeleton-init-openrc/skeleton-init-sysv.mk    | 15 +++++++++++++++
 package/skeleton-init-openrc/skeleton/etc/fstab   |  1 +
 2 files changed, 16 insertions(+)

diff --git a/package/skeleton-init-openrc/skeleton-init-sysv.mk b/package/skeleton-init-openrc/skeleton-init-sysv.mk
index 5ee2192093..bbe80071ae 100644
--- a/package/skeleton-init-openrc/skeleton-init-sysv.mk
+++ b/package/skeleton-init-openrc/skeleton-init-sysv.mk
@@ -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))
diff --git a/package/skeleton-init-openrc/skeleton/etc/fstab b/package/skeleton-init-openrc/skeleton/etc/fstab
index 3ec96cf634..21cf49ba5a 100644
--- a/package/skeleton-init-openrc/skeleton/etc/fstab
+++ b/package/skeleton-init-openrc/skeleton/etc/fstab
@@ -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
-- 
2.18.1

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

* [Buildroot] [PATCH 07/13] new package: openrc-netifrc-0.6.1
  2019-05-08 22:09 [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Michał Łyszczek
                   ` (4 preceding siblings ...)
  2019-05-08 22:09 ` [Buildroot] [PATCH 06/13] package/skeleton-init-openrc: add support to remount rootfs as rw Michał Łyszczek
@ 2019-05-08 22:09 ` Michał Łyszczek
  2019-05-08 22:09 ` [Buildroot] [PATCH 08/13] package/openrc-netifrc/openrc-netifrc.mk: add support for BR2_SYSTEM_DHCP Michał Łyszczek
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Michał Łyszczek @ 2019-05-08 22:09 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Micha? ?yszczek <michal.lyszczek@bofc.pl>
---
 DEVELOPERS                                 |  1 +
 package/Config.in                          |  1 +
 package/openrc-netifrc/Config.in           |  6 +++
 package/openrc-netifrc/openrc-netifrc.hash |  2 +
 package/openrc-netifrc/openrc-netifrc.mk   | 59 ++++++++++++++++++++++
 5 files changed, 69 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

diff --git a/DEVELOPERS b/DEVELOPERS
index 92aa5381f8..4cf9feff21 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -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 <michel.stempin@wanadoo.fr>
diff --git a/package/Config.in b/package/Config.in
index 584c7e4e5a..c724b33ce8 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -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"
diff --git a/package/openrc-netifrc/Config.in b/package/openrc-netifrc/Config.in
new file mode 100644
index 0000000000..5b8749c226
--- /dev/null
+++ b/package/openrc-netifrc/Config.in
@@ -0,0 +1,6 @@
+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.
diff --git a/package/openrc-netifrc/openrc-netifrc.hash b/package/openrc-netifrc/openrc-netifrc.hash
new file mode 100644
index 0000000000..177bb5b99f
--- /dev/null
+++ b/package/openrc-netifrc/openrc-netifrc.hash
@@ -0,0 +1,2 @@
+# Calculated manually
+sha256	004907e0c3db2d106d6a51d604d79f971f1013fa7642054ad7efe5076e52f7b3	netifrc-0.6.1.tar.gz
diff --git a/package/openrc-netifrc/openrc-netifrc.mk b/package/openrc-netifrc/openrc-netifrc.mk
new file mode 100644
index 0000000000..6f2985cada
--- /dev/null
+++ b/package/openrc-netifrc/openrc-netifrc.mk
@@ -0,0 +1,59 @@
+################################################################################
+#
+# openrc-netifrc
+#
+################################################################################
+
+OPENRC_NETIFRC_VERSION = 0.6.1
+OPENRC_NETIFRC_SOURCE = netifrc-$(OPENRC_NETIFRC_VERSION).tar.gz
+OPENRC_NETIFRC_SITE = $(call github,gentoo,netifrc,$(OPENRC_NETIFRC_VERSION))
+OPENRC_NETIFRC_LICENSE = BSD-2-Clause
+OPENRC_NETIFRC_LICENSE_FILES = LICENSE
+
+OPENRC_NETIFRC_DEPENDENCIES += openrc
+
+# set LIBNAME so netifrc puts files in proper directories and sets proper
+# paths in installed files. Since in buildroot /lib64 and /lib32 always
+# points to /lib, it's safe to hardcode it to "lib"
+OPENRC_NETIFRC_MAKE_OPTS += LIBNAME=lib
+OPENRC_NETIFRC_MAKE_OPTS += LIBEXECDIR=/usr/libexec/netifrc
+
+define OPENRC_NETIFRC_BUILD_CMDS
+	$(MAKE) $(OPENRC_NETIFRC_MAKE_OPTS) -C $(@D)
+endef
+
+define OPENRC_NETIFRC_INSTALL_TARGET_CMDS
+	DESTDIR=$(TARGET_DIR) $(MAKE) $(OPENRC_NETIFRC_MAKE_OPTS) -C $(@D) install
+endef
+
+define OPENRC_NETIFRC_REMOVE_UNNEEDED
+	$(RM) $(TARGET_DIR)/usr/share/doc/netifrc/net.example
+	rmdir $(TARGET_DIR)/usr/share/doc/netifrc
+	rmdir --ignore-fail-on-non-empty  $(TARGET_DIR)/usr/share/doc
+	rmdir --ignore-fail-on-non-empty  $(TARGET_DIR)/usr/share
+endef
+
+ifeq ($(BR2_PACKAGE_HAS_UDEV),)
+define OPENRC_NETIFRC_REMOVE_UDEV
+	$(RM) $(TARGET_DIR)/lib/udev/net.sh
+	$(RM) $(TARGET_DIR)/lib/udev/rules.d/90-network.rules
+	rmdir --ignore-fail-on-non-empty  $(TARGET_DIR)/lib/udev/rules.d
+	rmdir --ignore-fail-on-non-empty  $(TARGET_DIR)/lib/udev
+endef
+OPENRC_NETIFRC_TARGET_FINALIZE_HOOKS += OPENRC_NETIFRC_REMOVE_UDEV
+endif # BR2_PACKAGE_HAS_UDEV
+
+ifeq ($(BR2_PACKAGE_OPENRC_NETIFRC),y)
+# netifrc replaces network, staticroute and loopback services which are
+# installed by openrc
+define OPENRC_NETIFRC_INSTALL
+	$(RM) $(TARGET_DIR)/etc/runlevels/boot/{network,staticroute,loopback}
+	$(RM) $(TARGET_DIR)/etc/init.d/{network,staticroute,loopback}
+	$(RM) $(TARGET_DIR)/etc/conf.d/{network,staticroute,loopback}
+	ln -sf /etc/init.d/net.lo $(TARGET_DIR)/etc/runlevels/default/net.lo
+	echo "config_lo=\"127.0.0.1/8\"" > $(TARGET_DIR)/etc/conf.d/net
+endef
+OPENRC_NETIFRC_TARGET_FINALIZE_HOOKS += OPENRC_NETIFRC_INSTALL
+endif # BR2_PACKAGE_OPENRC_NETIFRC
+
+$(eval $(generic-package))
-- 
2.18.1

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

* [Buildroot] [PATCH 08/13] package/openrc-netifrc/openrc-netifrc.mk: add support for BR2_SYSTEM_DHCP
  2019-05-08 22:09 [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Michał Łyszczek
                   ` (5 preceding siblings ...)
  2019-05-08 22:09 ` [Buildroot] [PATCH 07/13] new package: openrc-netifrc-0.6.1 Michał Łyszczek
@ 2019-05-08 22:09 ` Michał Łyszczek
  2019-05-08 22:09 ` [Buildroot] [PATCH 09/13] package/openrc: add patch to support busybox version of sysctl Michał Łyszczek
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Michał Łyszczek @ 2019-05-08 22:09 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Micha? ?yszczek <michal.lyszczek@bofc.pl>
---
 package/openrc-netifrc/openrc-netifrc.mk | 10 ++++++++++
 system/Config.in                         | 10 +++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/package/openrc-netifrc/openrc-netifrc.mk b/package/openrc-netifrc/openrc-netifrc.mk
index 6f2985cada..498bdfafe4 100644
--- a/package/openrc-netifrc/openrc-netifrc.mk
+++ b/package/openrc-netifrc/openrc-netifrc.mk
@@ -56,4 +56,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))
diff --git a/system/Config.in b/system/Config.in
index 90aa0e52b9..32c502e310 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -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
 
-- 
2.18.1

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

* [Buildroot] [PATCH 09/13] package/openrc: add patch to support busybox version of sysctl
  2019-05-08 22:09 [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Michał Łyszczek
                   ` (6 preceding siblings ...)
  2019-05-08 22:09 ` [Buildroot] [PATCH 08/13] package/openrc-netifrc/openrc-netifrc.mk: add support for BR2_SYSTEM_DHCP Michał Łyszczek
@ 2019-05-08 22:09 ` Michał Łyszczek
  2019-05-08 22:09 ` [Buildroot] [PATCH 10/13] package/openrc: change /run/lock from root:uucp to root:daemon Michał Łyszczek
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Michał Łyszczek @ 2019-05-08 22:09 UTC (permalink / raw)
  To: buildroot

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.

Signed-off-by: Micha? ?yszczek <michal.lyszczek@bofc.pl>
---
 ...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

diff --git a/package/openrc/0001-init.d-sysctl.in-add-support-for-busybox-sysctl.patch b/package/openrc/0001-init.d-sysctl.in-add-support-for-busybox-sysctl.patch
new file mode 100644
index 0000000000..da8cf042c6
--- /dev/null
+++ b/package/openrc/0001-init.d-sysctl.in-add-support-for-busybox-sysctl.patch
@@ -0,0 +1,66 @@
+From ec1a0c8fa2e7a7c6cf70f68bdabc07cbb1a567cf Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20=C5=81yszczek?= <michal.lyszczek@bofc.pl>
+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 <michal.lyszczek@bofc.pl>
+---
+ 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
+
-- 
2.18.1

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

* [Buildroot] [PATCH 10/13] package/openrc: change /run/lock from root:uucp to root:daemon
  2019-05-08 22:09 [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Michał Łyszczek
                   ` (7 preceding siblings ...)
  2019-05-08 22:09 ` [Buildroot] [PATCH 09/13] package/openrc: add patch to support busybox version of sysctl Michał Łyszczek
@ 2019-05-08 22:09 ` Michał Łyszczek
  2019-05-08 22:09 ` [Buildroot] [PATCH 11/13] package/openrc: add support to set terminal encoding Michał Łyszczek
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Michał Łyszczek @ 2019-05-08 22:09 UTC (permalink / raw)
  To: buildroot

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 <michal.lyszczek@bofc.pl>
---
 ....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

diff --git a/package/openrc/0002-sh-init.sh.Linux.in-change-run-lock-from-root-uucp-t.patch b/package/openrc/0002-sh-init.sh.Linux.in-change-run-lock-from-root-uucp-t.patch
new file mode 100644
index 0000000000..66bbba42ba
--- /dev/null
+++ b/package/openrc/0002-sh-init.sh.Linux.in-change-run-lock-from-root-uucp-t.patch
@@ -0,0 +1,34 @@
+From 5ae8209afad9a4284723712b46d8685e7f7fd72c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20=C5=81yszczek?= <michal.lyszczek@bofc.pl>
+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 <michal.lyszczek@bofc.pl>
+---
+ 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
+
-- 
2.18.1

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

* [Buildroot] [PATCH 11/13] package/openrc: add support to set terminal encoding
  2019-05-08 22:09 [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Michał Łyszczek
                   ` (8 preceding siblings ...)
  2019-05-08 22:09 ` [Buildroot] [PATCH 10/13] package/openrc: change /run/lock from root:uucp to root:daemon Michał Łyszczek
@ 2019-05-08 22:09 ` Michał Łyszczek
  2019-05-08 22:09 ` [Buildroot] [PATCH 12/13] package/openrc: add support for setting terminal keymap Michał Łyszczek
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Michał Łyszczek @ 2019-05-08 22:09 UTC (permalink / raw)
  To: buildroot

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.

Signed-off-by: Micha? ?yszczek <michal.lyszczek@bofc.pl>
---
 package/openrc/openrc.mk | 19 +++++++++++++++++++
 system/Config.in         | 17 +++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/package/openrc/openrc.mk b/package/openrc/openrc.mk
index f0aa014256..23b33b65f4 100644
--- a/package/openrc/openrc.mk
+++ b/package/openrc/openrc.mk
@@ -56,4 +56,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))
diff --git a/system/Config.in b/system/Config.in
index 32c502e310..08bcb517e4 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -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
-- 
2.18.1

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

* [Buildroot] [PATCH 12/13] package/openrc: add support for setting terminal keymap
  2019-05-08 22:09 [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Michał Łyszczek
                   ` (9 preceding siblings ...)
  2019-05-08 22:09 ` [Buildroot] [PATCH 11/13] package/openrc: add support to set terminal encoding Michał Łyszczek
@ 2019-05-08 22:09 ` Michał Łyszczek
  2019-05-08 22:09 ` [Buildroot] [PATCH 13/13] package/skeleton-init-openrc: add support for starting sysv scripts Michał Łyszczek
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: Michał Łyszczek @ 2019-05-08 22:09 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Micha? ?yszczek <michal.lyszczek@bofc.pl>
---
 package/openrc/openrc.mk | 28 ++++++++++++++++++++++++++++
 system/Config.in         | 12 ++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/package/openrc/openrc.mk b/package/openrc/openrc.mk
index 23b33b65f4..6749999b29 100644
--- a/package/openrc/openrc.mk
+++ b/package/openrc/openrc.mk
@@ -75,4 +75,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))
diff --git a/system/Config.in b/system/Config.in
index 08bcb517e4..a890fe11c0 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -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 kdb package"
+	depends on !(BR2_INIT_OPENRC && BR2_PACKAGE_KBD)
+
 endif # BR2_ROOTFS_SKELETON_DEFAULT
 
 config BR2_SYSTEM_DEFAULT_PATH
-- 
2.18.1

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

* [Buildroot] [PATCH 13/13] package/skeleton-init-openrc: add support for starting sysv scripts
  2019-05-08 22:09 [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Michał Łyszczek
                   ` (10 preceding siblings ...)
  2019-05-08 22:09 ` [Buildroot] [PATCH 12/13] package/openrc: add support for setting terminal keymap Michał Łyszczek
@ 2019-05-08 22:09 ` Michał Łyszczek
  2019-05-09  7:01 ` [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Thomas Petazzoni
  2019-08-04 12:30 ` Yann E. MORIN
  13 siblings, 0 replies; 19+ messages in thread
From: Michał Łyszczek @ 2019-05-08 22:09 UTC (permalink / raw)
  To: buildroot

* 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))

Signed-off-by: Micha? ?yszczek <michal.lyszczek@bofc.pl>
---
 package/pkg-generic.mk                        |  4 +-
 .../skeleton/etc/init.d/sysv-rcs              | 53 +++++++++++++++++++
 .../skeleton/etc/runlevels/default/sysv-rcs   |  1 +
 3 files changed, 57 insertions(+), 1 deletion(-)
 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

diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 6d63c46a5b..dc335973c7 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -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)) ; \
diff --git a/package/skeleton-init-openrc/skeleton/etc/init.d/sysv-rcs b/package/skeleton-init-openrc/skeleton/etc/init.d/sysv-rcs
new file mode 100755
index 0000000000..9cbfe354d1
--- /dev/null
+++ b/package/skeleton-init-openrc/skeleton/etc/init.d/sysv-rcs
@@ -0,0 +1,53 @@
+#!/sbin/openrc-run
+
+description="start or stop sysv rc[S,K] scripts"
+
+depend() {
+	after local
+}
+
+start() {
+	einfo "Starting sysv rc scripts"
+	for i in /etc/init.d/S??* ; do
+		# Ignore dangling symlinks (if any).
+		[ ! -f "$i" ] && continue
+
+		case "$i" in
+		*.sh)
+			# Source shell script for speed.
+			(
+				trap - INT QUIT TSTP
+				set start
+				. $i
+			)
+			;;
+		*)
+			# No sh extension, so fork subprocess.
+			$i start
+			;;
+		esac
+	done
+}
+
+stop() {
+	einfo "Stopping sysv rc scripts"
+	for i in /etc/init.d/S??* ; do
+		# Ignore dangling symlinks (if any).
+		[ ! -f "$i" ] && continue
+
+		case "$i" in
+		*.sh)
+			# Source shell script for speed.
+			(
+				trap - INT QUIT TSTP
+				set stop
+				. $i
+			)
+			;;
+		*)
+			# No sh extension, so fork subprocess.
+			$i stop
+			;;
+		esac
+	done
+}
diff --git a/package/skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs b/package/skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs
new file mode 120000
index 0000000000..ef5e00823c
--- /dev/null
+++ b/package/skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs
@@ -0,0 +1 @@
+/etc/init.d/sysv-rcs
\ No newline at end of file
-- 
2.18.1

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

* [Buildroot] [PATCH 05/13] package/pkg-generic.mk: add _INSTALL_INIT_OPENRC
  2019-05-08 22:09 ` [Buildroot] [PATCH 05/13] package/pkg-generic.mk: add _INSTALL_INIT_OPENRC Michał Łyszczek
@ 2019-05-09  6:54   ` Thomas Petazzoni
  0 siblings, 0 replies; 19+ messages in thread
From: Thomas Petazzoni @ 2019-05-09  6:54 UTC (permalink / raw)
  To: buildroot

Hello Micha?,

On Thu,  9 May 2019 00:09:29 +0200
Micha? ?yszczek <michal.lyszczek@bofc.pl> wrote:

> Add _INSTALL_INIT_OPENRC so packages can define own steps to perform
> to install openrc service scripts.
> 
> Signed-off-by: Micha? ?yszczek <michal.lyszczek@bofc.pl>
> ---
>  package/pkg-generic.mk | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
> index 67782138b4..6d63c46a5b 100644
> --- a/package/pkg-generic.mk
> +++ b/package/pkg-generic.mk
> @@ -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))

This addition will require an update to the Buildroot manual, in
adding-packages-generic.txt, where the other <pkg>_INSTALL_INIT_*
variables are described.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH 01/13] new package: openrc-0.41.2
  2019-05-08 22:09 [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Michał Łyszczek
                   ` (11 preceding siblings ...)
  2019-05-08 22:09 ` [Buildroot] [PATCH 13/13] package/skeleton-init-openrc: add support for starting sysv scripts Michał Łyszczek
@ 2019-05-09  7:01 ` Thomas Petazzoni
  2019-05-09 10:30   ` michal.lyszczek at bofc.pl
  2019-08-04 12:30 ` Yann E. MORIN
  13 siblings, 1 reply; 19+ messages in thread
From: Thomas Petazzoni @ 2019-05-09  7:01 UTC (permalink / raw)
  To: buildroot

Hello Micha?,

Looks good overall, there are just a few comments/questions below.

On Thu,  9 May 2019 00:09:25 +0200
Micha? ?yszczek <michal.lyszczek@bofc.pl> wrote:

> This adds openrc init system package. This performs default openrc
> installation with openrc-init that acts as pid1.
> 
> Signed-off-by: Micha? ?yszczek <michal.lyszczek@bofc.pl>

First of all, the commit title should be:

	package/openrc: new package

and it should be fixed similarly in PATCH 07/13 in your series, for the
openrc-netifrc package.


> diff --git a/package/openrc/Config.in b/package/openrc/Config.in
> new file mode 100644
> index 0000000000..e98ed624c9
> --- /dev/null
> +++ b/package/openrc/Config.in
> @@ -0,0 +1,14 @@
> +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.

We like to have the upstream URL of the project at the end of the
Config.in help text, see how other packages do that.

> diff --git a/package/openrc/openrc.hash b/package/openrc/openrc.hash
> new file mode 100644
> index 0000000000..0d813b6a14
> --- /dev/null
> +++ b/package/openrc/openrc.hash
> @@ -0,0 +1,2 @@
> +# Calculated manually
> +sha256	c99488ca54f2b795328d07bbd456ade49b571136bba7501f7eaaeb1ca9f9ecc4	openrc-0.41.2.tar.gz

Please add the hash of the license file.

> diff --git a/package/openrc/openrc.mk b/package/openrc/openrc.mk
> new file mode 100644
> index 0000000000..faffb5beb0
> --- /dev/null
> +++ b/package/openrc/openrc.mk
> @@ -0,0 +1,46 @@
> +################################################################################
> +#
> +# openrc
> +#
> +################################################################################
> +
> +OPENRC_VERSION = 0.41.2
> +OPENRC_SOURCE = openrc-$(OPENRC_VERSION).tar.gz

This is not needed, the default value is that one.

> +OPENRC_SITE = $(call github,OpenRC,openrc,$(OPENRC_VERSION))
> +OPENRC_LICENSE = BSD-2-Clause
> +OPENRC_LICENSE_FILES = LICENSE
> +
> +OPENRC_DEPENDENCIES += ncurses

Just = and not +=.

> +
> +ifeq ($(BR2_SHARED_LIBS),y)
> +OPENRC_MAKE_OPTS += MKSTATICLIBS=no
> +else
> +OPENRC_MAKE_OPTS += MKSTATICLIBS=yes
> +endif
> +
> +# set LIBNAME so openrc puts files in proper directories and sets proper
> +# paths in installed files. Since in buildroot /lib64 and /lib32 always
> +# points to /lib, it's safe to hardcode it to "lib"
> +OPENRC_MAKE_OPTS += LIBNAME=lib
> +OPENRC_MAKE_OPTS += LIBEXECDIR=/usr/libexec/rc
> +OPENRC_MAKE_OPTS += TARGETDIR=$(TARGET_DIR)
> +OPENRC_MAKE_OPTS += MKPKGCONFIG=no
> +OPENRC_MAKE_OPTS += MKSELINUX=no
> +OPENRC_MAKE_OPTS += MKSYSVINIT=yes
> +OPENRC_MAKE_OPTS += BRANDING="Buildroot $(BR2_VERSION_FULL)"
> +OPENRC_MAKE_OPTS += CC=$(TARGET_CC)

It would be nicer to see all those unconditional make opts before the
conditional one for static/shared libraries, and have them on a single
line.

OPENRC_MAKE_OPTS = \
	LIBNAME=lib \
	LIBEXECDIR=... \
	...

ifeq ($(BR2_SHARED_LIBS),y)
OPENRC_MAKE_OPTS += ...
else
OPENRC_MAKE_OPTS += ...
endif

Also, a few questions:

 - How is the TARGETDIR variable used by the build system ? Why does it
   need to know the installation location at build time ?

 - What is the effect of MKPKGCONFIG=no ? What is openrc using
   pkg-config for ?

> +define OPENRC_BUILD_CMDS
> +	$(MAKE) $(OPENRC_MAKE_OPTS) -C $(@D)
> +endef
> +
> +define OPENRC_INSTALL_TARGET_CMDS
> +	DESTDIR=$(TARGET_DIR) $(MAKE) $(OPENRC_MAKE_OPTS) -C $(@D) install

DESTDIR should be placed after $(OPENRC_MAKE_OPTS).

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH 01/13] new package: openrc-0.41.2
  2019-05-09  7:01 ` [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Thomas Petazzoni
@ 2019-05-09 10:30   ` michal.lyszczek at bofc.pl
  2019-05-09 12:20     ` Thomas Petazzoni
  0 siblings, 1 reply; 19+ messages in thread
From: michal.lyszczek at bofc.pl @ 2019-05-09 10:30 UTC (permalink / raw)
  To: buildroot

Hello Thomas,

On 2019-05-09 09:01:11, Thomas Petazzoni wrote:
> Also, a few questions:
> 
>  - How is the TARGETDIR variable used by the build system ? Why does it
>    need to know the installation location at build time ?

Good catch, it's not needed, it's a leftover from my integration I did in
March, but found better solution so it is not needed anymore. Deleted.

>  - What is the effect of MKPKGCONFIG=no ? What is openrc using
>    pkg-config for ?

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 exposes C api to controll openrc (al rc-* functions
uses it). From the looks of it, these libs would be usefull if you wanted
to write your own programs to manager services, and vast majority of people
using openrc won't need it. Also, that's the reason why there is not
INSTALL_STAGING=yes.
-------------- 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/20190509/8907fb13/attachment.asc>

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

* [Buildroot] [PATCH 01/13] new package: openrc-0.41.2
  2019-05-09 10:30   ` michal.lyszczek at bofc.pl
@ 2019-05-09 12:20     ` Thomas Petazzoni
  0 siblings, 0 replies; 19+ messages in thread
From: Thomas Petazzoni @ 2019-05-09 12:20 UTC (permalink / raw)
  To: buildroot

Hello Michal,

On Thu, 09 May 2019 12:30:24 +0200
michal.lyszczek at bofc.pl wrote:

> >  - What is the effect of MKPKGCONFIG=no ? What is openrc using
> >    pkg-config for ?  
> 
> 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 exposes C api to controll openrc (al rc-* functions
> uses it). From the looks of it, these libs would be usefull if you wanted
> to write your own programs to manager services, and vast majority of people
> using openrc won't need it. Also, that's the reason why there is not
> INSTALL_STAGING=yes.

OK, thanks for the explanation, it makes perfect sense. Could perhaps
be explained in the commit log or in a comment in the .mk file.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH 01/13] new package: openrc-0.41.2
  2019-05-08 22:09 [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Michał Łyszczek
                   ` (12 preceding siblings ...)
  2019-05-09  7:01 ` [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Thomas Petazzoni
@ 2019-08-04 12:30 ` Yann E. MORIN
  2019-08-05  8:45   ` michal.lyszczek at bofc.pl
  13 siblings, 1 reply; 19+ messages in thread
From: Yann E. MORIN @ 2019-08-04 12:30 UTC (permalink / raw)
  To: buildroot

Micha?, All,

Sorry for the long delay in replying to this series...

During the developers meetging this week-end, I've reworked most of your
series: https://patchwork.ozlabs.org/project/buildroot/list/?series=123190

I've however left two patches behind:

  - package/openrc: add support to set terminal encoding
  - package/openrc: add support for setting terminal keymap

We've discussed those two patches, and we agree that the feature is very
useful. However, we would like to have something that is not entirely
specific to openrc.

Indeed, the config options (e.g. BR2_TARGET_GENERIC_TERM_KEYMAP) should
be available for all init systems. The only part that should be specific
to each init system should be how the options are applied.

Finally, we would very much like to have run-time testing of openrc as
an init system, like we have for busybox and systemd, see:
    support/testing/tests/init/

Would like to work on these two points, once the new series ahs been
applied?

Thank you for your very valuable initial work! :-)

Regards,
Yann E. MORIN.

On 2019-05-09 00:09 +0200, Micha? ?yszczek spake thusly:
> This adds openrc init system package. This performs default openrc
> installation with openrc-init that acts as pid1.
> 
> Signed-off-by: Micha? ?yszczek <michal.lyszczek@bofc.pl>
> ---
>  DEVELOPERS                 |  1 +
>  package/Config.in          |  1 +
>  package/openrc/Config.in   | 14 ++++++++++++
>  package/openrc/openrc.hash |  2 ++
>  package/openrc/openrc.mk   | 46 ++++++++++++++++++++++++++++++++++++++
>  5 files changed, 64 insertions(+)
>  create mode 100644 package/openrc/Config.in
>  create mode 100644 package/openrc/openrc.hash
>  create mode 100644 package/openrc/openrc.mk
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 6ccb0afaf6..0f89e49b92 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -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 <michel.stempin@wanadoo.fr>
>  F:	board/licheepi/
> diff --git a/package/Config.in b/package/Config.in
> index f592e74a99..d9cb755d68 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -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"
> diff --git a/package/openrc/Config.in b/package/openrc/Config.in
> new file mode 100644
> index 0000000000..e98ed624c9
> --- /dev/null
> +++ b/package/openrc/Config.in
> @@ -0,0 +1,14 @@
> +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.
> diff --git a/package/openrc/openrc.hash b/package/openrc/openrc.hash
> new file mode 100644
> index 0000000000..0d813b6a14
> --- /dev/null
> +++ b/package/openrc/openrc.hash
> @@ -0,0 +1,2 @@
> +# Calculated manually
> +sha256	c99488ca54f2b795328d07bbd456ade49b571136bba7501f7eaaeb1ca9f9ecc4	openrc-0.41.2.tar.gz
> diff --git a/package/openrc/openrc.mk b/package/openrc/openrc.mk
> new file mode 100644
> index 0000000000..faffb5beb0
> --- /dev/null
> +++ b/package/openrc/openrc.mk
> @@ -0,0 +1,46 @@
> +################################################################################
> +#
> +# openrc
> +#
> +################################################################################
> +
> +OPENRC_VERSION = 0.41.2
> +OPENRC_SOURCE = openrc-$(OPENRC_VERSION).tar.gz
> +OPENRC_SITE = $(call github,OpenRC,openrc,$(OPENRC_VERSION))
> +OPENRC_LICENSE = BSD-2-Clause
> +OPENRC_LICENSE_FILES = LICENSE
> +
> +OPENRC_DEPENDENCIES += ncurses
> +
> +ifeq ($(BR2_SHARED_LIBS),y)
> +OPENRC_MAKE_OPTS += MKSTATICLIBS=no
> +else
> +OPENRC_MAKE_OPTS += MKSTATICLIBS=yes
> +endif
> +
> +# set LIBNAME so openrc puts files in proper directories and sets proper
> +# paths in installed files. Since in buildroot /lib64 and /lib32 always
> +# points to /lib, it's safe to hardcode it to "lib"
> +OPENRC_MAKE_OPTS += LIBNAME=lib
> +OPENRC_MAKE_OPTS += LIBEXECDIR=/usr/libexec/rc
> +OPENRC_MAKE_OPTS += TARGETDIR=$(TARGET_DIR)
> +OPENRC_MAKE_OPTS += MKPKGCONFIG=no
> +OPENRC_MAKE_OPTS += MKSELINUX=no
> +OPENRC_MAKE_OPTS += MKSYSVINIT=yes
> +OPENRC_MAKE_OPTS += BRANDING="Buildroot $(BR2_VERSION_FULL)"
> +OPENRC_MAKE_OPTS += CC=$(TARGET_CC)
> +
> +define OPENRC_BUILD_CMDS
> +	$(MAKE) $(OPENRC_MAKE_OPTS) -C $(@D)
> +endef
> +
> +define OPENRC_INSTALL_TARGET_CMDS
> +	DESTDIR=$(TARGET_DIR) $(MAKE) $(OPENRC_MAKE_OPTS) -C $(@D) install
> +endef
> +
> +define OPENRC_REMOVE_UNNEEDED
> +	$(RM) -r $(TARGET_DIR)/usr/share/openrc
> +endef
> +OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_REMOVE_UNNEEDED
> +
> +$(eval $(generic-package))
> -- 
> 2.18.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 01/13] new package: openrc-0.41.2
  2019-08-04 12:30 ` Yann E. MORIN
@ 2019-08-05  8:45   ` michal.lyszczek at bofc.pl
  0 siblings, 0 replies; 19+ messages in thread
From: michal.lyszczek at bofc.pl @ 2019-08-05  8:45 UTC (permalink / raw)
  To: buildroot

Hello Yann,
On 2019-08-04 14:30:19, Yann E. MORIN wrote:
> Micha?, All,
>
> Sorry for the long delay in replying to this series...

Nothing to worry about, really.

> During the developers meetging this week-end, I've reworked most of your
> series: https://patchwork.ozlabs.org/project/buildroot/list/?series=123190
>
> I've however left two patches behind:
>
>   - package/openrc: add support to set terminal encoding
>   - package/openrc: add support for setting terminal keymap
>
> We've discussed those two patches, and we agree that the feature is very
> useful. However, we would like to have something that is not entirely
> specific to openrc.
>
> Indeed, the config options (e.g. BR2_TARGET_GENERIC_TERM_KEYMAP) should
> be available for all init systems. The only part that should be specific
> to each init system should be how the options are applied.
>
> Finally, we would very much like to have run-time testing of openrc as
> an init system, like we have for busybox and systemd, see:
>     support/testing/tests/init/
>
> Would like to work on these two points, once the new series ahs been
> applied?

Yes, I can prepare tests and add generic support for setting terminal
encoding and keymap.

> Thank you for your very valuable initial work! :-)

And thank you for tweaking my changes :-)
-------------- 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/20190805/4959c672/attachment.asc>

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

end of thread, other threads:[~2019-08-05  8:45 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-08 22:09 [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Michał Łyszczek
2019-05-08 22:09 ` [Buildroot] [PATCH 02/13] package/skeleton-init-openrc: basic skeleton for openrc Michał Łyszczek
2019-05-08 22:09 ` [Buildroot] [PATCH 03/13] system/Config.in: add new init - openrc Michał Łyszczek
2019-05-08 22:09 ` [Buildroot] [PATCH 04/13] package/openrc: add support for spawning getty Michał Łyszczek
2019-05-08 22:09 ` [Buildroot] [PATCH 05/13] package/pkg-generic.mk: add _INSTALL_INIT_OPENRC Michał Łyszczek
2019-05-09  6:54   ` Thomas Petazzoni
2019-05-08 22:09 ` [Buildroot] [PATCH 06/13] package/skeleton-init-openrc: add support to remount rootfs as rw Michał Łyszczek
2019-05-08 22:09 ` [Buildroot] [PATCH 07/13] new package: openrc-netifrc-0.6.1 Michał Łyszczek
2019-05-08 22:09 ` [Buildroot] [PATCH 08/13] package/openrc-netifrc/openrc-netifrc.mk: add support for BR2_SYSTEM_DHCP Michał Łyszczek
2019-05-08 22:09 ` [Buildroot] [PATCH 09/13] package/openrc: add patch to support busybox version of sysctl Michał Łyszczek
2019-05-08 22:09 ` [Buildroot] [PATCH 10/13] package/openrc: change /run/lock from root:uucp to root:daemon Michał Łyszczek
2019-05-08 22:09 ` [Buildroot] [PATCH 11/13] package/openrc: add support to set terminal encoding Michał Łyszczek
2019-05-08 22:09 ` [Buildroot] [PATCH 12/13] package/openrc: add support for setting terminal keymap Michał Łyszczek
2019-05-08 22:09 ` [Buildroot] [PATCH 13/13] package/skeleton-init-openrc: add support for starting sysv scripts Michał Łyszczek
2019-05-09  7:01 ` [Buildroot] [PATCH 01/13] new package: openrc-0.41.2 Thomas Petazzoni
2019-05-09 10:30   ` michal.lyszczek at bofc.pl
2019-05-09 12:20     ` Thomas Petazzoni
2019-08-04 12:30 ` Yann E. MORIN
2019-08-05  8:45   ` michal.lyszczek at bofc.pl

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.