From patchwork Mon May 7 14:44:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Santos X-Patchwork-Id: 909792 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=datacom.ind.br Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40fllC5xr2z9s0W for ; Tue, 8 May 2018 00:44:55 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A002A86AF2; Mon, 7 May 2018 14:44:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 65Twf6tgqBgL; Mon, 7 May 2018 14:44:51 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 3BF2A83B16; Mon, 7 May 2018 14:44:51 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id DBA081CF020 for ; Mon, 7 May 2018 14:44:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id D81CB227B5 for ; Mon, 7 May 2018 14:44:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wshvMUKSsf5Y for ; Mon, 7 May 2018 14:44:43 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.datacom.ind.br (mx.datacom.ind.br [177.66.5.10]) by silver.osuosl.org (Postfix) with ESMTPS id D582A22719 for ; Mon, 7 May 2018 14:44:42 +0000 (UTC) Received: from mail.datacom.ind.br (localhost [127.0.0.1]) by mail.datacom.ind.br (Postfix) with ESMTPS id A34131BA1E07; Mon, 7 May 2018 11:44:40 -0300 (-03) Received: from localhost (localhost [127.0.0.1]) by mail.datacom.ind.br (Postfix) with ESMTP id 79AEE1BA1E1E; Mon, 7 May 2018 11:44:40 -0300 (-03) Received: from mail.datacom.ind.br ([127.0.0.1]) by localhost (mail.datacom.ind.br [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id NuGwU4Z7socX; Mon, 7 May 2018 11:44:40 -0300 (-03) Received: from pedeld202344.datacom.net (pedeld202344.datacom.net [10.0.120.87]) by mail.datacom.ind.br (Postfix) with ESMTPSA id 4E9CF1BA1DEF; Mon, 7 May 2018 11:44:40 -0300 (-03) From: Carlos Santos To: buildroot@buildroot.org Date: Mon, 7 May 2018 11:44:27 -0300 Message-Id: <20180507144431.14488-2-casantos@datacom.ind.br> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180507144431.14488-1-casantos@datacom.ind.br> References: <20180507144431.14488-1-casantos@datacom.ind.br> Subject: [Buildroot] [PATCH v3 1/5] skeleton-custom: use a script to check merged usr structure X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yann Morin , Thomas De Schampheleire MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Introduce support/scripts/check-merged-usr.sh, a script that check if a given path complies to the merged /usr requirements: / /bin -> usr/bin /lib -> usr/lib /sbin -> usr/sbin /usr/bin/ /usr/lib/ /usr/sbin/ Use this script in skeleton-custom.mk instead of a bunch of variables filled by $(shell ...) macros. The same script will be used to check rootfs overlays, in a forthcoming change. Signed-off-by: Carlos Santos --- Changes v1->v2: - Rebase series to HEAD of master branch --- package/skeleton-custom/skeleton-custom.mk | 23 +----------------- support/scripts/check-merged-usr.sh | 39 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 22 deletions(-) create mode 100755 support/scripts/check-merged-usr.sh diff --git a/package/skeleton-custom/skeleton-custom.mk b/package/skeleton-custom/skeleton-custom.mk index 8c57531782..b1cddd9146 100644 --- a/package/skeleton-custom/skeleton-custom.mk +++ b/package/skeleton-custom/skeleton-custom.mk @@ -23,32 +23,11 @@ $(error No path specified for the custom skeleton) endif endif -# 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) - # For a merged /usr, ensure that /lib, /bin and /sbin and their /usr # counterparts are appropriately setup as symlinks ones to the others. ifeq ($(BR2_ROOTFS_MERGED_USR),y) -ifneq ($(SKELETON_CUSTOM_LIB_INODE),$(SKELETON_CUSTOM_USR_LIB_INODE)) -SKELETON_CUSTOM_NOT_MERGED_USR_DIRS += /lib -endif -ifneq ($(SKELETON_CUSTOM_BIN_INODE),$(SKELETON_CUSTOM_USR_BIN_INODE)) -SKELETON_CUSTOM_NOT_MERGED_USR_DIRS += /bin -endif -ifneq ($(SKELETON_CUSTOM_SBIN_INODE),$(SKELETON_CUSTOM_USR_SBIN_INODE)) -SKELETON_CUSTOM_NOT_MERGED_USR_DIRS += /sbin -endif +SKELETON_CUSTOM_NOT_MERGED_USR_DIRS = $(shell support/scripts/check-merged-usr.sh $(SKELETON_CUSTOM_PATH)) endif # merged /usr diff --git a/support/scripts/check-merged-usr.sh b/support/scripts/check-merged-usr.sh new file mode 100755 index 0000000000..74c43c89fd --- /dev/null +++ b/support/scripts/check-merged-usr.sh @@ -0,0 +1,39 @@ +#!/bin/sh +# +# Check if a given custom skeleton or overlay complies to the merged /usr +# requirements: +# / +# /bin -> usr/bin +# /lib -> usr/lib +# /sbin -> usr/sbin +# /usr/bin/ +# /usr/lib/ +# /usr/sbin/ +# +# Output: the list non-compliant paths (empty if compliant). +# + +# 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. +# +lib_inode=$(stat -c '%i' "${1}/lib/." 2>/dev/null) +bin_inode=$(stat -c '%i' "${1}/bin/." 2>/dev/null) +sbin_inode=$(stat -c '%i' "${1}/sbin/." 2>/dev/null) +usr_lib_inode=$(stat -c '%i' "${1}/usr/lib/." 2>/dev/null) +usr_bin_inode=$(stat -c '%i' "${1}/usr/bin/." 2>/dev/null) +usr_sbin_inode=$(stat -c '%i' "${1}/usr/sbin/." 2>/dev/null) + +not_merged_dirs="" +test -z "$lib_inode" || \ + test "$lib_inode" = "$usr_lib_inode" || \ + not_merged_dirs="/lib" +test -z "$bin_inode" || \ + test "$bin_inode" = "$usr_bin_inode" || \ + not_merged_dirs="$not_merged_dirs /bin" +test -z "$sbin_inode" || \ + test "$sbin_inode" = "$usr_sbin_inode" || \ + not_merged_dirs="$not_merged_dirs /sbin" +echo "${not_merged_dirs# }" From patchwork Mon May 7 14:44:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Santos X-Patchwork-Id: 909789 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=datacom.ind.br Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40fll818Csz9s3q for ; Tue, 8 May 2018 00:44:52 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id D081685F2F; Mon, 7 May 2018 14:44:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KaimDN6UF1ZW; Mon, 7 May 2018 14:44:49 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 34DAD85ED8; Mon, 7 May 2018 14:44:49 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 917911C2AB3 for ; Mon, 7 May 2018 14:44:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8D94085DFA for ; Mon, 7 May 2018 14:44:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Mz_2uMUUpKl1 for ; Mon, 7 May 2018 14:44:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.datacom.ind.br (mx.datacom.ind.br [177.66.5.10]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 3EE6885ED8 for ; Mon, 7 May 2018 14:44:42 +0000 (UTC) Received: from mail.datacom.ind.br (localhost [127.0.0.1]) by mail.datacom.ind.br (Postfix) with ESMTPS id E93B21BA1E39; Mon, 7 May 2018 11:44:40 -0300 (-03) Received: from localhost (localhost [127.0.0.1]) by mail.datacom.ind.br (Postfix) with ESMTP id A24621BA1DEF; Mon, 7 May 2018 11:44:40 -0300 (-03) Received: from mail.datacom.ind.br ([127.0.0.1]) by localhost (mail.datacom.ind.br [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id DNRRdMdusWr3; Mon, 7 May 2018 11:44:40 -0300 (-03) Received: from pedeld202344.datacom.net (pedeld202344.datacom.net [10.0.120.87]) by mail.datacom.ind.br (Postfix) with ESMTPSA id 691BA1BA1E1C; Mon, 7 May 2018 11:44:40 -0300 (-03) From: Carlos Santos To: buildroot@buildroot.org Date: Mon, 7 May 2018 11:44:28 -0300 Message-Id: <20180507144431.14488-3-casantos@datacom.ind.br> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180507144431.14488-1-casantos@datacom.ind.br> References: <20180507144431.14488-1-casantos@datacom.ind.br> Subject: [Buildroot] [PATCH v3 2/5] skeleton-custom: install /bin, /lib, and /sbin X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yann Morin , Thomas De Schampheleire MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" skeleton-custom does not install the required /bin, /lib and /sbin directories (or symlinks), which may result in an imcomplete tree, The user could add the required directories/symlinks to the skeleton but they may be invalid, depending on the state of BR2_ROOTFS_MERGED_USR. Steps to reproduce: - Enable BR2_ROOTFS_MERGED_USR and BR2_INIT_SYSTEMD - Set BR2_ROOTFS_SKELETON_CUSTOM_PATH to "system/skeleton" - Run "make skeleton" - target/{bin.lib,sbin} will not exist Add calls to SYSTEM_USR_SYMLINKS_OR_DIRS to INSTALL_TARGET_CMDS and INSTALL_STAGING_CMDS, so the required directories or symlinks are created. Add a paragraph to the documentation clarifying that custom skeletons don't need to contain /bin, /lib or /sbin and must not contain them when BR2_ROOTFS_MERGED_USR is enabled. Signed-off-by: Carlos Santos --- Changes v1->v2: - Rebase series to HEAD of master branch - Rework commit message and documentation, as suggested by Thomas Petazzoni --- docs/manual/customize-rootfs.txt | 9 +++++++++ package/skeleton-custom/skeleton-custom.mk | 2 ++ 2 files changed, 11 insertions(+) diff --git a/docs/manual/customize-rootfs.txt b/docs/manual/customize-rootfs.txt index 44fc460670..9d3a62ddaf 100644 --- a/docs/manual/customize-rootfs.txt +++ b/docs/manual/customize-rootfs.txt @@ -100,6 +100,15 @@ To enable this feature, enable config option +System configuration+ menu. If you specify a relative path, it will be relative to the root of the Buildroot tree. + +Custom skeletons don't need to contain the '/bin', '/lib' or '/sbin' + directories, since they are created automatically during the build. + When +BR2_ROOTFS_MERGED_USR+ is enabled, then the custom skeleton must + not contain the '/bin', '/lib' or '/sbin' directories, as Buildroot + will create them as symbolic links to the relevant folders in '/usr'. + In such a situation, should the skeleton have any programs or + libraries, they should be placed in '/usr/bin', '/usr/sbin' and + '/usr/lib'. ++ This method is not recommended because it duplicates the entire skeleton, which prevents taking advantage of the fixes or improvements brought to the default skeleton in later Buildroot releases. diff --git a/package/skeleton-custom/skeleton-custom.mk b/package/skeleton-custom/skeleton-custom.mk index b1cddd9146..01cd62794d 100644 --- a/package/skeleton-custom/skeleton-custom.mk +++ b/package/skeleton-custom/skeleton-custom.mk @@ -43,6 +43,7 @@ endif # things we customise in the custom skeleton. define SKELETON_CUSTOM_INSTALL_TARGET_CMDS $(call SYSTEM_RSYNC,$(SKELETON_CUSTOM_PATH),$(TARGET_DIR)) + $(call SYSTEM_USR_SYMLINKS_OR_DIRS,$(TARGET_DIR)) $(call SYSTEM_LIB_SYMLINK,$(TARGET_DIR)) $(INSTALL) -m 0644 support/misc/target-dir-warning.txt \ $(TARGET_DIR_WARNING_FILE) @@ -54,6 +55,7 @@ endef # skeleton to staging. define SKELETON_CUSTOM_INSTALL_STAGING_CMDS $(call SYSTEM_RSYNC,$(SKELETON_CUSTOM_PATH),$(STAGING_DIR)) + $(call SYSTEM_USR_SYMLINKS_OR_DIRS,$(STAGING_DIR)) $(call SYSTEM_LIB_SYMLINK,$(STAGING_DIR)) endef From patchwork Mon May 7 14:44:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Santos X-Patchwork-Id: 909794 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=datacom.ind.br Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40fllG21d7z9s34 for ; Tue, 8 May 2018 00:44:58 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id D5E9026423; Mon, 7 May 2018 14:44:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dQUTi78L4Z1K; Mon, 7 May 2018 14:44:52 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id ADF5326362; Mon, 7 May 2018 14:44:52 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 380191CF09A for ; Mon, 7 May 2018 14:44:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 334C2814F3 for ; Mon, 7 May 2018 14:44:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KEOY3z6ZIeTB for ; Mon, 7 May 2018 14:44:43 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.datacom.ind.br (mx.datacom.ind.br [177.66.5.10]) by whitealder.osuosl.org (Postfix) with ESMTPS id 507D5813F2 for ; Mon, 7 May 2018 14:44:43 +0000 (UTC) Received: from mail.datacom.ind.br (localhost [127.0.0.1]) by mail.datacom.ind.br (Postfix) with ESMTPS id 2B9721BA1E2F; Mon, 7 May 2018 11:44:41 -0300 (-03) Received: from localhost (localhost [127.0.0.1]) by mail.datacom.ind.br (Postfix) with ESMTP id F14481BA1E40; Mon, 7 May 2018 11:44:40 -0300 (-03) Received: from mail.datacom.ind.br ([127.0.0.1]) by localhost (mail.datacom.ind.br [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id S446_rSJjKdx; Mon, 7 May 2018 11:44:40 -0300 (-03) Received: from pedeld202344.datacom.net (pedeld202344.datacom.net [10.0.120.87]) by mail.datacom.ind.br (Postfix) with ESMTPSA id 8C4F91BA1E18; Mon, 7 May 2018 11:44:40 -0300 (-03) From: Carlos Santos To: buildroot@buildroot.org Date: Mon, 7 May 2018 11:44:29 -0300 Message-Id: <20180507144431.14488-4-casantos@datacom.ind.br> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180507144431.14488-1-casantos@datacom.ind.br> References: <20180507144431.14488-1-casantos@datacom.ind.br> Subject: [Buildroot] [PATCH v3 3/5] Makefile: check rootfs overlays with BR2_ROOTFS_MERGED_USR enabled X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yann Morin , Thomas De Schampheleire MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Add a step to target-finalize that checks each rootfs overlay, following the criteria established for custom skeletons and using the same script uesd by skeleton-custom.mk. Add a paragraph to the documentation clarifying that rootfs overlays don't need to contain /bin, /lib or /sbin and must not contain them when BR2_ROOTFS_MERGED_USR is enabled. Signed-off-by: Carlos Santos --- Changes v1->v2: - Rebase series to HEAD of master branch - Rework commit message and documentation, as suggested by Thomas Petazzoni Changes v2-v3: - Move the removal of --keep-dirlinks in the call to rsync to a separate patch. --- Makefile | 16 ++++++++++++++++ docs/manual/customize-rootfs.txt | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/Makefile b/Makefile index c024c65f78..64c97ce6e2 100644 --- a/Makefile +++ b/Makefile @@ -746,6 +746,22 @@ endif @$(call MESSAGE,"Sanitizing RPATH in target tree") $(TOPDIR)/support/scripts/fix-rpath target +# For a merged /usr, ensure that /lib, /bin and /sbin and their /usr +# counterparts are appropriately setup as symlinks ones to the others. +ifeq ($(BR2_ROOTFS_MERGED_USR),y) + + @$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \ + $(call MESSAGE,"Sanity check in overlay $(d)"); \ + not_merged_dirs="$$(support/scripts/check-merged-usr.sh $(d))"; \ + test -n "$$not_merged_dirs" && { \ + echo "ERROR: The overlay in $(d) is not" \ + "using a merged /usr for the following directories:" \ + $$not_merged_dirs; \ + exit 1; \ + } || true$(sep)) + +endif # merged /usr + @$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \ $(call MESSAGE,"Copying overlay $(d)"); \ rsync -a --ignore-times --keep-dirlinks $(RSYNC_VCS_EXCLUSIONS) \ diff --git a/docs/manual/customize-rootfs.txt b/docs/manual/customize-rootfs.txt index 9d3a62ddaf..bb6d8da6bf 100644 --- a/docs/manual/customize-rootfs.txt +++ b/docs/manual/customize-rootfs.txt @@ -22,6 +22,14 @@ A filesystem overlay is a tree of files that is copied directly etc., files called +.empty+ and files ending in +~+ are excluded from the copy. + +Filesystem overlays don't need to contain the '/bin', '/lib' or '/sbin' + directories, since they are created automatically during the build. + When +BR2_ROOTFS_MERGED_USR+ is enabled, then the overlay must not + contain the '/bin', '/lib' or '/sbin' directories, as Buildroot will + create them as symbolic links to the relevant folders in '/usr'. In + such a situation, should the overlay have any programs or libraries, + they should be placed in '/usr/bin', '/usr/sbin' and '/usr/lib'. ++ As shown in xref:customize-dir-structure[], the recommended path for this overlay is +board///rootfs-overlay+. From patchwork Mon May 7 14:44:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Santos X-Patchwork-Id: 909791 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=datacom.ind.br Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40fllB61FHz9ryk for ; Tue, 8 May 2018 00:44:54 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A82A281E9F; Mon, 7 May 2018 14:44:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5pJjyHkMuQQN; Mon, 7 May 2018 14:44:47 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 7D99E814F3; Mon, 7 May 2018 14:44:47 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id EAD551CF020 for ; Mon, 7 May 2018 14:44:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id E6C1885EDA for ; Mon, 7 May 2018 14:44:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a8TycvjJ9uKn for ; Mon, 7 May 2018 14:44:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.datacom.ind.br (mx.datacom.ind.br [177.66.5.10]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 3674385DFA for ; Mon, 7 May 2018 14:44:42 +0000 (UTC) Received: from mail.datacom.ind.br (localhost [127.0.0.1]) by mail.datacom.ind.br (Postfix) with ESMTPS id 257F51BA1E2A; Mon, 7 May 2018 11:44:41 -0300 (-03) Received: from localhost (localhost [127.0.0.1]) by mail.datacom.ind.br (Postfix) with ESMTP id E85DB1BA1E1E; Mon, 7 May 2018 11:44:40 -0300 (-03) Received: from mail.datacom.ind.br ([127.0.0.1]) by localhost (mail.datacom.ind.br [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id sHjKdC877Yge; Mon, 7 May 2018 11:44:40 -0300 (-03) Received: from pedeld202344.datacom.net (pedeld202344.datacom.net [10.0.120.87]) by mail.datacom.ind.br (Postfix) with ESMTPSA id ABC461BA1E2F; Mon, 7 May 2018 11:44:40 -0300 (-03) From: Carlos Santos To: buildroot@buildroot.org Date: Mon, 7 May 2018 11:44:30 -0300 Message-Id: <20180507144431.14488-5-casantos@datacom.ind.br> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180507144431.14488-1-casantos@datacom.ind.br> References: <20180507144431.14488-1-casantos@datacom.ind.br> Subject: [Buildroot] [PATCH v3 4/5] Makefile: allow rootfs overlays to override symbolic links X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yann Morin , Thomas De Schampheleire MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Since commit 0db34529f48 we use rsync with the --keep-dirlinks option to prevent overlays from accidentally overwriding /{usr,bin,sbin,lib} links when BR2_ROOTFS_MERGED_USR option is enabled. Unfortunately this also prevents replacing a symlink by a directory on purpose (e.g. /var/log, to persist system logs). Steps to reproduce: - enable BR2_ROOTFS_MERGED_USR and BR2_PACKAGE_SKELETON_INIT_SYSV - mkdir some_path/rootfs-overlay/var/log - enable BR2_ROOTFS_OVERLAY="some_path/rootfs-overlay" - run 'make' - 'target/var/log' is still a symlink to '../tmp', not a directory The --keep-dirlinks option can be dropped, since we run sanity checks on overlays. Now the rsync invocation is identical to the SYSTEM_RSYNC logic we have in system/system.mk, so use that variable. Signed-off-by: Carlos Santos --- Changes v1->v2: - Rebase series to HEAD of master branch - Rework commit message and documentation, as suggested by Thomas Petazzoni Changes v2-v3: - Move the removal of --keep-dirlinks in the call to rsync to a separate patch. --- Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 64c97ce6e2..dc51269143 100644 --- a/Makefile +++ b/Makefile @@ -764,9 +764,7 @@ endif # merged /usr @$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \ $(call MESSAGE,"Copying overlay $(d)"); \ - rsync -a --ignore-times --keep-dirlinks $(RSYNC_VCS_EXCLUSIONS) \ - --chmod=u=rwX,go=rX --exclude .empty --exclude '*~' \ - $(d)/ $(TARGET_DIR)$(sep)) + $(call SYSTEM_RSYNC,$(d),$(TARGET_DIR))$(sep)) @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \ $(call MESSAGE,"Executing post-build script $(s)"); \ From patchwork Mon May 7 14:44:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Santos X-Patchwork-Id: 909793 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=datacom.ind.br Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40fllF6k2Zz9ryk for ; Tue, 8 May 2018 00:44:57 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 7361C85F18; Mon, 7 May 2018 14:44:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9w_7Gq86WjVP; Mon, 7 May 2018 14:44:55 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id C01FD85F19; Mon, 7 May 2018 14:44:55 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 86A001C2AB3 for ; Mon, 7 May 2018 14:44:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 8403387927 for ; Mon, 7 May 2018 14:44:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mTRI2FVNI5qv for ; Mon, 7 May 2018 14:44:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.datacom.ind.br (mx.datacom.ind.br [177.66.5.10]) by hemlock.osuosl.org (Postfix) with ESMTPS id 0DD1E8790E for ; Mon, 7 May 2018 14:44:45 +0000 (UTC) Received: from mail.datacom.ind.br (localhost [127.0.0.1]) by mail.datacom.ind.br (Postfix) with ESMTPS id 3AD381BA1E18; Mon, 7 May 2018 11:44:41 -0300 (-03) Received: from localhost (localhost [127.0.0.1]) by mail.datacom.ind.br (Postfix) with ESMTP id 1B9091BA1DEF; Mon, 7 May 2018 11:44:41 -0300 (-03) Received: from mail.datacom.ind.br ([127.0.0.1]) by localhost (mail.datacom.ind.br [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id BTa4Npvzi_a8; Mon, 7 May 2018 11:44:41 -0300 (-03) Received: from pedeld202344.datacom.net (pedeld202344.datacom.net [10.0.120.87]) by mail.datacom.ind.br (Postfix) with ESMTPSA id D742C1BA1E1C; Mon, 7 May 2018 11:44:40 -0300 (-03) From: Carlos Santos To: buildroot@buildroot.org Date: Mon, 7 May 2018 11:44:31 -0300 Message-Id: <20180507144431.14488-6-casantos@datacom.ind.br> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180507144431.14488-1-casantos@datacom.ind.br> References: <20180507144431.14488-1-casantos@datacom.ind.br> Subject: [Buildroot] [PATCH v3 5/5] system: allow selecting merged /usr along with custom rootfs skeleton X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yann Morin , Thomas De Schampheleire MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" If the user is brave enough to use a custom rootfs skeleton then we must not prevent using merged /usr too. Actually it is already possible to do this, although indirectly, by selecting BR2_INIT_SYSTEMD. Signed-off-by: Carlos Santos --- Changes v1->v2: - Rebase series to HEAD of master branch --- system/Config.in | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/system/Config.in b/system/Config.in index d14a864ca5..911cd424ba 100644 --- a/system/Config.in +++ b/system/Config.in @@ -31,10 +31,6 @@ config BR2_ROOTFS_SKELETON_CUSTOM_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 @@ -209,8 +205,6 @@ config BR2_ROOTFS_DEVICE_TABLE_SUPPORTS_EXTENDED_ATTRIBUTES help Support extended attributes handling in device tables -if BR2_ROOTFS_SKELETON_DEFAULT - config BR2_ROOTFS_MERGED_USR bool "Use symlinks to /usr for /bin, /sbin and /lib" help @@ -223,6 +217,8 @@ config BR2_ROOTFS_MERGED_USR symlinks to their counterparts in /usr. In this case, /usr can not be a separate filesystem. +if BR2_ROOTFS_SKELETON_DEFAULT + config BR2_TARGET_ENABLE_ROOT_LOGIN bool "Enable root login with password" default y