aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/gen_initramfs_list.sh6
-rw-r--r--scripts/kconfig/conf.c3
-rw-r--r--scripts/kconfig/lxdialog/checklist.c19
-rw-r--r--scripts/mkmakefile5
-rw-r--r--scripts/mod/file2alias.c36
-rw-r--r--scripts/mod/modpost.c105
-rw-r--r--scripts/mod/modpost.h23
7 files changed, 138 insertions, 59 deletions
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
index 56b3bed1108f..331c079f029b 100644
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -200,7 +200,11 @@ input_file() {
200 print_mtime "$1" >> ${output} 200 print_mtime "$1" >> ${output}
201 cat "$1" >> ${output} 201 cat "$1" >> ${output}
202 else 202 else
203 grep ^file "$1" | cut -d ' ' -f 3 203 cat "$1" | while read type dir file perm ; do
204 if [ "$type" == "file" ]; then
205 echo "$file \\";
206 fi
207 done
204 fi 208 fi
205 elif [ -d "$1" ]; then 209 elif [ -d "$1" ]; then
206 dir_filelist "$1" 210 dir_filelist "$1"
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index ae5ab981bb1d..8012d1076876 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -5,6 +5,7 @@
5 5
6#include <ctype.h> 6#include <ctype.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#include <stdio.h>
8#include <string.h> 9#include <string.h>
9#include <unistd.h> 10#include <unistd.h>
10#include <time.h> 11#include <time.h>
@@ -531,7 +532,7 @@ int main(int ac, char **av)
531 break; 532 break;
532 case 'h': 533 case 'h':
533 case '?': 534 case '?':
534 printf("%s [-o|-s] config\n", av[0]); 535 fprintf(stderr, "See README for usage info\n");
535 exit(0); 536 exit(0);
536 } 537 }
537 } 538 }
diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c
index db07ae73e051..be0200e9cdaf 100644
--- a/scripts/kconfig/lxdialog/checklist.c
+++ b/scripts/kconfig/lxdialog/checklist.c
@@ -196,8 +196,8 @@ int dialog_checklist(const char *title, const char *prompt, int height,
196 196
197 print_buttons(dialog, height, width, 0); 197 print_buttons(dialog, height, width, 0);
198 198
199 wnoutrefresh(list);
200 wnoutrefresh(dialog); 199 wnoutrefresh(dialog);
200 wnoutrefresh(list);
201 doupdate(); 201 doupdate();
202 202
203 while (key != ESC) { 203 while (key != ESC) {
@@ -225,12 +225,11 @@ int dialog_checklist(const char *title, const char *prompt, int height,
225 } 225 }
226 scroll--; 226 scroll--;
227 print_item(list, items[scroll * 3 + 1], status[scroll], 0, TRUE); 227 print_item(list, items[scroll * 3 + 1], status[scroll], 0, TRUE);
228 wnoutrefresh(list);
229
230 print_arrows(dialog, choice, item_no, 228 print_arrows(dialog, choice, item_no,
231 scroll, box_y, box_x + check_x + 5, list_height); 229 scroll, box_y, box_x + check_x + 5, list_height);
232 230
233 wrefresh(dialog); 231 wnoutrefresh(dialog);
232 wrefresh(list);
234 233
235 continue; /* wait for another key press */ 234 continue; /* wait for another key press */
236 } else 235 } else
@@ -252,12 +251,12 @@ int dialog_checklist(const char *title, const char *prompt, int height,
252 scroll++; 251 scroll++;
253 print_item(list, items[(scroll + max_choice - 1) * 3 + 1], 252 print_item(list, items[(scroll + max_choice - 1) * 3 + 1],
254 status[scroll + max_choice - 1], max_choice - 1, TRUE); 253 status[scroll + max_choice - 1], max_choice - 1, TRUE);
255 wnoutrefresh(list);
256 254
257 print_arrows(dialog, choice, item_no, 255 print_arrows(dialog, choice, item_no,
258 scroll, box_y, box_x + check_x + 5, list_height); 256 scroll, box_y, box_x + check_x + 5, list_height);
259 257
260 wrefresh(dialog); 258 wnoutrefresh(dialog);
259 wrefresh(list);
261 260
262 continue; /* wait for another key press */ 261 continue; /* wait for another key press */
263 } else 262 } else
@@ -271,8 +270,8 @@ int dialog_checklist(const char *title, const char *prompt, int height,
271 choice = i; 270 choice = i;
272 print_item(list, items[(scroll + choice) * 3 + 1], 271 print_item(list, items[(scroll + choice) * 3 + 1],
273 status[scroll + choice], choice, TRUE); 272 status[scroll + choice], choice, TRUE);
274 wnoutrefresh(list); 273 wnoutrefresh(dialog);
275 wrefresh(dialog); 274 wrefresh(list);
276 } 275 }
277 continue; /* wait for another key press */ 276 continue; /* wait for another key press */
278 } 277 }
@@ -306,8 +305,8 @@ int dialog_checklist(const char *title, const char *prompt, int height,
306 print_item(list, items[(scroll + i) * 3 + 1], 305 print_item(list, items[(scroll + i) * 3 + 1],
307 status[scroll + i], i, i == choice); 306 status[scroll + i], i, i == choice);
308 } 307 }
309 wnoutrefresh(list); 308 wnoutrefresh(dialog);
310 wrefresh(dialog); 309 wrefresh(list);
311 310
312 for (i = 0; i < item_no; i++) 311 for (i = 0; i < item_no; i++)
313 if (status[i]) 312 if (status[i])
diff --git a/scripts/mkmakefile b/scripts/mkmakefile
index a22cbedd3b3e..7f9d544f9b6c 100644
--- a/scripts/mkmakefile
+++ b/scripts/mkmakefile
@@ -10,7 +10,10 @@
10# $4 - patchlevel 10# $4 - patchlevel
11 11
12 12
13cat << EOF 13test ! -r $2/Makefile -o -O $2/Makefile || exit 0
14echo " GEN $2/Makefile"
15
16cat << EOF > $2/Makefile
14# Automatically generated by $0: don't edit 17# Automatically generated by $0: don't edit
15 18
16VERSION = $3 19VERSION = $3
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 84e21201f3c0..37f67c23e11b 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -374,10 +374,10 @@ static void do_input(char *alias,
374 kernel_ulong_t *arr, unsigned int min, unsigned int max) 374 kernel_ulong_t *arr, unsigned int min, unsigned int max)
375{ 375{
376 unsigned int i; 376 unsigned int i;
377 for (i = min; i < max; i++) { 377
378 if (arr[i/BITS_PER_LONG] & (1 << (i%BITS_PER_LONG))) 378 for (i = min; i < max; i++)
379 sprintf(alias+strlen(alias), "%X,*", i); 379 if (arr[i / BITS_PER_LONG] & (1 << (i%BITS_PER_LONG)))
380 } 380 sprintf(alias + strlen(alias), "%X,*", i);
381} 381}
382 382
383/* input:b0v0p0e0-eXkXrXaXmXlXsXfXwX where X is comma-separated %02X. */ 383/* input:b0v0p0e0-eXkXrXaXmXlXsXfXwX where X is comma-separated %02X. */
@@ -386,39 +386,37 @@ static int do_input_entry(const char *filename, struct input_device_id *id,
386{ 386{
387 sprintf(alias, "input:"); 387 sprintf(alias, "input:");
388 388
389 ADD(alias, "b", id->flags&INPUT_DEVICE_ID_MATCH_BUS, id->id.bustype); 389 ADD(alias, "b", id->flags & INPUT_DEVICE_ID_MATCH_BUS, id->bustype);
390 ADD(alias, "v", id->flags&INPUT_DEVICE_ID_MATCH_VENDOR, id->id.vendor); 390 ADD(alias, "v", id->flags & INPUT_DEVICE_ID_MATCH_VENDOR, id->vendor);
391 ADD(alias, "p", id->flags&INPUT_DEVICE_ID_MATCH_PRODUCT, 391 ADD(alias, "p", id->flags & INPUT_DEVICE_ID_MATCH_PRODUCT, id->product);
392 id->id.product); 392 ADD(alias, "e", id->flags & INPUT_DEVICE_ID_MATCH_VERSION, id->version);
393 ADD(alias, "e", id->flags&INPUT_DEVICE_ID_MATCH_VERSION,
394 id->id.version);
395 393
396 sprintf(alias + strlen(alias), "-e*"); 394 sprintf(alias + strlen(alias), "-e*");
397 if (id->flags&INPUT_DEVICE_ID_MATCH_EVBIT) 395 if (id->flags & INPUT_DEVICE_ID_MATCH_EVBIT)
398 do_input(alias, id->evbit, 0, EV_MAX); 396 do_input(alias, id->evbit, 0, EV_MAX);
399 sprintf(alias + strlen(alias), "k*"); 397 sprintf(alias + strlen(alias), "k*");
400 if (id->flags&INPUT_DEVICE_ID_MATCH_KEYBIT) 398 if (id->flags & INPUT_DEVICE_ID_MATCH_KEYBIT)
401 do_input(alias, id->keybit, KEY_MIN_INTERESTING, KEY_MAX); 399 do_input(alias, id->keybit, KEY_MIN_INTERESTING, KEY_MAX);
402 sprintf(alias + strlen(alias), "r*"); 400 sprintf(alias + strlen(alias), "r*");
403 if (id->flags&INPUT_DEVICE_ID_MATCH_RELBIT) 401 if (id->flags & INPUT_DEVICE_ID_MATCH_RELBIT)
404 do_input(alias, id->relbit, 0, REL_MAX); 402 do_input(alias, id->relbit, 0, REL_MAX);
405 sprintf(alias + strlen(alias), "a*"); 403 sprintf(alias + strlen(alias), "a*");
406 if (id->flags&INPUT_DEVICE_ID_MATCH_ABSBIT) 404 if (id->flags & INPUT_DEVICE_ID_MATCH_ABSBIT)
407 do_input(alias, id->absbit, 0, ABS_MAX); 405 do_input(alias, id->absbit, 0, ABS_MAX);
408 sprintf(alias + strlen(alias), "m*"); 406 sprintf(alias + strlen(alias), "m*");
409 if (id->flags&INPUT_DEVICE_ID_MATCH_MSCIT) 407 if (id->flags & INPUT_DEVICE_ID_MATCH_MSCIT)
410 do_input(alias, id->mscbit, 0, MSC_MAX); 408 do_input(alias, id->mscbit, 0, MSC_MAX);
411 sprintf(alias + strlen(alias), "l*"); 409 sprintf(alias + strlen(alias), "l*");
412 if (id->flags&INPUT_DEVICE_ID_MATCH_LEDBIT) 410 if (id->flags & INPUT_DEVICE_ID_MATCH_LEDBIT)
413 do_input(alias, id->ledbit, 0, LED_MAX); 411 do_input(alias, id->ledbit, 0, LED_MAX);
414 sprintf(alias + strlen(alias), "s*"); 412 sprintf(alias + strlen(alias), "s*");
415 if (id->flags&INPUT_DEVICE_ID_MATCH_SNDBIT) 413 if (id->flags & INPUT_DEVICE_ID_MATCH_SNDBIT)
416 do_input(alias, id->sndbit, 0, SND_MAX); 414 do_input(alias, id->sndbit, 0, SND_MAX);
417 sprintf(alias + strlen(alias), "f*"); 415 sprintf(alias + strlen(alias), "f*");
418 if (id->flags&INPUT_DEVICE_ID_MATCH_FFBIT) 416 if (id->flags & INPUT_DEVICE_ID_MATCH_FFBIT)
419 do_input(alias, id->ffbit, 0, FF_MAX); 417 do_input(alias, id->ffbit, 0, FF_MAX);
420 sprintf(alias + strlen(alias), "w*"); 418 sprintf(alias + strlen(alias), "w*");
421 if (id->flags&INPUT_DEVICE_ID_MATCH_SWBIT) 419 if (id->flags & INPUT_DEVICE_ID_MATCH_SWBIT)
422 do_input(alias, id->swbit, 0, SW_MAX); 420 do_input(alias, id->swbit, 0, SW_MAX);
423 return 1; 421 return 1;
424} 422}
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 7e8079a34adf..d0f86ed43f7a 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -487,22 +487,24 @@ static int strrcmp(const char *s, const char *sub)
487 * atsym =__param* 487 * atsym =__param*
488 * 488 *
489 * Pattern 2: 489 * Pattern 2:
490 * Many drivers utilise a *_driver container with references to 490 * Many drivers utilise a *driver container with references to
491 * add, remove, probe functions etc. 491 * add, remove, probe functions etc.
492 * These functions may often be marked __init and we do not want to 492 * These functions may often be marked __init and we do not want to
493 * warn here. 493 * warn here.
494 * the pattern is identified by: 494 * the pattern is identified by:
495 * tosec = .init.text | .exit.text 495 * tosec = .init.text | .exit.text | .init.data
496 * fromsec = .data 496 * fromsec = .data
497 * atsym = *_driver, *_ops, *_probe, *probe_one 497 * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one
498 **/ 498 **/
499static int secref_whitelist(const char *tosec, const char *fromsec, 499static int secref_whitelist(const char *tosec, const char *fromsec,
500 const char *atsym) 500 const char *atsym)
501{ 501{
502 int f1 = 1, f2 = 1; 502 int f1 = 1, f2 = 1;
503 const char **s; 503 const char **s;
504 const char *pat2sym[] = { 504 const char *pat2sym[] = {
505 "_driver", 505 "driver",
506 "_template", /* scsi uses *_template a lot */
507 "_sht", /* scsi also used *_sht to some extent */
506 "_ops", 508 "_ops",
507 "_probe", 509 "_probe",
508 "_probe_one", 510 "_probe_one",
@@ -522,7 +524,8 @@ static int secref_whitelist(const char *tosec, const char *fromsec,
522 524
523 /* Check for pattern 2 */ 525 /* Check for pattern 2 */
524 if ((strcmp(tosec, ".init.text") != 0) && 526 if ((strcmp(tosec, ".init.text") != 0) &&
525 (strcmp(tosec, ".exit.text") != 0)) 527 (strcmp(tosec, ".exit.text") != 0) &&
528 (strcmp(tosec, ".init.data") != 0))
526 f2 = 0; 529 f2 = 0;
527 if (strcmp(fromsec, ".data") != 0) 530 if (strcmp(fromsec, ".data") != 0)
528 f2 = 0; 531 f2 = 0;
@@ -694,29 +697,79 @@ static void check_sec_ref(struct module *mod, const char *modname,
694 697
695 /* Walk through all sections */ 698 /* Walk through all sections */
696 for (i = 0; i < hdr->e_shnum; i++) { 699 for (i = 0; i < hdr->e_shnum; i++) {
697 Elf_Rela *rela; 700 const char *name = secstrings + sechdrs[i].sh_name;
698 Elf_Rela *start = (void *)hdr + sechdrs[i].sh_offset; 701 const char *secname;
699 Elf_Rela *stop = (void*)start + sechdrs[i].sh_size; 702 Elf_Rela r;
700 const char *name = secstrings + sechdrs[i].sh_name + 703 unsigned int r_sym;
701 strlen(".rela");
702 /* We want to process only relocation sections and not .init */ 704 /* We want to process only relocation sections and not .init */
703 if (section_ref_ok(name) || (sechdrs[i].sh_type != SHT_RELA)) 705 if (sechdrs[i].sh_type == SHT_RELA) {
704 continue; 706 Elf_Rela *rela;
707 Elf_Rela *start = (void *)hdr + sechdrs[i].sh_offset;
708 Elf_Rela *stop = (void*)start + sechdrs[i].sh_size;
709 name += strlen(".rela");
710 if (section_ref_ok(name))
711 continue;
705 712
706 for (rela = start; rela < stop; rela++) { 713 for (rela = start; rela < stop; rela++) {
707 Elf_Rela r; 714 r.r_offset = TO_NATIVE(rela->r_offset);
708 const char *secname; 715#if KERNEL_ELFCLASS == ELFCLASS64
709 r.r_offset = TO_NATIVE(rela->r_offset); 716 if (hdr->e_machine == EM_MIPS) {
710 r.r_info = TO_NATIVE(rela->r_info); 717 r_sym = ELF64_MIPS_R_SYM(rela->r_info);
711 r.r_addend = TO_NATIVE(rela->r_addend); 718 r_sym = TO_NATIVE(r_sym);
712 sym = elf->symtab_start + ELF_R_SYM(r.r_info); 719 } else {
713 /* Skip special sections */ 720 r.r_info = TO_NATIVE(rela->r_info);
714 if (sym->st_shndx >= SHN_LORESERVE) 721 r_sym = ELF_R_SYM(r.r_info);
722 }
723#else
724 r.r_info = TO_NATIVE(rela->r_info);
725 r_sym = ELF_R_SYM(r.r_info);
726#endif
727 r.r_addend = TO_NATIVE(rela->r_addend);
728 sym = elf->symtab_start + r_sym;
729 /* Skip special sections */
730 if (sym->st_shndx >= SHN_LORESERVE)
731 continue;
732
733 secname = secstrings +
734 sechdrs[sym->st_shndx].sh_name;
735 if (section(secname))
736 warn_sec_mismatch(modname, name,
737 elf, sym, r);
738 }
739 } else if (sechdrs[i].sh_type == SHT_REL) {
740 Elf_Rel *rel;
741 Elf_Rel *start = (void *)hdr + sechdrs[i].sh_offset;
742 Elf_Rel *stop = (void*)start + sechdrs[i].sh_size;
743 name += strlen(".rel");
744 if (section_ref_ok(name))
715 continue; 745 continue;
716 746
717 secname = secstrings + sechdrs[sym->st_shndx].sh_name; 747 for (rel = start; rel < stop; rel++) {
718 if (section(secname)) 748 r.r_offset = TO_NATIVE(rel->r_offset);
719 warn_sec_mismatch(modname, name, elf, sym, r); 749#if KERNEL_ELFCLASS == ELFCLASS64
750 if (hdr->e_machine == EM_MIPS) {
751 r_sym = ELF64_MIPS_R_SYM(rel->r_info);
752 r_sym = TO_NATIVE(r_sym);
753 } else {
754 r.r_info = TO_NATIVE(rel->r_info);
755 r_sym = ELF_R_SYM(r.r_info);
756 }
757#else
758 r.r_info = TO_NATIVE(rel->r_info);
759 r_sym = ELF_R_SYM(r.r_info);
760#endif
761 r.r_addend = 0;
762 sym = elf->symtab_start + r_sym;
763 /* Skip special sections */
764 if (sym->st_shndx >= SHN_LORESERVE)
765 continue;
766
767 secname = secstrings +
768 sechdrs[sym->st_shndx].sh_name;
769 if (section(secname))
770 warn_sec_mismatch(modname, name,
771 elf, sym, r);
772 }
720 } 773 }
721 } 774 }
722} 775}
@@ -820,6 +873,7 @@ static int exit_section(const char *name)
820 * For our future {in}sanity, add a comment that this is the ppc .opd 873 * For our future {in}sanity, add a comment that this is the ppc .opd
821 * section, not the ia64 .opd section. 874 * section, not the ia64 .opd section.
822 * ia64 .opd should not point to discarded sections. 875 * ia64 .opd should not point to discarded sections.
876 * [.rodata] like for .init.text we ignore .rodata references -same reason
823 **/ 877 **/
824static int exit_section_ref_ok(const char *name) 878static int exit_section_ref_ok(const char *name)
825{ 879{
@@ -829,6 +883,7 @@ static int exit_section_ref_ok(const char *name)
829 ".exit.text", 883 ".exit.text",
830 ".exit.data", 884 ".exit.data",
831 ".init.text", 885 ".init.text",
886 ".rodata",
832 ".opd", /* See comment [OPD] */ 887 ".opd", /* See comment [OPD] */
833 ".toc1", /* used by ppc64 */ 888 ".toc1", /* used by ppc64 */
834 ".altinstructions", 889 ".altinstructions",
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
index b14255c72a37..861d866fcd83 100644
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -21,6 +21,7 @@
21#define ELF_ST_BIND ELF32_ST_BIND 21#define ELF_ST_BIND ELF32_ST_BIND
22#define ELF_ST_TYPE ELF32_ST_TYPE 22#define ELF_ST_TYPE ELF32_ST_TYPE
23 23
24#define Elf_Rel Elf32_Rel
24#define Elf_Rela Elf32_Rela 25#define Elf_Rela Elf32_Rela
25#define ELF_R_SYM ELF32_R_SYM 26#define ELF_R_SYM ELF32_R_SYM
26#define ELF_R_TYPE ELF32_R_TYPE 27#define ELF_R_TYPE ELF32_R_TYPE
@@ -34,11 +35,31 @@
34#define ELF_ST_BIND ELF64_ST_BIND 35#define ELF_ST_BIND ELF64_ST_BIND
35#define ELF_ST_TYPE ELF64_ST_TYPE 36#define ELF_ST_TYPE ELF64_ST_TYPE
36 37
38#define Elf_Rel Elf64_Rel
37#define Elf_Rela Elf64_Rela 39#define Elf_Rela Elf64_Rela
38#define ELF_R_SYM ELF64_R_SYM 40#define ELF_R_SYM ELF64_R_SYM
39#define ELF_R_TYPE ELF64_R_TYPE 41#define ELF_R_TYPE ELF64_R_TYPE
40#endif 42#endif
41 43
44/* The 64-bit MIPS ELF ABI uses an unusual reloc format. */
45typedef struct
46{
47 Elf32_Word r_sym; /* Symbol index */
48 unsigned char r_ssym; /* Special symbol for 2nd relocation */
49 unsigned char r_type3; /* 3rd relocation type */
50 unsigned char r_type2; /* 2nd relocation type */
51 unsigned char r_type1; /* 1st relocation type */
52} _Elf64_Mips_R_Info;
53
54typedef union
55{
56 Elf64_Xword r_info_number;
57 _Elf64_Mips_R_Info r_info_fields;
58} _Elf64_Mips_R_Info_union;
59
60#define ELF64_MIPS_R_SYM(i) \
61 ((__extension__ (_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_sym)
62
42#if KERNEL_ELFDATA != HOST_ELFDATA 63#if KERNEL_ELFDATA != HOST_ELFDATA
43 64
44static inline void __endian(const void *src, void *dest, unsigned int size) 65static inline void __endian(const void *src, void *dest, unsigned int size)
@@ -48,8 +69,6 @@ static inline void __endian(const void *src, void *dest, unsigned int size)
48 ((unsigned char*)dest)[i] = ((unsigned char*)src)[size - i-1]; 69 ((unsigned char*)dest)[i] = ((unsigned char*)src)[size - i-1];
49} 70}
50 71
51
52
53#define TO_NATIVE(x) \ 72#define TO_NATIVE(x) \
54({ \ 73({ \
55 typeof(x) __x; \ 74 typeof(x) __x; \