aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--scripts/Makefile.modpost6
-rw-r--r--scripts/mod/file2alias.c4
-rw-r--r--scripts/mod/modpost.c5
-rw-r--r--scripts/mod/modpost.h1
5 files changed, 15 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 7a4d34b91e03..1c4c8f87f6c5 100644
--- a/Makefile
+++ b/Makefile
@@ -189,7 +189,7 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
189# Alternatively CROSS_COMPILE can be set in the environment. 189# Alternatively CROSS_COMPILE can be set in the environment.
190# Default value for CROSS_COMPILE is not to prefix executables 190# Default value for CROSS_COMPILE is not to prefix executables
191# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile 191# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
192 192export KBUILD_BUILDHOST := $(SUBARCH)
193ARCH ?= $(SUBARCH) 193ARCH ?= $(SUBARCH)
194CROSS_COMPILE ?= 194CROSS_COMPILE ?=
195 195
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index cfc004e04417..2d20640854b7 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -58,6 +58,9 @@ modules := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o)))
58# Stop after building .o files if NOFINAL is set. Makes compile tests quicker 58# Stop after building .o files if NOFINAL is set. Makes compile tests quicker
59_modpost: $(if $(KBUILD_MODPOST_NOFINAL), $(modules:.ko:.o),$(modules)) 59_modpost: $(if $(KBUILD_MODPOST_NOFINAL), $(modules:.ko:.o),$(modules))
60 60
61ifneq ($(KBUILD_BUILDHOST),$(ARCH))
62 cross_build := 1
63endif
61 64
62# Step 2), invoke modpost 65# Step 2), invoke modpost
63# Includes step 3,4 66# Includes step 3,4
@@ -70,7 +73,8 @@ modpost = scripts/mod/modpost \
70 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ 73 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
71 $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \ 74 $(if $(CONFIG_MARKERS),-K $(kernelmarkersfile)) \
72 $(if $(CONFIG_MARKERS),-M $(markersfile)) \ 75 $(if $(CONFIG_MARKERS),-M $(markersfile)) \
73 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) 76 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \
77 $(if $(cross_build),-c)
74 78
75quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules 79quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
76 cmd_modpost = $(modpost) -s 80 cmd_modpost = $(modpost) -s
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 9ddf944cce29..348d8687b7c9 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -51,11 +51,13 @@ do { \
51 sprintf(str + strlen(str), "*"); \ 51 sprintf(str + strlen(str), "*"); \
52} while(0) 52} while(0)
53 53
54unsigned int cross_build = 0;
54/** 55/**
55 * Check that sizeof(device_id type) are consistent with size of section 56 * Check that sizeof(device_id type) are consistent with size of section
56 * in .o file. If in-consistent then userspace and kernel does not agree 57 * in .o file. If in-consistent then userspace and kernel does not agree
57 * on actual size which is a bug. 58 * on actual size which is a bug.
58 * Also verify that the final entry in the table is all zeros. 59 * Also verify that the final entry in the table is all zeros.
60 * Ignore both checks if build host differ from target host and size differs.
59 **/ 61 **/
60static void device_id_check(const char *modname, const char *device_id, 62static void device_id_check(const char *modname, const char *device_id,
61 unsigned long size, unsigned long id_size, 63 unsigned long size, unsigned long id_size,
@@ -64,6 +66,8 @@ static void device_id_check(const char *modname, const char *device_id,
64 int i; 66 int i;
65 67
66 if (size % id_size || size < id_size) { 68 if (size % id_size || size < id_size) {
69 if (cross_build != 0)
70 return;
67 fatal("%s: sizeof(struct %s_device_id)=%lu is not a modulo " 71 fatal("%s: sizeof(struct %s_device_id)=%lu is not a modulo "
68 "of the size of section __mod_%s_device_table=%lu.\n" 72 "of the size of section __mod_%s_device_table=%lu.\n"
69 "Fix definition of struct %s_device_id " 73 "Fix definition of struct %s_device_id "
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 695b5d657cf5..110cf243fa4e 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -2026,7 +2026,7 @@ int main(int argc, char **argv)
2026 int opt; 2026 int opt;
2027 int err; 2027 int err;
2028 2028
2029 while ((opt = getopt(argc, argv, "i:I:msSo:awM:K:")) != -1) { 2029 while ((opt = getopt(argc, argv, "i:I:cmsSo:awM:K:")) != -1) {
2030 switch (opt) { 2030 switch (opt) {
2031 case 'i': 2031 case 'i':
2032 kernel_read = optarg; 2032 kernel_read = optarg;
@@ -2035,6 +2035,9 @@ int main(int argc, char **argv)
2035 module_read = optarg; 2035 module_read = optarg;
2036 external_module = 1; 2036 external_module = 1;
2037 break; 2037 break;
2038 case 'c':
2039 cross_build = 1;
2040 break;
2038 case 'm': 2041 case 'm':
2039 modversions = 1; 2042 modversions = 1;
2040 break; 2043 break;
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
index 565c5872407e..09f58e33d227 100644
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -135,6 +135,7 @@ struct elf_info {
135}; 135};
136 136
137/* file2alias.c */ 137/* file2alias.c */
138extern unsigned int cross_build;
138void handle_moddevtable(struct module *mod, struct elf_info *info, 139void handle_moddevtable(struct module *mod, struct elf_info *info,
139 Elf_Sym *sym, const char *symname); 140 Elf_Sym *sym, const char *symname);
140void add_moddevtable(struct buffer *buf, struct module *mod); 141void add_moddevtable(struct buffer *buf, struct module *mod);