This patch fixes the problem at https://dev.openwrt.org/ticket/3316
On arm platform compat-wireless can't be build complete. The problem was that kbuild had problems when cross compiling for arm platform. The problem is described here: http://lkml.org/lkml/2008/3/23/284 in kernel 2.6.25 the problem is fixed. I backported the fix to kernel 2.6.24 and 2.6.23 and attached the file. Signed-off-by: Hauke Mehrtens <[EMAIL PROTECTED]> -- Hauke Mehrtens
Index: target/linux/generic-2.6/patches-2.6.23/015-kbuild_cross_build_fix.patch
===================================================================
--- target/linux/generic-2.6/patches-2.6.23/015-kbuild_cross_build_fix.patch (Revision 0)
+++ target/linux/generic-2.6/patches-2.6.23/015-kbuild_cross_build_fix.patch (Revision 0)
@@ -0,0 +1,91 @@
+diff -Naur linux-2.6.23.14.new/Makefile linux-2.6.23.14/Makefile
+--- linux-2.6.23.14/Makefile 2008-04-20 21:27:09.000000000 +0200
++++ linux-2.6.23.14.new/Makefile 2008-04-20 21:41:35.000000000 +0200
+@@ -181,7 +181,7 @@
+ # Alternatively CROSS_COMPILE can be set in the environment.
+ # Default value for CROSS_COMPILE is not to prefix executables
+ # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
+-
++export KBUILD_BUILDHOST := $(SUBARCH)
+ ARCH ?= $(SUBARCH)
+ CROSS_COMPILE ?=
+
+diff -Naur linux-2.6.23.14.new/scripts/Makefile.modpost linux-2.6.23.14/scripts/Makefile.modpost
+--- linux-2.6.23.14/scripts/Makefile.modpost 2008-04-20 21:27:09.000000000 +0200
++++ linux-2.6.23.14.new/scripts/Makefile.modpost 2008-04-20 21:41:35.000000000 +0200
+@@ -53,6 +53,9 @@
+ # Stop after building .o files if NOFINAL is set. Makes compile tests quicker
+ _modpost: $(if $(KBUILD_MODPOST_NOFINAL), $(modules:.ko:.o),$(modules))
+
++ifneq ($(KBUILD_BUILDHOST),$(ARCH))
++ cross_build := 1
++endif
+
+ # Step 2), invoke modpost
+ # Includes step 3,4
+@@ -62,7 +65,8 @@
+ $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
+ $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
+ $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
+- $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
++ $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \
++ $(if $(cross_build),-c)
+
+ quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
+ cmd_modpost = $(modpost) -s
+diff -Naur linux-2.6.23.14.new/scripts/mod/file2alias.c linux-2.6.23.14/scripts/mod/file2alias.c
+--- linux-2.6.23.14/scripts/mod/file2alias.c 2008-04-20 21:27:09.000000000 +0200
++++ linux-2.6.23.14.new/scripts/mod/file2alias.c 2008-04-20 21:43:58.000000000 +0200
+@@ -51,15 +51,19 @@
+ sprintf(str + strlen(str), "*"); \
+ } while(0)
+
++unsigned int cross_build = 0;
+ /**
+ * Check that sizeof(device_id type) are consistent with size of section
+ * in .o file. If in-consistent then userspace and kernel does not agree
+ * on actual size which is a bug.
++ * Ignore both checks if build host differ from target host and size differs.
+ **/
+ static void device_id_size_check(const char *modname, const char *device_id,
+ unsigned long size, unsigned long id_size)
+ {
+ if (size % id_size || size < id_size) {
++ if (cross_build != 0)
++ return;
+ fatal("%s: sizeof(struct %s_device_id)=%lu is not a modulo "
+ "of the size of section __mod_%s_device_table=%lu.\n"
+ "Fix definition of struct %s_device_id "
+diff -Naur linux-2.6.23.14.new/scripts/mod/modpost.c linux-2.6.23.14/scripts/mod/modpost.c
+--- linux-2.6.23.14/scripts/mod/modpost.c 2008-04-20 21:27:09.000000000 +0200
++++ linux-2.6.23.14.new/scripts/mod/modpost.c 2008-04-20 21:41:35.000000000 +0200
+@@ -1649,7 +1649,7 @@
+ int opt;
+ int err;
+
+- while ((opt = getopt(argc, argv, "i:I:mso:aw")) != -1) {
++ while ((opt = getopt(argc, argv, "i:I:cmso:aw")) != -1) {
+ switch(opt) {
+ case 'i':
+ kernel_read = optarg;
+@@ -1658,6 +1658,9 @@
+ module_read = optarg;
+ external_module = 1;
+ break;
++ case 'c':
++ cross_build = 1;
++ break;
+ case 'm':
+ modversions = 1;
+ break;
+diff -Naur linux-2.6.23.14.new/scripts/mod/modpost.h linux-2.6.23.14/scripts/mod/modpost.h
+--- linux-2.6.23.14/scripts/mod/modpost.h 2008-04-20 21:27:09.000000000 +0200
++++ linux-2.6.23.14.new/scripts/mod/modpost.h 2008-04-20 21:41:35.000000000 +0200
+@@ -130,6 +130,7 @@
+ };
+
+ /* file2alias.c */
++extern unsigned int cross_build;
+ void handle_moddevtable(struct module *mod, struct elf_info *info,
+ Elf_Sym *sym, const char *symname);
+ void add_moddevtable(struct buffer *buf, struct module *mod);
Index: target/linux/generic-2.6/patches-2.6.24/015-kbuild_cross_build_fix.patch
===================================================================
--- target/linux/generic-2.6/patches-2.6.24/015-kbuild_cross_build_fix.patch (Revision 0)
+++ target/linux/generic-2.6/patches-2.6.24/015-kbuild_cross_build_fix.patch (Revision 0)
@@ -0,0 +1,97 @@
+# This patch is based on http://lkml.org/lkml/diff/2008/3/23/284/1
+# more informatik can be found at http://lkml.org/lkml/2008/3/23/284
+
+diff -Naur linux-2.6.24.2/Makefile linux-2.6.24.2.new/Makefile
+--- linux-2.6.24.2/Makefile 2008-02-11 06:51:11.000000000 +0100
++++ linux-2.6.24.2.new/Makefile 2008-04-20 21:31:13.000000000 +0200
+@@ -189,7 +189,7 @@
+ # Alternatively CROSS_COMPILE can be set in the environment.
+ # Default value for CROSS_COMPILE is not to prefix executables
+ # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
+-
++export KBUILD_BUILDHOST := $(SUBARCH)
+ ARCH ?= $(SUBARCH)
+ CROSS_COMPILE ?=
+
+diff -Naur linux-2.6.24.2/scripts/Makefile.modpost linux-2.6.24.2.new/scripts/Makefile.modpost
+--- linux-2.6.24.2/scripts/Makefile.modpost 2008-02-11 06:51:11.000000000 +0100
++++ linux-2.6.24.2.new/scripts/Makefile.modpost 2008-04-20 21:33:25.000000000 +0200
+@@ -53,6 +53,9 @@
+ # Stop after building .o files if NOFINAL is set. Makes compile tests quicker
+ _modpost: $(if $(KBUILD_MODPOST_NOFINAL), $(modules:.ko:.o),$(modules))
+
++ifneq ($(KBUILD_BUILDHOST),$(ARCH))
++ cross_build := 1
++endif
+
+ # Step 2), invoke modpost
+ # Includes step 3,4
+@@ -62,7 +65,8 @@
+ $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
+ $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
+ $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
+- $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
++ $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \
++ $(if $(cross_build),-c)
+
+ quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
+ cmd_modpost = $(modpost) -s
+diff -Naur linux-2.6.24.2/scripts/mod/file2alias.c linux-2.6.24.2.new/scripts/mod/file2alias.c
+--- linux-2.6.24.2/scripts/mod/file2alias.c 2008-02-11 06:51:11.000000000 +0100
++++ linux-2.6.24.2.new/scripts/mod/file2alias.c 2008-04-20 21:31:13.000000000 +0200
+@@ -51,11 +51,13 @@
+ sprintf(str + strlen(str), "*"); \
+ } while(0)
+
++unsigned int cross_build = 0;
+ /**
+ * Check that sizeof(device_id type) are consistent with size of section
+ * in .o file. If in-consistent then userspace and kernel does not agree
+ * on actual size which is a bug.
+ * Also verify that the final entry in the table is all zeros.
++ * Ignore both checks if build host differ from target host and size differs.
+ **/
+ static void device_id_check(const char *modname, const char *device_id,
+ unsigned long size, unsigned long id_size,
+@@ -64,6 +66,8 @@
+ int i;
+
+ if (size % id_size || size < id_size) {
++ if (cross_build != 0)
++ return;
+ fatal("%s: sizeof(struct %s_device_id)=%lu is not a modulo "
+ "of the size of section __mod_%s_device_table=%lu.\n"
+ "Fix definition of struct %s_device_id "
+diff -Naur linux-2.6.24.2/scripts/mod/modpost.c linux-2.6.24.2.new/scripts/mod/modpost.c
+--- linux-2.6.24.2/scripts/mod/modpost.c 2008-02-11 06:51:11.000000000 +0100
++++ linux-2.6.24.2.new/scripts/mod/modpost.c 2008-04-20 21:35:21.000000000 +0200
+@@ -1659,7 +1659,7 @@
+ int opt;
+ int err;
+
+- while ((opt = getopt(argc, argv, "i:I:mso:aw")) != -1) {
++ while ((opt = getopt(argc, argv, "i:I:cmso:aw")) != -1) {
+ switch(opt) {
+ case 'i':
+ kernel_read = optarg;
+@@ -1668,6 +1668,9 @@
+ module_read = optarg;
+ external_module = 1;
+ break;
++ case 'c':
++ cross_build = 1;
++ break;
+ case 'm':
+ modversions = 1;
+ break;
+diff -Naur linux-2.6.24.2/scripts/mod/modpost.h linux-2.6.24.2.new/scripts/mod/modpost.h
+--- linux-2.6.24.2/scripts/mod/modpost.h 2008-02-11 06:51:11.000000000 +0100
++++ linux-2.6.24.2.new/scripts/mod/modpost.h 2008-04-20 21:31:13.000000000 +0200
+@@ -130,6 +130,7 @@
+ };
+
+ /* file2alias.c */
++extern unsigned int cross_build;
+ void handle_moddevtable(struct module *mod, struct elf_info *info,
+ Elf_Sym *sym, const char *symname);
+ void add_moddevtable(struct buffer *buf, struct module *mod);
signature.asc
Description: OpenPGP digital signature
_______________________________________________ openwrt-devel mailing list [email protected] http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
