diff options
author | Sam Ravnborg <sam@uranus.ravnborg.org> | 2008-03-23 16:38:54 -0400 |
---|---|---|
committer | Sam Ravnborg <sam@uranus.ravnborg.org> | 2008-03-23 16:38:54 -0400 |
commit | 4ce6efed48d736e3384c39ff87bda723e1f8e041 (patch) | |
tree | 961601d69caf571c5d3350d8d9f9075b844486b6 /scripts/mod | |
parent | d2532dd20a126020de407c1c2476a75b53fce7ac (diff) |
kbuild: soften modpost checks when doing cross builds
The module alias support in the kernel have a consistency
check where it is checked that the size of a structure
in the kernel and on the build host are the same.
For cross builds this check does not make sense so detect
when we do cross builds and silently skip the check in these
situations.
This fixes a build bug for a wireless driver when cross building
for arm.
Acked-by: Michael Buesch <mb@bu3sch.de>
Tested-by: Gordon Farquharson <gordonfarquharson@gmail.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: stable@kernel.org
Diffstat (limited to 'scripts/mod')
-rw-r--r-- | scripts/mod/file2alias.c | 4 | ||||
-rw-r--r-- | scripts/mod/modpost.c | 5 | ||||
-rw-r--r-- | scripts/mod/modpost.h | 1 |
3 files changed, 9 insertions, 1 deletions
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 | ||
54 | unsigned 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 | **/ |
60 | static void device_id_check(const char *modname, const char *device_id, | 62 | static 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 */ |
138 | extern unsigned int cross_build; | ||
138 | void handle_moddevtable(struct module *mod, struct elf_info *info, | 139 | void handle_moddevtable(struct module *mod, struct elf_info *info, |
139 | Elf_Sym *sym, const char *symname); | 140 | Elf_Sym *sym, const char *symname); |
140 | void add_moddevtable(struct buffer *buf, struct module *mod); | 141 | void add_moddevtable(struct buffer *buf, struct module *mod); |