Add hooks for creating your own board support package
authorUlf Samuelsson <ulf.samuelsson@atmel.com>
Wed, 12 Sep 2007 04:34:16 +0000 (04:34 -0000)
committerUlf Samuelsson <ulf.samuelsson@atmel.com>
Wed, 12 Sep 2007 04:34:16 +0000 (04:34 -0000)
Makefile
docs/buildroot.html
project/project.mk

index f37b9ede70d5b18764649777bd7c766275a787a1..5414644d37f9751ffd0652407387309acc51c825 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -35,11 +35,20 @@ noconfig_targets:=menuconfig config oldconfig randconfig \
 
 # Pull in the user's configuration file
 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
+ifeq ($(BOARD),)
 -include $(TOPDIR).config
+else
+-include $(TOPDIR)/local/$(BOARD)/$(BOARD).config
+endif
 endif
 ifneq ($(BUILDROOT_DL_DIR),)
 BR2_DL_DIR:=$(BUILDROOT_DL_DIR)
 endif
+ifneq ($(BUILDROOT_LOCAL),)
+LOCAL:=$(BUILDROOT_LOCAL)
+else
+LOCAL:=local
+endif
 
 # To put more focus on warnings, be less verbose as default
 # Use 'make V=1' to see the full commands
index f7871184b54b0c2da92761409beccb0d29878fdf..d751250f2a67ebdc6402288381ededc97036390d 100644 (file)
     tool. 
     The file is stored in the "binaries/<code>$(PROJECT)</code>/" directory</p>
 
+    <h3><a name="local_board_support" id="local_board_support"></a>
+    Creating your own board support</h3>
+
+    <p>Once a package has been unpacked, it is possible to manually update
+    configuration files. Buildroot can automatically save the configuration
+    of buildroot, linux, busybox, uclibc and u-boot in "local/$(PROJECT) by 
+    using the command:
+    </p>
+
+<pre>
+ $ make saveconfig
+</pre>
+
+     <p>Once a buildroot configuration has been created by saveconfig, 
+     the default "$(TOPDIR)/.config" file can be overridden by</p>
+
+<pre>
+ $ make BOARD=&lt;project&gt;
+</pre>
+
+    <p>Buildroot will then use "local/&lt;project&gt;/&lt;project&gt;.config"
+    instead of ".config". </p>
+
+    <p>If you want to modify your board, you can copy the project configuration
+     file to ".config" by using the command:</p> 
+
+<pre>
+ $ make BOARD=&lt;project&gt; getconfig
+</pre>
+
+    <p>You can share your custom board support directory between several buildroot trees
+    by setting the environment variable <code>BUILDROOT_LOCAL</code> to this directory,
+    </p> 
+
+
+    <h3><a name="offline_builds" id="offline_builds"></a>
+    Offline builds</h3>
+
     <p>If you intend to do an offline-build and just want to download all
     sources that you previously selected in &quot;make menuconfig&quot; then
     issue:</p>
index 847cde99e21383eb0cc5df88860e686c0f5d0e70..62645850b783584cceaf6aef5bbdea93b3472e1d 100644 (file)
@@ -1,5 +1,7 @@
+PROJECT_FILE:=$(LOCAL)/$(PROJECT)/$(PROJECT).config
 
-.PHONY: target-host-info
+
+.PHONY: target-host-info  saveconfig getconfig
 
 target-host-info: $(TARGET_DIR)/etc/issue $(TARGET_DIR)/etc/hostname
 
@@ -12,3 +14,28 @@ $(TARGET_DIR)/etc/issue: .config
 $(TARGET_DIR)/etc/hostname: .config
        mkdir -p $(TARGET_DIR)/etc
        echo "$(TARGET_HOSTNAME)" > $(TARGET_DIR)/etc/hostname
+
+saveconfig: $(CONFIG)/conf
+       mkdir -p $(LOCAL)/$(PROJECT)
+       -cp .config $(PROJECT_FILE)
+       if [ -f $(LINUX26_DIR)/.config ] ; then \
+               cp $(LINUX26_DIR)/.config $(LOCAL)/$(PROJECT)/linux-$(LINUX26_VERSION).config ; \
+               $(SED) '/BR2_PACKAGE_LINUX_KCONFIG/d' $(PROJECT_FILE) ; \
+               echo "BR2_PACKAGE_LINUX_KCONFIG:=$(LOCAL)/$(PROJECT)/linux-$(LINUX26_VERSION).config" >> $(PROJECT_FILE)        ; \
+       fi
+       if [ -f $(BUSYBOX_DIR)/.config ] ; then \
+               cp $(BUSYBOX_DIR)/.config $(LOCAL)/$(PROJECT)/busybox-$(BUSYBOX_VERSION).config ; \
+               $(SED) '/BR2_PACKAGE_BUSYBOX_CONFIG/d' $(PROJECT_FILE) ; \
+               echo "BR2_PACKAGE_BUSYBOX_CONFIG:=$(LOCAL)/$(PROJECT)/busybox-$(BUSYBOX_VERSION).config" >> $(PROJECT_FILE) ; \
+       fi
+       if [ -f $(UCLIBC_DIR)/.config ] ; then \
+               cp $(UCLIBC_DIR)/.config $(LOCAL)/$(PROJECT)/uclibc-$(UCLIBC_VER).config ; \
+               $(SED) '/BR2_UCLIBC_CONFIG/d' $(PROJECT_FILE) ; \
+               echo "BR2_UCLIBC_CONFIG:=$(LOCAL)/$(PROJECT)/uclibc-$(UCLIBC_VER).config" >> $(PROJECT_FILE) ; \
+       fi
+       if [ -f $(UBOOT_DIR)/include/configs/$(PROJECT).h ] ; then \
+               cp $(UBOOT_DIR)/include/configs/$(PROJECT).h $(LOCAL)/$(PROJECT)/u-boot/$(PROJECT).h ; \
+       fi
+
+getconfig: $(CONFIG)/conf
+       -cp $(LOCAL)/$(PROJECT)/$(PROJECT).config .config