summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xextra/scripts/fix_includes.sh45
-rw-r--r--include/features.h4
2 files changed, 29 insertions, 20 deletions
diff --git a/extra/scripts/fix_includes.sh b/extra/scripts/fix_includes.sh
index bcb679563..879bec0f1 100755
--- a/extra/scripts/fix_includes.sh
+++ b/extra/scripts/fix_includes.sh
@@ -59,46 +59,46 @@ while [ -n "$1" ]; do
esac;
done;
-if [ ! -f "$KERNEL_SOURCE/include/linux/version.h" ]; then
+if [ ! -f "$KERNEL_SOURCE/Makefile" ]; then
echo "";
echo "";
- echo "The file $KERNEL_SOURCE/include/linux/version.h is missing!";
- echo "Perhaps you forgot to configure your kernel source?"
+ echo "The file $KERNEL_SOURCE/Makefile is missing!";
+ echo "Perhaps your kernel source is broken?"
echo "";
echo "";
exit 1;
fi;
-if [ ! -d "$KERNEL_SOURCE" ]; then
+if [ ! -d "$KERNEL_SOURCE" ]; then
echo "";
echo "";
- echo "$KERNEL_SOURCE is not a directory";
+ echo "$KERNEL_SOURCE is not a directory";
echo "";
echo "";
exit 1;
fi;
-KVER=`gcc -I$KERNEL_SOURCE/include -E -dM $KERNEL_SOURCE/include/linux/version.h | grep UTS_RELEASE | awk '{ print $3 }' | sed 's/\"//g'`
+# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTERVERSION
+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`
+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
+fi
+
+echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION}"
-if [ -z "$KVER" ] ; then
- echo "";
- echo "";
- echo "Unable to determine kernel version."
- echo "Perhaps your kernel source tree is broken?"
- echo "";
- echo "";
- exit 1;
-fi;
echo -e "\n"
-echo "Using kernel headers from $KVER for architecture '$TARGET_ARCH'"
+echo "Using kernel headers from $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION} for architecture '$TARGET_ARCH'"
echo -e "\tprovided in directory $KERNEL_SOURCE"
echo -e "\n"
# Create a symlink to include/asm
-rm -f include/asm
-if [ ! -d "$KERNEL_SOURCE/include/asm" ]; then
+rm -f include/asm*
+if [ ! -d "$KERNEL_SOURCE/include/asm" ]; then
echo "";
echo "";
echo "The symlink $KERNEL_SOURCE/include/asm is missing\!";
@@ -106,7 +106,7 @@ if [ ! -d "$KERNEL_SOURCE/include/asm" ]; then
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 "Attempting to guess a usable value....";
echo ""
echo "";
sleep 1;
@@ -123,7 +123,7 @@ if [ ! -d "$KERNEL_SOURCE/include/asm" ]; 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 $KERNEL_SOURCE/include/asm-arm/proc ] ; then
if [ ! -L proc ] ; then
(cd include/asm;
ln -fs proc-armv proc;
@@ -155,6 +155,11 @@ ln -fs $KERNEL_SOURCE/include/asm include/asm
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;
+
# Create the include/linux and include/scsi symlinks.
rm -f include/linux
diff --git a/include/features.h b/include/features.h
index f13a76f19..bd97d38f9 100644
--- a/include/features.h
+++ b/include/features.h
@@ -446,4 +446,8 @@ uClibc was built without large file support enabled.
# define __linux__ 1
#endif
+/* Disable __user, which shows up in 2.6.x include asm headers
+ * that get pulled in by signal.h */
+#define __user
+
#endif /* features.h */