system: properly handle systemd as init system
cover system: properly handle systemd as init system
Hello All!
This series is a proposal to fix our handling of systemd as an init system.
Our default skeleton is not well suited for systemd:
- we have /var/log a symlink to /tmp/log, but the way systemd starts hides the journals:
- start systemd-journald, stores journals in /tmp/log/ (because of the redirection above)
- mounts a tmpfs over /tmp, thus hidding the journals.
- on a read-only rootfs, systemd expects /var to be read-write, which we do not provide.
All of this sounds trivial, but fixing it is definitely not.
The overall idea is that we need different skeletons, one for each type of init systems: sysv, systemd, others (aka custom).
The skeleton package becomes a virtual package, that is provided by one of four implementations:
- skeleton-sysv or skeleton-systemd, as their names imply, for either
SysV- or systemd-based systems, and which depend on skeleton-common;
- skeleton-common, that provides base files and directories comon to all skeletons (except custom, below); skeleton-common is also a provider for the skeleton virtual package, for use with no-init (aka custom init) systems;
- skeleton-custom, for user-provided custom skeleton, and of which we expect it is fully prepared; skeleton-custom does not depend on skeleton-common.
A series of runtime tests have also been added, running on the QEMU vexpress:
init system rootfs DHCP?
-------------------------------------
busybox ext4 no
busybox ext4 eth0
busybox squashfs no
busybox squashfs eth0
* systemd-ifupdown ext4 eth0
systemd-ifupdown squashfs eth0
** systemd-networkd ext4 eth0
systemd-networkd squashfs eth0
*** systemd-full ext4 eth0
systemd-full squashfs eth0
+ no-init squashfs no * systemd-networkd: only what gets selected automatically when
systemd is used as init system, with all other options unset;
** systemd-ifupdown: like systemd-networkd, but with networkd
disabled, thus using ifupdown instead;
*** systemd-full: all systemd options enabled, implies networkd;
+ a shell is launched as init
Those new tests are not exhaustive, especially the systemd one; instead, they just test basic features: what init is being used, and did we get an IP adress for eth0? More tests can be added later on.
Changes v2 -> v3:
- too much to note, mostly rewriten from scratch
Changes v1 -> v2:
- enhance the commit logs
Regards,
Yann E. MORIN.
The following changes since commit bc801efacb298e2297024f83e960eaf8a45dd39f
python-coherence: bump to the latest upstream commit (2017-07-17 11:28:58 +0200)
are available in the git repository at:
git://git.buildroot.org/~ymorin/git/buildroot.git
for you to fetch changes up to 95f6965c48dbf2f754818e2bec1f2d3891015475
support/testing: add runtime testing for init systems (2017-07-18 18:59:05 +0200)
----------------------------------------------------------------
Yann E. MORIN (20):
support/tests: allow properly indented config fragment core/pkg-generic: add variable to skip skeleton dependency package/skeleton: add macro to rsync skeleton directory package/skeleton: make SKELETON_LIB_SYMLINK a macro
system: provide package-wide system variables and macros
system: move setting getty to the corresponding init systems
system: move remounting / to the corresponding init systems
system: with no init system, only allow custom skeleton package/skeleton: drop dependency on host-mkpasswd package/skeleton: select it rather than default to y package/skeleton: split out into skeleton-custom package/skeleton: split out into skeleton-common package/skeleton: make it a virtual package package/skeleton-common: simplify staging install package/skeleton: introduce sysv- and systemd-specific skeletons
system: separate sysv and systemd parts of the skeleton
sytem: no-init systems may use our default, common skeleton
fs: add pre- and post-command hooks
system: make systemd work on a read-only rootfs support/testing: add runtime testing for init systems
Makefile | 1 +
fs/common.mk | 4 +
package/Config.in | 4 +
package/busybox/busybox.mk | 15 +-
package/pkg-generic.mk | 11 +-
package/skeleton-common/Config.in | 31 ++++
package/skeleton-common/skeleton-common.mk | 92 +++++++++
package/skeleton-custom/Config.in | 6 +
package/skeleton-custom/skeleton-custom.mk | 107 +++++++++++
package/skeleton-systemd/Config.in | 7 +
package/skeleton-systemd/skeleton-systemd.mk | 71 +++++++
package/skeleton-sysv/Config.in | 7 +
package/skeleton-sysv/skeleton-sysv.mk | 22 +++
{system => package/skeleton-sysv}/skeleton/dev/log | 0
.../skeleton-sysv}/skeleton/dev/pts/.empty | 0
.../skeleton-sysv}/skeleton/dev/shm/.empty | 0
.../skeleton-sysv}/skeleton/etc/fstab | 0
.../skeleton-sysv}/skeleton/var/cache | 0
.../skeleton-sysv}/skeleton/var/lib/misc | 0
.../skeleton-sysv}/skeleton/var/lock | 0
{system => package/skeleton-sysv}/skeleton/var/log | 0
{system => package/skeleton-sysv}/skeleton/var/run | 0
.../skeleton-sysv}/skeleton/var/spool | 0
{system => package/skeleton-sysv}/skeleton/var/tmp | 0
package/skeleton/Config.in | 8 +-
package/skeleton/skeleton.mk | 206 +--------------------
package/sysvinit/sysvinit.mk | 11 ++
support/testing/infra/builder.py | 3 +-
.../testing/tests/init/__init__.py | 0
support/testing/tests/init/base.py | 47 +++++
support/testing/tests/init/test_busybox.py | 67 +++++++
support/testing/tests/init/test_none.py | 32 ++++
support/testing/tests/init/test_systemd.py | 145 +++++++++++++++
system/Config.in | 13 +-
system/skeleton/dev/{pts => }/.empty | 0
system/system.mk | 88 +++++++++
36 files changed, 787 insertions(+), 211 deletions(-)
create mode 100644 package/skeleton-common/Config.in
create mode 100644 package/skeleton-common/skeleton-common.mk
create mode 100644 package/skeleton-custom/Config.in
create mode 100644 package/skeleton-custom/skeleton-custom.mk
create mode 100644 package/skeleton-systemd/Config.in
create mode 100644 package/skeleton-systemd/skeleton-systemd.mk
create mode 100644 package/skeleton-sysv/Config.in
create mode 100644 package/skeleton-sysv/skeleton-sysv.mk
rename {system => package/skeleton-sysv}/skeleton/dev/log (100%)
copy {system => package/skeleton-sysv}/skeleton/dev/pts/.empty (100%)
rename {system => package/skeleton-sysv}/skeleton/dev/shm/.empty (100%)
rename {system => package/skeleton-sysv}/skeleton/etc/fstab (100%)
rename {system => package/skeleton-sysv}/skeleton/var/cache (100%)
rename {system => package/skeleton-sysv}/skeleton/var/lib/misc (100%)
rename {system => package/skeleton-sysv}/skeleton/var/lock (100%)
rename {system => package/skeleton-sysv}/skeleton/var/log (100%)
rename {system => package/skeleton-sysv}/skeleton/var/run (100%)
rename {system => package/skeleton-sysv}/skeleton/var/spool (100%)
rename {system => package/skeleton-sysv}/skeleton/var/tmp (100%)
copy system/skeleton/dev/pts/.empty => support/testing/tests/init/__init__.py (100%)
create mode 100644 support/testing/tests/init/base.py
create mode 100644 support/testing/tests/init/test_busybox.py
create mode 100644 support/testing/tests/init/test_none.py
create mode 100644 support/testing/tests/init/test_systemd.py
rename system/skeleton/dev/{pts => }/.empty (100%)
create mode 100644 system/system.mkSignature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/20 support/tests: allow properly indented config fragment
Currently, defining a config fragment in the runtime test infra requires that the fragment not to be indented. This is beark, and causes grievance when looking at the code (e.g. to fix it).
Just strip out all leading spaces/tabs when writing the configuration lines into the config file, allowing in-line indented config fragments, like so:
class TestFoo(bla):
config = bla.config + \
"""
FOO=y
# BAR is not set
"""---
Changes v1 -> v2:
- add example in commit log (Thomas)
---
Note: this is only tangentially related to this series, because it is needed by the last patch in the series. It wasalready submitted before:
https://patchwork.ozlabs.org/patch/788985/ --- support/testing/infra/builder.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
support/testing/infra/builder.py +2 -1
@@ -16,7 +16,8 @@ class Builder(object): config_file = os.path.join(self.builddir, ".config") with open(config_file, "w+") as cf: - cf.write(self.config) + for line in self.config.splitlines(): + cf.write("{}\n".format(line.lstrip())) cmd = ["make", "O={}".format(self.builddir),
Signature · 1 line
2.11.0
PATCH 1/20 support/tests: allow properly indented config fragment
All,
This is version 2 of the patch. Version 1 has been just reviewed now by Arnout, after which I sent v3:
https://patchwork.ozlabs.org/patch/790525/
So, please disregard this one; use v3 instead (but still before the rest of this series).
Thanks!
Regards,
Yann E. MORIN.
On 2017-07-18 19:25 +0200, Yann E. MORIN spake thusly:
Quoted 47 lines
Currently, defining a config fragment in the runtime test infra requires that the fragment not to be indented. This is beark, and causes grievance when looking at the code (e.g. to fix it).
Just strip out all leading spaces/tabs when writing the configuration lines into the config file, allowing in-line indented config fragments, like so:
class TestFoo(bla): config = bla.config + \ """ FOO=y # BAR is not set """Signed-off-by "Yann E. MORIN" <[email protected]>Cc Thomas Petazzoni <[email protected]>---
Changes v1 -> v2:
- add example in commit log (Thomas)---
Note: this is only tangentially related to this series, because it is needed by the last patch in the series. It wasalready submitted before:https://patchwork.ozlabs.org/patch/788985/ --- support/testing/infra/builder.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)support/testing/infra/builder.py +2
-1@@ -16,7 +16,8 @@ class Builder(object): config_file = os.path.join(self.builddir, ".config") with open(config_file, "w+") as cf: - cf.write(self.config) + for line in self.config.splitlines(): + cf.write("{}\n".format(line.lstrip())) cmd = ["make", "O={}".format(self.builddir),Signature · 1 line
2.11.0
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 2/20 core/pkg-generic: add variable to skip skeleton dependency
In reply to Yann E. MORINWe currently skip the skeleton dependency by checking if the current package is the skeleton.
We are going to introduce more skeleton-related packages, so we need a way to exclude the skeleton dependency for those, or we'd get a circular dependency, for the same reason we need to skip the toolchain dependency.
Instead of checking for all the skeleton-providing packages in the core infra, add a new package options so that packages can express they do not need the dependency on the skeleton, like we have an option to avoid the depednency on the toolchain. The only packages that will use that option are probably the skeletons, so we need not document this variable, like we did not document the option to exclude the dependency on the toolchain.
--- package/pkg-generic.mk | 7 +++++-- package/skeleton/skeleton.mk | 1 + 2 files changed, 6 insertions(+), 2 deletions(-)
package/pkg-generic.mk +5 -2
@@ -542,11 +542,14 @@ $(2)_REDIST_SOURCES_DIR = $$(REDIST_SOURCES_DIR_$$(call UPPERCASE,$(4)))/$$($(2) # When a target package is a toolchain dependency set this variable to # 'NO' so the 'toolchain' dependency is not added to prevent a circular -# dependency +# dependency. +# Similarly for the skeleton. $(2)_ADD_TOOLCHAIN_DEPENDENCY ?= YES +$(2)_ADD_SKELETON_DEPENDENCY ?= YES + ifeq ($(4),target) -ifneq ($(1),skeleton) +ifeq ($$($(2)_ADD_SKELETON_DEPENDENCY),YES) $(2)_DEPENDENCIES += skeleton endif ifeq ($$($(2)_ADD_TOOLCHAIN_DEPENDENCY),YES)
package/skeleton/skeleton.mk +1 -0
@@ -9,6 +9,7 @@ # Hence, skeleton would depends on the toolchain and the toolchain would depend # on skeleton. SKELETON_ADD_TOOLCHAIN_DEPENDENCY = NO +SKELETON_ADD_SKELETON_DEPENDENCY = NO # The skeleton also handles the merged /usr case in the sysroot SKELETON_INSTALL_STAGING = YES
Signature · 1 line
2.11.0
PATCH 2/20 core/pkg-generic: add variable to skip skeleton dependency
Quoted 16 lines · Yann E. MORIN
We currently skip the skeleton dependency by checking if the current package is the skeleton.
We are going to introduce more skeleton-related packages, so we need a way to exclude the skeleton dependency for those, or we'd get a circular dependency, for the same reason we need to skip the toolchain dependency.
Instead of checking for all the skeleton-providing packages in the core infra, add a new package options so that packages can express they do not need the dependency on the skeleton, like we have an option to avoid the depednency on the toolchain. The only packages that will use that option are probably the skeletons, so we need not document this variable, like we did not document the option to exclude the dependency on the toolchain.
Quoted 2 lines
Signed-off-by "Yann E. MORIN" <[email protected]>Reviewed-by Romain Naour <[email protected]>
I absolutely hate adding additional variables that are used for only a few
packages, but I have no better ideas, so
Regards,
Arnout
[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 2/20 core/pkg-generic: add variable to skip skeleton dependency
Quoted 10 lines
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Arnout" == Arnout Vandecappelle <[email protected]> writes:
Instead of checking for all the skeleton-providing packages in the core infra, add a new package options so that packages can express they do not need the dependency on the skeleton, like we have an option to avoid the depednency on the toolchain. The only packages that will use that option are probably the skeletons, so we need not document this variable, like we did not document the option to exclude the dependency on the toolchain.
Quoted 5 lines
Quoted 2 lines
Signed-off-by "Yann E. MORIN" <[email protected]>Reviewed-by Romain Naour <[email protected]>I absolutely hate adding additional variables that are used for only a few
packages, but I have no better ideas, so
An alternative could be to enforce a naming convention for these packages, E.G. skeleton-*, and then use $(filter skeleton%,$(1)) in the check, but I'm not sure that really is much nicer.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 2/20 core/pkg-generic: add variable to skip skeleton dependency
Peter, All,
On 2017-07-23 11:12 +0200, Peter Korsgaard spake thusly:
Quoted 13 lines
Quoted 12 lines
Quoted 12 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Arnout" == Arnout Vandecappelle <[email protected]> writes:
Instead of checking for all the skeleton-providing packages in the core infra, add a new package options so that packages can express they do not need the dependency on the skeleton, like we have an option to avoid the depednency on the toolchain. The only packages that will use that option are probably the skeletons, so we need not document this variable, like we did not document the option to exclude the dependency on the toolchain.
Signed-off-by "Yann E. MORIN" <[email protected]>Reviewed-by Romain Naour <[email protected]>
Quoted 6 lines
Quoted 2 lines
I absolutely hate adding additional variables that are used for only a few
packages, but I have no better ideas, soAn alternative could be to enforce a naming convention for these packages, E.G. skeleton-*, and then use $(filter skeleton%,$(1)) in the check, but I'm not sure that really is much nicer.
We also talked about that possibility on IRC, and came to the conclusion that it was not nice to hard-code magic values in the infra.
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 2/20 core/pkg-generic: add variable to skip skeleton dependency
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Hi,
Quoted 6 lines
Quoted 3 lines
An alternative could be to enforce a naming convention for these packages, E.G. skeleton-*, and then use $(filter skeleton%,$(1)) in the check, but I'm not sure that really is much nicer.
We also talked about that possibility on IRC, and came to the conclusion that it was not nice to hard-code magic values in the infra.
Ok, We aldready did have skeleton hardcoded - But ok, the variable solution is also fine by me.
Signature · 1 line
Bye, Peter Korsgaard
Thomas Petazzoni
AppliedPATCH 2/20 core/pkg-generic: add variable to skip skeleton dependency
In reply to Yann E. MORINHello,
Quoted 16 lines · Yann E. MORIN
We currently skip the skeleton dependency by checking if the current package is the skeleton.
We are going to introduce more skeleton-related packages, so we need a way to exclude the skeleton dependency for those, or we'd get a circular dependency, for the same reason we need to skip the toolchain dependency.
Instead of checking for all the skeleton-providing packages in the core infra, add a new package options so that packages can express they do not need the dependency on the skeleton, like we have an option to avoid the depednency on the toolchain. The only packages that will use that option are probably the skeletons, so we need not document this variable, like we did not document the option to exclude the dependency on the toolchain.
Quoted 6 lines
Signed-off-by "Yann E. MORIN" <[email protected]>Reviewed-by Romain Naour <[email protected]>--- package/pkg-generic.mk | 7 +++++-- package/skeleton/skeleton.mk | 1 + 2 files changed, 6 insertions(+), 2 deletions(-)
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 3/20 package/skeleton: add macro to rsync skeleton directory
In reply to Yann E. MORINThe rsync command is currently called from a single location. In follow-up patches, it will be called from various places then.
It will be easier to update and fix this command if it is defined in a single location, rather than if duplicated in many places.
Define a macro that skeleton packages can call to install their skeleton directories. Since at least one occurence of it will want to install in staging, the macro must accept a destination path, rather than hard-code target as the destination.
Since it is to be used by other skeleton packages, define it early, outside of any conditional block.
--- package/skeleton/skeleton.mk | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
package/skeleton/skeleton.mk +13 -3
@@ -14,6 +14,18 @@ SKELETON_ADD_SKELETON_DEPENDENCY = NO # The skeleton also handles the merged /usr case in the sysroot SKELETON_INSTALL_STAGING = YES +############ +# Macros available for use by any skeleton package: +# - SKELETON_RSYNC + +# This function rsyncs the skeleton directory in $(1) to the destination +# in $(2), which should be either $(TARTGET_DIR) or $(STAGING_DIR) +define SKELETON_RSYNC + rsync -a --ignore-times $(RSYNC_VCS_EXCLUSIONS) \ + --chmod=u=rwX,go=rX --exclude .empty --exclude '*~' \ + $(1)/ $(2)/ +endef + ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y) SKELETON_PATH = $(call qstrip,$(BR2_ROOTFS_SKELETON_CUSTOM_PATH))
@@ -89,9 +101,7 @@ SKELETON_LIB_SYMLINK = lib32 endif define SKELETON_INSTALL_TARGET_CMDS - rsync -a --ignore-times $(RSYNC_VCS_EXCLUSIONS) \ - --chmod=u=rwX,go=rX --exclude .empty --exclude '*~' \ - $(SKELETON_PATH)/ $(TARGET_DIR)/ + $(call SKELETON_RSYNC,$(SKELETON_PATH),$(TARGET_DIR)) $(call SKELETON_USR_SYMLINKS_OR_DIRS,$(TARGET_DIR)) ln -snf lib $(TARGET_DIR)/$(SKELETON_LIB_SYMLINK) ln -snf lib $(TARGET_DIR)/usr/$(SKELETON_LIB_SYMLINK)
Signature · 1 line
2.11.0
PATCH 3/20 package/skeleton: add macro to rsync skeleton directory
Quoted 29 lines · Yann E. MORIN
The rsync command is currently called from a single location. In follow-up patches, it will be called from various places then.
It will be easier to update and fix this command if it is defined in a single location, rather than if duplicated in many places.
Define a macro that skeleton packages can call to install their skeleton directories. Since at least one occurence of it will want to install in staging, the macro must accept a destination path, rather than hard-code target as the destination.
Since it is to be used by other skeleton packages, define it early, outside of any conditional block.
Signed-off-by "Yann E. MORIN" <[email protected]>Reviewed-by Romain Naour <[email protected]>--- package/skeleton/skeleton.mk | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)package/skeleton/skeleton.mk +1
-0@@ -14,6 +14,18 @@ SKELETON_ADD_SKELETON_DEPENDENCY = NO # The skeleton also handles the merged /usr case in the sysroot SKELETON_INSTALL_STAGING = YES +############
package/skeleton/skeleton.mk SKELETON_ADD_SKELETON_DEPENDENCY = NO · line 27
Quoted 10 lines
package/skeleton/skeleton.mk +10
-0+# Macros available for use by any skeleton package: +# - SKELETON_RSYNC + +# This function rsyncs the skeleton directory in $(1) to the destination +# in $(2), which should be either $(TARTGET_DIR) or $(STAGING_DIR) +define SKELETON_RSYNC + rsync -a --ignore-times $(RSYNC_VCS_EXCLUSIONS) \ + --chmod=u=rwX,go=rX --exclude .empty --exclude '*~' \ + $(1)/ $(2)/ +endef
Another thing I hate is make functions - they're difficult to understand. So
instead, I'd just define
SKELETON_RSYNC_ARGS = -a --ignore-times ...
Adding the / after $(1) and $(2) is the only reason to claim this should be a
macro, but really I don't think that that's enough.
The above is bikeshedding though, so feel free to commit the current solution.
Regards,
Arnout
Quoted 16 lines
package/skeleton/skeleton.mk +2
-3+ ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y) SKELETON_PATH = $(call qstrip,$(BR2_ROOTFS_SKELETON_CUSTOM_PATH))@@ -89,9 +101,7 @@ SKELETON_LIB_SYMLINK = lib32 endif define SKELETON_INSTALL_TARGET_CMDS - rsync -a --ignore-times $(RSYNC_VCS_EXCLUSIONS) \ - --chmod=u=rwX,go=rX --exclude .empty --exclude '*~' \ - $(SKELETON_PATH)/ $(TARGET_DIR)/ + $(call SKELETON_RSYNC,$(SKELETON_PATH),$(TARGET_DIR)) $(call SKELETON_USR_SYMLINKS_OR_DIRS,$(TARGET_DIR)) ln -snf lib $(TARGET_DIR)/$(SKELETON_LIB_SYMLINK) ln -snf lib $(TARGET_DIR)/usr/$(SKELETON_LIB_SYMLINK)
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 3/20 package/skeleton: add macro to rsync skeleton directory
In reply to Yann E. MORINQuoted 2 lines · Yann E. MORIN
Define a macro that skeleton packages can call to install their skeleton directories. Since at least one occurence of it will want to install in
occurrence
Quoted 2 lines
staging, the macro must accept a destination path, rather than hard-code target as the destination.
By the way, the overlay copying uses almost the same rsync arguments, so they
can be used there as well.
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 3/20 package/skeleton: add macro to rsync skeleton directory
Arnout, All,
On 2017-07-22 15:02 +0200, Arnout Vandecappelle spake thusly:
Quoted 9 lines · Yann E. MORIN
Quoted 2 lines
Define a macro that skeleton packages can call to install their skeleton directories. Since at least one occurence of it will want to install in
occurrence
Quoted 2 lines
staging, the macro must accept a destination path, rather than hard-code target as the destination.
By the way, the overlay copying uses almost the same rsync arguments, so they
can be used there as well.
This series was only about the skeleton thingy, so I refrained from doing cleanup works elsewhere. Or you'd have had a series with far more than 20 patches. ;-)
But yeah, I see your point, and that can be added in the future.
Thanks!
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 3/20 package/skeleton: add macro to rsync skeleton directory
In reply to Yann E. MORINHello,
Quoted 11 lines · Yann E. MORIN
The rsync command is currently called from a single location. In follow-up patches, it will be called from various places then.
It will be easier to update and fix this command if it is defined in a single location, rather than if duplicated in many places.
Define a macro that skeleton packages can call to install their skeleton directories. Since at least one occurence of it will want to install in staging, the macro must accept a destination path, rather than hard-code target as the destination.
Quoted 8 lines
Since it is to be used by other skeleton packages, define it early, outside of any conditional block.
Signed-off-by "Yann E. MORIN" <[email protected]>Reviewed-by Romain Naour <[email protected]>--- package/skeleton/skeleton.mk | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
I know Arnout was not entirely happy about this solution, but Arnout comments can be addressed later on, they were not really crucial, and I want to move forward with applying the rest of the series. Therefore:
patch applied, after fixing the typo pointed by Arnout in the commit log.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 4/20 package/skeleton: make SKELETON_LIB_SYMLINK a macro
In reply to Yann E. MORINRather than duplicate that code in all skeleton packages, make this a macro, so that it is easier to use.
--- package/skeleton/skeleton.mk | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
package/skeleton/skeleton.mk +18 -12
@@ -17,6 +17,7 @@ SKELETON_INSTALL_STAGING = YES ############ # Macros available for use by any skeleton package: # - SKELETON_RSYNC +# - SKELETON_LIB_SYMLINK # This function rsyncs the skeleton directory in $(1) to the destination # in $(2), which should be either $(TARTGET_DIR) or $(STAGING_DIR)
@@ -26,6 +27,21 @@ define SKELETON_RSYNC $(1)/ $(2)/ endef +# Make a symlink lib32->lib or lib64->lib as appropriate. +# MIPS64/n32 requires lib32 even though it's a 64-bit arch. +# $(1): base dir (either staging or target) +ifeq ($(BR2_ARCH_IS_64)$(BR2_MIPS_NABI32),y) +define SKELETON_LIB_SYMLINK + ln -snf lib $(1)/lib64 + ln -snf lib $(1)/usr/lib64 +endef +else +define SKELETON_LIB_SYMLINK + ln -snf lib $(1)/lib32 + ln -snf lib $(1)/usr/lib32 +endef +endif + ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y) SKELETON_PATH = $(call qstrip,$(BR2_ROOTFS_SKELETON_CUSTOM_PATH))
@@ -92,19 +108,10 @@ define SKELETON_USR_SYMLINKS_OR_DIRS endef endif -# We make a symlink lib32->lib or lib64->lib as appropriate -# MIPS64/n32 requires lib32 even though it's a 64-bit arch. -ifeq ($(BR2_ARCH_IS_64)$(BR2_MIPS_NABI32),y) -SKELETON_LIB_SYMLINK = lib64 -else -SKELETON_LIB_SYMLINK = lib32 -endif - define SKELETON_INSTALL_TARGET_CMDS $(call SKELETON_RSYNC,$(SKELETON_PATH),$(TARGET_DIR)) $(call SKELETON_USR_SYMLINKS_OR_DIRS,$(TARGET_DIR)) - ln -snf lib $(TARGET_DIR)/$(SKELETON_LIB_SYMLINK) - ln -snf lib $(TARGET_DIR)/usr/$(SKELETON_LIB_SYMLINK) + $(call SKELETON_LIB_SYMLINK,$(TARGET_DIR)) $(INSTALL) -m 0644 support/misc/target-dir-warning.txt \ $(TARGET_DIR_WARNING_FILE) endef
@@ -120,8 +127,7 @@ define SKELETON_INSTALL_STAGING_CMDS $(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/sbin $(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include $(call SKELETON_USR_SYMLINKS_OR_DIRS,$(STAGING_DIR)) - ln -snf lib $(STAGING_DIR)/$(SKELETON_LIB_SYMLINK) - ln -snf lib $(STAGING_DIR)/usr/$(SKELETON_LIB_SYMLINK) + $(call SKELETON_LIB_SYMLINK,$(STAGING_DIR)) endef # The TARGET_FINALIZE_HOOKS must be sourced only if the users choose to use the
Signature · 1 line
2.11.0
PATCH 4/20 package/skeleton: make SKELETON_LIB_SYMLINK a macro
Quoted 4 lines · Yann E. MORIN
Rather than duplicate that code in all skeleton packages, make this a macro, so that it is easier to use.
Signed-off-by "Yann E. MORIN" <[email protected]>
However...
Quoted 17 lines
--- package/skeleton/skeleton.mk | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)package/skeleton/skeleton.mk +1
-0@@ -17,6 +17,7 @@ SKELETON_INSTALL_STAGING = YES ############ # Macros available for use by any skeleton package: # - SKELETON_RSYNC +# - SKELETON_LIB_SYMLINK # This function rsyncs the skeleton directory in $(1) to the destination # in $(2), which should be either $(TARTGET_DIR) or $(STAGING_DIR)
package/skeleton/skeleton.mk define SKELETON_RSYNC · line 33
Quoted 7 lines
package/skeleton/skeleton.mk +4
-0@@ -26,6 +27,21 @@ define SKELETON_RSYNC $(1)/ $(2)/ endef +# Make a symlink lib32->lib or lib64->lib as appropriate. +# MIPS64/n32 requires lib32 even though it's a 64-bit arch. +# $(1): base dir (either staging or target) +ifeq ($(BR2_ARCH_IS_64)$(BR2_MIPS_NABI32),y)
This makes me wonder: are we doing the right thing with NABI32? What is the
semantics of BR2_ARCH_IS_64? I would say, it doesn't specify that you have a 32-bit or 64-bit capable CPU; instead, it says that you have a 32-bit or 64-bit userspace. I.e., that void* and long are 32 resp. 64 bits. Indeed, I don't think it's really relevant for Buildroot to know about the CPU capabilities, the important thing is the userpace ABI, i.e. how we compile packages.
So, with that in mind, I think we should NOT select BR2_ARCH_IS_64 for the n32
ABI. Similarly, when we add x32, it should also not be BR2_ARCH_IS_64.
It's a kind of big change though, that also affects how the architectures are
selected, and possibly with legacy implications...
Vicente, what do you think?
Regards,
Arnout
PS when replying to this, better change the subject :-)
Quoted 10 lines
package/skeleton/skeleton.mk +10
-0+define SKELETON_LIB_SYMLINK + ln -snf lib $(1)/lib64 + ln -snf lib $(1)/usr/lib64 +endef +else +define SKELETON_LIB_SYMLINK + ln -snf lib $(1)/lib32 + ln -snf lib $(1)/usr/lib32 +endef +endif
[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 4/20 package/skeleton: make SKELETON_LIB_SYMLINK a macro
Hello,
Quoted 12 lines · Arnout Vandecappelle
package/skeleton/skeleton.mk define SKELETON_RSYNC · line 33
Quoted 4 lines
package/skeleton/skeleton.mk +4
-0+# Make a symlink lib32->lib or lib64->lib as appropriate. +# MIPS64/n32 requires lib32 even though it's a 64-bit arch. +# $(1): base dir (either staging or target) +ifeq ($(BR2_ARCH_IS_64)$(BR2_MIPS_NABI32),y)This makes me wonder: are we doing the right thing with NABI32? What is the
semantics ofBR2_ARCH_IS_64? I would say, it doesn't specify that you have a 32-bit or 64-bit capable CPU; instead, it says that you have a 32-bit or 64-bit userspace. I.e., that void* and long are 32 resp. 64 bits. Indeed, I don't think it's really relevant for Buildroot to know about the CPU capabilities, the important thing is the userpace ABI, i.e. how we compile packages.
Quoted 2 lines
So, with that in mind, I think we should NOT select
BR2_ARCH_IS_64for the n32
ABI. Similarly, when we add x32, it should also not beBR2_ARCH_IS_64.
I see your reasoning, but I believe it might be confusing to have BR2_ARCH_IS_64 be false on a 64 bit architecture. However, we could introduce something like BR2_UABI_IS_64, to define whether the userspace ABI is 32 or 64 bits.
But doing that involves reviewing all the places where BR2_ARCH_IS_64 is used, and check if we're using it to say "the architecture is 64 bits" or "the userspace ABI is 32 bits".
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
[Buildroot] Is MIPS_NABI32 a 64-bit architecture? [was: [PATCH 04/20] package/skeleton: make SKELETON_LIB_SYMLINK a macro]
Quoted 19 lines · Thomas Petazzoni
Hello,
Quoted 12 lines · Arnout Vandecappelle
package/skeleton/skeleton.mk define SKELETON_RSYNC · line 33
Quoted 4 lines
package/skeleton/skeleton.mk +4
-0+# Make a symlink lib32->lib or lib64->lib as appropriate. +# MIPS64/n32 requires lib32 even though it's a 64-bit arch. +# $(1): base dir (either staging or target) +ifeq ($(BR2_ARCH_IS_64)$(BR2_MIPS_NABI32),y)This makes me wonder: are we doing the right thing with NABI32? What is the
semantics ofBR2_ARCH_IS_64? I would say, it doesn't specify that you have a 32-bit or 64-bit capable CPU; instead, it says that you have a 32-bit or 64-bit userspace. I.e., that void* and long are 32 resp. 64 bits. Indeed, I don't think it's really relevant for Buildroot to know about the CPU capabilities, the important thing is the userpace ABI, i.e. how we compile packages.Quoted 2 lines
So, with that in mind, I think we should NOT select
BR2_ARCH_IS_64for the n32
ABI. Similarly, when we add x32, it should also not beBR2_ARCH_IS_64.
Quoted 8 lines
I see your reasoning, but I believe it might be confusing to have
BR2_ARCH_IS_64be false on a 64 bit architecture. However, we could introduce something likeBR2_UABI_IS_64, to define whether the userspace ABI is 32 or 64 bits.But doing that involves reviewing all the places where
BR2_ARCH_IS_64is used, and check if we're using it to say "the architecture is 64 bits" or "the userspace ABI is 32 bits".
Well, first of all, there is currently only one arch in this situation, and
that's MIPS64/n32. We don't support x32 or ilp32 yet, and I don't think there's something similar for PPC.
Outside of arch/, BR2_ARCH_IS_64 is used in 15 places. 2 of them are
x86_64-specific (grub2, syslinux). 3 already treat MIPS_N32 specially. 6 look like they should also treat MIPS_N32 specially, but since that ABI doesn't get tested in the autobuilders (right?) we haven't noticed.
There is one case that is interesting: BR2_TOOLCHAIN_HAS_SYNC_8 defaults y ifBR2_ARCH_IS_64. I guess that that is indeed true for n32, x32 and ilp32. If so, it indeed makes sense to split off BR2_ARCH_IS_64 and BR2_UABI_IS_64. But I think that that will be the only place where BR2_ARCH_IS_64 will be used.
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 4/20 package/skeleton: make SKELETON_LIB_SYMLINK a macro
In reply to Yann E. MORINHello,
Quoted 2 lines · Yann E. MORIN
Rather than duplicate that code in all skeleton packages, make this a macro, so that it is easier to use.
Is it really going to be used in *all* skeleton packages ? Because if it is, it means it's the exact same call that will be duplicated everywhere, which would mean it should be factored out.
But in practice, it seems it's not used in all skeleton packages, but just in skeleton-common.mk and skeleton-custom.mk, correct ?
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 4/20 package/skeleton: make SKELETON_LIB_SYMLINK a macro
Thomas, All,
On 2017-07-22 15:50 +0200, Thomas Petazzoni spake thusly:
Quoted 10 lines · Yann E. MORIN
Quoted 2 lines
Rather than duplicate that code in all skeleton packages, make this a macro, so that it is easier to use.
Is it really going to be used in *all* skeleton packages ? Because if it is, it means it's the exact same call that will be duplicated everywhere, which would mean it should be factored out.
But in practice, it seems it's not used in all skeleton packages, but just in skeleton-common.mk and skeleton-custom.mk, correct ?
Right.
Cordialement,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
Thomas Petazzoni
AppliedPATCH 4/20 package/skeleton: make SKELETON_LIB_SYMLINK a macro
In reply to Yann E. MORINHello,
Quoted 7 lines · Yann E. MORIN
Rather than duplicate that code in all skeleton packages, make this a macro, so that it is easier to use.
Signed-off-by "Yann E. MORIN" <[email protected]>--- package/skeleton/skeleton.mk | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 5/20 system: provide package-wide system variables and macros
In reply to Yann E. MORINSome macros, soon some variables, currently defined in the skeleton are going to be used by other packages.
Some of those variables will be used as Makefile conditions (e.g. in ifeq() conditiopns), so they *must* be defined before being used.
Since the skeleton package, starting with an 's', is included quite late, those variables would not be available to most packages.
Offload the existing macros into the new system/system/mk file, that is included early, before any package is. Rename the macros to appropriate names.
Future commits will add new macros and variables in that file.
--- Makefile | 1 + package/skeleton/skeleton.mk | 53 ++++--------------------------------- system/system.mk | 62 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 48 deletions(-) create mode 100644 system/system.mk
Makefile +1 -0
@@ -479,6 +479,7 @@ all: world # may rely on it. include Makefile.legacy +include system/system.mk include package/Makefile.in # arch/arch.mk.* must be after package/Makefile.in because it may need to # complement variables defined therein, like BR_NO_CHECK_HASH_FOR.
package/skeleton/skeleton.mk +5 -48
72 lines not on this page · raw message
system/system.mk new file +62 -0
62 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH 5/20 system: provide package-wide system variables and macros
Quoted 10 lines · Yann E. MORIN
Some macros, soon some variables, currently defined in the skeleton are going to be used by other packages.
Some of those variables will be used as
Makefileconditions (e.g. inifeq()conditiopns), so they *must* be defined before being used.Since the skeleton package, starting with an 's', is included quite late, those variables would not be available to most packages.
Offload the existing macros into the new system/system/mk file, that is
^.
Quoted 6 lines
included early, before any package is. Rename the macros to appropriate names.
Future commits will add new macros and variables in that file.
Signed-off-by "Yann E. MORIN" <[email protected]>
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 6/20 system: move setting getty to the corresponding init systems
In reply to Yann E. MORINCurrently, setting the getty is done:
- by the skeleton package when the init system is either busybox or
sysvinit;
- by the systemd package when the init system is systemd;
both by registering a target-finalize hook.
This is not very consistent.
Move setting the getty out of the skeleton and into the package that provides the init system, by registering a per-package target-fialize hook.
This offloads yet a bit more out of the skeleton, so that it is easier to properly separate the skeletons for the various init systems.
--- package/busybox/busybox.mk | 12 +++++++++++- package/skeleton/skeleton.mk | 22 ---------------------- package/sysvinit/sysvinit.mk | 8 ++++++++ system/system.mk | 11 +++++++++++ 4 files changed, 30 insertions(+), 23 deletions(-)
package/busybox/busybox.mk +11 -1
@@ -181,10 +181,20 @@ define BUSYBOX_INSTALL_UDHCPC_SCRIPT endef ifeq ($(BR2_INIT_BUSYBOX),y) + define BUSYBOX_SET_INIT $(call KCONFIG_ENABLE_OPT,CONFIG_INIT,$(BUSYBOX_BUILD_CONFIG)) endef -endif + +ifeq ($(BR2_TARGET_GENERIC_GETTY),y) +define BUSYBOX_SET_GETTY + $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(SYSTEM_GETTY_PORT)::respawn:/sbin/getty -L $(SYSTEM_GETTY_OPTIONS) $(SYSTEM_GETTY_PORT) $(SYSTEM_GETTY_BAUDRATE) $(SYSTEM_GETTY_TERM) #~' \ + $(TARGET_DIR)/etc/inittab +endef +BUSYBOX_TARGET_FINALIZE_HOOKS += BUSYBOX_SET_GETTY +endif # BR2_TARGET_GENERIC_GETTY + +endif # BR2_INIT_BUSYBOX ifeq ($(BR2_PACKAGE_BUSYBOX_SELINUX),y) BUSYBOX_DEPENDENCIES += host-pkgconf libselinux libsepol
package/skeleton/skeleton.mk +0 -22
@@ -96,10 +96,6 @@ SKELETON_TARGET_GENERIC_ISSUE = $(call qstrip,$(BR2_TARGET_GENERIC_ISSUE)) SKELETON_TARGET_GENERIC_ROOT_PASSWD = $(call qstrip,$(BR2_TARGET_GENERIC_ROOT_PASSWD)) SKELETON_TARGET_GENERIC_PASSWD_METHOD = $(call qstrip,$(BR2_TARGET_GENERIC_PASSWD_METHOD)) SKELETON_TARGET_GENERIC_BIN_SH = $(call qstrip,$(BR2_SYSTEM_BIN_SH)) -SKELETON_TARGET_GENERIC_GETTY_PORT = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)) -SKELETON_TARGET_GENERIC_GETTY_BAUDRATE = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE)) -SKELETON_TARGET_GENERIC_GETTY_TERM = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_TERM)) -SKELETON_TARGET_GENERIC_GETTY_OPTIONS = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_OPTIONS)) ifneq ($(SKELETON_TARGET_GENERIC_HOSTNAME),) define SKELETON_SET_HOSTNAME
@@ -152,24 +148,6 @@ endif endif TARGET_FINALIZE_HOOKS += SKELETON_BIN_SH -ifeq ($(BR2_TARGET_GENERIC_GETTY),y) -ifeq ($(BR2_INIT_SYSV),y) -# In sysvinit inittab, the "id" must not be longer than 4 bytes, so we -# skip the "tty" part and keep only the remaining. -define SKELETON_SET_GETTY - $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(shell echo $(SKELETON_TARGET_GENERIC_GETTY_PORT) | tail -c+4)::respawn:/sbin/getty -L $(SKELETON_TARGET_GENERIC_GETTY_OPTIONS) $(SKELETON_TARGET_GENERIC_GETTY_PORT) $(SKELETON_TARGET_GENERIC_GETTY_BAUDRATE) $(SKELETON_TARGET_GENERIC_GETTY_TERM) #~' \ - $(TARGET_DIR)/etc/inittab -endef -else ifeq ($(BR2_INIT_BUSYBOX),y) -# Add getty to busybox inittab -define SKELETON_SET_GETTY - $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(SKELETON_TARGET_GENERIC_GETTY_PORT)::respawn:/sbin/getty -L $(SKELETON_TARGET_GENERIC_GETTY_OPTIONS) $(SKELETON_TARGET_GENERIC_GETTY_PORT) $(SKELETON_TARGET_GENERIC_GETTY_BAUDRATE) $(SKELETON_TARGET_GENERIC_GETTY_TERM) #~' \ - $(TARGET_DIR)/etc/inittab -endef -endif -TARGET_FINALIZE_HOOKS += SKELETON_SET_GETTY -endif - ifeq ($(BR2_INIT_BUSYBOX)$(BR2_INIT_SYSV),y) ifeq ($(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW),y) # Find commented line, if any, and remove leading '#'s
package/sysvinit/sysvinit.mk +8 -0
@@ -47,4 +47,12 @@ define SYSVINIT_INSTALL_TARGET_CMDS ln -sf killall5 $(TARGET_DIR)/sbin/pidof endef +ifeq ($(BR2_TARGET_GENERIC_GETTY),y) +define SYSVINIT_SET_GETTY + $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(shell echo $(SYSTEM_GETTY_PORT) | tail -c+4)::respawn:/sbin/getty -L $(SYSTEM_GETTY_OPTIONS) $(SYSTEM_GETTY_PORT) $(SYSTEM_GETTY_BAUDRATE) $(SYSTEM_GETTY_TERM) #~' \ + $(TARGET_DIR)/etc/inittab +endef +SYSVINIT_TARGET_FINALIZE_HOOKS += SYSVINIT_SET_GETTY +endif # BR2_TARGET_GENERIC_GETTY + $(eval $(generic-package))
system/system.mk +11 -0
@@ -22,6 +22,12 @@ # - SYSTEM_LIB_SYMLINK # create the appropriate /lib{32,64} symlinks # +# - SYSTEM_GETTY_PORT +# - SYSTEM_GETTY_BAUDRATE +# - SYSTEM_GETTY_TERM +# - SYSTEM_GETTY_OPTIONS +# the un-quoted getty setting +# # This function handles the merged or non-merged /usr cases ifeq ($(BR2_ROOTFS_MERGED_USR),y)
@@ -60,3 +66,8 @@ define SYSTEM_LIB_SYMLINK ln -snf lib $(1)/usr/lib32 endef endif + +SYSTEM_GETTY_PORT = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)) +SYSTEM_GETTY_BAUDRATE = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE)) +SYSTEM_GETTY_TERM = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_TERM)) +SYSTEM_GETTY_OPTIONS = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_OPTIONS))
Signature · 1 line
2.11.0
PATCH 6/20 system: move setting getty to the corresponding init systems
Quoted 10 lines · Yann E. MORIN
Currently, setting the getty is done:
- by the skeleton package when the init system is either busybox orsysvinit;- by the systemd package when the init system is systemd;
both by registering a target-finalize hook.This is not very consistent.
Move setting the getty out of the skeleton and into the package that provides the init system, by registering a per-package target-fialize
finalize
Quoted 6 lines
hook.
This offloads yet a bit more out of the skeleton, so that it is easier to properly separate the skeletons for the various init systems.
Signed-off-by "Yann E. MORIN" <[email protected]>
[snip]
Quoted 4 lines
package/busybox/busybox.mk +4
-0+define BUSYBOX_SET_GETTY + $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(SYSTEM_GETTY_PORT)::respawn:/sbin/getty -L $(SYSTEM_GETTY_OPTIONS) $(SYSTEM_GETTY_PORT) $(SYSTEM_GETTY_BAUDRATE) $(SYSTEM_GETTY_TERM) #~' \ + $(TARGET_DIR)/etc/inittab +endef
[snip]
package/sysvinit/sysvinit.mk define SYSVINIT_INSTALL_TARGET_CMDS · line 54
Quoted 4 lines
package/sysvinit/sysvinit.mk +4
-0+define SYSVINIT_SET_GETTY + $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(shell echo $(SYSTEM_GETTY_PORT) | tail -c+4)::respawn:/sbin/getty -L $(SYSTEM_GETTY_OPTIONS) $(SYSTEM_GETTY_PORT) $(SYSTEM_GETTY_BAUDRATE) $(SYSTEM_GETTY_TERM) #~' \ + $(TARGET_DIR)/etc/inittab +endef
The only difference between these two is that for sysvinit we have to make sure
it's only 4 characters. But it actually doesn't hurt to do the same for busybox as well. So perhaps we can factor the two in a single SYSTEM_SET_GETTY ?
[snip]
system/system.mk define SYSTEM_LIB_SYMLINK · line 73
Quoted 4 lines
system/system.mk +4
-0+SYSTEM_GETTY_PORT = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)) +SYSTEM_GETTY_BAUDRATE = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE)) +SYSTEM_GETTY_TERM = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_TERM)) +SYSTEM_GETTY_OPTIONS = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_OPTIONS))
Perhaps systemd.mk should also start making use of these?
Both of these are of course separate patches.
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 6/20 system: move setting getty to the corresponding init systems
Hello,
Quoted 6 lines · Arnout Vandecappelle
[snip]
Quoted 4 lines
package/busybox/busybox.mk +4
-0+define BUSYBOX_SET_GETTY + $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(SYSTEM_GETTY_PORT)::respawn:/sbin/getty -L $(SYSTEM_GETTY_OPTIONS) $(SYSTEM_GETTY_PORT) $(SYSTEM_GETTY_BAUDRATE) $(SYSTEM_GETTY_TERM) #~' \ + $(TARGET_DIR)/etc/inittab +endef[snip]
Quoted 8 lines
package/sysvinit/sysvinit.mk define SYSVINIT_INSTALL_TARGET_CMDS · line 54
Quoted 4 lines
package/sysvinit/sysvinit.mk +4
-0+define SYSVINIT_SET_GETTY + $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(shell echo $(SYSTEM_GETTY_PORT) | tail -c+4)::respawn:/sbin/getty -L $(SYSTEM_GETTY_OPTIONS) $(SYSTEM_GETTY_PORT) $(SYSTEM_GETTY_BAUDRATE) $(SYSTEM_GETTY_TERM) #~' \ + $(TARGET_DIR)/etc/inittab +endefThe only difference between these two is that for sysvinit we have to make sure
it's only 4 characters. But it actually doesn't hurt to do the same for busybox as well. So perhaps we can factor the two in a singleSYSTEM_SET_GETTY?
I am not sure if that works, because the semantic of the first field is not the same between sysvinit and Busybox init.
For sysvinit (http://www.manpages.info/linux/inittab.5.html)
id is a unique sequence of 1-4 characters which identifies an entry
in inittab (for versions of sysvinit compiled with libraries < 5.2.18 or a.out libraries the limit is 2 characters).
Note: For gettys or other login processes, the id field should
be the tty suffix of the corresponding tty, e.g. 1 for tty1.
Otherwise, the login accounting might not work correctly.
For Busybox init:
# <id>: WARNING: This field has a non-traditional meaning for BusyBox init! #
# The id field is used by BusyBox init to specify the controlling tty for # the specified process to run on. The contents of this field are # appended to "/dev/" and used as-is. There is no need for this field to # be unique, although if it isn't you may have strange results. If this # field is left blank, then the init's stdin/out will be used.
Hence, with Busybox init, if you pass a truncated "id", the command might fail to run as it will try to open a /dev/<something> that doesn't exist. So, if you truncate ttyAMA0, it will be just ttyA, Busybox will try to open /dev/ttyA and it will fail.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 6/20 system: move setting getty to the corresponding init systems
Quoted 3 lines · Thomas Petazzoni
Hello,
On Sat, 22 Jul 2017 15:11:57 +0200, Arnout Vandecappelle wrote:
[snip]
Quoted 6 lines
Quoted 3 lines
The only difference between these two is that for sysvinit we have to make sure
it's only 4 characters. But it actually doesn't hurt to do the same for busybox as well. So perhaps we can factor the two in a singleSYSTEM_SET_GETTY?I am not sure if that works, because the semantic of the first field is not the same between sysvinit and Busybox init.
Right! I thought busybox init just ignored it, I forgot about the controlling
terminal.
Regards,
Arnout
Quoted 30 lines
For sysvinit (http://www.manpages.info/linux/inittab.5.html)
id is a unique sequence of 1-4 characters which identifies an entry
in inittab (for versions of sysvinit compiled with libraries < 5.2.18 or a.out libraries the limit is 2 characters).Note: For gettys or other login processes, the id field should
be the tty suffix of the corresponding tty, e.g. 1 for tty1.
Otherwise, the login accounting might not work correctly.For Busybox init:
# <id>: WARNING: This field has a non-traditional meaning for BusyBox init! #
# The id field is used by BusyBox init to specify the controlling tty for # the specified process to run on. The contents of this field are # appended to "/dev/" and used as-is. There is no need for this field to # be unique, although if it isn't you may have strange results. If this # field is left blank, then the init's stdin/out will be used.Hence, with Busybox init, if you pass a truncated "id", the command might fail to run as it will try to open a /dev/<something> that doesn't exist. So, if you truncate ttyAMA0, it will be just ttyA, Busybox will try to open
/dev/ttyAand it will fail.Best regards,
Thomas
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Thomas Petazzoni
AppliedPATCH 6/20 system: move setting getty to the corresponding init systems
In reply to Yann E. MORINHello,
Quoted 15 lines · Yann E. MORIN
Currently, setting the getty is done:
- by the skeleton package when the init system is either busybox orsysvinit;- by the systemd package when the init system is systemd;
both by registering a target-finalize hook.This is not very consistent.
Move setting the getty out of the skeleton and into the package that provides the init system, by registering a per-package target-fialize hook.
This offloads yet a bit more out of the skeleton, so that it is easier to properly separate the skeletons for the various init systems.
Quoted 7 lines
Signed-off-by "Yann E. MORIN" <[email protected]>--- package/busybox/busybox.mk | 12 +++++++++++- package/skeleton/skeleton.mk | 22 ---------------------- package/sysvinit/sysvinit.mk | 8 ++++++++ system/system.mk | 11 +++++++++++ 4 files changed, 30 insertions(+), 23 deletions(-)
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 7/20 system: move remounting / to the corresponding init systems
In reply to Yann E. MORINCurrently, remounting / read-write (or not) is done by the skeleton package when the init system is eitehr busybox or sysvinit, by registering a target-finalize hook; it is not done at all for systemd.
Move registering this target-finalize hook to both of busybox and sysvinit. Leave systemd alone, we'll take care of it later.
Rename the macro to a more meaningful name, and move it to system.mk with the other such macros.
Yet a little bit less init-system knowledge in the skeleton.
--- package/busybox/busybox.mk | 3 +++ package/skeleton/skeleton.mk | 15 --------------- package/sysvinit/sysvinit.mk | 3 +++ system/system.mk | 15 +++++++++++++++ 4 files changed, 21 insertions(+), 15 deletions(-)
package/busybox/busybox.mk +3 -0
@@ -194,6 +194,9 @@ endef BUSYBOX_TARGET_FINALIZE_HOOKS += BUSYBOX_SET_GETTY endif # BR2_TARGET_GENERIC_GETTY +# Provided by the skeleton package +BUSYBOX_TARGET_FINALIZE_HOOKS += SYSTEM_REMOUNT_ROOT_INITTAB + endif # BR2_INIT_BUSYBOX ifeq ($(BR2_PACKAGE_BUSYBOX_SELINUX),y)
package/skeleton/skeleton.mk +0 -15
@@ -148,21 +148,6 @@ endif endif TARGET_FINALIZE_HOOKS += SKELETON_BIN_SH -ifeq ($(BR2_INIT_BUSYBOX)$(BR2_INIT_SYSV),y) -ifeq ($(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW),y) -# Find commented line, if any, and remove leading '#'s -define SKELETON_REMOUNT_RW - $(SED) '/^#.*-o remount,rw \/$$/s~^#\+~~' $(TARGET_DIR)/etc/inittab -endef -else -# Find uncommented line, if any, and add a leading '#' -define SKELETON_REMOUNT_RW - $(SED) '/^[^#].*-o remount,rw \/$$/s~^~#~' $(TARGET_DIR)/etc/inittab -endef -endif -TARGET_FINALIZE_HOOKS += SKELETON_REMOUNT_RW -endif # BR2_INIT_BUSYBOX || BR2_INIT_SYSV - endif # BR2_ROOTFS_SKELETON_DEFAULT $(eval $(generic-package))
package/sysvinit/sysvinit.mk +3 -0
@@ -55,4 +55,7 @@ endef SYSVINIT_TARGET_FINALIZE_HOOKS += SYSVINIT_SET_GETTY endif # BR2_TARGET_GENERIC_GETTY +# Provided by the skeleton package +SYSVINIT_TARGET_FINALIZE_HOOKS += SYSTEM_REMOUNT_ROOT_INITTAB + $(eval $(generic-package))
system/system.mk +15 -0
@@ -28,6 +28,9 @@ # - SYSTEM_GETTY_OPTIONS # the un-quoted getty setting # +# - SYSTEM_REMOUNT_ROOT_INITTAB +# set inittab to remount root read-write or read-only +# # This function handles the merged or non-merged /usr cases ifeq ($(BR2_ROOTFS_MERGED_USR),y)
@@ -71,3 +74,15 @@ SYSTEM_GETTY_PORT = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)) SYSTEM_GETTY_BAUDRATE = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE)) SYSTEM_GETTY_TERM = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_TERM)) SYSTEM_GETTY_OPTIONS = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_OPTIONS)) + +ifeq ($(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW),y) +# Find commented line, if any, and remove leading '#'s +define SYSTEM_REMOUNT_ROOT_INITTAB + $(SED) '/^#.*-o remount,rw \/$$/s~^#\+~~' $(TARGET_DIR)/etc/inittab +endef +else +# Find uncommented line, if any, and add a leading '#' +define SYSTEM_REMOUNT_ROOT_INITTAB + $(SED) '/^[^#].*-o remount,rw \/$$/s~^~#~' $(TARGET_DIR)/etc/inittab +endef +endif
Signature · 1 line
2.11.0
PATCH 7/20 system: move remounting / to the corresponding init systems
Quoted 2 lines · Yann E. MORIN
Currently, remounting / read-write (or not) is done by the skeleton package when the init system is eitehr busybox or sysvinit, by
either
Quoted 11 lines
registering a target-finalize hook; it is not done at all for systemd.
Move registering this target-finalize hook to both of busybox and sysvinit. Leave systemd alone, we'll take care of it later.
Rename the macro to a more meaningful name, and move it to system.mk with the other such macros.
Yet a little bit less init-system knowledge in the skeleton.
Signed-off-by "Yann E. MORIN" <[email protected]>
Small details to fix...
[snip]
Quoted 1 line
+# Provided by the skeleton package
Not really, it's provided by system.mk - which is kind of obvious from the
name. So I'd just remove this comment.
Quoted 1 line
+BUSYBOX_TARGET_FINALIZE_HOOKS +=
SYSTEM_REMOUNT_ROOT_INITTAB
Excellent choice in variable name!
[snip]
Quoted 1 line
+# Provided by the skeleton package
Same here of course.
Quoted 2 lines
package/sysvinit/sysvinit.mk +2
-0+SYSVINIT_TARGET_FINALIZE_HOOKS += SYSTEM_REMOUNT_ROOT_INITTAB +
[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Thomas Petazzoni
AppliedPATCH 7/20 system: move remounting / to the corresponding init systems
In reply to Yann E. MORINHello,
Quoted 12 lines · Yann E. MORIN
Currently, remounting / read-write (or not) is done by the skeleton package when the init system is eitehr busybox or sysvinit, by registering a target-finalize hook; it is not done at all for systemd.
Move registering this target-finalize hook to both of busybox and sysvinit. Leave systemd alone, we'll take care of it later.
Rename the macro to a more meaningful name, and move it to system.mk with the other such macros.
Yet a little bit less init-system knowledge in the skeleton.
Quoted 7 lines
Signed-off-by "Yann E. MORIN" <[email protected]>--- package/busybox/busybox.mk | 3 +++ package/skeleton/skeleton.mk | 15 --------------- package/sysvinit/sysvinit.mk | 3 +++ system/system.mk | 15 +++++++++++++++ 4 files changed, 21 insertions(+), 15 deletions(-)
Applied to master, after dropping the two comments, as pointed by Arnout.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 8/20 system: with no init system, only allow custom skeleton
In reply to Yann E. MORINWhen there is no init system (i.e. a custom one), our bundled default skeleton is most probably un-fit for that (non-)init system.
This will be the case when we introduce per init system skeletons. The systemd skeleton will be unfit except for a systemd init; the sysv skeleton will be unfit except for a sysv-like init system.
In case they are using no init system (really, a custom one), the user should be responsible for providing their own, custom skeleton as well.
--- system/Config.in | 6 ++++++ 1 file changed, 6 insertions(+)
system/Config.in +6 -0
@@ -3,11 +3,17 @@ menu "System configuration" choice prompt "Root FS skeleton" +# When not using an init system (i.e. a custom one), our default skeleton +# is most probably unfit; so, allow only the custom skeleton in that case. config BR2_ROOTFS_SKELETON_DEFAULT bool "default target skeleton" + depends on !BR2_INIT_NONE help Use default target skeleton +comment "default target skeleton needs an init system" + depends on BR2_INIT_NONE + config BR2_ROOTFS_SKELETON_CUSTOM bool "custom target skeleton" help
Signature · 1 line
2.11.0
PATCH 8/20 system: with no init system, only allow custom skeleton
Quoted 11 lines · Yann E. MORIN
When there is no init system (i.e. a custom one), our bundled default skeleton is most probably un-fit for that (non-)init system.
This will be the case when we introduce per init system skeletons. The systemd skeleton will be unfit except for a systemd init; the sysv skeleton will be unfit except for a sysv-like init system.
In case they are using no init system (really, a custom one), the user should be responsible for providing their own, custom skeleton as well.
Signed-off-by "Yann E. MORIN" <[email protected]>
NACK on this one. Our skeleton (as in, the contents of system/skeleton) is
already init-agnostic. If you use another init system (shell script, or no init at all because you just use it as a chroot, or whatever), you will *still* need that skelecton. Indeed, the skeleton contains things like the /sys and /dev directories, a passwd file, ....
If there are things in that skeleton that you don't need for a custom init
system, then they probably shouldn't even be in the skeleton.
Regards,
Arnout
Quoted 27 lines
--- system/Config.in | 6 ++++++ 1 file changed, 6 insertions(+)system/Config.in +6
-0@@ -3,11 +3,17 @@ menu "System configuration" choice prompt "Root FS skeleton" +# When not using an init system (i.e. a custom one), our default skeleton +# is most probably unfit; so, allow only the custom skeleton in that case. config BR2_ROOTFS_SKELETON_DEFAULT bool "default target skeleton" + depends on !BR2_INIT_NONE help Use default target skeleton +comment "default target skeleton needs an init system" + depends on BR2_INIT_NONE + config BR2_ROOTFS_SKELETON_CUSTOM bool "custom target skeleton" help
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 8/20 system: with no init system, only allow custom skeleton
Ranout, All,
On 2017-07-22 15:28 +0200, Arnout Vandecappelle spake thusly:
Quoted 13 lines · Yann E. MORIN
Quoted 11 lines
When there is no init system (i.e. a custom one), our bundled default skeleton is most probably un-fit for that (non-)init system.
This will be the case when we introduce per init system skeletons. The systemd skeleton will be unfit except for a systemd init; the sysv skeleton will be unfit except for a sysv-like init system.
In case they are using no init system (really, a custom one), the user should be responsible for providing their own, custom skeleton as well.
Signed-off-by "Yann E. MORIN" <[email protected]>
Quoted 8 lines
NACK on this one. Our skeleton (as in, the contents of system/skeleton) is
already init-agnostic. If you use another init system (shell script, or no init at all because you just use it as a chroot, or whatever), you will *still* need that skelecton. Indeed, the skeleton contains things like the /sys and /dev directories, a passwd file, ....If there are things in that skeleton that you don't need for a custom init
system, then they probably shouldn't even be in the skeleton.
This patch is reverted later in the series, once all the types of skeleton are in place. I could not see how to do it sanely and cleanly otherwise.
Regards,
Yann E. MORIN.
Quoted 38 lines
Regards,
ArnoutQuoted 27 lines
--- system/Config.in | 6 ++++++ 1 file changed, 6 insertions(+)system/Config.in +6
-0@@ -3,11 +3,17 @@ menu "System configuration" choice prompt "Root FS skeleton" +# When not using an init system (i.e. a custom one), our default skeleton +# is most probably unfit; so, allow only the custom skeleton in that case. config BR2_ROOTFS_SKELETON_DEFAULT bool "default target skeleton" + depends on !BR2_INIT_NONE help Use default target skeleton +comment "default target skeleton needs an init system" + depends on BR2_INIT_NONE + config BR2_ROOTFS_SKELETON_CUSTOM bool "custom target skeleton" helpSignature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 8/20 system: with no init system, only allow custom skeleton
Quoted 22 lines · Yann E. MORIN
Ranout, All,
On 2017-07-22 15:28 +0200, Arnout Vandecappelle spake thusly:
Quoted 19 lines · Yann E. MORIN
Quoted 11 lines
When there is no init system (i.e. a custom one), our bundled default skeleton is most probably un-fit for that (non-)init system.
This will be the case when we introduce per init system skeletons. The systemd skeleton will be unfit except for a systemd init; the sysv skeleton will be unfit except for a sysv-like init system.
In case they are using no init system (really, a custom one), the user should be responsible for providing their own, custom skeleton as well.
Signed-off-by "Yann E. MORIN" <[email protected]>NACK on this one. Our skeleton (as in, the contents of system/skeleton) is
already init-agnostic. If you use another init system (shell script, or no init at all because you just use it as a chroot, or whatever), you will *still* need that skelecton. Indeed, the skeleton contains things like the /sys and /dev directories, a passwd file, ....
Quoted 6 lines
Quoted 2 lines
If there are things in that skeleton that you don't need for a custom init
system, then they probably shouldn't even be in the skeleton.This patch is reverted later in the series, once all the types of skeleton are in place. I could not see how to do it sanely and cleanly otherwise.
OK, in that case
I trust that you looked for a way to avoid this temporary workaround.
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 8/20 system: with no init system, only allow custom skeleton
Arnout, All,
On 2017-07-22 23:18 +0200, Arnout Vandecappelle spake thusly:
Quoted 26 lines · Yann E. MORIN
Quoted 25 lines
Ranout, All,
On 2017-07-22 15:28 +0200, Arnout Vandecappelle spake thusly:
Quoted 21 lines · Yann E. MORIN
Quoted 11 lines
When there is no init system (i.e. a custom one), our bundled default skeleton is most probably un-fit for that (non-)init system.
This will be the case when we introduce per init system skeletons. The systemd skeleton will be unfit except for a systemd init; the sysv skeleton will be unfit except for a sysv-like init system.
In case they are using no init system (really, a custom one), the user should be responsible for providing their own, custom skeleton as well.
Signed-off-by "Yann E. MORIN" <[email protected]>NACK on this one. Our skeleton (as in, the contents of system/skeleton) is
already init-agnostic. If you use another init system (shell script, or no init at all because you just use it as a chroot, or whatever), you will *still* need that skelecton. Indeed, the skeleton contains things like the /sys and /dev directories, a passwd file, ....If there are things in that skeleton that you don't need for a custom init
system, then they probably shouldn't even be in the skeleton.
Quoted 7 lines
Quoted 3 lines
This patch is reverted later in the series, once all the types of skeleton are in place. I could not see how to do it sanely and cleanly otherwise.
OK, in that case
Thanks.
Quoted 1 line
I trust that you looked for a way to avoid this temporary workaround.
I tried, but I could not see a simple, clean and quick solution...
Regards,
Yann E. MORIN.
Quoted 10 lines
Regards,
ArnoutSignature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 9/20 package/skeleton: drop dependency on host-mkpasswd
In reply to Yann E. MORINSetting the root pasword is done in a target-finalize hook, so we do not need to enforce a dependency from the skeleton onto host-mkpasswd.
Dropping that dependency will simplify making skeleton a virtual package (in up-coming changes).
This however introduces a slight change in behaviour: previously, host-mkpasswd would only be built if we needed to hash the root password from its plain-text value. Now, host-mkpasswd is always built as soon as the root password is non-empty, even if already pre-hashed.
Since host-mkpasswd is a really tiny weeny package bundled in Buidlroot, with only two C files, built as a single unit with a single gcc call, the overhead is really minimal. Compared to the simplifications this will allow in the skeleton packages (plural: common, sysv, systemd, custom) to come, this overhead is acceptable.
Yet another simplification, even if small, to ease providing multiple skeletons.
--- package/skeleton/skeleton.mk | 1 - system/Config.in | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
package/skeleton/skeleton.mk +0 -1
@@ -121,7 +121,6 @@ SKELETON_ROOT_PASSWORD = else ifneq ($(filter $$1$$% $$5$$% $$6$$%,$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)),) SKELETON_ROOT_PASSWORD = '$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)' else -SKELETON_DEPENDENCIES += host-mkpasswd # This variable will only be evaluated in the finalize stage, so we can # be sure that host-mkpasswd will have already been built by that time. SKELETON_ROOT_PASSWORD = "`$(MKPASSWD) -m "$(SKELETON_TARGET_GENERIC_PASSWD_METHOD)" "$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)"`"
system/Config.in +1 -0
@@ -224,6 +224,7 @@ config BR2_ROOTFS_MERGED_USR config BR2_TARGET_ENABLE_ROOT_LOGIN bool "Enable root login with password" default y + select BR2_PACKAGE_HOST_MKPASSWD if BR2_TARGET_GENERIC_ROOT_PASSWD != "" help Allow root to log in with a password.
Signature · 1 line
2.11.0
PATCH 9/20 package/skeleton: drop dependency on host-mkpasswd
This makes no sense to me...
Quoted 5 lines · Yann E. MORIN
Setting the root pasword is done in a target-finalize hook, so we do not need to enforce a dependency from the skeleton onto host-mkpasswd.
Dropping that dependency will simplify making skeleton a virtual package (in up-coming changes).
How so? What's wrong with
SKELETON_COMMON_DEPENDENCIES += host-mkpasswd
in exactly the same place?
You forgot to mention the other interesting bit: it is now selected, so we are
still sure it will get built before target-finalize.
Quoted 7 lines
This however introduces a slight change in behaviour: previously, host-mkpasswd would only be built if we needed to hash the root password from its plain-text value. Now, host-mkpasswd is always built as soon as the root password is non-empty, even if already pre-hashed.
Since host-mkpasswd is a really tiny weeny package bundled in Buidlroot,
Buildroot
Quoted 9 lines
with only two C files, built as a single unit with a single gcc call, the overhead is really minimal. Compared to the simplifications this will allow in the skeleton packages (plural: common, sysv, systemd, custom) to come, this overhead is acceptable.
Yet another simplification, even if small, to ease providing multiple skeletons.
Signed-off-by "Yann E. MORIN" <[email protected]>
Although I don't think it's really *necessary* to remove the dependency, it is
certainly more correct. And we want to select host packages from Config.in anyway on the long run, so doing it only for not-yet-hashed passwords won't be possible anyway. Therefore:
Regards,
Arnout
Quoted 30 lines
--- package/skeleton/skeleton.mk | 1 - system/Config.in | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)package/skeleton/skeleton.mk +0
-1@@ -121,7 +121,6 @@ SKELETON_ROOT_PASSWORD = else ifneq ($(filter $$1$$% $$5$$% $$6$$%,$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)),) SKELETON_ROOT_PASSWORD = '$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)' else -SKELETON_DEPENDENCIES += host-mkpasswd # This variable will only be evaluated in the finalize stage, so we can # be sure that host-mkpasswd will have already been built by that time. SKELETON_ROOT_PASSWORD = "`$(MKPASSWD) -m "$(SKELETON_TARGET_GENERIC_PASSWD_METHOD)" "$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)"`"system/Config.in +1
-0@@ -224,6 +224,7 @@ config BR2_ROOTFS_MERGED_USR config BR2_TARGET_ENABLE_ROOT_LOGIN bool "Enable root login with password" default y + select BR2_PACKAGE_HOST_MKPASSWD if BR2_TARGET_GENERIC_ROOT_PASSWD != "" help Allow root to log in with a password.
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 9/20 package/skeleton: drop dependency on host-mkpasswd
Arnout, All,
On 2017-07-22 23:24 +0200, Arnout Vandecappelle spake thusly:
Quoted 6 lines
This makes no sense to me...
Quoted 3 lines · Yann E. MORIN
Setting the root pasword is done in a target-finalize hook, so we do not need to enforce a dependency from the skeleton onto host-mkpasswd.
Quoted 8 lines
Quoted 2 lines
Dropping that dependency will simplify making skeleton a virtual package (in up-coming changes).
How so? What's wrong with
SKELETON_COMMON_DEPENDENCIES+= host-mkpasswdin exactly the same place?
Indeed, it does not simplify much. But at least, that was a little bit less code I had to carry over to the new skeleton infra, see below [0].
And as you've seen, this series was no picnic...
Quoted 5 lines
You forgot to mention the other interesting bit: it is now selected, so we are
still sure it will get built before target-finalize.
Quoted 7 lines
Quoted 6 lines
This however introduces a slight change in behaviour: previously, host-mkpasswd would only be built if we needed to hash the root password from its plain-text value. Now, host-mkpasswd is always built as soon as the root password is non-empty, even if already pre-hashed.
Since host-mkpasswd is a really tiny weeny package bundled in Buidlroot,
Buildroot
I think I have unconciously associated Buildroot and Beetlejuice in my head, as Buidlroot sounds too much like Beetlejuice, and I do this typo all the time. Not that I never typoes anything else, for that matters... ;-]
Quoted 7 lines
Quoted 7 lines
with only two C files, built as a single unit with a single gcc call, the overhead is really minimal. Compared to the simplifications this will allow in the skeleton packages (plural: common, sysv, systemd, custom) to come, this overhead is acceptable.
Yet another simplification, even if small, to ease providing multiple skeletons.
[0[] here I said it was but a small simplification. ;-)
Quoted 8 lines
Quoted 1 line
Signed-off-by "Yann E. MORIN" <[email protected]>Although I don't think it's really *necessary* to remove the dependency, it is
certainly more correct. And we want to select host packages from Config.in anyway on the long run, so doing it only for not-yet-hashed passwords won't be possible anyway. Therefore:
Thanks! :-)
Regards,
Yann E. MORIN.
Quoted 41 lines
Regards,
ArnoutQuoted 30 lines
--- package/skeleton/skeleton.mk | 1 - system/Config.in | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)package/skeleton/skeleton.mk +0
-1@@ -121,7 +121,6 @@ SKELETON_ROOT_PASSWORD = else ifneq ($(filter $$1$$% $$5$$% $$6$$%,$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)),) SKELETON_ROOT_PASSWORD = '$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)' else -SKELETON_DEPENDENCIES += host-mkpasswd # This variable will only be evaluated in the finalize stage, so we can # be sure that host-mkpasswd will have already been built by that time. SKELETON_ROOT_PASSWORD = "`$(MKPASSWD) -m "$(SKELETON_TARGET_GENERIC_PASSWD_METHOD)" "$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)"`"system/Config.in +1
-0@@ -224,6 +224,7 @@ config BR2_ROOTFS_MERGED_USR config BR2_TARGET_ENABLE_ROOT_LOGIN bool "Enable root login with password" default y + select BR2_PACKAGE_HOST_MKPASSWD if BR2_TARGET_GENERIC_ROOT_PASSWD != "" help Allow root to log in with a password.Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 10/20 package/skeleton: select it rather than default to y
In reply to Yann E. MORINOur current skeleton is tailored to sysv-like init systems; it is not fit for systemd-based systems. So, in upcoming changes, we'll add another skeleton for systemd.
This means we can no longer have the current skeleton default to 'y', or it would be enabled also for systemd, which would be incorrect.
So, we remove the default to 'y' but have it selected by the default skeleton choice.
However, we do not yet have a way to directly build (really, install) the custom skeleton, it is built (really, installed) as a dependency of the default skeleton. So we must also forcibly select the default skeleton when using a custom one.
Until we have the mean to do only one or the other; i.e. when we have a virtual skeleton.
--- package/skeleton/Config.in | 1 - system/Config.in | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-)
package/skeleton/Config.in +0 -1
@@ -1,5 +1,4 @@ config BR2_PACKAGE_SKELETON bool - default y help The basic skeleton for your rootfs.
system/Config.in +2 -0
@@ -8,6 +8,7 @@ choice config BR2_ROOTFS_SKELETON_DEFAULT bool "default target skeleton" depends on !BR2_INIT_NONE + select BR2_PACKAGE_SKELETON help Use default target skeleton
@@ -16,6 +17,7 @@ comment "default target skeleton needs an init system" config BR2_ROOTFS_SKELETON_CUSTOM bool "custom target skeleton" + select BR2_PACKAGE_SKELETON help Use custom target skeleton.
Signature · 1 line
2.11.0
PATCH 10/20 package/skeleton: select it rather than default to y
Quoted 10 lines · Yann E. MORIN
Our current skeleton is tailored to sysv-like init systems; it is not fit for systemd-based systems. So, in upcoming changes, we'll add another skeleton for systemd.
This means we can no longer have the current skeleton default to 'y', or it would be enabled also for systemd, which would be incorrect.
So, we remove the default to 'y' but have it selected by the default skeleton choice.
Quoted 6 lines
However, we do not yet have a way to directly build (really, install) the custom skeleton, it is built (really, installed) as a dependency of the default skeleton. So we must also forcibly select the default skeleton when using a custom one.
Until we have the mean to do only one or the other; i.e. when we have a
means
Quoted 3 lines
virtual skeleton.
Signed-off-by "Yann E. MORIN" <[email protected]>
You're going about it in a pretty complicated way. I think it would have been
simpler to rename skeleton to skeleton-common and introducing the skeleton virtual package in one commit, and then start splitting them up. However, you've done it this way now, and it works, so
Regards,
Arnout
Quoted 36 lines
--- package/skeleton/Config.in | 1 - system/Config.in | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-)package/skeleton/Config.in +0
-1@@ -1,5 +1,4 @@ config BR2_PACKAGE_SKELETON bool - default y help The basic skeleton for your rootfs.system/Config.in +2
-0@@ -8,6 +8,7 @@ choice config BR2_ROOTFS_SKELETON_DEFAULT bool "default target skeleton" depends on !BR2_INIT_NONE + select BR2_PACKAGE_SKELETON help Use default target skeleton@@ -16,6 +17,7 @@ comment "default target skeleton needs an init system" config BR2_ROOTFS_SKELETON_CUSTOM bool "custom target skeleton" + select BR2_PACKAGE_SKELETON help Use custom target skeleton.
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 11/20 package/skeleton: split out into skeleton-custom
In reply to Yann E. MORINFor the custom skeleton, we practicaly do nothing, except ensure it contains the basic, required directories, and that those are properly setup wrt. merged /usr.
Furthermore, our current skeleton is not fit for systemd, and we'll have to split things out into various skeletons.
So, off-load the custom skeleton into its own package.
Thus, the existing skeleton package is now limited to:
- when using our default skeleton, install and tweak it properly;
- when using a custom skeleton, do nothing except for depending on the skeleton-custom package.
---
Note: this calls for making skeleton a virtual package. This will come in follwup patches, after skeleton has lost all its code to the various skeleton packages.
--- package/Config.in | 1 + package/skeleton-custom/Config.in | 3 + package/skeleton-custom/skeleton-custom.mk | 105 +++++++++++++++++++++++++++++ package/skeleton/skeleton.mk | 51 +------------- system/Config.in | 2 +- 5 files changed, 112 insertions(+), 50 deletions(-) create mode 100644 package/skeleton-custom/Config.in create mode 100644 package/skeleton-custom/skeleton-custom.mk
package/Config.in +1 -0
@@ -2,6 +2,7 @@ menu "Target packages" source "package/busybox/Config.in" source "package/skeleton/Config.in" + source "package/skeleton-custom/Config.in" menu "Audio and video applications" source "package/alsa-utils/Config.in"
package/skeleton-custom/Config.in new file +3 -0
@@ -0,0 +1,3 @@ +config BR2_PACKAGE_SKELETON_CUSTOM + bool + select BR2_PACKAGE_SKELETON
package/skeleton-custom/skeleton-custom.mk new file +105 -0
105 lines not on this page · raw message
package/skeleton/skeleton.mk +2 -49
69 lines not on this page · raw message
system/Config.in +1 -1
@@ -17,7 +17,7 @@ comment "default target skeleton needs an init system" config BR2_ROOTFS_SKELETON_CUSTOM bool "custom target skeleton" - select BR2_PACKAGE_SKELETON + select BR2_PACKAGE_SKELETON_CUSTOM help Use custom target skeleton.
Signature · 1 line
2.11.0
PATCH 11/20 package/skeleton: split out into skeleton-custom
Quoted 1 line · Yann E. MORIN
For the custom skeleton, we practicaly do nothing, except ensure it
do practically
Quoted 8 lines
contains the basic, required directories, and that those are properly setup wrt. merged /usr.
Furthermore, our current skeleton is not fit for systemd, and we'll have to split things out into various skeletons.
So, off-load the custom skeleton into its own package.
Quoted 8 lines
Thus, the existing skeleton package is now limited to:
- when using our default skeleton, install and tweak it properly;
- when using a custom skeleton, do nothing except for depending on the skeleton-custom package.
Signed-off-by "Yann E. MORIN" <[email protected]>
Just spelling and comment fixes, so
[snip]
package/skeleton-custom/skeleton-custom.mk line 85
Quoted 3 lines
package/skeleton-custom/skeleton-custom.mk new file +3
-0+# Provided by the 'skeleton' package: +# - SKELETON_RSYNC +# - SKELETON_LIB_SYMLINK
Like I wrote in a different patch: it's SYSTEM_*, not SKELETON_*, and the name
is sufficiently indicative of where it comes from, so the comment can be removed.
Review
Quoted 2 lines
(quoted diff) +2
-0+ +# The target-dir-warning file is the only thing we customise in the
and the lib{32,64} symlinks are the only things
package/skeleton-custom/skeleton-custom.mk line 99
Quoted 12 lines
package/skeleton-custom/skeleton-custom.mk new file +12
-0+# custom skeleton. +define SKELETON_CUSTOM_INSTALL_TARGET_CMDS + $(call SYSTEM_RSYNC,$(SKELETON_CUSTOM_PATH),$(TARGET_DIR)) + $(call SYSTEM_LIB_SYMLINK,$(TARGET_DIR)) + $(INSTALL) -m 0644 support/misc/target-dir-warning.txt \ + $(TARGET_DIR_WARNING_FILE) +endef + +# For the staging dir, we don't really care what we install, but we +# need the /lib and /usr/lib appropriately setup. Since we ensure, +# above, that they are correct in the skeleton, we can simply copy the +# skeleton to staging.
Great explanation!
Regards,
Arnout
Quoted 4 lines
package/skeleton-custom/skeleton-custom.mk new file +4
-0+define SKELETON_CUSTOM_INSTALL_STAGING_CMDS + $(call SYSTEM_RSYNC,$(SKELETON_CUSTOM_PATH),$(STAGING_DIR)) + $(call SYSTEM_LIB_SYMLINK,$(STAGING_DIR)) +endef
[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 11/20 package/skeleton: split out into skeleton-custom
On second thought...
Quoted 3 lines · Arnout Vandecappelle
package/skeleton-custom/skeleton-custom.mk line 102
Quoted 3 lines
package/skeleton-custom/skeleton-custom.mk new file +3
-0+define SKELETON_CUSTOM_INSTALL_STAGING_CMDS + $(call SYSTEM_RSYNC,$(SKELETON_CUSTOM_PATH),$(STAGING_DIR)) + $(call SYSTEM_LIB_SYMLINK,$(STAGING_DIR))
In skeleton-common, we also have:
$(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include
Shouldn't we do that here as well?
Regards,
Arnout
Quoted 1 line
Quoted 1 line
+endef
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 11/20 package/skeleton: split out into skeleton-custom
On 2017-07-23 00:38 +0200, Arnout Vandecappelle spake thusly:
Quoted 9 lines
On second thought...
Quoted 3 lines · Arnout Vandecappelle
package/skeleton-custom/skeleton-custom.mk line 102
Quoted 3 lines
package/skeleton-custom/skeleton-custom.mk new file +3
-0+define SKELETON_CUSTOM_INSTALL_STAGING_CMDS + $(call SYSTEM_RSYNC,$(SKELETON_CUSTOM_PATH),$(STAGING_DIR)) + $(call SYSTEM_LIB_SYMLINK,$(STAGING_DIR))In skeleton-common, we also have:
Quoted 3 lines
$(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/includeShouldn't we do that here as well?
In fact, I argue that we should not have this mkdir at all:
https://patchwork.ozlabs.org/patch/710672/
I propagated it here because the patch is just about moving stuff, not cleaning up.
Regards,
Yann E. MORIN.
Quoted 12 lines
Regards,
ArnoutQuoted 1 line
Quoted 1 line
+endef
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 12/20 package/skeleton: split out into skeleton-common
In reply to Yann E. MORINMove all the handling of the default skeleton into a new package, skeleton-common.
We don;t name it skeleton-default, because it will be further split later, into a skeleton for sysv and another for systemd, with some parts still common between the two. So just name it skeleton-common right now; this will save us a rename later.
We keep in the skeleton package all definitions of macros and variables that can be used by other skeleton packages and/or init systems, and just offload the actual feeding of the skeleton to the new package.
--- package/Config.in | 1 + package/skeleton-common/Config.in | 3 + package/skeleton-common/skeleton-common.mk | 96 ++++++++++++++++++++++++++++++ package/skeleton/skeleton.mk | 87 +-------------------------- system/Config.in | 2 +- 5 files changed, 102 insertions(+), 87 deletions(-) create mode 100644 package/skeleton-common/Config.in create mode 100644 package/skeleton-common/skeleton-common.mk
package/Config.in +1 -0
@@ -2,6 +2,7 @@ menu "Target packages" source "package/busybox/Config.in" source "package/skeleton/Config.in" + source "package/skeleton-common/Config.in" source "package/skeleton-custom/Config.in" menu "Audio and video applications"
package/skeleton-common/Config.in new file +3 -0
@@ -0,0 +1,3 @@ +config BR2_PACKAGE_SKELETON_COMMON + bool + select BR2_PACKAGE_SKELETON
package/skeleton-common/skeleton-common.mk new file +96 -0
96 lines not on this page · raw message
package/skeleton/skeleton.mk +1 -86
96 lines not on this page · raw message
system/Config.in +1 -1
@@ -8,7 +8,7 @@ choice config BR2_ROOTFS_SKELETON_DEFAULT bool "default target skeleton" depends on !BR2_INIT_NONE - select BR2_PACKAGE_SKELETON + select BR2_PACKAGE_SKELETON_COMMON help Use default target skeleton
Signature · 1 line
2.11.0
PATCH 12/20 package/skeleton: split out into skeleton-common
Quoted 4 lines · Yann E. MORIN
Move all the handling of the default skeleton into a new package, skeleton-common.
We don;t name it skeleton-default, because it will be further split
don't
Quoted 9 lines
later, into a skeleton for sysv and another for systemd, with some parts still common between the two. So just name it skeleton-common right now; this will save us a rename later.
We keep in the skeleton package all definitions of macros and variables that can be used by other skeleton packages and/or init systems, and just offload the actual feeding of the skeleton to the new package.
Signed-off-by "Yann E. MORIN" <[email protected]>
[snip]
package/skeleton-common/skeleton-common.mk line 10
Quoted 4 lines
package/skeleton-common/skeleton-common.mk new file +4
-0+# 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.
I don't think this comment is very useful - it's pretty obvious. Actually, it
would make sense for SKELETON_COMMON_ADD_SKELETON_DEPENDENCY=NO to imply SKELETON_COMMON_ADD_TOOLCHAIN_DEPENDENCY=NO, but really we don't need to complicate the infra for that...
You can't have too many comments though, so let's not block the patch for that.
package/skeleton-common/skeleton-common.mk line 14
Quoted 4 lines
package/skeleton-common/skeleton-common.mk new file +4
-0+SKELETON_COMMON_ADD_TOOLCHAIN_DEPENDENCY = NO +SKELETON_COMMON_ADD_SKELETON_DEPENDENCY = NO + +# The skeleton also handles the merged /usr case in the sysroot
This comment, on the other hand, *is* very useful.
package/skeleton-common/skeleton-common.mk line 17
Quoted 3 lines
package/skeleton-common/skeleton-common.mk new file +3
-0+SKELETON_COMMON_INSTALL_STAGING = YES + +SKELETON_COMMON_PATH = system/skeleton
Not for this patch of course, but I think it would make sense to also move that
here. But you probably thought of that already :-)
Regards,
Arnout
[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 12/20 package/skeleton: split out into skeleton-common
Arnout, All,
On 2017-07-23 01:06 +0200, Arnout Vandecappelle spake thusly:
Quoted 20 lines · Yann E. MORIN
Quoted 4 lines
Move all the handling of the default skeleton into a new package, skeleton-common.
We don;t name it skeleton-default, because it will be further split
don't
Quoted 9 lines
later, into a skeleton for sysv and another for systemd, with some parts still common between the two. So just name it skeleton-common right now; this will save us a rename later.
We keep in the skeleton package all definitions of macros and variables that can be used by other skeleton packages and/or init systems, and just offload the actual feeding of the skeleton to the new package.
Signed-off-by "Yann E. MORIN" <[email protected]>[snip]
Quoted 9 lines
package/skeleton-common/skeleton-common.mk line 10
Quoted 4 lines
package/skeleton-common/skeleton-common.mk new file +4
-0+# 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.I don't think this comment is very useful - it's pretty obvious. Actually, it
would make sense for SKELETON_COMMON_ADD_SKELETON_DEPENDENCY=NO to imply SKELETON_COMMON_ADD_TOOLCHAIN_DEPENDENCY=NO, but really we don't need to complicate the infra for that...
Yeah, it is obvious. But since there was a comment about the toolchain already in the skeleton, I stubornly duplicated it for the skeleton as well, and then stubornly propagated to all skeleton packages...
I am entirely fine with dropping both, though.
Quoted 9 lines
You can't have too many comments though, so let's not block the patch for that.
package/skeleton-common/skeleton-common.mk line 14
Quoted 4 lines
package/skeleton-common/skeleton-common.mk new file +4
-0+SKELETON_COMMON_ADD_TOOLCHAIN_DEPENDENCY = NO +SKELETON_COMMON_ADD_SKELETON_DEPENDENCY = NO + +# The skeleton also handles the merged /usr case in the sysrootThis comment, on the other hand, *is* very useful.
Quoted 6 lines
package/skeleton-common/skeleton-common.mk line 17
Quoted 3 lines
package/skeleton-common/skeleton-common.mk new file +3
-0+SKELETON_COMMON_INSTALL_STAGING = YES + +SKELETON_COMMON_PATH = system/skeletonNot for this patch of course, but I think it would make sense to also move that
here. But you probably thought of that already :-)
Yes, that's is what I did in the first iteration, but Thomas was against moving it, so I left it alone to stay there.
Regards,
Yann E. MORIN.
Quoted 12 lines
Regards,
Arnout[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 12/20 package/skeleton: split out into skeleton-common
First of all: I agree/accept all the feedback you gave to my review comments.
Quoted 3 lines · Yann E. MORIN
Arnout, All,
On 2017-07-23 01:06 +0200, Arnout Vandecappelle spake thusly:
[snip]
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
+SKELETON_COMMON_PATH = system/skeleton
Not for this patch of course, but I think it would make sense to also move that
here. But you probably thought of that already :-)Yes, that's is what I did in the first iteration, but Thomas was against moving it, so I left it alone to stay there.
Thomas, do you remember why you were against moving the skeleton to
package/skeleton-common?
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 12/20 package/skeleton: split out into skeleton-common
Hello,
Quoted 8 lines · Arnout Vandecappelle
Quoted 5 lines
Quoted 2 lines
Not for this patch of course, but I think it would make sense to also move that
here. But you probably thought of that already :-)Yes, that's is what I did in the first iteration, but Thomas was against moving it, so I left it alone to stay there.
Thomas, do you remember why you were against moving the skeleton to
package/skeleton-common?
I honestly don't remember. I believe it might be that I thought that system/skeleton/ was a more "obvious" place to look for the skeleton, rather than buried in package/skeleton-common/. But this argument feels a bit fishy, so I'm not sure if that was that or something else.
I don't currently see a problem with having the base skeleton moved to package/skeleton-common/.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 12/20 package/skeleton: split out into skeleton-common
Thomas, All,
On 2017-07-24 09:19 +0200, Thomas Petazzoni spake thusly:
Quoted 11 lines · Arnout Vandecappelle
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Not for this patch of course, but I think it would make sense to also move that
here. But you probably thought of that already :-)Yes, that's is what I did in the first iteration, but Thomas was against moving it, so I left it alone to stay there.
Thomas, do you remember why you were against moving the skeleton to
package/skeleton-common?
Quoted 7 lines
I honestly don't remember. I believe it might be that I thought that system/skeleton/ was a more "obvious" place to look for the skeleton, rather than buried in package/skeleton-common/. But this argument feels a bit fishy, so I'm not sure if that was that or something else.
I don't currently see a problem with having the base skeleton moved to package/skeleton-common/.
OK, I'll move that when I respin later tonight.
Thanks!
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 13/20 package/skeleton: make it a virtual package
In reply to Yann E. MORINWe now have two packages that can act as a skeleton, skeleton-common, also known as our default skeleton, and skeleton-custom.
This means that the skeleton package can be a standard virtual package now.
Well, except that, besides being a virtual package, it also provides variables and macros that can be used by the other skeletons and/or the init systems.
--- package/skeleton-common/Config.in | 5 ++++- package/skeleton-common/skeleton-common.mk | 2 ++ package/skeleton-custom/Config.in | 5 ++++- package/skeleton-custom/skeleton-custom.mk | 2 ++ package/skeleton/Config.in | 9 +++++++-- package/skeleton/skeleton.mk | 8 +------- system/Config.in | 4 ++++ 7 files changed, 24 insertions(+), 11 deletions(-)
package/skeleton-common/Config.in +4 -1
@@ -1,3 +1,6 @@ config BR2_PACKAGE_SKELETON_COMMON bool - select BR2_PACKAGE_SKELETON + select BR2_PACKAGE_HAS_SKELETON + +config BR2_PACKAGE_PROVIDES_SKELETON + default "skeleton-common" if BR2_PACKAGE_SKELETON_COMMON
package/skeleton-common/skeleton-common.mk +2 -0
@@ -11,6 +11,8 @@ SKELETON_COMMON_ADD_TOOLCHAIN_DEPENDENCY = NO SKELETON_COMMON_ADD_SKELETON_DEPENDENCY = NO +SKELETON_COMMON_PROVIDES = skeleton + # The skeleton also handles the merged /usr case in the sysroot SKELETON_COMMON_INSTALL_STAGING = YES
package/skeleton-custom/Config.in +4 -1
@@ -1,3 +1,6 @@ config BR2_PACKAGE_SKELETON_CUSTOM bool - select BR2_PACKAGE_SKELETON + select BR2_PACKAGE_HAS_SKELETON + +config BR2_PACKAGE_PROVIDES_SKELETON + default "skeleton-custom" if BR2_PACKAGE_SKELETON_CUSTOM
package/skeleton-custom/skeleton-custom.mk +2 -0
@@ -7,6 +7,8 @@ SKELETON_CUSTOM_ADD_TOOLCHAIN_DEPENDENCY = NO SKELETON_CUSTOM_ADD_SKELETON_DEPENDENCY = NO +SKELETON_CUSTOM_PROVIDES = skeleton + SKELETON_CUSTOM_INSTALL_STAGING = YES SKELETON_CUSTOM_PATH = $(call qstrip,$(BR2_ROOTFS_SKELETON_CUSTOM_PATH))
package/skeleton/Config.in +7 -2
@@ -1,4 +1,9 @@ config BR2_PACKAGE_SKELETON bool - help - The basic skeleton for your rootfs. + default y + +config BR2_PACKAGE_HAS_SKELETON + bool + +config BR2_PACKAGE_PROVIDES_SKELETON + string
package/skeleton/skeleton.mk +1 -7
@@ -11,10 +11,4 @@ SKELETON_ADD_TOOLCHAIN_DEPENDENCY = NO SKELETON_ADD_SKELETON_DEPENDENCY = NO -ifeq ($(BR2_PACKAGE_SKELETON_CUSTOM),y) -SKELETON_DEPENDENCIES = skeleton-custom -else -SKELETON_DEPENDENCIES = skeleton-common -endif - -$(eval $(generic-package)) +$(eval $(virtual-package))
system/Config.in +4 -0
@@ -1,5 +1,9 @@ menu "System configuration" +# Note: usually, it is not possible to select a provider of a virtual +# package. But here we have an exception: there are only two providers +# and they only get selected each by separate entries in this choice. +# So this is a safe situation. choice prompt "Root FS skeleton"
Signature · 1 line
2.11.0
PATCH 13/20 package/skeleton: make it a virtual package
Quoted 9 lines · Yann E. MORIN
We now have two packages that can act as a skeleton, skeleton-common, also known as our default skeleton, and skeleton-custom.
This means that the skeleton package can be a standard virtual package now.
Well, except that, besides being a virtual package, it also provides variables and macros that can be used by the other skeletons and/or the init systems.
I guess this is a left-over from when you hadn't moved everything to system.mk
yet...
Quoted 2 lines
Signed-off-by "Yann E. MORIN" <[email protected]>
On this patch, I do have kind of big comments.
[snip]
package/skeleton-custom/Config.in line 6
Quoted 12 lines
package/skeleton-custom/Config.in +4
-1@@ -1,3 +1,6 @@ config BR2_PACKAGE_SKELETON_CUSTOM bool - select BR2_PACKAGE_SKELETON + select BR2_PACKAGE_HAS_SKELETON + +config BR2_PACKAGE_PROVIDES_SKELETON + default "skeleton-custom" if BR2_PACKAGE_SKELETON_CUSTOM
In almost all virtual package providers, we do it like:
if BR2_PACKAGE_SKELETON_CUSTOM
config BR2_PACKAGE_PROVIDES_SKELETON
default "skeleton-custom"
endif
[snip]
package/skeleton-custom/Config.in
Quoted 5 lines
config
BR2_PACKAGE_SKELETONpackage/skeleton-custom/Config.in +1
-2bool - help - The basic skeleton for your rootfs. + default y
For most virtual packages, we don't define the Kconfig symbol (e.g. there is noBR2_PACKAGE_EGL). Do we need it for skeleton?
package/skeleton-custom/Config.in
Quoted 3 lines
package/skeleton-custom/Config.in +3
-0+ +config BR2_PACKAGE_HAS_SKELETON + bool
We also don't really need this. It is used by packages that need the virtual
package to check if there is a provider for it. But no package 'depends on' skeleton (or rather, all of them do), so we don't need this.
package/skeleton-custom/Config.in
Quoted 3 lines
package/skeleton-custom/Config.in +3
-0+ +config BR2_PACKAGE_PROVIDES_SKELETON + string
This one we do need :-)
[snip]
system/Config.in line 4
Quoted 9 lines
system/Config.in +2
-0@@ -1,5 +1,9 @@ menu "System configuration" +# Note: usually, it is not possible to select a provider of a virtual +# package.
This is not true cryptodev, jpeg and mysql do exactly that. libressl/openssl
will also do it that way. In fact, a choice is in a way the better way to do it, because then you're guaranteed not to have conflicting providers.
So this entire comment is wrong and can be removed. IMO.
Regards,
Arnout
Quoted 7 lines
But here we have an exception: there are only two providers
system/Config.in +2
-0+# and they only get selected each by separate entries in this choice. +# So this is a safe situation. choice prompt "Root FS skeleton"
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 13/20 package/skeleton: make it a virtual package
On 2017-07-23 01:36 +0200, Arnout Vandecappelle spake thusly:
Quoted 9 lines · Yann E. MORIN
Quoted 6 lines
We now have two packages that can act as a skeleton, skeleton-common, also known as our default skeleton, and skeleton-custom.
This means that the skeleton package can be a standard virtual package now.
Quoted 6 lines
Quoted 3 lines
Well, except that, besides being a virtual package, it also provides variables and macros that can be used by the other skeletons and/or the init systems.
I guess this is a left-over from when you hadn't moved everything to system.mk
yet...
Arg, yes...
Quoted 26 lines
Quoted 1 line
Signed-off-by "Yann E. MORIN" <[email protected]>On this patch, I do have kind of big comments.
[snip]
package/skeleton-custom/Config.in line 6
Quoted 12 lines
package/skeleton-custom/Config.in +4
-1@@ -1,3 +1,6 @@ config BR2_PACKAGE_SKELETON_CUSTOM bool - select BR2_PACKAGE_SKELETON + select BR2_PACKAGE_HAS_SKELETON + +config BR2_PACKAGE_PROVIDES_SKELETON + default "skeleton-custom" if BR2_PACKAGE_SKELETON_CUSTOMIn almost all virtual package providers, we do it like:
if
BR2_PACKAGE_SKELETON_CUSTOM
configBR2_PACKAGE_PROVIDES_SKELETON
default "skeleton-custom"
endif[snip]
Quoted 8 lines
package/skeleton-custom/Config.in
Quoted 5 lines
config
BR2_PACKAGE_SKELETONpackage/skeleton-custom/Config.in +1
-2bool - help - The basic skeleton for your rootfs. + default yFor most virtual packages, we don't define the
Kconfigsymbol (e.g. there is noBR2_PACKAGE_EGL). Do we need it for skeleton?
We have it already for toolchain, another 'speical' package.
Having a package options ensures that:
- the package is always enabled, even if none selects it,
- the package appears in the graph-depends.
Quoted 7 lines
package/skeleton-custom/Config.in
Quoted 3 lines
package/skeleton-custom/Config.in +3
-0+ +config BR2_PACKAGE_HAS_SKELETON + boolWe also don't really need this. It is used by packages that need the virtual
package to check if there is a provider for it. But no package 'depends on' skeleton (or rather, all of them do), so we don't need this.
Technically, we do not need it. But I want to avoid scratching my head if/when I have to revisit the virtual package infra, and the skeleton stuff suddenly breaks for no reason.
This is a virtual package, let's make it a real virtual package. Let's try not to be subtle.
Quoted 14 lines
package/skeleton-custom/Config.in
Quoted 3 lines
package/skeleton-custom/Config.in +3
-0+ +config BR2_PACKAGE_PROVIDES_SKELETON + stringThis one we do need :-)
[snip]
Quoted 7 lines
system/Config.in +0
-0@@ -1,5 +1,9 @@ menu "System configuration"
Quoted 6 lines
system/Config.in line 4
Quoted 2 lines
system/Config.in +2
-0+# Note: usually, it is not possible to select a provider of a virtual +# package.This is not true cryptodev, jpeg and mysql do exactly that. libressl/openssl
will also do it that way. In fact, a choice is in a way the better way to do it, because then you're guaranteed not to have conflicting providers.
But then you disallow implementations from a br2-external tree, for example for jpeg, a provider that has a hardware-accelerated libjpeg.
Quoted 1 line
So this entire comment is wrong and can be removed. IMO.
No, the comment is true, when you look at a virtual package definition in the manual. The way we do it for jpeg, cryptodev and mysql is that we have a real package and a virtual package both in one, which have a choice, and thus lift the limitation.
Regards,
Yann E. MORIN.
Quoted 18 lines
Regards,
ArnoutQuoted 7 lines
But here we have an exception: there are only two providers
system/Config.in +2
-0+# and they only get selected each by separate entries in this choice. +# So this is a safe situation. choice prompt "Root FS skeleton"Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 13/20 package/skeleton: make it a virtual package
Quoted 4 lines · Yann E. MORIN
On 2017-07-23 01:36 +0200, Arnout Vandecappelle spake thusly:
Quoted 3 lines · Yann E. MORIN
[snip]
Quoted 10 lines
Quoted 8 lines
package/skeleton/Config.in line 3
Quoted 5 lines
config
BR2_PACKAGE_SKELETONpackage/skeleton/Config.in +1
-2bool - help - The basic skeleton for your rootfs. + default yFor most virtual packages, we don't define the
Kconfigsymbol (e.g. there is noBR2_PACKAGE_EGL). Do we need it for skeleton?We have it already for toolchain, another 'speical' package.
However, why don't we have it for other virtual packages?
Or maybe I should ask: why do we have a separate BR2_PACKAGE_SKELETON andBR2_PACKAGE_HAS_SKELETON?
Indeed for consistency it's better to add all these Kconfig symbols for
skeleton now.
[snip]
Quoted 9 lines
Quoted 6 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+# Note: usually, it is not possible to select a provider of a virtual +# package.This is not true cryptodev, jpeg and mysql do exactly that. libressl/openssl
will also do it that way. In fact, a choice is in a way the better way to do it, because then you're guaranteed not to have conflicting providers.But then you disallow implementations from a br2-external tree, for example for jpeg, a provider that has a hardware-accelerated libjpeg.
There are pros and cons to the choice.
Quoted 7 lines
Quoted 2 lines
So this entire comment is wrong and can be removed. IMO.
No, the comment is true, when you look at a virtual package definition in the manual. The way we do it for jpeg, cryptodev and mysql is that we have a real package and a virtual package both in one, which have a choice, and thus lift the limitation.
Well, IMO skeleton is similar to jpeg, cryptodev and mysql in that respect.
But let's not discuss about adding or removing a comment :-)
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 14/20 package/skeleton-common: simplify staging install
In reply to Yann E. MORINWe don't really care what's going in staging, as long as it is properly setup for merged/non-merged /usr, especially for the lib/ directory.
So we can just copy the skeleton as-is.
This simplify the maintenance, should we ever need to tweak the layout:
we'd just have to do it once in the skeleton directory to have it propagated to both target and staging.
--- package/skeleton-common/skeleton-common.mk | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
package/skeleton-common/skeleton-common.mk +5 -9
@@ -26,18 +26,14 @@ define SKELETON_COMMON_INSTALL_TARGET_CMDS $(TARGET_DIR_WARNING_FILE) endef -# For the staging dir, we don't really care about /bin and /sbin. -# But for consistency with the target dir, and to simplify the code, -# we still handle them for the merged or non-merged /usr cases. -# Since the toolchain is not yet available, the staging is not yet -# populated, so we need to create the directories in /usr +# We don't care much about what goes in staging, as long as it is +# correctly setup for merged/non-merged /usr. The simplest is to +# fill it in with the content of the skeleton. define SKELETON_COMMON_INSTALL_STAGING_CMDS - $(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/lib - $(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/bin - $(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/sbin - $(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include + $(call SYSTEM_RSYNC,$(SKELETON_COMMON_PATH),$(STAGING_DIR)) $(call SYSTEM_USR_SYMLINKS_OR_DIRS,$(STAGING_DIR)) $(call SYSTEM_LIB_SYMLINK,$(STAGING_DIR)) + $(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include endef SKELETON_COMMON_HOSTNAME = $(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME))
Signature · 1 line
2.11.0
PATCH 14/20 package/skeleton-common: simplify staging install
Quoted 8 lines · Yann E. MORIN
We don't really care what's going in staging, as long as it is properly setup for merged/non-merged /usr, especially for the
lib/directory.So we can just copy the skeleton as-is.
This simplify the maintenance, should we ever need to tweak the layout:
we'd just have to do it once in the skeleton directory to have it propagated to both target and staging.
Yes, very nice, I like it!
Quoted 2 lines
Signed-off-by "Yann E. MORIN" <[email protected]>
Regards,
Arnout
Quoted 33 lines
--- package/skeleton-common/skeleton-common.mk | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)package/skeleton-common/skeleton-common.mk +5
-9@@ -26,18 +26,14 @@ define SKELETON_COMMON_INSTALL_TARGET_CMDS $(TARGET_DIR_WARNING_FILE) endef -# For the staging dir, we don't really care about /bin and /sbin. -# But for consistency with the target dir, and to simplify the code, -# we still handle them for the merged or non-merged /usr cases. -# Since the toolchain is not yet available, the staging is not yet -# populated, so we need to create the directories in /usr +# We don't care much about what goes in staging, as long as it is +# correctly setup for merged/non-merged /usr. The simplest is to +# fill it in with the content of the skeleton. define SKELETON_COMMON_INSTALL_STAGING_CMDS - $(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/lib - $(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/bin - $(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/sbin - $(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include + $(call SYSTEM_RSYNC,$(SKELETON_COMMON_PATH),$(STAGING_DIR)) $(call SYSTEM_USR_SYMLINKS_OR_DIRS,$(STAGING_DIR)) $(call SYSTEM_LIB_SYMLINK,$(STAGING_DIR)) + $(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include endef SKELETON_COMMON_HOSTNAME = $(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME))
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 15/20 package/skeleton: introduce sysv- and systemd-specific skeletons
In reply to Yann E. MORINCurrently, we use the same skeleton for sysv-like init systems and systemd, even though systemd has some peculiarities that makes out default skeleton unfit.
So, we'll need to provide different skeletons (really, only part of it) for sysv-like and systemd.
Introduce two new skeleton packages, aptly named skeleton-sysv and skeleton-systemd, one for each, that are both providers of the skeleton package, in lieue of the skeleton-common, which is now a simple dependency of both the two new skeletons.
Those packages are empty for now. In followup changes:
- sysv-specific stuff will be moved out of skeleton-common and into
skeleton-sysv;
- systemd-specific stuff will be added to skeleton-systemd.
--- package/Config.in | 2 ++ package/skeleton-common/Config.in | 4 ---- package/skeleton-common/skeleton-common.mk | 2 -- package/skeleton-systemd/Config.in | 7 +++++++ package/skeleton-systemd/skeleton-systemd.mk | 18 ++++++++++++++++++ package/skeleton-sysv/Config.in | 7 +++++++ package/skeleton-sysv/skeleton-sysv.mk | 18 ++++++++++++++++++ system/Config.in | 10 ++++++---- 8 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 package/skeleton-systemd/Config.in create mode 100644 package/skeleton-systemd/skeleton-systemd.mk create mode 100644 package/skeleton-sysv/Config.in create mode 100644 package/skeleton-sysv/skeleton-sysv.mk
package/Config.in +2 -0
@@ -4,6 +4,8 @@ menu "Target packages" source "package/skeleton/Config.in" source "package/skeleton-common/Config.in" source "package/skeleton-custom/Config.in" + source "package/skeleton-systemd/Config.in" + source "package/skeleton-sysv/Config.in" menu "Audio and video applications" source "package/alsa-utils/Config.in"
package/skeleton-common/Config.in +0 -4
@@ -1,6 +1,2 @@ config BR2_PACKAGE_SKELETON_COMMON bool - select BR2_PACKAGE_HAS_SKELETON - -config BR2_PACKAGE_PROVIDES_SKELETON - default "skeleton-common" if BR2_PACKAGE_SKELETON_COMMON
package/skeleton-common/skeleton-common.mk +0 -2
@@ -11,8 +11,6 @@ SKELETON_COMMON_ADD_TOOLCHAIN_DEPENDENCY = NO SKELETON_COMMON_ADD_SKELETON_DEPENDENCY = NO -SKELETON_COMMON_PROVIDES = skeleton - # The skeleton also handles the merged /usr case in the sysroot SKELETON_COMMON_INSTALL_STAGING = YES
package/skeleton-systemd/Config.in new file +7 -0
@@ -0,0 +1,7 @@ +config BR2_PACKAGE_SKELETON_SYSTEMD + bool + select BR2_PACKAGE_HAS_SKELETON + select BR2_PACKAGE_SKELETON_COMMON + +config BR2_PACKAGE_PROVIDES_SKELETON + default "skeleton-systemd" if BR2_PACKAGE_SKELETON_SYSTEMD
package/skeleton-systemd/skeleton-systemd.mk new file +18 -0
@@ -0,0 +1,18 @@ +################################################################################ +# +# skeleton-systemd +# +################################################################################ + +# 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_SYSTEMD_ADD_TOOLCHAIN_DEPENDENCY = NO +SKELETON_SYSTEMD_ADD_SKELETON_DEPENDENCY = NO + +SKELETON_SYSTEMD_DEPENDENCIES = skeleton-common + +SKELETON_SYSTEMD_PROVIDES = skeleton + +$(eval $(generic-package))
package/skeleton-sysv/Config.in new file +7 -0
@@ -0,0 +1,7 @@ +config BR2_PACKAGE_SKELETON_SYSV + bool + select BR2_PACKAGE_HAS_SKELETON + select BR2_PACKAGE_SKELETON_COMMON + +config BR2_PACKAGE_PROVIDES_SKELETON + default "skeleton-sysv" if BR2_PACKAGE_SKELETON_SYSV
package/skeleton-sysv/skeleton-sysv.mk new file +18 -0
@@ -0,0 +1,18 @@ +################################################################################ +# +# skeleton-sysv +# +################################################################################ + +# 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_SYSV_ADD_TOOLCHAIN_DEPENDENCY = NO +SKELETON_SYSV_ADD_SKELETON_DEPENDENCY = NO + +SKELETON_SYSV_DEPENDENCIES = skeleton-common + +SKELETON_SYSV_PROVIDES = skeleton + +$(eval $(generic-package))
system/Config.in +6 -4
@@ -1,9 +1,9 @@ menu "System configuration" # Note: usually, it is not possible to select a provider of a virtual -# package. But here we have an exception: there are only two providers -# and they only get selected each by separate entries in this choice. -# So this is a safe situation. +# package. But here we have an exception: there are only three providers +# and they only get selected by separate entries in this choice and +# under different, exclusive conditions. So this is a safe situation. choice prompt "Root FS skeleton"
@@ -12,7 +12,9 @@ choice config BR2_ROOTFS_SKELETON_DEFAULT bool "default target skeleton" depends on !BR2_INIT_NONE - select BR2_PACKAGE_SKELETON_COMMON + select BR2_PACKAGE_SKELETON_SYSV if BR2_INIT_SYSV + select BR2_PACKAGE_SKELETON_SYSV if BR2_INIT_BUSYBOX + select BR2_PACKAGE_SKELETON_SYSTEMD if BR2_INIT_SYSTEMD help Use default target skeleton
Signature · 1 line
2.11.0
PATCH 15/20 package/skeleton: introduce sysv- and systemd-specific skeletons
Quoted 2 lines · Yann E. MORIN
Currently, we use the same skeleton for sysv-like init systems and systemd, even though systemd has some peculiarities that makes out
our
Quoted 10 lines
default skeleton unfit.
So, we'll need to provide different skeletons (really, only part of it) for sysv-like and systemd.
Introduce two new skeleton packages, aptly named skeleton-sysv and skeleton-systemd, one for each, that are both providers of the skeleton package, in lieue of the skeleton-common, which is now a simple dependency of both the two new skeletons.
Quoted 6 lines
Those packages are empty for now. In followup changes:
- sysv-specific stuff will be moved out of skeleton-common and intoskeleton-sysv;- systemd-specific stuff will be added to skeleton-systemd.
Signed-off-by "Yann E. MORIN" <[email protected]>
But...
[snip]
package/skeleton-systemd/Config.in line 7
Quoted 7 lines
package/skeleton-systemd/Config.in new file +7
-0+config BR2_PACKAGE_SKELETON_SYSTEMD + bool + select BR2_PACKAGE_HAS_SKELETON + select BR2_PACKAGE_SKELETON_COMMON + +config BR2_PACKAGE_PROVIDES_SKELETON + default "skeleton-systemd" if BR2_PACKAGE_SKELETON_SYSTEMD
Again, we usually do it with if...config...endif. Same for sysv, obviously.
[snip]
system/Config.in choice · line 17
Quoted 8 lines
system/Config.in +3
-1@@ -12,7 +12,9 @@ choice config BR2_ROOTFS_SKELETON_DEFAULT bool "default target skeleton" depends on !BR2_INIT_NONE - select BR2_PACKAGE_SKELETON_COMMON + select BR2_PACKAGE_SKELETON_SYSV if BR2_INIT_SYSV + select BR2_PACKAGE_SKELETON_SYSV if BR2_INIT_BUSYBOX + select BR2_PACKAGE_SKELETON_SYSTEMD if BR2_INIT_SYSTEMD
This works, but I'm thinking of an alternative, let's see if it flies:
Instead of choosing the different skeletons here, we could do it in the select
of BR2_INIT_*. Indeed, you have a skeleton for each init option. Of course, all the selects there would have to look like
select BR2_PACKAGE_SKELETON_SYSV if BR2_ROOTFS_SKELETON_DEFAULT
I'm not entirely sure if it's an improvement, but I have the feeling it's
easier to follow if the different skeleton options are put together with the different init options.
Regards,
Arnout
Quoted 4 lines
system/Config.in +0
-0help Use default target skeleton
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 15/20 package/skeleton: introduce sysv- and systemd-specific skeletons
Arnout, All,
On 2017-07-23 01:49 +0200, Arnout Vandecappelle spake thusly:
Quoted 52 lines · Yann E. MORIN
Quoted 2 lines
Currently, we use the same skeleton for sysv-like init systems and systemd, even though systemd has some peculiarities that makes out
our
Quoted 10 lines
default skeleton unfit.
So, we'll need to provide different skeletons (really, only part of it) for sysv-like and systemd.
Introduce two new skeleton packages, aptly named skeleton-sysv and skeleton-systemd, one for each, that are both providers of the skeleton package, in lieue of the skeleton-common, which is now a simple dependency of both the two new skeletons.
Quoted 6 lines
Those packages are empty for now. In followup changes:
- sysv-specific stuff will be moved out of skeleton-common and intoskeleton-sysv;- systemd-specific stuff will be added to skeleton-systemd.
Signed-off-by "Yann E. MORIN" <[email protected]>But...
[snip]
package/skeleton-systemd/Config.in line 7
Quoted 7 lines
package/skeleton-systemd/Config.in new file +7
-0+config BR2_PACKAGE_SKELETON_SYSTEMD + bool + select BR2_PACKAGE_HAS_SKELETON + select BR2_PACKAGE_SKELETON_COMMON + +config BR2_PACKAGE_PROVIDES_SKELETON + default "skeleton-systemd" if BR2_PACKAGE_SKELETON_SYSTEMDAgain, we usually do it with if...config...endif. Same for sysv, obviously.
[snip]
system/Config.in choice · line 17
Quoted 8 lines
system/Config.in +3
-1@@ -12,7 +12,9 @@ choice config BR2_ROOTFS_SKELETON_DEFAULT bool "default target skeleton" depends on !BR2_INIT_NONE - select BR2_PACKAGE_SKELETON_COMMON + select BR2_PACKAGE_SKELETON_SYSV if BR2_INIT_SYSV + select BR2_PACKAGE_SKELETON_SYSV if BR2_INIT_BUSYBOX + select BR2_PACKAGE_SKELETON_SYSTEMD if BR2_INIT_SYSTEMDThis works, but I'm thinking of an alternative, let's see if it flies:
Instead of choosing the different skeletons here, we could do it in the select
of BR2_INIT_*. Indeed, you have a skeleton for each init option. Of course, all the selects there would have to look like
Quoted 6 lines
select
BR2_PACKAGE_SKELETON_SYSVifBR2_ROOTFS_SKELETON_DEFAULTI'm not entirely sure if it's an improvement, but I have the feeling it's
easier to follow if the different skeleton options are put together with the different init options.
I also tried that, but I found it uglier, because it is split away in various options, while here it is fully concentrated in a single one, so it is (arguably) easier to maintain...
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 16/20 system: separate sysv and systemd parts of the skeleton
In reply to Yann E. MORINsystems does not like that the content of /var be symlinks to /tmp, especially journald that starts before /tmp is mounted, and thus the journal files are hidden from view, which causes wuite a bit if fuss...
Instead, move the current /var to a sysv-only skeleton.
systemd at install time will create the /var content it needs, so we just create an empty /var for systemd. Yet, systemd really requires a bunch of extra directories to exist, so we also create those.
---
Note: /home and /srv will be created at runtime if missing, but it is better to create them right now, to simplify supporting systemd on a RO filesystem in the (near) future.
---
package/skeleton-systemd/skeleton-systemd.mk | 7 +++++++
package/skeleton-sysv/skeleton-sysv.mk | 4 ++++
{system => package/skeleton-sysv}/skeleton/dev/log | 0
{system => package/skeleton-sysv}/skeleton/dev/pts/.empty | 0
{system => package/skeleton-sysv}/skeleton/dev/shm/.empty | 0
{system => package/skeleton-sysv}/skeleton/etc/fstab | 0
{system => package/skeleton-sysv}/skeleton/var/cache | 0
{system => package/skeleton-sysv}/skeleton/var/lib/misc | 0
{system => package/skeleton-sysv}/skeleton/var/lock | 0
{system => package/skeleton-sysv}/skeleton/var/log | 0
{system => package/skeleton-sysv}/skeleton/var/run | 0
{system => package/skeleton-sysv}/skeleton/var/spool | 0
{system => package/skeleton-sysv}/skeleton/var/tmp | 0
system/skeleton/dev/.empty | 0
14 files changed, 11 insertions(+)
rename {system => package/skeleton-sysv}/skeleton/dev/log (100%)
rename {system => package/skeleton-sysv}/skeleton/dev/pts/.empty (100%)
rename {system => package/skeleton-sysv}/skeleton/dev/shm/.empty (100%)
rename {system => package/skeleton-sysv}/skeleton/etc/fstab (100%)
rename {system => package/skeleton-sysv}/skeleton/var/cache (100%)
rename {system => package/skeleton-sysv}/skeleton/var/lib/misc (100%)
rename {system => package/skeleton-sysv}/skeleton/var/lock (100%)
rename {system => package/skeleton-sysv}/skeleton/var/log (100%)
rename {system => package/skeleton-sysv}/skeleton/var/run (100%)
rename {system => package/skeleton-sysv}/skeleton/var/spool (100%)
rename {system => package/skeleton-sysv}/skeleton/var/tmp (100%)
create mode 100644 system/skeleton/dev/.emptypackage/skeleton-systemd/skeleton-systemd.mk +7 -0
@@ -15,4 +15,11 @@ SKELETON_SYSTEMD_DEPENDENCIES = skeleton-common SKELETON_SYSTEMD_PROVIDES = skeleton +define SKELETON_SYSTEMD_INSTALL_TARGET_CMDS + mkdir -p $(TARGET_DIR)/home + mkdir -p $(TARGET_DIR)/srv + mkdir -p $(TARGET_DIR)/var + echo "/dev/root / auto rw 0 1" >$(TARGET_DIR)/etc/fstab +endef + $(eval $(generic-package))
package/skeleton-sysv/skeleton-sysv.mk +4 -0
@@ -15,4 +15,8 @@ SKELETON_SYSV_DEPENDENCIES = skeleton-common SKELETON_SYSV_PROVIDES = skeleton +define SKELETON_SYSV_INSTALL_TARGET_CMDS + $(call SYSTEM_RSYNC,$(SKELETON_SYSV_PKGDIR)/skeleton,$(TARGET_DIR)) +endef + $(eval $(generic-package))
package/skeleton-sysv/skeleton/dev/log renamed from system/skeleton/dev/log +0 -0
package/skeleton-sysv/skeleton/dev/pts/.empty renamed from system/skeleton/dev/pts/.empty +0 -0
package/skeleton-sysv/skeleton/dev/shm/.empty renamed from system/skeleton/dev/shm/.empty +0 -0
package/skeleton-sysv/skeleton/etc/fstab renamed from system/skeleton/etc/fstab +0 -0
package/skeleton-sysv/skeleton/var/cache renamed from system/skeleton/var/cache +0 -0
package/skeleton-sysv/skeleton/var/lib/misc renamed from system/skeleton/var/lib/misc +0 -0
package/skeleton-sysv/skeleton/var/lock renamed from system/skeleton/var/lock +0 -0
package/skeleton-sysv/skeleton/var/log renamed from system/skeleton/var/log +0 -0
package/skeleton-sysv/skeleton/var/run renamed from system/skeleton/var/run +0 -0
package/skeleton-sysv/skeleton/var/spool renamed from system/skeleton/var/spool +0 -0
package/skeleton-sysv/skeleton/var/tmp renamed from system/skeleton/var/tmp +0 -0
system/skeleton/dev/.empty new file +0 -0
Signature · 1 line
2.11.0
PATCH 16/20 system: separate sysv and systemd parts of the skeleton
Quoted 1 line · Yann E. MORIN
systems does not like that the content of /var be symlinks to /tmp,
systemd
Quoted 2 lines
especially journald that starts before /tmp is mounted, and thus the journal files are hidden from view, which causes wuite a bit if fuss...
quite
Quoted 4 lines
Instead, move the current /var to a sysv-only skeleton.
systemd at install time will create the /var content it needs, so we
I guess systemd will also create a tmpfs on /var?
Quoted 5 lines
just create an empty /var for systemd. Yet, systemd really requires a bunch of extra directories to exist, so we also create those.
Signed-off-by "Yann E. MORIN" <[email protected]>Cc Maxime Hadjinlian <[email protected]>
Commit message needs to be improved (see also below), but with that
Quoted 11 lines
---
Note: /home and /srv will be created at runtime if missing, but it is better to create them right now, to simplify supporting systemd on a RO filesystem in the (near) future.--- package/skeleton-systemd/skeleton-systemd.mk | 7 +++++++ package/skeleton-sysv/skeleton-sysv.mk | 4 ++++ {system => package/skeleton-sysv}/skeleton/dev/log | 0 {system => package/skeleton-sysv}/skeleton/dev/pts/.empty | 0 {system => package/skeleton-sysv}/skeleton/dev/shm/.empty | 0
I guess indeed the /dev stuff is not needed for systemd because there is anyway
a devtmpfs mounted over it. Which makes me wonder: shouldn't these be moved to the device-table? Only the static devices case needs these to be present... Of course, such a change is not for this patch, but I'd say that we can just leave this /dev stuff in the common part - systemd has no less use of it than sysv.
Quoted 1 line
{system => package/skeleton-sysv}/skeleton/etc/fstab | 0 Why? systemd does use fstab, so it seems weird not to have an fstab in the
systemd case. Well, I guess our skeleton fstab doesn't contain anything relevant for systemd because all of that is handled already by tmpfiles.
But the commit log should at least explain this.
Regards,
Arnout
[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 16/20 system: separate sysv and systemd parts of the skeleton
Quoted 5 lines · Arnout Vandecappelle
Quoted 1 line · Yann E. MORIN
systems does not like that the content of /var be symlinks to /tmp,
systemd
Quoted 7 lines
Quoted 2 lines
especially journald that starts before /tmp is mounted, and thus the journal files are hidden from view, which causes wuite a bit if fuss...
quite
Quoted 3 lines
Instead, move the current /var to a sysv-only skeleton.
systemd at install time will create the /var content it needs, so we
I guess systemd will also create a tmpfs on /var?
Seems the following sentence got dropped:
What happens when a package installs something in /var?
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 16/20 system: separate sysv and systemd parts of the skeleton
On 2017-07-23 02:13 +0200, Arnout Vandecappelle spake thusly:
Quoted 11 lines · Arnout Vandecappelle
Quoted 8 lines · Yann E. MORIN
Quoted 1 line
systems does not like that the content of /var be symlinks to /tmp,
systemd
Quoted 2 lines
especially journald that starts before /tmp is mounted, and thus the journal files are hidden from view, which causes wuite a bit if fuss...
quite
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
Instead, move the current /var to a sysv-only skeleton.
systemd at install time will create the /var content it needs, so we
I guess systemd will also create a tmpfs on /var?
Seems the following sentence got dropped:
What happens when a package installs something in /var?
Since we do not (yet) support a read-only root filesystem for systemd, and that systemd does _not_ automatically mount anything on /var, we always have /var that is writable, and thus whatever a package installs in /var at build time is in /var at runtime.
Now, see the followup patches, that add support for a read-only rootfs with systemd:
fs: add pre- and post-command hooks
system: make systemd work on a read-only rootfs
Even though the code for each is relatively simple, there is a *lot* of explanations in there about /var handling on a read-only rootfs with systemd.
But again, so far, we only ever supported systemd on a read-write rootfs.
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 16/20 system: separate sysv and systemd parts of the skeleton
In reply to Arnout VandecappelleArnout, All,
On 2017-07-23 02:08 +0200, Arnout Vandecappelle spake thusly:
Quoted 6 lines · Yann E. MORIN
Quoted 1 line
systems does not like that the content of /var be symlinks to /tmp,
systemd
Quoted 2 lines
especially journald that starts before /tmp is mounted, and thus the journal files are hidden from view, which causes wuite a bit if fuss...
Quoted 7 lines
quite
Quoted 4 lines
Instead, move the current /var to a sysv-only skeleton.
systemd at install time will create the /var content it needs, so we
I guess systemd will also create a tmpfs on /var?
No it does not. But so far we do not support systemd on a read-only root filesystem anyway (see the depends on for systemd).
In a later patch, we add support for a read-only rootfs, and then we add an explicit tmpfs mont on /var, which systemd does not do on its own, which is the reason for 886f3109bc (system: systemd only really supports a R/W rootfs)
Quoted 27 lines
Quoted 5 lines
just create an empty /var for systemd. Yet, systemd really requires a bunch of extra directories to exist, so we also create those.
Signed-off-by "Yann E. MORIN" <[email protected]>Cc Maxime Hadjinlian <[email protected]>Commit message needs to be improved (see also below), but with that
Quoted 11 lines
---
Note: /home and /srv will be created at runtime if missing, but it is better to create them right now, to simplify supporting systemd on a RO filesystem in the (near) future.--- package/skeleton-systemd/skeleton-systemd.mk | 7 +++++++ package/skeleton-sysv/skeleton-sysv.mk | 4 ++++ {system => package/skeleton-sysv}/skeleton/dev/log | 0 {system => package/skeleton-sysv}/skeleton/dev/pts/.empty | 0 {system => package/skeleton-sysv}/skeleton/dev/shm/.empty | 0I guess indeed the /dev stuff is not needed for systemd because there is anyway
a devtmpfs mounted over it. Which makes me wonder: shouldn't these be moved to the device-table? Only the static devices case needs these to be present... Of course, such a change is not for this patch, but I'd say that we can just leave this /dev stuff in the common part - systemd has no less use of it than sysv.
Quoted 4 lines
Quoted 1 line
{system => package/skeleton-sysv}/skeleton/etc/fstab | 0Why? systemd does use fstab, so it seems weird not to have an fstab in the
systemd case.
We do have one, it is created in the skeleton-systemd.mk file:
define SKELETON_SYSTEMD_INSTALL_TARGET_CMDS
mkdir -p $(TARGET_DIR)/home
mkdir -p $(TARGET_DIR)/srv
mkdir -p $(TARGET_DIR)/var
echo "/dev/root / auto rw 0 1" >$(TARGET_DIR)/etc/fstab
endefQuoted 2 lines
Well, I guess our skeleton fstab doesn't contain anything relevant for systemd because all of that is handled already by tmpfiles.
Exactly.
Quoted 1 line
But the commit log should at least explain this.
Like so, maybe?
For systemd, we only ever need an entry for /, because all the rest is totally irrelevant for systemd (it automatically mounts what it needs where it needs it).
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 16/20 system: separate sysv and systemd parts of the skeleton
Quoted 3 lines · Yann E. MORIN
Arnout, All,
On 2017-07-23 02:08 +0200, Arnout Vandecappelle spake thusly:
[snip]
Quoted 7 lines
Quoted 1 line
But the commit log should at least explain this.
Like so, maybe?
For systemd, we only ever need an entry for /, because all the rest is totally irrelevant for systemd (it automatically mounts what it needs where it needs it).
But... skeleton-common installs a lot more than just /, no? It installs/etc/stuff, and a bunch of top-level directories...
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 16/20 system: separate sysv and systemd parts of the skeleton
Quoted 10 lines · Arnout Vandecappelle
Quoted 3 lines · Yann E. MORIN
Arnout, All,
On 2017-07-23 02:08 +0200, Arnout Vandecappelle spake thusly:
[snip]
Quoted 2 lines
Quoted 1 line
But the commit log should at least explain this.
Quoted 8 lines
Quoted 5 lines
Like so, maybe?
For systemd, we only ever need an entry for /, because all the rest is totally irrelevant for systemd (it automatically mounts what it needs where it needs it).
But... skeleton-common installs a lot more than just /, no? It installs
/etc/stuff, and a bunch of top-level directories...
Sorry, I missed that this was about fstab, I thought it was about the skeleton
itself.
fstab is not yet mentioned at all in the commit message, so this should be
rephrased a little. But content-wise this is indeed what I wanted.
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 16/20 system: separate sysv and systemd parts of the skeleton
Arnout, All,
On 2017-07-23 15:39 +0200, Arnout Vandecappelle spake thusly:
Quoted 15 lines · Arnout Vandecappelle
Quoted 14 lines · Yann E. MORIN
Quoted 3 lines
Arnout, All,
On 2017-07-23 02:08 +0200, Arnout Vandecappelle spake thusly:
[snip]
Quoted 7 lines
Quoted 1 line
But the commit log should at least explain this.
Like so, maybe?
For systemd, we only ever need an entry for /, because all the rest is totally irrelevant for systemd (it automatically mounts what it needs where it needs it).
Quoted 8 lines
Quoted 2 lines
But... skeleton-common installs a lot more than just /, no? It installs
/etc/stuff, and a bunch of top-level directories...Sorry, I missed that this was about fstab, I thought it was about the skeleton
itself.fstab is not yet mentioned at all in the commit message, so this should be
rephrased a little. But content-wise this is indeed what I wanted.
Ok, good. Thanks!
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 17/20 sytem: no-init systems may use our default, common skeleton
In reply to Yann E. MORINRequiring that no-init system indeed provide their own custom skeletons is a bit too-high a burden, especially for quick one-off tests when testing our packages.
Allow no-init systems to use our default skeleton, but only use the common part, for the specific sysv or systemd ones are unfit.
--- package/skeleton-common/Config.in | 29 +++++++++++++++++++++++++++++ system/Config.in | 5 +---- 2 files changed, 30 insertions(+), 4 deletions(-)
package/skeleton-common/Config.in +29 -0
@@ -1,2 +1,31 @@ +# Normally, skeleton-common is a dependency of either the sysv or +# the systemd ones, so it should not declare itself as a provider +# for the skeleton virtual package. +# +# However, when one uses a no-init system (BR2_INIT_NONE), neither +# the sysv not the systemd skeleton are enabled, so skeleton-common +# is the one and only skeleton available, so it must declare itself +# as a provider. +# +# We can safely select _HAS_SKELETON, because either we are the only +# provider (in which case we must select it) or we were selected by +# another skeleton which would have selected it by itself (in which +# case us selecting _HAS_SKELETON is harmless). +# config BR2_PACKAGE_SKELETON_COMMON bool + select BR2_PACKAGE_HAS_SKELETON + +if BR2_PACKAGE_SKELETON_COMMON + +config BR2_PACKAGE_SKELETON_COMMON_ONLY + bool + default y + depends on !BR2_PACKAGE_SKELETON_SYSV + depends on !BR2_PACKAGE_SKELETON_SYSTEMD + depends on !BR2_PACKAGE_SKELETON_CUSTOM + +config BR2_PACKAGE_PROVIDES_SKELETON + default "skeleton-common" if BR2_PACKAGE_SKELETON_COMMON_ONLY + +endif
system/Config.in +1 -4
@@ -11,16 +11,13 @@ choice # is most probably unfit; so, allow only the custom skeleton in that case. config BR2_ROOTFS_SKELETON_DEFAULT bool "default target skeleton" - depends on !BR2_INIT_NONE select BR2_PACKAGE_SKELETON_SYSV if BR2_INIT_SYSV select BR2_PACKAGE_SKELETON_SYSV if BR2_INIT_BUSYBOX select BR2_PACKAGE_SKELETON_SYSTEMD if BR2_INIT_SYSTEMD + select BR2_PACKAGE_SKELETON_COMMON if BR2_INIT_NONE help Use default target skeleton -comment "default target skeleton needs an init system" - depends on BR2_INIT_NONE - config BR2_ROOTFS_SKELETON_CUSTOM bool "custom target skeleton" select BR2_PACKAGE_SKELETON_CUSTOM
Signature · 1 line
2.11.0
PATCH 17/20 sytem: no-init systems may use our default, common skeleton
Quoted 1 line · Yann E. MORIN
Requiring that no-init system indeed provide their own custom skeletons
systems
Quoted 5 lines
is a bit too-high a burden, especially for quick one-off tests when testing our packages.
Allow no-init systems to use our default skeleton, but only use the common part, for the specific sysv or systemd ones are unfit.
For people who use BR2_INIT_NONE to create a chroot-able rootfs, this entails
an important change: the /var stuff (e.g. /var/run symlink) is no longer there. This could have implications for some use cases. So I think a comment about this should be added to the release notes.
Quoted 20 lines
Reported-by Thomas Petazzoni <[email protected]>Signed-off-by "Yann E. MORIN" <[email protected]>--- package/skeleton-common/Config.in | 29 +++++++++++++++++++++++++++++ system/Config.in | 5 +---- 2 files changed, 30 insertions(+), 4 deletions(-)package/skeleton-common/Config.in +7
-0@@ -1,2 +1,31 @@ +# Normally, skeleton-common is a dependency of either the sysv or +# the systemd ones, so it should not declare itself as a provider +# for the skeleton virtual package. +# +# However, when one uses a no-init system (BR2_INIT_NONE), neither +# the sysv not the systemd skeleton are enabled, so skeleton-common +# is the one and only skeleton available, so it must declare itself
package/skeleton-common/Config.in line 17
Quoted 10 lines
package/skeleton-common/Config.in +8
-0+# as a provider. +# +# We can safely select _HAS_SKELETON, because either we are the only +# provider (in which case we must select it) or we were selected by +# another skeleton which would have selected it by itself (in which +# case us selecting _HAS_SKELETON is harmless). +# config BR2_PACKAGE_SKELETON_COMMON bool + select BR2_PACKAGE_HAS_SKELETON
Instead of putting it here...
package/skeleton-common/Config.in line 26
Quoted 9 lines
package/skeleton-common/Config.in +9
-0+ +if BR2_PACKAGE_SKELETON_COMMON + +config BR2_PACKAGE_SKELETON_COMMON_ONLY + bool + default y + depends on !BR2_PACKAGE_SKELETON_SYSV + depends on !BR2_PACKAGE_SKELETON_SYSTEMD + depends on !BR2_PACKAGE_SKELETON_CUSTOM
... put it here. Then you don't need the comment above, there will always be
just one symbol that selects skeleton.
But as I wrote in an earlier reply, we don't even need to selectBR2_PACKAGE_HAS_SKELETON, so the point is moot.
Regards,
Arnout
[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 17/20 sytem: no-init systems may use our default, common skeleton
Arnout, All,
On 2017-07-23 02:18 +0200, Arnout Vandecappelle spake thusly:
Quoted 48 lines · Yann E. MORIN
Quoted 1 line
Requiring that no-init system indeed provide their own custom skeletons
systems
Quoted 5 lines
is a bit too-high a burden, especially for quick one-off tests when testing our packages.
Allow no-init systems to use our default skeleton, but only use the common part, for the specific sysv or systemd ones are unfit.
For people who use
BR2_INIT_NONEto create a chroot-able rootfs, this entails
an important change: the /var stuff (e.g./var/runsymlink) is no longer there. This could have implications for some use cases. So I think a comment about this should be added to the release notes.Quoted 20 lines
Reported-by Thomas Petazzoni <[email protected]>Signed-off-by "Yann E. MORIN" <[email protected]>--- package/skeleton-common/Config.in | 29 +++++++++++++++++++++++++++++ system/Config.in | 5 +---- 2 files changed, 30 insertions(+), 4 deletions(-)package/skeleton-common/Config.in +7
-0@@ -1,2 +1,31 @@ +# Normally, skeleton-common is a dependency of either the sysv or +# the systemd ones, so it should not declare itself as a provider +# for the skeleton virtual package. +# +# However, when one uses a no-init system (BR2_INIT_NONE), neither +# the sysv not the systemd skeleton are enabled, so skeleton-common +# is the one and only skeleton available, so it must declare itselfpackage/skeleton-common/Config.in line 17
Quoted 10 lines
package/skeleton-common/Config.in +8
-0+# as a provider. +# +# We can safely select _HAS_SKELETON, because either we are the only +# provider (in which case we must select it) or we were selected by +# another skeleton which would have selected it by itself (in which +# case us selecting _HAS_SKELETON is harmless). +# config BR2_PACKAGE_SKELETON_COMMON bool + select BR2_PACKAGE_HAS_SKELETONInstead of putting it here...
Quoted 12 lines
package/skeleton-common/Config.in line 26
Quoted 9 lines
package/skeleton-common/Config.in +9
-0+ +if BR2_PACKAGE_SKELETON_COMMON + +config BR2_PACKAGE_SKELETON_COMMON_ONLY + bool + default y + depends on !BR2_PACKAGE_SKELETON_SYSV + depends on !BR2_PACKAGE_SKELETON_SYSTEMD + depends on !BR2_PACKAGE_SKELETON_CUSTOM... put it here. Then you don't need the comment above, there will always be
just one symbol that selects skeleton.
But, but. but... My nice comment... It took me so much time to write that big, nice, explication... I would be sad to let it go...
Yes, you're right, it would be much cleaner and more obvious.
Quoted 2 lines
But as I wrote in an earlier reply, we don't even need to select
BR2_PACKAGE_HAS_SKELETON, so the point is moot.
And I stand by my previous reply, that we should not try to be smart. Well, we can try to be smart, but not _too_ smart, becasue it _will_ cause grievance later on. ;-]
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 18/20 fs: add pre- and post-command hooks
In reply to Yann E. MORINIn some cases, the directory structure we want in the filesystem is not exactly what we have in target/
For example, when systemd is used on a read-only rootfs, /var must be a tmpfs. However, we may have packages that install stuff in there, and set important rights (via the permission-table). So, at build time, we need /var to be a symlink to the remanent location (/usr/share/factory) while at runtime we need /var to be a directory.
One option would have seen to have /var as a real directory even during build time, and in a target-finalize hook, move everything out of there and into the "factory" location. However, that's not possible because it's too early: some packages may want to set ownership and/or acces rights on directories or files in /var, and this is only done in the fakeroot script, which is called only later during the assembling of the filesystem images.
Also, there would have been no way to undo the tweak (i.e. we need to restore the /var symlink so that subsequent builds continue to work) if it were done as a target-finalize hook.
The only solution is to allow packages to register pre- and post-hooks that are called right before and right after the rootfs commands are executed, and inside in the fakeroot script.
We can however not re-use the BR2_ROOTFS_POST_FAKEROOT_SCRIPT feature either because it is done before the filesystem command, but there is nothing that is done after. Also, we don't want to add to, and modify a user-supplied variable.
So, we introduce two new variables that packages can set to add the commands they need to run to tweak the filesystem right at the last moment.
Those hooks are not documented on-purpose; they are probably going to only ever be used by systemd.
---
Changes v2 -> v3:
- add space between >> and $$ (Romain)
--- fs/common.mk | 4 ++++ package/pkg-generic.mk | 4 ++++ 2 files changed, 8 insertions(+)
fs/common.mk +4 -0
@@ -95,10 +95,14 @@ endif $$(foreach s,$$(call qstrip,$$(BR2_ROOTFS_POST_FAKEROOT_SCRIPT)),\ echo "echo '$$(TERM_BOLD)>>> Executing fakeroot script $$(s)$$(TERM_RESET)'" >> $$(FAKEROOT_SCRIPT); \ echo $$(s) $$(TARGET_DIR) $$(BR2_ROOTFS_POST_SCRIPT_ARGS) >> $$(FAKEROOT_SCRIPT)$$(sep)) + $$(foreach hook,$$(ROOTFS_PRE_CMD_HOOKS),\ + $$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)) ifeq ($$(BR2_REPRODUCIBLE),y) echo "find $$(TARGET_DIR) -print0 | xargs -0 -r touch -hd @$$(SOURCE_DATE_EPOCH)" >> $$(FAKEROOT_SCRIPT) endif $$(call PRINTF,$$(ROOTFS_$(2)_CMD)) >> $$(FAKEROOT_SCRIPT) + $$(foreach hook,$$(ROOTFS_POST_CMD_HOOKS),\ + $$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)) chmod a+x $$(FAKEROOT_SCRIPT) PATH=$$(BR_PATH) $$(HOST_DIR)/bin/fakeroot -- $$(FAKEROOT_SCRIPT) $$(INSTALL) -m 0644 support/misc/target-dir-warning.txt $$(TARGET_DIR_WARNING_FILE)
package/pkg-generic.mk +4 -0
@@ -612,6 +612,8 @@ $(2)_POST_INSTALL_IMAGES_HOOKS ?= $(2)_PRE_LEGAL_INFO_HOOKS ?= $(2)_POST_LEGAL_INFO_HOOKS ?= $(2)_TARGET_FINALIZE_HOOKS ?= +$(2)_ROOTFS_PRE_CMD_HOOKS ?= +$(2)_ROOTFS_POST_CMD_HOOKS ?= # human-friendly targets and target sequencing $(1): $(1)-install
@@ -931,6 +933,8 @@ ifneq ($$($(2)_USERS),) PACKAGES_USERS += $$($(2)_USERS)$$(sep) endif TARGET_FINALIZE_HOOKS += $$($(2)_TARGET_FINALIZE_HOOKS) +ROOTFS_PRE_CMD_HOOKS += $$($(2)_ROOTFS_PRE_CMD_HOOKS) +ROOTFS_POST_CMD_HOOKS += $$($(2)_ROOTFS_POST_CMD_HOOKS) ifeq ($$($(2)_SITE_METHOD),svn) DL_TOOLS_DEPENDENCIES += svn
Signature · 1 line
2.11.0
PATCH 18/20 fs: add pre- and post-command hooks
Hi Yann,
Quoted 21 lines · Yann E. MORIN
In some cases, the directory structure we want in the filesystem is not exactly what we have in target/
For example, when systemd is used on a read-only rootfs, /var must be a tmpfs. However, we may have packages that install stuff in there, and set important rights (via the permission-table). So, at build time, we need /var to be a symlink to the remanent location (
/usr/share/factory) while at runtime we need /var to be a directory.One option would have seen to have /var as a real directory even during build time, and in a target-finalize hook, move everything out of there and into the "factory" location. However, that's not possible because it's too early: some packages may want to set ownership and/or acces rights on directories or files in /var, and this is only done in the fakeroot script, which is called only later during the assembling of the filesystem images.
Also, there would have been no way to undo the tweak (i.e. we need to restore the /var symlink so that subsequent builds continue to work) if it were done as a target-finalize hook.
Quoted 8 lines
The only solution is to allow packages to register pre- and post-hooks that are called right before and right after the rootfs commands are executed, and inside in the fakeroot script.
We can however not re-use the
BR2_ROOTFS_POST_FAKEROOT_SCRIPTfeature either because it is done before the filesystem command, but there is nothing that is done after. Also, we don't want to add to, and modify a user-supplied variable.
I completely agree with this approach.
Quoted 4 lines
So, we introduce two new variables that packages can set to add the commands they need to run to tweak the filesystem right at the last moment.
But not with this.
Quoted 2 lines
Those hooks are not documented on-purpose; they are probably going to only ever be used by systemd.
If systemd is the only one ever to use it, then the approach with a list of
hooks is just too much over the top. Why not hardcode it? Like so:
Quoted 16 lines
Signed-off-by "Yann E. MORIN" <[email protected]>Reviewed-by Romain Naour <[email protected]>---
Changes v2 -> v3:
- add space between >> and $$ (Romain)--- fs/common.mk | 4 ++++ package/pkg-generic.mk | 4 ++++ 2 files changed, 8 insertions(+)fs/common.mk +0
-0
fs/common.mk endif · line 99
Quoted 5 lines
fs/common.mk +2
-0@@ -95,10 +95,14 @@ endif $$(foreach s,$$(call qstrip,$$(BR2_ROOTFS_POST_FAKEROOT_SCRIPT)),\ echo "echo '$$(TERM_BOLD)>>> Executing fakeroot script $$(s)$$(TERM_RESET)'" >> $$(FAKEROOT_SCRIPT); \ echo $$(s) $$(TARGET_DIR) $$(BR2_ROOTFS_POST_SCRIPT_ARGS) >> $$(FAKEROOT_SCRIPT)$$(sep)) + $$(foreach hook,$$(ROOTFS_PRE_CMD_HOOKS),\ + $$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT))
$$(call PRINTF,$$(ROOTFS_SKELETON_PRE_CMD_HOOK)) >> $$(FAKEROOT_SCRIPT)
You may want to change the variable name, obviously.
Regards,
Arnout
[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 18/20 fs: add pre- and post-command hooks
Arnout, All,
On 2017-07-23 15:42 +0200, Arnout Vandecappelle spake thusly:
Quoted 70 lines · Yann E. MORIN
Quoted 21 lines
In some cases, the directory structure we want in the filesystem is not exactly what we have in target/
For example, when systemd is used on a read-only rootfs, /var must be a tmpfs. However, we may have packages that install stuff in there, and set important rights (via the permission-table). So, at build time, we need /var to be a symlink to the remanent location (
/usr/share/factory) while at runtime we need /var to be a directory.One option would have seen to have /var as a real directory even during build time, and in a target-finalize hook, move everything out of there and into the "factory" location. However, that's not possible because it's too early: some packages may want to set ownership and/or acces rights on directories or files in /var, and this is only done in the fakeroot script, which is called only later during the assembling of the filesystem images.
Also, there would have been no way to undo the tweak (i.e. we need to restore the /var symlink so that subsequent builds continue to work) if it were done as a target-finalize hook.
Quoted 8 lines
The only solution is to allow packages to register pre- and post-hooks that are called right before and right after the rootfs commands are executed, and inside in the fakeroot script.
We can however not re-use the
BR2_ROOTFS_POST_FAKEROOT_SCRIPTfeature either because it is done before the filesystem command, but there is nothing that is done after. Also, we don't want to add to, and modify a user-supplied variable.I completely agree with this approach.
Quoted 4 lines
So, we introduce two new variables that packages can set to add the commands they need to run to tweak the filesystem right at the last moment.
But not with this.
Quoted 2 lines
Those hooks are not documented on-purpose; they are probably going to only ever be used by systemd.
If systemd is the only one ever to use it, then the approach with a list of
hooks is just too much over the top. Why not hardcode it? Like so:Quoted 16 lines
Signed-off-by "Yann E. MORIN" <[email protected]>Reviewed-by Romain Naour <[email protected]>---
Changes v2 -> v3:
- add space between >> and $$ (Romain)--- fs/common.mk | 4 ++++ package/pkg-generic.mk | 4 ++++ 2 files changed, 8 insertions(+)fs/common.mk +0
-0fs/common.mk endif · line 99
Quoted 5 lines
fs/common.mk +2
-0@@ -95,10 +95,14 @@ endif $$(foreach s,$$(call qstrip,$$(BR2_ROOTFS_POST_FAKEROOT_SCRIPT)),\ echo "echo '$$(TERM_BOLD)>>> Executing fakeroot script $$(s)$$(TERM_RESET)'" >> $$(FAKEROOT_SCRIPT); \ echo $$(s) $$(TARGET_DIR) $$(BR2_ROOTFS_POST_SCRIPT_ARGS) >> $$(FAKEROOT_SCRIPT)$$(sep)) + $$(foreach hook,$$(ROOTFS_PRE_CMD_HOOKS),\ + $$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT))$$(call PRINTF,$$(ROOTFS_SKELETON_PRE_CMD_HOOK)) >> $$(FAKEROOT_SCRIPT)
Quoted 1 line
You may want to change the variable name, obviously.
And it also means that the declaration of ROOTFS_SKELETON_PRE_CMD_HOOK be conditional in the skeleton-systemd package, like:
ifeq ($(BR2_PACKAGE_SKELETON_SYSTEMD),y)
define ROOTFS_SKELETON_PRE_CMD_HOOK
blabla
endef
endifBut I do not like these kind of constructs in the packages themselves, because they are too easy to miss...
Alternatively, I would rather move that logic into the filesystem code itself, because after all that is its responsibility, and guard its use with something like (with a proper variable name, of course):
ifeq ($(ROOTFS_VAR_FACTORY_BLABLA),YES)
blabla...
endifAnd then have the packages that need it just set:
ROOTFS_VAR_FACTORY_BLABLA = YES
All that, because Thomas already suggested (last year in Toulouse) that we could re-use the same factory mechanism for the other init systems as well (on read-only rootfs). In this case, the code would then be guarded by an test against an empty $(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW), because then there would be no relation to an init system at all.
But the tmpfiles format is very specific to systemd; we'd have to write our own parser for that (not too difficult, I think, but it'd run on the target so it'd have to be really dead-simple).
So in the end, I'd remove the hooks and move the code to the fs handling, protected by a conditional that so far only systemd would set.
OK with this new approach?
Still, there is yet ine thing that I dislike in this solution, whether it be with hooks or the variable, and that noone has seen so far: it is not atomic and the target/ directory will be broken if the filesystem command fails right in the middle, before the var symlink was restored.
I have seen no solution to this issue, except doing a copy of target first, right before assembling the image(s), becasue in that case, we wouldn't care about restoring the previous status, so we would no longer need atomicity.
Regards,
Yann E. MORIN.
Quoted 13 lines
Regards,
Arnout[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 18/20 fs: add pre- and post-command hooks
Quoted 3 lines · Yann E. MORIN
Arnout, All,
On 2017-07-23 15:42 +0200, Arnout Vandecappelle spake thusly:
[snip]
Quoted 7 lines
Quoted 3 lines
$$(call PRINTF,$$(ROOTFS_SKELETON_PRE_CMD_HOOK)) >> $$(FAKEROOT_SCRIPT)You may want to change the variable name, obviously.
And it also means that the declaration of
ROOTFS_SKELETON_PRE_CMD_HOOKbe conditional in the skeleton-systemd package, like:
Quoted 8 lines
ifeq ($(BR2_PACKAGE_SKELETON_SYSTEMD),y) define ROOTFS_SKELETON_PRE_CMD_HOOK blabla endef endifBut I do not like these kind of constructs in the packages themselves, because they are too easy to miss...
I'm not sure if it's that hard to miss. You just grep forROOTFS_SKELETON_PRE_CMD_HOOK to get the context.
Quoted 10 lines
Alternatively, I would rather move that logic into the filesystem code itself, because after all that is its responsibility, and guard its use with something like (with a proper variable name, of course):
ifeq ($(ROOTFS_VAR_FACTORY_BLABLA),YES) blabla... endifAnd then have the packages that need it just set:
ROOTFS_VAR_FACTORY_BLABLA= YES
I'm not so sure I like that better...
Quoted 5 lines
All that, because Thomas already suggested (last year in Toulouse) that we could re-use the same factory mechanism for the other init systems as well (on read-only rootfs). In this case, the code would then be guarded by an test against an empty $(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW), because then there would be no relation to an init system at all.
You completely lost me here.
Quoted 8 lines
But the tmpfiles format is very specific to systemd; we'd have to write our own parser for that (not too difficult, I think, but it'd run on the target so it'd have to be really dead-simple).
So in the end, I'd remove the hooks and move the code to the fs handling, protected by a conditional that so far only systemd would set.
OK with this new approach?
I'm not so convinced. I mean, if you're putting systemd-specific code intoROOTFS_TARGET_INTERNAL, you might just as well make that bit depend on BR2_INIT_SYSTEMD directly. But then it becomes really too intertwined for my liking. I think my ROOTFS_SKELETON_PRE_CMD_HOOK proposal is a better middle ground between complexity and abstraction. If you really don't like that, I prefer the original ROOTFS_PRE_CMD_HOOKS approach. I just think that giving the possibility of defining more than one hook is useless. Particularly since the systemd hook hinges on being the very last thing before rootfs creation.
Quoted 4 lines
Still, there is yet ine thing that I dislike in this solution, whether it be with hooks or the variable, and that noone has seen so far: it is not atomic and the target/ directory will be broken if the filesystem command fails right in the middle, before the var symlink was restored.
Can we create the symlink early in the build process, every time? I.e. runSKELETON_SYSTEMD_POST_ROOTFS_VAR somehwere at the start of the build as well? Only, I'm not sure where we could put it.
Regards,
Arnout
Quoted 4 lines
I have seen no solution to this issue, except doing a copy of target first, right before assembling the image(s), becasue in that case, we wouldn't care about restoring the previous status, so we would no longer need atomicity.
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 18/20 fs: add pre- and post-command hooks
On 2017-07-23 23:51 +0200, Arnout Vandecappelle spake thusly:
Quoted 31 lines · Yann E. MORIN
Quoted 3 lines
Arnout, All,
On 2017-07-23 15:42 +0200, Arnout Vandecappelle spake thusly:
[snip]
Quoted 7 lines
Quoted 3 lines
$$(call PRINTF,$$(ROOTFS_SKELETON_PRE_CMD_HOOK)) >> $$(FAKEROOT_SCRIPT)You may want to change the variable name, obviously.
And it also means that the declaration of
ROOTFS_SKELETON_PRE_CMD_HOOKbe conditional in the skeleton-systemd package, like:Quoted 8 lines
ifeq ($(BR2_PACKAGE_SKELETON_SYSTEMD),y) define ROOTFS_SKELETON_PRE_CMD_HOOK blabla endef endifBut I do not like these kind of constructs in the packages themselves, because they are too easy to miss...
I'm not sure if it's that hard to miss. You just grep for
ROOTFS_SKELETON_PRE_CMD_HOOKto get the context.Quoted 4 lines
Alternatively, I would rather move that logic into the filesystem code itself, because after all that is its responsibility, and guard its use with something like (with a proper variable name, of course):
Quoted 8 lines
Quoted 6 lines
ifeq ($(ROOTFS_VAR_FACTORY_BLABLA),YES) blabla... endifAnd then have the packages that need it just set:
ROOTFS_VAR_FACTORY_BLABLA= YESI'm not so sure I like that better...
I'm not sure either, but I'll further explain below, so you get a better picture than the blurred one I posted yesterday...
Quoted 7 lines
Quoted 5 lines
All that, because Thomas already suggested (last year in Toulouse) that we could re-use the same factory mechanism for the other init systems as well (on read-only rootfs). In this case, the code would then be guarded by an test against an empty $(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW), because then there would be no relation to an init system at all.
You completely lost me here.
Ah...
So, the factory is something that is indeed specific to systemd.
However, it allows for a systemd-based rootfs to start with a known first-boot state, that is put in place early, before applications/services need them.
IWith this patch, it means that every boot if a first-boot, but at least the content of /var is what packages isntalled, and they know it is writable.
But with the other init systems (busybox, syysvinit) we do not have a factory. Instead /var contains only symlinks to /tmp, which is clean on boot. So packages won't find what they need in /var, either:
- it is redirected to /tmp, in which case it is empty, or
- it is not redirected to /tmp, and it is read-only.
So Thomas suggested that we apply the factory feature to all init systems. With systemd, it would be built-in (by mean of tmpfiles), while for the others we'd need some extra startup scripts to mount a tmpfs on /var and populate it.
Quoted 4 lines
Quoted 4 lines
But the tmpfiles format is very specific to systemd; we'd have to write our own parser for that (not too difficult, I think, but it'd run on the target so it'd have to be really dead-simple).
Quoted 8 lines
Quoted 4 lines
So in the end, I'd remove the hooks and move the code to the fs handling, protected by a conditional that so far only systemd would set.
OK with this new approach?
I'm not so convinced. I mean, if you're putting systemd-specific code into
ROOTFS_TARGET_INTERNAL, you might just as well make that bit depend onBR2_INIT_SYSTEMDdirectly.
But then it is no longer systemd-specific, see above.
Quoted 8 lines
But then it becomes really too intertwined for my
liking. I think myROOTFS_SKELETON_PRE_CMD_HOOKproposal is a better middle ground between complexity and abstraction. If you really don't like that, I prefer the originalROOTFS_PRE_CMD_HOOKSapproach. I just think that giving the possibility of defining more than one hook is useless. Particularly since the systemd hook hinges on being the very last thing before rootfs creation.
Quoted 8 lines
Quoted 4 lines
Still, there is yet ine thing that I dislike in this solution, whether it be with hooks or the variable, and that noone has seen so far: it is not atomic and the target/ directory will be broken if the filesystem command fails right in the middle, before the var symlink was restored.
Can we create the symlink early in the build process, every time? I.e. run
SKELETON_SYSTEMD_POST_ROOTFS_VARsomehwere at the start of the build as well? Only, I'm not sure where we could put it.
Hmm... Good point. I'll try to find a place. But I'm not sure that would be possible.
Maybe with the step-hooks, that are called very early for all steps, and then we'd use that to create the symlink if missing. But I do not like that too much...
I'll investigate.
In the meantime, I'll drop the read-only patches from the series, to avoid too much noise for now, and so we concentrate on the skeleton stuff for this release.
Thanks!
Regards,
Yann E. MORIN.
Quoted 16 lines
Regards,
ArnoutQuoted 4 lines
I have seen no solution to this issue, except doing a copy of target first, right before assembling the image(s), becasue in that case, we wouldn't care about restoring the previous status, so we would no longer need atomicity.
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 18/20 fs: add pre- and post-command hooks
Quoted 1 line · Yann E. MORIN
On 2017-07-23 23:51 +0200, Arnout Vandecappelle spake thusly:
[snip]
Quoted 4 lines
So Thomas suggested that we apply the factory feature to all init systems. With systemd, it would be built-in (by mean of tmpfiles), while for the others we'd need some extra startup scripts to mount a tmpfs on /var and populate it.
Hum-hum, I thought that the Buildroot rule was: we don't add features. If
someone needs the factory feature, they should use systemd (or s6 I believe also has some kind of factory feature).
[snip]
Quoted 6 lines
Quoted 3 lines
Can we create the symlink early in the build process, every time? I.e. run
SKELETON_SYSTEMD_POST_ROOTFS_VARsomehwere at the start of the build as well? Only, I'm not sure where we could put it.Hmm... Good point. I'll try to find a place. But I'm not sure that would be possible.
"dependencies" is an option, but that's *really* dirty.
Perhaps we can add a stamp file to TARGET_DIR/usr/share/factory, and then add
TARGET_DIR/var/stampfile as a dependency of dirs. If TARGET_DIR/var is an (empty) directory, then TARGET_DIR/var/stampfile will not exist so the rule will trigger.
But there are a few problems with that:
- dirs is also "called" for legal-info, but legal-info doesn't otherwise create a target directory;
- it would be natural for this stampfile to depend on skeleton-systemd (which can then create the stampfile), but that would give a circular dependency.
Quoted 3 lines
Maybe with the step-hooks, that are called very early for all steps, and then we'd use that to create the symlink if missing. But I do not like that too much...
Meh, no, that would repeat the check for *every* package...
Quoted 5 lines
I'll investigate.
In the meantime, I'll drop the read-only patches from the series, to avoid too much noise for now, and so we concentrate on the skeleton stuff for this release.
I think it's better if you still include them:
- it doesn't hurt if they are part of the series but don't get applied;
- it gives some context about the direction in which we are going;
- it gives an opportunity to continue discussion on these patches.
Even if you re-post with some changes NOT applied, just say so in the commit
message. Perhaps remove your Sob to make sure it doesn't get applied by accident. Or remove it from patchwork.
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 19/20 system: make systemd work on a read-only rootfs
In reply to Yann E. MORINWhen the rootfs is readonly, systemd will expect /var to be writable. Because we do not really have a R/W filesystem to mount on /var, we make it a tmpfs [*], and use the systemd-tmpfiles feature to populate it with "factory" defaults.
We obtain those factory defaults by redirecting /var to that location at build time, using a symlink /var -> /usr/share/factory which is the location in which systemd-tmpfiles will look for when instructed to "recursively copy" a directory.
With a line like:
C /var/something - - - -
it will look for /usr/share/factory/something and copy it (recursively if it is a directory) to /var/something, but only if it does not already exist there.
We also mark this copy with the exclamation mark, as it is only safe to copy on boot, not when changing targets.
To be noted: the real format for such lines are:
C /var/something - - - - /from/where/to/copy/something
But if the source is not given, then it is implicitly taken from /usr/share/factory (which in our case is as-good a location as whatever else, so we use it, and thus we need not specify the source of the copy).
Note that we treat symlinks a little bit specially, by creating symlinks to the factory defaults rather than copying them.
Finally, /var at build time is a symlink, but at runtime, it must be a directory (so we can mount the tmpfs over there). We can't change that as a target-finalize hook, because:
- some packages may want to set ownership and/or access rights on files or directories in /var, and that only happens while assembling the filesystem images; changing /var from a symlink to a (then empty) directory would break this;
- /var would be a directory on sub-sequent builds (until the next
"make clean").
Instead, we use the newly-introduce pre- and post-rootfs command hooks, to turn /var into a directory before assembling the image, and back to a symlink after assembling the image.
[*] People who want the factory-defaults only on first boot will have
to tweak the fstab to mount something else than a tmpfs on /var.
---
Changes v2 -> v3;
- fix typoes in commit log (Romain)
--- package/skeleton-systemd/skeleton-systemd.mk | 50 ++++++++++++++++++++++++++-- system/Config.in | 1 - 2 files changed, 48 insertions(+), 3 deletions(-)
package/skeleton-systemd/skeleton-systemd.mk +48 -2
@@ -15,11 +15,57 @@ SKELETON_SYSTEMD_DEPENDENCIES = skeleton-common SKELETON_SYSTEMD_PROVIDES = skeleton +ifeq ($(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW),y) + +define SKELETON_SYSTEMD_ROOT_RO_OR_RW + echo "/dev/root / auto rw 0 1" >$(TARGET_DIR)/etc/fstab + mkdir -p $(TARGET_DIR)/var +endef + +else + +# On a R/O rootfs, /var is a tmpfs filesystem. So, at build time, we +# redirect /var to the "factory settings" location. Just before the +# filesystem gets created, the /var symlink will be replaced with +# a real (but empty) directory, and the "factory files" will be copied +# back there by the tmpfiles.d mechanism. +define SKELETON_SYSTEMD_ROOT_RO_OR_RW + mkdir -p $(TARGET_DIR)/etc/systemd/tmpfiles.d + mkdir -p $(TARGET_DIR)/usr/share/factory + ln -s usr/share/factory $(TARGET_DIR)/var + echo "/dev/root / auto ro 0 1" >$(TARGET_DIR)/etc/fstab + echo "tmpfs /var tmpfs mode=1777 0 0" >>$(TARGET_DIR)/etc/fstab +endef + +define SKELETON_SYSTEMD_PRE_ROOTFS_VAR + rm -f $(TARGET_DIR)/var + mkdir $(TARGET_DIR)/var + for i in $(TARGET_DIR)/usr/share/factory/*; do \ + j="$${i##*/}"; \ + if [ -L "$${i}" ]; then \ + printf "L+! /var/%s - - - - %s\n" \ + "$${j}" "../usr/share/factory/$${j}" \ + || exit 1; \ + else \ + printf "C! /var/%s - - - -\n" "$${j}" \ + || exit 1; \ + fi; \ + done >$(TARGET_DIR)/etc/systemd/tmpfiles.d/var-factory.conf +endef +SKELETON_SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SKELETON_SYSTEMD_PRE_ROOTFS_VAR + +define SKELETON_SYSTEMD_POST_ROOTFS_VAR + rm -rf $(TARGET_DIR)/var + ln -s usr/share/factory $(TARGET_DIR)/var +endef +SKELETON_SYSTEMD_ROOTFS_POST_CMD_HOOKS += SKELETON_SYSTEMD_POST_ROOTFS_VAR + +endif + define SKELETON_SYSTEMD_INSTALL_TARGET_CMDS mkdir -p $(TARGET_DIR)/home mkdir -p $(TARGET_DIR)/srv - mkdir -p $(TARGET_DIR)/var - echo "/dev/root / auto rw 0 1" >$(TARGET_DIR)/etc/fstab + $(SKELETON_SYSTEMD_ROOT_RO_OR_RW) endef $(eval $(generic-package))
system/Config.in +0 -1
@@ -138,7 +138,6 @@ config BR2_INIT_SYSTEMD depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_10 select BR2_ROOTFS_MERGED_USR select BR2_PACKAGE_SYSTEMD - select BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW if BR2_ROOTFS_SKELETON_DEFAULT comment "systemd needs a glibc toolchain, headers >= 3.10" depends on !(BR2_TOOLCHAIN_USES_GLIBC \
Signature · 1 line
2.11.0
PATCH 19/20 system: make systemd work on a read-only rootfs
On 18-07-17 19:25, Yann E. MORIN wrote:
[snip]
Quoted 7 lines
With a line like:
C
/var/something- - - -it will look for
/usr/share/factory/somethingand copy it (recursively if it is a directory) to/var/something, but only if it does not already exist there.
So we could just have a line
C /var - - - -
and be done with it?
[snip]
Quoted 2 lines
Note that we treat symlinks a little bit specially, by creating symlinks to the factory defaults rather than copying them.
You forgot to explain why. I guess because a relative symlink that was created
based on the /usr/share/factory location wouldn't work any more.
However, it is possible that a package creates a relative symlink based on the
/var location. Most symlinks that we create in Buildroot stupidly assume that all the path components are not symlinks. So a package could for example do
ln -sf ../srv/www $DESTDIR/var/www
This will now create a broken symlink. It's fine as long as it is copied as-is to /var, but not with your approach...
[snip]
package/skeleton-systemd/skeleton-systemd.mk SKELETON_SYSTEMD_DEPENDENCIES = skeleton-common · line 35
Quoted 4 lines
package/skeleton-systemd/skeleton-systemd.mk +4
-0+define SKELETON_SYSTEMD_ROOT_RO_OR_RW + mkdir -p $(TARGET_DIR)/etc/systemd/tmpfiles.d + mkdir -p $(TARGET_DIR)/usr/share/factory + ln -s usr/share/factory $(TARGET_DIR)/var
Since other stuff may also want to put things in /usr/share/factory, I think it
should be
mkdir -p $(TARGET_DIR)/usr/share/factory/var ln -s usr/share/factory/var $(TARGET_DIR)/var
Regards,
Arnout
[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 19/20 system: make systemd work on a read-only rootfs
Arnout, All,
On 2017-07-24 00:18 +0200, Arnout Vandecappelle spake thusly:
Quoted 10 lines · Yann E. MORIN
[snip]
Quoted 7 lines
With a line like:
C
/var/something- - - -it will look for
/usr/share/factory/somethingand copy it (recursively if it is a directory) to/var/something, but only if it does not already exist there.
Quoted 5 lines
So we could just have a line
C /var - - - -
and be done with it?
No, because systemd-tmpfiles will only act if the entry does not exist. But our case, /var does exist, and it is a mount point. We must have /var to exist, because / is read-only.
If we were to use your construct, then systemd-tmpfiles would never do anything at all.
From TMPFILES.D(5):
C
Recursively copy a file or directory, if the destination files or directories do not exist yet. Note that this command will not descend into subdirectories if the destination directory already exists. Instead, the entire copy operation is skipped. If the argument is omitted, files from the source directory /usr/share/factory/ with the same name are copied. Does not follow symlinks.
So we must have one tmpfile entry for each entry we need in /var/.
Quoted 7 lines
[snip]
Quoted 2 lines
Note that we treat symlinks a little bit specially, by creating symlinks to the factory defaults rather than copying them.
You forgot to explain why. I guess because a relative symlink that was created
based on the/usr/share/factorylocation wouldn't work any more.
Quoted 8 lines
However, it is possible that a package creates a relative symlink based on the
/var location. Most symlinks that we create in Buildroot stupidly assume that all the path components are not symlinks. So a package could for example doln -sf ../srv/www $DESTDIR/var/www
This will now create a broken symlink. It's fine as long as it is copied as-is to /var, but not with your approach...
Hmm... I'll have to think about that a bit more, even though I think I have taken that into account...
At least I did see no breakage so far, but the set of packages I built was arguably rather limited...
Quoted 10 lines
[snip]
package/skeleton-systemd/skeleton-systemd.mk SKELETON_SYSTEMD_DEPENDENCIES = skeleton-common · line 35
Quoted 4 lines
package/skeleton-systemd/skeleton-systemd.mk +4
-0+define SKELETON_SYSTEMD_ROOT_RO_OR_RW + mkdir -p $(TARGET_DIR)/etc/systemd/tmpfiles.d + mkdir -p $(TARGET_DIR)/usr/share/factory + ln -s usr/share/factory $(TARGET_DIR)/varSince other stuff may also want to put things in
/usr/share/factory, I think it
should bemkdir -p $(TARGET_DIR)/usr/share/factory/var ln -s usr/share/factory/var $(TARGET_DIR)/var
Not really, because systemd-tmpfile will look in exactly the factory path to find the source of the copy/link. See the exerpt I pasted above.
So, given this entry, for example:
C /var/foo - - - -
systemd-tmpfiles will see if it can find /usr/share/factory/foo not /usr/share/factory/var/foo
And if other packages install things in factory, they would most probably install their own tmpfile description to copy it in place on boot, becasue factory *is* for factory settings.
Thanks!
Regards,
Yann E. MORIN.
Quoted 12 lines
Regards,
Arnout[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 19/20 system: make systemd work on a read-only rootfs
Quoted 15 lines · Yann E. MORIN
Arnout, All,
On 2017-07-24 00:18 +0200, Arnout Vandecappelle spake thusly:
Quoted 12 lines · Yann E. MORIN
[snip]
Quoted 7 lines
With a line like:
C
/var/something- - - -it will look for
/usr/share/factory/somethingand copy it (recursively if it is a directory) to/var/something, but only if it does not already exist there.So we could just have a line
Quoted 7 lines
Quoted 3 lines
C /var - - - -
and be done with it?
No, because systemd-tmpfiles will only act if the entry does not exist. But our case, /var does exist, and it is a mount point. We must have /var to exist, because / is read-only.
Right! I knew that, actually... You even wrote it there :-)
Thinking out of the box: can we make /var a symlink to /tmp/var, and avoid
creating a tmpfs on /var at all? Since /tmp/var doesn't exist, "C! /tmp/var" should work, no? Or did that cause journald to bail out?
[snip]
Quoted 8 lines
Quoted 8 lines
However, it is possible that a package creates a relative symlink based on the
/var location. Most symlinks that we create in Buildroot stupidly assume that all the path components are not symlinks. So a package could for example doln -sf ../srv/www $DESTDIR/var/www
This will now create a broken symlink. It's fine as long as it is copied as-is to /var, but not with your approach...
Note that this is *NOT* fine anymore if /var is a symlink to /tmp/var ...
Quoted 2 lines
Hmm... I'll have to think about that a bit more, even though I think I have taken that into account...
There is unfortunately no way to fix this. If the package is smart, it does
calculates the relative path based on the real path of the source and destination. If the package is stupid, it just assumes ../something. Whatever we do, one of them will break... The only safe approach would be to put stuff in /factory instead of /usr/share/factory.
Quoted 17 lines
At least I did see no breakage so far, but the set of packages I built was arguably rather limited...
Quoted 10 lines
[snip]
package/skeleton-systemd/skeleton-systemd.mk SKELETON_SYSTEMD_DEPENDENCIES = skeleton-common · line 35
Quoted 4 lines
package/skeleton-systemd/skeleton-systemd.mk +4
-0+define SKELETON_SYSTEMD_ROOT_RO_OR_RW + mkdir -p $(TARGET_DIR)/etc/systemd/tmpfiles.d + mkdir -p $(TARGET_DIR)/usr/share/factory + ln -s usr/share/factory $(TARGET_DIR)/varSince other stuff may also want to put things in
/usr/share/factory, I think it
should bemkdir -p $(TARGET_DIR)/usr/share/factory/var ln -s usr/share/factory/var $(TARGET_DIR)/varNot really, because systemd-tmpfile will look in exactly the factory path to find the source of the copy/link. See the exerpt I pasted above.
Quoted 6 lines
So, given this entry, for example:
C /var/foo - - - -systemd-tmpfiles will see if it can find
/usr/share/factory/foonot/usr/share/factory/var/foo
Weird, the way I read both the man page and the source code seem to suggest
that "C /var/something" will copy from /usr/share/factory/var/something... But I guess you tested that so I must be misreading the source code.
Quoted 3 lines
And if other packages install things in factory, they would most probably install their own tmpfile description to copy it in place on boot, becasue factory *is* for factory settings.
Yes but you could have a name collision.
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 19/20 system: make systemd work on a read-only rootfs
Arnout, All,
On 2017-07-25 00:44 +0200, Arnout Vandecappelle spake thusly:
Quoted 3 lines · Yann E. MORIN
Quoted 2 lines
On 2017-07-24 00:18 +0200, Arnout Vandecappelle spake thusly:
Quoted 1 line · Yann E. MORIN
[--SNIP--]
Quoted 3 lines
Thinking out of the box: can we make /var a symlink to
/tmp/var, and avoid
creating a tmpfs on /var at all? Since/tmp/vardoesn't exist, "C!/tmp/var" should work, no? Or did that cause journald to bail out?
Worth a try, of course. But still we'd need hoks of some kind to allow package to install in /var at build time, and move that to factory at the end of the build, while still preserving the ability to be able to rebuild stuff without requiring a 'make clean'.
[--SNIP symlinks in /var--]
Quoted 5 lines
There is unfortunately no way to fix this. If the package is smart, it does
calculates the relative path based on the real path of the source and destination. If the package is stupid, it just assumes ../something. Whatever we do, one of them will break... The only safe approach would be to put stuff in /factory instead of/usr/share/factory.
But that is not where systemd-tmpfiles will look at...
Unless you meant we have /factory during the build, then move it at the moment we aggregaate the images, and move it back (moving the problem from handling /var to handling /factory instead) ?
[--SNIP--]
Quoted 5 lines
Quoted 5 lines
Not really, because systemd-tmpfile will look in exactly the factory path to find the source of the copy/link. See the exerpt I pasted above.
So, given this entry, for example:
Quoted 8 lines
Quoted 4 lines
C /var/foo - - - -systemd-tmpfiles will see if it can find
/usr/share/factory/foonot/usr/share/factory/var/fooWeird, the way I read both the man page and the source code seem to suggest
that "C/var/something" will copy from/usr/share/factory/var/something... But I guess you tested that so I must be misreading the source code.
And of course you are right.
It just happened that my testing was borked because systemd (or one of its minions like journald) would create the required directory structure and files they need, so I did not see mine were not copied over. Now I have another test that does not use those "standard" files, and I'll add it to the testing infra.
So yes, it should be /usr/share/factory/var/foo to populate /var/foo.
Which led to another bug, which is that tmpfiles should be in /etc/tmpfiles.d/ and not in /etc/systemd/tmpfiles.d/
I've now fixed that.
However (thinking aloud now), I have another tentative to do, which instead of creating a symlink for /var at runtime, would just creat it as a direcotry as expected.
Then the hooks would simply "mv /var /usr/share/factory/var; mkdir /var", create the tmpfiles entries, aggregate the image(s), the rm -rf /var; mv /usr/share/factory/var /var".
This is probably much simpler than moving the entries one by one.
The only drawback in this case would be a package that already creates a factory/var/foo entry. It would end up in /var/foo afterwards... :-/ So I think the /var symlink is better, in fact, so I'll keep that.
Thanks! :-)
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 19/20 system: make systemd work on a read-only rootfs
Quoted 7 lines · Yann E. MORIN
Arnout, All,
On 2017-07-25 00:44 +0200, Arnout Vandecappelle spake thusly:
Quoted 3 lines · Yann E. MORIN
Quoted 2 lines
On 2017-07-24 00:18 +0200, Arnout Vandecappelle spake thusly:
Quoted 1 line · Yann E. MORIN
[--SNIP--]
Quoted 8 lines
Quoted 3 lines
Thinking out of the box: can we make /var a symlink to
/tmp/var, and avoid
creating a tmpfs on /var at all? Since/tmp/vardoesn't exist, "C!/tmp/var" should work, no? Or did that cause journald to bail out?Worth a try, of course. But still we'd need hoks of some kind to allow package to install in /var at build time, and move that to factory at the end of the build, while still preserving the ability to be able to rebuild stuff without requiring a 'make clean'.
I forgot to add: and create a symlink from /tmp/var to/usr/share/factory/tmp/var. That way stuff will still get installed directly into /usr/share/factory/tmp/var. We don't need to remove any of the symlinks,
however: when the tmpfs is mounted over /tmp, the symlink magically disappears.
But that still doesn't fix:
Quoted 8 lines
[--SNIP symlinks in /var--]
Quoted 5 lines
There is unfortunately no way to fix this. If the package is smart, it does
calculates the relative path based on the real path of the source and destination. If the package is stupid, it just assumes ../something. Whatever we do, one of them will break... The only safe approach would be to put stuff in /factory instead of/usr/share/factory.But that is not where systemd-tmpfiles will look at...
Yes, then we'd still have to copy/move /factory to /usr/share/factory.
BTW, systemd-tmpfiles will look at anywhere you tell it to look:
C! /var - - - - /factory/var
Quoted 3 lines
Unless you meant we have /factory during the build, then move it at the moment we aggregaate the images, and move it back (moving the problem from handling /var to handling /factory instead) ?
It is what I meant. This was not to solve the interrupted rootfs creation
problem, this was to solve the broken symlink problem.
[snip]
Quoted 7 lines
However (thinking aloud now), I have another tentative to do, which instead of creating a symlink for /var at runtime, would just creat it as a direcotry as expected.
Then the hooks would simply "mv /var
/usr/share/factory/var; mkdir /var", create the tmpfiles entries, aggregate the image(s), the rm -rf /var; mv/usr/share/factory/var/var".
You still have the interrupted rootfs creation problem. But the symlinks are fixed.
Quoted 5 lines
This is probably much simpler than moving the entries one by one.
The only drawback in this case would be a package that already creates a factory/var/foo entry. It would end up in
/var/fooafterwards... :-/ So I think the /var symlink is better, in fact, so I'll keep that.
Except that it may break symlinks...
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 20/20 support/testing: add runtime testing for init systems
In reply to Yann E. MORINThe "builtin" kernel does not boot a systemd-based system, so we resort to building the same one as currently used by our qemu_arm_vexpress_defconfig.
We test the 11 following combinations:
- busybox, read-only, without network
- busybox, read-only, with network
- busybox, read-write, without network
- busybox, read-write, with network
- basic systemd, read-only, network w/ ifupdown
- basic systemd, read-only, network w/ networkd
- basic systemd, read-write, network w/ ifupdown
- basic systemd, read-write, network w/ networkd
- full systemd, read-only, network w/ networkd
- full systemd, read-write, network w/ networkd
- no init system, read-only, without network
The tests just verify what the /sbin/init binary is, and that we were able to grab an IP address. More tests can be added later, for example to check each systemd features (journal, tmpfiles...)
--- support/testing/tests/init/__init__.py | 0 support/testing/tests/init/base.py | 47 ++++++++++ support/testing/tests/init/test_busybox.py | 67 +++++++++++++ support/testing/tests/init/test_none.py | 32 +++++++ support/testing/tests/init/test_systemd.py | 145 +++++++++++++++++++++++++++++ 5 files changed, 291 insertions(+) create mode 100644 support/testing/tests/init/__init__.py create mode 100644 support/testing/tests/init/base.py create mode 100644 support/testing/tests/init/test_busybox.py create mode 100644 support/testing/tests/init/test_none.py create mode 100644 support/testing/tests/init/test_systemd.py
support/testing/tests/init/__init__.py new file +0 -0
support/testing/tests/init/base.py new file +47 -0
47 lines not on this page · raw message
support/testing/tests/init/test_busybox.py new file +67 -0
67 lines not on this page · raw message
support/testing/tests/init/test_none.py new file +32 -0
@@ -0,0 +1,32 @@ +import pexpect + +import infra.basetest +from tests.init.base import InitSystemBase as InitSystemBase + +class TestInitSystemNone(InitSystemBase): + config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ + """ + BR2_INIT_NONE=y + # BR2_TARGET_ROOTFS_TAR is not set + BR2_TARGET_ROOTFS_SQUASHFS=y + """ + + def test_run(self): + self.startEmulator(fs_type="squashfs", init="/bin/sh") + index = self.emulator.qemu.expect(["/bin/sh: can't access tty; job control turned off", pexpect.TIMEOUT], timeout=60) + if index != 0: + self.emulator.logfile.write("==> System does not boot") + raise SystemError("System does not boot") + index = self.emulator.qemu.expect(["#", pexpect.TIMEOUT], timeout=60) + if index != 0: + self.emulator.logfile.write("==> System does not boot") + raise SystemError("System does not boot") + + out, exit_code = self.emulator.run("sh -c 'echo $PPID'") + self.assertEqual(exit_code, 0) + self.assertEqual(out[0], "1") + + _, exit_code = self.emulator.run("mount -t proc none /proc") + self.assertEqual(exit_code, 0) + + self.checkInit("/bin/sh")
support/testing/tests/init/test_systemd.py new file +145 -0
145 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH 20/20 support/testing: add runtime testing for init systems
I think this patch should go in right away, even before the skeleton/systemd
fixes. Yes, that may make some tests fail, but that's fine.
Quoted 16 lines · Yann E. MORIN
The "builtin" kernel does not boot a systemd-based system, so we resort to building the same one as currently used by our
qemu_arm_vexpress_defconfig.We test the 11 following combinations:
- busybox, read-only, without network
- busybox, read-only, with network
- busybox, read-write, without network
- busybox, read-write, with network- basic systemd, read-only, network w/ ifupdown
- basic systemd, read-only, network w/ networkd
- basic systemd, read-write, network w/ ifupdown
- basic systemd, read-write, network w/ networkd
Quoted 4 lines
- full systemd, read-only, network w/ networkd
- full systemd, read-write, network w/ networkd- no init system, read-only, without network
Given that we're testing init here, it would be nice to also add tests with the
cpio filesystem, which runs a shell script before starting /sbin/init.
It's probably sufficient to just do the maximal test with this scenario.
Oh, and a test with sysvinit would also be nice...
Quoted 6 lines
The tests just verify what the
/sbin/initbinary is, and that we were able to grab an IP address. More tests can be added later, for example to check each systemd features (journal, tmpfiles...)Signed-off-by "Yann E. MORIN" <[email protected]>Cc Thomas Petazzoni <[email protected]>
I have a bunch of comments, but nothing critical so
[snip]
Quoted 1 line
+ def
startEmulator(self, fs_type, kernel=None, dtb=None, init=None):
PEP8 says snake-case for functions. I'm not sure if the rest of the testing
infra satisfies this, but let's try to not make things worse.
support/testing/tests/init/base.py line 9
Quoted 2 lines
support/testing/tests/init/base.py new file +2
-0+ img = os.path.join(self.builddir, "images", "rootfs.{}".format(fs_type)) + subprocess.call(["truncate", "-s", "%1M", img])
It's a bit weird to do that here, but I see no better way either.
support/testing/tests/init/base.py line 18
Quoted 9 lines
support/testing/tests/init/base.py new file +9
-0+ + options = ["-drive", + "file={},if=sd,format=raw".format(img), + "-M", "vexpress-a9"] + + if kernel is None: + kernel = "builtin" + else: + kernel = os.path.join(self.builddir, "images", kernel)
This condition should probably be refactored into emulator.boot itself -
although admittedly that doesn't have a reference to builddir at the moment.
support/testing/tests/init/base.py line 20
Quoted 2 lines
support/testing/tests/init/base.py new file +2
-0+ options.extend(["-dtb", os.path.join(self.builddir, "images", + "{}.dtb".format(dtb))])
This should only be done if dtb is not None.
support/testing/tests/init/base.py line 29
Quoted 9 lines
support/testing/tests/init/base.py new file +9
-0+ + kernel_cmdline = ["root=/dev/mmcblk0", + "rootfstype={}".format(fs_type), + "rootwait", + "ro", + "console=ttyAMA0"] + + if not init is None: + kernel_cmdline.extend(["init={}".format(init)])
Just a single element, so append() instead of extend().
support/testing/tests/init/base.py line 37
Quoted 8 lines
support/testing/tests/init/base.py new file +8
-0+ + self.emulator.boot(arch="armv7", + kernel=kernel, + kernel_cmdline=kernel_cmdline, + options=options) + + if init is None: + self.emulator.login()
This looks weird so warrants a comment:
# The init argument is passed when there is no /sbin/init and we instead
# directly run an executable. So when init is None, we have to log in.
support/testing/tests/init/base.py line 47
Quoted 10 lines
support/testing/tests/init/base.py new file +10
-0+ + def checkInit(self, path): + cmd = "cmp /proc/1/exe {}".format(path) + _, exit_code = self.emulator.run(cmd) + self.assertEqual(exit_code, 0) + + def checkNetwork(self, interface, exitCode=0): + cmd = "ip addr show {} |grep inet".format(interface) + _, exit_code = self.emulator.run(cmd) + self.assertEqual(exit_code, exitCode)
These you could also run automatically, and request the arguments from the
instance:
def test_run(self):
self.startEmulator(self.fs_type())
self.checkInit(self.init_path())
if self.have_network():
self.checkNetwork("eth0")
else:
self.checkNetwork("eth0", 1) Ideally you'd then make this an ABC class and declare those callbacks as
@abstractmethod, but perhaps that's going too far for you :-)
[snip]
Quoted 4 lines
support/testing/tests/init/test_none.py new file +4
-0+class TestInitSystemNone(InitSystemBase): + config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ + """ + BR2_INIT_NONE=y
support/testing/tests/init/test_none.py line 19
Quoted 10 lines
support/testing/tests/init/test_none.py new file +10
-0+ # BR2_TARGET_ROOTFS_TAR is not set + BR2_TARGET_ROOTFS_SQUASHFS=y + """ + + def test_run(self): + self.startEmulator(fs_type="squashfs", init="/bin/sh") + index = self.emulator.qemu.expect(["/bin/sh: can't access tty; job control turned off", pexpect.TIMEOUT], timeout=60) + if index != 0: + self.emulator.logfile.write("==> System does not boot") + raise SystemError("System does not boot")
Why do you need to raise an exception here? Why not
if index != 0:
self.fail(==> System does not boot")
return Regards,
Arnout
[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 20/20 support/testing: add runtime testing for init systems
Arnout, All,
On 2017-07-22 16:32 +0200, Arnout Vandecappelle spake thusly:
Quoted 2 lines
I think this patch should go in right away, even before the skeleton/systemd
fixes. Yes, that may make some tests fail, but that's fine.
I am not so sure. We don;t know how long it will take this series to get in in its entirety.
OTOH, ahving the tests in right now would be quite an incentive to get the rest in. ;-]
Quoted 17 lines · Yann E. MORIN
Quoted 16 lines
The "builtin" kernel does not boot a systemd-based system, so we resort to building the same one as currently used by our
qemu_arm_vexpress_defconfig.We test the 11 following combinations:
- busybox, read-only, without network
- busybox, read-only, with network
- busybox, read-write, without network
- busybox, read-write, with network- basic systemd, read-only, network w/ ifupdown
- basic systemd, read-only, network w/ networkd
- basic systemd, read-write, network w/ ifupdown
- basic systemd, read-write, network w/ networkd
Quoted 7 lines
Quoted 4 lines
- full systemd, read-only, network w/ networkd
- full systemd, read-write, network w/ networkd- no init system, read-only, without network
Given that we're testing init here, it would be nice to also add tests with the
cpio filesystem, which runs a shell script before starting/sbin/init.
As I said, we can add more tests in the future. I already have a few ideas of what we could/should add, but I'll refrain to do so for now, to concentrate on doing the requested cleanups on this series. ;-)
Quoted 12 lines
It's probably sufficient to just do the maximal test with this scenario. Oh, and a test with sysvinit would also be nice...
Quoted 6 lines
The tests just verify what the
/sbin/initbinary is, and that we were able to grab an IP address. More tests can be added later, for example to check each systemd features (journal, tmpfiles...)Signed-off-by "Yann E. MORIN" <[email protected]>Cc Thomas Petazzoni <[email protected]>I have a bunch of comments, but nothing critical so
Quoted 7 lines
[snip]
Quoted 1 line
+ def
startEmulator(self, fs_type, kernel=None, dtb=None, init=None):PEP8 says snake-case for functions. I'm not sure if the rest of the testing
infra satisfies this, but let's try to not make things worse.
We already have BRTest.setUp() and BRTest.tearDown(), so I mimicked that. And I also applied Thomas suggestion to go camel-case with functions (reviewed on IRC).
Quoted 5 lines
support/testing/tests/init/base.py line 9
Quoted 2 lines
support/testing/tests/init/base.py new file +2
-0+ img = os.path.join(self.builddir, "images", "rootfs.{}".format(fs_type)) + subprocess.call(["truncate", "-s", "%1M", img])It's a bit weird to do that here, but I see no better way either.
Quoted 12 lines
support/testing/tests/init/base.py line 18
Quoted 9 lines
support/testing/tests/init/base.py new file +9
-0+ + options = ["-drive", + "file={},if=sd,format=raw".format(img), + "-M", "vexpress-a9"] + + if kernel is None: + kernel = "builtin" + else: + kernel = os.path.join(self.builddir, "images", kernel)This condition should probably be refactored into emulator.boot itself -
although admittedly that doesn't have a reference to builddir at the moment.
I was planning on reworking the test infra as you suggested, because I also found it did make sense, but again, that is out-of-scope for this series.
Quoted 4 lines
support/testing/tests/init/base.py line 20
Quoted 2 lines
support/testing/tests/init/base.py new file +2
-0+ options.extend(["-dtb", os.path.join(self.builddir, "images", + "{}.dtb".format(dtb))])This should only be done if dtb is not None.
Right.
Quoted 11 lines
support/testing/tests/init/base.py line 29
Quoted 9 lines
support/testing/tests/init/base.py new file +9
-0+ + kernel_cmdline = ["root=/dev/mmcblk0", + "rootfstype={}".format(fs_type), + "rootwait", + "ro", + "console=ttyAMA0"] + + if not init is None: + kernel_cmdline.extend(["init={}".format(init)])Just a single element, so
append()instead ofextend().
Right.
Quoted 11 lines
support/testing/tests/init/base.py line 37
Quoted 8 lines
support/testing/tests/init/base.py new file +8
-0+ + self.emulator.boot(arch="armv7", + kernel=kernel, + kernel_cmdline=kernel_cmdline, + options=options) + + if init is None: + self.emulator.login()This looks weird so warrants a comment:
Quoted 2 lines
# The init argument is passed when there is no
/sbin/initand we instead# directly run an executable. So when init is None, we have to log in.
Ack.
Quoted 22 lines
support/testing/tests/init/base.py line 47
Quoted 10 lines
support/testing/tests/init/base.py new file +10
-0+ + def checkInit(self, path): + cmd = "cmp /proc/1/exe {}".format(path) + _, exit_code = self.emulator.run(cmd) + self.assertEqual(exit_code, 0) + + def checkNetwork(self, interface, exitCode=0): + cmd = "ip addr show {} |grep inet".format(interface) + _, exit_code = self.emulator.run(cmd) + self.assertEqual(exit_code, exitCode)These you could also run automatically, and request the arguments from the
instance:def test_run(self): self.startEmulator(self.fs_type()) self.checkInit(self.init_path()) if self.have_network(): self.checkNetwork("eth0") else: self.checkNetwork("eth0", 1)
Quoted 2 lines
Ideally you'd then make this an ABC class and declare those callbacks as
@abstractmethod, but perhaps that's going too far for you :-)
Is it really necessary that we go this route? It is much more complex, for a dubious gain, if at all.
I'd prefer we keep with simple, plain code, so that everyone can contribute more easily...
Quoted 18 lines
[snip]
Quoted 4 lines
support/testing/tests/init/test_none.py new file +4
-0+class TestInitSystemNone(InitSystemBase): + config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ + """ + BR2_INIT_NONE=ysupport/testing/tests/init/test_none.py line 19
Quoted 10 lines
support/testing/tests/init/test_none.py new file +10
-0+ # BR2_TARGET_ROOTFS_TAR is not set + BR2_TARGET_ROOTFS_SQUASHFS=y + """ + + def test_run(self): + self.startEmulator(fs_type="squashfs", init="/bin/sh") + index = self.emulator.qemu.expect(["/bin/sh: can't access tty; job control turned off", pexpect.TIMEOUT], timeout=60) + if index != 0: + self.emulator.logfile.write("==> System does not boot") + raise SystemError("System does not boot")Why do you need to raise an exception here? Why not
Quoted 3 lines
if index != 0:
self.fail(==> System does not boot")
returnI did exactly as is currently done in Emulator.login():
index = self.qemu.expect(["buildroot login:", pexpect.TIMEOUT],
timeout=60)
if index != 0:
self.logfile.write("==> System does not boot")
raise SystemError("System does not boot")Regards,
Yann E. MORIN.
Quoted 12 lines
Regards,
Arnout[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 20/20 support/testing: add runtime testing for init systems
Hello,
Quoted 6 lines · Yann E. MORIN
Quoted 2 lines
PEP8 says snake-case for functions. I'm not sure if the rest of the testing
infra satisfies this, but let's try to not make things worse.We already have
BRTest.setUp()andBRTest.tearDown(), so I mimicked that. And I also applied Thomas suggestion to go camel-case with functions (reviewed on IRC).
I don't think I said to use camel case for functions. What I said is to not use ThisIsAFunction for functions/methods, because that's normally used for classes.
Quoted 8 lines
Quoted 8 lines
def test_run(self): self.startEmulator(self.fs_type()) self.checkInit(self.init_path()) if self.have_network(): self.checkNetwork("eth0") else: self.checkNetwork("eth0", 1)
Quoted 8 lines
Quoted 2 lines
Ideally you'd then make this an ABC class and declare those callbacks as
@abstractmethod, but perhaps that's going too far for you :-)Is it really necessary that we go this route? It is much more complex, for a dubious gain, if at all.
I'd prefer we keep with simple, plain code, so that everyone can contribute more easily...
Fully agreed with Yann. I know there are lots of funky but useful constructs / features in Python, but I'd like to keep the testing infrastructure to a usage of Python that can reasonably be understood by the average C programmer. So, a good indicator is: do Yann and Thomas understand what it does? If the answer is no, the construct shouldn't be used :-)
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 20/20 support/testing: add runtime testing for init systems
In reply to Yann E. MORINQuoted 11 lines · Yann E. MORIN
Arnout, All,
On 2017-07-22 16:32 +0200, Arnout Vandecappelle spake thusly:
Quoted 2 lines
I think this patch should go in right away, even before the skeleton/systemd
fixes. Yes, that may make some tests fail, but that's fine.I am not so sure. We don;t know how long it will take this series to get in in its entirety.
OTOH, ahving the tests in right now would be quite an incentive to get the rest in. ;-]
Well, we already have two tests failing and nobody seems to fix them...
[snip]
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
+ def
startEmulator(self, fs_type, kernel=None, dtb=None, init=None):PEP8 says snake-case for functions. I'm not sure if the rest of the testing
infra satisfies this, but let's try to not make things worse.We already have
BRTest.setUp()andBRTest.tearDown(), so I mimicked that.
Well, that's because python unittest predates PEP8 and it already had these
names, so they couldn't be changed.
There are two tools, pep8 and flake8, that help checking PEP8 compliance.
[snip]
Quoted 11 lines
Quoted 11 lines
These you could also run automatically, and request the arguments from the
instance:def test_run(self): self.startEmulator(self.fs_type()) self.checkInit(self.init_path()) if self.have_network(): self.checkNetwork("eth0") else: self.checkNetwork("eth0", 1)
Quoted 5 lines
Quoted 2 lines
Ideally you'd then make this an ABC class and declare those callbacks as
@abstractmethod, but perhaps that's going too far for you :-)Is it really necessary that we go this route? It is much more complex, for a dubious gain, if at all.
That's why I said "ideally".
The callbacks (or they could be class members as well, like we have with
config) are indeed useful I think.
Quoted 2 lines
I'd prefer we keep with simple, plain code, so that everyone can contribute more easily...
Fair enough.
Regards,
Arnout
[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 20/20 support/testing: add runtime testing for init systems
Hello,
Quoted 4 lines · Arnout Vandecappelle
Quoted 2 lines
OTOH, ahving the tests in right now would be quite an incentive to get the rest in. ;-]
Well, we already have two tests failing and nobody seems to fix them...
The patches fixing them are here:
http://patchwork.ozlabs.org/patch/783135/
http://patchwork.ozlabs.org/patch/783137/
http://patchwork.ozlabs.org/patch/783136/
and nobody reviews them.
(Actually only the first patch of the series is needed to fix the tests)
I made those on July 1st, pretty much the day we started running the tests in Gitlab CI. So it's a bit hard to now read your complaint that nobody cares about the failing tests...
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 20/20 support/testing: add runtime testing for init systems
Thomas, All,
On 2017-07-22 22:10 +0200, Thomas Petazzoni spake thusly:
Quoted 7 lines · Arnout Vandecappelle
Quoted 5 lines
Quoted 3 lines
OTOH, ahving the tests in right now would be quite an incentive to get the rest in. ;-]
Well, we already have two tests failing and nobody seems to fix them...
Quoted 7 lines
The patches fixing them are here:
http://patchwork.ozlabs.org/patch/783135/
http://patchwork.ozlabs.org/patch/783137/
http://patchwork.ozlabs.org/patch/783136/and nobody reviews them.
I gave them a spin here, and they indeed fix the build, but the tests are still broken because qemu can't boot the resulting system...
I'll investigate that tomorrow...
Regards,
Yann E. MORIN.
Quoted 14 lines
(Actually only the first patch of the series is needed to fix the tests)
I made those on July 1st, pretty much the day we started running the tests in Gitlab CI. So it's a bit hard to now read your complaint that nobody cares about the failing tests...
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 20/20 support/testing: add runtime testing for init systems
Hello,
Quoted 6 lines · Yann E. MORIN
Quoted 6 lines
The patches fixing them are here:
http://patchwork.ozlabs.org/patch/783135/
http://patchwork.ozlabs.org/patch/783137/
http://patchwork.ozlabs.org/patch/783136/
Quoted 6 lines
Quoted 1 line
and nobody reviews them.
I gave them a spin here, and they indeed fix the build, but the tests are still broken because qemu can't boot the resulting system...
I'll investigate that tomorrow...
Hum, weird, because I'm pretty sure I tested the test cases with those patches. I'll test again, maybe I missed something.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 20/20 support/testing: add runtime testing for init systems
Thomas, All,
On 2017-07-23 09:58 +0200, Thomas Petazzoni spake thusly:
Quoted 9 lines · Yann E. MORIN
Quoted 8 lines
Quoted 7 lines
The patches fixing them are here:
http://patchwork.ozlabs.org/patch/783135/
http://patchwork.ozlabs.org/patch/783137/
http://patchwork.ozlabs.org/patch/783136/and nobody reviews them.
Quoted 7 lines
Quoted 4 lines
I gave them a spin here, and they indeed fix the build, but the tests are still broken because qemu can't boot the resulting system...
I'll investigate that tomorrow...
Hum, weird, because I'm pretty sure I tested the test cases with those patches. I'll test again, maybe I missed something.
So, to rule out any sleep-deprivation issue while testign yesterday evening, I re-spawn the tests here this morning, and they still do not run.
Maybe it is my qemu version?
I'll try and bisect them between July the 1st and now.
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
[Buildroot] TestIso9660GrubExternal and TestIso9660GrubInternal failing
Hello,
I renamed the e-mail thread from:
[PATCH 20/20] support/testing: add runtime testing for init systems
Quoted 18 lines · Yann E. MORIN
On 2017-07-23 09:58 +0200, Thomas Petazzoni spake thusly:
Quoted 9 lines · Yann E. MORIN
Quoted 8 lines
Quoted 7 lines
The patches fixing them are here:
http://patchwork.ozlabs.org/patch/783135/
http://patchwork.ozlabs.org/patch/783137/
http://patchwork.ozlabs.org/patch/783136/and nobody reviews them.
Quoted 7 lines
Quoted 4 lines
I gave them a spin here, and they indeed fix the build, but the tests are still broken because qemu can't boot the resulting system...
I'll investigate that tomorrow...
Hum, weird, because I'm pretty sure I tested the test cases with those patches. I'll test again, maybe I missed something.
Quoted 7 lines
So, to rule out any sleep-deprivation issue while testign yesterday evening, I re-spawn the tests here this morning, and they still do not run.
Maybe it is my qemu version?
I'll try and bisect them between July the 1st and now.
Since you are investigating this, let me provide some data I hope is useful.
My local computer has:
binutils 2.26.1
qemu 2.5.0
Using my local computer the tests TestIso9660GrubExternal and TestIso9660GrubInternal always pass, in current master and also with the 3 grub patches applied.
Using the image buildroot/base I can reproduce the problems:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/23825707
GRUB requires a working absolute objcopy; upgrade your binutils
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/23831270
==> System does not boot
If you need me to check versions for other tools in my local computer (Ubuntu 16.04.2, not plain vanilla), feel free to ask.
Regards,
Ricardo
[Buildroot] TestIso9660GrubExternal and TestIso9660GrubInternal failing
Ricardo, All,
On 2017-07-23 15:13 -0300, Ricardo Martincoski spake thusly:
Quoted 23 lines · Yann E. MORIN
Quoted 22 lines
On 2017-07-23 09:58 +0200, Thomas Petazzoni spake thusly:
Quoted 9 lines · Yann E. MORIN
Quoted 8 lines
Quoted 7 lines
The patches fixing them are here:
http://patchwork.ozlabs.org/patch/783135/
http://patchwork.ozlabs.org/patch/783137/
http://patchwork.ozlabs.org/patch/783136/and nobody reviews them.
Quoted 7 lines
Quoted 4 lines
I gave them a spin here, and they indeed fix the build, but the tests are still broken because qemu can't boot the resulting system...
I'll investigate that tomorrow...
Hum, weird, because I'm pretty sure I tested the test cases with those patches. I'll test again, maybe I missed something.
So, to rule out any sleep-deprivation issue while testign yesterday evening, I re-spawn the tests here this morning, and they still do not run.
Quoted 5 lines
Quoted 3 lines
Maybe it is my qemu version?
I'll try and bisect them between July the 1st and now.
Since you are investigating this, let me provide some data I hope is useful.
Thanks for the feedback! :-)
So I was not even capable of running it on a snashot of July (at the time the patches were made). It already failed to boot.
Quoted 3 lines
My local computer has:
binutils 2.26.1
qemu 2.5.0
I have Ubuntu 17.04:
GNU ar (GNU Binutils for Ubuntu) 2.28
QEMU emulator version 2.8.0(Debian 1:2.8+dfsg-3ubuntu2.3)
Quoted 3 lines
Using my local computer the tests TestIso9660GrubExternal and TestIso9660GrubInternal always pass, in current master and also with the 3 grub patches applied.
It is ex[ected that the build suceeds without the patches on your machine, because it is binutils 2.28 that broke the build.
However, that you were ablt to run is interesting. I'll spawn that on my server, which is a 16.04 as well.
Quoted 5 lines
Using the image buildroot/base I can reproduce the problems:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/23825707
GRUB requires a working absolute objcopy; upgrade your binutils
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/23831270
==> System does not boot
So, it would look like it is either:
- a qemu issue,
- a binutils regression we have not identified (maybe another Debian patch is required?),
- a grub regression.
Quoted 2 lines
If you need me to check versions for other tools in my local computer (Ubuntu 16.04.2, not plain vanilla), feel free to ask.
I plan on doign those tests;
- build on 16.04, run on 16.04
- build on 16.04, run on 17.04
- build on 17.04, run on 16.04
This should identify if qemu is the culprit (the second would not work), or if binutils is the culprit (the third would not work).
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
[Buildroot] TestIso9660GrubExternal and TestIso9660GrubInternal failing
Ricardo, All,
On 2017-07-23 22:02 +0200, Yann E. MORIN spake thusly:
Quoted 29 lines
On 2017-07-23 15:13 -0300, Ricardo Martincoski spake thusly:
Quoted 28 lines · Yann E. MORIN
Quoted 18 lines
On 2017-07-23 09:58 +0200, Thomas Petazzoni spake thusly:
Quoted 9 lines · Yann E. MORIN
Quoted 8 lines
Quoted 7 lines
The patches fixing them are here:
http://patchwork.ozlabs.org/patch/783135/
http://patchwork.ozlabs.org/patch/783137/
http://patchwork.ozlabs.org/patch/783136/and nobody reviews them.
Quoted 7 lines
Quoted 4 lines
I gave them a spin here, and they indeed fix the build, but the tests are still broken because qemu can't boot the resulting system...
I'll investigate that tomorrow...
Hum, weird, because I'm pretty sure I tested the test cases with those patches. I'll test again, maybe I missed something.
Quoted 7 lines
So, to rule out any sleep-deprivation issue while testign yesterday evening, I re-spawn the tests here this morning, and they still do not run.
Maybe it is my qemu version?
I'll try and bisect them between July the 1st and now.
Since you are investigating this, let me provide some data I hope is useful.
[--SNIP--]
Quoted 5 lines
I plan on doign those tests;
- build on 16.04, run on 16.04
- build on 16.04, run on 17.04
- build on 17.04, run on 16.04
So, even before the tests are all done, I already noticed an issue here:
on my machine, the iso images are about 1GiB large, while on my server, they are only a bit less than 5MiB.
So, it looks like this is a binutils issue, with objdump being the culprit (it very much look like older similar issues). I'll continue investigating...
Thanks!
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
[Buildroot] TestIso9660GrubExternal and TestIso9660GrubInternal failing
In reply to Yann E. MORINRicardo, All,
On 2017-07-23 22:02 +0200, Yann E. MORIN spake thusly:
[--SNIP--]
Quoted 1 line
I plan on doign those tests;
- build on 16.04, run on 16.04
==> builds and runs OK
- build on 16.04, run on 17.04
==> builds and runs OK
- build on 17.04, run on 16.04
==> builds OK, does not run.
So, I think this is realyl a regression with newer binutils:
$ ls -l fail/build/grub-0.97/stage1/stage1
-rwxr-xr-x 1 ymorin ymorin 129M juil. 23 22:10 stage1 $ ls -l works/build/grub-0.97/stage1/stage1
-rwxr-xr-x 1 ymorin ymorin 512 juil. 23 22:09 stage1Similarly with stage2 and above, with file reaching over 256MiB...
So, definitely something fishy with binutils-2.28...
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
[Buildroot] TestIso9660GrubExternal and TestIso9660GrubInternal failing
In reply to Ricardo MartincoskiHello,
Quoted 8 lines · Ricardo Martincoski
My local computer has:
binutils 2.26.1
qemu 2.5.0Using my local computer the tests TestIso9660GrubExternal and TestIso9660GrubInternal always pass, in current master and also with the 3 grub patches applied.
Quoted 5 lines
Using the image buildroot/base I can reproduce the problems:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/23825707
GRUB requires a working absolute objcopy; upgrade your binutils
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/23831270
==> System does not boot
And my patches did not fix this problem ?
Best regards,
Thomas Petazoni
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
[Buildroot] TestIso9660GrubExternal and TestIso9660GrubInternal failing
Hello,
----- Original Message -----
Quoted 13 lines
From: "Thomas Petazzoni"
Sent: Monday, July 24, 2017 4:13:21 AMQuoted 8 lines · Ricardo Martincoski
My local computer has:
binutils 2.26.1
qemu 2.5.0Using my local computer the tests TestIso9660GrubExternal and TestIso9660GrubInternal always pass, in current master and also with the 3 grub patches applied.
Quoted 7 lines
Quoted 5 lines
Using the image buildroot/base I can reproduce the problems:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/23825707
GRUB requires a working absolute objcopy; upgrade your binutils
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/23831270
==> System does not bootAnd my patches did not fix this problem ?
Your patches fix the build problem with newer binutils.
But the runtime problem remains, according to Yann's analysis related to binutils-2.28 installed in the host machine.
The second url above (ending in 270) are the tests running with your 3 patches applied.
Regards,
--
Ricardo Martincoski
DATACOM
Ethernet Switches
Rua Am?rica, 1000 - Eldorado do Sul, RS - 92990-000 - Brasil +55 51 3933 3000 - Ramal 3307
ricardo.martincoski at datacom.ind.br www.datacom.ind.br
[Buildroot] TestIso9660GrubExternal and TestIso9660GrubInternal failing
In reply to Thomas PetazzoniThomas, All,
On 2017-07-24 09:13 +0200, Thomas Petazzoni spake thusly:
Quoted 10 lines · Ricardo Martincoski
Quoted 9 lines
My local computer has:
binutils 2.26.1
qemu 2.5.0Using my local computer the tests TestIso9660GrubExternal and TestIso9660GrubInternal always pass, in current master and also with the 3 grub patches applied.
Quoted 7 lines
Quoted 5 lines
Using the image buildroot/base I can reproduce the problems:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/23825707
GRUB requires a working absolute objcopy; upgrade your binutils
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/23831270
==> System does not bootAnd my patches did not fix this problem ?
Not really, no.
Without your patches, the build breaks, because objdump fails, and we catch a build failure.
With your patches, the build seems to succeed, because it does not fail. However, the generated iso images are about 1GiB in size (instead of less than 5MiB), and they do not boot. See the summary I've written in:
http://lists.busybox.net/pipermail/buildroot/2017-July/198940.html
So no, your patches are not sufficient to solve the run-time test.
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 20/20 support/testing: add runtime testing for init systems
In reply to Yann E. MORINQuoted 104 lines · Yann E. MORIN
The "builtin" kernel does not boot a systemd-based system, so we resort to building the same one as currently used by our
qemu_arm_vexpress_defconfig.We test the 11 following combinations:
- busybox, read-only, without network
- busybox, read-only, with network
- busybox, read-write, without network
- busybox, read-write, with network- basic systemd, read-only, network w/ ifupdown
- basic systemd, read-only, network w/ networkd
- basic systemd, read-write, network w/ ifupdown
- basic systemd, read-write, network w/ networkd- full systemd, read-only, network w/ networkd
- full systemd, read-write, network w/ networkd- no init system, read-only, without network
The tests just verify what the
/sbin/initbinary is, and that we were able to grab an IP address. More tests can be added later, for example to check each systemd features (journal, tmpfiles...)Signed-off-by "Yann E. MORIN" <[email protected]>Cc Thomas Petazzoni <[email protected]>--- support/testing/tests/init/__init__.py | 0 support/testing/tests/init/base.py | 47 ++++++++++ support/testing/tests/init/test_busybox.py | 67 +++++++++++++ support/testing/tests/init/test_none.py | 32 +++++++ support/testing/tests/init/test_systemd.py | 145 +++++++++++++++++++++++++++++ 5 files changed, 291 insertions(+) create mode 100644 support/testing/tests/init/__init__.py create mode 100644 support/testing/tests/init/base.py create mode 100644 support/testing/tests/init/test_busybox.py create mode 100644 support/testing/tests/init/test_none.py create mode 100644 support/testing/tests/init/test_systemd.pysupport/testing/tests/init/__init__.py new file +0
-0support/testing/tests/init/base.py new file +47
-0@@ -0,0 +1,47 @@ +import os +import subprocess +import infra.basetest + +class InitSystemBase(infra.basetest.BRTest): + + def startEmulator(self, fs_type, kernel=None, dtb=None, init=None): + img = os.path.join(self.builddir, "images", "rootfs.{}".format(fs_type)) + subprocess.call(["truncate", "-s", "%1M", img]) + + options = ["-drive", + "file={},if=sd,format=raw".format(img), + "-M", "vexpress-a9"] + + if kernel is None: + kernel = "builtin" + else: + kernel = os.path.join(self.builddir, "images", kernel) + options.extend(["-dtb", os.path.join(self.builddir, "images", + "{}.dtb".format(dtb))]) + + kernel_cmdline = ["root=/dev/mmcblk0", + "rootfstype={}".format(fs_type), + "rootwait", + "ro", + "console=ttyAMA0"] + + if not init is None: + kernel_cmdline.extend(["init={}".format(init)]) + + self.emulator.boot(arch="armv7", + kernel=kernel, + kernel_cmdline=kernel_cmdline, + options=options) + + if init is None: + self.emulator.login() + + def checkInit(self, path): + cmd = "cmp /proc/1/exe {}".format(path) + _, exit_code = self.emulator.run(cmd) + self.assertEqual(exit_code, 0) + + def checkNetwork(self, interface, exitCode=0): + cmd = "ip addr show {} |grep inet".format(interface) + _, exit_code = self.emulator.run(cmd) + self.assertEqual(exit_code, exitCode)support/testing/tests/init/test_busybox.py new file +2
-0@@ -0,0 +1,67 @@ +import infra.basetest +from tests.init.base import InitSystemBase as InitSystemBase
support/testing/tests/init/test_busybox.py line 12
Quoted 10 lines
support/testing/tests/init/test_busybox.py new file +10
-0+ +class InitSystemBusyboxBase(InitSystemBase): + config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ + """ + # BR2_TARGET_ROOTFS_TAR is not set + """ + + def checkInit(self): + super(InitSystemBusyboxBase, self).checkInit("/bin/busybox") +
Just as a suggestion, you can probably get away without needing to override that function by defining a class variable "init_path" that SystemBusyboxBase and SystemSystemdBase will override to some appropriate value. See, for example, the code I wrote for Python and IPython related tests.
https://git.buildroot.net/buildroot/tree/support/testing/tests/package/test_python.py#n11
https://git.buildroot.net/buildroot/tree/support/testing/tests/package/test_ipython.py#n18
Thanks,
Andrey Smirnov
PATCH 20/20 support/testing: add runtime testing for init systems
Andrey, All,
On 2017-07-24 08:20 -0700, Andrey Smirnov spake thusly:
Quoted 4 lines · Yann E. MORIN
Quoted 3 lines
The "builtin" kernel does not boot a systemd-based system, so we resort to building the same one as currently used by our
qemu_arm_vexpress_defconfig.
[--SNIP--]
Quoted 25 lines
Quoted 8 lines
support/testing/tests/init/test_busybox.py new file +2
-0@@ -0,0 +1,67 @@ +import infra.basetest +from tests.init.base import InitSystemBase as InitSystemBasesupport/testing/tests/init/test_busybox.py line 12
Quoted 10 lines
support/testing/tests/init/test_busybox.py new file +10
-0+ +class InitSystemBusyboxBase(InitSystemBase): + config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ + """ + # BR2_TARGET_ROOTFS_TAR is not set + """ + + def checkInit(self): + super(InitSystemBusyboxBase, self).checkInit("/bin/busybox") +Just as a suggestion, you can probably get away without needing to override that function by defining a class variable "
init_path" that SystemBusyboxBase and SystemSystemdBase will override to some appropriate value. See, for example, the code I wrote for Python and IPython related tests.
Quoted 2 lines
https://git.buildroot.net/buildroot/tree/support/testing/tests/package/test_python.py#n11
https://git.buildroot.net/buildroot/tree/support/testing/tests/package/test_ipython.py#n18
Hmm, I see what you mean. I'll see if that helps with the code.
OTOH, calling super() is not too complex either. ;-)
Thanks for the suggestion! :-)
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
cover system: properly handle systemd as init system
In reply to Yann E. MORINQuoted 185 lines · Yann E. MORIN
Hello All!
This series is a proposal to fix our handling of systemd as an init system.
Our default skeleton is not well suited for systemd:
- we have
/var/loga symlink to/tmp/log, but the way systemd starts hides the journals:
- start systemd-journald, stores journals in/tmp/log/(because of the redirection above)
- mounts a tmpfs over /tmp, thus hidding the journals.- on a read-only rootfs, systemd expects /var to be read-write, which we do not provide.
All of this sounds trivial, but fixing it is definitely not.
The overall idea is that we need different skeletons, one for each type of init systems: sysv, systemd, others (aka custom).
The skeleton package becomes a virtual package, that is provided by one of four implementations:
- skeleton-sysv or skeleton-systemd, as their names imply, for either
SysV- or systemd-based systems, and which depend on skeleton-common;- skeleton-common, that provides base files and directories comon to all skeletons (except custom, below); skeleton-common is also a provider for the skeleton virtual package, for use with no-init (aka custom init) systems;
- skeleton-custom, for user-provided custom skeleton, and of which we expect it is fully prepared; skeleton-custom does not depend on skeleton-common.
A series of runtime tests have also been added, running on the QEMU vexpress:
init system rootfs DHCP?
-------------------------------------
busybox ext4 no
busybox ext4 eth0
busybox squashfs no
busybox squashfs eth0* systemd-ifupdown ext4 eth0 systemd-ifupdown squashfs eth0 ** systemd-networkd ext4 eth0 systemd-networkd squashfs eth0 *** systemd-full ext4 eth0 systemd-full squashfs eth0 + no-init squashfs no* systemd-networkd: only what gets selected automatically when
systemd is used as init system, with all other options unset;** systemd-ifupdown: like systemd-networkd, but with networkd
disabled, thus using ifupdown instead;*** systemd-full: all systemd options enabled, implies networkd;
+ a shell is launched as init
Those new tests are not exhaustive, especially the systemd one; instead, they just test basic features: what init is being used, and did we get an IP adress for eth0? More tests can be added later on.
Changes v2 -> v3:
- too much to note, mostly rewriten from scratchChanges v1 -> v2:
- enhance the commit logsRegards,
Yann E. MORIN.The following changes since commit
bc801efacb298e2297024f83e960eaf8a45dd39fpython-coherence: bump to the latest upstream commit (2017-07-17 11:28:58 +0200)
are available in the git repository at:
git://git.buildroot.org/~ymorin/git/buildroot.gitfor you to fetch changes up to
95f6965c48dbf2f754818e2bec1f2d3891015475support/testing: add runtime testing for init systems (2017-07-18 18:59:05 +0200)
----------------------------------------------------------------
Yann E. MORIN (20):
support/tests: allow properly indented config fragment core/pkg-generic: add variable to skip skeleton dependency package/skeleton: add macro to rsync skeleton directory package/skeleton: makeSKELETON_LIB_SYMLINKa macro
system: provide package-wide system variables and macros
system: move setting getty to the corresponding init systems
system: move remounting / to the corresponding init systems
system: with no init system, only allow custom skeleton package/skeleton: drop dependency on host-mkpasswd package/skeleton: select it rather than default to y package/skeleton: split out into skeleton-custom package/skeleton: split out into skeleton-common package/skeleton: make it a virtual package package/skeleton-common: simplify staging install package/skeleton: introduce sysv- and systemd-specific skeletons
system: separate sysv and systemd parts of the skeleton
sytem: no-init systems may use our default, common skeleton
fs: add pre- and post-command hooks
system: make systemd work on a read-only rootfs support/testing: add runtime testing for init systemsMakefile | 1 + fs/common.mk | 4 + package/Config.in | 4 + package/busybox/busybox.mk | 15 +- package/pkg-generic.mk | 11 +- package/skeleton-common/Config.in | 31 ++++ package/skeleton-common/skeleton-common.mk | 92 +++++++++ package/skeleton-custom/Config.in | 6 + package/skeleton-custom/skeleton-custom.mk | 107 +++++++++++ package/skeleton-systemd/Config.in | 7 + package/skeleton-systemd/skeleton-systemd.mk | 71 +++++++ package/skeleton-sysv/Config.in | 7 + package/skeleton-sysv/skeleton-sysv.mk | 22 +++ {system => package/skeleton-sysv}/skeleton/dev/log | 0 .../skeleton-sysv}/skeleton/dev/pts/.empty | 0 .../skeleton-sysv}/skeleton/dev/shm/.empty | 0 .../skeleton-sysv}/skeleton/etc/fstab | 0 .../skeleton-sysv}/skeleton/var/cache | 0 .../skeleton-sysv}/skeleton/var/lib/misc | 0 .../skeleton-sysv}/skeleton/var/lock | 0 {system => package/skeleton-sysv}/skeleton/var/log | 0 {system => package/skeleton-sysv}/skeleton/var/run | 0 .../skeleton-sysv}/skeleton/var/spool | 0 {system => package/skeleton-sysv}/skeleton/var/tmp | 0 package/skeleton/Config.in | 8 +- package/skeleton/skeleton.mk | 206 +-------------------- package/sysvinit/sysvinit.mk | 11 ++ support/testing/infra/builder.py | 3 +- .../testing/tests/init/__init__.py | 0 support/testing/tests/init/base.py | 47 +++++ support/testing/tests/init/test_busybox.py | 67 +++++++ support/testing/tests/init/test_none.py | 32 ++++ support/testing/tests/init/test_systemd.py | 145 +++++++++++++++ system/Config.in | 13 +- system/skeleton/dev/{pts => }/.empty | 0 system/system.mk | 88 +++++++++ 36 files changed, 787 insertions(+), 211 deletions(-) create mode 100644 package/skeleton-common/Config.in create mode 100644 package/skeleton-common/skeleton-common.mk create mode 100644 package/skeleton-custom/Config.in create mode 100644 package/skeleton-custom/skeleton-custom.mk create mode 100644 package/skeleton-systemd/Config.in create mode 100644 package/skeleton-systemd/skeleton-systemd.mk create mode 100644 package/skeleton-sysv/Config.in create mode 100644 package/skeleton-sysv/skeleton-sysv.mk rename {system => package/skeleton-sysv}/skeleton/dev/log (100%) copy {system => package/skeleton-sysv}/skeleton/dev/pts/.empty (100%) rename {system => package/skeleton-sysv}/skeleton/dev/shm/.empty (100%) rename {system => package/skeleton-sysv}/skeleton/etc/fstab (100%) rename {system => package/skeleton-sysv}/skeleton/var/cache (100%) rename {system => package/skeleton-sysv}/skeleton/var/lib/misc (100%) rename {system => package/skeleton-sysv}/skeleton/var/lock (100%) rename {system => package/skeleton-sysv}/skeleton/var/log (100%) rename {system => package/skeleton-sysv}/skeleton/var/run (100%) rename {system => package/skeleton-sysv}/skeleton/var/spool (100%) rename {system => package/skeleton-sysv}/skeleton/var/tmp (100%) copy system/skeleton/dev/pts/.empty => support/testing/tests/init/__init__.py (100%) create mode 100644 support/testing/tests/init/base.py create mode 100644 support/testing/tests/init/test_busybox.py create mode 100644 support/testing/tests/init/test_none.py create mode 100644 support/testing/tests/init/test_systemd.py rename system/skeleton/dev/{pts => }/.empty (100%) create mode 100644 system/system.mk--
.-----------------.--------------------.------------------.--------------------.| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
Quoted 5 lines
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
For what it's worth,
using some in-house configs (armv5 and armv7) with and without systemd-networkd, verified journald functionality and the state of /var and so on.
cover system: properly handle systemd as init system
Hello,
Quoted 7 lines · Andrey Yurovsky
For what it's worth,
Tested-by Andrey Yurovsky <[email protected]>using some in-house configs (armv5 and armv7) with and without systemd-networkd, verified journald functionality and the state of /var and so on.
Thanks a lot for testing, very useful to get some feedback!
Can you confirm that it fixes the journald issue reported in bug
https://bugs.busybox.net/show_bug.cgi?id=7892 ?
Also, it would be useful if someone interested in systemd could look at bugs https://bugs.busybox.net/show_bug.cgi?id=9881 and
https://bugs.busybox.net/show_bug.cgi?id=9926.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
cover system: properly handle systemd as init system
Quoted 8 lines · Thomas Petazzoni
Hello,
Quoted 4 lines · Andrey Yurovsky
For what it's worth,
Tested-by Andrey Yurovsky <[email protected]>
Quoted 8 lines
Quoted 3 lines
using some in-house configs (armv5 and armv7) with and without systemd-networkd, verified journald functionality and the state of /var and so on.
Thanks a lot for testing, very useful to get some feedback!
Can you confirm that it fixes the journald issue reported in bug
https://bugs.busybox.net/show_bug.cgi?id=7892 ?
It does.
Quoted 2 lines
Also, it would be useful if someone interested in systemd could look at bugs https://bugs.busybox.net/show_bug.cgi?id=9881 and
I did an ARMv7 build with networkd+resolvd and couldn't reproduce the described problem with these patches applied. /etc/resolv.conf points to ../tmp/resolv.conf which in turn is properly populated and names do resolve. systemd-hostnamed is acting like it does on Fedora (for what it's worth), I'm still learning about how to test it properly (that is, I just have a static hostname at the moment).
Quoted 1 line
Ok, I'll do a clean rebuild without networkd and with NetworkManager.
Quoted 4 lines
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
cover system: properly handle systemd as init system
Hello,
Quoted 6 lines · Andrey Yurovsky
Quoted 4 lines
Thanks a lot for testing, very useful to get some feedback!
Can you confirm that it fixes the journald issue reported in bug
https://bugs.busybox.net/show_bug.cgi?id=7892 ?It does.
Awesome, thanks.
Quoted 5 lines
Quoted 2 lines
Also, it would be useful if someone interested in systemd could look at bugs https://bugs.busybox.net/show_bug.cgi?id=9881 and
I did an ARMv7 build with networkd+resolvd and couldn't reproduce the described problem with these patches applied.
Can you reproduce the problem *without* the patches ?
Quoted 9 lines
/etc/resolv.confpoints
to../tmp/resolv.confwhich in turn is properly populated and names do resolve. systemd-hostnamed is acting like it does on Fedora (for what it's worth), I'm still learning about how to test it properly (that is, I just have a static hostname at the moment).Quoted 1 line
Ok, I'll do a clean rebuild without networkd and with NetworkManager.
Thanks a lot!
BTW, for these bugs, if there is something easy we can add to the testing infrastructure to make sure it keeps working, it would be nice!
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
cover system: properly handle systemd as init system
Hey,
Quoted 13 lines · Thomas Petazzoni
Hello,
Quoted 6 lines · Andrey Yurovsky
Quoted 4 lines
Thanks a lot for testing, very useful to get some feedback!
Can you confirm that it fixes the journald issue reported in bug
https://bugs.busybox.net/show_bug.cgi?id=7892 ?It does.
Awesome, thanks.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Also, it would be useful if someone interested in systemd could look at bugs https://bugs.busybox.net/show_bug.cgi?id=9881 and
I did an ARMv7 build with networkd+resolvd and couldn't reproduce the described problem with these patches applied.
Can you reproduce the problem *without* the patches ?
We are experiencing this problem. I'll try to test it with this patch series on Monday.
Quoted 11 lines
Quoted 10 lines
/etc/resolv.confpoints
to../tmp/resolv.confwhich in turn is properly populated and names do resolve. systemd-hostnamed is acting like it does on Fedora (for what it's worth), I'm still learning about how to test it properly (that is, I just have a static hostname at the moment).Quoted 1 line
Ok, I'll do a clean rebuild without networkd and with NetworkManager.
Quoted 9 lines
Thanks a lot!
BTW, for these bugs, if there is something easy we can add to the testing infrastructure to make sure it keeps working, it would be nice!
Best regards,
Thomas
Best wishes,
Marcus
cover system: properly handle systemd as init system
Hey,
Quoted 19 lines · Marcus Hoffmann
Hey,
Quoted 16 lines · Thomas Petazzoni
Hello,
Quoted 6 lines · Andrey Yurovsky
Quoted 4 lines
Thanks a lot for testing, very useful to get some feedback!
Can you confirm that it fixes the journald issue reported in bug
https://bugs.busybox.net/show_bug.cgi?id=7892 ?It does.
Awesome, thanks.
Quoted 3 lines
Quoted 2 lines
Also, it would be useful if someone interested in systemd could look at bugs https://bugs.busybox.net/show_bug.cgi?id=9881 and
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
I did an ARMv7 build with networkd+resolvd and couldn't reproduce the described problem with these patches applied.
Can you reproduce the problem *without* the patches ?
We are experiencing this problem. I'll try to test it with this patch series on Monday.
I tested this with Yanns latest series on top of master (well, a few days back, where it applied cleanly.) and I still see this problem.
/etc/resolv.conf -> ../run/systemd/resolve/resolv.conf
And there is no /run/systemd/resolve because systemd-resolved is not selected.
I guess in packages/systemd/systemd.mk:292
define SYSTEMD_INSTALL_RESOLVCONF_HOOK
ln -sf ../run/systemd/resolve/resolv.conf \ $(TARGET_DIR)/etc/resolv.conf
endef
This should be in the BR2_PACKAGE_SYSTEMD_RESOLVED and not in the BR2_PACKAGE_SYSTEMD_NETWORKD branch? Will test what happens in that case.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
/etc/resolv.confpoints
to../tmp/resolv.confwhich in turn is properly populated and names do resolve. systemd-hostnamed is acting like it does on Fedora (for what it's worth), I'm still learning about how to test it properly (that is, I just have a static hostname at the moment).
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Ok, I'll do a clean rebuild without networkd and with NetworkManager.
Thanks a lot!
BTW, for these bugs, if there is something easy we can add to the testing infrastructure to make sure it keeps working, it would be nice!
I'm not yet familiar with the the testing infrastructure. Would that be something like providing a certain set of defconfigs, booting into the generated filesystems and testing if dns works?
Quoted 6 lines
Quoted 5 lines
Best regards,
Thomas
Best wishes,
Marcus
cover system: properly handle systemd as init system
Hello,
Quoted 6 lines · Marcus Hoffmann
Quoted 2 lines
Quoted 2 lines
BTW, for these bugs, if there is something easy we can add to the testing infrastructure to make sure it keeps working, it would be nice!
I'm not yet familiar with the the testing infrastructure. Would that be something like providing a certain set of defconfigs, booting into the generated filesystems and testing if dns works?
Exactly that. The testing infrastructure makes it very easy to provide a defconfig fragment, build it, boot it under Qemu, and run arbitrary commands.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com