902-darwin_scripts_include.patch 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. diff -urN linux-2.6.21.1.old/scripts/genksyms/parse.c_shipped linux-2.6.21.1.dev/scripts/genksyms/parse.c_shipped
  2. --- linux-2.6.21.1.old/scripts/genksyms/parse.c_shipped 2007-04-27 23:49:26.000000000 +0200
  3. +++ linux-2.6.21.1.dev/scripts/genksyms/parse.c_shipped 2007-05-26 21:26:23.565690112 +0200
  4. @@ -144,7 +144,9 @@
  5. #include <assert.h>
  6. +#ifndef __APPLE__
  7. #include <malloc.h>
  8. +#endif
  9. #include "genksyms.h"
  10. static int is_typedef;
  11. diff -urN linux-2.6.21.1.old/scripts/genksyms/parse.y linux-2.6.21.1.dev/scripts/genksyms/parse.y
  12. --- linux-2.6.21.1.old/scripts/genksyms/parse.y 2007-04-27 23:49:26.000000000 +0200
  13. +++ linux-2.6.21.1.dev/scripts/genksyms/parse.y 2007-05-26 21:26:23.563690416 +0200
  14. @@ -24,7 +24,9 @@
  15. %{
  16. #include <assert.h>
  17. +#ifndef __APPLE__
  18. #include <malloc.h>
  19. +#endif
  20. #include "genksyms.h"
  21. static int is_typedef;
  22. diff -urN linux-2.6.21.1.old/scripts/kallsyms.c linux-2.6.21.1.dev/scripts/kallsyms.c
  23. --- linux-2.6.21.1.old/scripts/kallsyms.c 2007-04-27 23:49:26.000000000 +0200
  24. +++ linux-2.6.21.1.dev/scripts/kallsyms.c 2007-05-26 21:26:23.579687984 +0200
  25. @@ -30,6 +30,35 @@
  26. #include <stdlib.h>
  27. #include <string.h>
  28. #include <ctype.h>
  29. +#ifdef __APPLE__
  30. +/* Darwin has no memmem implementation, this one is ripped of the uClibc-0.9.28 source */
  31. +void *memmem (const void *haystack, size_t haystack_len,
  32. + const void *needle, size_t needle_len)
  33. +{
  34. + const char *begin;
  35. + const char *const last_possible
  36. + = (const char *) haystack + haystack_len - needle_len;
  37. +
  38. + if (needle_len == 0)
  39. + /* The first occurrence of the empty string is deemed to occur at
  40. + the beginning of the string. */
  41. + return (void *) haystack;
  42. +
  43. + /* Sanity check, otherwise the loop might search through the whole
  44. + memory. */
  45. + if (__builtin_expect (haystack_len < needle_len, 0))
  46. + return NULL;
  47. +
  48. + for (begin = (const char *) haystack; begin <= last_possible; ++begin)
  49. + if (begin[0] == ((const char *) needle)[0] &&
  50. + !memcmp ((const void *) &begin[1],
  51. + (const void *) ((const char *) needle + 1),
  52. + needle_len - 1))
  53. + return (void *) begin;
  54. +
  55. + return NULL;
  56. +}
  57. +#endif
  58. #define KSYM_NAME_LEN 127
  59. diff -urN linux-2.6.21.1.old/scripts/kconfig/Makefile linux-2.6.21.1.dev/scripts/kconfig/Makefile
  60. --- linux-2.6.21.1.old/scripts/kconfig/Makefile 2007-04-27 23:49:26.000000000 +0200
  61. +++ linux-2.6.21.1.dev/scripts/kconfig/Makefile 2007-05-26 21:26:23.553691936 +0200
  62. @@ -87,6 +87,9 @@
  63. # we really need to do so. (Do not call gcc as part of make mrproper)
  64. HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
  65. HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
  66. +ifeq ($(shell uname -s),Darwin)
  67. +HOST_LOADLIBES += -lncurses
  68. +endif
  69. HOST_EXTRACFLAGS += -DLOCALE
  70. diff -urN linux-2.6.21.1.old/scripts/mod/mk_elfconfig.c linux-2.6.21.1.dev/scripts/mod/mk_elfconfig.c
  71. --- linux-2.6.21.1.old/scripts/mod/mk_elfconfig.c 2007-04-27 23:49:26.000000000 +0200
  72. +++ linux-2.6.21.1.dev/scripts/mod/mk_elfconfig.c 2007-05-26 21:26:23.553691936 +0200
  73. @@ -1,7 +1,11 @@
  74. #include <stdio.h>
  75. #include <stdlib.h>
  76. #include <string.h>
  77. +#ifndef __APPLE__
  78. #include <elf.h>
  79. +#else
  80. +#include "../../../../../tools/sstrip/include/elf.h"
  81. +#endif
  82. int
  83. main(int argc, char **argv)
  84. diff -urN linux-2.6.21.1.old/scripts/mod/modpost.h linux-2.6.21.1.dev/scripts/mod/modpost.h
  85. --- linux-2.6.21.1.old/scripts/mod/modpost.h 2007-04-27 23:49:26.000000000 +0200
  86. +++ linux-2.6.21.1.dev/scripts/mod/modpost.h 2007-05-26 21:26:23.553691936 +0200
  87. @@ -7,7 +7,11 @@
  88. #include <sys/mman.h>
  89. #include <fcntl.h>
  90. #include <unistd.h>
  91. +#ifndef __APPLE__
  92. #include <elf.h>
  93. +#else
  94. +#include "../../../../../tools/sstrip/include/elf.h"
  95. +#endif
  96. #include "elfconfig.h"