Skip to contentSkip to conversation

init-manager-*: Mimic poky method of choosing init manager

PATCH In review Ryan Eatmon 2 participants 5 messages Aug 4, 2023 – Aug 8, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 init-manager-*: Mimic poky method of choosing init manager

Change arago over to a single init-manager for all images instead of a mixture of systemd/sysvinit based on perceived image size. With the migration to a more targeted initramfs we have the space in the image to support systemd and not require sysvinit for the smaller images.

We will still support setups that use ARAGO_SYSVINIT, but the preferred method will be to set ARAGO_INIT_MANAGER in the local.conf with the deault being systemd.

---
v2: - Add missing .inc in require.
- Fix assignment in init-manager-*.inc files.
- Remove packagegroup-arago-sysvinit-boot.bb since we stopped using it.

 meta-arago-distro/conf/distro/arago.conf          | 11 +++--------
 .../conf/distro/include/init-manager-systemd.inc  | 10 ++++++++++
 .../conf/distro/include/init-manager-sysvinit.inc | 10 ++++++++++
 .../recipes-core/images/arago-image.inc           |  2 +-
 .../recipes-core/images/arago-tiny-image.inc      |  4 ----
 .../packagegroup-arago-sysvinit-boot.bb           | 15 ---------------
 6 files changed, 24 insertions(+), 28 deletions(-)
 create mode 100644 meta-arago-distro/conf/distro/include/init-manager-systemd.inc
 create mode 100644 meta-arago-distro/conf/distro/include/init-manager-sysvinit.inc
 delete mode 100644 meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-sysvinit-boot.bb
meta-arago-distro/conf/distro/arago.conf +3 -8
index 38c42ef8..698053cb 100644
@@ -58,14 +58,9 @@ DISTRO_FEATURES_FILTER_NATIVE:append = " opencl opencv openmp"
 DISTRO_FEATURES_FILTER_NATIVESDK:append = " opencl opencv openmp"
 
 # Set global runtime providers for major components
-ARAGO_SYSVINIT ?= "0"
-VIRTUAL-RUNTIME_dev_manager = "${@'udev' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd'}"
-VIRTUAL-RUNTIME_init_manager = "${@'sysvinit' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd'}"
-VIRTUAL-RUNTIME_initscripts = "${@'initscripts' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd-compat-units'}"
-VIRTUAL-RUNTIME_initramfs = "${@'sysvinit-initramfs' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd-initramfs'}"
-VIRTUAL-RUNTIME_login_manager = "${@'busybox' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'shadow-base'}"
-
-DISTRO_FEATURES:append = " ${@'' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else ' systemd'}"
+ARAGO_SYSVINIT ??= "0"
+ARAGO_INIT_MANAGER ??= "${@['systemd','sysvinit'][int(d.getVar('ARAGO_SYSVINIT'))]}"
+require conf/distro/include/init-manager-${ARAGO_INIT_MANAGER}.inc
 
 # Distro-specific package configuration
 PACKAGECONFIG:append:pn-systemd = " coredump networkd resolved serial-getty-generator"
meta-arago-distro/conf/distro/include/init-manager-systemd.inc new file +10 -0
new file mode 100644
index 00000000..5d9d9a8e
@@ -0,0 +1,10 @@
+# Use systemd for system initialization
+
+DISTRO_FEATURES:append = " systemd"
+DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " sysvinit"
+
+VIRTUAL-RUNTIME_dev_manager = "systemd"
+VIRTUAL-RUNTIME_init_manager = "systemd"
+VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
+VIRTUAL-RUNTIME_initramfs = "systemd-initramfs"
+VIRTUAL-RUNTIME_login_manager = "shadow-base"
meta-arago-distro/conf/distro/include/init-manager-sysvinit.inc new file +10 -0
new file mode 100644
index 00000000..6ee41d6c
@@ -0,0 +1,10 @@
+# Use sysvinit for system initialization
+
+DISTRO_FEATURES:append = " sysvinit"
+DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " systemd"
+
+VIRTUAL-RUNTIME_dev_manager = ""
+VIRTUAL-RUNTIME_init_manager = "sysvinit"
+VIRTUAL-RUNTIME_initscripts = "initscripts"
+VIRTUAL-RUNTIME_initramfs = "sysvinit-initramfs"
+VIRTUAL-RUNTIME_login_manager = "busybox"
meta-arago-distro/recipes-core/images/arago-image.inc +1 -1
index d00c1f70..1c87afd5 100644
@@ -30,6 +30,6 @@ BAD_RECOMMENDATIONS += " \
     coreutils \
     coreutils-dev \
 "
-BAD_RECOMMENDATIONS += "${@oe.utils.conditional("ARAGO_SYSVINIT", "1", "", "busybox-syslog", d)}"
+BAD_RECOMMENDATIONS += "${@oe.utils.conditional("ARAGO_INIT_MANAGER", "sysvinit", "", "busybox-syslog", d)}"
 
 inherit core-image remove-net-rules
meta-arago-distro/recipes-core/images/arago-tiny-image.inc +0 -4
index 242e763c..6c726c4d 100644
@@ -1,9 +1,5 @@
-ARAGO_SYSVINIT = "1"
 
 require arago-image.inc
 
 IMAGE_FEATURES:remove = "splash"
 
-IMAGE_INSTALL = " \
-	packagegroup-arago-sysvinit-boot \
-"
meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-sysvinit-boot.bb deleted +0 -15
deleted file mode 100644
index df7ff960..00000000
@@ -1,15 +0,0 @@
-REQUIRED_DISTRO_FEATURES = "sysvinit"
-inherit features_check
-
-require recipes-core/packagegroups/packagegroup-core-boot.bb
-
-PR = "r0"
-
-# Cannot use eudev:
-#   "eudev was skipped: 'systemd' in DISTRO_FEATURES"
-#VIRTUAL-RUNTIME_dev_manager = "eudev"
-VIRTUAL-RUNTIME_dev_manager = ""
-VIRTUAL-RUNTIME_init_manager = "sysvinit"
-VIRTUAL-RUNTIME_initscripts = "initscripts"
-VIRTUAL-RUNTIME_initramfs = "sysvinit-initramfs"
-VIRTUAL-RUNTIME_login_manager = "busybox"
Signature · 1 line
2.17.1
#1 lore raw

In such case, why not use existing INIT_MANAGER variable along with the corresponding init-manager-*.inc files from OE-Core?

Quoted 130 lines · Ryan Eatmon via lists.yoctoproject.org

Change arago over to a single init-manager for all images instead of a mixture of systemd/sysvinit based on perceived image size. With the migration to a more targeted initramfs we have the space in the image to support systemd and not require sysvinit for the smaller images.

We will still support setups that use ARAGO_SYSVINIT, but the preferred method will be to set ARAGO_INIT_MANAGER in the local.conf with the deault being systemd.

---
v2: - Add missing .inc in require.
- Fix assignment in init-manager-*.inc files.
- Remove packagegroup-arago-sysvinit-boot.bb since we stopped using it.

 meta-arago-distro/conf/distro/arago.conf          | 11 +++--------
 .../conf/distro/include/init-manager-systemd.inc  | 10 ++++++++++
 .../conf/distro/include/init-manager-sysvinit.inc | 10 ++++++++++
 .../recipes-core/images/arago-image.inc           |  2 +-
 .../recipes-core/images/arago-tiny-image.inc      |  4 ----
 .../packagegroup-arago-sysvinit-boot.bb           | 15 ---------------
 6 files changed, 24 insertions(+), 28 deletions(-)
 create mode 100644 meta-arago-distro/conf/distro/include/init-manager-systemd.inc
 create mode 100644 meta-arago-distro/conf/distro/include/init-manager-sysvinit.inc
 delete mode 100644 meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-sysvinit-boot.bb
meta-arago-distro/conf/distro/arago.conf +3 -8
index 38c42ef8..698053cb 100644
@@ -58,14 +58,9 @@ DISTRO_FEATURES_FILTER_NATIVE:append = " opencl opencv openmp"
 DISTRO_FEATURES_FILTER_NATIVESDK:append = " opencl opencv openmp"
 
 # Set global runtime providers for major components
-ARAGO_SYSVINIT ?= "0"
-VIRTUAL-RUNTIME_dev_manager = "${@'udev' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd'}"
-VIRTUAL-RUNTIME_init_manager = "${@'sysvinit' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd'}"
-VIRTUAL-RUNTIME_initscripts = "${@'initscripts' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd-compat-units'}"
-VIRTUAL-RUNTIME_initramfs = "${@'sysvinit-initramfs' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd-initramfs'}"
-VIRTUAL-RUNTIME_login_manager = "${@'busybox' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'shadow-base'}"
-
-DISTRO_FEATURES:append = " ${@'' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else ' systemd'}"
+ARAGO_SYSVINIT ??= "0"
+ARAGO_INIT_MANAGER ??= "${@['systemd','sysvinit'][int(d.getVar('ARAGO_SYSVINIT'))]}"
+require conf/distro/include/init-manager-${ARAGO_INIT_MANAGER}.inc
 
 # Distro-specific package configuration
 PACKAGECONFIG:append:pn-systemd = " coredump networkd resolved serial-getty-generator"
meta-arago-distro/conf/distro/include/init-manager-systemd.inc new file +10 -0
new file mode 100644
index 00000000..5d9d9a8e
@@ -0,0 +1,10 @@
+# Use systemd for system initialization
+
+DISTRO_FEATURES:append = " systemd"
+DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " sysvinit"
+
+VIRTUAL-RUNTIME_dev_manager = "systemd"
+VIRTUAL-RUNTIME_init_manager = "systemd"
+VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
+VIRTUAL-RUNTIME_initramfs = "systemd-initramfs"
+VIRTUAL-RUNTIME_login_manager = "shadow-base"
meta-arago-distro/conf/distro/include/init-manager-sysvinit.inc new file +10 -0
new file mode 100644
index 00000000..6ee41d6c
@@ -0,0 +1,10 @@
+# Use sysvinit for system initialization
+
+DISTRO_FEATURES:append = " sysvinit"
+DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " systemd"
+
+VIRTUAL-RUNTIME_dev_manager = ""
+VIRTUAL-RUNTIME_init_manager = "sysvinit"
+VIRTUAL-RUNTIME_initscripts = "initscripts"
+VIRTUAL-RUNTIME_initramfs = "sysvinit-initramfs"
+VIRTUAL-RUNTIME_login_manager = "busybox"
meta-arago-distro/recipes-core/images/arago-image.inc +1 -1
index d00c1f70..1c87afd5 100644
@@ -30,6 +30,6 @@ BAD_RECOMMENDATIONS += " \
     coreutils \
     coreutils-dev \
 "
-BAD_RECOMMENDATIONS += "${@oe.utils.conditional("ARAGO_SYSVINIT", "1", "", "busybox-syslog", d)}"
+BAD_RECOMMENDATIONS += "${@oe.utils.conditional("ARAGO_INIT_MANAGER", "sysvinit", "", "busybox-syslog", d)}"
 
 inherit core-image remove-net-rules
meta-arago-distro/recipes-core/images/arago-tiny-image.inc +0 -4
index 242e763c..6c726c4d 100644
@@ -1,9 +1,5 @@
-ARAGO_SYSVINIT = "1"
 
 require arago-image.inc
 
 IMAGE_FEATURES:remove = "splash"
 
-IMAGE_INSTALL = " \
-	packagegroup-arago-sysvinit-boot \
-"
meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-sysvinit-boot.bb deleted +0 -15
deleted file mode 100644
index df7ff960..00000000
@@ -1,15 +0,0 @@
-REQUIRED_DISTRO_FEATURES = "sysvinit"
-inherit features_check
-
-require recipes-core/packagegroups/packagegroup-core-boot.bb
-
-PR = "r0"
-
-# Cannot use eudev:
-#   "eudev was skipped: 'systemd' in DISTRO_FEATURES"
-#VIRTUAL-RUNTIME_dev_manager = "eudev"
-VIRTUAL-RUNTIME_dev_manager = ""
-VIRTUAL-RUNTIME_init_manager = "sysvinit"
-VIRTUAL-RUNTIME_initscripts = "initscripts"
-VIRTUAL-RUNTIME_initramfs = "sysvinit-initramfs"
-VIRTUAL-RUNTIME_login_manager = "busybox"
Signature · 1 line
2.17.1
#2 lore raw

I thought about it. But we have so many other ARAGO_* variables that it seemed more on brand to use ARAGO_INIT_MANAGER...

As for not reusing the files... ours have a minor difference. One variable I think. So again for consistency I made the files local. Plus, it can be really confusing to bounce between layers when including files and what not. If we did use those files, then I would definitely want to add a comment next the include line that states that the files are in oe-core. But

Quoted 135 lines · Denys Dmytriyenko

In such case, why not use existing INIT_MANAGER variable along with the corresponding init-manager-*.inc files from OE-Core?

Quoted 130 lines · Ryan Eatmon via lists.yoctoproject.org

Change arago over to a single init-manager for all images instead of a mixture of systemd/sysvinit based on perceived image size. With the migration to a more targeted initramfs we have the space in the image to support systemd and not require sysvinit for the smaller images.

We will still support setups that use ARAGO_SYSVINIT, but the preferred method will be to set ARAGO_INIT_MANAGER in the local.conf with the deault being systemd.

---
v2: - Add missing .inc in require.
- Fix assignment in init-manager-*.inc files.
- Remove packagegroup-arago-sysvinit-boot.bb since we stopped using it.

  meta-arago-distro/conf/distro/arago.conf          | 11 +++--------
  .../conf/distro/include/init-manager-systemd.inc  | 10 ++++++++++
  .../conf/distro/include/init-manager-sysvinit.inc | 10 ++++++++++
  .../recipes-core/images/arago-image.inc           |  2 +-
  .../recipes-core/images/arago-tiny-image.inc      |  4 ----
  .../packagegroup-arago-sysvinit-boot.bb           | 15 ---------------
  6 files changed, 24 insertions(+), 28 deletions(-)

create mode 100644 meta-arago-distro/conf/distro/include/init-manager-systemd.inc create mode 100644 meta-arago-distro/conf/distro/include/init-manager-sysvinit.inc delete mode 100644 meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-sysvinit-boot.bb

meta-arago-distro/conf/distro/arago.conf +3 -8
index 38c42ef8..698053cb 100644
@@ -58,14 +58,9 @@ DISTRO_FEATURES_FILTER_NATIVE:append = " opencl opencv openmp"
  DISTRO_FEATURES_FILTER_NATIVESDK:append = " opencl opencv openmp"
 
  # Set global runtime providers for major components
-ARAGO_SYSVINIT ?= "0"
-VIRTUAL-RUNTIME_dev_manager = "${@'udev' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd'}"
-VIRTUAL-RUNTIME_init_manager = "${@'sysvinit' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd'}"
-VIRTUAL-RUNTIME_initscripts = "${@'initscripts' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd-compat-units'}"
-VIRTUAL-RUNTIME_initramfs = "${@'sysvinit-initramfs' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd-initramfs'}"
-VIRTUAL-RUNTIME_login_manager = "${@'busybox' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'shadow-base'}"
-
-DISTRO_FEATURES:append = " ${@'' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else ' systemd'}"
+ARAGO_SYSVINIT ??= "0"
+ARAGO_INIT_MANAGER ??= "${@['systemd','sysvinit'][int(d.getVar('ARAGO_SYSVINIT'))]}"
+require conf/distro/include/init-manager-${ARAGO_INIT_MANAGER}.inc
 
  # Distro-specific package configuration
  PACKAGECONFIG:append:pn-systemd = " coredump networkd resolved serial-getty-generator"
meta-arago-distro/conf/distro/include/init-manager-systemd.inc new file +10 -0
new file mode 100644
index 00000000..5d9d9a8e
@@ -0,0 +1,10 @@
+# Use systemd for system initialization
+
+DISTRO_FEATURES:append = " systemd"
+DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " sysvinit"
+
+VIRTUAL-RUNTIME_dev_manager = "systemd"
+VIRTUAL-RUNTIME_init_manager = "systemd"
+VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
+VIRTUAL-RUNTIME_initramfs = "systemd-initramfs"
+VIRTUAL-RUNTIME_login_manager = "shadow-base"
meta-arago-distro/conf/distro/include/init-manager-sysvinit.inc new file +10 -0
new file mode 100644
index 00000000..6ee41d6c
@@ -0,0 +1,10 @@
+# Use sysvinit for system initialization
+
+DISTRO_FEATURES:append = " sysvinit"
+DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " systemd"
+
+VIRTUAL-RUNTIME_dev_manager = ""
+VIRTUAL-RUNTIME_init_manager = "sysvinit"
+VIRTUAL-RUNTIME_initscripts = "initscripts"
+VIRTUAL-RUNTIME_initramfs = "sysvinit-initramfs"
+VIRTUAL-RUNTIME_login_manager = "busybox"
meta-arago-distro/recipes-core/images/arago-image.inc +1 -1
index d00c1f70..1c87afd5 100644
@@ -30,6 +30,6 @@ BAD_RECOMMENDATIONS += " \
      coreutils \
      coreutils-dev \
  "
-BAD_RECOMMENDATIONS += "${@oe.utils.conditional("ARAGO_SYSVINIT", "1", "", "busybox-syslog", d)}"
+BAD_RECOMMENDATIONS += "${@oe.utils.conditional("ARAGO_INIT_MANAGER", "sysvinit", "", "busybox-syslog", d)}"
 
  inherit core-image remove-net-rules
meta-arago-distro/recipes-core/images/arago-tiny-image.inc +0 -4
index 242e763c..6c726c4d 100644
@@ -1,9 +1,5 @@
-ARAGO_SYSVINIT = "1"
 
  require arago-image.inc
 
  IMAGE_FEATURES:remove = "splash"
 
-IMAGE_INSTALL = " \
-	packagegroup-arago-sysvinit-boot \
-"
meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-sysvinit-boot.bb deleted +0 -15
deleted file mode 100644
index df7ff960..00000000
@@ -1,15 +0,0 @@
-REQUIRED_DISTRO_FEATURES = "sysvinit"
-inherit features_check
-
-require recipes-core/packagegroups/packagegroup-core-boot.bb
-
-PR = "r0"
-
-# Cannot use eudev:
-#   "eudev was skipped: 'systemd' in DISTRO_FEATURES"
-#VIRTUAL-RUNTIME_dev_manager = "eudev"
-VIRTUAL-RUNTIME_dev_manager = ""
-VIRTUAL-RUNTIME_init_manager = "sysvinit"
-VIRTUAL-RUNTIME_initscripts = "initscripts"
-VIRTUAL-RUNTIME_initramfs = "sysvinit-initramfs"
-VIRTUAL-RUNTIME_login_manager = "busybox"
Signature · 1 line
2.17.1
Signature · 3 lines
Ryan Eatmon                [email protected]
-----------------------------------------
Texas Instruments, Inc.  -  LCPD  -  MGTS
#3 lore raw
Quoted 9 lines · Ryan Eatmon

I thought about it. But we have so many other ARAGO_* variables that it seemed more on brand to use ARAGO_INIT_MANAGER...

As for not reusing the files... ours have a minor difference. One variable I think. So again for consistency I made the files local. Plus, it can be really confusing to bounce between layers when including files and what not. If we did use those files, then I would definitely want to add a comment next the include line that states that the files are in oe-core. But

Was this reply truncated accidentally? ^^^

So, the only difference in those .inc files between OE-Core and meta-arago was due to trying to use both systemd and sysvinit at the same time. I had to add a custom VIRTUAL-RUNTIME_initramfs for that:

https://git.yoctoproject.org/meta-arago/commit/?id=78efe456a884176cfd1f6794fd317fc1e51b9358

systemd recipe in OE-Core alredy provides a subpackage systemd-initramfs with the /init symlink pointing to systemd binary:

https://git.openembedded.org/openembedded-core/tree/meta/recipes-core/systemd/systemd_254.bb#n273

When not using any init managers for a barebone ramdisk boot, you should provide a custom /init script to do boot chores, like initramfs-framework in OE-Core does:

https://git.openembedded.org/openembedded-core/tree/meta/recipes-core/initrdscripts/initramfs-framework/init

BTW, sysvinit has /sbin/init and that one should be used first, or used as a fallback (don't remember the exact order now), so doing /init -> /sbin/init shouldn't be strictly necessary and was done for consistency with systemd. Also, I don't remember all the details, but it could have been also done to workaround early K3 simulation boot issues...

Anyway, since you are now dismantling all this custom logic, it might be better to drop sysvinit-initramfs, VIRTUAL-RUNTIME_initramfs and fully embrace upstream INIT_MANAGER variable and existing init-manager-*.inc files from OE-Core. Maybe a bit of extra testing to ensure everything still boots as expected... :)

Quoted 130 lines · Denys Dmytriyenko
Quoted 129 lines

In such case, why not use existing INIT_MANAGER variable along with the corresponding init-manager-*.inc files from OE-Core?

Quoted 124 lines · Ryan Eatmon via lists.yoctoproject.org

Change arago over to a single init-manager for all images instead of a mixture of systemd/sysvinit based on perceived image size. With the migration to a more targeted initramfs we have the space in the image to support systemd and not require sysvinit for the smaller images.

We will still support setups that use ARAGO_SYSVINIT, but the preferred method will be to set ARAGO_INIT_MANAGER in the local.conf with the deault being systemd.

---
v2: - Add missing .inc in require.
- Fix assignment in init-manager-*.inc files.
- Remove packagegroup-arago-sysvinit-boot.bb since we stopped using it.

 meta-arago-distro/conf/distro/arago.conf          | 11 +++--------
 .../conf/distro/include/init-manager-systemd.inc  | 10 ++++++++++
 .../conf/distro/include/init-manager-sysvinit.inc | 10 ++++++++++
 .../recipes-core/images/arago-image.inc           |  2 +-
 .../recipes-core/images/arago-tiny-image.inc      |  4 ----
 .../packagegroup-arago-sysvinit-boot.bb           | 15 ---------------
 6 files changed, 24 insertions(+), 28 deletions(-)
 create mode 100644 meta-arago-distro/conf/distro/include/init-manager-systemd.inc
 create mode 100644 meta-arago-distro/conf/distro/include/init-manager-sysvinit.inc
 delete mode 100644 meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-sysvinit-boot.bb
meta-arago-distro/conf/distro/arago.conf +3 -8
index 38c42ef8..698053cb 100644
@@ -58,14 +58,9 @@ DISTRO_FEATURES_FILTER_NATIVE:append = " opencl opencv openmp"
 DISTRO_FEATURES_FILTER_NATIVESDK:append = " opencl opencv openmp"
 # Set global runtime providers for major components
-ARAGO_SYSVINIT ?= "0"
-VIRTUAL-RUNTIME_dev_manager = "${@'udev' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd'}"
-VIRTUAL-RUNTIME_init_manager = "${@'sysvinit' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd'}"
-VIRTUAL-RUNTIME_initscripts = "${@'initscripts' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd-compat-units'}"
-VIRTUAL-RUNTIME_initramfs = "${@'sysvinit-initramfs' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd-initramfs'}"
-VIRTUAL-RUNTIME_login_manager = "${@'busybox' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'shadow-base'}"
-
-DISTRO_FEATURES:append = " ${@'' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else ' systemd'}"
+ARAGO_SYSVINIT ??= "0"
+ARAGO_INIT_MANAGER ??= "${@['systemd','sysvinit'][int(d.getVar('ARAGO_SYSVINIT'))]}"
+require conf/distro/include/init-manager-${ARAGO_INIT_MANAGER}.inc
 # Distro-specific package configuration
 PACKAGECONFIG:append:pn-systemd = " coredump networkd resolved serial-getty-generator"
meta-arago-distro/conf/distro/include/init-manager-systemd.inc new file +10 -0
new file mode 100644
index 00000000..5d9d9a8e
@@ -0,0 +1,10 @@
+# Use systemd for system initialization
+
+DISTRO_FEATURES:append = " systemd"
+DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " sysvinit"
+
+VIRTUAL-RUNTIME_dev_manager = "systemd"
+VIRTUAL-RUNTIME_init_manager = "systemd"
+VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
+VIRTUAL-RUNTIME_initramfs = "systemd-initramfs"
+VIRTUAL-RUNTIME_login_manager = "shadow-base"
meta-arago-distro/conf/distro/include/init-manager-sysvinit.inc new file +10 -0
new file mode 100644
index 00000000..6ee41d6c
@@ -0,0 +1,10 @@
+# Use sysvinit for system initialization
+
+DISTRO_FEATURES:append = " sysvinit"
+DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " systemd"
+
+VIRTUAL-RUNTIME_dev_manager = ""
+VIRTUAL-RUNTIME_init_manager = "sysvinit"
+VIRTUAL-RUNTIME_initscripts = "initscripts"
+VIRTUAL-RUNTIME_initramfs = "sysvinit-initramfs"
+VIRTUAL-RUNTIME_login_manager = "busybox"
meta-arago-distro/recipes-core/images/arago-image.inc +1 -1
index d00c1f70..1c87afd5 100644
@@ -30,6 +30,6 @@ BAD_RECOMMENDATIONS += " \
     coreutils \
     coreutils-dev \
 "
-BAD_RECOMMENDATIONS += "${@oe.utils.conditional("ARAGO_SYSVINIT", "1", "", "busybox-syslog", d)}"
+BAD_RECOMMENDATIONS += "${@oe.utils.conditional("ARAGO_INIT_MANAGER", "sysvinit", "", "busybox-syslog", d)}"
 inherit core-image remove-net-rules
meta-arago-distro/recipes-core/images/arago-tiny-image.inc +0 -4
index 242e763c..6c726c4d 100644
@@ -1,9 +1,5 @@
-ARAGO_SYSVINIT = "1"
 require arago-image.inc
 IMAGE_FEATURES:remove = "splash"
-IMAGE_INSTALL = " \
-	packagegroup-arago-sysvinit-boot \
-"
meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-sysvinit-boot.bb deleted +0 -15
deleted file mode 100644
index df7ff960..00000000
@@ -1,15 +0,0 @@
-REQUIRED_DISTRO_FEATURES = "sysvinit"
-inherit features_check
-
-require recipes-core/packagegroups/packagegroup-core-boot.bb
-
-PR = "r0"
-
-# Cannot use eudev:
-#   "eudev was skipped: 'systemd' in DISTRO_FEATURES"
-#VIRTUAL-RUNTIME_dev_manager = "eudev"
-VIRTUAL-RUNTIME_dev_manager = ""
-VIRTUAL-RUNTIME_init_manager = "sysvinit"
-VIRTUAL-RUNTIME_initscripts = "initscripts"
-VIRTUAL-RUNTIME_initramfs = "sysvinit-initramfs"
-VIRTUAL-RUNTIME_login_manager = "busybox"
Signature · 1 line
2.17.1
#4 lore raw
Quoted 37 lines · Denys Dmytriyenko
Quoted 9 lines · Ryan Eatmon

I thought about it. But we have so many other ARAGO_* variables that it seemed more on brand to use ARAGO_INIT_MANAGER...

As for not reusing the files... ours have a minor difference. One variable I think. So again for consistency I made the files local. Plus, it can be really confusing to bounce between layers when including files and what not. If we did use those files, then I would definitely want to add a comment next the include line that states that the files are in oe-core. But

Was this reply truncated accidentally? ^^^

So, the only difference in those .inc files between OE-Core and meta-arago was due to trying to use both systemd and sysvinit at the same time. I had to add a custom VIRTUAL-RUNTIME_initramfs for that:

https://git.yoctoproject.org/meta-arago/commit/?id=78efe456a884176cfd1f6794fd317fc1e51b9358

systemd recipe in OE-Core alredy provides a subpackage systemd-initramfs with the /init symlink pointing to systemd binary:

https://git.openembedded.org/openembedded-core/tree/meta/recipes-core/systemd/systemd_254.bb#n273

When not using any init managers for a barebone ramdisk boot, you should provide a custom /init script to do boot chores, like initramfs-framework in OE-Core does:

https://git.openembedded.org/openembedded-core/tree/meta/recipes-core/initrdscripts/initramfs-framework/init

BTW, sysvinit has /sbin/init and that one should be used first, or used as a fallback (don't remember the exact order now), so doing /init -> /sbin/init shouldn't be strictly necessary and was done for consistency with systemd. Also, I don't remember all the details, but it could have been also done to workaround early K3 simulation boot issues...

Quoted 5 lines

Anyway, since you are now dismantling all this custom logic, it might be better to drop sysvinit-initramfs, VIRTUAL-RUNTIME_initramfs and fully embrace upstream INIT_MANAGER variable and existing init-manager-*.inc files from OE-Core. Maybe a bit of extra testing to ensure everything still boots as expected... :)

Ok. I'll try that out.

Quoted 131 lines
Quoted 131 lines · Denys Dmytriyenko
Quoted 129 lines

In such case, why not use existing INIT_MANAGER variable along with the corresponding init-manager-*.inc files from OE-Core?

Quoted 124 lines · Ryan Eatmon via lists.yoctoproject.org

Change arago over to a single init-manager for all images instead of a mixture of systemd/sysvinit based on perceived image size. With the migration to a more targeted initramfs we have the space in the image to support systemd and not require sysvinit for the smaller images.

We will still support setups that use ARAGO_SYSVINIT, but the preferred method will be to set ARAGO_INIT_MANAGER in the local.conf with the deault being systemd.

---
v2: - Add missing .inc in require.
- Fix assignment in init-manager-*.inc files.
- Remove packagegroup-arago-sysvinit-boot.bb since we stopped using it.

  meta-arago-distro/conf/distro/arago.conf          | 11 +++--------
  .../conf/distro/include/init-manager-systemd.inc  | 10 ++++++++++
  .../conf/distro/include/init-manager-sysvinit.inc | 10 ++++++++++
  .../recipes-core/images/arago-image.inc           |  2 +-
  .../recipes-core/images/arago-tiny-image.inc      |  4 ----
  .../packagegroup-arago-sysvinit-boot.bb           | 15 ---------------
  6 files changed, 24 insertions(+), 28 deletions(-)

create mode 100644 meta-arago-distro/conf/distro/include/init-manager-systemd.inc create mode 100644 meta-arago-distro/conf/distro/include/init-manager-sysvinit.inc delete mode 100644 meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-sysvinit-boot.bb

meta-arago-distro/conf/distro/arago.conf +3 -8
index 38c42ef8..698053cb 100644
@@ -58,14 +58,9 @@ DISTRO_FEATURES_FILTER_NATIVE:append = " opencl opencv openmp"
  DISTRO_FEATURES_FILTER_NATIVESDK:append = " opencl opencv openmp"
  # Set global runtime providers for major components
-ARAGO_SYSVINIT ?= "0"
-VIRTUAL-RUNTIME_dev_manager = "${@'udev' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd'}"
-VIRTUAL-RUNTIME_init_manager = "${@'sysvinit' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd'}"
-VIRTUAL-RUNTIME_initscripts = "${@'initscripts' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd-compat-units'}"
-VIRTUAL-RUNTIME_initramfs = "${@'sysvinit-initramfs' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'systemd-initramfs'}"
-VIRTUAL-RUNTIME_login_manager = "${@'busybox' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else 'shadow-base'}"
-
-DISTRO_FEATURES:append = " ${@'' if oe.types.boolean(d.getVar('ARAGO_SYSVINIT')) else ' systemd'}"
+ARAGO_SYSVINIT ??= "0"
+ARAGO_INIT_MANAGER ??= "${@['systemd','sysvinit'][int(d.getVar('ARAGO_SYSVINIT'))]}"
+require conf/distro/include/init-manager-${ARAGO_INIT_MANAGER}.inc
  # Distro-specific package configuration
  PACKAGECONFIG:append:pn-systemd = " coredump networkd resolved serial-getty-generator"
meta-arago-distro/conf/distro/include/init-manager-systemd.inc new file +10 -0
new file mode 100644
index 00000000..5d9d9a8e
@@ -0,0 +1,10 @@
+# Use systemd for system initialization
+
+DISTRO_FEATURES:append = " systemd"
+DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " sysvinit"
+
+VIRTUAL-RUNTIME_dev_manager = "systemd"
+VIRTUAL-RUNTIME_init_manager = "systemd"
+VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
+VIRTUAL-RUNTIME_initramfs = "systemd-initramfs"
+VIRTUAL-RUNTIME_login_manager = "shadow-base"
meta-arago-distro/conf/distro/include/init-manager-sysvinit.inc new file +10 -0
new file mode 100644
index 00000000..6ee41d6c
@@ -0,0 +1,10 @@
+# Use sysvinit for system initialization
+
+DISTRO_FEATURES:append = " sysvinit"
+DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " systemd"
+
+VIRTUAL-RUNTIME_dev_manager = ""
+VIRTUAL-RUNTIME_init_manager = "sysvinit"
+VIRTUAL-RUNTIME_initscripts = "initscripts"
+VIRTUAL-RUNTIME_initramfs = "sysvinit-initramfs"
+VIRTUAL-RUNTIME_login_manager = "busybox"
meta-arago-distro/recipes-core/images/arago-image.inc +1 -1
index d00c1f70..1c87afd5 100644
@@ -30,6 +30,6 @@ BAD_RECOMMENDATIONS += " \
      coreutils \
      coreutils-dev \
  "
-BAD_RECOMMENDATIONS += "${@oe.utils.conditional("ARAGO_SYSVINIT", "1", "", "busybox-syslog", d)}"
+BAD_RECOMMENDATIONS += "${@oe.utils.conditional("ARAGO_INIT_MANAGER", "sysvinit", "", "busybox-syslog", d)}"
  inherit core-image remove-net-rules
meta-arago-distro/recipes-core/images/arago-tiny-image.inc +0 -4
index 242e763c..6c726c4d 100644
@@ -1,9 +1,5 @@
-ARAGO_SYSVINIT = "1"
  require arago-image.inc
  IMAGE_FEATURES:remove = "splash"
-IMAGE_INSTALL = " \
-	packagegroup-arago-sysvinit-boot \
-"
meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-sysvinit-boot.bb deleted +0 -15
deleted file mode 100644
index df7ff960..00000000
@@ -1,15 +0,0 @@
-REQUIRED_DISTRO_FEATURES = "sysvinit"
-inherit features_check
-
-require recipes-core/packagegroups/packagegroup-core-boot.bb
-
-PR = "r0"
-
-# Cannot use eudev:
-#   "eudev was skipped: 'systemd' in DISTRO_FEATURES"
-#VIRTUAL-RUNTIME_dev_manager = "eudev"
-VIRTUAL-RUNTIME_dev_manager = ""
-VIRTUAL-RUNTIME_init_manager = "sysvinit"
-VIRTUAL-RUNTIME_initscripts = "initscripts"
-VIRTUAL-RUNTIME_initramfs = "sysvinit-initramfs"
-VIRTUAL-RUNTIME_login_manager = "busybox"
Signature · 1 line
2.17.1
Signature · 3 lines
Ryan Eatmon                [email protected]
-----------------------------------------
Texas Instruments, Inc.  -  LCPD  -  MGTS