2
0

902-darwin_scripts_include.patch 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. Index: linux-2.6.21.7/scripts/genksyms/parse.c_shipped
  2. ===================================================================
  3. --- linux-2.6.21.7.orig/scripts/genksyms/parse.c_shipped
  4. +++ linux-2.6.21.7/scripts/genksyms/parse.c_shipped
  5. @@ -144,7 +144,9 @@
  6. #include <assert.h>
  7. +#ifndef __APPLE__
  8. #include <malloc.h>
  9. +#endif
  10. #include "genksyms.h"
  11. static int is_typedef;
  12. Index: linux-2.6.21.7/scripts/genksyms/parse.y
  13. ===================================================================
  14. --- linux-2.6.21.7.orig/scripts/genksyms/parse.y
  15. +++ linux-2.6.21.7/scripts/genksyms/parse.y
  16. @@ -24,7 +24,9 @@
  17. %{
  18. #include <assert.h>
  19. +#ifndef __APPLE__
  20. #include <malloc.h>
  21. +#endif
  22. #include "genksyms.h"
  23. static int is_typedef;
  24. Index: linux-2.6.21.7/scripts/kallsyms.c
  25. ===================================================================
  26. --- linux-2.6.21.7.orig/scripts/kallsyms.c
  27. +++ linux-2.6.21.7/scripts/kallsyms.c
  28. @@ -30,6 +30,35 @@
  29. #include <stdlib.h>
  30. #include <string.h>
  31. #include <ctype.h>
  32. +#ifdef __APPLE__
  33. +/* Darwin has no memmem implementation, this one is ripped of the uClibc-0.9.28 source */
  34. +void *memmem (const void *haystack, size_t haystack_len,
  35. + const void *needle, size_t needle_len)
  36. +{
  37. + const char *begin;
  38. + const char *const last_possible
  39. + = (const char *) haystack + haystack_len - needle_len;
  40. +
  41. + if (needle_len == 0)
  42. + /* The first occurrence of the empty string is deemed to occur at
  43. + the beginning of the string. */
  44. + return (void *) haystack;
  45. +
  46. + /* Sanity check, otherwise the loop might search through the whole
  47. + memory. */
  48. + if (__builtin_expect (haystack_len < needle_len, 0))
  49. + return NULL;
  50. +
  51. + for (begin = (const char *) haystack; begin <= last_possible; ++begin)
  52. + if (begin[0] == ((const char *) needle)[0] &&
  53. + !memcmp ((const void *) &begin[1],
  54. + (const void *) ((const char *) needle + 1),
  55. + needle_len - 1))
  56. + return (void *) begin;
  57. +
  58. + return NULL;
  59. +}
  60. +#endif
  61. #define KSYM_NAME_LEN 127
  62. Index: linux-2.6.21.7/scripts/kconfig/Makefile
  63. ===================================================================
  64. --- linux-2.6.21.7.orig/scripts/kconfig/Makefile
  65. +++ linux-2.6.21.7/scripts/kconfig/Makefile
  66. @@ -87,6 +87,9 @@ check-lxdialog := $(srctree)/$(src)/lxd
  67. # we really need to do so. (Do not call gcc as part of make mrproper)
  68. HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
  69. HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
  70. +ifeq ($(shell uname -s),Darwin)
  71. +HOST_LOADLIBES += -lncurses
  72. +endif
  73. HOST_EXTRACFLAGS += -DLOCALE
  74. Index: linux-2.6.21.7/scripts/mod/file2alias.c
  75. ===================================================================
  76. --- linux-2.6.21.7.orig/scripts/mod/file2alias.c
  77. +++ linux-2.6.21.7/scripts/mod/file2alias.c
  78. @@ -37,7 +37,21 @@ typedef unsigned char __u8;
  79. * even potentially has different endianness and word sizes, since
  80. * we handle those differences explicitly below */
  81. #include "../../include/linux/mod_devicetable.h"
  82. +#ifndef __APPLE__
  83. #include "../../include/linux/input.h"
  84. +#else
  85. +#define EV_MAX 0x1f
  86. +#define KEY_MUTE 113
  87. +#define KEY_MIN_INTERESTING KEY_MUTE
  88. +#define KEY_MAX 0x1ff
  89. +#define REL_MAX 0x0f
  90. +#define ABS_MAX 0x3f
  91. +#define MSC_MAX 0x07
  92. +#define LED_MAX 0x0f
  93. +#define SND_MAX 0x07
  94. +#define FF_MAX 0x7f
  95. +#define SW_MAX 0x0f
  96. +#endif
  97. #define ADD(str, sep, cond, field) \
  98. do { \
  99. Index: linux-2.6.21.7/scripts/mod/mk_elfconfig.c
  100. ===================================================================
  101. --- linux-2.6.21.7.orig/scripts/mod/mk_elfconfig.c
  102. +++ linux-2.6.21.7/scripts/mod/mk_elfconfig.c
  103. @@ -1,7 +1,11 @@
  104. #include <stdio.h>
  105. #include <stdlib.h>
  106. #include <string.h>
  107. +#ifndef __APPLE__
  108. #include <elf.h>
  109. +#else
  110. +#include "../../../../../tools/sstrip/include/elf.h"
  111. +#endif
  112. int
  113. main(int argc, char **argv)
  114. Index: linux-2.6.21.7/scripts/mod/modpost.h
  115. ===================================================================
  116. --- linux-2.6.21.7.orig/scripts/mod/modpost.h
  117. +++ linux-2.6.21.7/scripts/mod/modpost.h
  118. @@ -7,7 +7,11 @@
  119. #include <sys/mman.h>
  120. #include <fcntl.h>
  121. #include <unistd.h>
  122. +#ifndef __APPLE__
  123. #include <elf.h>
  124. +#else
  125. +#include "../../../../../tools/sstrip/include/elf.h"
  126. +#endif
  127. #include "elfconfig.h"
  128. Index: linux-2.6.21.7/scripts/mod/sumversion.c
  129. ===================================================================
  130. --- linux-2.6.21.7.orig/scripts/mod/sumversion.c
  131. +++ linux-2.6.21.7/scripts/mod/sumversion.c
  132. @@ -8,6 +8,9 @@
  133. #include <errno.h>
  134. #include <string.h>
  135. #include "modpost.h"
  136. +#ifdef __APPLE__
  137. +#include <limits.h>
  138. +#endif
  139. /*
  140. * Stolen form Cryptographic API.