From patchwork Fri Jun 22 02:31:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Santos X-Patchwork-Id: 933049 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.com.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 41BjHl4pCsz9s01 for ; Fri, 22 Jun 2018 12:31:30 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A168122F1D; Fri, 22 Jun 2018 02:31:24 +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 OpwtZ77eNtJD; Fri, 22 Jun 2018 02:31:22 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 52D7922870; Fri, 22 Jun 2018 02:31:22 +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 CE9191C0A3E for ; Fri, 22 Jun 2018 02:31:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id CE8D887BDB for ; Fri, 22 Jun 2018 02:31:20 +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 yOA0mbrSv-lV for ; Fri, 22 Jun 2018 02:31:19 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.datacom.com.br (mx.datacom.ind.br [177.66.5.10]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 0E1AD87B82 for ; Fri, 22 Jun 2018 02:31:18 +0000 (UTC) Received: from mail.datacom.com.br (localhost [127.0.0.1]) by mail.datacom.com.br (Postfix) with ESMTPS id 44BC61BA67D1 for ; Thu, 21 Jun 2018 23:31:45 -0300 (-03) Received: from localhost (localhost [127.0.0.1]) by mail.datacom.com.br (Postfix) with ESMTP id 357811BA67CF for ; Thu, 21 Jun 2018 23:31:45 -0300 (-03) Received: from mail.datacom.com.br ([127.0.0.1]) by localhost (mail.datacom.com.br [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id IPLFEf46r_gz for ; Thu, 21 Jun 2018 23:31:45 -0300 (-03) Received: from p7-1130br.casantos.org (unknown [177.97.72.117]) by mail.datacom.com.br (Postfix) with ESMTPSA id E787B1BA67CD for ; Thu, 21 Jun 2018 23:31:44 -0300 (-03) From: Carlos Santos To: buildroot@buildroot.org Date: Thu, 21 Jun 2018 23:31:05 -0300 Message-Id: <20180622023105.27865-1-casantos@datacom.com.br> X-Mailer: git-send-email 2.17.1 Subject: [Buildroot] [RFC] fs: allow passing the image file name to inner-rootfs 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: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Suppose that you want to create a filesystem image containing only the /var/lib subtree. That would something like this on a br2-external: fs/rootfs-var-lib/Config.in: menuconfig BR2_TARGET_ROOTFS_VAR_LIB bool "/var/lib" if BR2_TARGET_ROOTFS_VAR_LIB source "$BR2_EXTERNAL_MFS_PATH/fs/rootfs-var-lib/ext4/Config.in" endif fs/rootfs-var-lib/rootfs-var-lib.mk: ifeq ($(BR2_TARGET_ROOTFS_VAR_LIB),y) rootfs-var-lib = $(call inner-rootfs,var-lib-$(pkgname),VAR_LIB_$(call UPPERCASE,$(pkgname))) include $(sort $(wildcard $(BR2_EXTERNAL_MFS_PATH)/fs/rootfs-var-lib/*/*.mk)) endif fs/rootfs-var-lib/ext4/Config.in: config BR2_TARGET_ROOTFS_VAR_LIB_EXT4 bool "ext4 /var/lib filesystem" select BR2_PACKAGE_HOST_E2FSPROGS help Build an ext4 /var/lib filesystem if BR2_TARGET_ROOTFS_VAR_LIB_EXT4 [...] endif # BR2_TARGET_ROOTFS_VAR_LIB_EXT4 fs/rootfs-var-lib/ext4/ext4.mk: # Build the ext4 /var/lib filesystem image [...] ROOTFS_VAR_LIB_EXT4_OPTS = \ -d $(TARGET_DIR)/var/lib \ ^^^^^^^^---- /var/lib, only [...] define ROOTFS_VAR_LIB_EXT4_CMD rm -f $@ $(HOST_DIR)/sbin/mkfs.ext4 $(ROOTFS_VAR_LIB_EXT4_OPTS) $@ "$(ROOTFS_VAR_LIB_EXT4_SIZE)" endef $(eval $(rootfs-var-lib)) Selecting BR2_TARGET_ROOTFS_VAR_LIB_EXT4 would produce the filesystem image $(BINARIES_DIR)/rootfs.var-lib-ext4 coresponging to the contents of $(TARGET_DIR)/var/lib. This is correct but the file name is a bit awkward. It would be better to call it "rootfs-var-lib.ext4", instead. This can be achieved by passing a third argument to inner-rootfs with the desired file name: rootfs-var-lib = $(call inner-rootfs,var-lib-$(pkgname),VAR_LIB_$(call UPPERCASE,$(pkgname)),rootfs-var-lib.$(pkgname)) Signed-off-by: Carlos Santos --- fs/common.mk | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/common.mk b/fs/common.mk index abf35418cb..2380c1dd3f 100644 --- a/fs/common.mk +++ b/fs/common.mk @@ -139,10 +139,10 @@ ROOTFS_$(2)_COMPRESS_EXT = .xz ROOTFS_$(2)_COMPRESS_CMD = xz -9 -C crc32 -c endif -$$(BINARIES_DIR)/rootfs.$(1): ROOTFS=$(2) -$$(BINARIES_DIR)/rootfs.$(1): FAKEROOT_SCRIPT=$$(ROOTFS_$(2)_DIR)/fakeroot -$$(BINARIES_DIR)/rootfs.$(1): $$(ROOTFS_$(2)_DEPENDENCIES) - @$$(call MESSAGE,"Generating root filesystem image rootfs.$(1)") +$$(BINARIES_DIR)/$(3): ROOTFS=$(2) +$$(BINARIES_DIR)/$(3): FAKEROOT_SCRIPT=$$(ROOTFS_$(2)_DIR)/fakeroot +$$(BINARIES_DIR)/$(3): $$(ROOTFS_$(2)_DEPENDENCIES) + @$$(call MESSAGE,"Generating root filesystem image $(3)") rm -rf $$(ROOTFS_$(2)_DIR) mkdir -p $$(ROOTFS_$(2)_DIR) echo '#!/bin/sh' > $$(FAKEROOT_SCRIPT) @@ -163,7 +163,7 @@ endif rootfs-$(1)-show-depends: @echo $$(ROOTFS_$(2)_DEPENDENCIES) -rootfs-$(1): $$(BINARIES_DIR)/rootfs.$(1) +rootfs-$(1): $$(BINARIES_DIR)/$(3) .PHONY: rootfs-$(1) rootfs-$(1)-show-depends @@ -181,6 +181,6 @@ endif endef # $(pkgname) also works well to return the filesystem name -rootfs = $(call inner-rootfs,$(pkgname),$(call UPPERCASE,$(pkgname))) +rootfs = $(call inner-rootfs,$(pkgname),$(call UPPERCASE,$(pkgname)),rootfs.$(pkgname)) include $(sort $(wildcard fs/*/*.mk))