Add support for prepatched toolchains
authorUlf Samuelsson <ulf.samuelsson@atmel.com>
Tue, 31 Jul 2007 14:59:58 +0000 (14:59 -0000)
committerUlf Samuelsson <ulf.samuelsson@atmel.com>
Tue, 31 Jul 2007 14:59:58 +0000 (14:59 -0000)
12 files changed:
Config.in
target/device/Atmel/Mirrors.in [new file with mode: 0644]
target/device/Mirrors.in [new file with mode: 0644]
target/device/Toolchain.in [new file with mode: 0644]
toolchain/Config.in
toolchain/Makefile.in
toolchain/binutils/binutils.mk
toolchain/gcc/Config.in
toolchain/gcc/gcc-uclibc-3.x.mk
toolchain/gcc/gcc-uclibc-4.x.mk
toolchain/gdb/gdb.mk
toolchain/uClibc/uclibc.mk

index 499b4fc72c84ddbbb50207594496a1742957a988..cdc66663f27666b814942cdc82cfbfe2865cecf5 100644 (file)
--- a/Config.in
+++ b/Config.in
@@ -564,43 +564,7 @@ config BR2_DL_DIR
        help
          Directory to store all the source files that we need to fetch.
 
-config BR2_SOURCEFORGE_MIRROR
-       string "Sourceforge mirror site"
-       default "easynews"
-       help
-         Sourceforge has a system of mirror sites.  Some sites may be closer
-         to your location, and sometimes mirror sites go down and are no longer
-         available.  This option allows you to select your preferred Sourceforge
-         mirror site.
-
-         The list of mirrors is available here:
-         http://prdownloads.sourceforge.net/index-sf.html?download
-
-config BR2_ATMEL_MIRROR
-       depends BR2_TARGET_ATMEL && (BR2_avr32 || BR2_arm)
-       string "Atmel AVR32/AT91 download site"
-       default "ftp://at91dist:distrib@81.80.104.162/AT91_Third_Party_Design_Flow/Linux_Host/"
-       help
-         Unofficial site for AVR32/AT91 Buildroot patches, or your local mirror.
-         Atmel does not currently support buildroot, but this site makes
-         available neccessary patches and prepatched packages useful
-         to extend a buildroot for AVR32 or AT91 ARM based boards.
-         Issues with contents of this server needs to be highlighted
-         on the buildroot mailing list and
-         should not be addressed directly to Atmel
-         Atmel provides support for their AVR32 chips on 
-         http://avr32linux.org/ or http://www.avrfreaks.net/
-         Atmel provides support for AT91 chips on www.at91.com.
-         Commercial AT91 Linux support is through www.timesys.com
-         Community  AT91 Linux support is through http://maxim.org.za/AT91_26.html
-
-config BR2_AT91_PATCH_MIRROR
-       depends BR2_TARGET_ATMEL && BR2_arm
-       string "Atmel AT91 Linux Patch download site"
-       default "http://maxim.org.za/AT91RM9200/2.6/"
-       help
-         Patches for the AT91 generated by the Linux community
-         usually ends up here, courtesy of Andrew Victor
+source "target/device/Mirrors.in"
          
 config BR2_STAGING_DIR
        string "Toolchain and header file location?"
diff --git a/target/device/Atmel/Mirrors.in b/target/device/Atmel/Mirrors.in
new file mode 100644 (file)
index 0000000..64eb531
--- /dev/null
@@ -0,0 +1,27 @@
+menu   "Atmel Mirrors"
+
+config BR2_ATMEL_MIRROR
+       string "Atmel AVR32/AT91 download site"
+       default "ftp://at91dist:distrib@81.80.104.162/AT91_Third_Party_Design_Flow/Linux_Host/"
+       help
+         Unofficial site for AVR32/AT91 Buildroot patches, or your local mirror.
+         Atmel does not currently support buildroot, but this site makes
+         available neccessary patches and prepatched packages useful
+         to extend a buildroot for AVR32 or AT91 ARM based boards.
+         Issues with contents of this server needs to be highlighted
+         on the buildroot mailing list and
+         should not be addressed directly to Atmel
+         Atmel provides support for their AVR32 chips on 
+         http://avr32linux.org/ or http://www.avrfreaks.net/
+         Atmel provides support for AT91 chips on www.at91.com.
+         Commercial AT91 Linux support is through www.timesys.com
+         Community  AT91 Linux support is through http://maxim.org.za/AT91_26.html
+
+config BR2_AT91_PATCH_MIRROR
+       string "Atmel AT91 Linux Patch download site"
+       default "http://maxim.org.za/AT91RM9200/2.6/"
+       help
+         Patches for the AT91 generated by the Linux community
+         usually ends up here, courtesy of Andrew Victor
+
+endmenu
diff --git a/target/device/Mirrors.in b/target/device/Mirrors.in
new file mode 100644 (file)
index 0000000..477429f
--- /dev/null
@@ -0,0 +1,17 @@
+menu "Mirrors and Download locations"
+
+config BR2_SOURCEFORGE_MIRROR
+       string "Sourceforge mirror site"
+       default "easynews"
+       help
+         Sourceforge has a system of mirror sites.  Some sites may be closer
+         to your location, and sometimes mirror sites go down and are no longer
+         available.  This option allows you to select your preferred Sourceforge
+         mirror site.
+
+         The list of mirrors is available here:
+         http://prdownloads.sourceforge.net/index-sf.html?download
+
+source "target/device/Atmel/Mirrors.in"
+
+endmenu
diff --git a/target/device/Toolchain.in b/target/device/Toolchain.in
new file mode 100644 (file)
index 0000000..617cca3
--- /dev/null
@@ -0,0 +1,51 @@
+choice
+       prompt "Source location:"
+       default BR2_TOOLCHAIN_NORMAL            if      !BR2_avr32
+       default BR2_TOOLCHAIN_ATMEL_AVR32       if       BR2_avr32
+       depends on BR2_TOOLCHAIN_BUILDROOT
+       help
+         Select whether to use the toolchain built by the buildroot
+         system or an external pre-built toolchain.
+
+config BR2_TOOLCHAIN_NORMAL
+       bool
+       prompt "Use default sources for toolchain"
+
+config BR2_TOOLCHAIN_ATMEL_AVR32
+       bool
+       prompt "Use prepatched source for AVR32 toolchain"
+       depends on BR2_avr32
+       depends on BR2_GCC_VERSION_4_1_2
+       depends on BR2_GDB_VERSION_6_4 || !BR2_PACKAGE_GDB
+       depends on BR2_BINUTILS_VERSION_2_17
+       depends on BR2_UCLIBC_VERSION_0_9_28_3
+
+endchoice
+
+config BR2_VENDOR_SITE
+       string
+       default $(BR2_ATMEL_MIRROR)                     if BR2_TOOLCHAIN_ATMEL_AVR32
+
+config BR2_VENDOR_SUFFIX
+       string
+       default "-avr32"                                if BR2_TOOLCHAIN_ATMEL_AVR32
+
+config BR2_VENDOR_BINUTILS_RELEASE
+       string
+       default "-2.0"                                  if BR2_TOOLCHAIN_ATMEL_AVR32
+
+config BR2_VENDOR_GCC_RELEASE
+       string
+       default "-2.0"                                  if BR2_TOOLCHAIN_ATMEL_AVR32
+
+config BR2_VENDOR_UCLIBC_RELEASE
+       string
+       default "-2.0"                                  if BR2_TOOLCHAIN_ATMEL_AVR32
+
+config BR2_VENDOR_GDB_RELEASE
+       string
+       default "-2.0"                                  if BR2_TOOLCHAIN_ATMEL_AVR32
+
+config BR2_VENDOR_PATCH_DIR
+       string
+       default "target/device/Atmel/toolchain/avr32"   if BR2_TOOLCHAIN_ATMEL_AVR32
index 9e16bb8466aa97128f69c8fc93bd80161b7b38cb..a4b1af32fa9ec4c111220f891acc8d0f658f8aa0 100644 (file)
@@ -1,5 +1,4 @@
-#
-
+menu   "Toolchain type"
 choice
        prompt "Toolchain type"
        default BR2_TOOLCHAIN_BUILDROOT
@@ -16,5 +15,9 @@ config BR2_TOOLCHAIN_EXTERNAL
        prompt "External toolchain"
 endchoice
 
+source "target/device/Toolchain.in"
+
+endmenu
+
 source "toolchain/Config.in.2"
 source "toolchain/external-toolchain/Config.in"
index a3dff49d425f6864e8d75d6d887cab096d80d0c3..e313df3c2ec7ce213a42549fc479c10af4f8d5df 100644 (file)
@@ -45,5 +45,21 @@ CFLAGS_WHOLE_PROGRAM = $(call cc-option,-fwhole-program,)
 # gcc-3.4 would need -combine, I only support 4.2, which correctly uses '--'
 CFLAGS_COMBINE = $(call cc-option,--combine,)
 
+# define values for prepatched source trees for toolchains
+VENDOR_SITE:=$(strip $(subst ",,$(BR2_VENDOR_SITE)))
+#"))
+VENDOR_SUFFIX:=$(strip $(subst ",,$(BR2_VENDOR_SUFFIX)))
+#"))
+VENDOR_BINUTILS_RELEASE:=$(strip $(subst ",,$(BR2_VENDOR_BINUTILS_RELEASE)))
+#"))
+VENDOR_GCC_RELEASE:=$(strip $(subst ",,$(BR2_VENDOR_GCC_RELEASE)))
+#"))
+VENDOR_UCLIBC_RELEASE:=$(strip $(subst ",,$(BR2_VENDOR_UCLIBC_RELEASE)))
+#"))
+VENDOR_GDB_RELEASE:=$(strip $(subst ",,$(BR2_VENDOR_GDB_RELEASE)))
+#"))
+VENDOR_PATCH_DIR:=$(strip $(subst ",,$(BR2_VENDOR_PATCH_DIR)))
+#"))
+
 # gcc has a bunch of needed stuff....
 include toolchain/gcc/Makefile.in
index 1932360726fa01255c10b779bb5325773153fba5..32b23727fdaa34084d9f9dcc6be6b135f9c14e72 100644 (file)
@@ -62,8 +62,20 @@ BINUTILS_TARGET_CONFIG_OPTIONS=--with-gmp="$(GMP_TARGET_DIR)"
 BINUTILS_TARGET_CONFIG_OPTIONS+=--with-mpfr="$(MPFR_TARGET_DIR)"
 endif
 
-BINUTILS_SOURCE:=binutils-$(BINUTILS_VERSION).tar.bz2
-BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)
+ifeq   ($(BR2_TOOLCHAIN_NORMAL),)
+BINUTILS_SITE:=$(VENDOR_SITE)
+endif
+
+BINUTILS_OFFICIAL_VERSION:=$(BINUTILS_VERSION)$(VENDOR_SUFFIX)$(VENDOR_BINUTILS_RELEASE)
+
+ifeq   ($(BR2_TOOLCHAIN_NORMAL),y)
+BINUTILS_PATCH_DIR:=toolchain/binutils/$(BINUTILS_VERSION)
+else
+BINUTILS_PATCH_DIR:=$(VENDOR_PATCH_DIR)/binutils-$(BINUTILS_OFFICIAL_VERSION)
+endif
+
+BINUTILS_SOURCE:=binutils-$(BINUTILS_OFFICIAL_VERSION).tar.bz2
+BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_OFFICIAL_VERSION)
 BINUTILS_CAT:=$(BZCAT)
 
 BINUTILS_DIR1:=$(TOOL_BUILD_DIR)/binutils-$(BINUTILS_VERSION)-build
@@ -72,7 +84,7 @@ $(DL_DIR)/$(BINUTILS_SOURCE):
        mkdir -p $(DL_DIR)
        $(WGET) -P $(DL_DIR) $(BINUTILS_SITE)/$(BINUTILS_SOURCE)
 
-binutils-unpacked: $(BINUTILS_DIR)/.unpacked
+binutils-unpacked: $(BINUTILS_DIR)/.patched
 $(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE)
        mkdir -p $(TOOL_BUILD_DIR)
        rm -rf $(BINUTILS_DIR)
@@ -82,7 +94,7 @@ $(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE)
 
 $(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked
        # Apply appropriate binutils patches.
-       toolchain/patch-kernel.sh $(BINUTILS_DIR) toolchain/binutils/$(BINUTILS_VERSION) \*.patch
+       toolchain/patch-kernel.sh $(BINUTILS_DIR) $(BINUTILS_PATCH_DIR) \*.patch
        touch $@
 
 $(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched
index c7b258095a6b2b9a78a2819f43df7eef9324eb62..51934d9d96ae97875507b89f08e0c4ee0adcaef9 100644 (file)
@@ -119,7 +119,7 @@ config BR2_GCC_VERSION
 
 config BR2_TOOLCHAIN_SYSROOT
        bool "Enable toolchain with --sysroot support"
-       depends on !BR2_GCC_VERSION_3_3_5 && !BR2_GCC_VERSION_3_3_6 && !BR2_GCC_VERSION_3_4_2 && !BR2_GCC_VERSION_3_4_3 && !BR2_GCC_VERSION_3_4_4 && !BR2_GCC_VERSION_3_4_5 && !BR2_GCC_VERSION_3_4_6
+       depends on !BR2_GCC_VERSION_3_3_5 && !BR2_GCC_VERSION_3_3_6 && !BR2_GCC_VERSION_3_4_2 && !BR2_GCC_VERSION_3_4_3 && !BR2_GCC_VERSION_3_4_4 && !BR2_GCC_VERSION_3_4_5 && !BR2_GCC_VERSION_3_4_6 && !BR2_GCC_VERSION_4_1_2
        default y
        help
          Enables --sysroot=dir for binutils and gcc.
index cd736371ff8d2b1627bb721f832b2367f543b314..798ba25b9226f5ad7b053f6675007da83bc156ad 100644 (file)
@@ -31,8 +31,31 @@ GCC_OFFICIAL_VER:=$(GCC_VERSION)-$(GCC_SNAP_DATE)
 GCC_SITE:=ftp://sources.redhat.com/pub/gcc/snapshots/$(GCC_OFFICIAL_VER)
 endif
 
+
+# redefine if using an external prepatched gcc source
+ifeq   ($(BR2_TOOLCHAIN_NORMAL),)
+GCC_SITE:=$(VENDOR_SITE)
+GCC_OFFICIAL_VER:=$(GCC_VERSION)$(VENDOR_SUFFIX)$(VENDOR_GCC_RELEASE)
+endif
+
 GCC_SOURCE:=gcc-$(GCC_OFFICIAL_VER).tar.bz2
 GCC_DIR:=$(TOOL_BUILD_DIR)/gcc-$(GCC_OFFICIAL_VER)
+
+ifeq   ($(BR2_TOOLCHAIN_NORMAL),y)
+ifeq ($(GCC_SNAP_DATE),)
+GCC_PATCH_DIR:=toolchain/gcc/$(GCC_VERSION)
+else
+ifneq ($(wildcard toolchain/gcc/$(GCC_OFFICIAL_VER)),)
+GCC_PATCH_DIR:=toolchain/gcc/$(GCC_OFFICIAL_VER)
+else
+GCC_PATCH_DIR:=toolchain/gcc/$(GCC_VERSION)
+endif
+endif
+else
+GCC_PATCH_DIR:=$(VENDOR_PATCH_DIR)/gcc-$(GCC_OFFICIAL_VER)
+endif
+
+
 GCC_CAT:=$(BZCAT)
 GCC_STRIP_HOST_BINARIES:=true
 
@@ -109,7 +132,7 @@ $(DL_DIR)/$(GCC_SOURCE):
        mkdir -p $(DL_DIR)
        $(WGET) -P $(DL_DIR) $(GCC_SITE)/$(GCC_SOURCE)
 
-gcc-unpacked: $(GCC_DIR)/.unpacked
+gcc-unpacked: $(GCC_DIR)/.patched
 $(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE)
        mkdir -p $(TOOL_BUILD_DIR)
        $(GCC_CAT) $(DL_DIR)/$(GCC_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
@@ -119,16 +142,7 @@ $(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE)
 gcc-patched: $(GCC_DIR)/.patched
 $(GCC_DIR)/.patched: $(GCC_DIR)/.unpacked
        # Apply any files named gcc-*.patch from the source directory to gcc
-ifeq ($(GCC_SNAP_DATE),)
-       toolchain/patch-kernel.sh $(GCC_DIR) toolchain/gcc/$(GCC_VERSION) \*.patch
-else
-ifneq ($(wildcard toolchain/gcc/$(GCC_OFFICIAL_VER)),)
-       toolchain/patch-kernel.sh $(GCC_DIR) toolchain/gcc/$(GCC_OFFICIAL_VER) \*.patch
-else
-       toolchain/patch-kernel.sh $(GCC_DIR) toolchain/gcc/$(GCC_VERSION) \*.patch
-endif
-endif
-
+       toolchain/patch-kernel.sh $(GCC_DIR) $(GCC_PATCH_DIR) \*.patch
        # Note: The soft float situation has improved considerably with gcc 3.4.x.
        # We can dispense with the custom spec files, as well as libfloat for the arm case.
        # However, we still need a patch for arm.  There's a similar patch for gcc 3.3.x
index 2274811b339d42ac3d55e20dbc383053d9fe51be..fb8cb6908c188eddb0ec153798cc75bd204f7546 100644 (file)
@@ -29,6 +29,28 @@ GCC_OFFICIAL_VER:=$(GCC_VERSION)-$(GCC_SNAP_DATE)
 GCC_SITE:=ftp://sources.redhat.com/pub/gcc/snapshots/$(GCC_OFFICIAL_VER)
 endif
 
+# redefine if using an external prepatched gcc source
+ifeq   ($(BR2_TOOLCHAIN_NORMAL),)
+GCC_SITE:=$(VENDOR_SITE)
+GCC_OFFICIAL_VER:=$(GCC_VERSION)$(VENDOR_SUFFIX)$(VENDOR_GCC_RELEASE)
+endif
+
+# define patch location
+ifeq   ($(BR2_TOOLCHAIN_NORMAL),y)     # Normal toolchain
+ifeq ($(GCC_SNAP_DATE),)               # Not a snapshot
+GCC_PATCH_DIR:=toolchain/gcc/$(GCC_VERSION)
+else                                   # Is a snapshot
+ifneq ($(wildcard toolchain/gcc/$(GCC_OFFICIAL_VER)),) # Snapshot patch?
+GCC_PATCH_DIR:=toolchain/gcc/$(GCC_OFFICIAL_VER)
+else                                   # Normal patch to snapshot
+# Use the normal location, if the dedicated location does not exist
+GCC_PATCH_DIR:=toolchain/gcc/$(GCC_VERSION)
+endif                                  # Snapshot patch
+endif                                  # Not a snapshot
+else                                   # Prepatched toolchain
+GCC_PATCH_DIR:=$(VENDOR_PATCH_DIR)/gcc-$(GCC_OFFICIAL_VER)
+endif                                  # Normal toolchain
+
 GCC_SOURCE:=gcc-$(GCC_OFFICIAL_VER).tar.bz2
 GCC_DIR:=$(TOOL_BUILD_DIR)/gcc-$(GCC_OFFICIAL_VER)
 GCC_CAT:=$(BZCAT)
@@ -97,7 +119,7 @@ $(DL_DIR)/$(GCC_SOURCE):
        mkdir -p $(DL_DIR)
        $(WGET) -P $(DL_DIR) $(GCC_SITE)/$(GCC_SOURCE)
 
-gcc-unpacked: $(GCC_DIR)/.unpacked
+gcc-unpacked: $(GCC_DIR)/.patched
 $(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE)
        mkdir -p $(TOOL_BUILD_DIR)
        rm -rf $(GCC_DIR)
@@ -108,15 +130,7 @@ $(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE)
 gcc-patched: $(GCC_DIR)/.patched
 $(GCC_DIR)/.patched: $(GCC_DIR)/.unpacked
        # Apply any files named gcc-*.patch from the source directory to gcc
-ifeq ($(GCC_SNAP_DATE),)
-       toolchain/patch-kernel.sh $(GCC_DIR) toolchain/gcc/$(GCC_VERSION) \*.patch
-else
-ifneq ($(wildcard toolchain/gcc/$(GCC_OFFICIAL_VER)),)
-       toolchain/patch-kernel.sh $(GCC_DIR) toolchain/gcc/$(GCC_OFFICIAL_VER) \*.patch
-else
-       toolchain/patch-kernel.sh $(GCC_DIR) toolchain/gcc/$(GCC_VERSION) \*.patch
-endif
-endif
+       toolchain/patch-kernel.sh $(GCC_DIR) $(GCC_PATCH_DIR) \*.patch
 
        # Note: The soft float situation has improved considerably with gcc 3.4.x.
        # We can dispense with the custom spec files, as well as libfloat for the arm case.
index 80d66f24c3fbf40a3481aff9cdc0a7cae42d2e2a..847a7ec064a1ab6d7be05c7a6817f3bf0637e2c6 100644 (file)
@@ -18,11 +18,25 @@ GDB_SOURCE:=gdb.tar.bz2
 GDB_CAT:=$(BZCAT)
 GDB_DIR:=$(TOOL_BUILD_DIR)/gdb-$(GDB_VERSION)
 else
+
+ifeq   ($(BR2_TOOLCHAIN_NORMAL),y)
 GDB_SITE:=http://ftp.gnu.org/gnu/gdb
-GDB_SOURCE:=gdb-$(GDB_VERSION).tar.bz2
+else
+GDB_SITE:=$(VENDOR_SITE)
+endif
+
+GDB_OFFICIAL_VERSION:=$(GDB_VERSION)$(VENDOR_SUFFIX)$(VENDOR_GDB_RELEASE)
+
+GDB_SOURCE:=gdb-$(GDB_OFFICIAL_VERSION).tar.bz2
 GDB_CAT:=$(BZCAT)
 
-GDB_DIR:=$(TOOL_BUILD_DIR)/gdb-$(GDB_VERSION)
+ifeq   ($(BR2_TOOLCHAIN_NORMAL),y)
+GDB_PATCH_DIR:=toolchain/gdb/$(GDB_OFFICIAL_VERSION)
+else
+GDB_PATCH_DIR:=$(VENDOR_PATCH_DIR)/gdb-$(GDB_OFFICIAL_VERSION)
+endif
+
+GDB_DIR:=$(TOOL_BUILD_DIR)/gdb-$(GDB_OFFICIAL_VERSION)
 
 # NOTE: This option should not be used with gdb versions 6.4 and above.
 ifeq ($(GDB_VERSION),6.2.1)
@@ -39,13 +53,14 @@ $(DL_DIR)/$(GDB_SOURCE):
 
 gdb-unpacked: $(GDB_DIR)/.unpacked
 $(GDB_DIR)/.unpacked: $(DL_DIR)/$(GDB_SOURCE)
+       mkdir -p $(TOOL_BUILD_DIR)
        $(GDB_CAT) $(DL_DIR)/$(GDB_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
 ifeq ($(GDB_VERSION),snapshot)
        GDB_REAL_DIR=$(shell \
                tar jtf $(DL_DIR)/$(GDB_SOURCE) | head -1 | cut -d"/" -f1)
        ln -sf $(TOOL_BUILD_DIR)/$(shell tar jtf $(DL_DIR)/$(GDB_SOURCE) | head -1 | cut -d"/" -f1) $(GDB_DIR)
 endif
-       toolchain/patch-kernel.sh $(GDB_DIR) toolchain/gdb/$(GDB_VERSION) \*.patch
+       toolchain/patch-kernel.sh $(GDB_DIR) $(GDB_PATCH_DIR) \*.patch
        $(CONFIG_UPDATE) $(GDB_DIR)
        touch $@
 
index af13bf280123b0f1d974d4499289b804e7e66111..f860d50174123fd4b5103e4f450ede2b0414793b 100644 (file)
@@ -33,13 +33,21 @@ UCLIBC_VER:=0.9.28
 endif
 UCLIBC_SITE:=http://www.uclibc.org/downloads
 
-ifeq   ($(BR2_avr32),y)
-VENDOR_SUFFIX:=-avr32
-UCLIBC_SITE:=$(BR2_ATMEL_MIRROR)/Source
+ifeq   ($(BR2_TOOLCHAIN_NORMAL),)
+UCLIBC_SITE:=$(VENDOR_SITE)
 endif
 
-UCLIBC_DIR:=$(TOOL_BUILD_DIR)/uClibc-$(UCLIBC_VER)$(VENDOR_SUFFIX)
-UCLIBC_SOURCE:=uClibc-$(UCLIBC_VER)$(VENDOR_SUFFIX).tar.bz2
+UCLIBC_OFFICIAL_VERSION:=$(UCLIBC_VER)$(VENDOR_SUFFIX)$(VENDOR_UCLIBC_RELEASE)
+
+
+ifeq   ($(BR2_TOOLCHAIN_NORMAL),y)
+UCLIBC_PATCH_DIR:=toolchain/uClibc/
+else
+UCLIBC_PATCH_DIR:=$(VENDOR_PATCH_DIR)/uClibc-$(UCLIBC_OFFICIAL_VERSION)
+endif
+
+UCLIBC_DIR:=$(TOOL_BUILD_DIR)/uClibc-$(UCLIBC_OFFICIAL_VERSION)
+UCLIBC_SOURCE:=uClibc-$(UCLIBC_OFFICIAL_VERSION).tar.bz2
 endif
 
 UCLIBC_CAT:=$(BZCAT)
@@ -93,13 +101,13 @@ endif
 
 uclibc-unpacked: $(UCLIBC_DIR)/.unpacked
 $(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE) $(UCLIBC_LOCALE_DATA)
-       [ -d $(TOOL_BUILD_DIR) ] || $(INSTALL) -d $(TOOL_BUILD_DIR)
+       mkdir -p $(TOOL_BUILD_DIR)
        rm -rf $(UCLIBC_DIR)
        $(UCLIBC_CAT) $(DL_DIR)/$(UCLIBC_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
 ifneq ($(BR2_UCLIBC_VERSION_SNAPSHOT),y)
-       toolchain/patch-kernel.sh $(UCLIBC_DIR) toolchain/uClibc/ uClibc-$(UCLIBC_VER)$(VENDOR_SUFFIX)-\*.patch
+       toolchain/patch-kernel.sh $(UCLIBC_DIR) $(UCLIBC_PATCH_DIR) uClibc-$(UCLIBC_OFFICIAL_VERSION)-\*.patch
 else
-       toolchain/patch-kernel.sh $(UCLIBC_DIR) toolchain/uClibc/ uClibc.\*.patch
+       toolchain/patch-kernel.sh $(UCLIBC_DIR) $(UCLIBC_PATCH_DIR) uClibc.\*.patch
 endif
 ifneq ($(BR2_ENABLE_LOCALE),)
        cp -dpf $(DL_DIR)/$(UCLIBC_SOURCE_LOCALE) $(UCLIBC_DIR)/extra/locale/