* [Buildroot] [pull request] skeleton: fix custom skeleton for use with systemd
@ 2015-11-10 21:36 Yann E. MORIN
2015-11-10 21:36 ` [Buildroot] [PATCH 1/3] package/skeleton: qstrip path before using it Yann E. MORIN
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Yann E. MORIN @ 2015-11-10 21:36 UTC (permalink / raw)
To: buildroot
Hello All!
The current situation with systemd and a custom skeleton is a little bit
muddy.
Buildroot does not support a split /usr when systemd is used as the init
system. We also have some tricks and tweaks in a few packages to
accomodate a merged /usr and play nice with systemd.
However, when a custom skeleton is used, the user may provide a skeleton
with a split /usr. In that case, our little tricks and tweaks may no
longer be functional.
Since we defined a policy in Buidroot that we use a merged /usr for use
with systemd, we must ensure that a custom skeleton is set up for a
merged /usr when systemd is used.
The series is pretty trivial, with two initial cleanup patches. The
third patch is the core of the change, and actually implements the test
that the custom skeleton actually uses a merged /usr when required.
Regards,
Yann E. MORIN.
The following changes since commit 185aa5b0f0a630b14885b78fb0033397ce7eb3a1:
gettext: fix legal info (2015-11-10 11:28:51 +0100)
are available in the git repository at:
git://git.busybox.net/~ymorin/git/buildroot yem/systemd-merged-usr-fix
for you to fetch changes up to d667c39209bc260f60546ee0b9e7f5a661c4b761:
package/skeleton: ensure custom skeleton uses merged /usr if needed (2015-11-10 19:58:42 +0100)
----------------------------------------------------------------
Yann E. MORIN (3):
package/skeleton: qstrip path before using it
package/skeleton: don't handle merged /usr for custom skeleton
package/skeleton: ensure custom skeleton uses merged /usr if needed
package/skeleton/skeleton.mk | 46 +++++++++++++++++++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 3 deletions(-)
--
.-----------------.--------------------.------------------.--------------------.
| 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. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/3] package/skeleton: qstrip path before using it
2015-11-10 21:36 [Buildroot] [pull request] skeleton: fix custom skeleton for use with systemd Yann E. MORIN
@ 2015-11-10 21:36 ` Yann E. MORIN
2015-11-10 21:36 ` [Buildroot] [PATCH 2/3] package/skeleton: don't handle merged /usr for custom skeleton Yann E. MORIN
2015-11-10 21:36 ` [Buildroot] [PATCH 3/3] package/skeleton: ensure custom skeleton uses merged /usr if needed Yann E. MORIN
2 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2015-11-10 21:36 UTC (permalink / raw)
To: buildroot
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
---
package/skeleton/skeleton.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package/skeleton/skeleton.mk b/package/skeleton/skeleton.mk
index d1b797d..11a609b 100644
--- a/package/skeleton/skeleton.mk
+++ b/package/skeleton/skeleton.mk
@@ -14,7 +14,7 @@ SKELETON_SOURCE =
SKELETON_ADD_TOOLCHAIN_DEPENDENCY = NO
ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
-SKELETON_PATH = $(BR2_ROOTFS_SKELETON_CUSTOM_PATH)
+SKELETON_PATH = $(call qstrip,$(BR2_ROOTFS_SKELETON_CUSTOM_PATH))
else
SKELETON_PATH = system/skeleton
endif
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 2/3] package/skeleton: don't handle merged /usr for custom skeleton
2015-11-10 21:36 [Buildroot] [pull request] skeleton: fix custom skeleton for use with systemd Yann E. MORIN
2015-11-10 21:36 ` [Buildroot] [PATCH 1/3] package/skeleton: qstrip path before using it Yann E. MORIN
@ 2015-11-10 21:36 ` Yann E. MORIN
2015-11-10 21:36 ` [Buildroot] [PATCH 3/3] package/skeleton: ensure custom skeleton uses merged /usr if needed Yann E. MORIN
2 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2015-11-10 21:36 UTC (permalink / raw)
To: buildroot
In case the user wants to use a custom skeleton, we should not try to
handle the symlinks (resp. mkdir) to handle merged (resp. split) /usr.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Cc: Peter Korsgaard <jacmet@uclibc.org>
---
package/skeleton/skeleton.mk | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/package/skeleton/skeleton.mk b/package/skeleton/skeleton.mk
index 11a609b..38391de 100644
--- a/package/skeleton/skeleton.mk
+++ b/package/skeleton/skeleton.mk
@@ -15,9 +15,9 @@ SKELETON_ADD_TOOLCHAIN_DEPENDENCY = NO
ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
SKELETON_PATH = $(call qstrip,$(BR2_ROOTFS_SKELETON_CUSTOM_PATH))
-else
+else # ! custom skeleton
+
SKELETON_PATH = system/skeleton
-endif
ifeq ($(BR2_ROOTFS_MERGED_USR),y)
define SKELETON_USR_SYMLINKS_OR_DIRS
@@ -33,6 +33,8 @@ define SKELETON_USR_SYMLINKS_OR_DIRS
endef
endif
+endif # ! custom skeleton
+
define SKELETON_INSTALL_TARGET_CMDS
rsync -a --ignore-times $(SYNC_VCS_EXCLUSIONS) \
--chmod=u=rwX,go=rX --exclude .empty --exclude '*~' \
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 3/3] package/skeleton: ensure custom skeleton uses merged /usr if needed
2015-11-10 21:36 [Buildroot] [pull request] skeleton: fix custom skeleton for use with systemd Yann E. MORIN
2015-11-10 21:36 ` [Buildroot] [PATCH 1/3] package/skeleton: qstrip path before using it Yann E. MORIN
2015-11-10 21:36 ` [Buildroot] [PATCH 2/3] package/skeleton: don't handle merged /usr for custom skeleton Yann E. MORIN
@ 2015-11-10 21:36 ` Yann E. MORIN
2015-11-10 23:22 ` Peter Korsgaard
2 siblings, 1 reply; 6+ messages in thread
From: Yann E. MORIN @ 2015-11-10 21:36 UTC (permalink / raw)
To: buildroot
When using systemd, the poolicy in Buildroot is to use a merged /usr
(see c5bd8af6, "system: add options for /bin /sbin and /lib to be
symlinks into /usr" for more info). So, we apply a few tricks in some
packages to account for the merged /usr case.
However, when using a custom skeleton, we have no say in how that
skeleton is organised, so it may well have a split /usr. In that case,
our little tricks might not work as expected.
So, when the user uses a custom skeleton and wants systemd as an init
system, we must check that the custom skeleton is setup with a merged
/usr.
We do that by checking that each pair of {/lib,/usr/lib} {/bin,/usr/bin}
and {/sbin,/usr/sbin} have the same inode numbers, i.e. /lib must have
the same inode number as /usr/lib (and so on...). When a pair does not
share the same inode number, this is not a merged /usr and we abort.
We implement that check with make constructs, so it is done very early
in the build process, and we can abort early if need be.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Cc: Peter Korsgaard <jacmet@uclibc.org>
---
package/skeleton/skeleton.mk | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/package/skeleton/skeleton.mk b/package/skeleton/skeleton.mk
index 38391de..46e8cc4 100644
--- a/package/skeleton/skeleton.mk
+++ b/package/skeleton/skeleton.mk
@@ -14,7 +14,45 @@ SKELETON_SOURCE =
SKELETON_ADD_TOOLCHAIN_DEPENDENCY = NO
ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
+
SKELETON_PATH = $(call qstrip,$(BR2_ROOTFS_SKELETON_CUSTOM_PATH))
+
+ifeq ($(BR2_ROOTFS_MERGED_USR),y)
+
+# Ensure the user has prepared a merged /usr.
+#
+# Extract the inode numbers for all of those directories. In case any is
+# a symlink, we want to get the inode of the pointed-to directory, so we
+# append '/.' to be sure we get the target directory. Since the symlinks
+# can be anyway (/bin -> /usr/bin or /usr/bin -> /bin), we do that for
+# all of them.
+#
+SKELETON_LIB_INODE = $(shell stat -c '%i' $(SKELETON_PATH)/lib/.)
+SKELETON_BIN_INODE = $(shell stat -c '%i' $(SKELETON_PATH)/bin/.)
+SKELETON_SBIN_INODE = $(shell stat -c '%i' $(SKELETON_PATH)/sbin/.)
+SKELETON_USR_LIB_INODE = $(shell stat -c '%i' $(SKELETON_PATH)/usr/lib/.)
+SKELETON_USR_BIN_INODE = $(shell stat -c '%i' $(SKELETON_PATH)/usr/bin/.)
+SKELETON_USR_SBIN_INODE = $(shell stat -c '%i' $(SKELETON_PATH)/usr/sbin/.)
+
+ifneq ($(SKELETON_LIB_INODE),$(SKELETON_USR_LIB_INODE))
+SKELETON_CUSTOM_NOT_MERGED_USR += /lib
+endif
+ifneq ($(SKELETON_BIN_INODE),$(SKELETON_USR_BIN_INODE))
+SKELETON_CUSTOM_NOT_MERGED_USR += /bin
+endif
+ifneq ($(SKELETON_SBIN_INODE),$(SKELETON_USR_SBIN_INODE))
+SKELETON_CUSTOM_NOT_MERGED_USR += /sbin
+endif
+
+ifneq ($(SKELETON_CUSTOM_NOT_MERGED_USR),)
+$(error Use of systemd as an init system requires a merged /usr. \
+ However, the custom skeleton in $(SKELETON_PATH) is not \
+ using a merged /usr for the following directories: \
+ $(SKELETON_CUSTOM_NOT_MERGED_USR))
+endif
+
+endif # merged /usr
+
else # ! custom skeleton
SKELETON_PATH = system/skeleton
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 3/3] package/skeleton: ensure custom skeleton uses merged /usr if needed
2015-11-10 21:36 ` [Buildroot] [PATCH 3/3] package/skeleton: ensure custom skeleton uses merged /usr if needed Yann E. MORIN
@ 2015-11-10 23:22 ` Peter Korsgaard
2015-11-11 12:52 ` Yann E. MORIN
0 siblings, 1 reply; 6+ messages in thread
From: Peter Korsgaard @ 2015-11-10 23:22 UTC (permalink / raw)
To: buildroot
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> When using systemd, the poolicy in Buildroot is to use a merged /usr
> (see c5bd8af6, "system: add options for /bin /sbin and /lib to be
> symlinks into /usr" for more info). So, we apply a few tricks in some
> packages to account for the merged /usr case.
> However, when using a custom skeleton, we have no say in how that
> skeleton is organised, so it may well have a split /usr. In that case,
> our little tricks might not work as expected.
> So, when the user uses a custom skeleton and wants systemd as an init
> system, we must check that the custom skeleton is setup with a merged
> /usr.
> We do that by checking that each pair of {/lib,/usr/lib} {/bin,/usr/bin}
> and {/sbin,/usr/sbin} have the same inode numbers, i.e. /lib must have
> the same inode number as /usr/lib (and so on...). When a pair does not
> share the same inode number, this is not a merged /usr and we abort.
> We implement that check with make constructs, so it is done very early
> in the build process, and we can abort early if need be.
Nice. It doesn't handle cases where absolute symlinks are used
(E.G. /bin -> /usr/bin), but I don't see how we can fix that.
Committed series, thanks.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 3/3] package/skeleton: ensure custom skeleton uses merged /usr if needed
2015-11-10 23:22 ` Peter Korsgaard
@ 2015-11-11 12:52 ` Yann E. MORIN
0 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2015-11-11 12:52 UTC (permalink / raw)
To: buildroot
Peter, All,
On 2015-11-11 00:22 +0100, Peter Korsgaard spake thusly:
> >>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
>
> > When using systemd, the poolicy in Buildroot is to use a merged /usr
> > (see c5bd8af6, "system: add options for /bin /sbin and /lib to be
> > symlinks into /usr" for more info). So, we apply a few tricks in some
> > packages to account for the merged /usr case.
>
> > However, when using a custom skeleton, we have no say in how that
> > skeleton is organised, so it may well have a split /usr. In that case,
> > our little tricks might not work as expected.
>
> > So, when the user uses a custom skeleton and wants systemd as an init
> > system, we must check that the custom skeleton is setup with a merged
> > /usr.
>
> > We do that by checking that each pair of {/lib,/usr/lib} {/bin,/usr/bin}
> > and {/sbin,/usr/sbin} have the same inode numbers, i.e. /lib must have
> > the same inode number as /usr/lib (and so on...). When a pair does not
> > share the same inode number, this is not a merged /usr and we abort.
>
> > We implement that check with make constructs, so it is done very early
> > in the build process, and we can abort early if need be.
>
> Nice. It doesn't handle cases where absolute symlinks are used
> (E.G. /bin -> /usr/bin), but I don't see how we can fix that.
In that situation, then target/bin would indeed point to /usr/bin would
point to the host's /usr/bin and that would break horribly as soon as a
package would try to install something in there.
Well, that is not a change from the previous behaviour. that case was
broken (aka unsupported) previously, it is still broken.
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| 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. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-11-11 12:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-10 21:36 [Buildroot] [pull request] skeleton: fix custom skeleton for use with systemd Yann E. MORIN
2015-11-10 21:36 ` [Buildroot] [PATCH 1/3] package/skeleton: qstrip path before using it Yann E. MORIN
2015-11-10 21:36 ` [Buildroot] [PATCH 2/3] package/skeleton: don't handle merged /usr for custom skeleton Yann E. MORIN
2015-11-10 21:36 ` [Buildroot] [PATCH 3/3] package/skeleton: ensure custom skeleton uses merged /usr if needed Yann E. MORIN
2015-11-10 23:22 ` Peter Korsgaard
2015-11-11 12:52 ` Yann E. MORIN
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.