[OpenWrt-Devel] [PATCH] Fix/Enable OpenWrt External Toolchain Building ImageBuilder and SDK (and have them work)

2012-10-31 Thread Daniel Dickinson
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 csh...@openwrt.org

Patch follows:

Index: openwrt/target/imagebuilder/Config.in
===
--- openwrt.orig/target/imagebuilder/Config.in  2012-09-28 20:22:39.0 
-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.0 -0400
+++ openwrt/target/sdk/Config.in2012-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.in2012-09-28 20:22:41.0 -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.0 -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
 

Re: [OpenWrt-Devel] [PATCH] Fix/Enable OpenWrt External Toolchain Building ImageBuilder and SDK (and have them work)

2012-10-31 Thread Daniel Dickinson
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 csh...@openwrt.org
 
 Patch follows:
 
 Index: openwrt/target/imagebuilder/Config.in
 ===
 --- openwrt.orig/target/imagebuilder/Config.in2012-09-28 
 20:22:39.0 -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.0 -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.0 -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.0 -0400
 +++ openwrt/toolchain/Makefile2012-10-10 20:56:25.376687693 -0400
 @@ -29,9 +29,11 @@
 
  # subdirectories to descend into
  $(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if 
 

Re: [OpenWrt-Devel] [PATCH] Fix/Enable OpenWrt External Toolchain Building ImageBuilder and SDK (and have them work)

2012-10-31 Thread Daniel Dickinson
This version is based against trunk as of now and fixes the SDK tarball name.

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: DanielDickinson dan...@powercloudsystems.com
---
 package/toolchain/Makefile |   10 +++---
 rules.mk   |3 +++
 target/imagebuilder/Config.in  |2 +-
 target/imagebuilder/files/Makefile |7 ++-
 target/sdk/Config.in   |2 +-
 target/sdk/Makefile|8 +++-
 toolchain/Config.in|9 -
 toolchain/Makefile |2 ++
 toolchain/wrapper/Makefile |4 
 9 files changed, 39 insertions(+), 8 deletions(-)


diff --git a/package/toolchain/Makefile b/package/toolchain/Makefile
index c194a34..00923f9 100644
--- a/package/toolchain/Makefile
+++ b/package/toolchain/Makefile
@@ -138,7 +138,8 @@ define Package/libc/config
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
@@ -164,7 +165,7 @@ define Package/libpthread/config
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
@@ -196,7 +197,7 @@ define Package/librt/config
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
@@ -468,6 +469,7 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
$(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
@@ -532,6 +534,7 @@ else
$(INSTALL_DIR) $(1)/dir ; \
$(CP) $(call qstrip,$(CONFIG_LIBPTHREAD_ROOT_DIR))/file 
$(1)/dir/ ; \
done ; \
+   $(INSTALL_DIR) $(1)/lib
exit 0
   endef

@@ -541,6 +544,7 @@ else
$(INSTALL_DIR) $(1)/dir ; \
$(CP) $(call qstrip,$(CONFIG_LIBRT_ROOT_DIR))/file 
$(1)/dir/ ; \
done ; \
+   $(INSTALL_DIR) $(1)/lib
exit 0
   endef


Re: [OpenWrt-Devel] [PATCH] Fix/Enable OpenWrt External Toolchain Building ImageBuilder and SDK (and have them work)

2012-10-31 Thread Daniel Dickinson
This version is based against trunk as of now and fixes the SDK tarball name.

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: DanielDickinson dan...@powercloudsystems.com
---
 package/toolchain/Makefile |   10 +++---
 rules.mk   |3 +++
 target/imagebuilder/Config.in  |2 +-
 target/imagebuilder/files/Makefile |7 ++-
 target/sdk/Config.in   |2 +-
 target/sdk/Makefile|8 +++-
 toolchain/Config.in|9 -
 toolchain/Makefile |2 ++
 toolchain/wrapper/Makefile |4 
 9 files changed, 39 insertions(+), 8 deletions(-)


diff --git a/package/toolchain/Makefile b/package/toolchain/Makefile
index c194a34..00923f9 100644
--- a/package/toolchain/Makefile
+++ b/package/toolchain/Makefile
@@ -138,7 +138,8 @@ define Package/libc/config
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
@@ -164,7 +165,7 @@ define Package/libpthread/config
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
@@ -196,7 +197,7 @@ define Package/librt/config
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
@@ -468,6 +469,7 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
$(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
@@ -532,6 +534,7 @@ else
$(INSTALL_DIR) $(1)/dir ; \
$(CP) $(call qstrip,$(CONFIG_LIBPTHREAD_ROOT_DIR))/file 
$(1)/dir/ ; \
done ; \
+   $(INSTALL_DIR) $(1)/lib
exit 0
   endef

@@ -541,6 +544,7 @@ else
$(INSTALL_DIR) $(1)/dir ; \
$(CP) $(call qstrip,$(CONFIG_LIBRT_ROOT_DIR))/file 
$(1)/dir/ ; \
done ; \
+   $(INSTALL_DIR) $(1)/lib
exit 0
   endef