Oh, one thing I forgot was to rebase against trunk.  This is based on a version 
of attitude_adjustment
a few days to a week or two ago.

On 01/11/2012 12:49 AM, Daniel Dickinson wrote:
> Hi all,
> 
> The following patch both fixes using an openwrt external toolchain
> (that is in menuconfig using the option to build a toolchain, and feeding
> that back into another openwrt build as an external toolchain, which if 
> you're not
> constantly following every commit in trunk (or to a certain extent even if 
> you are,
> because even then toolchain doesn't change that often), saves a great deal of 
> build time
> since the toolchain is one of the portions of the build that takes longest 
> and is not
> parallelized (or at least not much)) to build a working ImageBuilder and SDK 
> (the resulting
> ImageBuilder and SDK (or at least the SDK) require that the Toolchain 
> directory be referenced
> in their .configs).
> 
> This patch should be fairly non-controversial or painful for anyone, but I am 
> posting for review
> of submitting because I have been on a long hiatus, and my previous recent 
> commit (for a personal patch,
> unlike this patch, which comes from a client) as a I came back was rather a 
> disaster (though at least
> the concept was appreciated (the -fat image for dir825 which allows to use 
> the full flash of the dir825
> instead of only about 6MB that the stock images use and the default caldata 
> position allows).
> 
> I am hoping this gets no complaints and I can just commit the patch, but if 
> there are issues, please let me
> know and I will try to address them.  I probably can't spend a lot of time on 
> it, since my client isn't likely to pay for
> extensive amounts of time massaging patches to get them accepted upstream 
> when they work for them, so please keep
> that in mind when asking for changes.  I am hoping the that various patches I 
> will be sending don't require a lot
> of managing to be useful/manageable in openwrt proper, since I'd like to see 
> openwrt benefit from the time I've
> spent away, but as I've said I don't have a lot of paid time to get them 
> integrated.
> 
> In include patch both inline and as attachment so that hopefully everyone can 
> get a non-mangled using their
> preferred method of dealing with patches.
> 
> Signed-Off-By: Daniel Dickinson <[email protected]>
> 
> Patch follows:
> 
> Index: openwrt/target/imagebuilder/Config.in
> ===================================================================
> --- openwrt.orig/target/imagebuilder/Config.in        2012-09-28 
> 20:22:39.000000000 -0400
> +++ openwrt/target/imagebuilder/Config.in     2012-10-10 20:56:25.372687867 
> -0400
> @@ -2,7 +2,7 @@
>       bool "Build the OpenWrt Image Builder"
>       depends !TARGET_ROOTFS_INITRAMFS
>       depends !PROFILE_KCONFIG
> -     depends !EXTERNAL_TOOLCHAIN
> +     depends !EXTERNAL_TOOLCHAIN || EXTERNAL_UCLIBC
>       help
>         This is essentially a stripped-down version of the buildroot
>         with precompiled packages, kernel image and image building tools.
> Index: openwrt/target/sdk/Config.in
> ===================================================================
> --- openwrt.orig/target/sdk/Config.in 2012-09-28 20:22:41.000000000 -0400
> +++ openwrt/target/sdk/Config.in      2012-10-10 20:56:25.372687867 -0400
> @@ -1,6 +1,6 @@
>  config SDK
>       bool "Build the OpenWrt SDK"
> -     depends !EXTERNAL_TOOLCHAIN
> +     depends !EXTERNAL_TOOLCHAIN || EXTERNAL_UCLIBC
>       help
>         This is essentially a stripped-down version of the buildroot
>         with a precompiled toolchain. It can be used to develop and
> Index: openwrt/toolchain/Config.in
> ===================================================================
> --- openwrt.orig/toolchain/Config.in  2012-09-28 20:22:41.000000000 -0400
> +++ openwrt/toolchain/Config.in       2012-10-10 20:56:25.376687693 -0400
> @@ -14,6 +14,13 @@
>               help
>                 If enabled, OpenWrt will compile using the native toolchain 
> for your host instead of compiling one
> 
> +     config EXTERNAL_UCLIBC
> +             bool
> +             prompt "External toolchain uses uClibc" if DEVEL
> +             depends EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN
> +             help
> +                If enabled, OpenWrt will treat the external toolchain as a 
> uClibc toolchain
> +
>       config TARGET_NAME
>               string
>               prompt "Target name"  if DEVEL
> @@ -171,7 +178,7 @@
> 
>  config USE_UCLIBC
>       bool
> -     default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN
> +     default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN 
> || EXTERNAL_UCLIBC
> 
>  config USE_EXTERNAL_LIBC
>       bool
> Index: openwrt/toolchain/Makefile
> ===================================================================
> --- openwrt.orig/toolchain/Makefile   2012-09-28 20:22:41.000000000 -0400
> +++ openwrt/toolchain/Makefile        2012-10-10 20:56:25.376687693 -0400
> @@ -29,9 +29,11 @@
> 
>  # subdirectories to descend into
>  $(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if 
> $(CONFIG_INSIGHT),insight) $(if 
> $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/minimal 
> gcc/initial gcc/final $(LIBC)/headers $(LIBC))
> +ifndef CONFIG_EXTERNAL_TOOLCHAIN
>  ifdef CONFIG_USE_UCLIBC
>    $(curdir)/builddirs += $(LIBC)/utils
>  endif
> +endif
>  $(curdir)/builddirs-compile:=$($(curdir)/builddirs-prepare)
>  $(curdir)/builddirs-install:=$($(curdir)/builddirs-compile)
> 
> Index: openwrt/target/sdk/Makefile
> ===================================================================
> --- openwrt.orig/target/sdk/Makefile  2012-09-28 20:22:41.000000000 -0400
> +++ openwrt/target/sdk/Makefile       2012-10-11 18:12:11.246179649 -0400
> @@ -14,7 +14,11 @@
>  PKG_OS:=$(word 2,$(subst -, ,$(shell $(HOSTCC) -dumpmachine)))
>  PKG_CPU:=$(word 1,$(subst -, ,$(shell $(HOSTCC) -dumpmachine)))
> 
> +ifeq ($(EXTERNAL_TOOLCHAIN),)
>  
> SDK_NAME:=OpenWrt-SDK-$(BOARD)-for-$(PKG_OS)-$(PKG_CPU)-gcc-$(GCCV)_$(LIBC)-$(LIBCV)
> +else
> +SDK_NAME:=OpenWrt-SDK-$(BOARD)-for-$(PKG_OS)-$(PKG_CPU)-gcc-$(GNU_TARGET_NAME)
> +endif
>  SDK_BUILD_DIR:=$(BUILD_DIR)/$(SDK_NAME)
>  EXCLUDE_DIRS:=*/ccache \
>       */stamp \
> @@ -33,7 +37,9 @@
>               $(foreach exclude,$(EXCLUDE_DIRS),--exclude="$(exclude)") \
>               --exclude="staging_dir/$(ARCH)" \
>               staging_dir/host 
> staging_dir/target-$(ARCH)$(ARCH_SUFFIX)_$(LIBC)-$(LIBCV)$(if 
> $(CONFIG_arm),_eabi) \
> -             
> staging_dir/toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)_$(LIBC)-$(LIBCV)$(if 
> $(CONFIG_arm),_eabi) | \
> +             staging_dir/host staging_dir/target-$(GNU_TARGET_NAME) \
> +             
> staging_dir/toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)_$(LIBC)-$(LIBCV)$(if 
> $(CONFIG_arm),_eabi) \
> +             staging_dir/toolchain-$(GNU_TARGET_NAME) | \
>               $(TAR) -xf - -C $(SDK_BUILD_DIR)
>       mkdir -p $(SDK_BUILD_DIR)/target/linux
>       $(CP) $(GENERIC_PLATFORM_DIR) $(PLATFORM_DIR) 
> $(SDK_BUILD_DIR)/target/linux/
> Index: openwrt/target/imagebuilder/files/Makefile
> ===================================================================
> --- openwrt.orig/target/imagebuilder/files/Makefile   2012-09-28 
> 20:22:39.000000000 -0400
> +++ openwrt/target/imagebuilder/files/Makefile        2012-10-10 
> 20:56:25.376687693 -0400
> @@ -53,6 +53,7 @@
> 
>  # override variables from rules.mk
>  PACKAGE_DIR:=$(TOPDIR)/packages
> +OPKG_TMP:=$(TOPDIR)/$(shell mktemp -d)
>  OPKG:= \
>    IPKG_TMP="$(TOPDIR)/tmp/ipkgtmp" \
>    IPKG_INSTROOT="$(TARGET_DIR)" \
> @@ -67,7 +68,8 @@
>       --offline-root $(TARGET_DIR) \
>       --add-dest root:/ \
>       --add-arch all:100 \
> -     --add-arch $(ARCH_PACKAGES):200
> +     --add-arch $(ARCH_PACKAGES):200 \
> +     -t $(OPKG_TMP)
> 
>  define Profile
>    $(eval $(call Profile/Default))
> @@ -105,6 +107,7 @@
>               $(MAKE) package_index; \
>       else \
>               mkdir -p $(TARGET_DIR)/tmp; \
> +             mkdir -p $(OPKG_TMP); \
>               $(OPKG) update; \
>       fi
>       $(MAKE) package_install
> @@ -121,11 +124,13 @@
>       (cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages && \
>               gzip -9c Packages > Packages.gz \
>       ) >/dev/null 2>/dev/null
> +     mkdir -p $(OPKG_TMP); \
>       $(OPKG) update
> 
>  package_install: FORCE
>       @echo
>       @echo Installing packages...
> +     mkdir -p $(OPKG_TMP)    
>       $(OPKG) install $(PACKAGE_DIR)/libc_*.ipk
>       $(OPKG) install $(PACKAGE_DIR)/kernel_*.ipk
>       $(OPKG) install $(BUILD_PACKAGES)
> Index: openwrt/package/toolchain/Makefile
> ===================================================================
> --- openwrt.orig/package/toolchain/Makefile   2012-09-28 20:22:39.000000000 
> -0400
> +++ openwrt/package/toolchain/Makefile        2012-10-11 18:14:35.955580531 
> -0400
> @@ -136,7 +136,8 @@
>               string
>               prompt "libc shared library files (use wildcards)"
>               depends EXTERNAL_TOOLCHAIN && PACKAGE_libc
> -             default "./lib/ld{-*.so,-linux*.so.*} 
> ./lib/lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util}{-*.so,.so.*}"
> +             default "./lib/ld{-*.so,-linux*.so.*} 
> ./lib/lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util}{-*.so,.so.*,.so}"
>  if !EXTERNAL_UCLIBC
> +             default "./lib/ld{-*.so,-*.so.*,-linux*.so.*} 
> ./lib/lib{anl,c,cidn,crypt,dl,m,nsl,nss_dns,nss_files,resolv,util,uClibc}{-*.so,.so.*,.so}"
>  if EXTERNAL_UCLIBC
> 
>       endmenu
>  endef
> @@ -162,7 +163,7 @@
>               string
>               prompt "libpthread shared library files (use wildcards)"
>               depends EXTERNAL_TOOLCHAIN && PACKAGE_libpthread
> -             default "./lib/libpthread{-*.so,.so.*}"
> +             default "./lib/libpthread{-*.so,.so.*,.so}"
> 
>       endmenu
>  endef
> @@ -189,7 +190,7 @@
>               string
>               prompt "librt shared library files (use wildcards)"
>               depends EXTERNAL_TOOLCHAIN && PACKAGE_librt
> -             default "./lib/librt{-*.so,.so.*}"
> +             default "./lib/librt{-*.so,.so.*,.so}"
> 
>       endmenu
>  endef
> @@ -453,6 +454,7 @@
>               $(TOOLCHAIN_DIR)/lib/librt.so.* \
>               $(TOOLCHAIN_DIR)/lib/librt-$(LIBC_SO_VERSION).so \
>               $(1)/lib/
> +     $(if $(CONFIG_EXTERNAL_UCLIBC),$(CP) 
> $(CONFIG_TOOLCHAIN_ROOT)/lib/librt-*.so $(TOOLCHAIN_DIR)/lib))
>    endef
> 
>    define Package/ldd/install
> @@ -517,6 +519,7 @@
>               $(INSTALL_DIR) $(1)/$$$$dir ; \
>               $(CP) $(call qstrip,$(CONFIG_LIBPTHREAD_ROOT_DIR))/$$$$file 
> $(1)/$$$$dir/ ; \
>       done ; \
> +     $(INSTALL_DIR) $(1)/lib
>       exit 0
>    endef
> 
> @@ -526,6 +529,7 @@
>               $(INSTALL_DIR) $(1)/$$$$dir ; \
>               $(CP) $(call qstrip,$(CONFIG_LIBRT_ROOT_DIR))/$$$$file 
> $(1)/$$$$dir/ ; \
>       done ; \
> +     $(INSTALL_DIR) $(1)/lib
>       exit 0
>    endef
> 
> Index: openwrt/rules.mk
> ===================================================================
> --- openwrt.orig/rules.mk     2012-09-28 20:22:39.000000000 -0400
> +++ openwrt/rules.mk  2012-10-10 20:56:25.376687693 -0400
> @@ -115,6 +115,9 @@
>  LIBGCC_S_PATH=$(realpath $(wildcard $(call 
> qstrip,$(CONFIG_LIBGCC_ROOT_DIR))/$(call qstrip,$(CONFIG_LIBGCC_FILE_SPEC))))
>  LIBGCC_S=$(if $(LIBGCC_S_PATH),-L$(dir $(LIBGCC_S_PATH)) -lgcc_s)
>  LIBGCC_A=$(realpath $(wildcard $(dir $(LIBGCC_S_PATH))/gcc/*/*/libgcc.a))
> +ifneq ($(CONFIG_EXTERNAL_UCLIBC),)
> +TARGET_LDFLAGS+= -ldl
> +endif
>  else
>  LIBGCC_A=$(wildcard $(TOOLCHAIN_DIR)/lib/gcc/*/*/libgcc.a)
>  LIBGCC_S=$(if $(wildcard 
> $(TOOLCHAIN_DIR)/lib/libgcc_s.so),-L$(TOOLCHAIN_DIR)/lib -lgcc_s,$(LIBGCC_A))
> Index: openwrt/toolchain/wrapper/Makefile
> ===================================================================
> --- openwrt.orig/toolchain/wrapper/Makefile   2012-09-28 20:22:41.000000000 
> -0400
> +++ openwrt/toolchain/wrapper/Makefile        2012-10-10 20:56:25.376687693 
> -0400
> @@ -53,6 +53,10 @@
> 
>  define Host/Install
>       $(call toolchain_util,--wrap "$(TOOLCHAIN_DIR)/bin")
> +     $(CP) $(CONFIG_TOOLCHAIN_ROOT)/lib/libpthread.so* $(TOOLCHAIN_DIR)/lib
> +     $(CP) $(CONFIG_TOOLCHAIN_ROOT)/lib/librt.so* $(TOOLCHAIN_DIR)/lib
> +     $(CP) $(CONFIG_TOOLCHAIN_ROOT)/lib/libpthread-*.so $(TOOLCHAIN_DIR)/lib
> +     $(CP) $(CONFIG_TOOLCHAIN_ROOT)/lib/librt-*.so $(TOOLCHAIN_DIR)/lib
>  endef
> 
>  define Host/Clean
> 
> 
> 
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> [email protected]
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> 


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to