diff options
author | Ulf Samuelsson <ulf.samuelsson@atmel.com> | 2007-07-12 13:11:03 +0000 |
---|---|---|
committer | Ulf Samuelsson <ulf.samuelsson@atmel.com> | 2007-07-12 13:11:03 +0000 |
commit | 412ca2a4d4072b5d4d2fa819d62f6a8848ff7fda (patch) | |
tree | 0181b9f0673b2cbe494b4ef025aac7cfb26649c0 | |
parent | 7def55591de471e6fa2e7921dfdf71c84a308cae (diff) | |
download | buildroot-novena-412ca2a4d4072b5d4d2fa819d62f6a8848ff7fda.tar.gz buildroot-novena-412ca2a4d4072b5d4d2fa819d62f6a8848ff7fda.zip |
BSP Patch:
=========================================================
The purpose of the BSP patch is to allow building
several boards inside the same buildroot tree.
For this to work, each board has to have its
own "$(TARGET_DIR)" and all *configurable* packages
must be rebuilt for each board.
They are now built in the "$(PROJECT_BUILD_DIR)"
All non configurable packages can and should still
be built in the "$(BUILD_DIR)".
If a package is built for one board, then when
you build for a second board of the same architecture
the build becomes a simple copy of the resulting
binaries.
-----
Define BR2_PROJECT which will be used as the selector
between different boards. Note that BR2_PROJECT allow
you to build multiple root file systems for a single
board, and should not be confused with BR2_BOARD_NAME
which relates to the H/W.
-----
Define PROJECT_BUILD_DIR as "PROJECT_BUILD_DIR/$(PROJECT)"
Define BINARIES_DIR as "binaries/$(PROJECT)"
Define TARGET_DIR as "$(PROJECT_BUILD_DIR)/root"
(some prefix/postfix may apply)
Resulting images are stored in "$(BINARIES_DIR)"
-----
Define a few new environment variables in Makefile
PROJECT: Stripped BR2_PROJECT
DATE: Date of build in YYYY-MM-DD format
HOSTNAME: Stripped BR2_HOSTNAME => /etc/hostname
BANNER: Stripped BR2_BANNER => /etc/issue
Linux and Busybox will be built in $(PROJECT_BUILD_DIR)
More patches will be needed later to ensure all
configurable packages are built in this directory.
-rw-r--r-- | Config.in | 2 | ||||
-rw-r--r-- | Makefile | 34 | ||||
-rw-r--r-- | package/Makefile.in | 10 | ||||
-rw-r--r-- | package/busybox/busybox.mk | 8 | ||||
-rw-r--r-- | project/Config.in | 26 | ||||
-rw-r--r-- | target/cloop/cloop.mk | 9 | ||||
-rw-r--r-- | target/jffs2/jffs2root.mk | 2 | ||||
-rw-r--r-- | target/linux/Makefile.in | 6 |
8 files changed, 75 insertions, 22 deletions
@@ -6,6 +6,8 @@ config BR2_HAVE_DOT_CONFIG bool default y +source "project/Config.in" + choice prompt "Target Architecture" default BR2_i386 @@ -155,6 +155,12 @@ TARGETS:=uclibc-configured binutils gcc uclibc-target-utils else TARGETS:=uclibc endif + +PROJECT:=$(strip $(subst ",, $(BR2_PROJECT))) +HOSTNAME:=$(strip $(subst ",, $(BR2_HOSTNAME))) +BANNER:=$(strip $(subst ",, $(BR2_BANNER))) + + include toolchain/Makefile.in include package/Makefile.in @@ -183,12 +189,14 @@ TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS)) TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS)) -world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS) -dirs: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) +world: $(DL_DIR) $(BUILD_DIR) $(PROJECT_BUILD_DIR) \ + $(BINARIES_DIR) $(STAGING_DIR) $(TARGET_DIR) bsp $(TARGETS) +dirs: $(DL_DIR) $(BUILD_DIR) $(PROJECT_BUILD_DIR) $(STAGING_DIR) -.PHONY: all world dirs clean dirclean distclean source $(TARGETS) \ +.PHONY: all world dirs clean dirclean distclean source bsp $(TARGETS) \ $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \ - $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR) + $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR) \ + $(PROJECT_BUILD_DIR) $(BINARIES_DIR) ############################################################# # @@ -196,7 +204,8 @@ dirs: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) # dependencies anywhere else # ############################################################# -$(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR): +$(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) \ + $(PROJECT_BUILD_DIR) $(BINARIES_DIR) : @mkdir -p $@ $(STAGING_DIR): @@ -221,6 +230,16 @@ $(TARGET_DIR): -find $(TARGET_DIR) -type d -name CVS | xargs rm -rf -find $(TARGET_DIR) -type d -name .svn | xargs rm -rf +bsp: $(TARGET_DIR)/etc/issue $(TARGET_DIR)/etc/hostname + +$(TARGET_DIR)/etc/issue: $(TARGET_DIR) .config + echo "" > $(TARGET_DIR)/etc/issue + echo "" >> $(TARGET_DIR)/etc/issue + echo "$(BANNER)" >> $(TARGET_DIR)/etc/issue + +$(TARGET_DIR)/etc/hostname: $(TARGET_DIR) .config + echo "$(HOSTNAME)" > $(TARGET_DIR)/etc/hostname + source: $(TARGETS_SOURCE) $(HOST_SOURCE) .config.check: dependencies @@ -245,12 +264,13 @@ distclean: ifeq ($(DL_DIR),$(BASE_DIR)/dl) rm -rf $(DL_DIR) endif - rm -rf $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE) $(BASE_DIR)/include \ + rm -rf $(BUILD_DIR) $(PROJECT_BUILD_DIR) $(BINARIES_DIR) \ + $(LINUX_KERNEL) $(IMAGE) $(BASE_DIR)/include \ .config.cmd $(MAKE) -C $(CONFIG) clean sourceball: - rm -rf $(BUILD_DIR) + rm -rf $(BUILD_DIR) $(PROJECT_BUILD_DIR) $(BINARIES_DIR) set -e; \ cd ..; \ rm -f buildroot.tar.bz2; \ diff --git a/package/Makefile.in b/package/Makefile.in index 3cbf6321d..fc0f020b4 100644 --- a/package/Makefile.in +++ b/package/Makefile.in @@ -69,7 +69,11 @@ DL_DIR:=$(BASE_DIR)/dl endif #PATCH_DIR=$(BASE_DIR)/sources/patches BUILD_DIR:=$(BASE_DIR)/$(TOPDIR_PREFIX)build_$(ARCH)$(ARCH_FPU_SUFFIX)$(TOPDIR_SUFFIX) -TARGET_DIR:=$(BUILD_DIR)/root + +PROJECT_BUILD_DIR:=$(BASE_DIR)/$(TOPDIR_PREFIX)project_build_$(ARCH)$(ARCH_FPU_SUFFIX)$(TOPDIR_SUFFIX)/$(PROJECT) +BINARIES_DIR:=$(BASE_DIR)/binaries/$(PROJECT) +TARGET_DIR:=$(PROJECT_BUILD_DIR)/root + GNU_TARGET_SUFFIX:=-$(strip $(subst ",, $(BR2_GNU_TARGET_SUFFIX))) #")) @@ -81,7 +85,7 @@ TOOL_BUILD_DIR=$(BASE_DIR)/$(TOPDIR_PREFIX)toolchain_build_$(ARCH)$(ARCH_FPU_SUF # Quotes are needed for spaces et al in path components. TARGET_PATH="$(TOOL_BUILD_DIR)/bin:$(STAGING_DIR)/bin:$(STAGING_DIR)/usr/bin:$(PATH)" -IMAGE:=$(BASE_DIR)/rootfs.$(ARCH)$(ARCH_FPU_SUFFIX) +IMAGE:=$(BINARIES_DIR)/rootfs.$(ARCH)$(ARCH_FPU_SUFFIX) GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)$(GNU_TARGET_SUFFIX) TARGET_CROSS=$(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)- @@ -93,7 +97,7 @@ TOOLCHAIN_EXTERNAL_PATH:=$(strip $(subst ",, $(BR2_TOOLCHAIN_EXTERNAL_PATH))) #")) TOOL_BUILD_DIR=$(BASE_DIR)/$(TOPDIR_PREFIX)toolchain_build_$(TOOLCHAIN_EXTERNAL_PREFIX) TARGET_PATH="$(STAGING_DIR)/bin:$(TOOL_BUILD_DIR)/bin:$(TOOLCHAIN_EXTERNAL_PATH)/bin:$(PATH)" -IMAGE:=$(BASE_DIR)/rootfs.$(TOOLCHAIN_EXTERNAL_PREFIX) +IMAGE:=$(BINARIES_DIR)/rootfs.$(TOOLCHAIN_EXTERNAL_PREFIX) REAL_GNU_TARGET_NAME=$(TOOLCHAIN_EXTERNAL_PREFIX) GNU_TARGET_NAME=$(TOOLCHAIN_EXTERNAL_PREFIX) KERNEL_CROSS=$(TOOLCHAIN_EXTERNAL_PATH)/bin/$(TOOLCHAIN_EXTERNAL_PREFIX)- diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk index 4d3511f6f..7c62c40d9 100644 --- a/package/busybox/busybox.mk +++ b/package/busybox/busybox.mk @@ -7,13 +7,13 @@ ifeq ($(strip $(BR2_PACKAGE_BUSYBOX_SNAPSHOT)),y) # Be aware that this changes daily.... -BUSYBOX_DIR:=$(BUILD_DIR)/busybox +BUSYBOX_DIR:=$(PROJECT_BUILD_DIR)/busybox BUSYBOX_SOURCE:=busybox-snapshot.tar.bz2 BUSYBOX_SITE:=http://www.busybox.net/downloads/snapshots else BUSYBOX_VERSION=$(strip $(subst ",, $(BR2_BUSYBOX_VERSION))) #")) -BUSYBOX_DIR:=$(BUILD_DIR)/busybox-$(BUSYBOX_VERSION) +BUSYBOX_DIR:=$(PROJECT_BUILD_DIR)/busybox-$(BUSYBOX_VERSION) BUSYBOX_SOURCE:=busybox-$(BUSYBOX_VERSION).tar.bz2 BUSYBOX_SITE:=http://www.busybox.net/downloads endif @@ -31,7 +31,7 @@ $(DL_DIR)/$(BUSYBOX_SOURCE): busybox-source: $(DL_DIR)/$(BUSYBOX_SOURCE) $(BUSYBOX_CONFIG_FILE) dependencies $(BUSYBOX_DIR)/.unpacked: $(DL_DIR)/$(BUSYBOX_SOURCE) - $(BUSYBOX_UNZIP) $(DL_DIR)/$(BUSYBOX_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - + $(BUSYBOX_UNZIP) $(DL_DIR)/$(BUSYBOX_SOURCE) | tar -C $(PROJECT_BUILD_DIR) $(TAR_OPTIONS) - ifeq ($(BR2_PACKAGE_SYSKLOGD),y) # if we have external syslogd, force busybox to use it $(SED) "/#include.*busybox\.h/a#define CONFIG_SYSLOGD" $(BUSYBOX_DIR)/init/init.c @@ -127,7 +127,7 @@ endif busybox: uclibc $(TARGET_DIR)/bin/busybox -busybox-menuconfig: host-sed $(BUILD_DIR) busybox-source $(BUSYBOX_DIR)/.configured +busybox-menuconfig: host-sed $(PROJECT_BUILD_DIR) busybox-source $(BUSYBOX_DIR)/.configured $(MAKE) __TARGET_ARCH=$(ARCH) -C $(BUSYBOX_DIR) menuconfig cp -f $(BUSYBOX_DIR)/.config $(BUSYBOX_CONFIG_FILE) diff --git a/project/Config.in b/project/Config.in new file mode 100644 index 000000000..67dd080e7 --- /dev/null +++ b/project/Config.in @@ -0,0 +1,26 @@ +menu "Project Options" + +config BR2_PROJECT + string "Project name" + default "uclibc" + help + The project name is used to define subdirectories + * where the Board Support Packages are built + (Linux,Root fs Bootmonitor,Utilities etc.) + * where the resulting binaries are stored. + Older targets may still build in the build_<arch> + and store binaries in the top directory. + +config BR2_HOSTNAME + string "hostname" + default "uclibc" + help + The hostname string is stored in "/etc/hostname" + +config BR2_BANNER + string "banner" + default "Welcome to the Erik's uClibc development environment." + help + The banner string is stored in "/etc/issue" + +endmenu diff --git a/target/cloop/cloop.mk b/target/cloop/cloop.mk index ca6d8bd4a..bba984edb 100644 --- a/target/cloop/cloop.mk +++ b/target/cloop/cloop.mk @@ -15,6 +15,7 @@ CLOOP_DIR=$(BUILD_DIR)/cloop-$(CLOOP_VERSION) CLOOP_SOURCE=cloop_$(CLOOP_VERSION)-5.tar.gz CLOOP_SITE=http://developer.linuxtag.net/knoppix/sources +CLOOP_TARGET:=$(IMAGE).cloop ### Note: not used yet! ck ### $(DL_DIR)/$(CLOOP_PATCH1): ### $(WGET) -P $(DL_DIR) $(CLOOP_PATCH1_URL)/$(CLOOP_PATCH1) @@ -78,19 +79,19 @@ clooproot: cloop check-tools $(IMAGE).cramfs ### cramfsroot @rm -rf $(TARGET_DIR)/usr/share/man @rm -rf $(TARGET_DIR)/usr/info @rmdir -p --ignore-fail-on-non-empty $(TARGET_DIR)/usr/share - ### $(CLOOP_DIR)/create_compressed_fs -q -D target/default/device_table.txt $(TARGET_DIR) $(IMAGE).cloop - ## mkisofs -r $(TARGET_DIR) | $(CLOOP_DIR)/create_compressed_fs - 65536 > $(IMAGE).cloop + ### $(CLOOP_DIR)/create_compressed_fs -q -D target/default/device_table.txt $(TARGET_DIR) $(CLOOP_TARGET) + ## mkisofs -r $(TARGET_DIR) | $(CLOOP_DIR)/create_compressed_fs - 65536 > $(CLOOP_TARGET) sudo /sbin/losetup -d /dev/loop1 sudo /sbin/losetup /dev/loop1 $(IMAGE).cramfs sudo mkdir -p /mnt/compressed sudo mount -o ro -t cramfs /dev/loop1 /mnt/compressed - mkisofs -r /mnt/compressed | $(CLOOP_DIR)/create_compressed_fs - 65536 > $(IMAGE).cloop + mkisofs -r /mnt/compressed | $(CLOOP_DIR)/create_compressed_fs - 65536 > $(CLOOP_TARGET) - symlinks -r /mnt/compressed sudo umount /mnt/compressed @echo "Mounting a compressed image:" @echo " sudo mkdir -p /mnt/compressed" @echo " sudo /sbin/insmod cloop" - @echo " sudo /sbin/losetup /dev/cloop1 $(IMAGE).cloop" + @echo " sudo /sbin/losetup /dev/cloop1 $(CLOOP_TARGET)" @echo " sudo mount -o ro -t iso9660 /dev/cloop1 /mnt/compressed" clooproot-source: cloop-source diff --git a/target/jffs2/jffs2root.mk b/target/jffs2/jffs2root.mk index 2df5de8b3..3341c0bf8 100644 --- a/target/jffs2/jffs2root.mk +++ b/target/jffs2/jffs2root.mk @@ -66,7 +66,7 @@ ifneq ($(TARGET_DEVICE_TABLE),) >> $(STAGING_DIR)/_fakeroot.$(notdir $(JFFS2_TARGET)) endif # Use fakeroot so mkfs.jffs2 believes the previous fakery - echo "$(MKFS_JFFS2) $(JFFS2_OPTS) -d $(BUILD_DIR)/root -o $(JFFS2_TARGET)" \ + echo "$(MKFS_JFFS2) $(JFFS2_OPTS) -d $(TARGET_DIR) -o $(JFFS2_TARGET)" \ >> $(STAGING_DIR)/_fakeroot.$(notdir $(JFFS2_TARGET)) chmod a+x $(STAGING_DIR)/_fakeroot.$(notdir $(JFFS2_TARGET)) $(STAGING_DIR)/usr/bin/fakeroot -- $(STAGING_DIR)/_fakeroot.$(notdir $(JFFS2_TARGET)) diff --git a/target/linux/Makefile.in b/target/linux/Makefile.in index 18c98b4c2..619b5706b 100644 --- a/target/linux/Makefile.in +++ b/target/linux/Makefile.in @@ -58,7 +58,7 @@ endif LINUX26_KERNEL=linux-kernel-$(LINUX26_VERSION)-$(KERNEL_ARCH) # Version of Linux AFTER patches -LINUX26_DIR=$(BUILD_DIR)/linux-$(LINUX26_VERSION) +LINUX26_DIR=$(PROJECT_BUILD_DIR)/linux-$(LINUX26_VERSION) # for packages that need it LINUX_VERSION:=$(LINUX_VERSION) @@ -89,10 +89,10 @@ $(DL_DIR)/$(LINUX26_SOURCE): $(LINUX26_DIR)/.unpacked: $(DL_DIR)/$(LINUX26_SOURCE) rm -rf $(LINUX26_DIR) - $(LINUX26_BZCAT) $(DL_DIR)/$(LINUX26_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - + $(LINUX26_BZCAT) $(DL_DIR)/$(LINUX26_SOURCE) | tar -C $(PROJECT_BUILD_DIR) $(TAR_OPTIONS) - ifneq ($(DOWNLOAD_LINUX26_VERSION),$(LINUX26_VERSION)) # Rename the dir from the downloaded version to the AFTER patch version - mv -f $(BUILD_DIR)/linux-$(DOWNLOAD_LINUX26_VERSION) $(LINUX26_DIR) + mv -f $(PROJECT_BUILD_DIR)/linux-$(DOWNLOAD_LINUX26_VERSION) $(LINUX26_DIR) endif touch $@ |