From patchwork Sat Oct 20 23:45:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnout Vandecappelle X-Patchwork-Id: 192972 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 8B50C2C007A for ; Sun, 21 Oct 2012 10:46:38 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id AFC1AA0373; Sat, 20 Oct 2012 23:46:37 +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 A83cMoaDZ1Lm; Sat, 20 Oct 2012 23:46:30 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 12AE2A038F; Sat, 20 Oct 2012 23:46:08 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 31D288F74A for ; Sat, 20 Oct 2012 23:45:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id F01558BB7E for ; Sat, 20 Oct 2012 23:45: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 g5TRKP3PFxPG for ; Sat, 20 Oct 2012 23:45:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from viper.mind.be (132.79-246-81.adsl-static.isp.belgacom.be [81.246.79.132]) by whitealder.osuosl.org (Postfix) with ESMTPS id 8B6758C189 for ; Sat, 20 Oct 2012 23:45:41 +0000 (UTC) Received: from [172.16.2.6] (helo=vandecaa-laptop) by viper.mind.be with esmtp (Exim 4.69) (envelope-from ) id 1TPijY-0000OB-W8; Sun, 21 Oct 2012 01:45:39 +0200 Received: from arnout by vandecaa-laptop with local (Exim 4.80) (envelope-from ) id 1TPijY-00035w-4i; Sun, 21 Oct 2012 01:45:36 +0200 From: "Arnout Vandecappelle (Essensium/Mind)" To: buildroot@busybox.net Date: Sun, 21 Oct 2012 01:45:23 +0200 Message-Id: <1350776731-8467-3-git-send-email-arnout@mind.be> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1350776731-8467-1-git-send-email-arnout@mind.be> References: <1350776731-8467-1-git-send-email-arnout@mind.be> Subject: [Buildroot] [PATCH 02/10] target/generic: add filesystem overlay option X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 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-bounces@busybox.net From: "Arnout Vandecappelle (Essensium/Mind)" The filesystem overlay is a tree that is copied over the target fs after building everything - which is currently usually done in the post-build script. Also replace the documentation for a custom skeleton with the filesystem overlay and deprecate the custom skeleton. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- Makefile | 9 +++++++++ docs/manual/customize-rootfs.txt | 21 +++++++++------------ docs/manual/customize-store.txt | 27 +++++++++------------------ target/generic/Config.in | 11 +++++++++++ 4 files changed, 38 insertions(+), 30 deletions(-) diff --git a/Makefile b/Makefile index 0128839..2122d45 100644 --- a/Makefile +++ b/Makefile @@ -463,6 +463,15 @@ endif echo "PRETTY_NAME=\"Buildroot $(BR2_VERSION)\"" \ ) > $(TARGET_DIR)/etc/os-release + @for dir in $(call qstrip,$(BR2_ROOTFS_OVERLAY)); do \ + if [ -d $${dir} ]; then \ + $(call MESSAGE,"Copying overlay $${dir}"); \ + rsync -a \ + --exclude .svn --exclude .git --exclude .hg --exclude '*~' \ + $${dir}/ $(TARGET_DIR); \ + fi \ + done + ifneq ($(BR2_ROOTFS_POST_BUILD_SCRIPT),"") @$(call MESSAGE,"Executing post-build script") $(BR2_ROOTFS_POST_BUILD_SCRIPT) $(TARGET_DIR) diff --git a/docs/manual/customize-rootfs.txt b/docs/manual/customize-rootfs.txt index 8c3ea82..b3c160b 100644 --- a/docs/manual/customize-rootfs.txt +++ b/docs/manual/customize-rootfs.txt @@ -1,5 +1,6 @@ Customizing the generated target filesystem ------------------------------------------- +[customize-rootfs] There are a few ways to customize the resulting target filesystem: @@ -10,24 +11,20 @@ There are a few ways to customize the resulting target filesystem: anything to the target filesystem, but if you decide to completely rebuild your toolchain and tools, these changes will be lost. -* Create your own 'target skeleton'. You can start with the default - skeleton available under +fs/skeleton+ and then customize it to suit - your needs. The +BR2_ROOTFS_SKELETON_CUSTOM+ and - +BR2_ROOTFS_SKELETON_CUSTOM_PATH+ will allow you to specify the - location of your custom skeleton. At build time, the contents of the - skeleton are copied to output/target before any package - installation. +* Create a filesystem overlay: a tree of files that are copied directly + over the target filesystem after it has been built. Set + +BR2_ROOTFS_OVERLAY+ to the top of the tree. +.git+, +.svn+, + +.hg+ directories and files ending with +~+ are excluded. * In the Buildroot configuration, you can specify the path to a post-build script, that gets called 'after' Buildroot builds all the selected software, but 'before' the rootfs packages are assembled. The destination root filesystem folder is given as the first argument to this script, and this script can then be used to - copy programs, static data or any other needed file to your target - filesystem. You should, however, use this feature with care. - Whenever you find that a certain package generates wrong or unneeded - files, you should fix that package rather than work around it with a - post-build cleanup script. + remove or modify any file in your target filesystem. You should, + however, use this feature with care. Whenever you find that a certain + package generates wrong or unneeded files, you should fix that + package rather than work around it with a post-build cleanup script. * A special package, 'customize', stored in +package/customize+ can be used. You can put all the files that you want to see in the final diff --git a/docs/manual/customize-store.txt b/docs/manual/customize-store.txt index cad1700..bc1751e 100644 --- a/docs/manual/customize-store.txt +++ b/docs/manual/customize-store.txt @@ -127,16 +127,12 @@ you can skip the steps that are not relevant for your use case. * +cp /build/at91bootstrap3-*/.config board///at91bootstrap3.config+ 1. Create +board///fs-overlay+ and fill it with additional files you need on your rootfs, e.g. - +board///etc/inittab+. + +board///etc/inittab+. Set +BR2_ROOTFS_OVERLAY+ + to +board///fs-overlay+. 1. Create a post-build script - +board///post-build.sh+. It should contain - the following command: -+ ------------- -rsync -a --exclude .empty --exclude '*~' ${0%/*}/fs-overlay $1 ------------- -+ -1. Set +BR2_ROOTFS_POST_BUILD_SCRIPT+ to +board///post-build.sh+ + +board///post-build.sh+. Set + +BR2_ROOTFS_POST_BUILD_SCRIPT+ to + +board///post-build.sh+ 1. If additional setuid permissions have to be set or device nodes have to be created, create +board///device_table.txt+ and add that path to +BR2_ROOTFS_DEVICE_TABLE+. @@ -172,16 +168,11 @@ the buildroot tree). * +cp /build/at91bootstrap3-*/.config /at91bootstrap3.config+ 1. Create +/fs-overlay+ and fill it with additional files you need on your rootfs, e.g. - +/etc/inittab+. + +/etc/inittab+. Set +BR2_ROOTFS_OVERLAY+ + to +/fs-overlay+. 1. Create a post-build script - +/post-build.sh+. It should contain - the following command: -+ ------------- -rsync -a --exclude .empty --exclude '*~' ${0%/*}/fs-overlay $1 ------------- -+ -1. Set +BR2_ROOTFS_POST_BUILD_SCRIPT+ to +$(BOARDDIR)/post-build.sh+ + +/post-build.sh+. Set + +BR2_ROOTFS_POST_BUILD_SCRIPT+ to +$(BOARDDIR)/post-build.sh+ 1. If additional setuid permissions have to be set or device nodes have to be created, create +/device_table.txt+ and add that path to +BR2_ROOTFS_DEVICE_TABLE+. diff --git a/target/generic/Config.in b/target/generic/Config.in index b8472f4..7f53a7c 100644 --- a/target/generic/Config.in +++ b/target/generic/Config.in @@ -166,6 +166,17 @@ config BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW endif # BR2_ROOTFS_SKELETON_DEFAULT +config BR2_ROOTFS_OVERLAY + string "Root filesystem overlay" + default "" + help + Specify a list of directories that are copied over the target + root filesystem after the build has finished and before it is + packed into the selected filesystem images. + + It is copied as-is into the rootfs, excluding files ending with + ~ and .git, .svn and .hg directories. + config BR2_ROOTFS_POST_BUILD_SCRIPT string "Custom script to run before creating filesystem images" default ""