From: "Bjørn Forsman" <bjorn.forsman@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 1/2] Makefile: improve $(TARGET_DIR) (re)creation
Date: Fri, 18 Feb 2011 00:44:53 +0100 [thread overview]
Message-ID: <1297986294-23446-1-git-send-email-bjorn.forsman@gmail.com> (raw)
This patch fixes the following use case:
1. Build, hack, ...
2. Oh no, $(TARGET_DIR) is no longer in sync with $(TARGET_SKELETON)
and/or the packages selected in menuconfig. If only there was a way
to *easily* rebuild $(TARGET_DIR) so it is in sync...
With this patch, just remove $(TARGET_DIR) and Buildroot will recreate
it.
Main changes:
* Always copy $(TARGET_SKELETON) to $(TARGET_DIR).
* If $(TARGET_DIR) needs to be created (i.e. if the directory is
missing), remove stamp files so all currently selected packages will
be reinstalled.
* If $(TARGET_DIR)/lib/modules/ is missing, try to install kernel
modules.
Also:
* remove code touching .fakeroot.00000 file (not needed)
* remove code trying to remove CVS and .svn stuff from target skeleton
(not needed)
Signed-off-by: Bj?rn Forsman <bjorn.forsman@gmail.com>
---
Changes in v2:
* remove gcc stamp file so libgcc_s.so.1 will be copied to TARGET_DIR
* make sure kernel modules get reinstalled
Makefile | 26 +++++++++++---------------
linux/linux.mk | 6 ++++--
2 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/Makefile b/Makefile
index d954178..4d41e98 100644
--- a/Makefile
+++ b/Makefile
@@ -364,7 +364,7 @@ $(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
dirs: $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
$(HOST_DIR) $(BR2_DEPENDS_DIR) $(BINARIES_DIR) $(STAMP_DIR)
-$(BASE_TARGETS): dirs $(O)/toolchainfile.cmake
+$(BASE_TARGETS): dirs $(O)/toolchainfile.cmake copy-target-skeleton
$(BUILD_DIR)/buildroot-config/auto.conf: $(CONFIG_DIR)/.config
$(MAKE) $(EXTRAMAKEARGS) silentoldconfig
@@ -390,9 +390,10 @@ $(O)/toolchainfile.cmake:
" > $@
.PHONY: all world dirs clean distclean source outputmakefile \
+ copy-target-skeleton \
$(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \
$(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \
- $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
+ $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) \
$(HOST_DIR) $(BR2_DEPENDS_DIR) $(BINARIES_DIR) $(STAMP_DIR)
#############################################################
@@ -416,19 +417,14 @@ ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
TARGET_SKELETON=$(BR2_ROOTFS_SKELETON_CUSTOM_PATH)
endif
-$(BUILD_DIR)/.root:
- mkdir -p $(TARGET_DIR)
- if ! [ -d "$(TARGET_DIR)/bin" ]; then \
- if [ -d "$(TARGET_SKELETON)" ]; then \
- cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \
- fi; \
- touch $(STAGING_DIR)/.fakeroot.00000; \
- fi
- -find $(TARGET_DIR) -type d -name CVS -print0 -o -name .svn -print0 | xargs -0 rm -rf
- -find $(TARGET_DIR) -type f \( -name .empty -o -name '*~' \) -print0 | xargs -0 rm -rf
- touch $@
+copy-target-skeleton: $(TARGET_DIR)
+ cp -ua $(TARGET_SKELETON)/* $(TARGET_DIR)/ && \
+ find $(TARGET_DIR) -type f \( -name .empty -o -name '*~' \) -print0 | xargs -0 rm -rf
-$(TARGET_DIR): $(BUILD_DIR)/.root
+$(TARGET_DIR):
+ mkdir $(TARGET_DIR)
+ rm -f $(BUILD_DIR)/*/.stamp_target_installed
+ rm -f $(STAMP_DIR)/gcc_libs_target_installed
erase-fakeroots:
rm -f $(BUILD_DIR)/.fakeroot*
diff --git a/linux/linux.mk b/linux/linux.mk
index 9076fb9..0ad8c0f 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -147,6 +147,9 @@ $(LINUX26_DIR)/.stamp_compiled: $(LINUX26_DIR)/.stamp_configured $(LINUX26_DIR)/
$(LINUX26_DIR)/.stamp_installed: $(LINUX26_DIR)/.stamp_compiled
@$(call MESSAGE,"Installing kernel")
cp $(LINUX26_IMAGE_PATH) $(BINARIES_DIR)
+ $(Q)touch $@
+
+$(TARGET_DIR)/lib/modules:
# Install modules and remove symbolic links pointing to build
# directories, not relevant on the target
@if [ $(shell grep -c "CONFIG_MODULES=y" $(LINUX26_DIR)/.config) != 0 ] ; then \
@@ -155,9 +158,8 @@ $(LINUX26_DIR)/.stamp_installed: $(LINUX26_DIR)/.stamp_compiled
rm -f $(TARGET_DIR)/lib/modules/$(LINUX26_VERSION_PROBED)/build ; \
rm -f $(TARGET_DIR)/lib/modules/$(LINUX26_VERSION_PROBED)/source ; \
fi
- $(Q)touch $@
-linux linux26: host-module-init-tools $(LINUX26_DEPENDENCIES) $(LINUX26_DIR)/.stamp_installed
+linux linux26: host-module-init-tools $(LINUX26_DEPENDENCIES) $(LINUX26_DIR)/.stamp_installed $(TARGET_DIR)/lib/modules
linux-menuconfig linux-xconfig linux-gconfig linux-nconfig linux26-menuconfig linux26-xconfig linux26-gconfig linux26-nconfig: dirs $(LINUX26_DIR)/.stamp_configured
$(MAKE) $(LINUX26_MAKE_FLAGS) -C $(LINUX26_DIR) \
--
1.7.1
next reply other threads:[~2011-02-17 23:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-17 23:44 Bjørn Forsman [this message]
2011-02-17 23:44 ` [Buildroot] [PATCH v2 2/2] linux.mk: depend on actual kernel image instead of stamp file Bjørn Forsman
2011-02-21 17:02 ` Bjørn Forsman
2011-03-01 16:06 ` Bjørn Forsman
2011-03-01 16:23 ` Thomas Petazzoni
2011-03-01 18:54 ` Bjørn Forsman
2011-03-01 20:06 ` Bjørn Forsman
2011-02-21 17:02 ` [Buildroot] [PATCH v2 1/2] Makefile: improve $(TARGET_DIR) (re)creation Bjørn Forsman
2011-03-01 16:03 ` Bjørn Forsman
2011-03-01 16:20 ` Thomas Petazzoni
2011-03-01 17:16 ` Bjørn Forsman
2011-03-03 18:22 ` Bjørn Forsman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1297986294-23446-1-git-send-email-bjorn.forsman@gmail.com \
--to=bjorn.forsman@gmail.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.