* [Buildroot] [PATCH 01/24] package/skeleton: remove useless .empty file
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 02/24] system: sysvinit only selects busybox-show-others if busybox is enabled Yann E. MORIN
` (23 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
Se now have a real file in that directory, so we do not need a .empty
placeholder.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
system/skeleton/etc/network/if-pre-up.d/.empty | 0
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 system/skeleton/etc/network/if-pre-up.d/.empty
diff --git a/system/skeleton/etc/network/if-pre-up.d/.empty b/system/skeleton/etc/network/if-pre-up.d/.empty
deleted file mode 100644
index e69de29..0000000
--
2.7.4
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 02/24] system: sysvinit only selects busybox-show-others if busybox is enabled
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 01/24] package/skeleton: remove useless .empty file Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 03/24] package/skeleton: respect variables namespace Yann E. MORIN
` (22 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS is a bit special. When Busybox is
enabled, it is a Busybox option. When Busybox is not enabled, it is a
stand-alone option, forcibly enabled.
So we can safely 'select' it without ensuring (via a 'depends on' or
another 'select') that Busybox is enabled.
However, the name of this option does not express the fact that it is
safe to select it without checking Busybox, which can lead to a bit of
time-consuming head-scratching.
To avoid future puzzlement from an unsuspecting observer, consider this
to be a Busybox option, and only select it when Busybox is enabled.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Peter Korsgaard <peter@korsgaard.com>
---
Changes v1 -> v2:
- only select if busybox is enabled (Thomas)
---
Hopefully, this will avoid people to go hunting like I did, and loose a
few precious minutes of hair-pulling... ;-]
---
system/Config.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/system/Config.in b/system/Config.in
index 9441467..2d20230 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -74,7 +74,7 @@ config BR2_INIT_BUSYBOX
config BR2_INIT_SYSV
bool "systemV"
- select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # sysvinit
+ select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS if BR2_PACKAGE_BUSYBOX # sysvinit
select BR2_PACKAGE_INITSCRIPTS
select BR2_PACKAGE_SYSVINIT
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 03/24] package/skeleton: respect variables namespace
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 01/24] package/skeleton: remove useless .empty file Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 02/24] system: sysvinit only selects busybox-show-others if busybox is enabled Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 04/24] system/skeleton: update etc/mtab with a more sensible link Yann E. MORIN
` (21 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
In makefiles, variable have global scope. We readitionally ensure that
we get no name clashing by prefixing all variables with the package
name.
Currently, this is not the case in the skeleton package, for historical
reasons (code snippets copied over from the common Makefiles). We
currently have a mix of namings for the variables:
- some are indeed prefixed with SKELETON_
- some are prefixed with SYSTEM_
- some are not prefixed
Clean up thiese discrepancies, and prefix all variables with just
SKELETON_ and drop the SYSTEM_ prefix.
Also include SET_ in all variables that do set something (getty) for
consistency across all the variables.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
package/skeleton/skeleton.mk | 60 ++++++++++++++++++++++----------------------
1 file changed, 30 insertions(+), 30 deletions(-)
diff --git a/package/skeleton/skeleton.mk b/package/skeleton/skeleton.mk
index 4e3cdc6..3852448 100644
--- a/package/skeleton/skeleton.mk
+++ b/package/skeleton/skeleton.mk
@@ -121,24 +121,24 @@ SKELETON_TARGET_GENERIC_GETTY_TERM = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_TE
SKELETON_TARGET_GENERIC_GETTY_OPTIONS = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_OPTIONS))
ifneq ($(SKELETON_TARGET_GENERIC_HOSTNAME),)
-define SYSTEM_HOSTNAME
+define SKELETON_SET_HOSTNAME
mkdir -p $(TARGET_DIR)/etc
echo "$(SKELETON_TARGET_GENERIC_HOSTNAME)" > $(TARGET_DIR)/etc/hostname
$(SED) '$$a \127.0.1.1\t$(SKELETON_TARGET_GENERIC_HOSTNAME)' \
-e '/^127.0.1.1/d' $(TARGET_DIR)/etc/hosts
endef
-TARGET_FINALIZE_HOOKS += SYSTEM_HOSTNAME
+TARGET_FINALIZE_HOOKS += SKELETON_SET_HOSTNAME
endif
ifneq ($(SKELETON_TARGET_GENERIC_ISSUE),)
-define SYSTEM_ISSUE
+define SKELETON_SET_ISSUE
mkdir -p $(TARGET_DIR)/etc
echo "$(SKELETON_TARGET_GENERIC_ISSUE)" > $(TARGET_DIR)/etc/issue
endef
-TARGET_FINALIZE_HOOKS += SYSTEM_ISSUE
+TARGET_FINALIZE_HOOKS += SKELETON_SET_ISSUE
endif
-define SET_NETWORK_LOCALHOST
+define SKELETON_SET_NETWORK_LOCALHOST
( \
echo "# interface file auto-generated by buildroot"; \
echo ; \
@@ -147,14 +147,14 @@ define SET_NETWORK_LOCALHOST
) > $(TARGET_DIR)/etc/network/interfaces
endef
-NETWORK_DHCP_IFACE = $(call qstrip,$(BR2_SYSTEM_DHCP))
+SKELETON_NETWORK_DHCP_IFACE = $(call qstrip,$(BR2_SYSTEM_DHCP))
-ifneq ($(NETWORK_DHCP_IFACE),)
-define SET_NETWORK_DHCP
+ifneq ($(SKELETON_NETWORK_DHCP_IFACE),)
+define SKELETON_SET_NETWORK_DHCP
( \
echo ; \
- echo "auto $(NETWORK_DHCP_IFACE)"; \
- echo "iface $(NETWORK_DHCP_IFACE) inet dhcp"; \
+ echo "auto $(SKELETON_NETWORK_DHCP_IFACE)"; \
+ echo "iface $(SKELETON_NETWORK_DHCP_IFACE) inet dhcp"; \
echo " pre-up /etc/network/nfs_check"; \
echo " wait-delay 15"; \
) >> $(TARGET_DIR)/etc/network/interfaces
@@ -163,13 +163,13 @@ define SET_NETWORK_DHCP
endef
endif
-define SET_NETWORK
+define SKELETON_SET_NETWORK
mkdir -p $(TARGET_DIR)/etc/network/
- $(SET_NETWORK_LOCALHOST)
- $(SET_NETWORK_DHCP)
+ $(SKELETON_SET_NETWORK_LOCALHOST)
+ $(SKELETON_SET_NETWORK_DHCP)
endef
-TARGET_FINALIZE_HOOKS += SET_NETWORK
+TARGET_FINALIZE_HOOKS += SKELETON_SET_NETWORK
# The TARGET_FINALIZE_HOOKS must be sourced only if the users choose to use the
# default skeleton.
@@ -177,66 +177,66 @@ ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y)
ifeq ($(BR2_TARGET_ENABLE_ROOT_LOGIN),y)
ifeq ($(SKELETON_TARGET_GENERIC_ROOT_PASSWD),)
-SYSTEM_ROOT_PASSWORD =
+SKELETON_ROOT_PASSWORD =
else ifneq ($(filter $$1$$% $$5$$% $$6$$%,$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)),)
-SYSTEM_ROOT_PASSWORD = '$(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.
-SYSTEM_ROOT_PASSWORD = "`$(MKPASSWD) -m "$(SKELETON_TARGET_GENERIC_PASSWD_METHOD)" "$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)"`"
+SKELETON_ROOT_PASSWORD = "`$(MKPASSWD) -m "$(SKELETON_TARGET_GENERIC_PASSWD_METHOD)" "$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)"`"
endif
else # !BR2_TARGET_ENABLE_ROOT_LOGIN
-SYSTEM_ROOT_PASSWORD = "*"
+SKELETON_ROOT_PASSWORD = "*"
endif
-define SKELETON_SYSTEM_SET_ROOT_PASSWD
- $(SED) s,^root:[^:]*:,root:$(SYSTEM_ROOT_PASSWORD):, $(TARGET_DIR)/etc/shadow
+define SKELETON_SET_ROOT_PASSWD
+ $(SED) s,^root:[^:]*:,root:$(SKELETON_ROOT_PASSWORD):, $(TARGET_DIR)/etc/shadow
endef
-TARGET_FINALIZE_HOOKS += SKELETON_SYSTEM_SET_ROOT_PASSWD
+TARGET_FINALIZE_HOOKS += SKELETON_SET_ROOT_PASSWD
ifeq ($(BR2_SYSTEM_BIN_SH_NONE),y)
-define SKELETON_SYSTEM_BIN_SH
+define SKELETON_BIN_SH
rm -f $(TARGET_DIR)/bin/sh
endef
else
-define SKELETON_SYSTEM_BIN_SH
+define SKELETON_BIN_SH
ln -sf $(SKELETON_TARGET_GENERIC_BIN_SH) $(TARGET_DIR)/bin/sh
endef
endif
-TARGET_FINALIZE_HOOKS += SKELETON_SYSTEM_BIN_SH
+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_SYSTEM_GETTY
+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_SYSTEM_GETTY
+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_SYSTEM_GETTY
+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
-define SKELETON_SYSTEM_REMOUNT_RW
+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_SYSTEM_REMOUNT_RW
+define SKELETON_REMOUNT_RW
$(SED) '/^[^#].*-o remount,rw \/$$/s~^~#~' $(TARGET_DIR)/etc/inittab
endef
endif
-TARGET_FINALIZE_HOOKS += SKELETON_SYSTEM_REMOUNT_RW
+TARGET_FINALIZE_HOOKS += SKELETON_REMOUNT_RW
endif # BR2_INIT_BUSYBOX || BR2_INIT_SYSV
endif # BR2_ROOTFS_SKELETON_DEFAULT
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 04/24] system/skeleton: update etc/mtab with a more sensible link
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (2 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 03/24] package/skeleton: respect variables namespace Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 05/24] system: systemd only really supports a R/W rootfs Yann E. MORIN
` (20 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
Currently, our /etc/mtab points to /proc/mounts. This was all neat so
far, and was good for a sysv-like init system.
However, the way to day is to point it at /proc/self/mounts, the
per-process mount tab.
Additionnally, that's what systemd expects. If /etc/mtab is not a
symlink to ../proc/self/mounts and the rootfs is readonly, systemd would
whine loudly (and a service unit is marked failed).
Since it works well for sysv-like init systems too, just use that.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
system/skeleton/etc/mtab | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/system/skeleton/etc/mtab b/system/skeleton/etc/mtab
index 4c0a094..5c4677a 120000
--- a/system/skeleton/etc/mtab
+++ b/system/skeleton/etc/mtab
@@ -1 +1 @@
-/proc/mounts
\ No newline at end of file
+../proc/self/mounts
\ No newline at end of file
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 05/24] system: systemd only really supports a R/W rootfs
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (3 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 04/24] system/skeleton: update etc/mtab with a more sensible link Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 06/24] package/systemd: disabling tty1 getty is a post-install hook Yann E. MORIN
` (19 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
Supporting a R/O rootfs needs a bit more love to be fully operational.
This will come in later patches...
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
system/Config.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/system/Config.in b/system/Config.in
index 2d20230..4f9f270 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -94,6 +94,7 @@ 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
comment "systemd needs (e)glibc toolchain, headers >= 3.10"
depends on !(BR2_TOOLCHAIN_USES_GLIBC \
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 06/24] package/systemd: disabling tty1 getty is a post-install hook
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (4 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 05/24] system: systemd only really supports a R/W rootfs Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 07/24] system: provide no default for custom skeleton path Yann E. MORIN
` (18 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
Currently, we disable the getty on tty1 as a "init" step. It looks
better like it is a post-install hook.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
package/systemd/systemd.mk | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
index b525397..193f221 100644
--- a/package/systemd/systemd.mk
+++ b/package/systemd/systemd.mk
@@ -205,10 +205,15 @@ define SYSTEMD_INSTALL_MACHINEID_HOOK
touch $(TARGET_DIR)/etc/machine-id
endef
+define SYSTEMD_DISABLE_SERVICE_TTY1_HOOK
+ rm -f $(TARGET_DIR)/etc/systemd/system/getty.target.wants/getty at tty1.service
+endef
+
SYSTEMD_POST_INSTALL_TARGET_HOOKS += \
SYSTEMD_INSTALL_INIT_HOOK \
SYSTEMD_INSTALL_MACHINEID_HOOK \
- SYSTEMD_INSTALL_RESOLVCONF_HOOK
+ SYSTEMD_INSTALL_RESOLVCONF_HOOK \
+ SYSTEMD_DISABLE_SERVICE_TTY1_HOOK
define SYSTEMD_USERS
systemd-journal -1 systemd-journal -1 * /var/log/journal - - Journal
@@ -222,10 +227,6 @@ define SYSTEMD_USERS
- - input -1 * - - - Input device group
endef
-define SYSTEMD_DISABLE_SERVICE_TTY1
- rm -f $(TARGET_DIR)/etc/systemd/system/getty.target.wants/getty at tty1.service
-endef
-
ifneq ($(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT)),)
# systemd needs getty.service for VTs and serial-getty.service for serial ttys
# also patch the file to use the correct baud-rate, the default baudrate is 115200 so look for that
@@ -246,7 +247,6 @@ endef
endif
define SYSTEMD_INSTALL_INIT_SYSTEMD
- $(SYSTEMD_DISABLE_SERVICE_TTY1)
$(SYSTEMD_INSTALL_SERVICE_TTY)
$(SYSTEMD_INSTALL_SERVICE_NETWORK)
$(SYSTEMD_INSTALL_SERVICE_TIMESYNC)
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 07/24] system: provide no default for custom skeleton path
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (5 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 06/24] package/systemd: disabling tty1 getty is a post-install hook Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 08/24] system: move the rootfs skeleton choice Yann E. MORIN
` (17 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
Being custom means that our default one is not suitable to start with.
So there is no reson to offer it as the default path.
Add a separating empty line, for good measure, too.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
system/Config.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/system/Config.in b/system/Config.in
index 4f9f270..04b886b 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -179,9 +179,9 @@ config BR2_ROOTFS_SKELETON_CUSTOM
endchoice
if BR2_ROOTFS_SKELETON_CUSTOM
+
config BR2_ROOTFS_SKELETON_CUSTOM_PATH
string "custom target skeleton path"
- default "system/skeleton"
help
Path to custom target skeleton.
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 08/24] system: move the rootfs skeleton choice
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (6 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 07/24] system: provide no default for custom skeleton path Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 09/24] system: do not handle network settings for custom skeleton Yann E. MORIN
` (16 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
In the following commits, we'll be switching more options to be
conditional on the default or custom skeleton.
So, it makes sense that those options come after the choice of a
skeleton.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
system/Config.in | 56 ++++++++++++++++++++++++++++----------------------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/system/Config.in b/system/Config.in
index 04b886b..662443b 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -1,5 +1,33 @@
menu "System configuration"
+choice
+ prompt "Root FS skeleton"
+
+config BR2_ROOTFS_SKELETON_DEFAULT
+ bool "default target skeleton"
+ help
+ Use default target skeleton
+
+config BR2_ROOTFS_SKELETON_CUSTOM
+ bool "custom target skeleton"
+ help
+ Use custom target skeleton.
+
+endchoice
+
+if BR2_ROOTFS_SKELETON_CUSTOM
+
+config BR2_ROOTFS_SKELETON_CUSTOM_PATH
+ string "custom target skeleton path"
+ help
+ Path to custom target skeleton.
+
+# dummy config so merged /usr workarounds can also be activated for
+# custom rootfs skeleton
+config BR2_ROOTFS_MERGED_USR
+
+endif
+
config BR2_TARGET_GENERIC_HOSTNAME
string "System hostname"
default "buildroot"
@@ -163,34 +191,6 @@ config BR2_ROOTFS_STATIC_DEVICE_TABLE
See package/makedevs/README for details on the usage and
syntax of these files.
-choice
- prompt "Root FS skeleton"
-
-config BR2_ROOTFS_SKELETON_DEFAULT
- bool "default target skeleton"
- help
- Use default target skeleton
-
-config BR2_ROOTFS_SKELETON_CUSTOM
- bool "custom target skeleton"
- help
- Use custom target skeleton.
-
-endchoice
-
-if BR2_ROOTFS_SKELETON_CUSTOM
-
-config BR2_ROOTFS_SKELETON_CUSTOM_PATH
- string "custom target skeleton path"
- help
- Path to custom target skeleton.
-
-# dummy config so merged /usr workarounds can also be activated for
-# custom rootfs skeleton
-config BR2_ROOTFS_MERGED_USR
-
-endif
-
if BR2_ROOTFS_SKELETON_DEFAULT
config BR2_ROOTFS_MERGED_USR
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 09/24] system: do not handle network settings for custom skeleton
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (7 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 08/24] system: move the rootfs skeleton choice Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 10/24] package/perl: use dummy hostname Yann E. MORIN
` (15 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
package/skeleton/skeleton.mk | 8 ++++----
system/Config.in | 5 ++---
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/package/skeleton/skeleton.mk b/package/skeleton/skeleton.mk
index 3852448..144b759 100644
--- a/package/skeleton/skeleton.mk
+++ b/package/skeleton/skeleton.mk
@@ -138,6 +138,10 @@ endef
TARGET_FINALIZE_HOOKS += SKELETON_SET_ISSUE
endif
+# The TARGET_FINALIZE_HOOKS must be sourced only if the users choose to use the
+# default skeleton.
+ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y)
+
define SKELETON_SET_NETWORK_LOCALHOST
( \
echo "# interface file auto-generated by buildroot"; \
@@ -171,10 +175,6 @@ endef
TARGET_FINALIZE_HOOKS += SKELETON_SET_NETWORK
-# The TARGET_FINALIZE_HOOKS must be sourced only if the users choose to use the
-# default skeleton.
-ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y)
-
ifeq ($(BR2_TARGET_ENABLE_ROOT_LOGIN),y)
ifeq ($(SKELETON_TARGET_GENERIC_ROOT_PASSWD),)
SKELETON_ROOT_PASSWORD =
diff --git a/system/Config.in b/system/Config.in
index 662443b..c02f394 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -352,9 +352,6 @@ config BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW
read-only.
If unsure, say Y.
-endif # BR2_ROOTFS_SKELETON_DEFAULT
-
-
config BR2_SYSTEM_DHCP
string "Network interface to configure through DHCP"
default ""
@@ -374,6 +371,8 @@ comment "automatic network configuration via DHCP is not compatible with network
comment "automatic network configuration via DHCP needs ifupdown or busybox"
depends on !(BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN)
+endif # BR2_ROOTFS_SKELETON_DEFAULT
+
config BR2_TARGET_TZ_INFO
bool "Install timezone info"
# No timezone for musl; only for uClibc or (e)glibc.
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 10/24] package/perl: use dummy hostname
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (8 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 09/24] system: do not handle network settings for custom skeleton Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 11/24] system: do not set hostname and issue for custom skeleton Yann E. MORIN
` (14 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
The hostname does not look like it serves any useful purpose, except
maybe to set set perladmin email.
Which is undoubtfully useless on the target.
A followup commit will make the hostname depend on the default skeleton,
so it won't always be available. We can not rely on it to be set.
Use a dummy hostname.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
package/perl/perl.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package/perl/perl.mk b/package/perl/perl.mk
index 11b10ff..29af7a4 100644
--- a/package/perl/perl.mk
+++ b/package/perl/perl.mk
@@ -54,7 +54,7 @@ PERL_CONF_OPTS = \
-Dccflags="$(TARGET_CFLAGS)" \
-Dldflags="$(TARGET_LDFLAGS) -lm" \
-Dmydomain="" \
- -Dmyhostname="$(BR2_TARGET_GENERIC_HOSTNAME)" \
+ -Dmyhostname="noname" \
-Dmyuname="Buildroot $(BR2_VERSION_FULL)" \
-Dosname=linux \
-Dosvers=$(LINUX_VERSION) \
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 11/24] system: do not set hostname and issue for custom skeleton
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (9 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 10/24] package/perl: use dummy hostname Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 12/24] core/pkg-generic: add variable to skip skeleton dependency Yann E. MORIN
` (13 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
Note: beside the skeleton, the only other user of the hostname was the
perl package, and it was just previously changed not to use it anymore.
---
package/skeleton/skeleton.mk | 8 ++++----
system/Config.in | 4 ++++
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/package/skeleton/skeleton.mk b/package/skeleton/skeleton.mk
index 144b759..e67a477 100644
--- a/package/skeleton/skeleton.mk
+++ b/package/skeleton/skeleton.mk
@@ -110,6 +110,10 @@ define SKELETON_INSTALL_STAGING_CMDS
ln -snf lib $(STAGING_DIR)/usr/$(SKELETON_LIB_SYMLINK)
endef
+# The TARGET_FINALIZE_HOOKS must be sourced only if the users choose to use the
+# default skeleton.
+ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y)
+
SKELETON_TARGET_GENERIC_HOSTNAME = $(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME))
SKELETON_TARGET_GENERIC_ISSUE = $(call qstrip,$(BR2_TARGET_GENERIC_ISSUE))
SKELETON_TARGET_GENERIC_ROOT_PASSWD = $(call qstrip,$(BR2_TARGET_GENERIC_ROOT_PASSWD))
@@ -138,10 +142,6 @@ endef
TARGET_FINALIZE_HOOKS += SKELETON_SET_ISSUE
endif
-# The TARGET_FINALIZE_HOOKS must be sourced only if the users choose to use the
-# default skeleton.
-ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y)
-
define SKELETON_SET_NETWORK_LOCALHOST
( \
echo "# interface file auto-generated by buildroot"; \
diff --git a/system/Config.in b/system/Config.in
index c02f394..3a38bd4 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -28,6 +28,8 @@ config BR2_ROOTFS_MERGED_USR
endif
+if BR2_ROOTFS_SKELETON_DEFAULT
+
config BR2_TARGET_GENERIC_HOSTNAME
string "System hostname"
default "buildroot"
@@ -46,6 +48,8 @@ config BR2_TARGET_GENERIC_ISSUE
Leave empty to not create /etc/issue, or to keep the
one from a custom skeleton.
+endif
+
choice
bool "Passwords encoding"
default BR2_TARGET_GENERIC_PASSWD_MD5
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 12/24] core/pkg-generic: add variable to skip skeleton dependency
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (10 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 11/24] system: do not set hostname and issue for custom skeleton Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 13/24] package/skeleton: add macro to rsync skeleton directory Yann E. MORIN
` (12 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
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.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
package/pkg-generic.mk | 7 +++++--
package/skeleton/skeleton.mk | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 374d9d5..3281374 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -486,15 +486,18 @@ $(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),host)
$(2)_DEPENDENCIES ?= $$(filter-out host-skeleton host-toolchain $(1),\
$$(patsubst host-host-%,host-%,$$(addprefix host-,$$($(3)_DEPENDENCIES))))
endif
ifeq ($(4),target)
-ifneq ($(1),skeleton)
+ifeq ($$($(2)_ADD_SKELETON_DEPENDENCY),YES)
$(2)_DEPENDENCIES += skeleton
endif
ifeq ($$($(2)_ADD_TOOLCHAIN_DEPENDENCY),YES)
diff --git a/package/skeleton/skeleton.mk b/package/skeleton/skeleton.mk
index e67a477..072d217 100644
--- a/package/skeleton/skeleton.mk
+++ b/package/skeleton/skeleton.mk
@@ -12,6 +12,7 @@ SKELETON_SOURCE =
# 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
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 13/24] package/skeleton: add macro to rsync skeleton directory
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (11 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 12/24] core/pkg-generic: add variable to skip skeleton dependency Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 14/24] core/pkg-generic: allow packages to declare target-finalize hooks Yann E. MORIN
` (11 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
The rsync command is currently called from a single location. In
follow-up patches, it will be called from various places now.
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 wants to install in
staging, the macro must accept a destination path, rather than hard-code
target as the destination.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
package/skeleton/skeleton.mk | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/package/skeleton/skeleton.mk b/package/skeleton/skeleton.mk
index 072d217..e3ae694 100644
--- a/package/skeleton/skeleton.mk
+++ b/package/skeleton/skeleton.mk
@@ -62,6 +62,14 @@ SKELETON_PATH = system/skeleton
endif # ! custom skeleton
+# 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
+
# This function handles the merged or non-merged /usr cases
ifeq ($(BR2_ROOTFS_MERGED_USR),y)
define SKELETON_USR_SYMLINKS_OR_DIRS
@@ -86,9 +94,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)
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 14/24] core/pkg-generic: allow packages to declare target-finalize hooks
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (12 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 13/24] package/skeleton: add macro to rsync skeleton directory Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 15/24] packages: use the <PKG>_TARGET_FINALIZE_HOOKS Yann E. MORIN
` (10 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
Currently, our skeleton declares target-finalize hooks, and does so
unconditionally.
That's fine since we have a single skeleton package, and thus the hooks
it declares need not be conditional.
However, we're going to be adding more skeleton packages, one for the
custom skeleton, one for the sysv-like init systems and, eventually, one
for the systemd init system.
In that case, we will not want the sysv-like target-finalize hooks to be
applied when the init system is systemd. And the other way around, of
course. And so on for each type of skeleton...
The only soltuion we have so far is to enclose all target-finalize hooks
declarations between an ifeq-block to check that the package is enabled.
This is cumbersome to do, even more so when the hooks are themselves
conditional.
Add support in the core infra for packages to register such hooks, like
is done to register users, device tables and whatnots.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
docs/manual/adding-packages-hooks.txt | 7 +++++++
package/pkg-generic.mk | 2 ++
2 files changed, 9 insertions(+)
diff --git a/docs/manual/adding-packages-hooks.txt b/docs/manual/adding-packages-hooks.txt
index 5b5bf6a..d25092a 100644
--- a/docs/manual/adding-packages-hooks.txt
+++ b/docs/manual/adding-packages-hooks.txt
@@ -77,3 +77,10 @@ others, use the following variables:
* +$(SRCDIR)+: the path to the overridden source directory
* +$(@D)+: the path to the build directory
+
+==== Target-finalize hook
+
+Packages may also register hooks in +LIBFOO_TARGET_FINALIZE_HOOKS+.
+These hooks are run after all packages are built, but before the
+filesystem images are generated. They are seldom used, and your
+package probably do not need them.
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 3281374..4415342 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -558,6 +558,7 @@ $(2)_PRE_INSTALL_IMAGES_HOOKS ?=
$(2)_POST_INSTALL_IMAGES_HOOKS ?=
$(2)_PRE_LEGAL_INFO_HOOKS ?=
$(2)_POST_LEGAL_INFO_HOOKS ?=
+$(2)_TARGET_FINALIZE_HOOKS ?=
# human-friendly targets and target sequencing
$(1): $(1)-install
@@ -858,6 +859,7 @@ endif
ifneq ($$($(2)_USERS),)
PACKAGES_USERS += $$($(2)_USERS)$$(sep)
endif
+TARGET_FINALIZE_HOOKS += $$($(2)_TARGET_FINALIZE_HOOKS)
ifeq ($$($(2)_SITE_METHOD),svn)
DL_TOOLS_DEPENDENCIES += svn
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 15/24] packages: use the <PKG>_TARGET_FINALIZE_HOOKS
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (13 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 14/24] core/pkg-generic: allow packages to declare target-finalize hooks Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 16/24] package/skeleton: split into sysv and custom skeleton Yann E. MORIN
` (9 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
Register package-specific target-finalize hooks with the
newly-introduced <PKG>_TARGET_FINALIZE_HOOKS.
To be noted, the skeleton package is not converted, because it is not
optional, we always have it; so its hooks would always be registered
anyway. Besides, the followup patches would render this conversion moot
anyway, since those hooks would be spread across the various skeleton
packages.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
package/google-breakpad/google-breakpad.mk | 6 ++----
package/libglib2/libglib2.mk | 6 ++----
package/libgtk3/libgtk3.mk | 4 +---
package/luarocks/luarocks.mk | 3 +--
package/perl/perl.mk | 4 +---
package/python/python.mk | 10 ++++------
package/python3/python3.mk | 10 ++++------
7 files changed, 15 insertions(+), 28 deletions(-)
diff --git a/package/google-breakpad/google-breakpad.mk b/package/google-breakpad/google-breakpad.mk
index 1bbe4da..7a88c76 100644
--- a/package/google-breakpad/google-breakpad.mk
+++ b/package/google-breakpad/google-breakpad.mk
@@ -13,15 +13,13 @@ GOOGLE_BREAKPAD_INSTALL_TARGET = NO
GOOGLE_BREAKPAD_INSTALL_STAGING = YES
GOOGLE_BREAKPAD_LICENSE = BSD-3c
GOOGLE_BREAKPAD_LICENSE_FILES = LICENSE
-
-ifeq ($(BR2_PACKAGE_GOOGLE_BREAKPAD),y)
GOOGLE_BREAKPAD_DEPENDENCIES = host-google-breakpad
+
define GOOGLE_BREAKPAD_EXTRACT_SYMBOLS
$(EXTRA_ENV) package/google-breakpad/gen-syms.sh $(STAGING_DIR) \
$(TARGET_DIR) $(call qstrip,$(BR2_GOOGLE_BREAKPAD_INCLUDE_FILES))
endef
-TARGET_FINALIZE_HOOKS += GOOGLE_BREAKPAD_EXTRACT_SYMBOLS
-endif
+GOOGLE_BREAKPAD_TARGET_FINALIZE_HOOKS += GOOGLE_BREAKPAD_EXTRACT_SYMBOLS
$(eval $(autotools-package))
$(eval $(host-autotools-package))
diff --git a/package/libglib2/libglib2.mk b/package/libglib2/libglib2.mk
index b479bae..e2bff6d 100644
--- a/package/libglib2/libglib2.mk
+++ b/package/libglib2/libglib2.mk
@@ -160,10 +160,8 @@ define LIBGLIB2_COMPILE_SCHEMAS
--targetdir=$(TARGET_DIR)/usr/share/glib-2.0/schemas
endef
-ifeq ($(BR2_PACKAGE_LIBGLIB2),y)
-TARGET_FINALIZE_HOOKS += LIBGLIB2_REMOVE_TARGET_SCHEMAS
-TARGET_FINALIZE_HOOKS += LIBGLIB2_COMPILE_SCHEMAS
-endif
+LIBGLIB2_TARGET_FINALIZE_HOOKS += LIBGLIB2_REMOVE_TARGET_SCHEMAS
+LIBGLIB2_TARGET_FINALIZE_HOOKS += LIBGLIB2_COMPILE_SCHEMAS
$(eval $(autotools-package))
$(eval $(host-autotools-package))
diff --git a/package/libgtk3/libgtk3.mk b/package/libgtk3/libgtk3.mk
index f447e7a..08d172f 100644
--- a/package/libgtk3/libgtk3.mk
+++ b/package/libgtk3/libgtk3.mk
@@ -182,13 +182,11 @@ endef
# Create icon-theme.cache for each of the icon directories/themes
# It's not strictly necessary but speeds up lookups
-ifeq ($(BR2_PACKAGE_LIBGTK3),y)
define LIBGTK3_UPDATE_ICON_CACHE
find $(TARGET_DIR)/usr/share/icons -maxdepth 1 -mindepth 1 -type d \
-exec $(HOST_DIR)/usr/bin/gtk-update-icon-cache {} \;
endef
-TARGET_FINALIZE_HOOKS += LIBGTK3_UPDATE_ICON_CACHE
-endif
+LIBGTK3_TARGET_FINALIZE_HOOKS += LIBGTK3_UPDATE_ICON_CACHE
$(eval $(autotools-package))
$(eval $(host-autotools-package))
diff --git a/package/luarocks/luarocks.mk b/package/luarocks/luarocks.mk
index 656b832..eddd435 100644
--- a/package/luarocks/luarocks.mk
+++ b/package/luarocks/luarocks.mk
@@ -60,5 +60,4 @@ define LUAROCKS_FINALIZE_TARGET
rm -rf $(TARGET_DIR)/usr/lib/luarocks
endef
-TARGET_FINALIZE_HOOKS += LUAROCKS_FINALIZE_TARGET
-
+LUAROCKS_TARGET_FINALIZE_HOOKS += LUAROCKS_FINALIZE_TARGET
diff --git a/package/perl/perl.mk b/package/perl/perl.mk
index 29af7a4..ca70123 100644
--- a/package/perl/perl.mk
+++ b/package/perl/perl.mk
@@ -114,7 +114,6 @@ endef
$(eval $(generic-package))
$(eval $(host-generic-package))
-ifeq ($(BR2_PACKAGE_PERL),y)
define PERL_FINALIZE_TARGET
rm -rf $(TARGET_DIR)/usr/lib/perl5/$(PERL_VERSION)/pod
rm -rf $(TARGET_DIR)/usr/lib/perl5/$(PERL_VERSION)/$(PERL_ARCHNAME)/CORE
@@ -122,5 +121,4 @@ define PERL_FINALIZE_TARGET
find $(TARGET_DIR)/usr/lib/perl5/ -name '*.bs' -print0 | xargs -0 rm -f
find $(TARGET_DIR)/usr/lib/perl5/ -name '.packlist' -print0 | xargs -0 rm -f
endef
-TARGET_FINALIZE_HOOKS += PERL_FINALIZE_TARGET
-endif
+PERL_TARGET_FINALIZE_HOOKS += PERL_FINALIZE_TARGET
diff --git a/package/python/python.mk b/package/python/python.mk
index 913dc2c..5e13bf3 100644
--- a/package/python/python.mk
+++ b/package/python/python.mk
@@ -226,7 +226,7 @@ define PYTHON_CREATE_PYC_FILES
endef
ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY)$(BR2_PACKAGE_PYTHON_PY_PYC),y)
-TARGET_FINALIZE_HOOKS += PYTHON_CREATE_PYC_FILES
+PYTHON_TARGET_FINALIZE_HOOKS += PYTHON_CREATE_PYC_FILES
endif
ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
@@ -234,7 +234,7 @@ define PYTHON_REMOVE_PY_FILES
find $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR) -name '*.py' -print0 | \
xargs -0 --no-run-if-empty rm -f
endef
-TARGET_FINALIZE_HOOKS += PYTHON_REMOVE_PY_FILES
+PYTHON_TARGET_FINALIZE_HOOKS += PYTHON_REMOVE_PY_FILES
endif
# Normally, *.pyc files should not have been compiled, but just in
@@ -244,14 +244,12 @@ define PYTHON_REMOVE_PYC_FILES
find $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR) -name '*.pyc' -print0 | \
xargs -0 --no-run-if-empty rm -f
endef
-TARGET_FINALIZE_HOOKS += PYTHON_REMOVE_PYC_FILES
+PYTHON_TARGET_FINALIZE_HOOKS += PYTHON_REMOVE_PYC_FILES
endif
# In all cases, we don't want to keep the optimized .pyo files
-ifeq ($(BR2_PACKAGE_PYTHON),y)
define PYTHON_REMOVE_PYO_FILES
find $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR) -name '*.pyo' -print0 | \
xargs -0 --no-run-if-empty rm -f
endef
-TARGET_FINALIZE_HOOKS += PYTHON_REMOVE_PYO_FILES
-endif
+PYTHON_TARGET_FINALIZE_HOOKS += PYTHON_REMOVE_PYO_FILES
diff --git a/package/python3/python3.mk b/package/python3/python3.mk
index 8459b11..dc776fe 100644
--- a/package/python3/python3.mk
+++ b/package/python3/python3.mk
@@ -217,7 +217,7 @@ define PYTHON3_CREATE_PYC_FILES
endef
ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY)$(BR2_PACKAGE_PYTHON3_PY_PYC),y)
-TARGET_FINALIZE_HOOKS += PYTHON3_CREATE_PYC_FILES
+PYTHON3_TARGET_FINALIZE_HOOKS += PYTHON3_CREATE_PYC_FILES
endif
ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY),y)
@@ -225,7 +225,7 @@ define PYTHON3_REMOVE_PY_FILES
find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.py' -print0 | \
xargs -0 --no-run-if-empty rm -f
endef
-TARGET_FINALIZE_HOOKS += PYTHON3_REMOVE_PY_FILES
+PYTHON3_TARGET_FINALIZE_HOOKS += PYTHON3_REMOVE_PY_FILES
endif
# Normally, *.pyc files should not have been compiled, but just in
@@ -235,16 +235,14 @@ define PYTHON3_REMOVE_PYC_FILES
find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.pyc' -print0 | \
xargs -0 --no-run-if-empty rm -f
endef
-TARGET_FINALIZE_HOOKS += PYTHON3_REMOVE_PYC_FILES
+PYTHON3_TARGET_FINALIZE_HOOKS += PYTHON3_REMOVE_PYC_FILES
endif
# In all cases, we don't want to keep the optimized .opt-1.pyc and
# .opt-2.pyc files, since they can't work without their non-optimized
# variant.
-ifeq ($(BR2_PACKAGE_PYTHON3),y)
define PYTHON3_REMOVE_OPTIMIZED_PYC_FILES
find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.opt-1.pyc' -print0 -o -name '*.opt-2.pyc' -print0 | \
xargs -0 --no-run-if-empty rm -f
endef
-TARGET_FINALIZE_HOOKS += PYTHON3_REMOVE_OPTIMIZED_PYC_FILES
-endif
+PYTHON3_TARGET_FINALIZE_HOOKS += PYTHON3_REMOVE_OPTIMIZED_PYC_FILES
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 16/24] package/skeleton: split into sysv and custom skeleton
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (14 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 15/24] packages: use the <PKG>_TARGET_FINALIZE_HOOKS Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 17/24] package/skeleton: make it a virtual package Yann E. MORIN
` (8 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
Currently, both the sysv-like and custom skeletons are managed in a
single package.
However, for the custom skeleton, we basically do nothing, except for
a few symlinks for the /lib direcoty aliases, and a few checks about
merged /usr.
OTOH, for the default (sysv-like) skeleton, we do a lot more things,
like tweaking the issue, the hostname, setting the root password and so
on...
Furthermore, we're soon gonna have a skeleton for each kind of init
system, be it sysv-based or systemd.
So, it makes sense to offload the custom skeleton namagement to its own
package.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
package/Config.in | 2 +
package/skeleton-custom/Config.in | 2 +
package/skeleton-custom/skeleton-custom.mk | 112 +++++++++++++++++++
package/skeleton-sysv/Config.in | 2 +
package/skeleton-sysv/skeleton-sysv.mk | 126 +++++++++++++++++++++
package/skeleton/Config.in | 2 +
package/skeleton/skeleton.mk | 172 ++++-------------------------
7 files changed, 265 insertions(+), 153 deletions(-)
create mode 100644 package/skeleton-custom/Config.in
create mode 100644 package/skeleton-custom/skeleton-custom.mk
create mode 100644 package/skeleton-sysv/Config.in
create mode 100644 package/skeleton-sysv/skeleton-sysv.mk
diff --git a/package/Config.in b/package/Config.in
index 2f42038..8eba40a 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2,6 +2,8 @@ menu "Target packages"
source "package/busybox/Config.in"
source "package/skeleton/Config.in"
+ source "package/skeleton-custom/Config.in"
+ source "package/skeleton-sysv/Config.in"
menu "Audio and video applications"
source "package/alsa-utils/Config.in"
diff --git a/package/skeleton-custom/Config.in b/package/skeleton-custom/Config.in
new file mode 100644
index 0000000..1f3c87c
--- /dev/null
+++ b/package/skeleton-custom/Config.in
@@ -0,0 +1,2 @@
+config BR2_PACKAGE_SKELETON_CUSTOM
+ bool
diff --git a/package/skeleton-custom/skeleton-custom.mk b/package/skeleton-custom/skeleton-custom.mk
new file mode 100644
index 0000000..8690af4
--- /dev/null
+++ b/package/skeleton-custom/skeleton-custom.mk
@@ -0,0 +1,112 @@
+################################################################################
+#
+# skeleton-custom
+#
+################################################################################
+
+SKELETON_CUSTOM_SOURCE =
+
+SKELETON_CUSTOM_ADD_TOOLCHAIN_DEPENDENCY = NO
+SKELETON_CUSTOM_ADD_SKELETON_DEPENDENCY = NO
+
+SKELETON_CUSTOM_INSTALL_STAGING = YES
+
+SKELETON_CUSTOM_PATH = $(call qstrip,$(BR2_ROOTFS_SKELETON_CUSTOM_PATH))
+
+# 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_CUSTOM_LIB_INODE = $(shell stat -c '%i' $(SKELETON_CUSTOM_PATH)/lib/. 2>/dev/null)
+SKELETON_CUSTOM_BIN_INODE = $(shell stat -c '%i' $(SKELETON_CUSTOM_PATH)/bin/. 2>/dev/null)
+SKELETON_CUSTOM_SBIN_INODE = $(shell stat -c '%i' $(SKELETON_CUSTOM_PATH)/sbin/. 2>/dev/null)
+SKELETON_CUSTOM_USR_LIB_INODE = $(shell stat -c '%i' $(SKELETON_CUSTOM_PATH)/usr/lib/. 2>/dev/null)
+SKELETON_CUSTOM_USR_BIN_INODE = $(shell stat -c '%i' $(SKELETON_CUSTOM_PATH)/usr/bin/. 2>/dev/null)
+SKELETON_CUSTOM_USR_SBIN_INODE = $(shell stat -c '%i' $(SKELETON_CUSTOM_PATH)/usr/sbin/. 2>/dev/null)
+
+# Ensure that the custom skeleton has /lib, /bin and /sbin, and their
+# /usr counterparts
+define SKELETON_CUSTOM_MISSING_DIRS
+ if [ -z "$(SKELETON_CUSTOM_LIB_INODE)" ]; then \
+ missing+=" /lib"; \
+ fi; \
+ if [ -z "$(SKELETON_CUSTOM_USR_LIB_INODE)" ]; then \
+ missing+=" /usr/lib"; \
+ fi; \
+ if [ -z "$(SKELETON_CUSTOM_BIN_INODE)" ]; then \
+ missing+=" /bin"; \
+ fi; \
+ if [ -z "$(SKELETON_CUSTOM_USR_BIN_INODE)" ]; then \
+ missing+=" /usr/bin"; \
+ fi; \
+ if [ -z "$(SKELETON_CUSTOM_SBIN_INODE)" ]; then \
+ missing+=" /sbin"; \
+ fi; \
+ if [ -z "$(SKELETON_CUSTOM_USR_SBIN_INODE)" ]; then \
+ missing+=" /usr/sbin"; \
+ fi; \
+ if [ "$${missing" ]; then \
+ printf "The custom skeleton in %s is missing\n" "$(SKELETON_CUSTOM_PATH)"; \
+ printf "the following directories:\n"; \
+ printf " %s\n" "$${missing}"; \
+ exit 1; \
+ fi
+endef
+
+# For a merged /usr, ensure that /lib, /bin and /sbin and their /usr
+# counterparts are appropriately setup symlinks ones to the others.
+ifeq ($(BR2_ROOTFS_MERGED_USR),y)
+
+define SKELETON_CUSTOM_MERGED_USR
+ if [ $(SKELETON_LIB_INODE) != $(SKELETON_USR_LIB_INODE) ]; then \
+ missing+=" /lib"; \
+ fi; \
+ if [ $(SKELETON_BIN_INODE) != $(SKELETON_USR_BIN_INODE) ]; then \
+ missing+=" /bin"; \
+ fi; \
+ if [ $(SKELETON_SBIN_INODE) != $(SKELETON_USR_SBIN_INODE) ]; then \
+ missing+=" /sbin"; \
+ fi;
+ if [ "$${missing}" ]; then
+ printf "The custom skeleton in %s is not\n" "$(SKELETON_CUSTOM_PATH)"; \
+ printf "using a merged /usr for the following directories:\n"; \
+ printf " %s\n" "$${missing}"; \
+ exit 1; \
+ fi
+endef
+
+endif # merged /usr
+
+# We used to do the followinf checks in Makefile code, to catch the
+# errors as early as possible. But the skeleton is the very first
+# package to be installed, so we do the checks in its configure
+# commands; they are almost as early as if they were done in Makefile
+# code.
+define SKELETON_CUSTOM_CONFIGURE_CMDS
+ $(SKELETON_CUSTOM_MISSING_DIRS)
+ $(SKELETON_CUSTOM_MERGED_USR)
+endef
+
+# Provided by the 'skeleton' package:
+# - SKELETON_LIB_SYMLINK
+
+define SKELETON_CUSTOM_INSTALL_TARGET_CMDS
+ $(call SKELETON_RSYNC,$(SKELETON_CUSTOM_PATH),$(TARGET_DIR))
+ ln -snf lib $(TARGET_DIR)/$(SKELETON_LIB_SYMLINK)
+ ln -snf lib $(TARGET_DIR)/usr/$(SKELETON_LIB_SYMLINK)
+endef
+
+# For the staging dir, we don't really care what we install, but we
+# need the /lib and /usr/lib apropriately setup.
+# Since we ensure, above, that they are correct in the skeleton, we
+# can simply copy it to staging.
+define SKELETON_CUSTOM_INSTALL_STAGING_CMDS
+ $(call SKELETON_RSYNC,$(SKELETON_CUSTOM_PATH),$(STAGING_DIR))
+ $(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include
+ ln -snf lib $(STAGING_DIR)/$(SKELETON_LIB_SYMLINK)
+ ln -snf lib $(STAGING_DIR)/usr/$(SKELETON_LIB_SYMLINK)
+endef
+
+$(eval $(generic-package))
diff --git a/package/skeleton-sysv/Config.in b/package/skeleton-sysv/Config.in
new file mode 100644
index 0000000..8c2e7dd
--- /dev/null
+++ b/package/skeleton-sysv/Config.in
@@ -0,0 +1,2 @@
+config BR2_PACKAGE_SKELETON_SYSV
+ bool
diff --git a/package/skeleton-sysv/skeleton-sysv.mk b/package/skeleton-sysv/skeleton-sysv.mk
new file mode 100644
index 0000000..0a2f51b
--- /dev/null
+++ b/package/skeleton-sysv/skeleton-sysv.mk
@@ -0,0 +1,126 @@
+################################################################################
+#
+# skeleton-sysv
+#
+################################################################################
+
+SKELETON_SYSV_SOURCE =
+
+SKELETON_SYSV_ADD_TOOLCHAIN_DEPENDENCY = NO
+SKELETON_SYSV_ADD_SKELETON_DEPENDENCY = NO
+
+SKELETON_SYSV_INSTALL_STAGING = YES
+
+# Provided by the 'skeleton' package:
+# - SKELETON_USR_SYMLINKS_OR_DIRS
+# - SKELETON_LIB_SYMLINK
+# - SKELETON_TARGET_GENERIC_HOSTNAME
+# - SKELETON_TARGET_GENERIC_ISSUE
+# - SKELETON_TARGET_ROOT_PASSWD
+# - SKELETON_TARGET_GENERIC_BIN_SH
+# - SKELETON_TARGET_GENERIC_GETTY_PORT
+# - SKELETON_TARGET_GENERIC_GETTY_BAUDRATE
+# - SKELETON_TARGET_GENERIC_GETTY_TERM
+# - SKELETON_TARGET_GENERIC_GETTY_OPTIONS
+# - SKELETON_SET_NETWORK_IFUPDOWN_LOOPBACK
+# - SKELETON_SET_NETWORK_IFUPDOWN_DHCP
+
+define SKELETON_INSTALL_TARGET_CMDS
+ $(call SKELETON_RSYNC,system/skeleton,$(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)
+ $(INSTALL) -m 0644 support/misc/target-dir-warning.txt \
+ $(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
+define SKELETON_SYSV_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 SKELETON_USR_SYMLINKS_OR_DIRS,$(STAGING_DIR))
+ ln -snf lib $(STAGING_DIR)/$(SKELETON_LIB_SYMLINK)
+ ln -snf lib $(STAGING_DIR)/usr/$(SKELETON_LIB_SYMLINK)
+endef
+
+ifneq ($(SKELETON_TARGET_GENERIC_HOSTNAME),)
+define SKELETON_SYSV_SET_HOSTNAME
+ mkdir -p $(TARGET_DIR)/etc
+ echo "$(SKELETON_TARGET_GENERIC_HOSTNAME)" > $(TARGET_DIR)/etc/hostname
+ $(SED) '$$a \127.0.1.1\t$(SKELETON_TARGET_GENERIC_HOSTNAME)' \
+ -e '/^127.0.1.1/d' $(TARGET_DIR)/etc/hosts
+endef
+SKELETON_SYSV_TARGET_FINALIZE_HOOKS += SKELETON_SYSV_SET_HOSTNAME
+endif
+
+ifneq ($(SKELETON_TARGET_GENERIC_ISSUE),)
+define SKELETON_SYSV_SET_ISSUE
+ mkdir -p $(TARGET_DIR)/etc
+ echo "$(SKELETON_TARGET_GENERIC_ISSUE)" > $(TARGET_DIR)/etc/issue
+endef
+SKELETON_SYSV_TARGET_FINALIZE_HOOKS += SKELETON_SYSV_SET_ISSUE
+endif
+
+define SKELETON_SYSV_SET_NETWORK
+ mkdir -p $(TARGET_DIR)/etc/network/
+ $(SKELETON_SET_NETWORK_IFUPDOWN_LOOPBACK)
+ $(SKELETON_SET_NETWORK_IFUPDOWN_DHCP)
+endef
+SKELETON_SYSV_TARGET_FINALIZE_HOOKS += SKELETON_SYSV_SET_NETWORK
+
+define SKELETON_SYSV_SET_ROOT_PASSWD
+ $(SED) s,^root:[^:]*:,root:$(SKELETON_SYSV_ROOT_PASSWORD):, $(TARGET_DIR)/etc/shadow
+endef
+SKELETON_SYSV_TARGET_FINALIZE_HOOKS += SKELETON_SYSV_SET_ROOT_PASSWD
+
+ifeq ($(BR2_SYSTEM_BIN_SH_NONE),y)
+define SKELETON_SYSV_BIN_SH
+ rm -f $(TARGET_DIR)/bin/sh
+endef
+else
+define SKELETON_SYSV_BIN_SH
+ ln -sf $(SKELETON_TARGET_GENERIC_BIN_SH) $(TARGET_DIR)/bin/sh
+endef
+endif
+SKELETON_SYSV_TARGET_FINALIZE_HOOKS += SKELETON_SYSV_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_SYSV_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_SYSV_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
+SKELETON_SYSV_TARGET_FINALIZE_HOOKS += SKELETON_SYSV_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
+define SKELETON_SYSV_REMOUNT_RW
+ $(SED) '/^#.*-o remount,rw \/$$/s~^#\+~~' $(TARGET_DIR)/etc/inittab
+endef
+else
+# Find uncommented line, if any, and add a leading '#'
+define SKELETON_SYSV_REMOUNT_RW
+ $(SED) '/^[^#].*-o remount,rw \/$$/s~^~#~' $(TARGET_DIR)/etc/inittab
+endef
+endif
+SKELETON_SYSV_TARGET_FINALIZE_HOOKS += SKELETON_SYSV_REMOUNT_RW
+endif # BR2_INIT_BUSYBOX || BR2_INIT_SYSV
+
+$(eval $(generic-package))
diff --git a/package/skeleton/Config.in b/package/skeleton/Config.in
index d25147b..6db0634 100644
--- a/package/skeleton/Config.in
+++ b/package/skeleton/Config.in
@@ -1,5 +1,7 @@
config BR2_PACKAGE_SKELETON
bool
default y
+ select BR2_PACKAGE_SKELETON_SYSV if BR2_ROOTFS_SKELETON_DEFAULT
+ select BR2_PACKAGE_SKELETON_CUSTOM if BR2_ROOTFS_SKELETON_CUSTOM
help
The basic skeleton for your rootfs.
diff --git a/package/skeleton/skeleton.mk b/package/skeleton/skeleton.mk
index e3ae694..bd787db 100644
--- a/package/skeleton/skeleton.mk
+++ b/package/skeleton/skeleton.mk
@@ -7,6 +7,10 @@
# source included in buildroot
SKELETON_SOURCE =
+SKELETON_DEPENDENCIES = \
+ $(if $(BR2_PACKAGE_SKELETON_SYSV),skeleton-sysv) \
+ $(if $(BR2_PACKAGE_SKELETON_CUSTOM),skeleton-custom)
+
# 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
@@ -14,53 +18,19 @@ SKELETON_SOURCE =
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
-
-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 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
-
-endif # ! custom skeleton
+# The following definitions are to be used by the specific skeletons:
+# - SKELETON_USR_SYMLINKS_OR_DIRS
+# - SKELETON_LIB_SYMLINK
+# - SKELETON_TARGET_GENERIC_HOSTNAME
+# - SKELETON_TARGET_GENERIC_ISSUE
+# - SKELETON_TARGET_ROOT_PASSWD
+# - SKELETON_TARGET_GENERIC_BIN_SH
+# - SKELETON_TARGET_GENERIC_GETTY_PORT
+# - SKELETON_TARGET_GENERIC_GETTY_BAUDRATE
+# - SKELETON_TARGET_GENERIC_GETTY_TERM
+# - SKELETON_TARGET_GENERIC_GETTY_OPTIONS
+# - SKELETON_SET_NETWORK_IFUPDOWN_LOOPBACK
+# - SKELETON_SET_NETWORK_IFUPDOWN_DHCP
# This function rsyncs the skeleton directory in $(1) to the destination
# in $(2), which should be either $(TARTGET_DIR) or $(STAGING_DIR)
@@ -93,34 +63,6 @@ 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)
- $(INSTALL) -m 0644 support/misc/target-dir-warning.txt \
- $(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
-define SKELETON_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 SKELETON_USR_SYMLINKS_OR_DIRS,$(STAGING_DIR))
- ln -snf lib $(STAGING_DIR)/$(SKELETON_LIB_SYMLINK)
- ln -snf lib $(STAGING_DIR)/usr/$(SKELETON_LIB_SYMLINK)
-endef
-
-# The TARGET_FINALIZE_HOOKS must be sourced only if the users choose to use the
-# default skeleton.
-ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y)
-
SKELETON_TARGET_GENERIC_HOSTNAME = $(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME))
SKELETON_TARGET_GENERIC_ISSUE = $(call qstrip,$(BR2_TARGET_GENERIC_ISSUE))
SKELETON_TARGET_GENERIC_ROOT_PASSWD = $(call qstrip,$(BR2_TARGET_GENERIC_ROOT_PASSWD))
@@ -131,25 +73,8 @@ SKELETON_TARGET_GENERIC_GETTY_BAUDRATE = $(call qstrip,$(BR2_TARGET_GENERIC_GETT
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
- mkdir -p $(TARGET_DIR)/etc
- echo "$(SKELETON_TARGET_GENERIC_HOSTNAME)" > $(TARGET_DIR)/etc/hostname
- $(SED) '$$a \127.0.1.1\t$(SKELETON_TARGET_GENERIC_HOSTNAME)' \
- -e '/^127.0.1.1/d' $(TARGET_DIR)/etc/hosts
-endef
-TARGET_FINALIZE_HOOKS += SKELETON_SET_HOSTNAME
-endif
-ifneq ($(SKELETON_TARGET_GENERIC_ISSUE),)
-define SKELETON_SET_ISSUE
- mkdir -p $(TARGET_DIR)/etc
- echo "$(SKELETON_TARGET_GENERIC_ISSUE)" > $(TARGET_DIR)/etc/issue
-endef
-TARGET_FINALIZE_HOOKS += SKELETON_SET_ISSUE
-endif
-
-define SKELETON_SET_NETWORK_LOCALHOST
+define SKELETON_SET_NETWORK_IFUPDOWN_LOOPBACK
( \
echo "# interface file auto-generated by buildroot"; \
echo ; \
@@ -161,7 +86,7 @@ endef
SKELETON_NETWORK_DHCP_IFACE = $(call qstrip,$(BR2_SYSTEM_DHCP))
ifneq ($(SKELETON_NETWORK_DHCP_IFACE),)
-define SKELETON_SET_NETWORK_DHCP
+define SKELETON_SET_NETWORK_IFUPDOWN_DHCP
( \
echo ; \
echo "auto $(SKELETON_NETWORK_DHCP_IFACE)"; \
@@ -174,14 +99,6 @@ define SKELETON_SET_NETWORK_DHCP
endef
endif
-define SKELETON_SET_NETWORK
- mkdir -p $(TARGET_DIR)/etc/network/
- $(SKELETON_SET_NETWORK_LOCALHOST)
- $(SKELETON_SET_NETWORK_DHCP)
-endef
-
-TARGET_FINALIZE_HOOKS += SKELETON_SET_NETWORK
-
ifeq ($(BR2_TARGET_ENABLE_ROOT_LOGIN),y)
ifeq ($(SKELETON_TARGET_GENERIC_ROOT_PASSWD),)
SKELETON_ROOT_PASSWORD =
@@ -197,55 +114,4 @@ else # !BR2_TARGET_ENABLE_ROOT_LOGIN
SKELETON_ROOT_PASSWORD = "*"
endif
-define SKELETON_SET_ROOT_PASSWD
- $(SED) s,^root:[^:]*:,root:$(SKELETON_ROOT_PASSWORD):, $(TARGET_DIR)/etc/shadow
-endef
-TARGET_FINALIZE_HOOKS += SKELETON_SET_ROOT_PASSWD
-
-ifeq ($(BR2_SYSTEM_BIN_SH_NONE),y)
-define SKELETON_BIN_SH
- rm -f $(TARGET_DIR)/bin/sh
-endef
-else
-define SKELETON_BIN_SH
- ln -sf $(SKELETON_TARGET_GENERIC_BIN_SH) $(TARGET_DIR)/bin/sh
-endef
-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
-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))
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 17/24] package/skeleton: make it a virtual package
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (15 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 16/24] package/skeleton: split into sysv and custom skeleton Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 18/24] package/skeleton-sysv: split into skeleton-common Yann E. MORIN
` (7 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
The skeleton package now only serves as an intermediate package to
direct to the real skeleton implementaion.
This is exactly what a virtual package is. Make it so.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
package/skeleton-custom/Config.in | 4 ++++
package/skeleton-custom/skeleton-custom.mk | 2 ++
package/skeleton-sysv/Config.in | 4 ++++
package/skeleton-sysv/skeleton-sysv.mk | 2 ++
package/skeleton/Config.in | 12 ++++++++++--
package/skeleton/skeleton.mk | 11 ++---------
system/Config.in | 2 ++
7 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/package/skeleton-custom/Config.in b/package/skeleton-custom/Config.in
index 1f3c87c..601c3b2 100644
--- a/package/skeleton-custom/Config.in
+++ b/package/skeleton-custom/Config.in
@@ -1,2 +1,6 @@
config BR2_PACKAGE_SKELETON_CUSTOM
bool
+ select BR2_PACKAGE_HAS_SKELETON
+
+config BR2_PACKAGE_PROVIDES_SKELETON
+ default "skeleton-custom" if BR2_PACKAGE_SKELETON_CUSTOM
diff --git a/package/skeleton-custom/skeleton-custom.mk b/package/skeleton-custom/skeleton-custom.mk
index 8690af4..e251448 100644
--- a/package/skeleton-custom/skeleton-custom.mk
+++ b/package/skeleton-custom/skeleton-custom.mk
@@ -6,6 +6,8 @@
SKELETON_CUSTOM_SOURCE =
+SKELETON_CUSTOM_PROVIDES = skeleton
+
SKELETON_CUSTOM_ADD_TOOLCHAIN_DEPENDENCY = NO
SKELETON_CUSTOM_ADD_SKELETON_DEPENDENCY = NO
diff --git a/package/skeleton-sysv/Config.in b/package/skeleton-sysv/Config.in
index 8c2e7dd..95c796f 100644
--- a/package/skeleton-sysv/Config.in
+++ b/package/skeleton-sysv/Config.in
@@ -1,2 +1,6 @@
config BR2_PACKAGE_SKELETON_SYSV
bool
+ select BR2_PACKAGE_HAS_SKELETON
+
+config BR2_PACKAGE_PROVIDES_SKELETON
+ default "skeleton-sysv" if BR2_PACKAGE_SKELETON_SYSV
diff --git a/package/skeleton-sysv/skeleton-sysv.mk b/package/skeleton-sysv/skeleton-sysv.mk
index 0a2f51b..aa0b65c 100644
--- a/package/skeleton-sysv/skeleton-sysv.mk
+++ b/package/skeleton-sysv/skeleton-sysv.mk
@@ -6,6 +6,8 @@
SKELETON_SYSV_SOURCE =
+SKELETON_SYSV_PROVIDES = skeleton
+
SKELETON_SYSV_ADD_TOOLCHAIN_DEPENDENCY = NO
SKELETON_SYSV_ADD_SKELETON_DEPENDENCY = NO
diff --git a/package/skeleton/Config.in b/package/skeleton/Config.in
index 6db0634..7d6841e 100644
--- a/package/skeleton/Config.in
+++ b/package/skeleton/Config.in
@@ -1,7 +1,15 @@
+# Every packages depend on the 'skeleton' package, but noone selects
+# its symbol since it is an implicit dependency. So we just force
+# that symbol to always be 'y'.
config BR2_PACKAGE_SKELETON
bool
default y
- select BR2_PACKAGE_SKELETON_SYSV if BR2_ROOTFS_SKELETON_DEFAULT
- select BR2_PACKAGE_SKELETON_CUSTOM if BR2_ROOTFS_SKELETON_CUSTOM
help
The basic skeleton for your rootfs.
+
+config BR2_PACKAGE_HAS_SKELETON
+ bool
+
+config BR2_PACKAGE_PROVIDES_SKELETON
+ string
+ depends on BR2_PACKAGE_SKELETON
diff --git a/package/skeleton/skeleton.mk b/package/skeleton/skeleton.mk
index bd787db..b791650 100644
--- a/package/skeleton/skeleton.mk
+++ b/package/skeleton/skeleton.mk
@@ -4,13 +4,6 @@
#
################################################################################
-# source included in buildroot
-SKELETON_SOURCE =
-
-SKELETON_DEPENDENCIES = \
- $(if $(BR2_PACKAGE_SKELETON_SYSV),skeleton-sysv) \
- $(if $(BR2_PACKAGE_SKELETON_CUSTOM),skeleton-custom)
-
# 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
@@ -18,6 +11,8 @@ SKELETON_DEPENDENCIES = \
SKELETON_ADD_TOOLCHAIN_DEPENDENCY = NO
SKELETON_ADD_SKELETON_DEPENDENCY = NO
+$(eval $(virtual-package))
+
# The following definitions are to be used by the specific skeletons:
# - SKELETON_USR_SYMLINKS_OR_DIRS
# - SKELETON_LIB_SYMLINK
@@ -113,5 +108,3 @@ endif
else # !BR2_TARGET_ENABLE_ROOT_LOGIN
SKELETON_ROOT_PASSWORD = "*"
endif
-
-$(eval $(generic-package))
diff --git a/system/Config.in b/system/Config.in
index 3a38bd4..3792be2 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -5,11 +5,13 @@ choice
config BR2_ROOTFS_SKELETON_DEFAULT
bool "default target skeleton"
+ select BR2_PACKAGE_SKELETON_SYSV
help
Use default target skeleton
config BR2_ROOTFS_SKELETON_CUSTOM
bool "custom target skeleton"
+ select BR2_PACKAGE_SKELETON_CUSTOM
help
Use custom target skeleton.
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 18/24] package/skeleton-sysv: split into skeleton-common
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (16 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 17/24] package/skeleton: make it a virtual package Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 19/24] system: split skeleton Yann E. MORIN
` (6 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
Add skeleton-common, the base skeleton shared between the sysv/busybox
and systemd skeletons (the latter to come in followup patches).
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
package/Config.in | 1 +
package/skeleton-common/Config.in | 2 +
package/skeleton-common/skeleton-common.mk | 99 ++++++++++++++++++++++++++++++
package/skeleton-sysv/Config.in | 1 +
package/skeleton-sysv/skeleton-sysv.mk | 60 +-----------------
package/skeleton/skeleton.mk | 25 +-------
6 files changed, 106 insertions(+), 82 deletions(-)
create mode 100644 package/skeleton-common/Config.in
create mode 100644 package/skeleton-common/skeleton-common.mk
diff --git a/package/Config.in b/package/Config.in
index 8eba40a..6956a2a 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -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"
source "package/skeleton-sysv/Config.in"
diff --git a/package/skeleton-common/Config.in b/package/skeleton-common/Config.in
new file mode 100644
index 0000000..9abed42
--- /dev/null
+++ b/package/skeleton-common/Config.in
@@ -0,0 +1,2 @@
+config BR2_PACKAGE_SKELETON_COMMON
+ bool
diff --git a/package/skeleton-common/skeleton-common.mk b/package/skeleton-common/skeleton-common.mk
new file mode 100644
index 0000000..544cce7
--- /dev/null
+++ b/package/skeleton-common/skeleton-common.mk
@@ -0,0 +1,99 @@
+################################################################################
+#
+# skeleton-common
+#
+################################################################################
+
+SKELETON_COMMON_SOURCE =
+
+SKELETON_COMMON_ADD_TOOLCHAIN_DEPENDENCY = NO
+SKELETON_COMMON_ADD_SKELETON_DEPENDENCY = NO
+
+SKELETON_COMMON_INSTALL_STAGING = YES
+
+SKELETON_COMMON_PATH = system/skeleton
+
+# Provided by the 'skeleton' package:
+# - SKELETON_USR_SYMLINKS_OR_DIRS
+# - SKELETON_LIB_SYMLINK
+
+SKELETON_COMMON_TARGET_GENERIC_HOSTNAME = $(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME))
+SKELETON_COMMON_TARGET_GENERIC_ISSUE = $(call qstrip,$(BR2_TARGET_GENERIC_ISSUE))
+SKELETON_COMMON_TARGET_GENERIC_ROOT_PASSWD = $(call qstrip,$(BR2_TARGET_GENERIC_ROOT_PASSWD))
+SKELETON_COMMON_TARGET_GENERIC_PASSWD_METHOD = $(call qstrip,$(BR2_TARGET_GENERIC_PASSWD_METHOD))
+SKELETON_COMMON_TARGET_GENERIC_BIN_SH = $(call qstrip,$(BR2_SYSTEM_BIN_SH))
+
+ifeq ($(BR2_TARGET_ENABLE_ROOT_LOGIN),y)
+ifeq ($(SKELETON_TARGET_GENERIC_ROOT_PASSWD),)
+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)"`"
+endif
+else # !BR2_TARGET_ENABLE_ROOT_LOGIN
+SKELETON_ROOT_PASSWORD = "*"
+endif
+
+define SKELETON_COMMON_INSTALL_TARGET_CMDS
+ $(call SKELETON_RSYNC,$(SKELETON_COMMON_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)
+ $(INSTALL) -m 0644 support/misc/target-dir-warning.txt \
+ $(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
+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 SKELETON_USR_SYMLINKS_OR_DIRS,$(STAGING_DIR))
+ ln -snf lib $(STAGING_DIR)/$(SKELETON_LIB_SYMLINK)
+ ln -snf lib $(STAGING_DIR)/usr/$(SKELETON_LIB_SYMLINK)
+endef
+
+ifneq ($(SKELETON_COMMON_TARGET_GENERIC_HOSTNAME),)
+define SKELETON_COMMON_SET_HOSTNAME
+ mkdir -p $(TARGET_DIR)/etc
+ echo "$(SKELETON_COMMON_TARGET_GENERIC_HOSTNAME)" > $(TARGET_DIR)/etc/hostname
+ $(SED) '$$a \127.0.1.1\t$(SKELETON_COMMON_TARGET_GENERIC_HOSTNAME)' \
+ -e '/^127.0.1.1/d' $(TARGET_DIR)/etc/hosts
+endef
+SKELETON_COMMON_TARGET_FINALIZE_HOOKS += SKELETON_COMMON_SET_HOSTNAME
+endif
+
+ifneq ($(SKELETON_COMMON_TARGET_GENERIC_ISSUE),)
+define SKELETON_COMMON_SET_ISSUE
+ mkdir -p $(TARGET_DIR)/etc
+ echo "$(SKELETON_COMMON_TARGET_GENERIC_ISSUE)" > $(TARGET_DIR)/etc/issue
+endef
+SKELETON_COMMON_TARGET_FINALIZE_HOOKS += SKELETON_COMMON_SET_ISSUE
+endif
+
+define SKELETON_COMMON_SET_ROOT_PASSWD
+ $(SED) s,^root:[^:]*:,root:$(SKELETON_ROOT_PASSWORD):, $(TARGET_DIR)/etc/shadow
+endef
+SKELETON_COMMON_TARGET_FINALIZE_HOOKS += SKELETON_COMMON_SET_ROOT_PASSWD
+
+ifeq ($(BR2_SYSTEM_BIN_SH_NONE),y)
+define SKELETON_COMMON_BIN_SH
+ rm -f $(TARGET_DIR)/bin/sh
+endef
+else
+define SKELETON_COMMON_BIN_SH
+ ln -sf $(SKELETON_COMMON_TARGET_GENERIC_BIN_SH) $(TARGET_DIR)/bin/sh
+endef
+endif
+SKELETON_COMMON_TARGET_FINALIZE_HOOKS += SKELETON_COMMON_BIN_SH
+
+$(eval $(generic-package))
diff --git a/package/skeleton-sysv/Config.in b/package/skeleton-sysv/Config.in
index 95c796f..2f6dbd9 100644
--- a/package/skeleton-sysv/Config.in
+++ b/package/skeleton-sysv/Config.in
@@ -1,6 +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
diff --git a/package/skeleton-sysv/skeleton-sysv.mk b/package/skeleton-sysv/skeleton-sysv.mk
index aa0b65c..6e15b15 100644
--- a/package/skeleton-sysv/skeleton-sysv.mk
+++ b/package/skeleton-sysv/skeleton-sysv.mk
@@ -8,6 +8,8 @@ SKELETON_SYSV_SOURCE =
SKELETON_SYSV_PROVIDES = skeleton
+SKELETON_SYSV_DEPENDENCIES = skeleton-common
+
SKELETON_SYSV_ADD_TOOLCHAIN_DEPENDENCY = NO
SKELETON_SYSV_ADD_SKELETON_DEPENDENCY = NO
@@ -27,48 +29,6 @@ SKELETON_SYSV_INSTALL_STAGING = YES
# - SKELETON_SET_NETWORK_IFUPDOWN_LOOPBACK
# - SKELETON_SET_NETWORK_IFUPDOWN_DHCP
-define SKELETON_INSTALL_TARGET_CMDS
- $(call SKELETON_RSYNC,system/skeleton,$(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)
- $(INSTALL) -m 0644 support/misc/target-dir-warning.txt \
- $(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
-define SKELETON_SYSV_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 SKELETON_USR_SYMLINKS_OR_DIRS,$(STAGING_DIR))
- ln -snf lib $(STAGING_DIR)/$(SKELETON_LIB_SYMLINK)
- ln -snf lib $(STAGING_DIR)/usr/$(SKELETON_LIB_SYMLINK)
-endef
-
-ifneq ($(SKELETON_TARGET_GENERIC_HOSTNAME),)
-define SKELETON_SYSV_SET_HOSTNAME
- mkdir -p $(TARGET_DIR)/etc
- echo "$(SKELETON_TARGET_GENERIC_HOSTNAME)" > $(TARGET_DIR)/etc/hostname
- $(SED) '$$a \127.0.1.1\t$(SKELETON_TARGET_GENERIC_HOSTNAME)' \
- -e '/^127.0.1.1/d' $(TARGET_DIR)/etc/hosts
-endef
-SKELETON_SYSV_TARGET_FINALIZE_HOOKS += SKELETON_SYSV_SET_HOSTNAME
-endif
-
-ifneq ($(SKELETON_TARGET_GENERIC_ISSUE),)
-define SKELETON_SYSV_SET_ISSUE
- mkdir -p $(TARGET_DIR)/etc
- echo "$(SKELETON_TARGET_GENERIC_ISSUE)" > $(TARGET_DIR)/etc/issue
-endef
-SKELETON_SYSV_TARGET_FINALIZE_HOOKS += SKELETON_SYSV_SET_ISSUE
-endif
-
define SKELETON_SYSV_SET_NETWORK
mkdir -p $(TARGET_DIR)/etc/network/
$(SKELETON_SET_NETWORK_IFUPDOWN_LOOPBACK)
@@ -76,22 +36,6 @@ define SKELETON_SYSV_SET_NETWORK
endef
SKELETON_SYSV_TARGET_FINALIZE_HOOKS += SKELETON_SYSV_SET_NETWORK
-define SKELETON_SYSV_SET_ROOT_PASSWD
- $(SED) s,^root:[^:]*:,root:$(SKELETON_SYSV_ROOT_PASSWORD):, $(TARGET_DIR)/etc/shadow
-endef
-SKELETON_SYSV_TARGET_FINALIZE_HOOKS += SKELETON_SYSV_SET_ROOT_PASSWD
-
-ifeq ($(BR2_SYSTEM_BIN_SH_NONE),y)
-define SKELETON_SYSV_BIN_SH
- rm -f $(TARGET_DIR)/bin/sh
-endef
-else
-define SKELETON_SYSV_BIN_SH
- ln -sf $(SKELETON_TARGET_GENERIC_BIN_SH) $(TARGET_DIR)/bin/sh
-endef
-endif
-SKELETON_SYSV_TARGET_FINALIZE_HOOKS += SKELETON_SYSV_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
diff --git a/package/skeleton/skeleton.mk b/package/skeleton/skeleton.mk
index b791650..d93f939 100644
--- a/package/skeleton/skeleton.mk
+++ b/package/skeleton/skeleton.mk
@@ -16,10 +16,6 @@ $(eval $(virtual-package))
# The following definitions are to be used by the specific skeletons:
# - SKELETON_USR_SYMLINKS_OR_DIRS
# - SKELETON_LIB_SYMLINK
-# - SKELETON_TARGET_GENERIC_HOSTNAME
-# - SKELETON_TARGET_GENERIC_ISSUE
-# - SKELETON_TARGET_ROOT_PASSWD
-# - SKELETON_TARGET_GENERIC_BIN_SH
# - SKELETON_TARGET_GENERIC_GETTY_PORT
# - SKELETON_TARGET_GENERIC_GETTY_BAUDRATE
# - SKELETON_TARGET_GENERIC_GETTY_TERM
@@ -58,11 +54,7 @@ else
SKELETON_LIB_SYMLINK = lib32
endif
-SKELETON_TARGET_GENERIC_HOSTNAME = $(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME))
-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))
+# The various init systems have different ways of dealing with those:
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))
@@ -93,18 +85,3 @@ define SKELETON_SET_NETWORK_IFUPDOWN_DHCP
$(TARGET_DIR)/etc/network/nfs_check
endef
endif
-
-ifeq ($(BR2_TARGET_ENABLE_ROOT_LOGIN),y)
-ifeq ($(SKELETON_TARGET_GENERIC_ROOT_PASSWD),)
-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)"`"
-endif
-else # !BR2_TARGET_ENABLE_ROOT_LOGIN
-SKELETON_ROOT_PASSWORD = "*"
-endif
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 19/24] system: split skeleton
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (17 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 18/24] package/skeleton-sysv: split into skeleton-common Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 20/24] package/skeleton-systemd: new package Yann E. MORIN
` (5 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
Move the sysv-related parts to separate skeletons.
The network-related parts of the skeleton will also be useable by the
systemd skeleton (but only when systemd-networkd is not enabled), so we
also split that out into its own skeleton.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
package/skeleton-sysv/skeleton-sysv.mk | 7 +++++++
.../network/if-up.d => skeleton-net/etc/network/if-down.d}/.empty | 0
.../{skeleton => skeleton-net}/etc/network/if-post-down.d/.empty | 0
.../{skeleton => skeleton-net}/etc/network/if-pre-up.d/wait_iface | 0
.../network/if-down.d => skeleton-net/etc/network/if-up.d}/.empty | 0
system/{skeleton => skeleton-sysv}/dev/log | 0
system/{skeleton/dev/shm => skeleton-sysv/dev/pts}/.empty | 0
system/{skeleton/dev/pts => skeleton-sysv/dev/shm}/.empty | 0
system/{skeleton => skeleton-sysv}/etc/fstab | 0
system/{skeleton => skeleton-sysv}/etc/resolv.conf | 0
system/{skeleton => skeleton-sysv}/var/cache | 0
system/{skeleton => skeleton-sysv}/var/lib/misc | 0
system/{skeleton => skeleton-sysv}/var/lock | 0
system/{skeleton => skeleton-sysv}/var/log | 0
system/{skeleton => skeleton-sysv}/var/run | 0
system/{skeleton => skeleton-sysv}/var/spool | 0
system/{skeleton => skeleton-sysv}/var/tmp | 0
system/skeleton/dev/.empty | 0
18 files changed, 7 insertions(+)
rename system/{skeleton/etc/network/if-up.d => skeleton-net/etc/network/if-down.d}/.empty (100%)
rename system/{skeleton => skeleton-net}/etc/network/if-post-down.d/.empty (100%)
rename system/{skeleton => skeleton-net}/etc/network/if-pre-up.d/wait_iface (100%)
rename system/{skeleton/etc/network/if-down.d => skeleton-net/etc/network/if-up.d}/.empty (100%)
rename system/{skeleton => skeleton-sysv}/dev/log (100%)
rename system/{skeleton/dev/shm => skeleton-sysv/dev/pts}/.empty (100%)
rename system/{skeleton/dev/pts => skeleton-sysv/dev/shm}/.empty (100%)
rename system/{skeleton => skeleton-sysv}/etc/fstab (100%)
rename system/{skeleton => skeleton-sysv}/etc/resolv.conf (100%)
rename system/{skeleton => skeleton-sysv}/var/cache (100%)
rename system/{skeleton => skeleton-sysv}/var/lib/misc (100%)
rename system/{skeleton => skeleton-sysv}/var/lock (100%)
rename system/{skeleton => skeleton-sysv}/var/log (100%)
rename system/{skeleton => skeleton-sysv}/var/run (100%)
rename system/{skeleton => skeleton-sysv}/var/spool (100%)
rename system/{skeleton => skeleton-sysv}/var/tmp (100%)
create mode 100644 system/skeleton/dev/.empty
diff --git a/package/skeleton-sysv/skeleton-sysv.mk b/package/skeleton-sysv/skeleton-sysv.mk
index 6e15b15..ee9e670 100644
--- a/package/skeleton-sysv/skeleton-sysv.mk
+++ b/package/skeleton-sysv/skeleton-sysv.mk
@@ -29,6 +29,13 @@ SKELETON_SYSV_INSTALL_STAGING = YES
# - SKELETON_SET_NETWORK_IFUPDOWN_LOOPBACK
# - SKELETON_SET_NETWORK_IFUPDOWN_DHCP
+# Even without a configured DHCP interface, we still need the network part
+# of the skeleton, because it is used to configure the loopback interface.
+define SKELETON_SYSV_INSTALL_TARGET_CMDS
+ $(call SKELETON_RSYNC,system/skeleton-sysv,$(TARGET_DIR))
+ $(call SKELETON_RSYNC,system/skeleton-net,$(TARGET_DIR))
+endef
+
define SKELETON_SYSV_SET_NETWORK
mkdir -p $(TARGET_DIR)/etc/network/
$(SKELETON_SET_NETWORK_IFUPDOWN_LOOPBACK)
diff --git a/system/skeleton/etc/network/if-up.d/.empty b/system/skeleton-net/etc/network/if-down.d/.empty
similarity index 100%
rename from system/skeleton/etc/network/if-up.d/.empty
rename to system/skeleton-net/etc/network/if-down.d/.empty
diff --git a/system/skeleton/etc/network/if-post-down.d/.empty b/system/skeleton-net/etc/network/if-post-down.d/.empty
similarity index 100%
rename from system/skeleton/etc/network/if-post-down.d/.empty
rename to system/skeleton-net/etc/network/if-post-down.d/.empty
diff --git a/system/skeleton/etc/network/if-pre-up.d/wait_iface b/system/skeleton-net/etc/network/if-pre-up.d/wait_iface
similarity index 100%
rename from system/skeleton/etc/network/if-pre-up.d/wait_iface
rename to system/skeleton-net/etc/network/if-pre-up.d/wait_iface
diff --git a/system/skeleton/etc/network/if-down.d/.empty b/system/skeleton-net/etc/network/if-up.d/.empty
similarity index 100%
rename from system/skeleton/etc/network/if-down.d/.empty
rename to system/skeleton-net/etc/network/if-up.d/.empty
diff --git a/system/skeleton/dev/log b/system/skeleton-sysv/dev/log
similarity index 100%
rename from system/skeleton/dev/log
rename to system/skeleton-sysv/dev/log
diff --git a/system/skeleton/dev/shm/.empty b/system/skeleton-sysv/dev/pts/.empty
similarity index 100%
rename from system/skeleton/dev/shm/.empty
rename to system/skeleton-sysv/dev/pts/.empty
diff --git a/system/skeleton/dev/pts/.empty b/system/skeleton-sysv/dev/shm/.empty
similarity index 100%
rename from system/skeleton/dev/pts/.empty
rename to system/skeleton-sysv/dev/shm/.empty
diff --git a/system/skeleton/etc/fstab b/system/skeleton-sysv/etc/fstab
similarity index 100%
rename from system/skeleton/etc/fstab
rename to system/skeleton-sysv/etc/fstab
diff --git a/system/skeleton/etc/resolv.conf b/system/skeleton-sysv/etc/resolv.conf
similarity index 100%
rename from system/skeleton/etc/resolv.conf
rename to system/skeleton-sysv/etc/resolv.conf
diff --git a/system/skeleton/var/cache b/system/skeleton-sysv/var/cache
similarity index 100%
rename from system/skeleton/var/cache
rename to system/skeleton-sysv/var/cache
diff --git a/system/skeleton/var/lib/misc b/system/skeleton-sysv/var/lib/misc
similarity index 100%
rename from system/skeleton/var/lib/misc
rename to system/skeleton-sysv/var/lib/misc
diff --git a/system/skeleton/var/lock b/system/skeleton-sysv/var/lock
similarity index 100%
rename from system/skeleton/var/lock
rename to system/skeleton-sysv/var/lock
diff --git a/system/skeleton/var/log b/system/skeleton-sysv/var/log
similarity index 100%
rename from system/skeleton/var/log
rename to system/skeleton-sysv/var/log
diff --git a/system/skeleton/var/run b/system/skeleton-sysv/var/run
similarity index 100%
rename from system/skeleton/var/run
rename to system/skeleton-sysv/var/run
diff --git a/system/skeleton/var/spool b/system/skeleton-sysv/var/spool
similarity index 100%
rename from system/skeleton/var/spool
rename to system/skeleton-sysv/var/spool
diff --git a/system/skeleton/var/tmp b/system/skeleton-sysv/var/tmp
similarity index 100%
rename from system/skeleton/var/tmp
rename to system/skeleton-sysv/var/tmp
diff --git a/system/skeleton/dev/.empty b/system/skeleton/dev/.empty
new file mode 100644
index 0000000..e69de29
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton)
@ 2016-06-12 21:55 Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 01/24] package/skeleton: remove useless .empty file Yann E. MORIN
` (24 more replies)
0 siblings, 25 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
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 of
the init systems (and as can be seen later, there is in fact none for
systeemd).
Also, the organisation of the rootfs is different between the different
init systems, with different mount points in some cases.
First comes a long and rather boring sub-series aimed at preparing for
the various skeletons, with patches 1-11 some cleanups and re-factoring
of the system sub-menu, plus limiting our tweaks in the custom skeleton.
Then comes more in-depth preparatory works in the core infra: allow
packages to explicitly declare target-finalize hooks, or avoid the
dependency on the skeleton.
Third, we split the current skeleton into various parts: one skeleton
for the sysv-like init systems (busybox, sysv-init), one skeleton for
sysv-like network management (because shared between sysv and
systemd-without-networkd) and a third to handle the custom skeleton.
Finally, we introduce the skeleton for systemd, add missing pieces it
really needs (timezones) and make it work flawlessly on a read-only
rootfs.
Please have a look at the various commit logs for more in-depth
explanations for the vairious pieces.
With this series, I was able to build and run without issues those
combinations:
init system rootfs DHCP? target
----------------------------------------------------
busybox ext4 no rpi0
busybox ext4 eth0 rpi1-B
busybox squashfs no rpi0
busybox squashfs eth0 rpi1-B
* systemd-minimal ext4 no rpi0
systemd-minimal ext4 eth0 rpi1-B
systemd-minimal squashfs no rpi0
systemd-minimal squashfs eth0 rpi1-B
** systemd-full ext4 no rpi0
systemd-full ext4 eth0 rpi1-B
systemd-full squashfs no rpi0
systemd-full squashfs eth0 rpi1-B
* systemd-minimal: only what gets selected automatically when systemd
is used as init system, with all other options unset
** systemd-full: all systemd options enabled
To be noted for future work:
- systemd-230 (which we currently have) has dropped support for legacy
libs, patch should be trivial;
- systemd-230 also ditched systemd-bootchartd, which is now a separate
package; until recently it did not compile against systemd-230; its
repository was recently updated to supposedly fix this issue, but I
did not have time to test;
- I also had a look at all the pending patches on the list; I'll
handle them after this series has been completed (i.e. applied after
any necessary rework). I don;t want to carry a series with tens and
tens of patches... ;-)
Regards,
Yann E. MORIN.
The following changes since commit 494b0a5b6b0018bfd05ae5d7c09f57c881ed2b72
gst1-imx: make kernel dependency optional (2016-06-12 22:38:19 +0200)
are available in the git repository at:
https://git.busybox.net/~ymorin/git/buildroot
for you to fetch changes up to 4bfd9509ba59300ae2fa25be5cebfd6786ca7f7c
system: allow DHCP interface with systemd-networkd (2016-06-12 22:46:00 +0200)
----------------------------------------------------------------
Yann E. MORIN (24):
package/skeleton: remove useless .empty file
system: sysvinit only selects busybox-show-others if busybox is enabled
package/skeleton: respect variables namespace
system/skeleton: update etc/mtab with a more sensible link
system: systemd only really supports a R/W rootfs
package/systemd: disabling tty1 getty is a post-install hook
system: provide no default for custom skeleton path
system: move the rootfs skeleton choice
system: do not handle network settings for custom skeleton
package/perl: use dummy hostname
system: do not set hostname and issue for custom skeleton
core/pkg-generic: add variable to skip skeleton dependency
package/skeleton: add macro to rsync skeleton directory
core/pkg-generic: allow packages to declare target-finalize hooks
packages: use the <PKG>_TARGET_FINALIZE_HOOKS
package/skeleton: split into sysv and custom skeleton
package/skeleton: make it a virtual package
package/skeleton-sysv: split into skeleton-common
system: split skeleton
package/skeleton-systemd: new package
system/systemd: needs timezone
fs: add pre- and post-command hooks
system: make systemd work on a read-only rootfs
system: allow DHCP interface with systemd-networkd
docs/manual/adding-packages-hooks.txt | 7 +
fs/common.mk | 4 +
package/Config.in | 4 +
package/google-breakpad/google-breakpad.mk | 6 +-
package/libglib2/libglib2.mk | 6 +-
package/libgtk3/libgtk3.mk | 4 +-
package/luarocks/luarocks.mk | 3 +-
package/perl/perl.mk | 6 +-
package/pkg-generic.mk | 13 +-
package/python/python.mk | 10 +-
package/python3/python3.mk | 10 +-
package/skeleton-common/Config.in | 2 +
package/skeleton-common/skeleton-common.mk | 99 ++++++++++
package/skeleton-custom/Config.in | 6 +
package/skeleton-custom/skeleton-custom.mk | 114 +++++++++++
package/skeleton-systemd/Config.in | 7 +
package/skeleton-systemd/skeleton-systemd.mk | 106 ++++++++++
package/skeleton-sysv/Config.in | 7 +
package/skeleton-sysv/skeleton-sysv.mk | 79 ++++++++
package/skeleton/Config.in | 10 +
package/skeleton/skeleton.mk | 213 +++------------------
package/systemd/systemd.mk | 12 +-
system/Config.in | 78 ++++----
.../etc/network/if-down.d}/.empty | 0
.../etc/network/if-post-down.d}/.empty | 0
.../etc/network/if-pre-up.d/wait_iface | 0
.../etc/network/if-up.d}/.empty | 0
system/{skeleton => skeleton-sysv}/dev/log | 0
.../if-down.d => skeleton-sysv/dev/pts}/.empty | 0
system/{skeleton => skeleton-sysv}/dev/shm/.empty | 0
system/{skeleton => skeleton-sysv}/etc/fstab | 0
system/{skeleton => skeleton-sysv}/etc/resolv.conf | 0
system/{skeleton => skeleton-sysv}/var/cache | 0
system/{skeleton => skeleton-sysv}/var/lib/misc | 0
system/{skeleton => skeleton-sysv}/var/lock | 0
system/{skeleton => skeleton-sysv}/var/log | 0
system/{skeleton => skeleton-sysv}/var/run | 0
system/{skeleton => skeleton-sysv}/var/spool | 0
system/{skeleton => skeleton-sysv}/var/tmp | 0
system/skeleton/dev/{pts => }/.empty | 0
system/skeleton/etc/mtab | 2 +-
41 files changed, 548 insertions(+), 260 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/{skeleton/etc/network/if-up.d => skeleton-net/etc/network/if-down.d}/.empty (100%)
rename system/{skeleton/etc/network/if-pre-up.d => skeleton-net/etc/network/if-post-down.d}/.empty (100%)
rename system/{skeleton => skeleton-net}/etc/network/if-pre-up.d/wait_iface (100%)
rename system/{skeleton/etc/network/if-post-down.d => skeleton-net/etc/network/if-up.d}/.empty (100%)
rename system/{skeleton => skeleton-sysv}/dev/log (100%)
rename system/{skeleton/etc/network/if-down.d => skeleton-sysv/dev/pts}/.empty (100%)
rename system/{skeleton => skeleton-sysv}/dev/shm/.empty (100%)
rename system/{skeleton => skeleton-sysv}/etc/fstab (100%)
rename system/{skeleton => skeleton-sysv}/etc/resolv.conf (100%)
rename system/{skeleton => skeleton-sysv}/var/cache (100%)
rename system/{skeleton => skeleton-sysv}/var/lib/misc (100%)
rename system/{skeleton => skeleton-sysv}/var/lock (100%)
rename system/{skeleton => skeleton-sysv}/var/log (100%)
rename system/{skeleton => skeleton-sysv}/var/run (100%)
rename system/{skeleton => skeleton-sysv}/var/spool (100%)
rename system/{skeleton => skeleton-sysv}/var/tmp (100%)
rename system/skeleton/dev/{pts => }/.empty (100%)
--
.-----------------.--------------------.------------------.--------------------.
| 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] 26+ messages in thread
* [Buildroot] [PATCH 20/24] package/skeleton-systemd: new package
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (18 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 19/24] system: split skeleton Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 21/24] system/systemd: needs timezone Yann E. MORIN
` (4 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
Given the very few things to create in the skeleton, there is no real
need in having a pre-populated skeleton that we rsync. We can very well
just create the directory structure with simple mkdir commands.
systemd does not like being booted without any timezone info, so we
forcibly enable that. If there is no default timezone set, we fallback
to UTC (which is basically what no TZ means anyway).
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
package/Config.in | 1 +
package/skeleton-systemd/Config.in | 7 +++++
package/skeleton-systemd/skeleton-systemd.mk | 43 ++++++++++++++++++++++++++++
system/Config.in | 3 +-
4 files changed, 53 insertions(+), 1 deletion(-)
create mode 100644 package/skeleton-systemd/Config.in
create mode 100644 package/skeleton-systemd/skeleton-systemd.mk
diff --git a/package/Config.in b/package/Config.in
index 6956a2a..82d169d 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -4,6 +4,7 @@ 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"
diff --git a/package/skeleton-systemd/Config.in b/package/skeleton-systemd/Config.in
new file mode 100644
index 0000000..c507264
--- /dev/null
+++ b/package/skeleton-systemd/Config.in
@@ -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
diff --git a/package/skeleton-systemd/skeleton-systemd.mk b/package/skeleton-systemd/skeleton-systemd.mk
new file mode 100644
index 0000000..e781ce9
--- /dev/null
+++ b/package/skeleton-systemd/skeleton-systemd.mk
@@ -0,0 +1,43 @@
+################################################################################
+#
+# skeleton-systemd
+#
+################################################################################
+
+SKELETON_SYSTEMD_SOURCE =
+
+SKELETON_SYSTEMD_PROVIDES = skeleton
+
+SKELETON_SYSTEMD_DEPENDENCIES = skeleton-common
+
+SKELETON_SYSTEMD_ADD_TOOLCHAIN_DEPENDENCY = NO
+SKELETON_SYSTEMD_ADD_SKELETON_DEPENDENCY = NO
+
+# In case we're not using systemd-networkd, use the sysv-like network infra;
+# otherwise, the necessary bits are installed by the systemd package.
+ifeq ($(BR2_PACKAGE_SYSTEMD_NETWORKD),)
+
+define SKELETON_SYSTEMD_RSYNC_NETWORK
+ $(call SKELETON_RSYNC,system/skeleton-net,$(TARGET_DIR))
+endef
+
+define SKELETON_SYSTEMD_SET_NETWORK
+ ln -fs ../tmp/resolv.conf $(TARGET_DIR)/etc/resolv.conf
+ mkdir -p $(TARGET_DIR)/etc/network/
+ $(SKELETON_SET_NETWORK_IFUPDOWN_LOOPBACK)
+ $(SKELETON_SET_NETWORK_IFUPDOWN_DHCP)
+endef
+SKELETON_SYSTEMD_TARGET_FINALIZE_HOOKS += SKELETON_SYSTEMD_SET_NETWORK
+
+endif # BR2_PACKAGE_SYSTEMD_NETWORKD not set
+
+define SKELETON_SYSTEMD_INSTALL_TARGET_CMDS
+ mkdir -p $(TARGET_DIR)/etc
+ 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_RSYNC_NETWORK)
+endef
+
+$(eval $(generic-package))
diff --git a/system/Config.in b/system/Config.in
index 3792be2..17ce832 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -5,7 +5,8 @@ choice
config BR2_ROOTFS_SKELETON_DEFAULT
bool "default target skeleton"
- select BR2_PACKAGE_SKELETON_SYSV
+ select BR2_PACKAGE_SKELETON_SYSV if !BR2_INIT_SYSTEMD
+ select BR2_PACKAGE_SKELETON_SYSTEMD if BR2_INIT_SYSTEMD
help
Use default target skeleton
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 21/24] system/systemd: needs timezone
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (19 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 20/24] package/skeleton-systemd: new package Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 22/24] fs: add pre- and post-command hooks Yann E. MORIN
` (3 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
systemd does not like being booted without any timezone info (especially
on a R/O filesystem), so we forcibly enable that. If there is no default
timezone set, we fallback to UTC (which is basically what no TZ means
anyway).
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
package/skeleton-systemd/skeleton-systemd.mk | 7 +++++++
system/Config.in | 1 +
2 files changed, 8 insertions(+)
diff --git a/package/skeleton-systemd/skeleton-systemd.mk b/package/skeleton-systemd/skeleton-systemd.mk
index e781ce9..b45bbde 100644
--- a/package/skeleton-systemd/skeleton-systemd.mk
+++ b/package/skeleton-systemd/skeleton-systemd.mk
@@ -31,12 +31,19 @@ SKELETON_SYSTEMD_TARGET_FINALIZE_HOOKS += SKELETON_SYSTEMD_SET_NETWORK
endif # BR2_PACKAGE_SYSTEMD_NETWORKD not set
+SKELETON_SYSTEM_LOCALTIME = $(call qstrip,$(BR2_TARGET_LOCALTIME))
+ifeq ($(SKELETON_SYSTEM_LOCALTIME),)
+SKELETON_SYSTEM_LOCALTIME = Etc/UTC
+endif
+
define SKELETON_SYSTEMD_INSTALL_TARGET_CMDS
mkdir -p $(TARGET_DIR)/etc
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
+ ln -sf ../usr/share/zoneinfo/$(SKELETON_SYSTEMD_LOCALTIME) \
+ $(TARGET_DIR)/etc/localtime
$(SKELETON_SYSTEMD_RSYNC_NETWORK)
endef
diff --git a/system/Config.in b/system/Config.in
index 17ce832..07af2e0 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -130,6 +130,7 @@ config BR2_INIT_SYSTEMD
select BR2_ROOTFS_MERGED_USR
select BR2_PACKAGE_SYSTEMD
select BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW
+ select BR2_TARGET_TZ_INFO
comment "systemd needs (e)glibc toolchain, headers >= 3.10"
depends on !(BR2_TOOLCHAIN_USES_GLIBC \
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 22/24] fs: add pre- and post-command hooks
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (20 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 21/24] system/systemd: needs timezone Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 23/24] system: make systemd work on a read-only rootfs Yann E. MORIN
` (2 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
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.
Doing the tweaks in target-finalise is not possible, as there is no way
to undo the tweak (i.e. we'd need to restore the /var symlink so that
subsequent builds continue to work).
Add two pre- and post-hooks that packages can set, that are called right
before and after the rootfs commands are executed.
Those hooks are not documented on-purpose; they are probably going to be
used only by systemd.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
fs/common.mk | 4 ++++
package/pkg-generic.mk | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/fs/common.mk b/fs/common.mk
index b7202c3..8feb172 100644
--- a/fs/common.mk
+++ b/fs/common.mk
@@ -92,7 +92,11 @@ endif
$$(call PRINTF,$$(PACKAGES_PERMISSIONS_TABLE)) >> $$(FULL_DEVICE_TABLE)
echo "$$(HOST_DIR)/usr/bin/makedevs -d $$(FULL_DEVICE_TABLE) $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)
endif
+ $$(foreach hook,$$(FS_INIT_PRE_CMD_HOOKS),\
+ $$(call PRINTF,$$($$(hook))) >>$$(FAKEROOT_SCRIPT))
$$(call PRINTF,$$(ROOTFS_$(2)_CMD)) >> $$(FAKEROOT_SCRIPT)
+ $$(foreach hook,$$(FS_INIT_POST_CMD_HOOKS),\
+ $$(call PRINTF,$$($$(hook))) >>$$(FAKEROOT_SCRIPT))
chmod a+x $$(FAKEROOT_SCRIPT)
PATH=$$(BR_PATH) $$(HOST_DIR)/usr/bin/fakeroot -- $$(FAKEROOT_SCRIPT)
$$(INSTALL) -m 0644 support/misc/target-dir-warning.txt $$(TARGET_DIR_WARNING_FILE)
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 4415342..2f80392 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -559,6 +559,8 @@ $(2)_POST_INSTALL_IMAGES_HOOKS ?=
$(2)_PRE_LEGAL_INFO_HOOKS ?=
$(2)_POST_LEGAL_INFO_HOOKS ?=
$(2)_TARGET_FINALIZE_HOOKS ?=
+$(2)_FS_PRE_CMD_HOOKS ?=
+$(2)_FS_POST_CMD_HOOKS ?=
# human-friendly targets and target sequencing
$(1): $(1)-install
@@ -860,6 +862,8 @@ ifneq ($$($(2)_USERS),)
PACKAGES_USERS += $$($(2)_USERS)$$(sep)
endif
TARGET_FINALIZE_HOOKS += $$($(2)_TARGET_FINALIZE_HOOKS)
+FS_INIT_PRE_CMD_HOOKS += $$($(2)_FS_PRE_CMD_HOOKS)
+FS_INIT_POST_CMD_HOOKS += $$($(2)_FS_POST_CMD_HOOKS)
ifeq ($$($(2)_SITE_METHOD),svn)
DL_TOOLS_DEPENDENCIES += svn
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 23/24] system: make systemd work on a read-only rootfs
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (21 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 22/24] fs: add pre- and post-command hooks Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 24/24] system: allow DHCP interface with systemd-networkd Yann E. MORIN
2016-06-18 9:36 ` [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
When 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 feautre to populate it with
"factory" defaults.
We obtain those factory defaults by redirecting /var to that location at
build time, usign 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 to
/var/something, but only if it does not already exist.
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/soemthing
But if the source is not given, then it is implicitly tken 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 tree 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, or /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 dorectory before assembing the image, and back to a
symlink after assembling the image.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
Note: I haven't seen any symlinks installed in the factory so far, but I
haven't build a lot of packages yet... So, I'm not sure what to do with
the symlinks, especially when a package install relative symlinks...
---
package/skeleton-systemd/skeleton-systemd.mk | 51 ++++++++++++++++++++++++++--
system/Config.in | 1 -
2 files changed, 49 insertions(+), 3 deletions(-)
diff --git a/package/skeleton-systemd/skeleton-systemd.mk b/package/skeleton-systemd/skeleton-systemd.mk
index b45bbde..c7c2e26 100644
--- a/package/skeleton-systemd/skeleton-systemd.mk
+++ b/package/skeleton-systemd/skeleton-systemd.mk
@@ -36,12 +36,59 @@ ifeq ($(SKELETON_SYSTEM_LOCALTIME),)
SKELETON_SYSTEM_LOCALTIME = Etc/UTC
endif
+ifeq ($(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW),y)
+
+define SKELETON_SYSTEMD_ROOT_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
+ 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_VAR_PRE_FS
+ 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_FS_PRE_CMD_HOOKS += SKELETON_SYSTEMD_VAR_PRE_FS
+
+define SKELETON_SYSTEMD_VAR_POST_FS
+ rm -rf $(TARGET_DIR)/var
+ ln -s usr/share/factory $(TARGET_DIR)/var
+endef
+SKELETON_SYSTEMD_FS_POST_CMD_HOOKS += SKELETON_SYSTEMD_VAR_POST_FS
+
+endif
+
define SKELETON_SYSTEMD_INSTALL_TARGET_CMDS
mkdir -p $(TARGET_DIR)/etc
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)
+ $(SKELETON_SYSTEMD_ROOT_RW)
ln -sf ../usr/share/zoneinfo/$(SKELETON_SYSTEMD_LOCALTIME) \
$(TARGET_DIR)/etc/localtime
$(SKELETON_SYSTEMD_RSYNC_NETWORK)
diff --git a/system/Config.in b/system/Config.in
index 07af2e0..32d6542 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -129,7 +129,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
select BR2_TARGET_TZ_INFO
comment "systemd needs (e)glibc toolchain, headers >= 3.10"
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 24/24] system: allow DHCP interface with systemd-networkd
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (22 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 23/24] system: make systemd work on a read-only rootfs Yann E. MORIN
@ 2016-06-12 21:55 ` Yann E. MORIN
2016-06-18 9:36 ` [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-12 21:55 UTC (permalink / raw)
To: buildroot
It is prett trivial to enable a DHCP interface with systemd-networkd, we
just need to provide a .network config file with just the name of the
interface to bring up and activate DHCP on it.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
package/skeleton-systemd/skeleton-systemd.mk | 11 ++++++++++-
system/Config.in | 9 +++------
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/package/skeleton-systemd/skeleton-systemd.mk b/package/skeleton-systemd/skeleton-systemd.mk
index c7c2e26..1ad1470 100644
--- a/package/skeleton-systemd/skeleton-systemd.mk
+++ b/package/skeleton-systemd/skeleton-systemd.mk
@@ -15,7 +15,16 @@ SKELETON_SYSTEMD_ADD_SKELETON_DEPENDENCY = NO
# In case we're not using systemd-networkd, use the sysv-like network infra;
# otherwise, the necessary bits are installed by the systemd package.
-ifeq ($(BR2_PACKAGE_SYSTEMD_NETWORKD),)
+ifeq ($(BR2_PACKAGE_SYSTEMD_NETWORKD),y)
+
+define SKELETON_SYSTEMD_SET_NETWORK
+ printf '[Match]\nName=%s\n[Network]\nDHCP=yes\n' \
+ $(SKELETON_NETWORK_DHCP_IFACE) \
+ >$(TARGET_DIR)/etc/systemd/network/$(SKELETON_NETWORK_DHCP_IFACE).network
+endef
+SKELETON_SYSTEMD_TARGET_FINALIZE_HOOKS += SKELETON_SYSTEMD_SET_NETWORK
+
+else # BR2_PACKAGE_SYSTEMD_NETWORKD is not set
define SKELETON_SYSTEMD_RSYNC_NETWORK
$(call SKELETON_RSYNC,system/skeleton-net,$(TARGET_DIR))
diff --git a/system/Config.in b/system/Config.in
index 32d6542..c90866c 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -362,7 +362,7 @@ config BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW
config BR2_SYSTEM_DHCP
string "Network interface to configure through DHCP"
default ""
- depends on !BR2_PACKAGE_SYSTEMD_NETWORKD && (BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN)
+ depends on BR2_PACKAGE_SYSTEMD_NETWORKD || BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN
help
Enter here the name of the network interface (E.G. eth0) to
automatically configure through DHCP at bootup.
@@ -372,11 +372,8 @@ config BR2_SYSTEM_DHCP
For more complicated network setups use an overlay to overwrite
/etc/network/interfaces or add a networkd configuration file.
-comment "automatic network configuration via DHCP is not compatible with networkd"
- depends on BR2_PACKAGE_SYSTEMD_NETWORKD
-
-comment "automatic network configuration via DHCP needs ifupdown or busybox"
- depends on !(BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN)
+comment "automatic network configuration via DHCP needs systemd, busybox or ifupdown"
+ depends on !(BR2_PACKAGE_SYSTEMD_NETWORKD || BR2_PACKAGE_BUSYBOX || BR2_PACKAGE_IFUPDOWN)
endif # BR2_ROOTFS_SKELETON_DEFAULT
--
2.7.4
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton)
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
` (23 preceding siblings ...)
2016-06-12 21:55 ` [Buildroot] [PATCH 24/24] system: allow DHCP interface with systemd-networkd Yann E. MORIN
@ 2016-06-18 9:36 ` Yann E. MORIN
24 siblings, 0 replies; 26+ messages in thread
From: Yann E. MORIN @ 2016-06-18 9:36 UTC (permalink / raw)
To: buildroot
All,
On 2016-06-12 23:55 +0200, Yann E. MORIN spake thusly:
> Hello All!
>
> This series is a proposal to fix our handling of systemd as an init
> system.
I've marked this series as Changes Requested: the commit logs were not
really complete. So I detaield each commit a bit more.
I'll respin a new version of the series by the end of the day.
Regards,
Yann E. MORIN.
> 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 of
> the init systems (and as can be seen later, there is in fact none for
> systeemd).
>
> Also, the organisation of the rootfs is different between the different
> init systems, with different mount points in some cases.
>
> First comes a long and rather boring sub-series aimed at preparing for
> the various skeletons, with patches 1-11 some cleanups and re-factoring
> of the system sub-menu, plus limiting our tweaks in the custom skeleton.
>
> Then comes more in-depth preparatory works in the core infra: allow
> packages to explicitly declare target-finalize hooks, or avoid the
> dependency on the skeleton.
>
> Third, we split the current skeleton into various parts: one skeleton
> for the sysv-like init systems (busybox, sysv-init), one skeleton for
> sysv-like network management (because shared between sysv and
> systemd-without-networkd) and a third to handle the custom skeleton.
>
> Finally, we introduce the skeleton for systemd, add missing pieces it
> really needs (timezones) and make it work flawlessly on a read-only
> rootfs.
>
> Please have a look at the various commit logs for more in-depth
> explanations for the vairious pieces.
>
> With this series, I was able to build and run without issues those
> combinations:
>
> init system rootfs DHCP? target
> ----------------------------------------------------
> busybox ext4 no rpi0
> busybox ext4 eth0 rpi1-B
> busybox squashfs no rpi0
> busybox squashfs eth0 rpi1-B
> * systemd-minimal ext4 no rpi0
> systemd-minimal ext4 eth0 rpi1-B
> systemd-minimal squashfs no rpi0
> systemd-minimal squashfs eth0 rpi1-B
> ** systemd-full ext4 no rpi0
> systemd-full ext4 eth0 rpi1-B
> systemd-full squashfs no rpi0
> systemd-full squashfs eth0 rpi1-B
>
>
> * systemd-minimal: only what gets selected automatically when systemd
> is used as init system, with all other options unset
>
> ** systemd-full: all systemd options enabled
>
> To be noted for future work:
>
> - systemd-230 (which we currently have) has dropped support for legacy
> libs, patch should be trivial;
>
> - systemd-230 also ditched systemd-bootchartd, which is now a separate
> package; until recently it did not compile against systemd-230; its
> repository was recently updated to supposedly fix this issue, but I
> did not have time to test;
>
> - I also had a look at all the pending patches on the list; I'll
> handle them after this series has been completed (i.e. applied after
> any necessary rework). I don;t want to carry a series with tens and
> tens of patches... ;-)
>
>
> Regards,
> Yann E. MORIN.
>
>
> The following changes since commit 494b0a5b6b0018bfd05ae5d7c09f57c881ed2b72
>
> gst1-imx: make kernel dependency optional (2016-06-12 22:38:19 +0200)
>
>
> are available in the git repository at:
>
> https://git.busybox.net/~ymorin/git/buildroot
>
> for you to fetch changes up to 4bfd9509ba59300ae2fa25be5cebfd6786ca7f7c
>
> system: allow DHCP interface with systemd-networkd (2016-06-12 22:46:00 +0200)
>
>
> ----------------------------------------------------------------
> Yann E. MORIN (24):
> package/skeleton: remove useless .empty file
> system: sysvinit only selects busybox-show-others if busybox is enabled
> package/skeleton: respect variables namespace
> system/skeleton: update etc/mtab with a more sensible link
> system: systemd only really supports a R/W rootfs
> package/systemd: disabling tty1 getty is a post-install hook
> system: provide no default for custom skeleton path
> system: move the rootfs skeleton choice
> system: do not handle network settings for custom skeleton
> package/perl: use dummy hostname
> system: do not set hostname and issue for custom skeleton
> core/pkg-generic: add variable to skip skeleton dependency
> package/skeleton: add macro to rsync skeleton directory
> core/pkg-generic: allow packages to declare target-finalize hooks
> packages: use the <PKG>_TARGET_FINALIZE_HOOKS
> package/skeleton: split into sysv and custom skeleton
> package/skeleton: make it a virtual package
> package/skeleton-sysv: split into skeleton-common
> system: split skeleton
> package/skeleton-systemd: new package
> system/systemd: needs timezone
> fs: add pre- and post-command hooks
> system: make systemd work on a read-only rootfs
> system: allow DHCP interface with systemd-networkd
>
> docs/manual/adding-packages-hooks.txt | 7 +
> fs/common.mk | 4 +
> package/Config.in | 4 +
> package/google-breakpad/google-breakpad.mk | 6 +-
> package/libglib2/libglib2.mk | 6 +-
> package/libgtk3/libgtk3.mk | 4 +-
> package/luarocks/luarocks.mk | 3 +-
> package/perl/perl.mk | 6 +-
> package/pkg-generic.mk | 13 +-
> package/python/python.mk | 10 +-
> package/python3/python3.mk | 10 +-
> package/skeleton-common/Config.in | 2 +
> package/skeleton-common/skeleton-common.mk | 99 ++++++++++
> package/skeleton-custom/Config.in | 6 +
> package/skeleton-custom/skeleton-custom.mk | 114 +++++++++++
> package/skeleton-systemd/Config.in | 7 +
> package/skeleton-systemd/skeleton-systemd.mk | 106 ++++++++++
> package/skeleton-sysv/Config.in | 7 +
> package/skeleton-sysv/skeleton-sysv.mk | 79 ++++++++
> package/skeleton/Config.in | 10 +
> package/skeleton/skeleton.mk | 213 +++------------------
> package/systemd/systemd.mk | 12 +-
> system/Config.in | 78 ++++----
> .../etc/network/if-down.d}/.empty | 0
> .../etc/network/if-post-down.d}/.empty | 0
> .../etc/network/if-pre-up.d/wait_iface | 0
> .../etc/network/if-up.d}/.empty | 0
> system/{skeleton => skeleton-sysv}/dev/log | 0
> .../if-down.d => skeleton-sysv/dev/pts}/.empty | 0
> system/{skeleton => skeleton-sysv}/dev/shm/.empty | 0
> system/{skeleton => skeleton-sysv}/etc/fstab | 0
> system/{skeleton => skeleton-sysv}/etc/resolv.conf | 0
> system/{skeleton => skeleton-sysv}/var/cache | 0
> system/{skeleton => skeleton-sysv}/var/lib/misc | 0
> system/{skeleton => skeleton-sysv}/var/lock | 0
> system/{skeleton => skeleton-sysv}/var/log | 0
> system/{skeleton => skeleton-sysv}/var/run | 0
> system/{skeleton => skeleton-sysv}/var/spool | 0
> system/{skeleton => skeleton-sysv}/var/tmp | 0
> system/skeleton/dev/{pts => }/.empty | 0
> system/skeleton/etc/mtab | 2 +-
> 41 files changed, 548 insertions(+), 260 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/{skeleton/etc/network/if-up.d => skeleton-net/etc/network/if-down.d}/.empty (100%)
> rename system/{skeleton/etc/network/if-pre-up.d => skeleton-net/etc/network/if-post-down.d}/.empty (100%)
> rename system/{skeleton => skeleton-net}/etc/network/if-pre-up.d/wait_iface (100%)
> rename system/{skeleton/etc/network/if-post-down.d => skeleton-net/etc/network/if-up.d}/.empty (100%)
> rename system/{skeleton => skeleton-sysv}/dev/log (100%)
> rename system/{skeleton/etc/network/if-down.d => skeleton-sysv/dev/pts}/.empty (100%)
> rename system/{skeleton => skeleton-sysv}/dev/shm/.empty (100%)
> rename system/{skeleton => skeleton-sysv}/etc/fstab (100%)
> rename system/{skeleton => skeleton-sysv}/etc/resolv.conf (100%)
> rename system/{skeleton => skeleton-sysv}/var/cache (100%)
> rename system/{skeleton => skeleton-sysv}/var/lib/misc (100%)
> rename system/{skeleton => skeleton-sysv}/var/lock (100%)
> rename system/{skeleton => skeleton-sysv}/var/log (100%)
> rename system/{skeleton => skeleton-sysv}/var/run (100%)
> rename system/{skeleton => skeleton-sysv}/var/spool (100%)
> rename system/{skeleton => skeleton-sysv}/var/tmp (100%)
> rename system/skeleton/dev/{pts => }/.empty (100%)
>
> --
> .-----------------.--------------------.------------------.--------------------.
> | 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. |
> '------------------------------^-------^------------------^--------------------'
--
.-----------------.--------------------.------------------.--------------------.
| 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] 26+ messages in thread
end of thread, other threads:[~2016-06-18 9:36 UTC | newest]
Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-12 21:55 [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 01/24] package/skeleton: remove useless .empty file Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 02/24] system: sysvinit only selects busybox-show-others if busybox is enabled Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 03/24] package/skeleton: respect variables namespace Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 04/24] system/skeleton: update etc/mtab with a more sensible link Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 05/24] system: systemd only really supports a R/W rootfs Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 06/24] package/systemd: disabling tty1 getty is a post-install hook Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 07/24] system: provide no default for custom skeleton path Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 08/24] system: move the rootfs skeleton choice Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 09/24] system: do not handle network settings for custom skeleton Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 10/24] package/perl: use dummy hostname Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 11/24] system: do not set hostname and issue for custom skeleton Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 12/24] core/pkg-generic: add variable to skip skeleton dependency Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 13/24] package/skeleton: add macro to rsync skeleton directory Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 14/24] core/pkg-generic: allow packages to declare target-finalize hooks Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 15/24] packages: use the <PKG>_TARGET_FINALIZE_HOOKS Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 16/24] package/skeleton: split into sysv and custom skeleton Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 17/24] package/skeleton: make it a virtual package Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 18/24] package/skeleton-sysv: split into skeleton-common Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 19/24] system: split skeleton Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 20/24] package/skeleton-systemd: new package Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 21/24] system/systemd: needs timezone Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 22/24] fs: add pre- and post-command hooks Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 23/24] system: make systemd work on a read-only rootfs Yann E. MORIN
2016-06-12 21:55 ` [Buildroot] [PATCH 24/24] system: allow DHCP interface with systemd-networkd Yann E. MORIN
2016-06-18 9:36 ` [Buildroot] [PATCH 00/24] system: properly handle systemd as init system (branch yem/systemd-skeleton) 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.