summaryrefslogtreecommitdiffstats
path: root/toolchain/uClibc/fix_includes-uClibc-0.9.28.patch
blob: 52c89678e153fdcb953a9466c9f89abe17989715 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
--- uClibc-0.9.28/Makefile.orig	2006-12-11 21:06:42.000000000 -0700
+++ uClibc-0.9.28/Makefile	2006-12-11 21:06:53.000000000 -0700
@@ -158,7 +158,7 @@
 	$(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib
 	$(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include
 	-$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/
-	if [ "$(KERNEL_SOURCE)" == "$(DEVEL_PREFIX)" ] ; then \
+	if [ "$(KERNEL_SOURCE)" = "$(DEVEL_PREFIX)" ] ; then \
 		extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \
 	else \
 		extra_exclude="" ; \
--- uClibc-0.9.28/extra/scripts/fix_includes.sh.orig	2006-12-13 05:44:21.000000000 -0700
+++ uClibc-0.9.28/extra/scripts/fix_includes.sh	2006-12-13 05:44:35.000000000 -0700
@@ -1,183 +1,155 @@
 #!/bin/sh
-# Copyright (C) 2003 Erik Andersen <andersen@uclibc.org>
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later
-# version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General
-# Public License along with this program; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
-# Boston, MA 02111-1307 USA
-
-usage () {
-    echo ""
-    echo "usage: "`basename $0`" -k KERNEL_SOURCE_DIRECTORY -t TARGET_ARCH"
-    echo ""
-    echo "This utility scans the KERNEL_SOURCE_DIRECTORY directory and"
-    echo "checks that it contains well formed kernel headers suitable"
-    echo "for inclusion as the include/linux/ directory provided by"
-    echo "uClibc."
-    echo ""
-    echo "If the specified kernel headers are present and already"
-    echo "configured for the architecture specified by TARGET_ARCH,"
-    echo "they will be used as-is."
-    echo ""
-    echo "If the specified kernel headers are missing entirely, this"
-    echo "script will return an error."
-    echo ""
-    echo "If the specified kernel headers are present, but are either"
-    echo "not yet configured or are configured for an architecture"
-    echo "different than that specified by TARGET_ARCH, this script"
-    echo "will attempt to 'fix' the kernel headers and make them"
-    echo "suitable for use by uClibc.  This fixing process may fail."
-    echo "It is therefore best to always provide kernel headers that"
-    echo "are already configured for the selected architecture."
-    echo ""
-    echo "Most Linux distributions provide 'kernel-headers' packages"
-    echo "that are suitable for use by uClibc."
-    echo ""
-    echo ""
-    exit 1;
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+usage() {
+	echo ""
+	echo "usage: "`basename $0`" -k KERNEL_SOURCE_DIRECTORY -t TARGET_ARCH"
+	echo ""
+	echo "This utility scans the KERNEL_SOURCE_DIRECTORY directory and"
+	echo "checks that it contains well formed kernel headers suitable"
+	echo "for inclusion as the include/linux/ directory provided by"
+	echo "uClibc."
+	echo ""
+	echo "If the specified kernel headers are present and already"
+	echo "configured for the architecture specified by TARGET_ARCH,"
+	echo "they will be used as-is."
+	echo ""
+	echo "If the specified kernel headers are missing entirely, this"
+	echo "script will return an error."
+	echo ""
+	echo "If the specified kernel headers are present, but are either"
+	echo "not yet configured or are configured for an architecture"
+	echo "different than that specified by TARGET_ARCH, this script"
+	echo "will attempt to 'fix' the kernel headers and make them"
+	echo "suitable for use by uClibc.  This fixing process may fail."
+	echo "It is therefore best to always provide kernel headers that"
+	echo "are already configured for the selected architecture."
+	echo ""
+	echo "Most Linux distributions provide 'kernel-headers' packages"
+	echo "that are suitable for use by uClibc."
+	echo ""
+	echo ""
+	exit 1
 }
 
-HAS_MMU="y";
+
+#
+# Parse our arguments
+#
+HAS_MMU="y"
 while [ -n "$1" ]; do
-    case $1 in
-	-k ) shift; if [ -n "$1" ]; then KERNEL_SOURCE=$1; shift; else usage; fi; ;;
-	-t ) shift; if [ -n "$1" ]; then TARGET_ARCH=$1; shift; else usage; fi; ;;
-	-n ) shift; HAS_MMU="n"; ;;
-	-* ) usage; ;;
-	* ) usage; ;;
-    esac;
-done;
+	case $1 in
+		-k ) shift; if [ -n "$1" ]; then KERNEL_SOURCE=$1; shift; else usage; fi; ;;
+		-t ) shift; if [ -n "$1" ]; then TARGET_ARCH=$1; shift; else usage; fi; ;;
+		-n ) shift; HAS_MMU="n"; ;;
+		-* ) usage; ;;
+		* ) usage; ;;
+	esac
+done
 
-if [ ! -f "$KERNEL_SOURCE/Makefile" -a ! -f "$KERNEL_SOURCE/include/linux/version.h" ]; then
-    echo "";
-    echo "";
-    echo "The file $KERNEL_SOURCE/Makefile or $KERNEL_SOURCE/include/linux/version.h is missing!";
-    echo "Perhaps your kernel source is broken?"
-    echo "";
-    echo "";
-    exit 1;
-fi;
 
-if [ ! -d "$KERNEL_SOURCE" ]; then
-    echo "";
-    echo "";
-    echo "$KERNEL_SOURCE is not a directory";
-    echo "";
-    echo "";
-    exit 1;
-fi;
-
-if [ -f "$KERNEL_SOURCE/Makefile" ] ; then
-# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION
-eval `sed -n -e 's/^\([A-Z]*\) = \([0-9]*\)$/\1=\2/p' -e 's/^\([A-Z]*\) = \(-[-a-z0-9]*\)$/\1=\2/p' $KERNEL_SOURCE/Makefile`
-else
-ver=`grep UTS_RELEASE $KERNEL_SOURCE/include/linux/version.h | cut -d '"' -f 2`
-VERSION=`echo "$ver" | cut -d '.' -f 1`
-PATCHLEVEL=`echo "$ver" | cut -d '.' -f 2`
-if echo "$ver" | grep -q '-' ; then
-SUBLEVEL=`echo "$ver" | sed "s/${VERSION}.${PATCHLEVEL}.//" | cut -d '-' -f 1`
-EXTRAVERSION=`echo "$ver" | sed "s/${VERSION}.${PATCHLEVEL}.${SUBLEVEL}-//"`
-else
-SUBLEVEL=`echo "$ver" | cut -d '.' -f 3`
-#EXTRAVERSION=
-fi
+#
+# Perform some sanity checks on our kernel sources
+#
+if [ ! -f "$KERNEL_SOURCE/Makefile" -a ! -f "$KERNEL_SOURCE/include/linux/version.h" ]; then
+	echo ""
+	echo ""
+	echo "The file $KERNEL_SOURCE/Makefile or $KERNEL_SOURCE/include/linux/version.h is missing!"
+	echo "Perhaps your kernel source is broken?"
+	echo ""
+	echo ""
+	exit 1
 fi
-if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ]
-then
-    echo "Unable to determine version for kernel headers"
-    echo -e "\tprovided in directory $KERNEL_SOURCE"
-    exit 1
+if [ ! -d "$KERNEL_SOURCE" ]; then
+	echo ""
+	echo ""
+	echo "$KERNEL_SOURCE is not a directory"
+	echo ""
+	echo ""
+	exit 1
 fi
 
-if [ "$MAKE_IS_SILENT" != "y" ]; then
-echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION}"
-echo -e "\n"
-echo "Using kernel headers from $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION} for architecture '$TARGET_ARCH'"
-echo -e "\tprovided in directory $KERNEL_SOURCE"
-echo -e "\n"
-fi
 
+#
 # Create a symlink to include/asm
-
+#
 rm -f include/asm*
 if [ ! -d "$KERNEL_SOURCE/include/asm" ]; then
-    echo "";
-    echo "";
-    echo "The symlink $KERNEL_SOURCE/include/asm is missing\!";
-    echo "Perhaps you forgot to configure your kernel source?";
-    echo "You really should configure your kernel source tree so I";
-    echo "do not have to try and guess about this sort of thing.";
-    echo ""
-    echo "Attempting to guess a usable value....";
-    echo ""
-    echo "";
-    sleep 1;
-
-    if [ "$TARGET_ARCH" = "powerpc" ];then
-	set -x;
-	ln -fs $KERNEL_SOURCE/include/asm-ppc include/asm;
-	set +x;
-    elif [ "$TARGET_ARCH" = "mips" ];then
-	set -x;
-	ln -fs $KERNEL_SOURCE/include/asm-mips include/asm;
-	set +x;
-    elif [ "$TARGET_ARCH" = "arm" ];then
-	set -x;
-	ln -fs $KERNEL_SOURCE/include/asm-arm include/asm;
-	set +x;
-	if [ ! -L $KERNEL_SOURCE/include/asm-arm/proc ] ; then
-	    if [ ! -L proc ] ; then
-		(cd include/asm;
-		ln -fs proc-armv proc;
-		ln -fs arch-ebsa285 arch);
-	    fi
+	echo ""
+	echo ""
+	echo "The symlink $KERNEL_SOURCE/include/asm is missing\!"
+	echo "Perhaps you forgot to configure your kernel source?"
+	echo "You really should configure your kernel source tree so I"
+	echo "do not have to try and guess about this sort of thing."
+	echo ""
+	echo "Attempting to guess a usable value...."
+	echo ""
+	echo ""
+	sleep 1
+
+	if [ "$TARGET_ARCH" = "powerpc" ]; then
+		set -x
+		ln -fs $KERNEL_SOURCE/include/asm-ppc include/asm
+		set +x
+	elif [ "$TARGET_ARCH" = "mips" ]; then
+		set -x
+		ln -fs $KERNEL_SOURCE/include/asm-mips include/asm
+		set +x
+	elif [ "$TARGET_ARCH" = "arm" ]; then
+		set -x
+		ln -fs $KERNEL_SOURCE/include/asm-arm include/asm
+		set +x
+	if [ ! -L $KERNEL_SOURCE/include/asm-arm/proc ]; then
+		if [ ! -L proc ]; then
+			(
+				cd include/asm
+				ln -fs proc-armv proc
+				ln -fs arch-ebsa285 arch
+			)
+		fi
+	fi
+	elif [ "$TARGET_ARCH" = "cris" ]; then
+		set -x
+		ln -fs $KERNEL_SOURCE/include/asm-cris include/asm
+		set +x
+	elif [ "$HAS_MMU" != "y" ]; then
+		if [ -d $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu ]; then
+			set -x
+			ln -fs $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu include/asm
+			set +x
+		else
+			set -x
+			ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm
+			set +x
+		fi
+	else
+		set -x
+		ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm
+		set +x
 	fi;
-    elif [ "$TARGET_ARCH" = "cris" ]; then
-	set -x;
-	ln -fs $KERNEL_SOURCE/include/asm-cris include/asm;
-	set +x;
-    elif [ "$HAS_MMU" != "y" ]; then
-	    if [ -d $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu ] ; then
-		set -x;
-		ln -fs $KERNEL_SOURCE/include/asm-${TARGET_ARCH}nommu include/asm;
-		set +x;
-	    else
-		set -x;
-		ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm;
-		set +x;
-	    fi;
-    else
-	set -x;
-	ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm;
-	set +x;
-    fi;
 else
-# No guessing required.....
-ln -fs $KERNEL_SOURCE/include/asm include/asm
-if [ -e $KERNEL_SOURCE/include/asm-$TARGET_ARCH ] ; then
-ln -fs $KERNEL_SOURCE/include/asm-$TARGET_ARCH include/asm-$TARGET_ARCH
+	# No guessing required.....
+	for x in $KERNEL_SOURCE/include/asm* ; do
+		ln -fs ${x} include/
+	done
 fi
-fi;
 
 
+#
 # Annoyingly, 2.6.x kernel headers also need an include/asm-generic/ directory
-if [ $VERSION -eq 2 ] && [ $PATCHLEVEL -ge 6 ] ; then
-    ln -fs $KERNEL_SOURCE/include/asm-generic include/asm-generic
-fi;
+#
+if [ -e $KERNEL_SOURCE/include/asm-generic ]; then
+	rm -f include/asm-generic
+	ln -fs $KERNEL_SOURCE/include/asm-generic include/asm-generic
+fi
 
 
+#
 # Create the include/linux symlink.
+#
 rm -f include/linux
 ln -fs $KERNEL_SOURCE/include/linux include/linux
-