This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Add support for using headers_install target in new kernels


Newer Linux kernels (2.6.18 and greater) have a make target the exports the kernel headers. If we are building with a newer kernel use the headers_install make target.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

Index: crosstool.sh
===================================================================
--- crosstool.sh	(revision 9)
+++ crosstool.sh	(working copy)
@@ -325,40 +325,58 @@
 # autodetect kernel version from contents of Makefile
 KERNEL_VERSION=`awk '/^VERSION =/ { print $3 }' $LINUX_HEADER_DIR/Makefile`
 KERNEL_PATCHLEVEL=`awk '/^PATCHLEVEL =/ { print $3 }' $LINUX_HEADER_DIR/Makefile`
+KERNEL_SUBLEVEL=`awk '/^SUBLEVEL =/ { print $3 }' $LINUX_HEADER_DIR/Makefile`
+KERNEL_HAS_HEADERS_INSTALL=""

case "$KERNEL_VERSION.$KERNEL_PATCHLEVEL.x" in
2.2.x|2.4.x) make ARCH=$ARCH symlinks include/linux/version.h
+ cp -r include/asm-generic $HEADERDIR/asm-generic
;;
-2.6.x) case $ARCH in
- sh*) # sh does secret stuff in 'make prepare' that can't be triggered separately,
- # but happily, it doesn't use target gcc, so we can use it.
- # Update: this fails on 2.6.11, as it installs elfconfig.h, which requires target compiler :-(
- make ARCH=$ARCH prepare include/linux/version.h
- ;;
- arm*|cris*) make ARCH=$ARCH include/asm include/linux/version.h include/asm-$ARCH/.arch
- ;;
- mips*) # for linux-2.6, 'make prepare' for mips doesn't - # actually create any symlinks. Hope generic is ok.
- # Note that glibc ignores all -I flags passed in CFLAGS,
- # so you have to use -isystem.
- make ARCH=$ARCH include/asm include/linux/version.h
- TARGET_CFLAGS="$TARGET_CFLAGS -isystem $LINUX_HEADER_DIR/include/asm-mips/mach-generic"
- ;;
- *) make ARCH=$ARCH include/asm include/linux/version.h
- ;;
+2.6.x) case $KERNEL_SUBLEVEL in
+ 1[8-9]|[2-9][0-9]) # kernel versions 2.6.18 and greater
+ KERNEL_HAS_HEADERS_INSTALL="yes"
+ case $ARCH in
+ ppc*) ARCH=powerpc ;; # ppc & ppc64 merged into powerpc
+ esac
+ make ARCH=$ARCH INSTALL_HDR_PATH=$HEADERDIR/.. headers_install
+ ;;
+ [0-9]|1[0-7]) # kernel versions 2.6.0 to 2.6.17
+ case $ARCH in
+ sh*) # sh does secret stuff in 'make prepare' that can't be triggered separately,
+ # but happily, it doesn't use target gcc, so we can use it.
+ # Update: this fails on 2.6.11, as it installs elfconfig.h, which requires target compiler :-(
+ make ARCH=$ARCH prepare include/linux/version.h
+ ;;
+ arm*|cris*) make ARCH=$ARCH include/asm include/linux/version.h include/asm-$ARCH/.arch
+ ;;
+ mips*) # for linux-2.6, 'make prepare' for mips doesn't + # actually create any symlinks. Hope generic is ok.
+ # Note that glibc ignores all -I flags passed in CFLAGS,
+ # so you have to use -isystem.
+ make ARCH=$ARCH include/asm include/linux/version.h
+ TARGET_CFLAGS="$TARGET_CFLAGS -isystem $LINUX_HEADER_DIR/include/asm-mips/mach-generic"
+ ;;
+ *) make ARCH=$ARCH include/asm include/linux/version.h
+ ;;
+ esac
+ cp -r include/asm-generic $HEADERDIR/asm-generic
+ ;;
+ *) abort "Unsupported kernel version $KERNEL_VERSION.$KERNEL_PATCHLEVEL.$KERNEL_SUBLEVEL"
+ ;;
esac
;;
*) abort "Unsupported kernel version $KERNEL_VERSION.$KERNEL_PATCHLEVEL"
+ ;;
esac
-cp -r include/asm-generic $HEADERDIR/asm-generic


fi # test -z "$LINUX_SANITIZED_HEADER_DIR"

-cp -r include/linux $HEADERDIR
-cp -r include/asm-${ARCH} $HEADERDIR/asm
+if test -z "${KERNEL_HAS_HEADERS_INSTALL}" ; then
+    cp -r include/linux $HEADERDIR
+    cp -r include/asm-${ARCH} $HEADERDIR/asm
+fi

 cd $BUILD_DIR
-
 #---------------------------------------------------------
 echo Build binutils

Index: gcc-4.1.1-glibc-2.3.6-tls.dat
===================================================================
--- gcc-4.1.1-glibc-2.3.6-tls.dat	(revision 9)
+++ gcc-4.1.1-glibc-2.3.6-tls.dat	(working copy)
@@ -2,8 +2,7 @@
 GCC_CORE_DIR=gcc-3.3.6
 GCC_DIR=gcc-4.1.1
 GLIBC_DIR=glibc-2.3.6
-LINUX_DIR=linux-2.6.15.4
-LINUX_SANITIZED_HEADER_DIR=linux-libc-headers-2.6.12.0
+LINUX_DIR=linux-2.6.18.2
 GLIBCTHREADS_FILENAME=glibc-linuxthreads-2.3.6
 GDB_DIR=gdb-6.5
 GLIBC_EXTRA_CONFIG="$GLIBC_EXTRA_CONFIG --with-tls --with-__thread  --enable-kernel=2.4.18"

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]